Package hec.map

Class WorldRect

java.lang.Object
hec.map.WorldRect
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
Flo2dCell

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)
    • WorldRect

      public WorldRect(Rectangle2D r)
  • Method Details

    • getRectangle2D

      public Rectangle2D.Double getRectangle2D()
    • 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 boolean init(String extents)
      init the coordinates to the given String. String should have the format w,n,e,s
      Parameters:
      extents -
      Returns:
      true if the WorldRect is now valid
    • 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 p, double radius)
    • 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. A Union function.
    • 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.
    • setInvalid

      public void setInvalid()
      set this WorldRect to be invalid
    • contains

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

      public boolean contains(WorldPt pt)
    • contains

      public boolean contains(double tolerance, WorldPt pt)
    • contains

      public boolean contains(WorldRect rect)
    • contains

      public boolean contains(WorldLine l)
      check if line is in rectangle
    • intersects

      public boolean intersects(WorldRect rc)
    • intersect

      public boolean intersect(WorldLineSeg l, WorldLineSeg lclipped)
      Determine which quadrant a point lies - for clipping quadrant code 13 23 33 ------ 12 | 22 | 32 ------ 11 21 31
    • 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
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • getCenterPoint

      public WorldPt getCenterPoint()
    • toString

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

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