Package globus.glmap

Class GLMapBBox

java.lang.Object
globus.glmap.GLMapBBox
All Implemented Interfaces:
Serializable

public class GLMapBBox extends Object implements Serializable
GLMapBBox defines some rectangular area of map
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    double
    X coordinate of the origin of the bounding box
    double
    Y coordinate of the origin of the bounding box
    double
    X size of the bounding box
    double
    Y size of the bounding box
  • Constructor Summary

    Constructors
    Constructor
    Description
    Default constructor.
    GLMapBBox(double origin_x, double origin_y, double size_x, double size_y)
    Initialize bbox with given data
    Copy constructor
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Join this bbox with given
    void
    addPoint(double x, double y)
    Add point to bbox
    void
    Add point to bbox
    void
    assign(double origin_x, double origin_y, double size_x, double size_y)
    Initialize bbox with data
    Center of bbox
    void
    Reset bbox to empty
    double
    Returns distance from bbox to point
    boolean
    equals(Object other)
     
    int
     
    boolean
    Checks if bbox intersects with other bbox
    void
    rotate(double angle)
    Rotates bbox

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • origin_x

      public double origin_x
      X coordinate of the origin of the bounding box
    • origin_y

      public double origin_y
      Y coordinate of the origin of the bounding box
    • size_x

      public double size_x
      X size of the bounding box
    • size_y

      public double size_y
      Y size of the bounding box
  • Constructor Details

    • GLMapBBox

      public GLMapBBox()
      Default constructor. Initialize empty bounding box
    • GLMapBBox

      public GLMapBBox(double origin_x, double origin_y, double size_x, double size_y)
      Initialize bbox with given data
      Parameters:
      origin_x - X coordinate of the origin of the bounding box
      origin_y - Y coordinate of the origin of the bounding box
      size_x - X size of the bounding box
      size_y - Y size of the bounding box
    • GLMapBBox

      public GLMapBBox(@NonNull GLMapBBox bbox)
      Copy constructor
      Parameters:
      bbox - bbox to copy
  • Method Details

    • clear

      public void clear()
      Reset bbox to empty
    • assign

      public void assign(double origin_x, double origin_y, double size_x, double size_y)
      Initialize bbox with data
      Parameters:
      origin_x - X coordinate of the origin of the bounding box
      origin_y - Y coordinate of the origin of the bounding box
      size_x - X size of the bounding box
      size_y - Y size of the bounding box
    • center

      @NonNull public MapPoint center()
      Center of bbox
      Returns:
      center of bbox
    • addBBox

      public void addBBox(@Nullable GLMapBBox bbox)
      Join this bbox with given
      Parameters:
      bbox - bbox to add
    • addPoint

      public void addPoint(double x, double y)
      Add point to bbox
      Parameters:
      x - x coordinate of point
      y - y coordinate of point
    • addPoint

      public void addPoint(@NonNull MapPoint pt)
      Add point to bbox
      Parameters:
      pt - point to add
    • equals

      public boolean equals(Object other)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • rotate

      public void rotate(double angle)
      Rotates bbox
      Parameters:
      angle - angle to rotate
    • intersects

      public boolean intersects(@NonNull GLMapBBox b)
      Checks if bbox intersects with other bbox
      Parameters:
      b - other bbox
      Returns:
      true if intersects
    • distance

      public double distance(@NonNull MapPoint pt)
      Returns distance from bbox to point
      Parameters:
      pt - point
      Returns:
      distance to point