Package hec.geometry

Class WorldRect

java.lang.Object
hec.geometry.WorldRect
All Implemented Interfaces:
Serializable

public class WorldRect extends Object implements Serializable
Represents rectangles in world coordinate space.
See Also:
  • Field Details

    • w

      public double w
      west (left) coordinate
    • n

      public double n
      north (top) coordinate
    • e

      public double e
      east (right) coordinate
    • s

      public double s
      south (bottom) coordinate
  • Constructor Details

    • WorldRect

      public WorldRect()
    • WorldRect

      public WorldRect(double rw, double rn, double re, double rs)
    • WorldRect

      public WorldRect(WorldPt nw, WorldPt se)
    • WorldRect

      public WorldRect(WorldPt p, double radius)
    • WorldRect

      public WorldRect(WorldRect r)
  • Method Details

    • set

      public void set(WorldRect r)
    • width

      public double width()
      Gets the width of the rectangle.
      Returns:
      returns e - w.
    • height

      public double height()
      Gets the height of the rectangle.
      Returns:
      returns n - s.
    • area

      public double area()
      Gets the area of the rectangle.
      Returns:
      returns width*height.
    • copy

      public void copy(WorldRect r)
      Copies the coordinates of the given rectangle.
    • init

      public void init(double pw, double pn, double pe, double ps)
      Sets corners of the rectangle equal to the given points.
    • init

      public void init(WorldPt nw, WorldPt se)
      Sets corners of the rectangle equal to the given points.
    • init

      public void init(WorldRect rc)
      Sets corners of the rectangle equal to the given rectangle.
    • init

      public void init(WorldPt p)
      Sets all corners of the rectangle the the given point.
    • initToPoint

      @Deprecated public void initToPoint(WorldPt p)
      Deprecated.
      Sets all corners of the rectangle the the given point.
    • grow

      public void grow(WorldPt p)
      Increases the size of the rectangle to include the given point.
    • growToPoint

      @Deprecated public void growToPoint(WorldPt p)
      Deprecated.
      Increases the size of the rectangle to include the given point.
    • grow

      public void grow(WorldRect r)
      Increases the size of the rectangle to include the given rectangle.
    • growToRect

      @Deprecated public void growToRect(WorldRect r)
      Deprecated.
      Increases the size of the rectangle to include the given rectangle.
    • justify

      public void justify()
      insures that the east coordinate is greater than the west, and that the north coordinate is greater than the south.
    • isValid

      public boolean isValid()
      Rectangle is valid if all corners are valid doubles and area is not zero.
    • contains

      public boolean contains(double pte, double ptn)
    • contains

      public boolean contains(WorldPt pt)
    • intersects

      public boolean intersects(WorldRect rc)
    • getIntersection

      public WorldRect getIntersection(WorldRect rc)
      returns a new WorldRect that represents the intersection of this rect and the given rect. if the intersection is null, null is returned
    • toString

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

      public String paramString()
      a more human readable form of toString()
      Returns: