public class TLcdProcedureTrajectory extends Object implements ILcdPolyline,ILcdFeatured, ILcdDataObject, ILcdInvalidateable, ILcdCurve
ILcdProcedure
, provided
as a convenience to help display procedures on a map. This class implements
ILcdPolyline
, so that it is easy to use it with existing
LuciadLightspeed tools such as vertical views.
A procedure trajectory stores a reference to a procedure, and also holds a
TLcdProcedureGeometryCalculator
and TLcdAircraftPerformanceSettings
.
The combination of these two objects provide a geometrical representation of
the procedure. This geometrical representation is internally cached, so
external changes to the geometry calculator or the aircraft performance settings
should always be accompanied by a call to the invalidate()
method, which will ensure that the procedure geometry is properly updated to
reflect the changes.
To avoid memory problems when handling large sets of procedure trajectories,
the geometrical representation is stored using SoftReference
objects:
this allows to garbage-collect the geometrical representation, when
memory is running low. In order to have the best performance, enough memory
is needed to store all geometrical representations.
To access the geometry of a procedure trajectory, two approaches can be used:
ILcdPolyline
, which give access
to the individual points of the procedure trajectory,ILcdProcedureGeometryHandler
via processProcedureGeometry(ILcdProcedureGeometryHandler)
,
which gives access to high-level information about the geometry that is not
available through the ILcdPolyline
interface.
Users should try to avoid adding ILcdProcedure
objects to an
ILcdModel
directly, and should prefer using this class instead.
INTERPOLATION_CIRCLE_BY_3POINTS, INTERPOLATION_CIRCLE_BY_CENTERPOINT, INTERPOLATION_CIRCULARARC_BY_3POINTS, INTERPOLATION_CIRCULARARC_BY_BULGE, INTERPOLATION_CIRCULARARC_BY_CENTERPOINT, INTERPOLATION_ELLIPTICAL, INTERPOLATION_GEODESIC, INTERPOLATION_LINEAR, INTERPOLATION_MIXED, INTERPOLATION_RHUMB
Constructor and Description |
---|
TLcdProcedureTrajectory(ILcdProcedure aProcedure,
TLcdAircraftPerformanceSettings aAircraftPerformanceSettings,
TLcdProcedureGeometryCalculator aGeometryCalculator)
Constructs a
TLcdProcedureTrajectory for the given procedure. |
Modifier and Type | Method and Description |
---|---|
boolean |
canSetFeature(int aIndex)
Returns whether the feature at the given index of the associated
ILcdProcedure can be set. |
Object |
clone()
Returns a clone of this
TLcdProcedureTrajectory object. |
void |
computePointSFCT(double aParam,
ILcd3DEditablePoint aPointSFCT)
Computes a point of the curve, defined by the given parameter.
|
boolean |
contains2D(double aX,
double aY)
Returns
false . |
boolean |
contains2D(ILcdPoint aPoint)
Returns
false . |
boolean |
contains3D(double aX,
double aY,
double aZ)
Returns
false . |
boolean |
contains3D(ILcdPoint aPoint)
Returns
false . |
TLcdAircraftPerformanceSettings |
getAircraftPerformanceSettings()
Returns the aircraft performance settings used by this trajectory.
|
ILcdBounds |
getBounds()
Returns the bounds of this trajectory.
|
TLcdDataType |
getDataType()
Returns the type of this data object.
|
ILcdPoint |
getEndPoint()
Retrieves the end point of the curve.
|
double |
getEndTangent2D()
Returns the angle of the curve's tangent at the end point,
in degrees counterclockwise from the direction at 3 o'clock.
|
Object |
getFeature(int aIndex)
Returns the feature at the given index of the associated
ILcdProcedure ,
if it is of the type ILcdFeatured . |
int |
getFeatureCount()
Returns the number of features of the associated
ILcdProcedure ,
if it is of the type ILcdFeatured . |
ILcdPoint |
getFocusPoint()
Returns the focus point of this
ILcdShape . |
String |
getInterpolation()
Returns the interpolation method used by this curve.
|
double |
getLength2D(double aParam1,
double aParam2)
Returns the length between two points of the curve,
defined by the given parameters.
|
int |
getLineSegmentIntersectionCount(ILcdPoint aP1,
ILcdPoint aP2)
Returns the number of intersections between this curve and a line segment
defined by the two specified points.
|
ILcdPoint |
getPoint(int aIndex)
Returns the trajectory point at the given index.
|
int |
getPointCount()
Returns the number of points in this trajectory.
|
ILcdProcedure |
getProcedure()
Returns the
ILcdProcedure associated with this trajectory. |
TLcdProcedureGeometryCalculator |
getProcedureGeometryCalculator()
Returns the procedure geometry calculator used to calculate this trajectory.
|
ILcdPoint |
getStartPoint()
Retrieves the start point of the curve.
|
double |
getStartTangent2D()
Returns the angle of the curve's tangent at the start point,
in degrees counterclockwise from the direction at 3 o'clock.
|
double |
getTangent2D(double aParam)
Returns the angle of the curve's tangent in the point defined
by the given parameter, in degrees counterclockwise from the
direction at 3 o'clock.
|
Object |
getValue(String aPropertyName)
Convenience method that returns the value of the property with the given name.
|
Object |
getValue(TLcdDataProperty aProperty)
Returns the value of the given property.
|
boolean |
hasValue(String aPropertyName)
Indicates whether this data object has a value for the given property.
|
boolean |
hasValue(TLcdDataProperty aProperty)
Indicates whether this data object has a value for the given property.
|
void |
invalidate()
Discards the geometry cached with this trajectory and recalculates it from
the source procedure.
|
void |
invalidateObject()
Delegates to
invalidate() . |
void |
processProcedureGeometry(ILcdProcedureGeometryHandler aHandler)
Iterates over the procedure geometry using an
ILcdProcedureGeometryHandler . |
void |
setAircraftPerformanceSettings(TLcdAircraftPerformanceSettings aPerformance)
Sets the aircraft performance settings to be used by this trajectory
and invokes the
invalidate() method. |
void |
setFeature(int aIndex,
Object aObject)
Sets the feature at the given index of the associated
ILcdProcedure ,
if it is of the type ILcdFeatured . |
void |
setProcedureGeometryCalculator(TLcdProcedureGeometryCalculator aGeometryCalculator)
Sets the procedure geometry calculator to be used to calculate
this trajectory and invokes the
invalidate() method. |
void |
setValue(String aPropertyName,
Object aValue)
Convenience method that sets the value of the property with the given name.
|
void |
setValue(TLcdDataProperty aProperty,
Object aValue)
Sets the value of the given property for this data object.
|
String |
toString()
Returns the toString value
of the associated
ILcdProcedure . |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getPointSFCT, getX, getY, getZ
public TLcdProcedureTrajectory(ILcdProcedure aProcedure, TLcdAircraftPerformanceSettings aAircraftPerformanceSettings, TLcdProcedureGeometryCalculator aGeometryCalculator)
TLcdProcedureTrajectory
for the given procedure.
The trajectory is built using the given geometry calculator and aircraft performance settings.aProcedure
- A procedure to create a trajectory foraAircraftPerformanceSettings
- The aircraft performance settings to be used to calculate the trajectoryaGeometryCalculator
- The geometry calculator to calculate the trajectorypublic void invalidate()
ILcdModel
containing this trajectory should be notified by means of a call to
ALcdModel.elementChanged(Object, int)
!public void invalidateObject()
invalidate()
.invalidateObject
in interface ILcdInvalidateable
invalidate()
public void processProcedureGeometry(ILcdProcedureGeometryHandler aHandler)
ILcdProcedureGeometryHandler
.
This gives access to high-level information about the geometry that is not
available through the ILcdPolyline
interface.aHandler
- A handler to iterate over the procedure geometrypublic ILcdProcedure getProcedure()
ILcdProcedure
associated with this trajectory.ILcdProcedure
associated with this trajectory.public TLcdAircraftPerformanceSettings getAircraftPerformanceSettings()
invalidate()
must be called on all TLcdProcedureTrajectory
objects
that are using it.public void setAircraftPerformanceSettings(TLcdAircraftPerformanceSettings aPerformance)
invalidate()
method.aPerformance
- the aircraft performance settings to be used by this trajectory.public TLcdProcedureGeometryCalculator getProcedureGeometryCalculator()
invalidate()
must be called on all TLcdProcedureTrajectory
objects
that are using it.public void setProcedureGeometryCalculator(TLcdProcedureGeometryCalculator aGeometryCalculator)
invalidate()
method.aGeometryCalculator
- the procedure geometry calculator to calculate this trajectory.public String toString()
ILcdProcedure
.public ILcdPoint getFocusPoint()
ILcdShape
ILcdShape
.getFocusPoint
in interface ILcdShape
ILcdShape
.public boolean contains2D(ILcdPoint aPoint)
false
.contains2D
in interface ILcdShape
aPoint
- a pointfalse
.ILcdShape.contains2D(double, double)
public boolean contains2D(double aX, double aY)
false
.contains2D
in interface ILcdShape
aX
- An X coordinateaY
- An Y coordinatefalse
.public boolean contains3D(ILcdPoint aPoint)
false
.contains3D
in interface ILcdShape
aPoint
- a pointfalse
.ILcdShape.contains3D(double, double, double)
public boolean contains3D(double aX, double aY, double aZ)
false
.contains3D
in interface ILcdShape
aX
- An X coordinateaY
- An Y coordinateaZ
- A Z coordinatefalse
.public Object clone()
TLcdProcedureTrajectory
object.
Note: the features of the new object are a shallow clone of the features of
this object.clone
in interface ILcdCloneable
clone
in class Object
TLcdProcedureTrajectory
object.Object.clone()
public ILcdBounds getBounds()
getBounds
in interface ILcdBounded
public int getPointCount()
getPointCount
in interface ILcdPointList
public ILcdPoint getPoint(int aIndex) throws IndexOutOfBoundsException
getPoint
in interface ILcdPointList
aIndex
- the index of the point to be retrievedIndexOutOfBoundsException
- if the index is out of range (index
< 0 || index >= getPointCount()).public void computePointSFCT(double aParam, ILcd3DEditablePoint aPointSFCT)
ILcdCurve
ILcdCurve.getStartPoint()
.ILcdCurve.getEndPoint()
.computePointSFCT
in interface ILcdCurve
aParam
- a value of the closed interval [0,1]aPointSFCT
- the point to store the computed curve point inpublic ILcdPoint getEndPoint()
ILcdCurve
This is equivalent to computePointSFCT(1)
.
getEndPoint
in interface ILcdCurve
public double getEndTangent2D()
ILcdCurve
The tangent orientation is from the end point, away from the curve before it.
This is the same as getTangent2D(1)
.
getEndTangent2D
in interface ILcdCurve
public String getInterpolation()
ILcdCurve
A set of predefined constants are defined in this interface,
which are used by the default ILcdCurve
implementations
provided by LuciadLightspeed.
Custom implementations can define their own constants, and use them to interpret the interpolation of the curve.
getInterpolation
in interface ILcdCurve
public double getLength2D(double aParam1, double aParam2)
ILcdCurve
aParam1 == aParam2
, the length is 0.aParam1 == 0 and aParam2 == 1
, the length is the whole length of the curve.aParam1 > aParam2
, the length is (aParam1 to 1
) + (0 to aParam2
).getLength2D
in interface ILcdCurve
aParam1
- a value of the closed interval [0,1]aParam2
- a value of the closed interval [0,1]public int getLineSegmentIntersectionCount(ILcdPoint aP1, ILcdPoint aP2)
ILcdCurve
This information can be used to perform containment calculations, if this curve is closed or if this curve is part of a composite closed curve. By determining the number of intersections between this curve and a line segment starting from a given point in a fixed direction, one can determine whether a point is located within the closed curve by using the even-odd rule.
getLineSegmentIntersectionCount
in interface ILcdCurve
aP1
- the first point of the line segmentaP2
- the second point of the line segmentpublic ILcdPoint getStartPoint()
ILcdCurve
This is equivalent to computePointSFCT(0)
.
getStartPoint
in interface ILcdCurve
public double getStartTangent2D()
ILcdCurve
The tangent orientation is from the start point towards the rest of the shape.
This is the same as getTangent2D(0)
.
getStartTangent2D
in interface ILcdCurve
public double getTangent2D(double aParam)
ILcdCurve
The tangent orientation is from the point at parameter aParam
towards the rest of the shape.
ILcdCurve.getStartTangent2D()
.ILcdCurve.getEndTangent2D()
.getTangent2D
in interface ILcdCurve
aParam
- a value of the closed interval [0,1]public int getFeatureCount()
ILcdProcedure
,
if it is of the type ILcdFeatured
. Otherwise, 0 is returned.getFeatureCount
in interface ILcdFeatured
ILcdProcedure
if it is of the type ILcdFeatured
, or 0 otherwise.public Object getFeature(int aIndex) throws IndexOutOfBoundsException, UnsupportedOperationException
ILcdProcedure
,
if it is of the type ILcdFeatured
. Otherwise, an UnsupportedOperationException
is thrown.getFeature
in interface ILcdFeatured
aIndex
- a valid feature index.ILcdProcedure
,
if it is of the type ILcdFeatured
.IndexOutOfBoundsException
- if the index is out of range (index
< 0 || index >= getFeatureCount()).UnsupportedOperationException
- if the associated ILcdProcedure
is
not of the type ILcdFeatured
.ILcdFeatured.setFeature(int, java.lang.Object)
public void setFeature(int aIndex, Object aObject) throws IndexOutOfBoundsException, UnsupportedOperationException
ILcdProcedure
,
if it is of the type ILcdFeatured
. Otherwise, an UnsupportedOperationException
is thrown.setFeature
in interface ILcdFeatured
aIndex
- the index of the feature to be setaObject
- the feature valueIndexOutOfBoundsException
- if the index is out of range (index
< 0 || index >= getFeatureCount()).UnsupportedOperationException
- if the associated ILcdProcedure
is
not of the type ILcdFeatured
.ILcdFeatured.getFeature(int)
,
ILcdFeatured.canSetFeature(int)
public boolean canSetFeature(int aIndex)
ILcdProcedure
can be set.
If the procedure is not of the type ILcdFeatured
, false
is returned.canSetFeature
in interface ILcdFeatured
aIndex
- the index of the feature to be settrue
if the feature at the given index can be set.public TLcdDataType getDataType()
ILcdDataObject
null
.getDataType
in interface ILcdDataObject
public Object getValue(TLcdDataProperty aProperty)
ILcdDataObject
Returns the value of the given property.
If the property is a collection, the returned value will never be null. If the property has not been set, an empty collection of the appropriate type will be returned (Set, List or Map).
The property must not be null, and must be declared in the data object's type
or in one of its super types.
Otherwise an IllegalArgumentException
is thrown.
getValue
in interface ILcdDataObject
aProperty
- the property for which the value is to be returnedpublic Object getValue(String aPropertyName)
ILcdDataObject
Convenience method that returns the value of the property with the given name.
If more than one property exists with the given name, the most specific property should be used (this is the property defined by the most specialized type in this object's data type hierarchy). SeeILcdDataObject.getValue(TLcdDataProperty)
for more information.getValue
in interface ILcdDataObject
aPropertyName
- the name of the property of which the value is to be returnedTLcdDataType.getProperty(String)
public void setValue(TLcdDataProperty aProperty, Object aValue)
ILcdDataObject
Sets the value of the given property for this data object. The implementation is allowed to throw an exception if the given value can't be set.
The given property must be declared in thedata object's type
or in one of its super types. In
other words, getDataType().getProperties().contains( aProperty ) should always be true.
Otherwise, the implementation should throw an IllegalArgumentException
.setValue
in interface ILcdDataObject
aProperty
- the property for which the value is to be setaValue
- the value to setTLcdDataType.getProperty(String)
public void setValue(String aPropertyName, Object aValue)
ILcdDataObject
Convenience method that sets the value of the property with the given name.
If more than one property exists with the given name, the most specific property should be used (this is the property defined by the most specialized type in this object's data type hierarchy). SeeILcdDataObject.setValue(TLcdDataProperty, Object)
for more information.setValue
in interface ILcdDataObject
aPropertyName
- the name of the property of which the value is to be setaValue
- the value to setpublic boolean hasValue(TLcdDataProperty aProperty)
ILcdDataObject
aProperty
is from the right data type
, and this instance has a value for it: returns true
aProperty
is from the right data type
, and this instance has no value for it: returns false
aProperty
is not from the right data type
: not allowed, you will get IllegalArgumentExceptionaProperty
is null
: not allowed, you will get NullPointerExceptionhasValue
in interface ILcdDataObject
aProperty
- the property for which to return whether a value is present or not.true
if this data object has a value for the given property, false
otherwise.public boolean hasValue(String aPropertyName)
ILcdDataObject
ILcdDataObject.hasValue(TLcdDataProperty)
for more information.hasValue
in interface ILcdDataObject
aPropertyName
- the name of the property for which to return whether a value is present
or not.true
if this data object has a value for the property with the given name,
false
otherwise.