public class TLcdComplexPolygon extends ALcdShape implements ILcdEditableComplexPolygon, ILcdCache
ILcdComplexPolygon
.
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.
Constructor and Description |
---|
TLcdComplexPolygon()
Constructs a
TLcdComplexPolygon that doesn't have any ILcdPolygon objects. |
TLcdComplexPolygon(ILcdPolygon[] aPolygonArray)
Constructs a
TLcdComplexPolygon containing the given
ILcdPolygon objects. |
TLcdComplexPolygon(TLcdComplexPolygon aComplexPolygon)
Constructs a
TLcdComplexPolygon that is a clone of the given
TLcdComplexPolygon . |
Modifier and Type | Method and Description |
---|---|
void |
addPolygon(ILcdPolygon aPolygon)
Appends the specified polygon to the end of this
ILcdComplexPolygon . |
void |
addPolygon(int aIndex,
ILcdPolygon aPolygon)
Inserts the specified polygon at the specified position in this
ILcdComplexPolygon . |
void |
addPolygons(ILcdPolygon[] aPolygon)
Appends the specified array of polygons to the end of this
ILcdComplexPolygon . |
protected void |
calculateFocusPoint()
Computes the focus point as the center of the bounding box.
|
void |
clearCache()
Clears the cache.
|
void |
clearPolygons()
Removes all of the polygons from this
ILcdComplexPolygon . |
Object |
clone()
Creates and returns a copy of this object.
|
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)
An object is considered equal to this shape if it has the same class.
|
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 this
ILcdShape . |
ILcdPoint |
getPoint(int aIndex)
Returns the
ILcdPoint at a given index. |
int |
getPointCount()
Returns the number of
ILcdPoint objects in the list. |
ILcdPolygon |
getPolygon(int aIndex)
Returns the
ILcdPolygon at the given index. |
int |
getPolygonCount()
Returns the number of
ILcdPolygon objects in the list. |
ILcdShape |
getShape(int aIndex)
Deprecated.
use
getPolygon(int) instead |
int |
getShapeCount()
Deprecated.
use
getPolygonCount() instead |
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() |
void |
invalidateObject()
Invalidates all cached values of this object.
|
void |
polygonChanged(ILcdPolygon aPolygon)
Notifies this
ILcdComplexPolygon that the specified polygon has changed. |
void |
polygonChanged(int aIndex)
Notifies this
ILcdComplexPolygon that the polygon at the specified position has changed. |
void |
polygonsChanged()
Notifies this
ILcdComplexPolygon that some (possibly all) of its polygons have changed. |
Object |
removeCachedObject(Object aKey)
Looks up and removes the cached Object corresponding to the given key.
|
boolean |
removePolygon(ILcdPolygon aPolygon)
Removes the first occurrence of the specified polygon in this
ILcdComplexPolygon . |
ILcdPolygon |
removePolygon(int aIndex)
Removes the polygon at the specified position in this
ILcdComplexPolygon . |
void |
removePolygons(ILcdPolygon[] aPolygon)
Removes all polygons from this
ILcdComplexPolygon that are contained in the specified
array of polygons. |
void |
setFocusPoint(ILcd3DEditablePoint aFocusPoint)
Specifies the focus point value.
|
void |
setPolygon(ILcdPolygon[] aPolygonArray)
Sets the
ILcdPolygon objects associated with this ILcdComplexPolygon . |
ILcdPolygon |
setPolygon(int aIndex,
ILcdPolygon aPolygon)
Replaces the polygon at the specified position in this
ILcdComplexPolygon with the
specified polygon. |
void |
setPolygons(ILcdPolygon[] aPolygons)
Replace the list of polygons contained in this
ILcdComplexPolygon with the specified
array of polygons. |
void |
setShape(ILcdShape[] aShapeArray)
Deprecated.
use
setPolygons(ILcdPolygon[]) instead |
contains2D, contains3D, fromDomainObject
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
contains2D, contains3D
getPointSFCT, getX, getY, getZ
public TLcdComplexPolygon()
TLcdComplexPolygon
that doesn't have any ILcdPolygon
objects.public TLcdComplexPolygon(ILcdPolygon[] aPolygonArray)
TLcdComplexPolygon
containing the given
ILcdPolygon
objects.aPolygonArray
- an array of ILcdPolygon
objects this
TLcdComplexPolygon
is composed of.public TLcdComplexPolygon(TLcdComplexPolygon aComplexPolygon)
TLcdComplexPolygon
that is a clone of the given
TLcdComplexPolygon
.aComplexPolygon
- the complex polygon to clone.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()
ILcdShape
ILcdShape
.getFocusPoint
in interface ILcdShape
ILcdShape
.public void setPolygon(ILcdPolygon[] aPolygonArray)
ILcdPolygon
objects associated with this ILcdComplexPolygon
. This
method does exactly the same as setPolygons(ILcdPolygon[])
.aPolygonArray
- the ILcdPolygon
objects associated with this ILcdComplexPolygon
.getPolygon(int)
,
setPolygons(com.luciad.shape.ILcdPolygon[])
public final int getPolygonCount()
ILcdComplexPolygon
ILcdPolygon
objects in the list.getPolygonCount
in interface ILcdComplexPolygon
ILcdPolygon
objects in the list.public final ILcdPolygon getPolygon(int aIndex) throws IndexOutOfBoundsException
ILcdComplexPolygon
ILcdPolygon
at the given index.getPolygon
in interface ILcdComplexPolygon
aIndex
- a valid index in the list of ILcdPolygon
objects.ILcdPolygon
at the given index.IndexOutOfBoundsException
- when the index is not valid.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 int getPointCount()
ILcdPointList
ILcdPoint
objects in the list.getPointCount
in interface ILcdPointList
ILcdPoint
objects in the list.public ILcdPoint getPoint(int aIndex) throws IndexOutOfBoundsException
ILcdPointList
ILcdPoint
at a given index.getPoint
in interface ILcdPointList
aIndex
- a valid index in the list of ILcdPoint
objects.ILcdPoint
at the given index.IndexOutOfBoundsException
- if the given index is out of bounds.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.public Object getCachedObject(Object aKey)
ILcdCache
getCachedObject
in interface ILcdCache
aKey
- the key Object that was used for storing the cache Object.public Object removeCachedObject(Object aKey)
ILcdCache
removeCachedObject
in interface ILcdCache
aKey
- the key Object that was used for storing the cache Object.public void clearCache()
ILcdCache
clearCache
in interface ILcdCache
public Object clone()
clone
in interface ILcdCloneable
clone
in class ALcdShape
Object.clone()
public boolean equals(Object aObject)
ALcdShape
public int hashCode()
ALcdShape
ALcdShape.equals(Object)
method.
Extensions should refine this implementation, based on their properties.public void addPolygon(int aIndex, ILcdPolygon aPolygon)
ILcdEditableComplexPolygon
ILcdComplexPolygon
.addPolygon
in interface ILcdEditableComplexPolygon
aIndex
- the index at which the polygon is to be inserted.aPolygon
- the polygon to be inserted.public void addPolygon(ILcdPolygon aPolygon)
ILcdEditableComplexPolygon
ILcdComplexPolygon
.addPolygon
in interface ILcdEditableComplexPolygon
aPolygon
- the polygon to be appended to this ILcdComplexPolygon
.public void addPolygons(ILcdPolygon[] aPolygon)
ILcdEditableComplexPolygon
ILcdComplexPolygon
.addPolygons
in interface ILcdEditableComplexPolygon
aPolygon
- the array of polygons to be appended to this ILcdComplexPolygon
.public void clearPolygons()
ILcdEditableComplexPolygon
ILcdComplexPolygon
.clearPolygons
in interface ILcdEditableComplexPolygon
public ILcdPolygon removePolygon(int aIndex)
ILcdEditableComplexPolygon
ILcdComplexPolygon
. Shifts any
subsequent polygons to the left. Returns the polygon that was removed from this
ILcdComplexPolygon
.removePolygon
in interface ILcdEditableComplexPolygon
aIndex
- the index of the polygon to removed.public boolean removePolygon(ILcdPolygon aPolygon)
ILcdEditableComplexPolygon
ILcdComplexPolygon
. If this
ILcdComplexPolygon
does not contain the polygon, it is unchanged.removePolygon
in interface ILcdEditableComplexPolygon
aPolygon
- the polygon to be removed, if present.true
if this ILcdComplexPolygon
contained the specified element.public void removePolygons(ILcdPolygon[] aPolygon)
ILcdEditableComplexPolygon
ILcdComplexPolygon
that are contained in the specified
array of polygons.removePolygons
in interface ILcdEditableComplexPolygon
aPolygon
- the array of polygons to be removed from this ILcdComplexPolygon
.public ILcdPolygon setPolygon(int aIndex, ILcdPolygon aPolygon)
ILcdEditableComplexPolygon
ILcdComplexPolygon
with the
specified polygon.setPolygon
in interface ILcdEditableComplexPolygon
aIndex
- index of polygon to replace.aPolygon
- the polygon to be stored at the specified position.public void setPolygons(ILcdPolygon[] aPolygons)
ILcdEditableComplexPolygon
ILcdComplexPolygon
with the specified
array of polygons.setPolygons
in interface ILcdEditableComplexPolygon
aPolygons
- the array of polygons to be stored in this ILcdComplexPolygon
.public void polygonChanged(int aIndex)
ILcdEditableComplexPolygon
ILcdComplexPolygon
that the polygon at the specified position has changed.polygonChanged
in interface ILcdEditableComplexPolygon
aIndex
- the index of the polygon that has changed.public void polygonChanged(ILcdPolygon aPolygon)
ILcdEditableComplexPolygon
ILcdComplexPolygon
that the specified polygon has changed.polygonChanged
in interface ILcdEditableComplexPolygon
aPolygon
- the polygon that has changed.public void polygonsChanged()
ILcdEditableComplexPolygon
ILcdComplexPolygon
that some (possibly all) of its polygons have changed.polygonsChanged
in interface ILcdEditableComplexPolygon
public void invalidateObject()
ILcdInvalidateable
invalidateObject
in interface ILcdInvalidateable
public void setShape(ILcdShape[] aShapeArray)
setPolygons(ILcdPolygon[])
insteadILcdShape
objects associated with this TLcdComplexPolygon
.aShapeArray
- the ILcdShape
objects associated with this TLcdComplexPolygon
.getShape(int)
public int getShapeCount()
getPolygonCount()
insteadILcdShape
objects in the list.ILcdShape
objects in the list.public ILcdShape getShape(int aIndex) throws IndexOutOfBoundsException
getPolygon(int)
insteadILcdShape
at the given index.aIndex
- a valid index in the list of ILcdShape
objects.ILcdShape
at the given index.IndexOutOfBoundsException
- when the index is not valid.protected void calculateFocusPoint()
public void setFocusPoint(ILcd3DEditablePoint aFocusPoint)
aFocusPoint
- the new focus point value.getFocusPoint()