public class TLcdXYArcBand extends ALcd2DEditableShape implements ILcd2DEditableArcBand, ILcdCache
ILcd2DEditableArcBand
in
the cartesian space.
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.
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.
MAX_RADIUS_END_CORNER, MAX_RADIUS_START_CORNER, MIN_RADIUS_END_CORNER, MIN_RADIUS_START_CORNER
Constructor and Description |
---|
TLcdXYArcBand()
Constructs a new
TLcdXYArcBand with all coordinates and angles set to 0. |
TLcdXYArcBand(double aCenterX,
double aCenterY,
double aMinRadius,
double aMaxRadius,
double aStartAngle,
double aArcAngle)
Constructs a new
TLcdXYArcBand with the given parameters. |
TLcdXYArcBand(ILcd2DEditableArcBand a2DEditableArcBand)
Constructs a new
TLcdXYArcBand that is a deep copy of the given ILcd2DEditableArcBand . |
TLcdXYArcBand(ILcdPoint aCenter,
double aMinRadius,
double aMaxRadius,
double aStartAngle,
double aArcAngle)
Constructs a new
TLcdXYArcBand with the given parameters. |
Modifier and Type | Method and Description |
---|---|
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. |
void |
corner2DEditablePointSFCT(int aCorner,
ILcd2DEditablePoint a2DEditablePointSFCT)
Computes the position of the specified corner of this
ILcdArcBand . |
boolean |
equals(Object aObject)
Returns whether the given object has the same class and the same
coordinates and parameters.
|
double |
getArcAngle()
Returns the angle over which the arc extends (in degrees).
|
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 |
getCenter()
Returns the center point of this
ILcdArcBand . |
ILcdPoint |
getFocusPoint()
Returns the focus point of this
ILcdShape . |
double |
getMaxRadius()
Returns the maximum radius of this
ILcdArcBand . |
double |
getMinRadius()
Returns the minimum radius of this
ILcdArcBand . |
double |
getStartAngle()
Returns the start angle of the arc (in degrees).
|
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 |
moveCornerPoint2D(int aCorner,
double aX,
double aY)
Moves the specified corner point to a new location.
|
Object |
removeCachedObject(Object aKey)
Looks up and removes the cached Object corresponding to the given key.
|
void |
setArcAngle(double aArcAngle)
Sets the angle over which this
ILcd2DEditableArcBand extends (in degrees). |
void |
setMaxRadius(double aMaxRadius)
Sets the radius of the outer arc of the arc band.
|
void |
setMinRadius(double aMinRadius)
Sets the radius of the inner arc of the arc band.
|
void |
setStartAngle(double aStartAngle)
Sets the start angle of this
ILcd2DEditableArcBand (in degrees). |
String |
toString() |
void |
translate2D(double aX,
double aY)
Translates this
ILcd2DEditableShape from its current position over the given translation
vector in the 2D space. |
contains3D, move2D, move2D
contains2D, contains3D, fromDomainObject
finalize, getClass, notify, notifyAll, wait, wait, wait
move2D, move2D
contains2D, contains3D, contains3D
public TLcdXYArcBand()
TLcdXYArcBand
with all coordinates and angles set to 0.public TLcdXYArcBand(ILcd2DEditableArcBand a2DEditableArcBand)
TLcdXYArcBand
that is a deep copy of the given ILcd2DEditableArcBand
.a2DEditableArcBand
- the ILcd2DEditableArcBand
to copy.public TLcdXYArcBand(ILcdPoint aCenter, double aMinRadius, double aMaxRadius, double aStartAngle, double aArcAngle)
TLcdXYArcBand
with the given parameters.aCenter
- the center point.aMinRadius
- the minimum radius.aMaxRadius
- the maximum radius.aStartAngle
- the start angle.aArcAngle
- the arc angle.IllegalArgumentException
- if the minimum or maximum radius passed is less than 0.public TLcdXYArcBand(double aCenterX, double aCenterY, double aMinRadius, double aMaxRadius, double aStartAngle, double aArcAngle)
TLcdXYArcBand
with the given parameters.aCenterX
- the longitude of the center point.aCenterY
- the latitude of the center point.aMinRadius
- the minimum radius.aMaxRadius
- the maximum radius.aStartAngle
- the start angle.aArcAngle
- the arc angle.IllegalArgumentException
- if the minimum or maximum radius passed is less than 0.public ILcdPoint getCenter()
ILcdArcBand
ILcdArcBand
.getCenter
in interface ILcdArcBand
ILcdArcBand
.public void setMinRadius(double aMinRadius)
setMinRadius
in interface ILcd2DEditableArcBand
aMinRadius
- the radius of the inner arc of the arc band. This value should not be less than 0.IllegalArgumentException
- if the radius passed is less than 0.public final double getMinRadius()
ILcdArcBand
ILcdArcBand
.getMinRadius
in interface ILcdArcBand
ILcdArcBand
.public void setMaxRadius(double aMaxRadius)
setMaxRadius
in interface ILcd2DEditableArcBand
aMaxRadius
- the radius of the outer arc of the arc band. This value should not be less than 0.IllegalArgumentException
- if the radius passed is less than 0.public final double getMaxRadius()
ILcdArcBand
ILcdArcBand
.getMaxRadius
in interface ILcdArcBand
ILcdArcBand
.public final double getStartAngle()
ILcdArcBand
getStartAngle
in interface ILcdArcBand
public void setStartAngle(double aStartAngle)
ILcd2DEditableArcBand
ILcd2DEditableArcBand
(in degrees).
The angle is measured from 3 o'clock position, positive
counter-clockwise.setStartAngle
in interface ILcd2DEditableArcBand
aStartAngle
- the new start angle.public final double getArcAngle()
ILcdArcBand
getArcAngle
in interface ILcdArcBand
public void setArcAngle(double aArcAngle)
ILcd2DEditableArcBand
ILcd2DEditableArcBand
extends (in degrees).
The angle is positive counter-clockwise.setArcAngle
in interface ILcd2DEditableArcBand
aArcAngle
- the new arc angle.public void corner2DEditablePointSFCT(int aCorner, ILcd2DEditablePoint a2DEditablePointSFCT)
ILcdArcBand
ILcdArcBand
.corner2DEditablePointSFCT
in interface ILcdArcBand
aCorner
- the corner:
ILcdArcBand.MIN_RADIUS_START_CORNER
,
ILcdArcBand.MAX_RADIUS_START_CORNER
,
ILcdArcBand.MIN_RADIUS_END_CORNER
, or
ILcdArcBand.MAX_RADIUS_END_CORNER
.a2DEditablePointSFCT
- an ILcd2DEditablePoint
into which the result is written as a
side-effect.public void moveCornerPoint2D(int aCorner, double aX, double aY)
ILcd2DEditableArcBand
moveCornerPoint2D
in interface ILcd2DEditableArcBand
aCorner
- a constant indicating which corner is to be moved:
ILcdArcBand.MIN_RADIUS_START_CORNER
,
ILcdArcBand.MAX_RADIUS_START_CORNER
,
ILcdArcBand.MIN_RADIUS_END_CORNER
, or
ILcdArcBand.MAX_RADIUS_END_CORNER
.aX
- the new x coordinate of the point.aY
- the new y coordinate of the point.public ILcdPoint getFocusPoint()
ILcdShape
ILcdShape
.getFocusPoint
in interface ILcdShape
ILcdShape
.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 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 void translate2D(double aX, double aY)
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 ILcd2DEditableShape
aX
- the x coordinate of the translation vector.aY
- the y coordinate of the translation vector.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)
public int hashCode()
ALcdShape
ALcdShape.equals(Object)
method.
Extensions should refine this implementation, based on their properties.