public abstract class ALcd3DEditablePolypoint extends ALcd3DEditableShape implements ILcd3DEditablePolypoint, ILcdPointList,ILcdPointList2, ILcdCache, Cloneable
ILcd3DEditablePolypoint
interface.
It implements ILcdCache
, thus providing a cache
to store expensive calculations, e.g. for painters,
to store model-world transformations. The cache is cleared whenever the shape is modified by
moving, translating, inserting or 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.
Constructor and Description |
---|
ALcd3DEditablePolypoint()
Creates a new, empty polypoint.
|
ALcd3DEditablePolypoint(ALcd3DEditablePolypoint a3DEditablePolypoint)
Copy constructor.
|
ALcd3DEditablePolypoint(ILcd3DEditablePointList a2DEditablePointList)
Creates a new polypoint backed by the given point list.
|
Modifier and Type | Method and Description |
---|---|
protected abstract ILcd3DEditableBounds |
calculateBounds()
This method should compute the bounds of the polypoint.
|
protected ILcd3DEditablePoint |
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.
|
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)
Provides an approximate default implementation of the 3D containment test
based on the 2D containment test.
|
boolean |
equals(Object aObject)
Returns whether the given object has the same class, the same focus point,
and the same coordinates.
|
protected ILcd3DEditablePointList |
get3DEditablePointList() |
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. |
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 . |
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 |
insert2DPoint(int aIndex,
double aX,
double aY)
Inserts a point at the given index into this
ILcd2DEditablePointList . |
void |
insert3DPoint(int aIndex,
double aX,
double aY,
double aZ)
Inserts a point at the given index into this
ILcd3DEditablePointList . |
void |
insertIntoCache(Object aKey,
Object aObject)
Inserts a cache Object corresponding to the given key Object.
|
protected void |
invalidateBounds() |
void |
move2D(double aX,
double aY)
Translates this shape so that its focus point ends up at the specified
position.
|
void |
move2DPoint(int aIndex,
double aX,
double aY)
Moves the specified point of this
ILcd2DEditablePointList to the given point in the 2D space. |
void |
move3DPoint(int aIndex,
double aX,
double aY,
double aZ)
Moves the specified point of this
ILcd3DEditablePointList to the given point in the 3D space. |
Object |
removeCachedObject(Object aKey)
Looks up and removes the cached Object corresponding to the given key.
|
void |
removePointAt(int aIndex)
Removes the point at the given index from this
ILcd2DEditablePointList . |
protected void |
set3DEditablePointList(ILcd3DEditablePointList a3DEditablePointList) |
protected void |
set3DEditablePointList(ILcd3DEditablePointList a3DEditablePointList,
boolean aDeepCopy) |
protected void |
setFocusPoint(ILcd3DEditablePoint aFocusPoint) |
String |
toString() |
void |
translate2D(double aDeltaX,
double aDeltaY)
Translates this
ILcd2DEditableShape from its current position over the given translation
vector in the 2D space. |
void |
translate2DPoint(int aIndex,
double aDeltaX,
double aDeltaY)
Translates the specified point of this
ILcd2DEditablePointList from its current position
over the given translation vector in the 2D space. |
void |
translate3D(double aDeltaX,
double aDeltaY,
double aDeltaZ)
Translates this
ILcd3DEditableShape from its current position over the given translation
vector in the 3D space. |
void |
translate3DPoint(int aIndex,
double aDeltaX,
double aDeltaY,
double aDeltaZ)
Translates the specified point of this
ILcd3DEditablePointList from its current position
over the given translation vector in the 3D space. |
move3D, move3D
move2D
contains2D, contains3D, fromDomainObject
finalize, getClass, notify, notifyAll, wait, wait, wait
move3D, move3D
move2D
contains2D, contains3D
append2DPoint
public ALcd3DEditablePolypoint()
public ALcd3DEditablePolypoint(ILcd3DEditablePointList a2DEditablePointList)
a2DEditablePointList
- The point list to usepublic ALcd3DEditablePolypoint(ALcd3DEditablePolypoint a3DEditablePolypoint)
a3DEditablePolypoint
- The ALcd3DEditablePolypoint
to copy.protected final ILcd3DEditablePointList get3DEditablePointList()
protected void set3DEditablePointList(ILcd3DEditablePointList a3DEditablePointList)
protected void set3DEditablePointList(ILcd3DEditablePointList a3DEditablePointList, boolean aDeepCopy)
public void getPointSFCT(int aIndex, ILcd3DEditablePoint aPointSFCT)
ILcdPointList
aIndex
in the given point.getPointSFCT
in interface ILcdPointList
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.public double getX(int aIndex)
ILcdPointList
aIndex
.getX
in interface ILcdPointList
aIndex
- the index of the point for which to return the X coordinate.aIndex
.public double getY(int aIndex)
ILcdPointList
aIndex
.getY
in interface ILcdPointList
aIndex
- the index of the point for which to return the Y coordinate.aIndex
.public double getZ(int aIndex)
ILcdPointList
aIndex
.getZ
in interface ILcdPointList
aIndex
- the index of the point for which to return the Z coordinate.aIndex
.public final int getPointCount()
ILcdPointList
ILcdPoint
objects in the list.getPointCount
in interface ILcdPointList
ILcdPoint
objects in the list.public final ILcdPoint getPoint(int aIndex)
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.public void move2DPoint(int aIndex, double aX, double aY)
ILcd2DEditablePointList
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.move2DPoint
in interface ILcd2DEditablePointList
aIndex
- a valid index in the list of points.aX
- the x coordinate of the point.aY
- the y coordinate of the point.public void move3DPoint(int aIndex, double aX, double aY, double aZ)
ILcd3DEditablePointList
ILcd3DEditablePointList
to the given point in the 3D space.move3DPoint
in interface ILcd3DEditablePointList
aIndex
- a valid index in the list of points.aX
- the x coordinate of the point.aY
- the y coordinate of the point.aZ
- the z coordinate of the point.public void translate2DPoint(int aIndex, double aDeltaX, double aDeltaY)
ILcd2DEditablePointList
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.translate2DPoint
in interface ILcd2DEditablePointList
aDeltaX
- the x coordinate of the translation vector.aDeltaY
- the y coordinate of the translation vector.public void translate3DPoint(int aIndex, double aDeltaX, double aDeltaY, double aDeltaZ)
ILcd3DEditablePointList
ILcd3DEditablePointList
from its current position
over the given translation vector in the 3D space.translate3DPoint
in interface ILcd3DEditablePointList
aIndex
- a valid new index in the list of points.aDeltaX
- the x coordinate of the translation vector.aDeltaY
- the y coordinate of the translation vector.aDeltaZ
- the z coordinate of the translation vector.public void insert2DPoint(int aIndex, double aX, double aY)
ILcd2DEditablePointList
ILcd2DEditablePointList
.insert2DPoint
in interface ILcd2DEditablePointList
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.public void insert3DPoint(int aIndex, double aX, double aY, double aZ)
ILcd3DEditablePointList
ILcd3DEditablePointList
.insert3DPoint
in interface ILcd3DEditablePointList
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.aZ
- the z coordinate of the new point.public void removePointAt(int aIndex)
ILcd2DEditablePointList
ILcd2DEditablePointList
.removePointAt
in interface ILcd2DEditablePointList
removePointAt
in interface ILcd3DEditablePointList
aIndex
- a valid index in the list of ILcdPoint
objects.protected void invalidateBounds()
protected abstract ILcd3DEditableBounds calculateBounds()
ILcd2DEditableBounds
should be stored in fBounds
.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.protected ILcd3DEditablePoint calculateFocusPoint()
ILcd2DEditablePoint
is stored in fFocusPoint
.public ILcdPoint getFocusPoint()
ILcdShape
ILcdShape
.getFocusPoint
in interface ILcdShape
ILcdShape
.protected void setFocusPoint(ILcd3DEditablePoint aFocusPoint)
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)
ALcd2DEditableShape
contains3D
in interface ILcdShape
contains3D
in class ALcd2DEditableShape
aX
- the x coordinate of the point.aY
- the y coordinate of the point.aZ
- the z coordinate of the point.true
if the bounds of this shape contain the point in the 3D space
and the shape itself contains the point in the 2D space, false
otherwise.public void translate2D(double aDeltaX, double aDeltaY)
ILcd2DEditableShape
ILcd2DEditableShape
from its current position over the given translation
vector in the 2D space. Only the first two dimensions of the ILcdShape
are considered.
The third dimension is left unchanged.translate2D
in interface ILcd2DEditablePointList
translate2D
in interface ILcd2DEditableShape
aDeltaX
- the x coordinate of the translation vector.aDeltaY
- the y coordinate of the translation vector.public void translate3D(double aDeltaX, double aDeltaY, double aDeltaZ)
ILcd3DEditableShape
ILcd3DEditableShape
from its current position over the given translation
vector in the 3D space.translate3D
in interface ILcd3DEditablePointList
translate3D
in interface ILcd3DEditableShape
aDeltaX
- the x coordinate of the translation vector.aDeltaY
- the y coordinate of the translation vector.aDeltaZ
- the z coordinate of the translation vector.public void move2D(double aX, double aY)
ALcd2DEditableShape
move2D
in interface ILcd2DEditableShape
move2D
in class ALcd2DEditableShape
aX
- the x coordinate of the point.aY
- the y coordinate of the point.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()
The contained editable points list is copied without being cloned.
The cache, the bounds and the focus point are not copied or cloned at all, but recalculated when needed.
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.