public class TLcdDiscretizedLonLatGeoPath extends ALcdDiscretizedGeoPath implements ILcdInvalidateable
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):
ILcdGeoPathLeg.SUB_POINT_LIST
.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.Modifier and Type | Field and Description |
---|---|
static int |
ARC_CENTER_CORRECTION
Identifies a data correction to prevent a self-intersection at a leg of type
ILcdGeoPathLeg.ARC . |
static int |
SUBPOINTLIST_INTERSECTION_CORRECTION
Identifies a data correction to prevent a self-intersection at/near a leg of type
ILcdGeoPathLeg.SUB_POINT_LIST . |
CLOCKWISE, COUNTERCLOCKWISE, INVALID_ORIENTATION
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 |
---|
TLcdDiscretizedLonLatGeoPath()
Default constructor.
|
TLcdDiscretizedLonLatGeoPath(TLcdDiscretizedLonLatGeoPath aDiscretizedGeoPath)
Copy constructor.
|
Modifier and Type | Method and Description |
---|---|
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.
|
void |
addLeg(ILcdGeoPathLeg aGeoPathLeg)
Add
aGeoPathLeg to this GeoPath. |
Object |
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 this
ILcdShape contains the given point in
the 2D space. |
boolean |
contains2D(ILcdPoint aPoint)
Checks whether this
ILcdShape contains the given ILcdPoint in the 2D space. |
boolean |
contains3D(double v,
double v1,
double v2)
Checks whether this
ILcdShape contains the given point in
the 3D space. |
boolean |
contains3D(ILcdPoint aPoint)
Checks whether this
ILcdShape contains the given ILcdPoint in the 3D space. |
ILcdBounds |
getBounds()
Returns the bounds of the discretized GeoPath.
|
double |
getDiscretisationResolutionAngle()
Return the distance between discrete points on an arc in degrees.
|
double |
getDiscretisationResolutionDistance()
Returns the distance between discretized points in meters.
|
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.
|
ILcdPoint |
getFocusPoint()
Returns the focus point of this
ILcdShape . |
String |
getInterpolation()
Returns the interpolation method used by this curve.
|
ILcdGeoPathLeg |
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 |
getLineSegmentIntersectionCount(ILcdPoint aP1,
ILcdPoint aP2)
Returns the number of intersections between this curve and a line segment
defined by the two specified points.
|
int |
getOrientation()
Returns the orientation of this
ILcdPolygon :
ILcdPolygon.CLOCKWISE or ILcdPolygon.COUNTERCLOCKWISE . |
ILcdPoint |
getPoint(int aIndex)
Returns the
ILcdPoint at a given index. |
int |
getPointCount()
Returns the number of
ILcdPoint objects in the list. |
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.
|
void |
insertLegAt(ILcdGeoPathLeg aLeg,
int anIndex)
Adds a
ILcdGeoPathLeg object to the ILcdEditableGeoPath
on the specified index. |
void |
invalidate()
Discards the geometry cached with this GeoPath and recalculates it.
|
void |
invalidateObject()
Delegates to
invalidate() . |
boolean |
removeLeg(ILcdGeoPathLeg aGeoPathLeg)
Remove
aGeoPathLeg from this GeoPath. |
void |
removeLegAt(int anIndex)
Removes the
ILcdGeoPathLeg object on the specified index from the
from ILcdEditableGeoPath . |
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.
|
getLeg, getLegCount
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getPointSFCT, getX, getY, getZ
public static final int SUBPOINTLIST_INTERSECTION_CORRECTION
ILcdGeoPathLeg.SUB_POINT_LIST
.public static final int ARC_CENTER_CORRECTION
ILcdGeoPathLeg.ARC
.public TLcdDiscretizedLonLatGeoPath()
public TLcdDiscretizedLonLatGeoPath(TLcdDiscretizedLonLatGeoPath aDiscretizedGeoPath)
aDiscretizedGeoPath
- the object to be copiedpublic ILcdBounds getBounds()
getBounds
in interface ILcdBounded
ILcdBounds
public Object clone()
clone
in interface ILcdCloneable
clone
in class ALcdDiscretizedGeoPath
Object.clone()
public ILcdPoint getFocusPoint()
ILcdShape
ILcdShape
.getFocusPoint
in interface ILcdShape
ILcdShape
.public boolean contains2D(ILcdPoint aPoint)
ILcdShape
ILcdShape
contains the given ILcdPoint
in the 2D space.
Only the first two dimensions of the ILcdShape
and the ILcdPoint
are considered.contains2D
in interface ILcdShape
aPoint
- the ILcdPoint
to test.ILcdShape.contains2D(double, double)
public boolean contains2D(double v, double v1)
ILcdShape
ILcdShape
contains the given point in
the 2D space. Only the first two dimensions of the ILcdShape
are considered.contains2D
in interface ILcdShape
v
- the x coordinate of the point.v1
- the y coordinate of the point.public boolean contains3D(ILcdPoint aPoint)
ILcdShape
ILcdShape
contains the given ILcdPoint
in the 3D space.contains3D
in interface ILcdShape
aPoint
- the ILcdPoint
to test.ILcdShape.contains3D(double, double, double)
public boolean contains3D(double v, double v1, double v2)
ILcdShape
ILcdShape
contains the given point in
the 3D space.contains3D
in interface ILcdShape
v
- the x coordinate of the point.v1
- the y coordinate of the point.v2
- the z coordinate of the point.public int getOrientation()
ILcdPolygon
ILcdPolygon
:
ILcdPolygon.CLOCKWISE
or ILcdPolygon.COUNTERCLOCKWISE
.getOrientation
in interface ILcdPolygon
ILcdPolygon
:
ILcdPolygon.CLOCKWISE
or ILcdPolygon.COUNTERCLOCKWISE
.
This method should not return INVALID_ORIENTATION
, which is only to be used for resetting the orientation
so that it can be recalculated.public int getPointCount()
ILcdPointList
ILcdPoint
objects in the list.getPointCount
in interface ILcdPointList
ILcdPoint
objects in the list.public ILcdPoint getPoint(int aIndex) throws IndexOutOfBoundsException
ILcdPointList
ILcdPoint
at a given index.getPoint
in interface ILcdPointList
aIndex
- a valid index in the list of ILcdPoint
objects.ILcdPoint
at the given index.IndexOutOfBoundsException
- if the given index is out of bounds.public void addLeg(ILcdGeoPathLeg aGeoPathLeg)
aGeoPathLeg
to this GeoPath.addLeg
in interface ILcdEditableGeoPath
addLeg
in class TLcdGeoPath
aGeoPathLeg
- the ILcdGeoPathLeg
to be addedpublic boolean removeLeg(ILcdGeoPathLeg aGeoPathLeg)
aGeoPathLeg
from this GeoPath.removeLeg
in class TLcdGeoPath
aGeoPathLeg
- the ILcdGeoPathLeg
to be removedtrue
if the leg was successfully removedpublic void insertLegAt(ILcdGeoPathLeg aLeg, int anIndex)
ILcdEditableGeoPath
ILcdGeoPathLeg
object to the ILcdEditableGeoPath
on the specified index.insertLegAt
in interface ILcdEditableGeoPath
insertLegAt
in class TLcdGeoPath
aLeg
- the ILcdGeoPathLeg
object to be added to the
ILcdEditableGeoPath
.anIndex
- the index in the ILcdEditableAirspace
where the
ILcdAirspaceSegment
object must be added.public void removeLegAt(int anIndex)
ILcdEditableGeoPath
ILcdGeoPathLeg
object on the specified index from the
from ILcdEditableGeoPath
.removeLegAt
in interface ILcdEditableGeoPath
removeLegAt
in class TLcdGeoPath
anIndex
- the index in the ILcdEditableGeoPath
where the
ILcdGeoPathLeg
object must be removed.public void invalidate()
public void invalidateObject()
invalidate()
.invalidateObject
in interface ILcdInvalidateable
invalidate()
public ILcdGeoPathLeg getLegForPoint(int aPointIndex)
aPointIndex
- the index of a discretized point in this GeoPathArrayIndexOutOfBoundsException
- if the index is out of range (index
< 0 || index >= getPointCount()).public int getLegIndexForPoint(int aPointIndex) throws ArrayIndexOutOfBoundsException
aPointIndex
- the index of a discretized point in this GeoPathArrayIndexOutOfBoundsException
- if the index is out of range (index
< 0 || index >= getPointCount()).public void setEllipsoid(ILcdEllipsoid aEllipsoid)
aEllipsoid
- an ILcdEllipsoid
public double getDiscretisationResolutionDistance()
public void setDiscretisationResolutionDistance(double aDiscretisationResolutionDistance)
aDiscretisationResolutionDistance
- the distance between discretized points in meters.public double getDiscretisationResolutionAngle()
public void setDiscretisationResolutionAngle(double aDiscretisationResolutionAngle)
aDiscretisationResolutionAngle
- the distance between discrete points on an arc in degrees.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]protected boolean acceptCorrection(ILcdGeoPathLeg aLeg, int aType, ILcdPoint aOriginalPoint, ILcdPoint aNewPoint)
true
in all cases.aLeg
- The ILcdGeoPathLeg
object for which a data correction is proposed.aType
- An identification of the data correction, which is either SUBPOINTLIST_INTERSECTION_CORRECTION
or ARC_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 a ILcdPoint
), or a point in its data array (ILcdGeoPathLeg.getDataSFCT()
)aNewPoint
- The new point to be used instead of the original point.