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

    Constructors
    Constructor
    Description
    Constructs a new empty TLcd2DEditablePointList.
    TLcd2DEditablePointList(ILcd2DEditablePoint[] a2DEditablePoints, boolean aDeepCopy)
    Constructs a new TLcd2DEditablePointList that contains the given array of points.
    TLcd2DEditablePointList(ILcd2DEditablePointList aPointList, boolean aDeepCopy)
    Constructs a new TLcd2DEditablePointList that is a copy of the given ILcd2DEditablePointList.
  • Method Summary

    Modifier and Type
    Method
    Description
    Creates and returns a copy of this object.
    create2DEditablePoint(double aX, double aY)
    Creates an ILcd2DEditablePoint with coordinates ( aX, aY ).
    boolean
     
    final ILcdPoint
    getPoint(int aIndex)
    Returns the ILcdPoint at a given index.
    final int
    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)
    Uses create2DEditablePoint to create a new ILcd2DEditablePoint from ( aX, aY ) .
    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 aX, double aY)
    Translates the specified point of this ILcd2DEditablePointList from 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, wait

    Methods inherited from interface com.luciad.shape.shape2D.ILcd2DEditablePointList

    append2DPoint
  • Constructor Details

    • TLcd2DEditablePointList

      public TLcd2DEditablePointList()
      Constructs a new empty TLcd2DEditablePointList.
    • TLcd2DEditablePointList

      public TLcd2DEditablePointList(ILcd2DEditablePointList aPointList, boolean aDeepCopy)
      Constructs a new TLcd2DEditablePointList that is a copy of the given ILcd2DEditablePointList.
      Parameters:
      aPointList - the ILcd2DEditablePointList to copy.
      aDeepCopy - a boolean indicating whether the individual points in the list should be cloned or just referenced.
    • TLcd2DEditablePointList

      public TLcd2DEditablePointList(ILcd2DEditablePoint[] a2DEditablePoints, boolean aDeepCopy)
      Constructs a new TLcd2DEditablePointList that 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: ILcdPointList
      Returns the number of ILcdPoint objects in the list.
      Specified by:
      getPointCount in interface ILcdPointList
      Returns:
      the number of ILcdPoint objects in the list.
    • getPoint

      public final ILcdPoint getPoint(int aIndex)
      Description copied from interface: ILcdPointList
      Returns the ILcdPoint at a given index.
      Specified by:
      getPoint in interface ILcdPointList
      Parameters:
      aIndex - a valid index in the list of ILcdPoint objects.
      Returns:
      the ILcdPoint at the given index.
    • translate2D

      public void translate2D(double aDeltaX, double aDeltaY)
      Description copied from interface: ILcd2DEditablePointList
      Translates all the points of this 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.
      Specified by:
      translate2D in interface ILcd2DEditablePointList
      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: ILcd2DEditablePointList
      Moves the specified point of this 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.
      Specified by:
      move2DPoint in interface ILcd2DEditablePointList
      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: ILcd2DEditablePointList
      Translates the specified point of this 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.
      Specified by:
      translate2DPoint in interface ILcd2DEditablePointList
      Parameters:
      aX - the x coordinate of the translation vector.
      aY - the y coordinate of the translation vector.
    • insert2DPoint

      public void insert2DPoint(int aIndex, ILcd2DEditablePoint a2DEditablePoint)
    • insert2DPoint

      public void insert2DPoint(int aIndex, double aX, double aY)
      Uses create2DEditablePoint to create a new ILcd2DEditablePoint from ( aX, aY ) .
      Specified by:
      insert2DPoint in interface ILcd2DEditablePointList
      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: ILcd2DEditablePointList
      Removes the point at the given index from this ILcd2DEditablePointList.
      Specified by:
      removePointAt in interface ILcd2DEditablePointList
      Parameters:
      aIndex - a valid index in the list of ILcdPoint objects.
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • clone

      public Object clone()
      Creates and returns a copy of this object.

      The contained editable points are cloned.

      Specified by:
      clone in interface ILcdCloneable
      Overrides:
      clone in class Object
      See Also:
    • create2DEditablePoint

      protected ILcd2DEditablePoint create2DEditablePoint(double aX, double aY)
      Creates an ILcd2DEditablePoint with 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 (see TLcdLonLatPoint).
      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 TLcdXYPoint with coordinates ( aX, aY ).
    • getX

      public double getX(int aIndex)
      Description copied from interface: ILcdPointList
      Returns the X coordinate of the point at aIndex.
      Specified by:
      getX in interface ILcdPointList
      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: ILcdPointList
      Returns the Y coordinate of the point at aIndex.
      Specified by:
      getY in interface ILcdPointList
      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: ILcdPointList
      Returns the Z coordinate of the point at aIndex.
      Specified by:
      getZ in interface ILcdPointList
      Parameters:
      aIndex - the index of the point for which to return the Z coordinate.
      Returns:
      the Z coordinate of the point at aIndex.
    • getPointSFCT

      public void getPointSFCT(int aIndex, ILcd3DEditablePoint aPointSFCT)
      Description copied from interface: ILcdPointList
      Stores the coordinates of the point at aIndex in the given point.
      Specified by:
      getPointSFCT in interface ILcdPointList
      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.