public abstract class ALcdBounds extends ALcdShape implements ILcdBounds
ILcdBounds
interface.
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 |
---|
ALcdBounds() |
Modifier and Type | Method and Description |
---|---|
boolean |
contains2D(double aX,
double aY)
Checks whether this
ALcdBounds object contains the given point in the cartesian
plane. |
boolean |
contains2D(double aX,
double aY,
double aWidth,
double aHeight)
Checks whether this
ALcdBounds object contains the given rectangle in
the cartesian plane. |
boolean |
contains2D(ILcdBounds aBounds)
Checks whether this
ALcdBounds object contains the given ILcdBounds
object in the cartesian plane. |
boolean |
contains3D(double aX,
double aY,
double aZ)
Checks whether this
ALcdBounds object contains the given point in the 3D cartesian
space. |
boolean |
contains3D(double aX,
double aY,
double aZ,
double aWidth,
double aHeight,
double aDepth)
Checks whether this
ALcdBounds object contains the given box in the 3D cartesian
space. |
boolean |
contains3D(ILcdBounds aBounds)
Checks whether this
ALcdBounds object contains the given ILcdBounds
object in the 3D cartesian space. |
boolean |
equals(Object aObject)
Returns whether the given object has the same class,
and the same coordinates, width, height, and depth.
|
static ILcdBounds |
fromDomainObject(Object aObject)
Returns the bounds of the given object.
|
ILcdBounds |
getBounds()
Returns the
ILcdBounds by which the geometry of this ILcdBounded object
is bounded. |
ILcdPoint |
getFocusPoint()
Returns the focus point of this
ILcdShape . |
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. |
boolean |
interacts2D(double aX,
double aY,
double aWidth,
double aHeight)
Checks whether this
ALcdBounds object interacts with the given rectangle in
the cartesian plane. |
boolean |
interacts2D(ILcdBounds aBounds)
Checks whether this
ALcdBounds object interacts with the given ILcdBounds
object in the cartesian plane. |
boolean |
interacts3D(double aX,
double aY,
double aZ,
double aWidth,
double aHeight,
double aDepth)
Checks whether this
ALcdBounds object interacts with the given box in
the 3D cartesian space. |
boolean |
interacts3D(ILcdBounds aBounds)
Checks whether this
ALcdBounds object interacts with the given ILcdBounds
object in the 3D cartesian space. |
static boolean |
isDefined(ILcdBounded aBounded)
Checks whether the bounds of the given object are
defined . |
static boolean |
isDefined(ILcdBounds aBounds)
Checks whether the given bounds are
defined . |
clone, contains2D, contains3D
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
cloneAs2DEditableBounds, cloneAs3DEditableBounds, getCenter, getDepth, getHeight, getLocation, getMaxX, getMaxY, getMaxZ, getMinX, getMinY, getMinZ, getWidth, isDefined
contains2D, contains3D
clone
public static ILcdBounds fromDomainObject(Object aObject)
Returns the bounds of the given object. The given object is usually a domain object, i.e. an object retrieved from the model. It returns bounds in the following cases:
Object
is an ILcdBounded
.Object
is an ILcdDataObject
whose type contains a TLcdHasGeometryAnnotation
with an ILcdShape
or ALcdImage
propertyIn other cases, this method returns null
.
One should never check if an Object
is a bounds using instanceof
, but use this method
instead and perform a null
-check on the result.
aObject
- an object, usually the domain object in a model.null
.public static boolean isDefined(ILcdBounds aBounds)
defined
.
You can pass null
as argument, which will result in false
.
This method is shorthand for:
(aBounds != null && aBounds.isDefined())
aBounds
- The bounds to check, can be null
.false
if the given bounds are null
or undefined
, true
otherwisepublic static boolean isDefined(ILcdBounded aBounded)
defined
.
You can pass null
as argument, which will result in false
.
This method is shorthand for:
ALcdBounds.isDefined(aBounded == null ? null : aBounded.getBounds())
aBounded
- The element whose bounds to check, can be null
.false
if the element is null
or its bounds are undefined
, true
otherwisepublic 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
ALcdBounds
object itself.public ILcdPoint getFocusPoint()
ILcdShape
ILcdShape
.getFocusPoint
in interface ILcdShape
ILcdBounds
.public boolean contains2D(double aX, double aY)
ALcdBounds
object contains the given point in the cartesian
plane. Only the first two dimensions of the ILcdBounds
are considered,
that is, the x coordinate and y coordinate of its location, its width, and
its height.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)
ALcdBounds
object contains the given point in the 3D cartesian
space. All three spatial dimensions of the ILcdBounds
are
considered, as a combination of contains2D
and a test in the
third dimension.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.contains2D(double, double)
public boolean interacts2D(ILcdBounds aBounds)
ALcdBounds
object interacts with the given ILcdBounds
object in the cartesian plane.interacts2D
in interface ILcdBounds
aBounds
- the ILcdBounds
to compare with.interacts2D(double, double, double, double)
public boolean interacts2D(double aX, double aY, double aWidth, double aHeight)
ALcdBounds
object interacts with the given rectangle in
the cartesian plane. Only the first two dimensions of the ILcdBounds
object
are considered, that is, the x coordinate and y coordinate of its location,
its width, and its height.interacts2D
in interface ILcdBounds
aX
- the x coordinate of the rectangle.aY
- the y coordinate of the rectangle.aWidth
- the width of the rectangle.aHeight
- the height of the rectangle.true
if this ALcdBounds
object touches or overlaps to
any extent with the given rectangle, false
otherwise.public boolean contains2D(ILcdBounds aBounds)
ALcdBounds
object contains the given ILcdBounds
object in the cartesian plane.contains2D
in interface ILcdBounds
aBounds
- the ILcdBounds
to compare with.contains2D(double, double, double, double)
public boolean contains2D(double aX, double aY, double aWidth, double aHeight)
ALcdBounds
object contains the given rectangle in
the cartesian plane. Only the first two dimensions of the ILcdBounds
object
are considered, that is, the x coordinate and y coordinate of its location,
its width, and its height.contains2D
in interface ILcdBounds
aX
- the x coordinate of the rectangle.aY
- the y coordinate of the rectangle.aWidth
- the width of the rectangle.aHeight
- the height of the rectangle.public boolean interacts3D(ILcdBounds aBounds)
ALcdBounds
object interacts with the given ILcdBounds
object in the 3D cartesian space.interacts3D
in interface ILcdBounds
aBounds
- the ILcdBounds
to compare with.interacts3D(double, double, double, double, double, double)
public boolean interacts3D(double aX, double aY, double aZ, double aWidth, double aHeight, double aDepth)
ALcdBounds
object interacts with the given box in
the 3D cartesian space.interacts3D
in interface ILcdBounds
aX
- the x coordinate of the box.aY
- the y coordinate of the box.aZ
- the z coordinate of the box.aWidth
- the width of the box.aHeight
- the height of the box.aDepth
- the depth of the box.true
if this ALcdBounds
object touches or overlaps to
any extent with the given box, false
otherwise.public boolean contains3D(ILcdBounds aBounds)
ALcdBounds
object contains the given ILcdBounds
object in the 3D cartesian space.contains3D
in interface ILcdBounds
aBounds
- the ILcdBounds
to compare with.contains3D(double, double, double, double, double, double)
public boolean contains3D(double aX, double aY, double aZ, double aWidth, double aHeight, double aDepth)
ALcdBounds
object contains the given box in the 3D cartesian
space. All three spatial dimensions of the ILcdBounds
are
considered, as a combination of contains2D
and a test in the
third dimension.contains3D
in interface ILcdBounds
aX
- the x coordinate of the point.aY
- the y coordinate of the point.aZ
- the z coordinate of the point.aWidth
- the width of the box.aHeight
- the height of the box.aDepth
- the depth of the box.contains2D(double, double, double, double)
public boolean equals(Object aObject)
public int hashCode()
ALcdShape
ALcdShape.equals(Object)
method.
Extensions should refine this implementation, based on their properties.