public class TLcd3DEditablePointList extends Object implements ILcd3DEditablePointList, ILcdCloneable, ILcdPointList,ILcdPointList2
ILcd3DEditablePointList
.
This implementation uses an array of the right size to store the list of
points, which is memory efficient, but inefficient for adding and
removing points.
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.
Note that the default implementation of the create3DEditablePoint(double, double, double)
method creates
cartesian points (TLcdXYZPoint), which are not suitable for use in geodetic shapes
(TLcdLonLatHeightPolypoint, TLcdLonLatHeightPolyline, etc).
Constructor and Description |
---|
TLcd3DEditablePointList()
Constructs a new empty
TLcd3DEditablePointList . |
TLcd3DEditablePointList(ILcd3DEditablePoint[] a3DEditablePoints,
boolean aDeepCopy)
Constructs a new
TLcd3DEditablePointList that contains the given array of points. |
TLcd3DEditablePointList(ILcd3DEditablePointList aPointList,
boolean aDeepCopy)
Constructs a new
TLcd3DEditablePointList that is a copy of the given ILcd3DEditablePointList . |
Modifier and Type | Method and Description |
---|---|
Object |
clone()
Makes
Object.clone() public. |
protected ILcd3DEditablePoint |
create3DEditablePoint(double aX,
double aY,
double aZ)
Creates an
ILcd3DEditablePoint with coordinates ( aX, aY, aZ ). |
boolean |
equals(Object obj) |
ILcdPoint |
getPoint(int aIndex)
Returns the
ILcdPoint at a given index. |
int |
getPointCount()
Returns the number of
ILcdPoint objects in the list. |
void |
getPointSFCT(int aIndex,
ILcd3DEditablePoint aPointSFCT)
Stores the coordinates of the point at
aIndex in the given point. |
double |
getX(int aIndex)
Returns the X coordinate of the point at
aIndex . |
double |
getY(int aIndex)
Returns the Y coordinate of the point at
aIndex . |
double |
getZ(int aIndex)
Returns the Z coordinate of the point at
aIndex . |
void |
insert2DPoint(int aIndex,
double aX,
double aY)
Inserts a point at the given index into this
ILcd2DEditablePointList . |
void |
insert3DPoint(int aIndex,
double aX,
double aY,
double aZ)
Inserts a point at the given index into this
ILcd3DEditablePointList . |
void |
insert3DPoint(int aIndex,
ILcd3DEditablePoint a3DEditablePoint) |
void |
move2DPoint(int aIndex,
double aX,
double aY)
Moves the specified point of this
ILcd2DEditablePointList to the given point in the 2D space. |
void |
move3DPoint(int aIndex,
double aX,
double aY,
double aZ)
Moves the specified point of this
ILcd3DEditablePointList to the given point in the 3D space. |
void |
removePointAt(int aIndex)
Removes the point at the given index from this
ILcd3DEditablePointList . |
void |
translate2D(double aDeltaX,
double aDeltaY)
Translates all the points of this
ILcd2DEditablePointList from their current positions
over the given translation vector in the 2D space. |
void |
translate2DPoint(int aIndex,
double aDeltaX,
double aDeltaY)
Translates the specified point of this
ILcd2DEditablePointList from its current position
over the given translation vector in the 2D space. |
void |
translate3D(double aDeltaX,
double aDeltaY,
double aDeltaZ)
Translates all the points of this
ILcd3DEditablePointList from their current positions
over the given translation vector in the 3D space. |
void |
translate3DPoint(int aIndex,
double aX,
double aY,
double aZ)
Translates the specified point of this
ILcd3DEditablePointList from its current position
over the given translation vector in the 3D space. |
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
append2DPoint
public TLcd3DEditablePointList()
TLcd3DEditablePointList
.public TLcd3DEditablePointList(ILcd3DEditablePointList aPointList, boolean aDeepCopy)
TLcd3DEditablePointList
that is a copy of the given ILcd3DEditablePointList
.aPointList
- the ILcd3DEditablePointList
to copy.aDeepCopy
- a boolean indicating whether the individual points in
the list should be cloned or just referenced.public TLcd3DEditablePointList(ILcd3DEditablePoint[] a3DEditablePoints, boolean aDeepCopy)
TLcd3DEditablePointList
that contains the given array of points.a3DEditablePoints
- the array of points to copy.aDeepCopy
- a boolean indicating whether the array and the individual points in
the list should be cloned or not.public final int getPointCount()
ILcdPointList
ILcdPoint
objects in the list.getPointCount
in interface ILcdPointList
ILcdPoint
objects in the list.public final ILcdPoint getPoint(int aIndex)
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.public final void translate3D(double aDeltaX, double aDeltaY, double aDeltaZ)
ILcd3DEditablePointList
ILcd3DEditablePointList
from their current positions
over the given translation vector in the 3D space.translate3D
in interface ILcd3DEditablePointList
aDeltaX
- the x coordinate of the translation vector.aDeltaY
- the y coordinate of the translation vector.aDeltaZ
- the z coordinate of the translation vector.public final void move3DPoint(int aIndex, double aX, double aY, double aZ)
ILcd3DEditablePointList
ILcd3DEditablePointList
to the given point in the 3D space.move3DPoint
in interface ILcd3DEditablePointList
aIndex
- a valid index in the list of points.aX
- the x coordinate of the point.aY
- the y coordinate of the point.aZ
- the z coordinate of the point.public final void translate3DPoint(int aIndex, double aX, double aY, double aZ)
ILcd3DEditablePointList
ILcd3DEditablePointList
from its current position
over the given translation vector in the 3D space.translate3DPoint
in interface ILcd3DEditablePointList
aIndex
- a valid new index in the list of points.aX
- the x coordinate of the translation vector.aY
- the y coordinate of the translation vector.aZ
- the z coordinate of the translation vector.public final void insert3DPoint(int aIndex, ILcd3DEditablePoint a3DEditablePoint)
public final void insert3DPoint(int aIndex, double aX, double aY, double aZ)
ILcd3DEditablePointList
ILcd3DEditablePointList
.insert3DPoint
in interface ILcd3DEditablePointList
aIndex
- a valid new index in the list of points.aX
- the x coordinate of the new point.aY
- the y coordinate of the new point.aZ
- the z coordinate of the new point.public final void removePointAt(int aIndex)
ILcd3DEditablePointList
ILcd3DEditablePointList
.removePointAt
in interface ILcd2DEditablePointList
removePointAt
in interface ILcd3DEditablePointList
aIndex
- a valid index in the list of ILcdPoint
objects.public final void translate2D(double aDeltaX, double aDeltaY)
ILcd2DEditablePointList
ILcd2DEditablePointList
from their current positions
over the given translation vector in the 2D space. Only the first two
dimensions of the points are considered. The third dimension is left unchanged.translate2D
in interface ILcd2DEditablePointList
aDeltaX
- the x coordinate of the translation vector.aDeltaY
- the y coordinate of the translation vector.public final void move2DPoint(int aIndex, double aX, double aY)
ILcd2DEditablePointList
ILcd2DEditablePointList
to the given point in the 2D space. Only the first
two dimensions of the ILcdShape
are considered.
The third dimension is left unchanged.move2DPoint
in interface ILcd2DEditablePointList
aIndex
- a valid index in the list of points.aX
- the x coordinate of the point.aY
- the y coordinate of the point.public final void translate2DPoint(int aIndex, double aDeltaX, double aDeltaY)
ILcd2DEditablePointList
ILcd2DEditablePointList
from its current position
over the given translation vector in the 2D space. Only the first two
dimensions of the points are considered. The third dimension is left unchanged.translate2DPoint
in interface ILcd2DEditablePointList
aDeltaX
- the x coordinate of the translation vector.aDeltaY
- the y coordinate of the translation vector.public final void insert2DPoint(int aIndex, double aX, double aY)
ILcd2DEditablePointList
ILcd2DEditablePointList
.insert2DPoint
in interface ILcd2DEditablePointList
aIndex
- a valid new index in the list of points.aX
- the x coordinate of the new point.aY
- the y coordinate of the new point.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()
protected ILcd3DEditablePoint create3DEditablePoint(double aX, double aY, double aZ)
ILcd3DEditablePoint
with coordinates ( aX, aY, aZ ).
By default this method creates a TLcdXYZPoint. To use the point list with a geodetic shape
(TLcdLonLatHeightPolypoint, TLcdLonLatHeightPolyline, etc) you should override this method to
create geodetic points (see TLcdLonLatHeightPoint
)aX
- The x-co-ordinate of the point to be created.aY
- The y-co-ordinate of the point to be created.aZ
- The z-co-ordinate of the point to be created.ILcd3DEditablePoint
with coordinates ( aX, aY, aZ ).public double getX(int aIndex)
ILcdPointList
aIndex
.getX
in interface ILcdPointList
aIndex
- the index of the point for which to return the X coordinate.aIndex
.public double getY(int aIndex)
ILcdPointList
aIndex
.getY
in interface ILcdPointList
aIndex
- the index of the point for which to return the Y coordinate.aIndex
.public double getZ(int aIndex)
ILcdPointList
aIndex
.getZ
in interface ILcdPointList
aIndex
- the index of the point for which to return the Z coordinate.aIndex
.public void getPointSFCT(int aIndex, ILcd3DEditablePoint aPointSFCT)
ILcdPointList
aIndex
in the given point.getPointSFCT
in interface ILcdPointList
aIndex
- the index of the point for which to retrieve the coordinates.aPointSFCT
- the side-effect parameter in which to store the coordinates of the requested
point.