Package com.luciad.earth.util
Class TLcdEarthTerrainElevationProvider
java.lang.Object
com.luciad.earth.util.ALcdEarthTerrainElevationProvider
com.luciad.earth.util.TLcdEarthTerrainElevationProvider
An
ALcdEarthTerrainElevationProvider
that can handle multiple models
with elevation data.
In most cases the more recent ILcdHeightProvider
and ILcdModelHeightProviderFactory
interfaces should be preferred over this class. The functionality of this class is equivalent
to using a TLcdEarthHeightProviderFactory
and
TLcdImageModelHeightProviderFactory
to create a height provider
for each model and combining those with a TLcdCompositeHeightProvider
.
This class is optimized for the case where all models
have the same model reference. If this is not the case, the elevation
provider still works but will do so with reduced performance due to the need
for additional transformations.
The order of the elevation model determines their relative importance for computing the result of
retrieveElevationAt(com.luciad.shape.ILcdPoint, com.luciad.reference.ILcdGeoReference, double)
: the lower the index, the higher the importance. There is no
particular order within a single model but this elevation provider always uses the most-detailed
level in a ILcdMultilevelRaster
and the most-detailed level that is available in a
ILcdEarthTileSet
.
This class is thread-safe.- Since:
- 8.2
- See Also:
-
Constructor Summary
ConstructorDescriptionCreates a newTLcdEarthTerrainElevationProvider
with no elevation models.TLcdEarthTerrainElevationProvider
(Vector aElevationModels) Creates a newTLcdEarthTerrainElevationProvider
with the specified elevation models. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addElevationModel
(int aIndex, ILcdModel aElevationModel) Adds the specified elevation model at the specified index.void
addElevationModel
(ILcdModel aElevationModel) Adds the specified elevation model at the end.getElevationModel
(int aIndex) Returns the elevation model at the specified index.int
Returns the number of elevation models.Returns the preferred reference for this elevation provider.int
Returns the index of the specified elevation model or -1 if it is not present.boolean
isSupportedElevationModel
(ILcdModel aModel) Returns whether a model contains elevation data that can be used.removeElevationModel
(int aIndex) Removes the elevation model at the specified index.double
retrieveElevationAt
(ILcdPoint aPoint, ILcdGeoReference aGeoReference) Returns the elevation for a given location, defined in meters above mean sea level.double
retrieveElevationAt
(ILcdPoint aPoint, ILcdGeoReference aPointReference, double aDesiredResolution) Returns the elevation for a given location, defined in meters above mean sea level.
-
Constructor Details
-
TLcdEarthTerrainElevationProvider
public TLcdEarthTerrainElevationProvider()Creates a newTLcdEarthTerrainElevationProvider
with no elevation models. -
TLcdEarthTerrainElevationProvider
Creates a newTLcdEarthTerrainElevationProvider
with the specified elevation models.- Parameters:
aElevationModels
-ILcdModel
objects containing elevation data.
-
-
Method Details
-
isSupportedElevationModel
Returns whether a model contains elevation data that can be used. This elevation provider only supports models which have a proper model descriptor and contain eitherILcdRaster
,ILcdMultilevelRaster
orILcdEarthTileSet
elements.- Parameters:
aModel
- the model that should be tested.- Returns:
- true if a
aModel
contains supported elevation data.
-
getElevationModelCount
public int getElevationModelCount()Returns the number of elevation models.- Returns:
- the number of elevation models.
-
addElevationModel
Adds the specified elevation model at the end.- Parameters:
aElevationModel
- the elevation model to add.- Throws:
IllegalArgumentException
- if the specified model is not supported (seeisSupportedElevationModel(com.luciad.model.ILcdModel)
).
-
addElevationModel
Adds the specified elevation model at the specified index.- Parameters:
aIndex
- an index in [0,getElevationModelCount()
].aElevationModel
- the elevation model to add.- Throws:
IllegalArgumentException
- if the specified model is not supported (seeisSupportedElevationModel(com.luciad.model.ILcdModel)
).
-
getElevationModel
Returns the elevation model at the specified index.- Parameters:
aIndex
- an index in [0,getElevationModelCount()
[.- Returns:
- the elevation model at the specified index.
-
removeElevationModel
Removes the elevation model at the specified index.- Parameters:
aIndex
- an index in [0,getElevationModelCount()
[.- Returns:
- the elevation model that was removed.
-
indexOf
Returns the index of the specified elevation model or -1 if it is not present.- Parameters:
aModel
- the elevation model.- Returns:
- an index in [0,
getElevationModelCount()
[ or -1.
-
retrieveElevationAt
public double retrieveElevationAt(ILcdPoint aPoint, ILcdGeoReference aPointReference, double aDesiredResolution) Description copied from class:ALcdEarthTerrainElevationProvider
Returns the elevation for a given location, defined in meters above mean sea level. If the elevation cannot be determined, this method returns NaN. TheaDesiredResolution
parameter can be used to indicate to the elevation provider what the desired resolution of the elevation values should be. The value should be a distance measured in units of the point reference. If an application wants to request elevations for a grid of points which are 10 units apart, for instance, it could pass a value of 10.0 inaDesiredResolution
. The elevation provider could then optimize for this particular resolution, e.g. by choosing the appropriate detail level from a multileveled elevation raster. The default implementation of this method simply delegates toALcdEarthTerrainElevationProvider.retrieveElevationAt(com.luciad.shape.ILcdPoint, com.luciad.reference.ILcdGeoReference)
and hence does not use theaDesiredResolution
parameter.- Overrides:
retrieveElevationAt
in classALcdEarthTerrainElevationProvider
- Parameters:
aPoint
- The point indicating the location for which to retrieve the elevation.aPointReference
- The reference in which the given location is defined.aDesiredResolution
- An indication of the spacing (in units of the point reference) between sample points for which elevations are being retrieved- Returns:
- the elevation for a given location, defined in meters above mean sea level, or NaN when the elevation cannot be determined.
-
retrieveElevationAt
Description copied from class:ALcdEarthTerrainElevationProvider
Returns the elevation for a given location, defined in meters above mean sea level. If the elevation cannot be determined, this method returns NaN.- Specified by:
retrieveElevationAt
in classALcdEarthTerrainElevationProvider
- Parameters:
aPoint
- The point indicating the location for which to retrieve the elevation.aGeoReference
- The reference in which the given location is defined.- Returns:
- the elevation for a given location, defined in meters above mean sea level, or NaN when the elevation cannot be determined.
-
getPreferredReference
Description copied from class:ALcdEarthTerrainElevationProvider
Returns the preferred reference for this elevation provider. This reference is the reference with the best performance when used as a parameter in the method
ALcdEarthTerrainElevationProvider.retrieveElevationAt(com.luciad.shape.ILcdPoint, com.luciad.reference.ILcdGeoReference)
. It is perfectly correct to use points with other references. It will be faster to use the preferred one.For performance reasons, the preferred reference should be the reference of the available elevation data to minimize the number of point transformations.
By default this method returns
null
, indicating that no preferred reference is available.- Overrides:
getPreferredReference
in classALcdEarthTerrainElevationProvider
- Returns:
- the preferred reference of this elevation provider. Note that this method
can return
null
if no preferred reference is available. - See Also:
-