public class ProjectionRect extends Object implements Serializable
Constructor and Description |
---|
ProjectionRect()
default constructor, initialized to center (0,0) and width (10000, 10000)
|
ProjectionRect(double x1,
double y1,
double x2,
double y2)
construct a MapArea from any two opposite corner points
|
ProjectionRect(ProjectionPoint minimum,
double width,
double height)
Construct a ProjectionRect from any two opposite corner points.
|
ProjectionRect(ProjectionPoint corner1,
ProjectionPoint corner2)
Construct a ProjectionRect from any two opposite corner points.
|
ProjectionRect(ProjectionRect r)
Copy Constructor
|
Modifier and Type | Method and Description |
---|---|
boolean |
contains(ProjectionPoint point)
Returns
true if this bounding box contains point . |
boolean |
contains(ProjectionRect rect)
Returns
true if this bounding box contains rect . |
boolean |
equals(Object o) |
double |
getCenterX()
Returns the X coordinate of the center of the framing
rectangle of the
Shape in double
precision. |
double |
getCenterY()
Returns the Y coordinate of the center of the framing
rectangle of the
Shape in double
precision. |
double |
getHeight() |
ProjectionPoint |
getLowerLeftPoint()
Get the Lower Right Point (same as getMinPoint)
|
ProjectionPoint |
getLowerRightPoint()
Get the Lower Right Point
|
ProjectionPoint |
getMaxPoint()
Get the maximum corner of the bounding box.
|
double |
getMaxX()
Returns the largest X coordinate of the framing
rectangle of the
Shape in double
precision. |
double |
getMaxY()
Returns the largest Y coordinate of the framing
rectangle of the
Shape in double
precision. |
ProjectionPoint |
getMinPoint()
Get the minimum corner of the bounding box.
|
double |
getMinX()
Returns the smallest X coordinate of the framing
rectangle of the
Shape in double
precision. |
double |
getMinY()
Returns the smallest Y coordinate of the framing
rectangle of the
Shape in double
precision. |
ProjectionPoint |
getUpperLeftPoint()
Get the Upper Left Point
|
ProjectionPoint |
getUpperRightPoint()
Get the Upper Left Point (same as getMaxPoint)
|
double |
getWidth() |
double |
getX() |
double |
getY() |
int |
hashCode() |
static void |
intersect(ProjectionRect src1,
ProjectionRect src2,
ProjectionRect dest)
Intersects the pair of specified source
Rectangle2D
objects and puts the result into the specified destination
Rectangle2D object. |
boolean |
intersects(double x,
double y,
double w,
double h) |
boolean |
intersects(ProjectionRect r) |
boolean |
isEmpty() |
boolean |
nearlyEquals(ProjectionRect other)
Returns the result of
nearlyEquals(ProjectionRect, double) , with Misc.defaultMaxRelativeDiffFloat . |
boolean |
nearlyEquals(ProjectionRect other,
double maxRelDiff)
Returns
true if this rectangle is nearly equal to other . |
String |
toString()
Get a String representation of this object.
|
String |
toString2(int ndec) |
public ProjectionRect()
public ProjectionRect(double x1, double y1, double x2, double y2)
x1
- x coord of any corner of the bounding boxy1
- y coord of the same corner as x1x2
- x coord of opposite corner from x1,y1y2
- y coord of same corner as x2public ProjectionRect(ProjectionPoint minimum, double width, double height)
minimum
- lower left corner, ie the minimum x and ywidth
- x width.height
- y heightpublic ProjectionRect(ProjectionPoint corner1, ProjectionPoint corner2)
corner1
- a corner.corner2
- the opposite corner.public ProjectionRect(ProjectionRect r)
r
- rectangle to copypublic boolean contains(ProjectionPoint point)
true
if this bounding box contains point
.point
- a point in projection coordinates.true
if this bounding box contains point
.public boolean contains(ProjectionRect rect)
true
if this bounding box contains rect
.rect
- a bounding box in projection coordinatestrue
if this bounding box contains rect
.public double getCenterX()
Shape
in double
precision.Shape
.public double getCenterY()
Shape
in double
precision.Shape
.public double getHeight()
public ProjectionPoint getLowerLeftPoint()
public ProjectionPoint getLowerRightPoint()
public ProjectionPoint getMaxPoint()
public double getMaxX()
Shape
in double
precision.Shape
.public double getMaxY()
Shape
in double
precision.Shape
.public ProjectionPoint getMinPoint()
public double getMinX()
Shape
in double
precision.Shape
.public double getMinY()
Shape
in double
precision.Shape
.public ProjectionPoint getUpperLeftPoint()
public ProjectionPoint getUpperRightPoint()
public double getWidth()
public double getX()
public double getY()
public static void intersect(ProjectionRect src1, ProjectionRect src2, ProjectionRect dest)
Rectangle2D
objects and puts the result into the specified destination
Rectangle2D
object. One of the source rectangles
can also be the destination to avoid creating a third Rectangle2D
object, but in this case the original points of this source
rectangle will be overwritten by this method.src1
- the first of a pair of Rectangle2D
objects to be intersected with each othersrc2
- the second of a pair of Rectangle2D
objects to be intersected with each otherdest
- the Rectangle2D
that holds the
results of the intersection of src1
and
src2
public boolean intersects(double x, double y, double w, double h)
public boolean intersects(ProjectionRect r)
public boolean isEmpty()
public boolean nearlyEquals(ProjectionRect other)
nearlyEquals(ProjectionRect, double)
, with Misc.defaultMaxRelativeDiffFloat
.public boolean nearlyEquals(ProjectionRect other, double maxRelDiff)
true
if this rectangle is nearly equal to other
. The "near equality" of corners is
determined using ProjectionPoint.nearlyEquals(ProjectionPoint, double)
, with the specified maxRelDiff.other
- the other rectangle to check.maxRelDiff
- the maximum relative difference
that two corners may have.true
if this rectangle is nearly equal to other
.public String toString()
public String toString2(int ndec)