Package hec.map
Class LocalRect
java.lang.Object
hec.map.LocalRect
Represents rectangles in local coordinate space. A screen coordinate
convention is assumed where the y coordinate increases in the downward
direction.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintarea()Gets the area of the rectangle.booleancontains(int ptx, int pty) booleanbooleanvoidCopies the coordinates of the given rectangle.booleanreturns a new LocalRect that represents the intersection of this rect and the given rect.voidIncreases the size of the rectangle to include the given point.voidgrowToRect(LocalRect rc) Increases the size of the rectangle to include the given rectangle.intheight()Gets the height of the rectangle.voidinit(int rl, int rt, int rr, int rb) Sets corners of the rectangle to given values.voidSets all corners of the rectangle the given points.voidSets all corners of the rectangle the given rectangle.voidSets all corners of the rectangle the the given point.booleanintersects(LocalRect rc) booleanisValid()Rectangle is valid if all corners are valid ints 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.toString()intwidth()Gets the width of the rectangle.
-
Field Details
-
l
public int lleft coordinate -
t
public int ttop coordinate -
r
public int rright coordinate -
b
public int bbottom coordinate
-
-
Constructor Details
-
LocalRect
public LocalRect() -
LocalRect
public LocalRect(int rl, int rt, int rr, int rb) -
LocalRect
-
LocalRect
-
-
Method Details
-
equals
-
width
public int width()Gets the width of the rectangle.- Returns:
- returns r - l.
-
height
public int height()Gets the height of the rectangle.- Returns:
- returns b - t.
-
area
public int area()Gets the area of the rectangle.- Returns:
- returns width*height.
-
copy
Copies the coordinates of the given rectangle. -
init
public void init(int rl, int rt, int rr, int rb) Sets corners of the rectangle to given values. -
init
Sets all corners of the rectangle the given points. -
init
Sets all corners of the rectangle the given rectangle. -
initToPoint
Sets all corners of the rectangle the the given point. -
growToPoint
Increases the size of the rectangle to include the given point. -
growToRect
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 ints and area is not zero. -
contains
public boolean contains(int ptx, int pty) -
contains
-
contains
-
intersects
-
getIntersection
returns a new LocalRect that represents the intersection of this rect and the given rect. if the intersection is null, null is returned -
toString
-