Package com.massifmaps.core
Class MapBounds
java.lang.Object
com.massifmaps.core.MapBounds
A container class that defines an axis aligned cuboid on the map using minimum and maximum map positions.
Valid ranges for map bounds depend on the projection used.
Valid ranges for map bounds depend on the projection used.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanTests whether this map bounds object contains a another map bounds object.booleanTests whether this map bounds object contains a map position.booleanChecks if this object is equal to the specified object.Calculates the center map position of this map envelope object.getDelta()Calculates the difference vector between the maximum and minimum map positions of this map bounds object.getMax()Returns the maximum (north east) map position of this map envelope object.getMin()Returns the minimum (south west) map position of this map envelope object.inthashCode()Returns the hash value of this object.booleanintersects(MapBounds bounds) Tests whether this map bounds object intersects with a another map bounds object.voidshrinkToIntersection(MapBounds bounds) Shrinks this map bounds object to the intersection of this bounds and given bounds object.toString()Creates a string representation of this map bounds object, useful for logging.
-
Constructor Details
-
MapBounds
public MapBounds()Constructs an empty MapBounds object. The coordinates of the minimum map position will be
set to positive infinity and the coordinates of the maximum map position will be
set to negative infinity. -
MapBounds
Constructs a MapBounds object from a minimum and maximum map position. If a coordinate of the
minimum map positon is larger than the same coordinate of the maximum map position then those
coordinates will be swapped.- Parameters:
min- The minimum map position (south-west).max- The maximum map position (north-east).
-
-
Method Details
-
equals
Checks if this object is equal to the specified object. -
hashCode
public int hashCode()Returns the hash value of this object. -
getCenter
Calculates the center map position of this map envelope object.- Returns:
- The center postion if this map envelope object.
-
getDelta
Calculates the difference vector between the maximum and minimum map positions of this map bounds object.- Returns:
- The difference vector between maximum and minimum map positions of this map bounds object.
-
getMin
Returns the minimum (south west) map position of this map envelope object.- Returns:
- The minimum (south west) map position of this map envelope object.
-
getMax
Returns the maximum (north east) map position of this map envelope object.- Returns:
- The maximum (north east) map position of this map envelope object.
-
contains
Tests whether this map bounds object contains a map position.- Parameters:
pos- The map position.- Returns:
- True if this map bounds object contains the map position.
-
contains
Tests whether this map bounds object contains a another map bounds object.- Parameters:
bounds- The other map bounds object.- Returns:
- True if this map bounds object contains the other map bounds object.
-
intersects
Tests whether this map bounds object intersects with a another map bounds object.- Parameters:
bounds- The other map bounds object.- Returns:
- True if this map bounds object intersects with the other map bounds object.
-
shrinkToIntersection
Shrinks this map bounds object to the intersection of this bounds and given bounds object.- Parameters:
bounds- The other map bounds object.
-
toString
Creates a string representation of this map bounds object, useful for logging.
-