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
Modifier and TypeFieldDescriptionstatic final int
Identifies a data correction to prevent a self-intersection at a leg of typeILcdGeoPathLeg.ARC
.static final int
Identifies 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_RHUMB
Fields inherited from interface com.luciad.shape.ILcdPolygon
CLOCKWISE, COUNTERCLOCKWISE, INVALID_ORIENTATION
-
Constructor Summary
ConstructorDescriptionDefault constructor.TLcdDiscretizedLonLatGeoPath
(TLcdDiscretizedLonLatGeoPath aDiscretizedGeoPath) Copy constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected 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.void
addLeg
(ILcdGeoPathLeg aGeoPathLeg) AddaGeoPathLeg
to this GeoPath.clone()
Creates and returns a copy of this object.void
computePointSFCT
(double aParam, ILcd3DEditablePoint aPointSFCT) Computes a point of the curve, defined by the given parameter.boolean
contains2D
(double v, double v1) Checks whether thisILcdShape
contains the given point in the 2D space.boolean
contains2D
(ILcdPoint aPoint) Checks whether thisILcdShape
contains the givenILcdPoint
in the 2D space.boolean
contains3D
(double v, double v1, double v2) Checks whether thisILcdShape
contains the given point in the 3D space.boolean
contains3D
(ILcdPoint aPoint) Checks whether thisILcdShape
contains the givenILcdPoint
in the 3D space.Returns the bounds of the discretized GeoPath.double
Return the distance between discrete points on an arc in degrees.double
Returns the distance between discretized points in meters.Retrieves the end point of the curve.double
Returns 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.int
getLegIndexForPoint
(int aPointIndex) Identical to getLegForPoint(), but returns the index of the ILcdGeoPathLeg rather than the leg itself.double
getLength2D
(double aParam1, double aParam2) Returns the length between two points of the curve, defined by the given parameters.int
Returns the number of intersections between this curve and a line segment defined by the two specified points.int
Returns the orientation of thisILcdPolygon
:ILcdPolygon.CLOCKWISE
orILcdPolygon.COUNTERCLOCKWISE
.getPoint
(int aIndex) Returns theILcdPoint
at a given index.int
Returns the number ofILcdPoint
objects in the list.Retrieves the start point of the curve.double
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.void
insertLegAt
(ILcdGeoPathLeg aLeg, int anIndex) Adds aILcdGeoPathLeg
object to theILcdEditableGeoPath
on the specified index.void
Discards the geometry cached with this GeoPath and recalculates it.void
Delegates toinvalidate()
.boolean
removeLeg
(ILcdGeoPathLeg aGeoPathLeg) RemoveaGeoPathLeg
from this GeoPath.void
removeLegAt
(int anIndex) Removes theILcdGeoPathLeg
object on the specified index from the fromILcdEditableGeoPath
.void
setDiscretisationResolutionAngle
(double aDiscretisationResolutionAngle) Sets the distance between discrete points on an arc in degrees.void
setDiscretisationResolutionDistance
(double aDiscretisationResolutionDistance) Sets the distance between discretized points in meters.void
setEllipsoid
(ILcdEllipsoid aEllipsoid) Sets the ellipsoid on which the discretization calculations are to be performed.Methods inherited from class com.luciad.ais.shape.TLcdGeoPath
getLeg, getLegCount
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods 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:
getBounds
in 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:
clone
in interfaceILcdCloneable
- Overrides:
clone
in classALcdDiscretizedGeoPath
- See Also:
-
getFocusPoint
Description copied from interface:ILcdShape
Returns the focus point of thisILcdShape
.- Specified by:
getFocusPoint
in interfaceILcdShape
- Returns:
- the focus point of this
ILcdShape
.
-
contains2D
Description copied from interface:ILcdShape
Checks whether thisILcdShape
contains the givenILcdPoint
in the 2D space. Only the first two dimensions of theILcdShape
and theILcdPoint
are considered.- Specified by:
contains2D
in interfaceILcdShape
- Parameters:
aPoint
- theILcdPoint
to test.- Returns:
- the boolean result of the containment test.
- See Also:
-
contains2D
public boolean contains2D(double v, double v1) Description copied from interface:ILcdShape
Checks whether thisILcdShape
contains the given point in the 2D space. Only the first two dimensions of theILcdShape
are considered.- Specified by:
contains2D
in 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:ILcdShape
Checks whether thisILcdShape
contains the givenILcdPoint
in the 3D space.- Specified by:
contains3D
in interfaceILcdShape
- Parameters:
aPoint
- theILcdPoint
to 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:ILcdShape
Checks whether thisILcdShape
contains the given point in the 3D space.- Specified by:
contains3D
in 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:ILcdPolygon
Returns the orientation of thisILcdPolygon
:ILcdPolygon.CLOCKWISE
orILcdPolygon.COUNTERCLOCKWISE
.- Specified by:
getOrientation
in interfaceILcdPolygon
- Returns:
- the orientation of this
ILcdPolygon
:ILcdPolygon.CLOCKWISE
orILcdPolygon.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:ILcdPointList
Returns the number ofILcdPoint
objects in the list.- Specified by:
getPointCount
in interfaceILcdPointList
- Returns:
- the number of
ILcdPoint
objects in the list.
-
getPoint
Description copied from interface:ILcdPointList
Returns theILcdPoint
at a given index.- Specified by:
getPoint
in interfaceILcdPointList
- Parameters:
aIndex
- a valid index in the list ofILcdPoint
objects.- Returns:
- the
ILcdPoint
at the given index. - Throws:
IndexOutOfBoundsException
- if the given index is out of bounds.
-
addLeg
AddaGeoPathLeg
to this GeoPath.- Specified by:
addLeg
in interfaceILcdEditableGeoPath
- Overrides:
addLeg
in classTLcdGeoPath
- Parameters:
aGeoPathLeg
- theILcdGeoPathLeg
to be added
-
removeLeg
RemoveaGeoPathLeg
from this GeoPath.- Overrides:
removeLeg
in classTLcdGeoPath
- Parameters:
aGeoPathLeg
- theILcdGeoPathLeg
to be removed- Returns:
true
if the leg was successfully removed
-
insertLegAt
Description copied from interface:ILcdEditableGeoPath
Adds aILcdGeoPathLeg
object to theILcdEditableGeoPath
on the specified index.- Specified by:
insertLegAt
in interfaceILcdEditableGeoPath
- Overrides:
insertLegAt
in classTLcdGeoPath
- Parameters:
aLeg
- theILcdGeoPathLeg
object to be added to theILcdEditableGeoPath
.anIndex
- the index in theILcdEditableAirspace
where theILcdAirspaceSegment
object must be added.
-
removeLegAt
public void removeLegAt(int anIndex) Description copied from interface:ILcdEditableGeoPath
Removes theILcdGeoPathLeg
object on the specified index from the fromILcdEditableGeoPath
.- Specified by:
removeLegAt
in interfaceILcdEditableGeoPath
- Overrides:
removeLegAt
in classTLcdGeoPath
- Parameters:
anIndex
- the index in theILcdEditableGeoPath
where theILcdGeoPathLeg
object 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:
invalidateObject
in 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:ILcdCurve
Computes 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:
computePointSFCT
in 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:ILcdCurve
Retrieves the end point of the curve.This is equivalent to
computePointSFCT(1)
.- Specified by:
getEndPoint
in interfaceILcdCurve
- Returns:
- the end point of the curve
-
getEndTangent2D
public double getEndTangent2D()Description copied from interface:ILcdCurve
Returns 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:
getEndTangent2D
in interfaceILcdCurve
- Returns:
- the curve's angle in the end point
-
getInterpolation
Description copied from interface:ILcdCurve
Returns the interpolation method used by this curve.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.
- Specified by:
getInterpolation
in interfaceILcdCurve
- Returns:
- the interpolation method used by this curve.
-
getLength2D
public double getLength2D(double aParam1, double aParam2) Description copied from interface:ILcdCurve
Returns 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:
getLength2D
in 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:ILcdCurve
Returns 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:
getLineSegmentIntersectionCount
in 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:ILcdCurve
Retrieves the start point of the curve.This is equivalent to
computePointSFCT(0)
.- Specified by:
getStartPoint
in interfaceILcdCurve
- Returns:
- the start point of the curve
-
getStartTangent2D
public double getStartTangent2D()Description copied from interface:ILcdCurve
Returns 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:
getStartTangent2D
in interfaceILcdCurve
- Returns:
- the curve's angle in the start point
-
getTangent2D
public double getTangent2D(double aParam) Description copied from interface:ILcdCurve
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.The tangent orientation is from the point at parameter
aParam
towards 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:
getTangent2D
in 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 returnstrue
in all cases.- Parameters:
aLeg
- TheILcdGeoPathLeg
object for which a data correction is proposed.aType
- An identification of the data correction, which is eitherSUBPOINTLIST_INTERSECTION_CORRECTION
orARC_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 (ILcdGeoPathLeg
is 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.
-