Class TLcdDiscretizedLonLatGeoPath
- All Implemented Interfaces:
ILcdEditableGeoPath,ILcdGeoPath,ILcdBounded,ILcdCurve,ILcdPointList,ILcdPolygon,ILcdRing,ILcdShape,ILcdCloneable,ILcdInvalidateable,Serializable,Cloneable
ALcdDiscretizedGeoPath which performs the
discretization in geodetic coordinates.
The discretization procedure tries to create an ILcdPolygon that is not self-intersecting,
as this can cause problems when it is used for certain algorithms in computational geometry,
like boolean operations or triangulation. More concretely, it contains a number of techniques to
resolve some self-intersection problems that occur frequently in a GeoPath model (most of the time on a very small scale):
- self-intersections between two succeeding GeoPath legs, of which at least one is of the type
ILcdGeoPathLeg.SUB_POINT_LIST. - self-intersections at the edges of a leg of type
ILcdGeoPathLeg.ARC, caused by an incorrect arc center/radius.
acceptCorrection(ILcdGeoPathLeg, int, ILcdPoint, ILcdPoint) is called for each point replacement. This method
returns a boolean value, indicating whether the proposed data correction should be carried out or not. By default, this method returns true
in all cases.
It is important to note that these mechanisms do not resolve all possible self-intersections, as it is by no means the intention to
perform a full validation of the GeoPath model. This class assumes that the source data of the GeoPath model is correct and only
contains some small inaccuracies at most.- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intIdentifies a data correction to prevent a self-intersection at a leg of typeILcdGeoPathLeg.ARC.static final intIdentifies a data correction to prevent a self-intersection at/near a leg of typeILcdGeoPathLeg.SUB_POINT_LIST.Fields inherited from interface com.luciad.shape.ILcdCurve
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_RHUMBFields inherited from interface com.luciad.shape.ILcdPolygon
CLOCKWISE, COUNTERCLOCKWISE, INVALID_ORIENTATION -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.TLcdDiscretizedLonLatGeoPath(TLcdDiscretizedLonLatGeoPath aDiscretizedGeoPath) Copy constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanacceptCorrection(ILcdGeoPathLeg aLeg, int aType, ILcdPoint aOriginalPoint, ILcdPoint aNewPoint) Checks whether the proposed data correction is accepted or not, to prevent self-intersections in the discretized pointlists.voidaddLeg(ILcdGeoPathLeg aGeoPathLeg) AddaGeoPathLegto this GeoPath.clone()Creates and returns a copy of this object.voidcomputePointSFCT(double aParam, ILcd3DEditablePoint aPointSFCT) Computes a point of the curve, defined by the given parameter.booleancontains2D(double v, double v1) Checks whether thisILcdShapecontains the given point in the 2D space.booleancontains2D(ILcdPoint aPoint) Checks whether thisILcdShapecontains the givenILcdPointin the 2D space.booleancontains3D(double v, double v1, double v2) Checks whether thisILcdShapecontains the given point in the 3D space.booleancontains3D(ILcdPoint aPoint) Checks whether thisILcdShapecontains the givenILcdPointin the 3D space.Returns the bounds of the discretized GeoPath.doubleReturn the distance between discrete points on an arc in degrees.doubleReturns the distance between discretized points in meters.Retrieves the end point of the curve.doubleReturns the angle of the curve's tangent at the end point, in degrees counterclockwise from the direction at 3 o'clock.Returns the focus point of thisILcdShape.Returns the interpolation method used by this curve.getLegForPoint(int aPointIndex) Returns the ILcdGeoPathLeg that contains the discretized point at the given index.intgetLegIndexForPoint(int aPointIndex) Identical to getLegForPoint(), but returns the index of the ILcdGeoPathLeg rather than the leg itself.doublegetLength2D(double aParam1, double aParam2) Returns the length between two points of the curve, defined by the given parameters.intReturns the number of intersections between this curve and a line segment defined by the two specified points.intReturns the orientation of thisILcdPolygon:ILcdPolygon.CLOCKWISEorILcdPolygon.COUNTERCLOCKWISE.getPoint(int aIndex) Returns theILcdPointat a given index.intReturns the number ofILcdPointobjects in the list.Retrieves the start point of the curve.doubleReturns the angle of the curve's tangent at the start point, in degrees counterclockwise from the direction at 3 o'clock.doublegetTangent2D(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.voidinsertLegAt(ILcdGeoPathLeg aLeg, int anIndex) Adds aILcdGeoPathLegobject to theILcdEditableGeoPathon the specified index.voidDiscards the geometry cached with this GeoPath and recalculates it.voidDelegates toinvalidate().booleanremoveLeg(ILcdGeoPathLeg aGeoPathLeg) RemoveaGeoPathLegfrom this GeoPath.voidremoveLegAt(int anIndex) Removes theILcdGeoPathLegobject on the specified index from the fromILcdEditableGeoPath.voidsetDiscretisationResolutionAngle(double aDiscretisationResolutionAngle) Sets the distance between discrete points on an arc in degrees.voidsetDiscretisationResolutionDistance(double aDiscretisationResolutionDistance) Sets the distance between discretized points in meters.voidsetEllipsoid(ILcdEllipsoid aEllipsoid) Sets the ellipsoid on which the discretization calculations are to be performed.Methods inherited from class com.luciad.ais.shape.TLcdGeoPath
getLeg, getLegCountMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.luciad.shape.ILcdPointList
getPointSFCT, getX, getY, getZ
-
Field Details
-
SUBPOINTLIST_INTERSECTION_CORRECTION
public static final int SUBPOINTLIST_INTERSECTION_CORRECTIONIdentifies a data correction to prevent a self-intersection at/near a leg of typeILcdGeoPathLeg.SUB_POINT_LIST.- See Also:
-
ARC_CENTER_CORRECTION
public static final int ARC_CENTER_CORRECTIONIdentifies a data correction to prevent a self-intersection at a leg of typeILcdGeoPathLeg.ARC.- See Also:
-
-
Constructor Details
-
TLcdDiscretizedLonLatGeoPath
public TLcdDiscretizedLonLatGeoPath()Default constructor. -
TLcdDiscretizedLonLatGeoPath
Copy constructor.- Parameters:
aDiscretizedGeoPath- the object to be copied
-
-
Method Details
-
getBounds
Returns the bounds of the discretized GeoPath.- Specified by:
getBoundsin interfaceILcdBounded- Returns:
- an
ILcdBounds
-
clone
Creates and returns a copy of this object. The discretization is not copied or cloned at all, but recalculated when needed.- Specified by:
clonein interfaceILcdCloneable- Overrides:
clonein classALcdDiscretizedGeoPath- See Also:
-
getFocusPoint
Description copied from interface:ILcdShapeReturns the focus point of thisILcdShape.- Specified by:
getFocusPointin interfaceILcdShape- Returns:
- the focus point of this
ILcdShape.
-
contains2D
Description copied from interface:ILcdShapeChecks whether thisILcdShapecontains the givenILcdPointin the 2D space. Only the first two dimensions of theILcdShapeand theILcdPointare considered.- Specified by:
contains2Din interfaceILcdShape- Parameters:
aPoint- theILcdPointto test.- Returns:
- the boolean result of the containment test.
- See Also:
-
contains2D
public boolean contains2D(double v, double v1) Description copied from interface:ILcdShapeChecks whether thisILcdShapecontains the given point in the 2D space. Only the first two dimensions of theILcdShapeare considered.- Specified by:
contains2Din interfaceILcdShape- Parameters:
v- the x coordinate of the point.v1- the y coordinate of the point.- Returns:
- the boolean result of the containment test.
-
contains3D
Description copied from interface:ILcdShapeChecks whether thisILcdShapecontains the givenILcdPointin the 3D space.- Specified by:
contains3Din interfaceILcdShape- Parameters:
aPoint- theILcdPointto test.- Returns:
- the boolean result of the containment test.
- See Also:
-
contains3D
public boolean contains3D(double v, double v1, double v2) Description copied from interface:ILcdShapeChecks whether thisILcdShapecontains the given point in the 3D space.- Specified by:
contains3Din interfaceILcdShape- Parameters:
v- the x coordinate of the point.v1- the y coordinate of the point.v2- the z coordinate of the point.- Returns:
- the boolean result of the containment test.
-
getOrientation
public int getOrientation()Description copied from interface:ILcdPolygonReturns the orientation of thisILcdPolygon:ILcdPolygon.CLOCKWISEorILcdPolygon.COUNTERCLOCKWISE.- Specified by:
getOrientationin interfaceILcdPolygon- Returns:
- the orientation of this
ILcdPolygon:ILcdPolygon.CLOCKWISEorILcdPolygon.COUNTERCLOCKWISE. This method should not returnINVALID_ORIENTATION, which is only to be used for resetting the orientation so that it can be recalculated.
-
getPointCount
public int getPointCount()Description copied from interface:ILcdPointListReturns the number ofILcdPointobjects in the list.- Specified by:
getPointCountin interfaceILcdPointList- Returns:
- the number of
ILcdPointobjects in the list.
-
getPoint
Description copied from interface:ILcdPointListReturns theILcdPointat a given index.- Specified by:
getPointin interfaceILcdPointList- Parameters:
aIndex- a valid index in the list ofILcdPointobjects.- Returns:
- the
ILcdPointat the given index. - Throws:
IndexOutOfBoundsException- if the given index is out of bounds.
-
addLeg
AddaGeoPathLegto this GeoPath.- Specified by:
addLegin interfaceILcdEditableGeoPath- Overrides:
addLegin classTLcdGeoPath- Parameters:
aGeoPathLeg- theILcdGeoPathLegto be added
-
removeLeg
RemoveaGeoPathLegfrom this GeoPath.- Overrides:
removeLegin classTLcdGeoPath- Parameters:
aGeoPathLeg- theILcdGeoPathLegto be removed- Returns:
trueif the leg was successfully removed
-
insertLegAt
Description copied from interface:ILcdEditableGeoPathAdds aILcdGeoPathLegobject to theILcdEditableGeoPathon the specified index.- Specified by:
insertLegAtin interfaceILcdEditableGeoPath- Overrides:
insertLegAtin classTLcdGeoPath- Parameters:
aLeg- theILcdGeoPathLegobject to be added to theILcdEditableGeoPath.anIndex- the index in theILcdEditableAirspacewhere theILcdAirspaceSegmentobject must be added.
-
removeLegAt
public void removeLegAt(int anIndex) Description copied from interface:ILcdEditableGeoPathRemoves theILcdGeoPathLegobject on the specified index from the fromILcdEditableGeoPath.- Specified by:
removeLegAtin interfaceILcdEditableGeoPath- Overrides:
removeLegAtin classTLcdGeoPath- Parameters:
anIndex- the index in theILcdEditableGeoPathwhere theILcdGeoPathLegobject must be removed.
-
invalidate
public void invalidate()Discards the geometry cached with this GeoPath and recalculates it. Whenever this is done, the ILcdModel containing this GeoPath should be notified by means of a call to elementChanged()! -
invalidateObject
public void invalidateObject()Delegates toinvalidate().- Specified by:
invalidateObjectin interfaceILcdInvalidateable- See Also:
-
getLegForPoint
Returns the ILcdGeoPathLeg that contains the discretized point at the given index.- Parameters:
aPointIndex- the index of a discretized point in this GeoPath- Returns:
- the corresponding ILcdGeoPathLeg.
- Throws:
ArrayIndexOutOfBoundsException- if the index is out of range (index < 0 || index >= getPointCount()).
-
getLegIndexForPoint
Identical to getLegForPoint(), but returns the index of the ILcdGeoPathLeg rather than the leg itself.- Parameters:
aPointIndex- the index of a discretized point in this GeoPath- Returns:
- the index of the corresponding ILcdGeoPathLeg.
- Throws:
ArrayIndexOutOfBoundsException- if the index is out of range (index < 0 || index >= getPointCount()).
-
setEllipsoid
Sets the ellipsoid on which the discretization calculations are to be performed. Defaults to the WGS84 ellipsoid.- Parameters:
aEllipsoid- anILcdEllipsoid
-
getDiscretisationResolutionDistance
public double getDiscretisationResolutionDistance()Returns the distance between discretized points in meters.- Returns:
- the distance between discretized points in meters.
-
setDiscretisationResolutionDistance
public void setDiscretisationResolutionDistance(double aDiscretisationResolutionDistance) Sets the distance between discretized points in meters.- Parameters:
aDiscretisationResolutionDistance- the distance between discretized points in meters.
-
getDiscretisationResolutionAngle
public double getDiscretisationResolutionAngle()Return the distance between discrete points on an arc in degrees.- Returns:
- the distance between discrete points on an arc in degrees.
-
setDiscretisationResolutionAngle
public void setDiscretisationResolutionAngle(double aDiscretisationResolutionAngle) Sets the distance between discrete points on an arc in degrees.- Parameters:
aDiscretisationResolutionAngle- the distance between discrete points on an arc in degrees.
-
computePointSFCT
Description copied from interface:ILcdCurveComputes a point of the curve, defined by the given parameter.- At parameter 0, the point is the same as
ILcdCurve.getStartPoint(). - At parameter 1, the point is the same as
ILcdCurve.getEndPoint().
- Specified by:
computePointSFCTin interfaceILcdCurve- Parameters:
aParam- a value of the closed interval [0,1]aPointSFCT- the point to store the computed curve point in
- At parameter 0, the point is the same as
-
getEndPoint
Description copied from interface:ILcdCurveRetrieves the end point of the curve.This is equivalent to
computePointSFCT(1).- Specified by:
getEndPointin interfaceILcdCurve- Returns:
- the end point of the curve
-
getEndTangent2D
public double getEndTangent2D()Description copied from interface:ILcdCurveReturns the angle of the curve's tangent at the end point, in degrees counterclockwise from the direction at 3 o'clock.The tangent orientation is from the end point, away from the curve before it.
This is the same as
getTangent2D(1).- Specified by:
getEndTangent2Din interfaceILcdCurve- Returns:
- the curve's angle in the end point
-
getInterpolation
Description copied from interface:ILcdCurveReturns the interpolation method used by this curve.A set of predefined constants are defined in this interface, which are used by the default
ILcdCurveimplementations provided by LuciadLightspeed.Custom implementations can define their own constants, and use them to interpret the interpolation of the curve.
- Specified by:
getInterpolationin interfaceILcdCurve- Returns:
- the interpolation method used by this curve.
-
getLength2D
public double getLength2D(double aParam1, double aParam2) Description copied from interface:ILcdCurveReturns the length between two points of the curve, defined by the given parameters.- When
aParam1 == aParam2, the length is 0. - When
aParam1 == 0 and aParam2 == 1, the length is the whole length of the curve. - When
aParam1 > aParam2, the length is (aParam1 to 1) + (0 to aParam2).
- Specified by:
getLength2Din interfaceILcdCurve- Parameters:
aParam1- a value of the closed interval [0,1]aParam2- a value of the closed interval [0,1]- Returns:
- the length of the curve.
- When
-
getLineSegmentIntersectionCount
Description copied from interface:ILcdCurveReturns the number of intersections between this curve and a line segment defined by the two specified points.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.
- Specified by:
getLineSegmentIntersectionCountin interfaceILcdCurve- Parameters:
aP1- the first point of the line segmentaP2- the second point of the line segment- Returns:
- the number of intersections between the curve and the line segment
-
getStartPoint
Description copied from interface:ILcdCurveRetrieves the start point of the curve.This is equivalent to
computePointSFCT(0).- Specified by:
getStartPointin interfaceILcdCurve- Returns:
- the start point of the curve
-
getStartTangent2D
public double getStartTangent2D()Description copied from interface:ILcdCurveReturns the angle of the curve's tangent at the start point, in degrees counterclockwise from the direction at 3 o'clock.The tangent orientation is from the start point towards the rest of the shape.
This is the same as
getTangent2D(0).- Specified by:
getStartTangent2Din interfaceILcdCurve- Returns:
- the curve's angle in the start point
-
getTangent2D
public double getTangent2D(double aParam) Description copied from interface:ILcdCurveReturns 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.The tangent orientation is from the point at parameter
aParamtowards the rest of the shape.- The tangent at parameter 0 is the same as
ILcdCurve.getStartTangent2D(). - The tangent at parameter 1 is the same as
ILcdCurve.getEndTangent2D().
- Specified by:
getTangent2Din interfaceILcdCurve- Parameters:
aParam- a value of the closed interval [0,1]- Returns:
- the curve's angle in the point defined by the given parameter
- The tangent at parameter 0 is the same as
-
acceptCorrection
protected boolean acceptCorrection(ILcdGeoPathLeg aLeg, int aType, ILcdPoint aOriginalPoint, ILcdPoint aNewPoint) Checks whether the proposed data correction is accepted or not, to prevent self-intersections in the discretized pointlists. The data correction implies a replacement of one point by another, in the supplied GeoPath leg. By default, this method returnstruein all cases.- Parameters:
aLeg- TheILcdGeoPathLegobject for which a data correction is proposed.aType- An identification of the data correction, which is eitherSUBPOINTLIST_INTERSECTION_CORRECTIONorARC_CENTER_CORRECTION.aOriginalPoint- A point in the geopath leg that is to be replaced. This point can be the location of the GeoPath leg itself (ILcdGeoPathLegis also aILcdPoint), or a point in its data array (ILcdGeoPathLeg.getDataSFCT())aNewPoint- The new point to be used instead of the original point.- Returns:
- True if the proposed data correction is accepted.
-