public class

MapBounds

extends Object
java.lang.Object
   ↳ com.carto.core.MapBounds

Class Overview

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.

Summary

Public Constructors
MapBounds()
Constructs an empty MapBounds object.
MapBounds(MapPos min, MapPos max)
Constructs a MapBounds object from a minimum and maximum map position.
Public Methods
boolean contains(MapBounds bounds)
Tests whether this map bounds object contains a another map bounds object.
boolean contains(MapPos pos)
Tests whether this map bounds object contains a map position.
synchronized void delete()
boolean equals(Object obj)
Checks if this object is equal to the specified object.
MapPos getCenter()
Calculates the center map position of this map envelope object.
MapVec getDelta()
Calculates the difference vector between the maximum and minimum map positions of this map bounds object.
MapPos getMax()
Returns the maximum (north east) map position of this map envelope object.
MapPos getMin()
Returns the minimum (south west) map position of this map envelope object.
int hashCode()
Returns the hash value of this object.
boolean intersects(MapBounds bounds)
Tests whether this map bounds object intersects with a another map bounds object.
void shrinkToIntersection(MapBounds bounds)
Shrinks this map bounds object to the intersection of this bounds and given bounds object.
String toString()
Creates a string representation of this map bounds object, useful for logging.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

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.

public MapBounds (MapPos min, MapPos max)

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).

Public Methods

public boolean contains (MapBounds bounds)

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.

public boolean contains (MapPos pos)

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.

public synchronized void delete ()

public boolean equals (Object obj)

Checks if this object is equal to the specified object.

Parameters
obj The reference object.
Returns
  • True when objects are equal, false otherwise.

public MapPos getCenter ()

Calculates the center map position of this map envelope object.

Returns
  • The center postion if this map envelope object.

public MapVec 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.

public MapPos 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.

public MapPos 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.

public int hashCode ()

Returns the hash value of this object.

Returns
  • The hash value of this object.

public boolean intersects (MapBounds bounds)

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.

public void shrinkToIntersection (MapBounds bounds)

Shrinks this map bounds object to the intersection of this bounds and given bounds object.

Parameters
bounds The other map bounds object.

public String toString ()

Creates a string representation of this map bounds object, useful for logging.

Returns
  • The string representation of this map bounds object.