Package hec.geometry
Class WorldRect
java.lang.Object
hec.geometry.WorldRect
- All Implemented Interfaces:
Serializable
Represents rectangles in world coordinate space.
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondouble
area()
Gets the area of the rectangle.boolean
contains
(double pte, double ptn) boolean
void
Copies the coordinates of the given rectangle.returns a new WorldRect that represents the intersection of this rect and the given rect.void
Increases the size of the rectangle to include the given point.void
Increases the size of the rectangle to include the given rectangle.void
Deprecated.void
Deprecated.double
height()
Gets the height of the rectangle.void
init
(double pw, double pn, double pe, double ps) Sets corners of the rectangle equal to the given points.void
Sets all corners of the rectangle the the given point.void
Sets corners of the rectangle equal to the given points.void
Sets corners of the rectangle equal to the given rectangle.void
Deprecated.boolean
intersects
(WorldRect rc) boolean
isValid()
Rectangle is valid if all corners are valid doubles and area is not zero.void
justify()
insures that the east coordinate is greater than the west, and that the north coordinate is greater than the south.a more human readable form of toString()void
toString()
double
width()
Gets the width of the rectangle.
-
Field Details
-
w
public double wwest (left) coordinate -
n
public double nnorth (top) coordinate -
e
public double eeast (right) coordinate -
s
public double ssouth (bottom) coordinate
-
-
Constructor Details
-
WorldRect
public WorldRect() -
WorldRect
public WorldRect(double rw, double rn, double re, double rs) -
WorldRect
-
WorldRect
-
WorldRect
-
-
Method Details
-
set
-
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
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
Sets corners of the rectangle equal to the given points. -
init
Sets corners of the rectangle equal to the given rectangle. -
init
Sets all corners of the rectangle the the given point. -
initToPoint
Deprecated.Sets all corners of the rectangle the the given point. -
grow
Increases the size of the rectangle to include the given point. -
growToPoint
Deprecated.Increases the size of the rectangle to include the given point. -
grow
Increases the size of the rectangle to include the given rectangle. -
growToRect
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
-
intersects
-
getIntersection
returns a new WorldRect that represents the intersection of this rect and the given rect. if the intersection is null, null is returned -
toString
-
paramString
a more human readable form of toString()- Returns:
-