Class MapEnvelope

java.lang.Object
com.massifmaps.core.MapEnvelope

public class MapEnvelope extends Object
A bounding area on the map. Can be defined by a map bounds object or by a convex bounding polygon.
This class is intended for conservative object area estimation and fast intersection testing.
  • Constructor Details

    • MapEnvelope

      public MapEnvelope()
      Constructs an empty MapEnvelope object. Nothing is contained within
      this envelope.
    • MapEnvelope

      public MapEnvelope(MapBounds bounds)
      Constructs a MapEnvelope object using map bounds.
      Parameters:
      bounds - The bounds for the envelope.
    • MapEnvelope

      public MapEnvelope(MapPosVector convexHull)
      Constructs a MapEnvelope object from a convex bounding polygon.
      Parameters:
      convexHull - The list of convex hull points.
  • Method Details

    • equals

      public boolean equals(Object obj)
      Checks if this object is equal to the specified object.
      Overrides:
      equals in class Object
      Parameters:
      obj - The reference object.
      Returns:
      True when objects are equal, false otherwise.
    • hashCode

      public int hashCode()
      Returns the hash value of this object.
      Overrides:
      hashCode in class Object
      Returns:
      The hash value of this object.
    • getBounds

      public MapBounds getBounds()
      Returns the map bounds of this map envelope.
      Returns:
      The map bounds of this map envelope.
    • getConvexHull

      public MapPosVector getConvexHull()
      Returns the convex hull of this map envelope.
      Returns:
      The convex hull of this map envelope.
    • contains

      public boolean contains(MapEnvelope envelope)
      Tests whether this map envelope contains another map envelope.
      Parameters:
      envelope - The other map envelope.
      Returns:
      True if this map envelope contains the other map envelope.
    • intersects

      public boolean intersects(MapEnvelope envelope)
      Tests whether this map envelope intersects with another map envelope.
      Parameters:
      envelope - The other map envelope.
      Returns:
      True if this map envelope intersects the other map envelope.
    • toString

      public String toString()
      Creates a string representation of this map envelope, useful for logging.
      Overrides:
      toString in class Object
      Returns:
      The string representation of this map envelope.