Class ALcd3DEditablePolypoint
- All Implemented Interfaces:
ILcdBounded
,ILcdPointList
,ILcdPointList2
,ILcdPolypoint
,ILcdShape
,ILcd2DEditablePointList
,ILcd2DEditablePolypoint
,ILcd2DEditableShape
,ILcd3DEditablePointList
,ILcd3DEditablePolypoint
,ILcd3DEditableShape
,ILcdCache
,ILcdCloneable
,Serializable
,Cloneable
- Direct Known Subclasses:
TLcdLonLatHeightPolypoint
,TLcdXYZPolypoint
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.
- See Also:
-
Constructor Summary
ConstructorDescriptionCreates a new, empty polypoint.ALcd3DEditablePolypoint
(ALcd3DEditablePolypoint a3DEditablePolypoint) Copy constructor.ALcd3DEditablePolypoint
(ILcd3DEditablePointList a2DEditablePointList) Creates a new polypoint backed by the given point list. -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract ILcd3DEditableBounds
This method should compute the bounds of the polypoint.protected ILcd3DEditablePoint
Computes the focus point as the center of the bounding box.void
Clears the cache.clone()
Creates and returns a copy of this object.boolean
contains2D
(double aX, double aY) Checks whether thisILcdShape
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
Returns whether the given object has the same class, the same focus point, and the same coordinates.protected final ILcd3DEditablePointList
Returns theILcdBounds
by which the geometry of thisILcdBounded
object is bounded.getCachedObject
(Object aKey) Looks up and returns the cached Object corresponding to the given key.Returns the focus point of thisILcdShape
.final ILcdPoint
getPoint
(int aIndex) Returns theILcdPoint
at a given index.final int
Returns the number ofILcdPoint
objects in the list.void
getPointSFCT
(int aIndex, ILcd3DEditablePoint aPointSFCT) Stores the coordinates of the point ataIndex
in the given point.double
getX
(int aIndex) Returns the X coordinate of the point ataIndex
.double
getY
(int aIndex) Returns the Y coordinate of the point ataIndex
.double
getZ
(int aIndex) Returns the Z coordinate of the point ataIndex
.int
hashCode()
The hash code of this shape is the hash code of its class, in order to be consistent with theALcdShape.equals(Object)
method.void
insert2DPoint
(int aIndex, double aX, double aY) Inserts a point at the given index into thisILcd2DEditablePointList
.void
insert3DPoint
(int aIndex, double aX, double aY, double aZ) Inserts a point at the given index into thisILcd3DEditablePointList
.void
insertIntoCache
(Object aKey, Object aObject) Inserts a cache Object corresponding to the given key Object.protected void
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 thisILcd2DEditablePointList
to the given point in the 2D space.void
move3DPoint
(int aIndex, double aX, double aY, double aZ) Moves the specified point of thisILcd3DEditablePointList
to the given point in the 3D space.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 thisILcd2DEditablePointList
.protected void
set3DEditablePointList
(ILcd3DEditablePointList a3DEditablePointList) protected void
set3DEditablePointList
(ILcd3DEditablePointList a3DEditablePointList, boolean aDeepCopy) protected void
setFocusPoint
(ILcd3DEditablePoint aFocusPoint) toString()
void
translate2D
(double aDeltaX, double aDeltaY) Translates thisILcd2DEditableShape
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 thisILcd2DEditablePointList
from its current position over the given translation vector in the 2D space.void
translate3D
(double aDeltaX, double aDeltaY, double aDeltaZ) Translates thisILcd3DEditableShape
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 thisILcd3DEditablePointList
from its current position over the given translation vector in the 3D space.Methods inherited from class com.luciad.shape.shape3D.ALcd3DEditableShape
move3D, move3D
Methods inherited from class com.luciad.shape.shape2D.ALcd2DEditableShape
move2D
Methods inherited from class com.luciad.shape.ALcdShape
contains2D, contains3D, fromDomainObject
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.luciad.shape.shape2D.ILcd2DEditablePointList
append2DPoint
Methods inherited from interface com.luciad.shape.shape2D.ILcd2DEditableShape
move2D
Methods inherited from interface com.luciad.shape.shape3D.ILcd3DEditableShape
move3D, move3D
Methods inherited from interface com.luciad.shape.ILcdShape
contains2D, contains3D
-
Constructor Details
-
ALcd3DEditablePolypoint
public ALcd3DEditablePolypoint()Creates a new, empty polypoint. -
ALcd3DEditablePolypoint
Creates a new polypoint backed by the given point list. The given pointlist is re-used by the new pointlist, and updates will affect both objects.- Parameters:
a2DEditablePointList
- The point list to use
-
ALcd3DEditablePolypoint
Copy constructor.- Parameters:
a3DEditablePolypoint
- TheALcd3DEditablePolypoint
to copy.
-
-
Method Details
-
get3DEditablePointList
-
set3DEditablePointList
-
set3DEditablePointList
protected void set3DEditablePointList(ILcd3DEditablePointList a3DEditablePointList, boolean aDeepCopy) -
getPointSFCT
Description copied from interface:ILcdPointList
Stores the coordinates of the point ataIndex
in the given point.- Specified by:
getPointSFCT
in interfaceILcdPointList
- Parameters:
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.
-
getX
public double getX(int aIndex) Description copied from interface:ILcdPointList
Returns the X coordinate of the point ataIndex
.- Specified by:
getX
in interfaceILcdPointList
- Parameters:
aIndex
- the index of the point for which to return the X coordinate.- Returns:
- the X coordinate of the point at
aIndex
.
-
getY
public double getY(int aIndex) Description copied from interface:ILcdPointList
Returns the Y coordinate of the point ataIndex
.- Specified by:
getY
in interfaceILcdPointList
- Parameters:
aIndex
- the index of the point for which to return the Y coordinate.- Returns:
- the Y coordinate of the point at
aIndex
.
-
getZ
public double getZ(int aIndex) Description copied from interface:ILcdPointList
Returns the Z coordinate of the point ataIndex
.- Specified by:
getZ
in interfaceILcdPointList
- Parameters:
aIndex
- the index of the point for which to return the Z coordinate.- Returns:
- the Z coordinate of the point at
aIndex
.
-
getPointCount
public final int getPointCount()Description copied from interface:ILcdPointList
Returns the number ofILcdPoint
objects in the list.- Specified by:
getPointCount
in interfaceILcdPointList
- Returns:
- the number of
ILcdPoint
objects in the list.
-
getPoint
Description copied from interface:ILcdPointList
Returns theILcdPoint
at a given index.- Specified by:
getPoint
in interfaceILcdPointList
- Parameters:
aIndex
- a valid index in the list ofILcdPoint
objects.- Returns:
- the
ILcdPoint
at the given index.
-
move2DPoint
public void move2DPoint(int aIndex, double aX, double aY) Description copied from interface:ILcd2DEditablePointList
Moves the specified point of thisILcd2DEditablePointList
to the given point in the 2D space. Only the first two dimensions of theILcdShape
are considered. The third dimension is left unchanged.- Specified by:
move2DPoint
in interfaceILcd2DEditablePointList
- Parameters:
aIndex
- a valid index in the list of points.aX
- the x coordinate of the point.aY
- the y coordinate of the point.
-
move3DPoint
public void move3DPoint(int aIndex, double aX, double aY, double aZ) Description copied from interface:ILcd3DEditablePointList
Moves the specified point of thisILcd3DEditablePointList
to the given point in the 3D space.- Specified by:
move3DPoint
in interfaceILcd3DEditablePointList
- Parameters:
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.
-
translate2DPoint
public void translate2DPoint(int aIndex, double aDeltaX, double aDeltaY) Description copied from interface:ILcd2DEditablePointList
Translates the specified point of thisILcd2DEditablePointList
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.- Specified by:
translate2DPoint
in interfaceILcd2DEditablePointList
- Parameters:
aDeltaX
- the x coordinate of the translation vector.aDeltaY
- the y coordinate of the translation vector.
-
translate3DPoint
public void translate3DPoint(int aIndex, double aDeltaX, double aDeltaY, double aDeltaZ) Description copied from interface:ILcd3DEditablePointList
Translates the specified point of thisILcd3DEditablePointList
from its current position over the given translation vector in the 3D space.- Specified by:
translate3DPoint
in interfaceILcd3DEditablePointList
- Parameters:
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.
-
insert2DPoint
public void insert2DPoint(int aIndex, double aX, double aY) Description copied from interface:ILcd2DEditablePointList
Inserts a point at the given index into thisILcd2DEditablePointList
.- Specified by:
insert2DPoint
in interfaceILcd2DEditablePointList
- Parameters:
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.
-
insert3DPoint
public void insert3DPoint(int aIndex, double aX, double aY, double aZ) Description copied from interface:ILcd3DEditablePointList
Inserts a point at the given index into thisILcd3DEditablePointList
.- Specified by:
insert3DPoint
in interfaceILcd3DEditablePointList
- Parameters:
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.
-
removePointAt
public void removePointAt(int aIndex) Description copied from interface:ILcd2DEditablePointList
Removes the point at the given index from thisILcd2DEditablePointList
.- Specified by:
removePointAt
in interfaceILcd2DEditablePointList
- Specified by:
removePointAt
in interfaceILcd3DEditablePointList
- Parameters:
aIndex
- a valid index in the list ofILcdPoint
objects.
-
invalidateBounds
protected void invalidateBounds() -
calculateBounds
This method should compute the bounds of the polypoint. The resultingILcd2DEditableBounds
should be stored infBounds
. -
getBounds
Description copied from interface:ILcdBounded
Returns theILcdBounds
by which the geometry of thisILcdBounded
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 ofTLcdLonLatBounds
orTLcdXYBounds
.- Specified by:
getBounds
in interfaceILcdBounded
- Returns:
- the
ILcdBounds
by which the geometry of thisILcdBounded
object is bounded.
-
calculateFocusPoint
Computes the focus point as the center of the bounding box. The resultingILcd2DEditablePoint
is stored infFocusPoint
. -
getFocusPoint
Description copied from interface:ILcdShape
Returns the focus point of thisILcdShape
.- Specified by:
getFocusPoint
in interfaceILcdShape
- Returns:
- the focus point of this
ILcdShape
.
-
setFocusPoint
-
contains2D
public boolean contains2D(double aX, double aY) Description copied from interface:ILcdShape
Checks whether thisILcdShape
contains the given point in the 2D space. Only the first two dimensions of theILcdShape
are considered.- Specified by:
contains2D
in interfaceILcdShape
- Parameters:
aX
- the x coordinate of the point.aY
- the y coordinate of the point.- Returns:
- the boolean result of the containment test.
-
contains3D
public boolean contains3D(double aX, double aY, double aZ) Description copied from class:ALcd2DEditableShape
Provides an approximate default implementation of the 3D containment test based on the 2D containment test.- Specified by:
contains3D
in interfaceILcdShape
- Overrides:
contains3D
in classALcd2DEditableShape
- Parameters:
aX
- the x coordinate of the point.aY
- the y coordinate of the point.aZ
- the z coordinate of the point.- Returns:
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.
-
translate2D
public void translate2D(double aDeltaX, double aDeltaY) Description copied from interface:ILcd2DEditableShape
Translates thisILcd2DEditableShape
from its current position over the given translation vector in the 2D space. Only the first two dimensions of theILcdShape
are considered. The third dimension is left unchanged.- Specified by:
translate2D
in interfaceILcd2DEditablePointList
- Specified by:
translate2D
in interfaceILcd2DEditableShape
- Parameters:
aDeltaX
- the x coordinate of the translation vector.aDeltaY
- the y coordinate of the translation vector.
-
translate3D
public void translate3D(double aDeltaX, double aDeltaY, double aDeltaZ) Description copied from interface:ILcd3DEditableShape
Translates thisILcd3DEditableShape
from its current position over the given translation vector in the 3D space.- Specified by:
translate3D
in interfaceILcd3DEditablePointList
- Specified by:
translate3D
in interfaceILcd3DEditableShape
- Parameters:
aDeltaX
- the x coordinate of the translation vector.aDeltaY
- the y coordinate of the translation vector.aDeltaZ
- the z coordinate of the translation vector.
-
move2D
public void move2D(double aX, double aY) Description copied from class:ALcd2DEditableShape
Translates this shape so that its focus point ends up at the specified position.- Specified by:
move2D
in interfaceILcd2DEditableShape
- Overrides:
move2D
in classALcd2DEditableShape
- Parameters:
aX
- the x coordinate of the point.aY
- the y coordinate of the point.
-
insertIntoCache
Description copied from interface:ILcdCache
Inserts a cache Object corresponding to the given key Object.- Specified by:
insertIntoCache
in interfaceILcdCache
- Parameters:
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.
-
getCachedObject
Description copied from interface:ILcdCache
Looks up and returns the cached Object corresponding to the given key.- Specified by:
getCachedObject
in interfaceILcdCache
- Parameters:
aKey
- the key Object that was used for storing the cache Object.- Returns:
- the cached Object, or null if there is no Object corresponding to the given key.
-
removeCachedObject
Description copied from interface:ILcdCache
Looks up and removes the cached Object corresponding to the given key.- Specified by:
removeCachedObject
in interfaceILcdCache
- Parameters:
aKey
- the key Object that was used for storing the cache Object.- Returns:
- the cached Object, or null if there was no Object corresponding to the given key.
-
clearCache
public void clearCache()Description copied from interface:ILcdCache
Clears the cache.- Specified by:
clearCache
in interfaceILcdCache
-
clone
Creates and returns a copy of this object.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.
- Specified by:
clone
in interfaceILcdCloneable
- Overrides:
clone
in classALcdShape
- See Also:
-
equals
Returns whether the given object has the same class, the same focus point, and the same coordinates. -
hashCode
public int hashCode()Description copied from class:ALcdShape
The hash code of this shape is the hash code of its class, in order to be consistent with theALcdShape.equals(Object)
method. Extensions should refine this implementation, based on their properties. -
toString
-