public abstract class ALcdShapeList extends ALcdShape implements ILcdShapeList, ILcdInvalidateable, ILcdCache
ILcdShapeList
interface.
This class has a bounds cache, which is computed as the union of the bounds
of the ILcdShape
objects.
This class also has a focus point cache.
For for computing the focus point, implementations may override the method
calculateFocusPoint()
. The default implementation computes the
center of the bounding box.
The result of calculateFocusPoint()
is only used if the focus point
has not been set explicitly using setFocusPoint(ILcdPoint)
.
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.
Constructor and Description |
---|
ALcdShapeList()
Constructs a new, empty shape list.
|
Modifier and Type | Method and Description |
---|---|
protected void |
calculateFocusPoint()
Computes the focus point as the center of the bounding box.
|
void |
clearCache()
Clears the cache.
|
Object |
clone()
Creates and returns a copy of this object, by delegating to
ALcdShape.clone() . |
boolean |
contains2D(double aX,
double aY)
Checks whether this
ILcdShape contains the given point in
the 2D space. |
boolean |
contains3D(double aX,
double aY,
double aZ)
Checks whether this
ILcdShape contains the given point in
the 3D space. |
boolean |
equals(Object aObject)
Returns whether the given object has the same class,
the same focus point, and the same shapes (in the same order).
|
ILcdBounds |
getBounds()
Returns the
ILcdBounds by which the geometry of this ILcdBounded object
is bounded. |
Object |
getCachedObject(Object aKey)
Looks up and returns the cached Object corresponding to the given key.
|
ILcdPoint |
getFocusPoint()
Returns the focus point of the shape list.
|
int |
hashCode()
The hash code of this shape is the hash code of its class, in order to
be consistent with the
ALcdShape.equals(Object) method. |
void |
insertIntoCache(Object aKey,
Object aObject)
Inserts a cache Object corresponding to the given key Object.
|
void |
invalidateBounds()
Notifies this object that its bounds have changed because one of its shapes
has changed.
|
void |
invalidateObject()
Invalidates all cached values of this object.
|
Object |
removeCachedObject(Object aKey)
Looks up and removes the cached Object corresponding to the given key.
|
void |
setFocusPoint(ILcd3DEditablePoint aFocusPoint)
Specifies the focus point value.
|
String |
toString() |
contains2D, contains3D, fromDomainObject
finalize, getClass, notify, notifyAll, wait, wait, wait
getShape, getShapeCount
contains2D, contains3D
public void invalidateObject()
ILcdInvalidateable
invalidateObject
in interface ILcdInvalidateable
public void invalidateBounds()
public ILcdBounds getBounds()
ILcdBounded
ILcdBounds
by which the geometry of this ILcdBounded
object
is bounded.
If the geometry does not allow retrieving valid bounds (for example a polyline with 0 points)
the return value is unspecified.
It is highly recommended to return an undefined
bounds.
You can create undefined bounds using the default constructors
of TLcdLonLatBounds
or TLcdXYBounds
.
getBounds
in interface ILcdBounded
ILcdBounds
by which the geometry of this ILcdBounded
object
is bounded.public ILcdPoint getFocusPoint()
calculateFocusPoint()
, if necessary, and then returns
the cached fFocusPoint
.getFocusPoint
in interface ILcdShape
ILcdShape
.protected void calculateFocusPoint()
public void setFocusPoint(ILcd3DEditablePoint aFocusPoint)
aFocusPoint
- the new focus point value.getFocusPoint()
public boolean contains2D(double aX, double aY)
ILcdShape
ILcdShape
contains the given point in
the 2D space. Only the first two dimensions of the ILcdShape
are considered.contains2D
in interface ILcdShape
aX
- the x coordinate of the point.aY
- the y coordinate of the point.public boolean contains3D(double aX, double aY, double aZ)
ILcdShape
ILcdShape
contains the given point in
the 3D space.contains3D
in interface ILcdShape
aX
- the x coordinate of the point.aY
- the y coordinate of the point.aZ
- the z coordinate of the point.public Object clone()
ALcdShape.clone()
. Extensions should delegate to this implementation
with super.clone()
, in order to create an object instance of
the right type, with all fields copied. They then should explicitly
clone any non-primitive fields for which a deeper clone is required.clone
in interface ILcdCloneable
clone
in class ALcdShape
Object.clone()
public boolean equals(Object aObject)
public int hashCode()
ALcdShape
ALcdShape.equals(Object)
method.
Extensions should refine this implementation, based on their properties.public void clearCache()
ILcdCache
clearCache
in interface ILcdCache
public Object removeCachedObject(Object aKey)
ILcdCache
removeCachedObject
in interface ILcdCache
aKey
- the key Object that was used for storing the cache Object.public Object getCachedObject(Object aKey)
ILcdCache
getCachedObject
in interface ILcdCache
aKey
- the key Object that was used for storing the cache Object.public void insertIntoCache(Object aKey, Object aObject)
ILcdCache
insertIntoCache
in interface ILcdCache
aKey
- the key Object that will be used to identify the Object.
The key must therefore be a unique identifier, typically the caller
itself: insertIntoCache(this, ...)
.aObject
- the Object to be cached.