public class ProjectionRect
extends java.lang.Object
implements java.io.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 |
---|---|
void |
add(double newx,
double newy)
Adds a point, specified by the double precision arguments
newx and newy , to this
Rectangle2D . |
void |
add(ProjectionPoint pt)
Adds the
Point2D object pt to this
Rectangle2D . |
void |
add(ProjectionRect r)
Adds a
Rectangle2D object to this
Rectangle2D . |
boolean |
contains(ProjectionPoint point)
Returns
true if this bounding box contains point . |
boolean |
equals(java.lang.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() |
void |
setHeight(double h)
set Y height
|
void |
setRect(double x,
double y,
double w,
double h) |
void |
setRect(ProjectionRect r) |
void |
setWidth(double w)
set X width
|
void |
setX(double x)
set minimum X
|
void |
setY(double y)
set minimum Y
|
java.lang.String |
toString()
Get a String representation of this object.
|
java.lang.String |
toString2() |
public ProjectionRect()
public ProjectionRect(ProjectionPoint corner1, ProjectionPoint corner2)
corner1
- a corner.corner2
- the opposite corner.public ProjectionRect(ProjectionPoint minimum, double width, double height)
minimum
- lower left corner, ie the minumum x and ywidth
- x width.height
- y heightpublic ProjectionRect(ProjectionRect r)
r
- rectangle to copypublic 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 double getX()
public double getY()
public double getWidth()
public double getHeight()
public double getMinX()
Shape
in double
precision.Shape
.public double getMinY()
Shape
in double
precision.Shape
.public double getMaxX()
Shape
in double
precision.Shape
.public double getMaxY()
Shape
in double
precision.Shape
.public double getCenterX()
Shape
in double
precision.Shape
.public double getCenterY()
Shape
in double
precision.Shape
.public void add(ProjectionRect r)
Rectangle2D
object to this
Rectangle2D
. The resulting Rectangle2D
is the union of the two Rectangle2D
objects.r
- the Rectangle2D
to add to this
Rectangle2D
.public void add(double newx, double newy)
newx
and newy
, to this
Rectangle2D
. The resulting Rectangle2D
is the smallest Rectangle2D
that
contains both the original Rectangle2D
and the
specified point.
After adding a point, a call to contains
with the
added point as an argument does not necessarily return
true
. The contains
method does not
return true
for points on the right or bottom
edges of a rectangle. Therefore, if the added point falls on
the left or bottom edge of the enlarged rectangle,
contains
returns false
for that point.
newx
- the X coordinate of the new pointnewy
- the Y coordinate of the new pointpublic void add(ProjectionPoint pt)
Point2D
object pt
to this
Rectangle2D
.
The resulting Rectangle2D
is the smallest
Rectangle2D
that contains both the original
Rectangle2D
and the specified Point2D
.
After adding a point, a call to contains
with the
added point as an argument does not necessarily return
true
. The contains
method does not return true
for points on the right
or bottom edges of a rectangle. Therefore, if the added point falls
on the left or bottom edge of the enlarged rectangle,
contains
returns false
for that point.
pt
- the new Point2D
to add to this
Rectangle2D
.public boolean isEmpty()
public boolean intersects(ProjectionRect r)
public boolean intersects(double x, double y, double w, double h)
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 contains(ProjectionPoint point)
true
if this bounding box contains point
.point
- a point in projection coordinates.true
if this bounding box contains point
.public ProjectionPoint getLowerRightPoint()
public ProjectionPoint getUpperRightPoint()
public ProjectionPoint getLowerLeftPoint()
public ProjectionPoint getUpperLeftPoint()
public ProjectionPoint getMinPoint()
public ProjectionPoint getMaxPoint()
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toString2()
public void setX(double x)
x
- minimum xpublic void setY(double y)
y
- minimum ypublic void setWidth(double w)
w
- x widthpublic void setHeight(double h)
h
- Y heightpublic void setRect(ProjectionRect r)
public void setRect(double x, double y, double w, double h)
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object