Package com.luciad.shape.shape2D
Class TLcdLonLatBounds
java.lang.Object
com.luciad.shape.ALcdShape
com.luciad.shape.ALcdBounds
com.luciad.shape.shape2D.ALcd2DEditableBounds
com.luciad.shape.shape2D.TLcdLonLatBounds
- All Implemented Interfaces:
ILcdBounded
,ILcdBounds
,ILcdShape
,ILcd2DEditableBounds
,ILcd2DEditableShape
,ILcdCloneable
,Serializable
,Cloneable
This class provides an implementation of
ILcd2DEditableBounds
in
the geodetic space.
All longitude/latitude coordinates are expressed in degrees.
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
ConstructorDescriptionConstructs a new rectangle, initialized to location (0, 0) and size (0, 0).TLcdLonLatBounds
(double aLon, double aLat, double aWidth, double aHeight) Constructs and initializes a rectangle with the specified parameters.TLcdLonLatBounds
(ILcdBounds aBounds) Constructs a new rectangle, initialized to match the values of the specified rectangle.TLcdLonLatBounds
(ILcdPoint aPoint) Constructs a rectangle at the given point with width and height zero.TLcdLonLatBounds
(ILcdPoint aPoint, double aWidth, double aHeight) Constructs a rectangle and initializes it with the parameters. -
Method Summary
Modifier and TypeMethodDescriptionclone()
Creates and returns a copy of this object.Returns a copy of thisILcdBounds
object that is also anILcd2DEditableBounds
.Returns a copy of thisILcdBounds
object that is also anILcd3DEditableBounds
.boolean
contains2D
(double aLon, double aLat) Checks whether thisALcdBounds
object contains the given point in the cartesian plane.boolean
contains2D
(double aLon, double aLat, double aWidth, double aHeight) Checks whether thisALcdBounds
object contains the given rectangle in the cartesian plane.final double
Returns the height of the bounding box in degrees.final ILcdPoint
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.final double
getWidth()
Returns the width of the bounding box in degrees.boolean
interacts2D
(double aLon, double aLat, double aWidth, double aHeight) Checks whether thisALcdBounds
object interacts with the given rectangle in the cartesian plane.void
move2D
(double aLon, double aLat) Moves the bounds.void
setHeight
(double aHeight) Sets the height (in degrees) of this bounds so that it covers a valid area.void
setTo2DIntersection
(double aLon, double aLat, double aWidth, double aHeight) Calculates the 2D intersection of thisALcd2DEditableBounds
and a given rectangle in the cartesian plane.void
setTo2DUnion
(double aLon, double aLat, double aWidth, double aHeight) Calculates the 2D union of thisALcd2DEditableBounds
and a given rectangle in the cartesian plane.void
setWidth
(double aWidth) Sets the width of the bounds (the extent along the x-axis).Methods inherited from class com.luciad.shape.shape2D.ALcd2DEditableBounds
getDepth, isDefined, move2D, setDefined, setTo2DIntersection, setTo2DUnion, setToIncludePoint2D, setToIncludePoint2D, toString, translate2D
Methods inherited from class com.luciad.shape.ALcdBounds
contains2D, contains3D, contains3D, contains3D, equals, fromDomainObject, getBounds, getFocusPoint, hashCode, interacts2D, interacts3D, interacts3D, isDefined, isDefined
Methods inherited from class com.luciad.shape.ALcdShape
contains2D, contains3D
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.luciad.shape.shape2D.ILcd2DEditableBounds
move2D, setTo2DIntersection, setTo2DUnion, setToIncludePoint2D, setToIncludePoint2D, translate2D
Methods inherited from interface com.luciad.shape.ILcdBounded
getBounds
Methods inherited from interface com.luciad.shape.ILcdBounds
contains2D, contains3D, contains3D, getCenter, getDepth, interacts2D, interacts3D, interacts3D, isDefined
Methods inherited from interface com.luciad.shape.ILcdShape
contains2D, contains3D, contains3D, getFocusPoint
-
Constructor Details
-
TLcdLonLatBounds
public TLcdLonLatBounds(double aLon, double aLat, double aWidth, double aHeight) Constructs and initializes a rectangle with the specified parameters.- Parameters:
aLon
- the longitude coordinate of the most south-western point.aLat
- the latitude coordinate of the most south-western point.aWidth
- the longitude-width of the rectangle, in degrees, must be positive.aHeight
- the latitude-height of the rectangle, in degrees, must be positive.
-
TLcdLonLatBounds
public TLcdLonLatBounds()Constructs a new rectangle, initialized to location (0, 0) and size (0, 0).The
defined
status of the instance isfalse
. -
TLcdLonLatBounds
Constructs a new rectangle, initialized to match the values of the specified rectangle.The
defined
status of the instance is also copied from the specified bounds.- Parameters:
aBounds
- a rectangle from which to copy initial values.
-
TLcdLonLatBounds
Constructs a rectangle and initializes it with the parameters.- Parameters:
aPoint
- the most south-western point of the rectangle.aWidth
- the longitude-width of the rectangle, in degrees, must be positive.aHeight
- the latitude-height of the rectangle, in degrees, must be positive.
-
TLcdLonLatBounds
Constructs a rectangle at the given point with width and height zero.- Parameters:
aPoint
- the point at which the rectangle is located.
-
-
Method Details
-
getLocation
Description copied from interface:ILcdBounds
Returns the location of the bounding box (smallest x and y coordinates).- Specified by:
getLocation
in interfaceILcdBounds
- Returns:
- the location of the bounding box.
-
getMinX
public double getMinX()Description copied from interface:ILcdBounds
Returns the minimum X value (left boundary) of this bounds. By default, this doesgetLocation.getX()
, but can be overridden for performance.- Specified by:
getMinX
in interfaceILcdBounds
- Returns:
- the minimum X boundary
- See Also:
-
getMinY
public double getMinY()Description copied from interface:ILcdBounds
Returns the minimum Y value (lower boundary) of this bounds. By default, this doesgetLocation.getY()
, but can be overridden for performance.- Specified by:
getMinY
in interfaceILcdBounds
- Returns:
- the minimum Y boundary
- See Also:
-
getMinZ
public double getMinZ()Description copied from interface:ILcdBounds
Returns the minimum Z value (bottom boundary) of this bounds. By default, this doesgetLocation.getZ()
, but can be overridden for performance.- Specified by:
getMinZ
in interfaceILcdBounds
- Returns:
- the minimum Z boundary
- See Also:
-
getMaxX
public double getMaxX()Description copied from interface:ILcdBounds
Returns the maximum X value (right boundary) of this bounds. By default, this doesgetLocation.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. Forgeodetic bounds
, the returned value is not necessarily normalized to [-180, 180].- Specified by:
getMaxX
in interfaceILcdBounds
- Returns:
- the maximum X boundary
- See Also:
-
getMaxY
public double getMaxY()Description copied from interface:ILcdBounds
Returns the maximum Y value (upper boundary) of this bounds. By default, this doesgetLocation.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.- Specified by:
getMaxY
in interfaceILcdBounds
- Returns:
- the maximum Y boundary
- See Also:
-
getMaxZ
public double getMaxZ()Description copied from interface:ILcdBounds
Returns the maximum Z value (top boundary) of this bounds. By default, this doesgetLocation.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.- Specified by:
getMaxZ
in interfaceILcdBounds
- Returns:
- the maximum Z boundary
- See Also:
-
getWidth
public final double getWidth()Returns the width of the bounding box in degrees. The width is in range [0, 360].- Specified by:
getWidth
in interfaceILcdBounds
- Returns:
- the width of the bounding box, in degrees.
-
setWidth
public void setWidth(double aWidth) Sets the width of the bounds (the extent along the x-axis). The width must be in degrees. A negative width will translate the bounds to the left. A width larger than 360 will be set to 360.- Specified by:
setWidth
in interfaceILcd2DEditableBounds
- Parameters:
aWidth
- the new width, in degrees.
-
getHeight
public final double getHeight()Returns the height of the bounding box in degrees. The width is in range [0, 180].- Specified by:
getHeight
in interfaceILcdBounds
- Returns:
- the height of the bounding box, in degrees.
-
setHeight
public void setHeight(double aHeight) Sets the height (in degrees) of this bounds so that it covers a valid area. When the height passed is so that the area covered with the bounds would have coordinates outside the valid latitude area, the height value is clipped to the largest value that would cover a valid longitude, latitude area. This implies that the result ofgetHeight()
is not necessarily the same as the value passed here.- Specified by:
setHeight
in interfaceILcd2DEditableBounds
- Parameters:
aHeight
- the proposed new height, in degrees, for this bounds object. This value may be clipped to ensure that the bounds covers a valid latitude interval.
-
move2D
public void move2D(double aLon, double aLat) Moves the bounds.- Specified by:
move2D
in interfaceILcd2DEditableBounds
- Specified by:
move2D
in interfaceILcd2DEditableShape
- Parameters:
aLon
- the longitude coordinate of the new most south-western point.aLat
- the latitude coordinate of the new most south-western point.
-
cloneAs2DEditableBounds
Description copied from interface:ILcdBounds
Returns a copy of thisILcdBounds
object that is also anILcd2DEditableBounds
. This makes sure that the first two dimensions of the copy are writable, even if the originalILcdBounds
object may be read-only.- Specified by:
cloneAs2DEditableBounds
in interfaceILcdBounds
- Returns:
- a copy of this
ILcdBounds
object that is also anILcd2DEditableBounds
. This makes sure that the first two dimensions of the copy are writable, even if the originalILcdBounds
object may be read-only. - See Also:
-
cloneAs3DEditableBounds
Description copied from interface:ILcdBounds
Returns a copy of thisILcdBounds
object that is also anILcd3DEditableBounds
. This makes sure that all three dimensions of the copy are writable, even if the originalILcdBounds
object may be read-only.- Specified by:
cloneAs3DEditableBounds
in interfaceILcdBounds
- Returns:
- a copy of this
ILcdBounds
object that is also anILcd3DEditableBounds
. This makes sure that all three dimensions of the copy are writable, even if the originalILcdBounds
object may be read-only. - See Also:
-
clone
Creates and returns a copy of this object. The contained editable point representing the most south-western point of the rectangle is cloned.- Specified by:
clone
in interfaceILcdCloneable
- Overrides:
clone
in classALcdShape
- See Also:
-
contains2D
public boolean contains2D(double aLon, double aLat) Description copied from class:ALcdBounds
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
- Overrides:
contains2D
in classALcdBounds
- Parameters:
aLon
- the x coordinate of the point.aLat
- the y coordinate of the point.- Returns:
- the boolean result of the containment test.
-
interacts2D
public boolean interacts2D(double aLon, double aLat, double aWidth, double aHeight) Description copied from class:ALcdBounds
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
- Overrides:
interacts2D
in classALcdBounds
- Parameters:
aLon
- the x coordinate of the rectangle.aLat
- 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
public boolean contains2D(double aLon, double aLat, double aWidth, double aHeight) Description copied from class:ALcdBounds
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
- Overrides:
contains2D
in classALcdBounds
- Parameters:
aLon
- the x coordinate of the rectangle.aLat
- 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.
-
setTo2DIntersection
public void setTo2DIntersection(double aLon, double aLat, double aWidth, double aHeight) Description copied from class:ALcd2DEditableBounds
Calculates the 2D intersection of thisALcd2DEditableBounds
and a given rectangle in the cartesian plane.- Specified by:
setTo2DIntersection
in interfaceILcd2DEditableBounds
- Overrides:
setTo2DIntersection
in classALcd2DEditableBounds
- Parameters:
aLon
- the x coordinate of the rectangle.aLat
- the y coordinate of the rectangle.aWidth
- the width of the rectangle.aHeight
- the height of the rectangle.
-
setTo2DUnion
public void setTo2DUnion(double aLon, double aLat, double aWidth, double aHeight) Description copied from class:ALcd2DEditableBounds
Calculates the 2D union of thisALcd2DEditableBounds
and a given rectangle in the cartesian plane.- Specified by:
setTo2DUnion
in interfaceILcd2DEditableBounds
- Overrides:
setTo2DUnion
in classALcd2DEditableBounds
- Parameters:
aLon
- the x coordinate of the rectangle.aLat
- the y coordinate of the rectangle.aWidth
- the width of the rectangle.aHeight
- the height of the rectangle.
-