public class TLcdXYBounds extends ALcd2DEditableBounds implements ILcd2DEditableBounds
ILcd2DEditableBounds
in
the cartesian space.
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 |
---|
TLcdXYBounds()
Constructs a new rectangle, initialized to location (0, 0) and
size (0, 0).
|
TLcdXYBounds(double aX,
double aY,
double aWidth,
double aHeight)
Constructs and initializes a rectangle with the specified parameters.
|
TLcdXYBounds(ILcdBounds aBounds)
Constructs a new rectangle, initialized to match the values of
the specified rectangle.
|
TLcdXYBounds(ILcdPoint aPoint)
Constructs a rectangle with zero width and height at the specified point.
|
TLcdXYBounds(ILcdPoint aPoint,
double aWidth,
double aHeight)
Constructs a rectangle and initializes it to the specified point.
|
TLcdXYBounds(Rectangle aRectangle)
Constructs a rectangle and initializes it with the values of
an AWT rectangle.
|
Modifier and Type | Method and Description |
---|---|
Object |
clone()
Creates and returns a copy of this object.
|
ILcd2DEditableBounds |
cloneAs2DEditableBounds()
Returns a copy of this
ILcdBounds object that is also an ILcd2DEditableBounds . |
ILcd3DEditableBounds |
cloneAs3DEditableBounds()
Returns a copy of this
ILcdBounds object that is also an ILcd3DEditableBounds . |
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,
double aWidth,
double aHeight,
double aDepth)
Checks whether this
ALcdBounds object contains the given box in the 3D cartesian
space. |
double |
getHeight()
Returns the height of the bounding box.
|
ILcdPoint |
getLocation()
Returns the location of the bounding box (smallest x and y coordinates).
|
double |
getMaxX()
Returns the maximum X value (right boundary) of this bounds.
|
double |
getMaxY()
Returns the maximum Y value (upper boundary) of this bounds.
|
double |
getMaxZ()
Returns the maximum Z value (top boundary) of this bounds.
|
double |
getMinX()
Returns the minimum X value (left boundary) of this bounds.
|
double |
getMinY()
Returns the minimum Y value (lower boundary) of this bounds.
|
double |
getMinZ()
Returns the minimum Z value (bottom boundary) of this bounds.
|
double |
getWidth()
Returns the width of the bounding box.
|
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 |
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. |
static void |
make2DEditableBoundsSFCT(ILcdPoint[] aPointArray,
ILcd2DEditableBounds a2DEditableBoundsSFCT) |
void |
move2D(double aX,
double aY)
Moves this
ILcd2DEditableShape to the given point in the 2D space. |
void |
retrieveAWTRectangleSFCT(Rectangle aRectangleSFCT) |
void |
setHeight(double aHeight)
Sets the height of the bounds (the extent along the y-axis).
|
void |
setTo2DIntersection(double aX,
double aY,
double aWidth,
double aHeight)
Calculates the 2D intersection of this
ALcd2DEditableBounds and a given rectangle
in the cartesian plane. |
void |
setTo2DUnion(double aX,
double aY,
double aWidth,
double aHeight)
Calculates the 2D union of this
ALcd2DEditableBounds and a given rectangle
in the cartesian plane. |
void |
setWidth(double aWidth)
Sets the width of the bounds (the extent along the x-axis).
|
getDepth, isDefined, move2D, setDefined, setTo2DIntersection, setTo2DUnion, setToIncludePoint2D, setToIncludePoint2D, toString, translate2D
contains2D, contains3D, contains3D, equals, fromDomainObject, getBounds, getFocusPoint, hashCode, interacts2D, interacts3D, isDefined, isDefined
contains2D, contains3D
finalize, getClass, notify, notifyAll, wait, wait, wait
move2D, setTo2DIntersection, setTo2DUnion, setToIncludePoint2D, setToIncludePoint2D, translate2D
contains3D, getCenter, getDepth, interacts2D, interacts3D, isDefined
contains2D, contains2D, contains3D, contains3D, getFocusPoint
getBounds
public TLcdXYBounds(double aX, double aY, double aWidth, double aHeight)
aX
- the x coordinate of the lower left point (smallest x).aY
- the y coordinate of the lower left point (smallest y).aWidth
- the width of the rectangle.aHeight
- the height of the rectangle.public TLcdXYBounds()
The defined
status of the instance is false
.
public TLcdXYBounds(ILcdBounds aBounds)
The defined
status of the instance is also copied from the specified bounds.
aBounds
- a rectangle from which to copy initial values.public TLcdXYBounds(ILcdPoint aPoint, double aWidth, double aHeight)
aPoint
- the lower left point of the rectangle (smallest x and y).aWidth
- the width of the rectangle.aHeight
- the height of the rectangle.public TLcdXYBounds(ILcdPoint aPoint)
aPoint
- the lower left point of the rectangle (smallest x and y coordinates).public TLcdXYBounds(Rectangle aRectangle)
aRectangle
- AWT rectangle.public final ILcdPoint getLocation()
ILcdBounds
getLocation
in interface ILcdBounds
public double getMinX()
ILcdBounds
getLocation.getX()
, but can be overridden for performance.getMinX
in interface ILcdBounds
ILcdBounds.getMaxX()
public double getMinY()
ILcdBounds
getLocation.getY()
, but can be overridden for performance.getMinY
in interface ILcdBounds
ILcdBounds.getMaxY()
public double getMinZ()
ILcdBounds
getLocation.getZ()
, but can be overridden for performance.getMinZ
in interface ILcdBounds
ILcdBounds.getMaxZ()
public double getMaxX()
ILcdBounds
getLocation.getX() + getWidth()
, but can be overridden for performance.
Note that this is a derived property, the bounds are defined by their lower-left corner and width/height.
For geodetic bounds
, the returned value is not necessarily normalized to [-180, 180].getMaxX
in interface ILcdBounds
ILcdBounds.getMinX()
public double getMaxY()
ILcdBounds
getLocation.getY() + getHeight()
, but can be overridden for performance.
Note that this is a derived property, the bounds are defined by their lower-left corner and width/height.getMaxY
in interface ILcdBounds
ILcdBounds.getMinY()
public double getMaxZ()
ILcdBounds
getLocation.getZ() + getDepth()
, but can be overridden for performance.
Note that this is a derived property, the bounds are defined by their lower-left corner and width/height.getMaxZ
in interface ILcdBounds
ILcdBounds.getMinZ()
public final double getWidth()
ILcdBounds
getWidth
in interface ILcdBounds
public void setWidth(double aWidth)
ILcd2DEditableBounds
If this bounds was undefined
, it becomes defined.
setWidth
in interface ILcd2DEditableBounds
aWidth
- the new width.public final double getHeight()
ILcdBounds
getHeight
in interface ILcdBounds
public void setHeight(double aHeight)
ILcd2DEditableBounds
If this bounds was undefined
, it becomes defined.
setHeight
in interface ILcd2DEditableBounds
aHeight
- the new height.public void move2D(double aX, double aY)
ILcd2DEditableBounds
ILcd2DEditableShape
to the given point in the 2D space. The focus point
is used as the handle by which the shape is moved. Only the first
two dimensions of the ILcdShape
are considered.
The third dimension is left unchanged.
If this bounds was undefined
, it becomes defined after the move.
move2D
in interface ILcd2DEditableBounds
move2D
in interface ILcd2DEditableShape
aX
- the x coordinate of the point.aY
- the y coordinate of the point.public static void make2DEditableBoundsSFCT(ILcdPoint[] aPointArray, ILcd2DEditableBounds a2DEditableBoundsSFCT)
public void retrieveAWTRectangleSFCT(Rectangle aRectangleSFCT)
aRectangleSFCT
- AWT Rectangle
that contains the given rectangle.public ILcd2DEditableBounds cloneAs2DEditableBounds()
ILcdBounds
ILcdBounds
object that is also an ILcd2DEditableBounds
.
This makes sure that the first two dimensions of the copy are writable,
even if the original ILcdBounds
object may be read-only.cloneAs2DEditableBounds
in interface ILcdBounds
ILcdBounds
object that is also an ILcd2DEditableBounds
.
This makes sure that the first two dimensions of the copy are writable,
even if the original ILcdBounds
object may be read-only.ILcd2DEditableBounds
public ILcd3DEditableBounds cloneAs3DEditableBounds()
ILcdBounds
ILcdBounds
object that is also an ILcd3DEditableBounds
.
This makes sure that all three dimensions of the copy are writable,
even if the original ILcdBounds
object may be read-only.cloneAs3DEditableBounds
in interface ILcdBounds
ILcdBounds
object that is also an ILcd3DEditableBounds
.
This makes sure that all three dimensions of the copy are writable,
even if the original ILcdBounds
object may be read-only.ILcd3DEditableBounds
public Object clone()
clone
in interface ILcdCloneable
clone
in class ALcdShape
Object.clone()
public void setTo2DIntersection(double aX, double aY, double aWidth, double aHeight)
ALcd2DEditableBounds
ALcd2DEditableBounds
and a given rectangle
in the cartesian plane.setTo2DIntersection
in interface ILcd2DEditableBounds
setTo2DIntersection
in class ALcd2DEditableBounds
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 void setTo2DUnion(double aX, double aY, double aWidth, double aHeight)
ALcd2DEditableBounds
ALcd2DEditableBounds
and a given rectangle
in the cartesian plane.setTo2DUnion
in interface ILcd2DEditableBounds
setTo2DUnion
in class ALcd2DEditableBounds
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 contains2D(double aX, double aY, double aWidth, double aHeight)
ALcdBounds
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
contains2D
in class ALcdBounds
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 contains2D(ILcdBounds aBounds)
ALcdBounds
ALcdBounds
object contains the given ILcdBounds
object in the cartesian plane.contains2D
in interface ILcdBounds
contains2D
in class ALcdBounds
aBounds
- the ILcdBounds
to compare with.ALcdBounds.contains2D(double, double, double, double)
public boolean interacts2D(double aX, double aY, double aWidth, double aHeight)
ALcdBounds
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
interacts2D
in class ALcdBounds
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 interacts3D(double aX, double aY, double aZ, double aWidth, double aHeight, double aDepth)
ALcdBounds
ALcdBounds
object interacts with the given box in
the 3D cartesian space.interacts3D
in interface ILcdBounds
interacts3D
in class ALcdBounds
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(double aX, double aY, double aZ, double aWidth, double aHeight, double aDepth)
ALcdBounds
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
contains3D
in class ALcdBounds
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.ALcdBounds.contains2D(double, double, double, double)