Package com.luciad.earth.view.vertical
Class TLcdVVTerrainModel
java.lang.Object
com.luciad.view.vertical.ALcdVVModel
com.luciad.earth.view.vertical.TLcdVVTerrainModel
- All Implemented Interfaces:
ILcdVVModel
ILcdVVModel
to show a terrain profile in a Vertical View.
The preferred way of using this class is:
- call
setView
to set the view that contains the terrain data. - call
setObject
to set the object for which the profile should be displayed, and the model to which the object belongs. Note that only models with anILcdGeodeticReference
orILcdGridReference
are supported. - call
update
to update the model.
This model treats a pointlist that is an instance of TLcdLonLatBuffer
or TLcdLonLatHeightBuffer
differently: the profile height in a
point is the maximum height along a line perpendicular to the buffer axis in this point and with
length equal to the buffer width. When going from one segment to the next (a "turn"), the outside
of the turn is not covered by these perpendicular lines. Instead, the maximum inside an arc with
center at the common point between the two segments and with as radius the width of the buffer
is used.
- Since:
- 2012.1
-
Constructor Summary
ConstructorDescriptionDeprecated.call the constructor with view, model and object arguments instead to avoid partially configured modelsTLcdVVTerrainModel
(boolean aAsynchronousUpdate) Deprecated.call the constructor with view, model and object arguments instead to avoid partially configured modelsTLcdVVTerrainModel
(Object aObject, ILcdModel aModel, ILcdView aView) Creates a terrain profile model that immediately and asynchronously calculates the profile for the given object. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addPropertyChangeListener
(PropertyChangeListener aListener) Adds aPropertyChangeListener
to the list of listeners that must be notified when any of the properties of this terrain profile model changes.protected double
calculateStepSize
(int aSegmentIndex, double aSegmentDistance, ILcdPoint aSegmentPoint1, ILcdPoint aSegmentPoint2, ILcdModelReference aPointReference) This method calculates the step size using which the terrain is sampled.double
getDistance
(int aPointIndex1, int aPointIndex2) Returns the distance between two points.getModel()
Returns the model to whichgetObject
belongs.Returns the object for which the profile and terrain elevation will be displayed.double
Returns the pixel density to use for the terrain rendering.getPoint
(int aPointIndex) int
int
Returns the reference system in which the terrain profile is generated.getView()
Returns the view set in thesetView
method.boolean
double
maxZ
(int aSubProfilePointIndex, int aSegmentIndex, int aSubProfileIndex) double
minZ
(int aSubProfilePointIndex, int aSegmentIndex, int aSubProfileIndex) void
Removes aPropertyChangeListener
from the list of listeners.protected ILcdHeightProvider
retrieveHeightProvider
(Map<String, Object> aRequiredProperties, Map<String, Object> aOptionalProperties) Retrieves a height provider for the given required and optional height provider properties.protected ILcdPointList
retrievePointList
(Object aObject) Returns a point list for the given object.final void
Sets the domain object for which the profile and terrain elevation will be displayed, and the model to which the given object belongs.void
setPixelDensity
(double aPixelDensity) Sets the pixel density to use for the terrain rendering.void
setPointZ
(int aIndex, double aZ, boolean isLastInRow) This method will be called whenever a point of the main-profile is being dragged so that its Z-dimension needs to be changed.void
setTerrainProfileReference
(ILcdModelReference aTerrainProfileReference) Sets the reference system in which the terrain profile should be generated.void
Sets the given view.float
stepLenghtRatio
(int aSubProfilePointIndex, int aSegmentIndex, int aSubProfileIndex) Returns where the given sub-profile point is positioned on the X-axis.int
subProfilePointCount
(int aSegmentIndex, int aSubProfileIndex) Returns the number of points (steps) of a sub-profile for the given main profile segment.void
update()
Updates the terrain profile model.Methods inherited from class com.luciad.view.vertical.ALcdVVModel
addChangeListener, fireChangeModel, removeChangeListener
-
Constructor Details
-
TLcdVVTerrainModel
Creates a terrain profile model that immediately and asynchronously calculates the profile for the given object.- Parameters:
aObject
- the objectaModel
- the model which the object belongs toaView
- the view containing the terrain data- Since:
- 2023.0
-
TLcdVVTerrainModel
public TLcdVVTerrainModel()Deprecated.call the constructor with view, model and object arguments instead to avoid partially configured modelsCreates an uninitialized terrain profile model. This model is updated asynchronously. After creation, callsetView(com.luciad.view.ILcdView)
,setObject(Object, ILcdModel)
, and finallyupdate()
. -
TLcdVVTerrainModel
public TLcdVVTerrainModel(boolean aAsynchronousUpdate) Deprecated.call the constructor with view, model and object arguments instead to avoid partially configured modelsCreates an uninitialized terrain profile model that is updated asynchronously or asynchronously. After creation, callsetView(com.luciad.view.ILcdView)
,setObject(Object, ILcdModel)
, and finallyupdate()
.- Parameters:
aAsynchronousUpdate
-true
to make sure the terrain profile model is updated asynchronously.false
otherwise.
-
-
Method Details
-
addPropertyChangeListener
Adds aPropertyChangeListener
to the list of listeners that must be notified when any of the properties of this terrain profile model changes.- Parameters:
aListener
- the listener that from now on will be notified of all changes to properties of this terrain profile model.- See Also:
-
removePropertyChangeListener
Removes aPropertyChangeListener
from the list of listeners. This listener will no longer be notified of any changes to the properties of this terrain profile model.- Parameters:
aListener
- the listener that no longer will be notified of any changes to properties of this terrain profile model.- See Also:
-
setView
Sets the given view. After calling this method, the terrain profile model will be updated automatically whenever an elevation layer is added or removed.- Parameters:
aView
- a given view. The view must implement ILcdLayered.- Throws:
IllegalArgumentException
- if the view does not implement ILcdLayered- See Also:
-
getView
Returns the view set in thesetView
method.- Returns:
- the view set in the
setView
method. - See Also:
-
setObject
Sets the domain object for which the profile and terrain elevation will be displayed, and the model to which the given object belongs. The terrain model should be able to retrieve apoint list
from the given object. See theretrievePointList(java.lang.Object)
method for the shape types that are supported by default. Note: after calling this method, theupdate
method should be called.- Parameters:
aObject
- the object.aModel
- the model to which the given object belongs. Note that only models with anILcdGeodeticReference
orILcdGridReference
are supported.- Throws:
IllegalArgumentException
- when the given model is null and the given object is not null or when a model with an unsupported model reference is provider.- See Also:
-
getObject
Returns the object for which the profile and terrain elevation will be displayed. Note that after callingsetObject
, this method will not immediately return the passedObject
. It will only return it after theupdate
method has been called, and has finished his execution (which may be asynchronously).- Returns:
- the object for which the profile and terrain elevation will be displayed.
- See Also:
-
getModel
Returns the model to whichgetObject
belongs. Note that after callingsetObject
, this method will not immediately return the passedILcdModel
. It will only return it after theupdate
method has been called, and has finished his execution (which may be asynchronously).- Returns:
- the model to which
getObject
belongs. - See Also:
-
retrievePointList
Returns a point list for the given object. This point list is used to update the terrain profile model. By default, this method checks if the given object is one of the following.ILcdDataObject
: This method will try to find a point list in the object'sprincipal
.ILcdShape
geometry propertyILcdExtrudedShape
: This method will try to find a point list in the base shape.ILcdShapeList
: This method will try to find a point list in this shape list if it has exactly 1 shape.ILcdGeoBuffer
: This method will try to find a point list in the base shape.ILcdVariableGeoBuffer
: This method will try to find a point list in the base shape.ILcdPointList
: The object itself is returned.
- Parameters:
aObject
- the object.- Returns:
- a point list for the given point list object.
-
setTerrainProfileReference
Sets the reference system in which the terrain profile should be generated. This is the reference used to retrieve the terrain height. By default, the terrain profile reference isnull
, which means that the same reference asgetModel
is used to discretize the point list. Currently,ILcdGeodeticReference
andILcdGridReference
are supported.- Parameters:
aTerrainProfileReference
- the reference system in which the terrain profile should be generated.- See Also:
-
getTerrainProfileReference
Returns the reference system in which the terrain profile is generated.- Returns:
- the reference system in which the terrain profile is generated.
- See Also:
-
update
public void update()Updates the terrain profile model. The terrain profile model is automatically updated- when the set object is modified (or removed)
- when a layer, containing elevation data is added or removed
-
calculateStepSize
protected double calculateStepSize(int aSegmentIndex, double aSegmentDistance, ILcdPoint aSegmentPoint1, ILcdPoint aSegmentPoint2, ILcdModelReference aPointReference) This method calculates the step size using which the terrain is sampled. This step size (expressed in meters) is used to walk over the point list and retrieve the terrain height. The default implementation of this method uses a pixel density to calculate this step size.- Parameters:
aSegmentIndex
- the index of the segment for which a step size should be calculated.aSegmentDistance
- the length of the segment in metersaSegmentPoint1
- the start point of the segmentaPointReference
- the reference of the segment points.- Returns:
- the step size using which the terrain is sampled.
- Since:
- 2017.1
-
getDistance
public double getDistance(int aPointIndex1, int aPointIndex2) Returns the distance between two points. In case of a geodetic reference, this distance is expressed in meters along a great circle on the globe. In case of a grid reference, the shortest (cartesian) distance is calculate.- Specified by:
getDistance
in interfaceILcdVVModel
- Overrides:
getDistance
in classALcdVVModel
- Parameters:
aPointIndex1
- the index of the first point on the main profileaPointIndex2
- the index of the second point on the main profile- Returns:
- the distance between the 2 points along a great circle on the globe.
-
retrieveHeightProvider
protected ILcdHeightProvider retrieveHeightProvider(Map<String, Object> aRequiredProperties, Map<String, Object> aOptionalProperties) Retrieves a height provider for the given required and optional height provider properties. By default, this method usesTLcdRasterModelHeightProviderFactory
andTLcdEarthHeightProviderFactory
to create aTLcdViewHeightProvider
. This view height provider is based on the set view and properties. When the view isnull
, anIllegalArgumentException
is thrown.- Parameters:
aRequiredProperties
- the required properties used to create a height provideraOptionalProperties
- the optional properties used to create a height provider- Returns:
- a height provider.
-
setPixelDensity
public void setPixelDensity(double aPixelDensity) Sets the pixel density to use for the terrain rendering. Pixel density is defined as the number of pixels in a raster per unit of area. The pixel density is assumed to be specified in the WGS 84 reference. This method is used by the default implementation ofcalculateStepSize
. By default, this values is14400.0
.- Parameters:
aPixelDensity
- The pixel density- See Also:
-
getPixelDensity
public double getPixelDensity()Returns the pixel density to use for the terrain rendering. This method is used by the default implementation ofcalculateStepSize
. By default, this values is14400.0
.- Returns:
- the pixel density to use for the terrain rendering.
- See Also:
-
subProfilePointCount
public int subProfilePointCount(int aSegmentIndex, int aSubProfileIndex) throws IndexOutOfBoundsException Description copied from interface:ILcdVVModel
Returns the number of points (steps) of a sub-profile for the given main profile segment.- Parameters:
aSegmentIndex
- the index of the segment in the main profileaSubProfileIndex
- the index of the sub-profile to use- Returns:
- For a given segment and for one specific sub-profile, how many points are contained.
- Throws:
IndexOutOfBoundsException
-
getPointCount
public int getPointCount()- Returns:
- the number of points on the main-profile.
-
getPoint
- Parameters:
aPointIndex
- the index of the point in the main profile- Returns:
- a point at a given index on the main-profile.
- Throws:
IndexOutOfBoundsException
- See Also:
-
setPointZ
Description copied from interface:ILcdVVModel
This method will be called whenever a point of the main-profile is being dragged so that its Z-dimension needs to be changed. If isLastInRow is false, the user should consider caching the Z-value.- Parameters:
aIndex
- The index of the point being dragged.aZ
- The new altitude for the point.isLastInRow
- While the user is dragging the point, this parameter will be false, at the release of the mouse this parameter will be true.- Throws:
IndexOutOfBoundsException
-
getSubProfileCount
public int getSubProfileCount()- Returns:
- the number of sub-profiles in this
ILcdVVModel
.
-
isEditable
public boolean isEditable()- Returns:
- true if editing of the main-profile (dragging the points) is allowed.
-
minZ
public double minZ(int aSubProfilePointIndex, int aSegmentIndex, int aSubProfileIndex) throws IndexOutOfBoundsException - Parameters:
aSubProfilePointIndex
- the index of the sub-profile point whose altitude to retrieveaSegmentIndex
- the main-profile segment of the sub-profile point A segment is a line-piece drawn between two main-profile points.aSubProfileIndex
- the index of the sub-profile to use- Returns:
- Should return the minimum altitude for one specific sub-profile-point. This minZ value will be used when the rendering mode for this sub-profile is BOTTOM_LINE, FILLED or POLYGON.
- Throws:
IndexOutOfBoundsException
-
maxZ
public double maxZ(int aSubProfilePointIndex, int aSegmentIndex, int aSubProfileIndex) throws IndexOutOfBoundsException - Parameters:
aSubProfilePointIndex
- the index of the sub-profile point whose altitude to retrieveaSegmentIndex
- the main-profile segment to retrieve the step length for. A segment is a line-piece drawn between two main-profile points.aSubProfileIndex
- the index of the sub-profile to use- Returns:
- Should return the maximum altitude for one specific sub-profile-point. This maxZ value will be used when rendering mode for this sub-profile is TOP_LINE, FILLED or POLYGON.
- Throws:
IndexOutOfBoundsException
-
stepLenghtRatio
public float stepLenghtRatio(int aSubProfilePointIndex, int aSegmentIndex, int aSubProfileIndex) throws IndexOutOfBoundsException Description copied from interface:ILcdVVModel
Returns where the given sub-profile point is positioned on the X-axis. More precisely, this method returns the percentage on the X-axis the given sub-profile point represents on the given main profile segment. The sum of all the ratios for one sub-profile on the segment should be 1.- Parameters:
aSubProfilePointIndex
- defines the step. It is the point to the right of the step, so it can never be less than 1,aSegmentIndex
- the main-profile segment to retrieve the step length for. A segment is a line-piece drawn between two main-profile points.aSubProfileIndex
- the sub-profile to retrieve the step length ratio for- Returns:
- the percentage on the X-axis the given sub-profile step represents
- Throws:
IndexOutOfBoundsException
-