public class TLcdVVTerrainModel extends ALcdVVModel
ILcdVVModel
to show a terrain profile in a Vertical View.
The preferred way of using this class is:
setView
to set the view that contains the terrain data.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 an
ILcdGeodeticReference
or ILcdGridReference
are supported.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.
Constructor and Description |
---|
TLcdVVTerrainModel()
Deprecated.
call the constructor with view, model and object arguments instead to avoid partially configured models
|
TLcdVVTerrainModel(boolean aAsynchronousUpdate)
Deprecated.
call the constructor with view, model and object arguments instead to avoid partially configured models
|
TLcdVVTerrainModel(Object aObject,
ILcdModel aModel,
ILcdView aView)
Creates a terrain profile model that immediately and asynchronously calculates the profile for the given object.
|
Modifier and Type | Method and Description |
---|---|
void |
addPropertyChangeListener(PropertyChangeListener aListener)
Adds a
PropertyChangeListener 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.
|
ILcdModel |
getModel()
Returns the model to which
getObject belongs. |
Object |
getObject()
Returns the object for which the profile and terrain elevation will be displayed.
|
double |
getPixelDensity()
Returns the pixel density to use for the terrain rendering.
|
ILcdPoint |
getPoint(int aPointIndex) |
int |
getPointCount() |
int |
getSubProfileCount() |
ILcdModelReference |
getTerrainProfileReference()
Returns the reference system in which the terrain profile is generated.
|
ILcdView |
getView()
Returns the view set in the
setView method. |
boolean |
isEditable() |
double |
maxZ(int aSubProfilePointIndex,
int aSegmentIndex,
int aSubProfileIndex) |
double |
minZ(int aSubProfilePointIndex,
int aSegmentIndex,
int aSubProfileIndex) |
void |
removePropertyChangeListener(PropertyChangeListener aListener)
Removes a
PropertyChangeListener 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.
|
void |
setObject(Object aObject,
ILcdModel aModel)
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 |
setView(ILcdView aView)
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.
|
addChangeListener, fireChangeModel, removeChangeListener
public TLcdVVTerrainModel(Object aObject, ILcdModel aModel, ILcdView aView)
aObject
- the objectaModel
- the model which the object belongs toaView
- the view containing the terrain datapublic TLcdVVTerrainModel()
setView(com.luciad.view.ILcdView)
, setObject(Object, ILcdModel)
, and finally update()
.public TLcdVVTerrainModel(boolean aAsynchronousUpdate)
setView(com.luciad.view.ILcdView)
, setObject(Object, ILcdModel)
, and finally update()
.aAsynchronousUpdate
- true
to make sure the terrain profile model is updated
asynchronously. false
otherwise.public void addPropertyChangeListener(PropertyChangeListener aListener)
PropertyChangeListener
to the list of listeners that must be notified when
any of the properties of this terrain profile model changes.aListener
- the listener that from now on will be notified of all changes to properties of
this terrain profile model.removePropertyChangeListener(java.beans.PropertyChangeListener)
public void removePropertyChangeListener(PropertyChangeListener aListener)
PropertyChangeListener
from the list of listeners. This listener will no
longer be notified of any changes to the properties of this terrain profile model.aListener
- the listener that no longer will be notified of any changes to properties of
this terrain profile model.addPropertyChangeListener(java.beans.PropertyChangeListener)
public void setView(ILcdView aView)
aView
- a given view. The view must implement ILcdLayered.IllegalArgumentException
- if the view does not implement ILcdLayeredgetView()
public ILcdView getView()
setView
method.setView
method.setView(com.luciad.view.ILcdView)
public final void setObject(Object aObject, ILcdModel aModel)
point list
from the given object.
See the retrievePointList(java.lang.Object)
method for the shape types that are supported by default.
Note: after calling this method, the update
method should be
called.aObject
- the object.aModel
- the model to which the given object belongs. Note that only models with an
ILcdGeodeticReference
or ILcdGridReference
are supported.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.getObject()
,
getModel()
public Object getObject()
setObject
, this method will not immediately return
the passed Object
. It will only return it after the update
method has been called, and has finished his execution (which may be asynchronously).setObject(Object, com.luciad.model.ILcdModel)
,
update()
public ILcdModel getModel()
getObject
belongs.
Note that after calling setObject
, this method will not immediately return
the passed ILcdModel
. It will only return it after the update
method has been called, and has finished his execution (which may be asynchronously).getObject
belongs.setObject(Object, com.luciad.model.ILcdModel)
,
update()
protected ILcdPointList retrievePointList(Object aObject)
ILcdDataObject
: This method will try to find a point list
in the object's principal {@code ILcdShape} geometry property
.ILcdExtrudedShape
: 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.aObject
- the object.public void setTerrainProfileReference(ILcdModelReference aTerrainProfileReference)
null
, which means that the same
reference as getModel
is used to discretize the point list.
Currently, ILcdGeodeticReference
and ILcdGridReference
are supported.aTerrainProfileReference
- the reference system in which the terrain profile should be generated.getTerrainProfileReference()
public ILcdModelReference getTerrainProfileReference()
setTerrainProfileReference(com.luciad.model.ILcdModelReference)
public void update()
protected double calculateStepSize(int aSegmentIndex, double aSegmentDistance, ILcdPoint aSegmentPoint1, ILcdPoint aSegmentPoint2, ILcdModelReference aPointReference)
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.public double getDistance(int aPointIndex1, int aPointIndex2)
getDistance
in interface ILcdVVModel
getDistance
in class ALcdVVModel
aPointIndex1
- the index of the first point on the main profileaPointIndex2
- the index of the second point on the main profileprotected ILcdHeightProvider retrieveHeightProvider(Map<String,Object> aRequiredProperties, Map<String,Object> aOptionalProperties)
TLcdRasterModelHeightProviderFactory
and TLcdEarthHeightProviderFactory
to
create a TLcdViewHeightProvider
. This view height provider is
based on the set view and properties. When the view
is null
, an IllegalArgumentException
is thrown.aRequiredProperties
- the required properties used to create a height provideraOptionalProperties
- the optional properties used to create a height providerpublic void setPixelDensity(double aPixelDensity)
calculateStepSize
.
By default, this values is 14400.0
.aPixelDensity
- The pixel densitygetPixelDensity()
public double getPixelDensity()
calculateStepSize
.
By default, this values is 14400.0
.setPixelDensity(double)
public int subProfilePointCount(int aSegmentIndex, int aSubProfileIndex) throws IndexOutOfBoundsException
ILcdVVModel
aSegmentIndex
- the index of the segment in the main profileaSubProfileIndex
- the index of the sub-profile to useIndexOutOfBoundsException
public int getPointCount()
public ILcdPoint getPoint(int aPointIndex) throws IndexOutOfBoundsException
aPointIndex
- the index of the point in the main profileIndexOutOfBoundsException
ILcdVVModel.setPointZ(int, double, boolean)
public void setPointZ(int aIndex, double aZ, boolean isLastInRow) throws IndexOutOfBoundsException
ILcdVVModel
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.IndexOutOfBoundsException
public int getSubProfileCount()
ILcdVVModel
.public boolean isEditable()
public double minZ(int aSubProfilePointIndex, int aSegmentIndex, int aSubProfileIndex) throws IndexOutOfBoundsException
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 useIndexOutOfBoundsException
public double maxZ(int aSubProfilePointIndex, int aSegmentIndex, int aSubProfileIndex) throws IndexOutOfBoundsException
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 useIndexOutOfBoundsException
public float stepLenghtRatio(int aSubProfilePointIndex, int aSegmentIndex, int aSubProfileIndex) throws IndexOutOfBoundsException
ILcdVVModel
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 forIndexOutOfBoundsException