Class TLcdShapeList

All Implemented Interfaces:
ILcdBounded, ILcdEditableShapeList, ILcdShape, ILcdShapeList, ILcdCache, ILcdCloneable, ILcdInvalidateable, Serializable, Cloneable
Direct Known Subclasses:
TLcdDataObjectShapeList, TLcdDGN3DSurface, TLcdDGNCell, TLcdDGNComplexChain, TLcdDGNComplexShape, TLcdDGNSolid, TLcdDGNTextNode2D, TLcdDWGBlock, TLcdFeaturedShapeList

public class TLcdShapeList extends ALcdShapeList implements ILcdEditableShapeList
This class provides an implementation of ILcdShapeList. This implementation uses an array of the right size to store the list of shapes, which is memory efficient, but inefficient for adding and removing shapes.

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.

See Also:
  • Constructor Details

    • TLcdShapeList

      public TLcdShapeList()
      Constructs a TLcdShapeList that doesn't have any ILcdShape objects.
    • TLcdShapeList

      public TLcdShapeList(ILcdShape[] aShapeArray)
      Constructs a TLcdShapeList containing the given ILcdShape objects.
      Parameters:
      aShapeArray - an array of shape objects to put in this shape list.
    • TLcdShapeList

      public TLcdShapeList(ILcdShape[] aShapeArray, ILcdBounds aBounds)
      Constructs a TLcdShapeList containing the given ILcdShape objects.
      Parameters:
      aShapeArray - an array of shape objects to put in this shape list.
      aBounds - the total bounds of this shape list, if already known at construction time, or null if unknown.
    • TLcdShapeList

      public TLcdShapeList(TLcdShapeList aShapeList)
      Constructs a TLcdShapeList that is a clone of the given TLcdShapeList.
      Parameters:
      aShapeList - the shape list to clone.
  • Method Details

    • setShape

      public void setShape(ILcdShape[] aShapeArray)
      Sets the ILcdShape objects associated with this ILcdShapeList. This method does exactly the same as setShapes(ILcdShape[]).
      Parameters:
      aShapeArray - the ILcdShape objects associated with this ILcdShapeList.
      See Also:
    • getShapeCount

      public final int getShapeCount()
      Description copied from interface: ILcdShapeList
      Returns the number of ILcdShape objects in the list.
      Specified by:
      getShapeCount in interface ILcdShapeList
      Returns:
      the number of ILcdShape objects in the list.
    • getShape

      public final ILcdShape getShape(int aIndex) throws IndexOutOfBoundsException
      Description copied from interface: ILcdShapeList
      Returns the ILcdShape at the given index.
      Specified by:
      getShape in interface ILcdShapeList
      Parameters:
      aIndex - a valid index in the list of ILcdShape objects.
      Returns:
      the ILcdShape at the given index.
      Throws:
      IndexOutOfBoundsException - when the index is not valid.
    • clone

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

      The shape array is copied without being cloned.

      Specified by:
      clone in interface ILcdCloneable
      Overrides:
      clone in class ALcdShapeList
      See Also:
    • addShape

      public void addShape(int aIndex, ILcdShape aShape)
      Description copied from interface: ILcdEditableShapeList
      Inserts the specified shape at the specified position in this ILcdShapeList.
      Specified by:
      addShape in interface ILcdEditableShapeList
      Parameters:
      aIndex - the index at which the shape is to be inserted.
      aShape - the shape to be inserted.
    • addShape

      public void addShape(ILcdShape aShape)
      Description copied from interface: ILcdEditableShapeList
      Appends the specified shape to the end of this ILcdShapeList.
      Specified by:
      addShape in interface ILcdEditableShapeList
      Parameters:
      aShape - the shape to be appended to this ILcdShapeList.
    • addShapes

      public void addShapes(ILcdShape[] aShape)
      Description copied from interface: ILcdEditableShapeList
      Appends the specified array of shapes to the end of this ILcdShapeList.
      Specified by:
      addShapes in interface ILcdEditableShapeList
      Parameters:
      aShape - the array of shapes to be appended to this ILcdShapeList.
    • clearShapes

      public void clearShapes()
      Description copied from interface: ILcdEditableShapeList
      Removes all of the shapes from this ILcdShapeList.
      Specified by:
      clearShapes in interface ILcdEditableShapeList
    • removeShape

      public ILcdShape removeShape(int aIndex)
      Description copied from interface: ILcdEditableShapeList
      Removes the shape at the specified position in this ILcdShapeList. Shifts any subsequent shapes to the left. Returns the shape that was removed from this ILcdShapeList.
      Specified by:
      removeShape in interface ILcdEditableShapeList
      Parameters:
      aIndex - the index of the shape to removed.
      Returns:
      the shape previously at the specified position.
    • removeShape

      public boolean removeShape(ILcdShape aShape)
      Description copied from interface: ILcdEditableShapeList
      Removes the first occurrence of the specified shape in this ILcdShapeList. If this ILcdShapeList does not contain the shape, it is unchanged.
      Specified by:
      removeShape in interface ILcdEditableShapeList
      Parameters:
      aShape - the shape to be removed, if present.
      Returns:
      true if this ILcdShapeList contained the specified element.
    • removeShapes

      public void removeShapes(ILcdShape[] aShapes)
      Description copied from interface: ILcdEditableShapeList
      Removes all shapes from this ILcdShapeList that are contained in the specified array of shapes.
      Specified by:
      removeShapes in interface ILcdEditableShapeList
      Parameters:
      aShapes - the array of shapes to be removed from this ILcdShapeList.
    • setShape

      public ILcdShape setShape(int aIndex, ILcdShape aShape)
      Description copied from interface: ILcdEditableShapeList
      Replaces the shape at the specified position in this ILcdShapeList with the specified shape.
      Specified by:
      setShape in interface ILcdEditableShapeList
      Parameters:
      aIndex - index of shape to replace.
      aShape - the shape to be stored at the specified position.
      Returns:
      the shape previously at the specified position.
    • setShapes

      public void setShapes(ILcdShape[] aShapes)
      Description copied from interface: ILcdEditableShapeList
      Replace the list of shapes contained in this ILcdShapeList with the specified array of shapes.
      Specified by:
      setShapes in interface ILcdEditableShapeList
      Parameters:
      aShapes - the array of shapes to be stored in this ILcdShapeList.
    • shapeChanged

      public void shapeChanged(int aIndex)
      Description copied from interface: ILcdEditableShapeList
      Notifies this ILcdShapeList that the shape at the specified position has changed.
      Specified by:
      shapeChanged in interface ILcdEditableShapeList
      Parameters:
      aIndex - the index of the shape that has changed.
    • shapeChanged

      public void shapeChanged(ILcdShape aShape)
      Description copied from interface: ILcdEditableShapeList
      Notifies this ILcdShapeList that the specified shape has changed.
      Specified by:
      shapeChanged in interface ILcdEditableShapeList
      Parameters:
      aShape - the shape that has changed.
    • shapesChanged

      public void shapesChanged()
      Description copied from interface: ILcdEditableShapeList
      Notifies this ILcdShapeList that some (possibly all) of its shapes have changed.
      Specified by:
      shapesChanged in interface ILcdEditableShapeList