Package edu.cnu.mdi.mapping.render
Class Etopo5Renderer
java.lang.Object
edu.cnu.mdi.mapping.render.Etopo5Renderer
Renders ETOPO5 terrain and bathymetry using the active map projection.
The renderer samples the visible screen area rather than projecting the complete ETOPO5 grid. Each screen block is converted back to geographic coordinates, sampled from the ETOPO5 data set, and filled with an elevation or bathymetry color.
The renderer owns display settings such as opacity and sampling step but does
not own an MDI layer. A MapView2D may place this renderer on any
ordinary Layer.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final floatDefault terrain opacity.static final intDefault screen-space sampling step in pixels. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondoublegetElevation(double latitudeDeg, double longitudeDeg) Returns interpolated elevation or bathymetry.floatReturns the terrain opacity.intgetStep()Returns the screen-space sampling step.voidrender(Graphics2D g2, IContainer container, IMapProjection projection) Renders the visible portion of the ETOPO5 data.voidsetOpacity(double opacity) Sets the terrain opacity.voidsetStep(int step) Sets the screen-space sampling step.
-
Field Details
-
DEFAULT_OPACITY
public static final float DEFAULT_OPACITYDefault terrain opacity.- See Also:
-
DEFAULT_STEP
public static final int DEFAULT_STEPDefault screen-space sampling step in pixels.- See Also:
-
-
Constructor Details
-
Etopo5Renderer
Creates an ETOPO5 renderer.- Parameters:
loader- loaded ETOPO5 data; must not benull
-
-
Method Details
-
render
Renders the visible portion of the ETOPO5 data.- Parameters:
g2- graphics contextcontainer- map containerprojection- active map projection
-
getElevation
public double getElevation(double latitudeDeg, double longitudeDeg) Returns interpolated elevation or bathymetry.- Parameters:
latitudeDeg- latitude in degreeslongitudeDeg- longitude in degrees- Returns:
- elevation in metres, or
NaNif unavailable or either coordinate is non-finite
-
getOpacity
public float getOpacity()Returns the terrain opacity.- Returns:
- opacity in the range [0, 1]
-
setOpacity
public void setOpacity(double opacity) Sets the terrain opacity.- Parameters:
opacity- opacity in the range [0, 1]
-
getStep
public int getStep()Returns the screen-space sampling step.- Returns:
- step in pixels
-
setStep
public void setStep(int step) Sets the screen-space sampling step.Smaller values produce smoother terrain but require more projection and elevation calculations.
- Parameters:
step- step in pixels; must be positive
-