|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectus.zuercher.gpx2map.util.Rectangle
public class Rectangle
Rectangle represents a set of four Points that describe the
four corners of a rectangle.
| Field Summary | |
|---|---|
private Point |
lowerLeft
Lower left Point. |
private Point |
lowerRight
Lower right Point. |
private Point |
upperLeft
Upper left Point. |
private Point |
upperRight
Upper right Point. |
| Constructor Summary | |
|---|---|
Rectangle(int x1,
int y1,
int x2,
int y2)
Constructs a new Rectangle from upper left and lower right coordinates. |
|
Rectangle(Point upperLeft,
Point lowerRight)
Constructs a new Rectangle from upper left and lower right coordinates. |
|
| Method Summary | |
|---|---|
int |
calculateArea()
Calculates the area of this rectangle in pixels. |
double |
calculateOverlap(Rectangle other)
Calculates the percentage overlap of this rectangle and another rectangle. |
boolean |
equals(Object other)
Tests whether this rectangle is identical to another. |
boolean |
equals(Rectangle other)
Tests whether this rectangle is identical to another. |
int |
getHeight()
Returns the rectangle's height. |
Point |
getLowerLeftPoint()
Returns the lower left corner, as a Point. |
Point |
getLowerRightPoint()
Returns the lower right corner, as a Point. |
Point |
getUpperLeftPoint()
Returns the upper left corner, as a Point. |
Point |
getUpperRightPoint()
Returns the upper right corner, as a Point. |
int |
getWidth()
Returns the rectangle's width. |
boolean |
overlaps(Rectangle other)
Tests whether this rectangle overlaps another rectangle. |
boolean |
within(Dimension bounds)
Tests whether this rectangle is entirely contained within the given Dimension. |
boolean |
within(Rectangle bounds)
Tests whether this rectangle is entire contained within the given Rectangle |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private final Point upperLeft
Point.
private final Point upperRight
Point.
private final Point lowerRight
Point.
private final Point lowerLeft
Point.
| Constructor Detail |
|---|
public Rectangle(int x1,
int y1,
int x2,
int y2)
x1 - upper left X coordinatey1 - upper left Y coordinatex2 - lower right X coordinatey2 - lower right Y coordinate
public Rectangle(Point upperLeft,
Point lowerRight)
upperLeft - upper left coordinatelowerRight - lower right coordinate| Method Detail |
|---|
public Point getUpperLeftPoint()
Point.
Point.public Point getUpperRightPoint()
Point.
Point.public Point getLowerRightPoint()
Point.
Point.public Point getLowerLeftPoint()
Point.
Point.public int getWidth()
public int getHeight()
public boolean overlaps(Rectangle other)
other - another Rectangle
public int calculateArea()
public double calculateOverlap(Rectangle other)
this or other is larger.
other - another Rectangle
overlap at all, and
1.0 indicates the rectangles have same the area and location.public boolean within(Dimension bounds)
Dimension.
bounds - the dimension to test against
public boolean within(Rectangle bounds)
bounds - the rectangle to test against
public boolean equals(Rectangle other)
other - the other Rectangle
public boolean equals(Object other)
equals in class Objectother - the other Rectangle
ClassCastException - if other is not a
Rectangle.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||