Package hec.map
Class WorldRect
java.lang.Object
hec.map.WorldRect
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
Flo2dCell
Represents rectangles in world coordinate space.
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondoublearea()Gets the area of the rectangle.booleancontains(double pte, double ptn) booleanbooleancheck if line is in rectanglebooleanbooleanvoidCopies the coordinates of the given rectangle.booleanreturns a new WorldRect that represents the intersection of this rect and the given rect.voidIncreases the size of the rectangle to include the given point.voidIncreases the size of the rectangle to include the given rectangle.voidDeprecated.voidDeprecated.doubleheight()Gets the height of the rectangle.voidinit(double pw, double pn, double pe, double ps) Sets corners of the rectangle equal to the given points.voidSets all corners of the rectangle the the given point.voidvoidSets corners of the rectangle equal to the given points.voidSets corners of the rectangle equal to the given rectangle.booleaninit the coordinates to the given String.voidDeprecated.booleanintersect(WorldLineSeg l, WorldLineSeg lclipped) Determine which quadrant a point lies - for clipping quadrant code 13 23 33 ------ 12 | 22 | 32 ------ 11 21 31booleanintersects(WorldRect rc) booleanisValid()Rectangle is valid if all corners are valid doubles and area is not zero.voidjustify()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()voidvoidset this WorldRect to be invalidtoString()doublewidth()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
-
WorldRect
-
-
Method Details
-
getRectangle2D
-
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
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
-
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. A Union function. -
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. -
setInvalid
public void setInvalid()set this WorldRect to be invalid -
contains
public boolean contains(double pte, double ptn) -
contains
-
contains
-
contains
-
contains
check if line is in rectangle -
intersects
-
intersect
Determine which quadrant a point lies - for clipping quadrant code 13 23 33 ------ 12 | 22 | 32 ------ 11 21 31 -
getIntersection
returns a new WorldRect that represents the intersection of this rect and the given rect. if the intersection is null, null is returned -
equals
-
getCenterPoint
-
toString
-
paramString
a more human readable form of toString()- Returns:
-