public class TLcd2DEditablePointListXYFloatArray extends Object implements ILcd2DEditablePointList, ILcdCloneable
ILcd2DEditablePointList
.
This implementation uses an array of the right size to store the coordinates
of the points, which is memory efficient, but inefficient for adding and
removing points.
This class is thread-safe for read-only access.
Constructor and Description |
---|
TLcd2DEditablePointListXYFloatArray()
Constructs a new empty
TLcd2DEditablePointList . |
TLcd2DEditablePointListXYFloatArray(float[] aPoints,
boolean aDeepCopy)
Constructs a new
TLcd2DEditablePointList that is a copy of the given ILcd2DEditablePointList . |
TLcd2DEditablePointListXYFloatArray(TLcd2DEditablePointListXYFloatArray a2DEditablePointListXYFloatArray,
boolean aDeepCopy) |
Modifier and Type | Method and Description |
---|---|
Object |
clone()
Makes
Object.clone() public. |
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 |
insert2DPoint(int aIndex,
double aX,
double aY)
Inserts a point at the given index into this
ILcd2DEditablePointList . |
void |
insert2DPoint(int aIndex,
ILcd2DEditablePoint a2DEditablePoint) |
void |
move2DPoint(int aIndex,
double aX,
double aY)
Moves the specified point of this
ILcd2DEditablePointList to the given point in the 2D space. |
void |
removePointAt(int aIndex)
Removes the point at the given index from this
ILcd2DEditablePointList . |
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. |
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
append2DPoint
getPointSFCT, getX, getY, getZ
public TLcd2DEditablePointListXYFloatArray()
TLcd2DEditablePointList
.public TLcd2DEditablePointListXYFloatArray(float[] aPoints, boolean aDeepCopy)
TLcd2DEditablePointList
that is a copy of the given ILcd2DEditablePointList
.aPoints
- an array of x/y coordinates. The n
'th point is specified by the values
aPoints[2n]
(the x) and aPoints[2n+1]
(the y).aDeepCopy
- a boolean indicating whether the individual points in
the list should be cloned or just referenced.public TLcd2DEditablePointListXYFloatArray(TLcd2DEditablePointListXYFloatArray a2DEditablePointListXYFloatArray, boolean aDeepCopy)
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 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 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 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 void insert2DPoint(int aIndex, ILcd2DEditablePoint a2DEditablePoint)
public 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 void removePointAt(int aIndex)
ILcd2DEditablePointList
ILcd2DEditablePointList
.removePointAt
in interface ILcd2DEditablePointList
aIndex
- a valid index in the list of ILcdPoint
objects.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()