Class ProjectionBounds

java.lang.Object
org.openstreetmap.josm.data.ProjectionBounds

public class ProjectionBounds extends Object
This is a simple data class for "rectangular" areas of the world, given in east/north min/max values.
  • Field Details

    • minEast

      public double minEast
      The minimum east coordinate.
    • minNorth

      public double minNorth
      The minimum north coordinate.
    • maxEast

      public double maxEast
      The maximum east coordinate.
    • maxNorth

      public double maxNorth
      The minimum north coordinate.
  • Constructor Details

    • ProjectionBounds

      Construct bounds out of two points.
      Parameters:
      min - min east/north
      max - max east/north
    • ProjectionBounds

      Construct bounds out of a single point.
      Parameters:
      p - east/north
    • ProjectionBounds

      public ProjectionBounds(EastNorth center, double east, double north)
      Construct bounds out of a center point and east/north dimensions.
      Parameters:
      center - center east/north
      east - east dimension
      north - north dimension
    • ProjectionBounds

      public ProjectionBounds(double minEast, double minNorth, double maxEast, double maxNorth)
      Construct bounds out of two points.
      Parameters:
      minEast - min east
      minNorth - min north
      maxEast - max east
      maxNorth - max north
    • ProjectionBounds

      Construct uninitialized bounds.

      At least one call to extend(EastNorth) or extend(ProjectionBounds) is required immediately after construction to initialize the ProjectionBounds instance and make it valid.

      Uninitialized ProjectionBounds must not be passed to other methods or used in any way other than initializing it.

  • Method Details

    • extend

      public void extend(EastNorth e)
      Extends bounds to include point e.
      Parameters:
      e - east/north to include
    • extend

      public void extend(ProjectionBounds b)
      Extends bounds to include bounds b.
      Parameters:
      b - bounds to include
      Since:
      11774
    • getCenter

      public EastNorth getCenter()
      Returns the center east/north.
      Returns:
      the center east/north
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • intersects

      public boolean intersects(ProjectionBounds b)
      The two bounds intersect? Compared to java Shape.intersects, if does not use the interior but the closure. (">=" instead of ">")
      Parameters:
      b - projection bounds
      Returns:
      true if the two bounds intersect
    • contains

      public boolean contains(EastNorth en)
      Check, if a point is within the bounds.
      Parameters:
      en - the point
      Returns:
      true, if en is within the bounds
    • getMin

      public EastNorth getMin()
      Returns the min east/north.
      Returns:
      the min east/north
    • getMax

      public EastNorth getMax()
      Returns the max east/north.
      Returns:
      the max east/north
    • hasExtend

      public boolean hasExtend()
      Determines if the bounds area is not null
      Returns:
      true if the area is not null
    • getScale

      public double getScale(int width, int height)
      Computes the scale of this bounds with respect to the given width/height.
      Parameters:
      width - the width
      height - the height
      Returns:
      the computed scale
    • getDeltaNorth

      private double getDeltaNorth()
    • getDeltaEast

      private double getDeltaEast()