Package com.luciad.shape
Class TLcdShapeList
java.lang.Object
com.luciad.shape.ALcdShape
com.luciad.shape.ALcdShapeList
com.luciad.shape.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
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 Summary
ConstructorsConstructorDescriptionConstructs aTLcdShapeListthat doesn't have anyILcdShapeobjects.TLcdShapeList(ILcdShape[] aShapeArray) Constructs aTLcdShapeListcontaining the givenILcdShapeobjects.TLcdShapeList(ILcdShape[] aShapeArray, ILcdBounds aBounds) Constructs aTLcdShapeListcontaining the givenILcdShapeobjects.TLcdShapeList(TLcdShapeList aShapeList) Constructs aTLcdShapeListthat is a clone of the givenTLcdShapeList. -
Method Summary
Modifier and TypeMethodDescriptionvoidInserts the specified shape at the specified position in thisILcdShapeList.voidAppends the specified shape to the end of thisILcdShapeList.voidAppends the specified array of shapes to the end of thisILcdShapeList.voidRemoves all of the shapes from thisILcdShapeList.clone()Creates and returns a copy of this object.final ILcdShapegetShape(int aIndex) Returns theILcdShapeat the given index.final intReturns the number ofILcdShapeobjects in the list.removeShape(int aIndex) Removes the shape at the specified position in thisILcdShapeList.booleanremoveShape(ILcdShape aShape) Removes the first occurrence of the specified shape in thisILcdShapeList.voidremoveShapes(ILcdShape[] aShapes) Removes all shapes from thisILcdShapeListthat are contained in the specified array of shapes.Replaces the shape at the specified position in thisILcdShapeListwith the specified shape.voidSets theILcdShapeobjects associated with thisILcdShapeList.voidReplace the list of shapes contained in thisILcdShapeListwith the specified array of shapes.voidshapeChanged(int aIndex) Notifies thisILcdShapeListthat the shape at the specified position has changed.voidshapeChanged(ILcdShape aShape) Notifies thisILcdShapeListthat the specified shape has changed.voidNotifies thisILcdShapeListthat some (possibly all) of its shapes have changed.Methods inherited from class com.luciad.shape.ALcdShapeList
calculateFocusPoint, clearCache, contains2D, contains3D, equals, getBounds, getCachedObject, getFocusPoint, hashCode, insertIntoCache, invalidateBounds, invalidateObject, removeCachedObject, setFocusPoint, toStringMethods inherited from class com.luciad.shape.ALcdShape
contains2D, contains3D, fromDomainObjectMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.luciad.shape.ILcdBounded
getBoundsMethods inherited from interface com.luciad.shape.ILcdShape
contains2D, contains2D, contains3D, contains3D, getFocusPoint
-
Constructor Details
-
TLcdShapeList
public TLcdShapeList()Constructs aTLcdShapeListthat doesn't have anyILcdShapeobjects. -
TLcdShapeList
Constructs aTLcdShapeListcontaining the givenILcdShapeobjects.- Parameters:
aShapeArray- an array of shape objects to put in this shape list.
-
TLcdShapeList
Constructs aTLcdShapeListcontaining the givenILcdShapeobjects.- 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, ornullif unknown.
-
TLcdShapeList
Constructs aTLcdShapeListthat is a clone of the givenTLcdShapeList.- Parameters:
aShapeList- the shape list to clone.
-
-
Method Details
-
setShape
Sets theILcdShapeobjects associated with thisILcdShapeList. This method does exactly the same assetShapes(ILcdShape[]).- Parameters:
aShapeArray- theILcdShapeobjects associated with thisILcdShapeList.- See Also:
-
getShapeCount
public final int getShapeCount()Description copied from interface:ILcdShapeListReturns the number ofILcdShapeobjects in the list.- Specified by:
getShapeCountin interfaceILcdShapeList- Returns:
- the number of
ILcdShapeobjects in the list.
-
getShape
Description copied from interface:ILcdShapeListReturns theILcdShapeat the given index.- Specified by:
getShapein interfaceILcdShapeList- Parameters:
aIndex- a valid index in the list ofILcdShapeobjects.- Returns:
- the
ILcdShapeat the given index. - Throws:
IndexOutOfBoundsException- when the index is not valid.
-
clone
Creates and returns a copy of this object. The shape array is copied without being cloned.- Specified by:
clonein interfaceILcdCloneable- Overrides:
clonein classALcdShapeList- See Also:
-
addShape
Description copied from interface:ILcdEditableShapeListInserts the specified shape at the specified position in thisILcdShapeList.- Specified by:
addShapein interfaceILcdEditableShapeList- Parameters:
aIndex- the index at which the shape is to be inserted.aShape- the shape to be inserted.
-
addShape
Description copied from interface:ILcdEditableShapeListAppends the specified shape to the end of thisILcdShapeList.- Specified by:
addShapein interfaceILcdEditableShapeList- Parameters:
aShape- the shape to be appended to thisILcdShapeList.
-
addShapes
Description copied from interface:ILcdEditableShapeListAppends the specified array of shapes to the end of thisILcdShapeList.- Specified by:
addShapesin interfaceILcdEditableShapeList- Parameters:
aShape- the array of shapes to be appended to thisILcdShapeList.
-
clearShapes
public void clearShapes()Description copied from interface:ILcdEditableShapeListRemoves all of the shapes from thisILcdShapeList.- Specified by:
clearShapesin interfaceILcdEditableShapeList
-
removeShape
Description copied from interface:ILcdEditableShapeListRemoves the shape at the specified position in thisILcdShapeList. Shifts any subsequent shapes to the left. Returns the shape that was removed from thisILcdShapeList.- Specified by:
removeShapein interfaceILcdEditableShapeList- Parameters:
aIndex- the index of the shape to removed.- Returns:
- the shape previously at the specified position.
-
removeShape
Description copied from interface:ILcdEditableShapeListRemoves the first occurrence of the specified shape in thisILcdShapeList. If thisILcdShapeListdoes not contain the shape, it is unchanged.- Specified by:
removeShapein interfaceILcdEditableShapeList- Parameters:
aShape- the shape to be removed, if present.- Returns:
trueif thisILcdShapeListcontained the specified element.
-
removeShapes
Description copied from interface:ILcdEditableShapeListRemoves all shapes from thisILcdShapeListthat are contained in the specified array of shapes.- Specified by:
removeShapesin interfaceILcdEditableShapeList- Parameters:
aShapes- the array of shapes to be removed from thisILcdShapeList.
-
setShape
Description copied from interface:ILcdEditableShapeListReplaces the shape at the specified position in thisILcdShapeListwith the specified shape.- Specified by:
setShapein interfaceILcdEditableShapeList- 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
Description copied from interface:ILcdEditableShapeListReplace the list of shapes contained in thisILcdShapeListwith the specified array of shapes.- Specified by:
setShapesin interfaceILcdEditableShapeList- Parameters:
aShapes- the array of shapes to be stored in thisILcdShapeList.
-
shapeChanged
public void shapeChanged(int aIndex) Description copied from interface:ILcdEditableShapeListNotifies thisILcdShapeListthat the shape at the specified position has changed.- Specified by:
shapeChangedin interfaceILcdEditableShapeList- Parameters:
aIndex- the index of the shape that has changed.
-
shapeChanged
Description copied from interface:ILcdEditableShapeListNotifies thisILcdShapeListthat the specified shape has changed.- Specified by:
shapeChangedin interfaceILcdEditableShapeList- Parameters:
aShape- the shape that has changed.
-
shapesChanged
public void shapesChanged()Description copied from interface:ILcdEditableShapeListNotifies thisILcdShapeListthat some (possibly all) of its shapes have changed.- Specified by:
shapesChangedin interfaceILcdEditableShapeList
-