Package com.luciad.shape.shape2D
Class TLcd2DEditablePointList
java.lang.Object
com.luciad.shape.shape2D.TLcd2DEditablePointList
- All Implemented Interfaces:
ILcdPointList,ILcdPointList2,ILcd2DEditablePointList,ILcdCloneable,Serializable,Cloneable
public class TLcd2DEditablePointList
extends Object
implements ILcd2DEditablePointList, ILcdCloneable, ILcdPointList, ILcdPointList2
This class provides an implementation of
ILcd2DEditablePointList.
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 create2DEditablePoint(double, double) method creates
cartesian points (TLcdXYPoint), which are not suitable for use in geodetic shapes
(TLcdLonLatPolypoint, TLcdLonLatPolyline, etc).
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new emptyTLcd2DEditablePointList.TLcd2DEditablePointList(ILcd2DEditablePoint[] a2DEditablePoints, boolean aDeepCopy) Constructs a newTLcd2DEditablePointListthat contains the given array of points.TLcd2DEditablePointList(ILcd2DEditablePointList aPointList, boolean aDeepCopy) Constructs a newTLcd2DEditablePointListthat is a copy of the givenILcd2DEditablePointList. -
Method Summary
Modifier and TypeMethodDescriptionclone()Creates and returns a copy of this object.protected ILcd2DEditablePointcreate2DEditablePoint(double aX, double aY) Creates anILcd2DEditablePointwith coordinates ( aX, aY ).booleanfinal ILcdPointgetPoint(int aIndex) Returns theILcdPointat a given index.final intReturns the number ofILcdPointobjects in the list.voidgetPointSFCT(int aIndex, ILcd3DEditablePoint aPointSFCT) Stores the coordinates of the point ataIndexin the given point.doublegetX(int aIndex) Returns the X coordinate of the point ataIndex.doublegetY(int aIndex) Returns the Y coordinate of the point ataIndex.doublegetZ(int aIndex) Returns the Z coordinate of the point ataIndex.voidinsert2DPoint(int aIndex, double aX, double aY) Uses create2DEditablePoint to create a new ILcd2DEditablePoint from ( aX, aY ) .voidinsert2DPoint(int aIndex, ILcd2DEditablePoint a2DEditablePoint) voidmove2DPoint(int aIndex, double aX, double aY) Moves the specified point of thisILcd2DEditablePointListto the given point in the 2D space.voidremovePointAt(int aIndex) Removes the point at the given index from thisILcd2DEditablePointList.voidtranslate2D(double aDeltaX, double aDeltaY) Translates all the points of thisILcd2DEditablePointListfrom their current positions over the given translation vector in the 2D space.voidtranslate2DPoint(int aIndex, double aX, double aY) Translates the specified point of thisILcd2DEditablePointListfrom its current position over the given translation vector in the 2D space.Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.luciad.shape.shape2D.ILcd2DEditablePointList
append2DPoint
-
Constructor Details
-
TLcd2DEditablePointList
public TLcd2DEditablePointList()Constructs a new emptyTLcd2DEditablePointList. -
TLcd2DEditablePointList
Constructs a newTLcd2DEditablePointListthat is a copy of the givenILcd2DEditablePointList.- Parameters:
aPointList- theILcd2DEditablePointListto copy.aDeepCopy- a boolean indicating whether the individual points in the list should be cloned or just referenced.
-
TLcd2DEditablePointList
Constructs a newTLcd2DEditablePointListthat contains the given array of points.- Parameters:
a2DEditablePoints- 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.
-
-
Method Details
-
getPointCount
public final int getPointCount()Description copied from interface:ILcdPointListReturns the number ofILcdPointobjects in the list.- Specified by:
getPointCountin interfaceILcdPointList- Returns:
- the number of
ILcdPointobjects in the list.
-
getPoint
Description copied from interface:ILcdPointListReturns theILcdPointat a given index.- Specified by:
getPointin interfaceILcdPointList- Parameters:
aIndex- a valid index in the list ofILcdPointobjects.- Returns:
- the
ILcdPointat the given index.
-
translate2D
public void translate2D(double aDeltaX, double aDeltaY) Description copied from interface:ILcd2DEditablePointListTranslates all the points of thisILcd2DEditablePointListfrom 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.- Specified by:
translate2Din interfaceILcd2DEditablePointList- Parameters:
aDeltaX- the x coordinate of the translation vector.aDeltaY- the y coordinate of the translation vector.
-
move2DPoint
public void move2DPoint(int aIndex, double aX, double aY) Description copied from interface:ILcd2DEditablePointListMoves the specified point of thisILcd2DEditablePointListto the given point in the 2D space. Only the first two dimensions of theILcdShapeare considered. The third dimension is left unchanged.- Specified by:
move2DPointin interfaceILcd2DEditablePointList- Parameters:
aIndex- a valid index in the list of points.aX- the x coordinate of the point.aY- the y coordinate of the point.
-
translate2DPoint
public void translate2DPoint(int aIndex, double aX, double aY) Description copied from interface:ILcd2DEditablePointListTranslates the specified point of thisILcd2DEditablePointListfrom 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.- Specified by:
translate2DPointin interfaceILcd2DEditablePointList- Parameters:
aX- the x coordinate of the translation vector.aY- the y coordinate of the translation vector.
-
insert2DPoint
-
insert2DPoint
public void insert2DPoint(int aIndex, double aX, double aY) Uses create2DEditablePoint to create a new ILcd2DEditablePoint from ( aX, aY ) .- Specified by:
insert2DPointin interfaceILcd2DEditablePointList- Parameters:
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.- See Also:
-
removePointAt
public void removePointAt(int aIndex) Description copied from interface:ILcd2DEditablePointListRemoves the point at the given index from thisILcd2DEditablePointList.- Specified by:
removePointAtin interfaceILcd2DEditablePointList- Parameters:
aIndex- a valid index in the list ofILcdPointobjects.
-
equals
-
clone
Creates and returns a copy of this object. The contained editable points are cloned.- Specified by:
clonein interfaceILcdCloneable- Overrides:
clonein classObject- See Also:
-
create2DEditablePoint
Creates anILcd2DEditablePointwith coordinates ( aX, aY ). By default this method creates a TLcdXYPoint. To use the point list with a geodetic shape (TLcdLonLatPolypoint, TLcdLonLatPolyline, etc) you should override this method to create geodetic points (seeTLcdLonLatPoint).- Parameters:
aX- The x-co-ordinate of the point to be created.aY- The y-co-ordinate of the point to be created.- Returns:
- An
TLcdXYPointwith coordinates ( aX, aY ).
-
getX
public double getX(int aIndex) Description copied from interface:ILcdPointListReturns the X coordinate of the point ataIndex.- Specified by:
getXin interfaceILcdPointList- Parameters:
aIndex- the index of the point for which to return the X coordinate.- Returns:
- the X coordinate of the point at
aIndex.
-
getY
public double getY(int aIndex) Description copied from interface:ILcdPointListReturns the Y coordinate of the point ataIndex.- Specified by:
getYin interfaceILcdPointList- Parameters:
aIndex- the index of the point for which to return the Y coordinate.- Returns:
- the Y coordinate of the point at
aIndex.
-
getZ
public double getZ(int aIndex) Description copied from interface:ILcdPointListReturns the Z coordinate of the point ataIndex.- Specified by:
getZin interfaceILcdPointList- Parameters:
aIndex- the index of the point for which to return the Z coordinate.- Returns:
- the Z coordinate of the point at
aIndex.
-
getPointSFCT
Description copied from interface:ILcdPointListStores the coordinates of the point ataIndexin the given point.- Specified by:
getPointSFCTin interfaceILcdPointList- Parameters:
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.
-