public class TLcdLonLatArc extends ALcd2DEditableShape implements ILcd2DEditableArc, ILcdCurve, ILcdCache
ILcd2DEditableArc
in
the geodetic space.
In addition to the properties defined by ILcd2DEditableArc
,
a TLcdLonLatArc
has an ellipsoid on which it lives.
It implements ILcdCache
, thus providing a cache
to store expensive calculations, e.g. for painters,
to store model-world transformations. The cache is cleared whenever the shape is modified.
All longitude/latitude coordinates and angles are expressed in degrees. Lengths are expressed in meters.
This class is thread-safe for concurrent read-only access of its contents. For read-write access, external locking must be used. Such locking is typically done at the model level.
ARC_END_CORNER, ARC_START_CORNER, MAJOR_RADIUS_CORNER, MAJOR_RADIUS_OPPOSITE_CORNER, MINOR_RADIUS_CORNER, MINOR_RADIUS_OPPOSITE_CORNER
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 |
---|
TLcdLonLatArc()
Creates a new full
TLcdLonLatArc with all other parameters
set to 0, and with a default ellipsoid. |
TLcdLonLatArc(double aCenterLon,
double aCenterLat,
double aA,
double aB,
double aRotAngle,
double aStartAngle,
double aArcAngle,
ILcdEllipsoid aEllipsoid)
Creates a new
TLcdLonLatArc with the given parameters. |
TLcdLonLatArc(ILcdPoint aCenter,
double aA,
double aB,
double aRotAngle,
double aStartAngle,
double aArcAngle,
ILcdEllipsoid aEllipsoid)
Creates a new
TLcdLonLatArc with the given parameters. |
TLcdLonLatArc(TLcdLonLatArc aLonLatArc)
Creates a new
TLcdLonLatArc that is a deep copy of the given
TLcdLonLatArc . |
Modifier and Type | Method and Description |
---|---|
void |
clearCache()
Clears the cache.
|
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 aLon,
double aLat)
Checks whether this
ILcdShape contains the given point in
the 2D space. |
boolean |
contains2D(ILcdPoint aLLP)
Checks whether this
ALcdShape contains the given point in the
2D cartesian plane. |
void |
corner2DEditablePointSFCT(int aCorner,
ILcd2DEditablePoint a2DEditablePointSFCT)
Computes the position of the specified corner of this
ILcdArc . |
boolean |
equals(Object aObject)
Returns whether the given object has the same class and the same
coordinates and parameters.
|
double |
getA()
Returns the length of the semi-major axis (in meters).
|
double |
getArcAngle()
Returns the arc angle (in degrees).
|
double |
getB()
Returns the length of the semi-minor axis (in meters).
|
ILcdBounds |
getBounds()
Returns the
ILcdBounds by which the geometry of this ILcdBounded object
is bounded. |
Object |
getCachedObject(Object aKey)
Looks up and returns the cached Object corresponding to the given key.
|
ILcdPoint |
getCenter()
Returns the center of this
ILcdArc . |
ILcdEllipsoid |
getEllipsoid() |
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,
which is
ILcdCurve.INTERPOLATION_ELLIPTICAL . |
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.
|
double |
getRotAngle()
Returns the rotation angle of the ellipse of the arc (in degrees).
|
double |
getStartAngle()
Returns the start angle of the arc (in degrees).
|
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.
|
int |
hashCode()
The hash code of this shape is the hash code of its class, in order to
be consistent with the
ALcdShape.equals(Object) method. |
void |
insertIntoCache(Object aKey,
Object aObject)
Inserts a cache Object corresponding to the given key Object.
|
protected void |
invalidateBounds() |
void |
move2D(double x,
double y)
Translates this shape so that its focus point ends up at the specified
position.
|
Object |
removeCachedObject(Object aKey)
Looks up and removes the cached Object corresponding to the given key.
|
void |
setA(double aA)
Sets the length of the semi-major axis of the ellipse on which this arc resides.
|
void |
setArcAngle(double aArcAngle)
Sets the arc angle.
|
void |
setB(double aB)
Sets the length of the semi-minor axis of the ellipse on which this arc resides.
|
void |
setEllipsoid(ILcdEllipsoid aEllipsoid)
Sets the ellipsoid of this
TLcdLonLatArc . |
void |
setRotAngle(double aRotAngle)
Sets the rotation angle of the ellipse of the arc.
|
void |
setStartAngle(double aStartAngle)
Sets the start angle of the arc.
|
String |
toString() |
void |
translate2D(double x,
double y)
Translates this
ILcd2DEditableShape from its current position over the given translation
vector in the 2D space. |
void |
updateForCornerPoint2D(int aCorner,
ILcdPoint aPoint)
Updates the arc for the specified corner point location.
|
contains3D, move2D
contains3D, fromDomainObject
finalize, getClass, notify, notifyAll, wait, wait, wait
move2D
contains3D, contains3D
public TLcdLonLatArc()
TLcdLonLatArc
with all other parameters
set to 0, and with a default ellipsoid.public TLcdLonLatArc(TLcdLonLatArc aLonLatArc)
TLcdLonLatArc
that is a deep copy of the given
TLcdLonLatArc
.aLonLatArc
- the TLcdLonLatArc
to copy.public TLcdLonLatArc(ILcdPoint aCenter, double aA, double aB, double aRotAngle, double aStartAngle, double aArcAngle, ILcdEllipsoid aEllipsoid)
TLcdLonLatArc
with the given parameters.aCenter
- the center point.aA
- the length of the semi-major axis (in meters).aB
- the length of the semi-minor axis (in meters).aRotAngle
- the rotation angle (in degrees, counterclockwise from
the direction at 3 o'clock).aStartAngle
- the start angle (in degrees, counterclockwise from
the direction at 3 o'clock).aArcAngle
- the arc angle (in degrees, counterclockwise from
the start angle).aEllipsoid
- the ellipsoid.public TLcdLonLatArc(double aCenterLon, double aCenterLat, double aA, double aB, double aRotAngle, double aStartAngle, double aArcAngle, ILcdEllipsoid aEllipsoid)
TLcdLonLatArc
with the given parameters.aCenterLon
- the longitude of the center.aCenterLat
- the latitude of the center.aA
- the length of the semi-major axis (in meters).aB
- the length of the semi-minor axis (in meters).aRotAngle
- the rotation angle (in degrees, counterclockwise from
the direction at 3 o'clock).aStartAngle
- the start angle (in degrees, counterclockwise from
the direction at 3 o'clock).aArcAngle
- the arc angle (in degrees, counterclockwise from
the start angle).aEllipsoid
- the ellipsoid.public ILcdEllipsoid getEllipsoid()
TLcdLonLatArc
.public void setEllipsoid(ILcdEllipsoid aEllipsoid)
TLcdLonLatArc
.aEllipsoid
- the new ellipsoid.public final double getA()
public void setA(double aA)
setA
in interface ILcd2DEditableArc
aA
- the length of the semi-major axis (in meters) of the ellipse on which this arc resides. This value may
not be negative.IllegalArgumentException
- if the length of the semi-major axis of the ellipse on which this arc resides is
negative.public final double getB()
public void setB(double aB)
setB
in interface ILcd2DEditableArc
aB
- the length of the semi-minor axis (in meters) of the ellipse on which this arc resides. This value may
not be negative.IllegalArgumentException
- if the length of the semi-minor axis of the ellipse on which this arc resides is
negative.public final double getRotAngle()
getRotAngle
in interface ILcdArc
public void setRotAngle(double aRotAngle)
setRotAngle
in interface ILcd2DEditableArc
aRotAngle
- the rotation angle (in degrees, counterclockwise from
the direction at 3 o'clock).public final double getStartAngle()
getStartAngle
in interface ILcdArc
public void setStartAngle(double aStartAngle)
setStartAngle
in interface ILcd2DEditableArc
aStartAngle
- the start angle (in degrees, counterclockwise from
the direction at 3 o'clock).public final double getArcAngle()
getArcAngle
in interface ILcdArc
public void setArcAngle(double aArcAngle)
setArcAngle
in interface ILcd2DEditableArc
aArcAngle
- the arc angle (in degrees, counterclockwise from
the start angle).public final ILcdPoint getCenter()
ILcdArc
ILcdArc
.public ILcdPoint getFocusPoint()
ILcdShape
ILcdShape
.getFocusPoint
in interface ILcdShape
ILcdShape
.public void corner2DEditablePointSFCT(int aCorner, ILcd2DEditablePoint a2DEditablePointSFCT)
ILcdArc
ILcdArc
.corner2DEditablePointSFCT
in interface ILcdArc
aCorner
- the corner:
ILcdArc.MAJOR_RADIUS_CORNER
,
ILcdArc.MINOR_RADIUS_CORNER
,
ILcdArc.MAJOR_RADIUS_OPPOSITE_CORNER
,
ILcdArc.MINOR_RADIUS_OPPOSITE_CORNER
,
ILcdArc.ARC_START_CORNER
, or
ILcdArc.ARC_END_CORNER
.a2DEditablePointSFCT
- an ILcd2DEditablePoint
into which
the result is written as a side-effect.public void updateForCornerPoint2D(int aCorner, ILcdPoint aPoint)
ILcd2DEditableArc
updateForCornerPoint2D
in interface ILcd2DEditableArc
aCorner
- a constant indicating which corner is to be moved:
ILcdArc.MAJOR_RADIUS_CORNER
,
ILcdArc.MINOR_RADIUS_CORNER
,
ILcdArc.MAJOR_RADIUS_OPPOSITE_CORNER
,
ILcdArc.MINOR_RADIUS_OPPOSITE_CORNER
,
ILcdArc.ARC_START_CORNER
, or
ILcdArc.ARC_END_CORNER
.aPoint
- the new coordinate of the point.protected void invalidateBounds()
public ILcdBounds getBounds()
ILcdBounded
ILcdBounds
by which the geometry of this ILcdBounded
object
is bounded.
If the geometry does not allow retrieving valid bounds (for example a polyline with 0 points)
the return value is unspecified.
It is highly recommended to return an undefined
bounds.
You can create undefined bounds using the default constructors
of TLcdLonLatBounds
or TLcdXYBounds
.
getBounds
in interface ILcdBounded
ILcdBounds
by which the geometry of this ILcdBounded
object
is bounded.public boolean contains2D(double aLon, double aLat)
ILcdShape
ILcdShape
contains the given point in
the 2D space. Only the first two dimensions of the ILcdShape
are considered.contains2D
in interface ILcdShape
aLon
- the x coordinate of the point.aLat
- the y coordinate of the point.public boolean contains2D(ILcdPoint aLLP)
ALcdShape
ALcdShape
contains the given point in the
2D cartesian plane.contains2D
in interface ILcdShape
contains2D
in class ALcdShape
aLLP
- the point to test.ILcdShape.contains2D(double, double)
public void translate2D(double x, double y)
ILcd2DEditableShape
ILcd2DEditableShape
from its current position over the given translation
vector in the 2D space. Only the first two dimensions of the ILcdShape
are considered.
The third dimension is left unchanged.translate2D
in interface ILcd2DEditableShape
x
- the x coordinate of the translation vector.y
- the y coordinate of the translation vector.public void move2D(double x, double y)
ALcd2DEditableShape
move2D
in interface ILcd2DEditableShape
move2D
in class ALcd2DEditableShape
x
- the x coordinate of the point.y
- the y coordinate of the point.public ILcdPoint getStartPoint()
ILcdCurve
This is equivalent to computePointSFCT(0)
.
getStartPoint
in interface ILcdCurve
public ILcdPoint getEndPoint()
ILcdCurve
This is equivalent to computePointSFCT(1)
.
getEndPoint
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 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 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 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 String getInterpolation()
ILcdCurve.INTERPOLATION_ELLIPTICAL
.getInterpolation
in interface ILcdCurve
INTERPOLATION_ELLIPTICAL
.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 void insertIntoCache(Object aKey, Object aObject)
ILcdCache
insertIntoCache
in interface ILcdCache
aKey
- the key Object that will be used to identify the Object.
The key must therefore be a unique identifier, typically the caller
itself: insertIntoCache(this, ...)
.aObject
- the Object to be cached.public Object getCachedObject(Object aKey)
ILcdCache
getCachedObject
in interface ILcdCache
aKey
- the key Object that was used for storing the cache Object.public Object removeCachedObject(Object aKey)
ILcdCache
removeCachedObject
in interface ILcdCache
aKey
- the key Object that was used for storing the cache Object.public void clearCache()
ILcdCache
clearCache
in interface ILcdCache
public Object clone()
clone
in interface ILcdCloneable
clone
in class ALcdShape
Object.clone()
public boolean equals(Object aObject)
public int hashCode()
ALcdShape
ALcdShape.equals(Object)
method.
Extensions should refine this implementation, based on their properties.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 segment