public final class TLcdRoundedPolyline extends Object implements ILcdCompositeCurve, ILcdCache, ILcdInvalidateable
This class represents a closed, 2D composite curve
, whose shape is determined by a roundness value and a set of points.
These points are referred to as control points. Typically, only the first and last points will be on the curve. The rest of the curve will be inside the convex hull formed by the control points.
This class is typically used to create a rounded version of a ILcdPolyline
.
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 |
---|
TLcdRoundedPolyline(ILcdModelReference aModelReference,
ILcdPointList aControlPoints,
double aRoundness)
Creates a new
TLcdRoundedPolyline using the points contained in the given ILcdPointList as control points. |
TLcdRoundedPolyline(ILcdPointList aControlPoints,
double aRoundness)
Creates a new
TLcdRoundedPolyline using the points contained in the given ILcdPointList as control points and a TLcdGeodeticReference as model reference. |
Modifier and Type | Method and Description |
---|---|
void |
clearCache()
Clears the cache.
|
Object |
clone()
Makes
Object.clone() public. |
void |
computePointSFCT(double aParam,
ILcd3DEditablePoint aPointSFCT)
Computes a point of the curve, defined by the given parameter.
|
boolean |
contains2D(double aX,
double aY)
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 aX,
double aY,
double aZ)
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. |
boolean |
equals(Object aO) |
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.
|
ILcdPointList |
getControlPoints()
Returns the list of control points that define this
ILcdCompositeCurve . |
List<ILcdCurve> |
getCurves()
Returns a list with the curve's elements.
|
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_MIXED . |
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.
|
ILcdModelReference |
getModelReference()
The model reference of the model that this shape will be added to.
|
double |
getRoundness()
This value indicates the roundness of this
TLcdRoundedPolyline . |
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() |
void |
insertIntoCache(Object aKey,
Object aObject)
Inserts a cache Object corresponding to the given key Object.
|
void |
invalidateObject()
Invalidates all cached values of this object.
|
Object |
removeCachedObject(Object aKey)
Looks up and removes the cached Object corresponding to the given key.
|
public TLcdRoundedPolyline(ILcdPointList aControlPoints, double aRoundness)
Creates a new TLcdRoundedPolyline
using the points contained in the given ILcdPointList
as control points and a TLcdGeodeticReference
as model reference.
You can use this constructor to create an open curve, that roughly follows the shape formed by the given control points.
Typically, only the first and last points will be on the curve. The rest of the curve will be inside the convex hull formed by the control points.
aControlPoints
- A ILcdPointList
whose points will be used as control points for the resulting TLcdRoundedPolyline
.
Modifying the ILcdPointList
will modify TLcdRoundedPolyline
after calling invalidateObject()
. This point list must not be null
.aRoundness
- A number in the range [0.0, 1.0] indicating the roundness of the resulting curve. public TLcdRoundedPolyline(ILcdModelReference aModelReference, ILcdPointList aControlPoints, double aRoundness)
Creates a new TLcdRoundedPolyline
using the points contained in the given ILcdPointList
as control points.
You can use this constructor to create an open curve, that roughly follows the shape formed by the given control points.
Typically, only the first and last points will be on the curve. The rest of the curve will be inside the convex hull formed by the control points.
aModelReference
- The model reference of the model that the resulting TLcdRoundedPolyline
will be added to. This model reference must not be null
.aControlPoints
- A ILcdPointList
whose points will be used as control points for the resulting TLcdRoundedPolyline
.
Modifying the ILcdPointList
will modify TLcdRoundedPolyline
after calling invalidateObject()
. This point list must not be null
.aRoundness
- A number in the range [0.0, 1.0] indicating the roundness of the resulting curve. public double getRoundness()
This value indicates the roundness of this TLcdRoundedPolyline
.
public ILcdPointList getControlPoints()
Returns the list of control points that define this ILcdCompositeCurve
.
ILcdPointList
containing the control points that define this ILcdCompositeCurve
.public ILcdModelReference getModelReference()
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 ILcdPoint getStartPoint()
ILcdCompositeCurve
ILcdCurve.computePointSFCT(double, com.luciad.shape.shape3D.ILcd3DEditablePoint)
with parameter value 0.
In case of an empty composite curve, null
is returned.
getStartPoint
in interface ILcdCompositeCurve
getStartPoint
in interface ILcdCurve
public ILcdPoint getEndPoint()
ILcdCompositeCurve
ILcdCurve.computePointSFCT(double, com.luciad.shape.shape3D.ILcd3DEditablePoint)
with parameter value 1.
In case of an empty composite curve, null
is returned.
getEndPoint
in interface ILcdCompositeCurve
getEndPoint
in interface ILcdCurve
public List<ILcdCurve> getCurves()
ILcdCompositeCurve
The returned list is not guaranteed to be editable. See ILcdEditableCompositeCurve
for an editable variant of this interface.
Note that this adding curves to the result of calling this method may throw a
ClassCastException
or IllegalArgumentException
in case the class of the curve(s) to add is not
compatible with the implementation of the composite curve. Implementations should
specify in their documentation all restrictions that apply in this context.
getCurves
in interface ILcdCompositeCurve
public String getInterpolation()
ILcdCompositeCurve
ILcdCurve.INTERPOLATION_MIXED
.getInterpolation
in interface ILcdCompositeCurve
getInterpolation
in interface ILcdCurve
INTERPOLATION_MIXED
.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 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 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 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 aX, double aY)
ILcdShape
ILcdShape
contains the given point in
the 2D space. Only the first two dimensions of the ILcdShape
are considered.contains2D
in interface ILcdShape
aX
- the x coordinate of the point.aY
- 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 aX, double aY, double aZ)
ILcdShape
ILcdShape
contains the given point in
the 3D space.contains3D
in interface ILcdShape
aX
- the x coordinate of the point.aY
- the y coordinate of the point.aZ
- the z coordinate of the point.public 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 void invalidateObject()
ILcdInvalidateable
invalidateObject
in interface ILcdInvalidateable
public Object clone()
ILcdCloneable
Makes Object.clone()
public.
java.lang.Object
, it can be implemented like this:
public Object clone() {
try {
return super.clone();
} catch ( CloneNotSupportedException e ) {
// Cannot happen: extends from Object and implements Cloneable (see also Object.clone)
throw new RuntimeException( e );
}
}
clone
in interface ILcdCloneable
clone
in class Object
Object.clone()