Class ALcdBounds
- All Implemented Interfaces:
ILcdBounded
,ILcdBounds
,ILcdShape
,ILcdCloneable
,Serializable
,Cloneable
- Direct Known Subclasses:
ALcd2DEditableBounds
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.
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
contains2D
(double aX, double aY) Checks whether thisALcdBounds
object contains the given point in the cartesian plane.boolean
contains2D
(double aX, double aY, double aWidth, double aHeight) Checks whether thisALcdBounds
object contains the given rectangle in the cartesian plane.boolean
contains2D
(ILcdBounds aBounds) Checks whether thisALcdBounds
object contains the givenILcdBounds
object in the cartesian plane.boolean
contains3D
(double aX, double aY, double aZ) Checks whether thisALcdBounds
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 thisALcdBounds
object contains the given box in the 3D cartesian space.boolean
contains3D
(ILcdBounds aBounds) Checks whether thisALcdBounds
object contains the givenILcdBounds
object in the 3D cartesian space.boolean
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.Returns theILcdBounds
by which the geometry of thisILcdBounded
object is bounded.Returns the focus point of thisILcdShape
.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.boolean
interacts2D
(double aX, double aY, double aWidth, double aHeight) Checks whether thisALcdBounds
object interacts with the given rectangle in the cartesian plane.boolean
interacts2D
(ILcdBounds aBounds) Checks whether thisALcdBounds
object interacts with the givenILcdBounds
object in the cartesian plane.boolean
interacts3D
(double aX, double aY, double aZ, double aWidth, double aHeight, double aDepth) Checks whether thisALcdBounds
object interacts with the given box in the 3D cartesian space.boolean
interacts3D
(ILcdBounds aBounds) Checks whether thisALcdBounds
object interacts with the givenILcdBounds
object in the 3D cartesian space.static boolean
isDefined
(ILcdBounded aBounded) Checks whether the bounds of the given object aredefined
.static boolean
isDefined
(ILcdBounds aBounds) Checks whether the given bounds aredefined
.Methods inherited from class com.luciad.shape.ALcdShape
clone, contains2D, contains3D
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.luciad.shape.ILcdBounds
cloneAs2DEditableBounds, cloneAs3DEditableBounds, getCenter, getDepth, getHeight, getLocation, getMaxX, getMaxY, getMaxZ, getMinX, getMinY, getMinZ, getWidth, isDefined
Methods inherited from interface com.luciad.util.ILcdCloneable
clone
Methods inherited from interface com.luciad.shape.ILcdShape
contains2D, contains3D
-
Constructor Details
-
ALcdBounds
public ALcdBounds()
-
-
Method Details
-
fromDomainObject
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:
- The given
Object
is anILcdBounded
. - The
Object
is anILcdDataObject
whose type contains aTLcdHasGeometryAnnotation
with anILcdShape
orALcdImage
property
In other cases, this method returns
null
.One should never check if an
Object
is a bounds usinginstanceof
, but use this method instead and perform anull
-check on the result.- Parameters:
aObject
- an object, usually the domain object in a model.- Returns:
- the bounds associated with the given object or
null
.
- The given
-
isDefined
Checks whether the given bounds aredefined
.You can pass
null
as argument, which will result infalse
.This method is shorthand for:
(aBounds != null && aBounds.isDefined())
- Parameters:
aBounds
- The bounds to check, can benull
.- Returns:
false
if the given bounds arenull
orundefined
,true
otherwise
-
isDefined
Checks whether the bounds of the given object aredefined
.You can pass
null
as argument, which will result infalse
.This method is shorthand for:
ALcdBounds.isDefined(aBounded == null ? null : aBounded.getBounds())
- Parameters:
aBounded
- The element whose bounds to check, can benull
.- Returns:
false
if the element isnull
or its bounds areundefined
,true
otherwise
-
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
ALcdBounds
object itself.
-
getFocusPoint
Description copied from interface:ILcdShape
Returns the focus point of thisILcdShape
.- Specified by:
getFocusPoint
in interfaceILcdShape
- Returns:
- the location of the
ILcdBounds
.
-
contains2D
public boolean contains2D(double aX, double aY) Checks whether thisALcdBounds
object contains the given point in the cartesian plane. Only the first two dimensions of theILcdBounds
are considered, that is, the x coordinate and y coordinate of its location, its width, and its height.- 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) Checks whether thisALcdBounds
object contains the given point in the 3D cartesian space. All three spatial dimensions of theILcdBounds
are considered, as a combination ofcontains2D
and a test in the third dimension.- Specified by:
contains3D
in interfaceILcdShape
- Parameters:
aX
- the x coordinate of the point.aY
- the y coordinate of the point.aZ
- the z coordinate of the point.- Returns:
- the boolean result of the containment test.
- See Also:
-
interacts2D
Checks whether thisALcdBounds
object interacts with the givenILcdBounds
object in the cartesian plane.- Specified by:
interacts2D
in interfaceILcdBounds
- Parameters:
aBounds
- theILcdBounds
to compare with.- Returns:
- the boolean result of the interaction test.
- See Also:
-
interacts2D
public boolean interacts2D(double aX, double aY, double aWidth, double aHeight) Checks whether thisALcdBounds
object interacts with the given rectangle in the cartesian plane. Only the first two dimensions of theILcdBounds
object are considered, that is, the x coordinate and y coordinate of its location, its width, and its height.- Specified by:
interacts2D
in interfaceILcdBounds
- Parameters:
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.- Returns:
true
if thisALcdBounds
object touches or overlaps to any extent with the given rectangle,false
otherwise.
-
contains2D
Checks whether thisALcdBounds
object contains the givenILcdBounds
object in the cartesian plane.- Specified by:
contains2D
in interfaceILcdBounds
- Parameters:
aBounds
- theILcdBounds
to compare with.- Returns:
- the boolean result of the containment test.
- See Also:
-
contains2D
public boolean contains2D(double aX, double aY, double aWidth, double aHeight) Checks whether thisALcdBounds
object contains the given rectangle in the cartesian plane. Only the first two dimensions of theILcdBounds
object are considered, that is, the x coordinate and y coordinate of its location, its width, and its height.- Specified by:
contains2D
in interfaceILcdBounds
- Parameters:
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.- Returns:
- the boolean result of the containment test.
-
interacts3D
Checks whether thisALcdBounds
object interacts with the givenILcdBounds
object in the 3D cartesian space.- Specified by:
interacts3D
in interfaceILcdBounds
- Parameters:
aBounds
- theILcdBounds
to compare with.- Returns:
- the boolean result of the interaction test.
- See Also:
-
interacts3D
public boolean interacts3D(double aX, double aY, double aZ, double aWidth, double aHeight, double aDepth) Checks whether thisALcdBounds
object interacts with the given box in the 3D cartesian space.- Specified by:
interacts3D
in interfaceILcdBounds
- Parameters:
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.- Returns:
true
if thisALcdBounds
object touches or overlaps to any extent with the given box,false
otherwise.
-
contains3D
Checks whether thisALcdBounds
object contains the givenILcdBounds
object in the 3D cartesian space.- Specified by:
contains3D
in interfaceILcdBounds
- Parameters:
aBounds
- theILcdBounds
to compare with.- Returns:
- the boolean result of the containment test.
- See Also:
-
contains3D
public boolean contains3D(double aX, double aY, double aZ, double aWidth, double aHeight, double aDepth) Checks whether thisALcdBounds
object contains the given box in the 3D cartesian space. All three spatial dimensions of theILcdBounds
are considered, as a combination ofcontains2D
and a test in the third dimension.- Specified by:
contains3D
in interfaceILcdBounds
- Parameters:
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.- Returns:
- the boolean result of the containment test.
- See Also:
-
equals
Returns whether the given object has the same class, and the same coordinates, width, height, and depth. -
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.
-