|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.geom.RectangularShape
java.awt.geom.Rectangle2D
org.deegree_impl.model.resources.XRectangle2D
Serializable, high-performance double-precision rectangle. Instead of using
x
, y
, width
and height
,
this class store rectangle's coordinates into the following fields:
xmin
, xmax
, ymin
et ymax
. Methods likes
contains
and intersects
are faster, which make this
class more appropriate for using intensively inside a loop.
Nested Class Summary |
Nested classes inherited from class java.awt.geom.Rectangle2D |
java.awt.geom.Rectangle2D.Double, java.awt.geom.Rectangle2D.Float |
Field Summary | |
double |
xmax
Coordonnées x maximale du rectangle. |
double |
xmin
Coordonnées x minimale du rectangle. |
double |
ymax
Coordonnées y maximale du rectangle. |
double |
ymin
Coordonnées y minimale du rectangle. |
Fields inherited from class java.awt.geom.Rectangle2D |
OUT_BOTTOM, OUT_LEFT, OUT_RIGHT, OUT_TOP |
Constructor Summary | |
XRectangle2D()
Construit un rectangle par défaut. |
|
XRectangle2D(double x,
double y,
double width,
double height)
Construit un rectangle avec les coordonnées spécifiées. |
|
XRectangle2D(java.awt.geom.Rectangle2D rect)
Construit un rectangle avec une copie des coordonnées du rectangle spécifiée. |
Method Summary | |
void |
add(double x,
double y)
Adds a point, specified by the double precision arguments x and y , to this Rectangle2D .
|
void |
add(java.awt.geom.Rectangle2D rect)
Adds a Rectangle2D object to this Rectangle2D .
|
boolean |
contains(double x,
double y)
Tests if a specified coordinate is inside the boundary of this Rectangle2D . |
boolean |
contains(double x,
double y,
double width,
double height)
Tests if the interior of this Rectangle2D entirely
contains the specified set of rectangular coordinates. |
java.awt.geom.Rectangle2D |
createIntersection(java.awt.geom.Rectangle2D rect)
Returns a new Rectangle2D object representing the
intersection of this Rectangle2D with the specified
Rectangle2D . |
java.awt.geom.Rectangle2D |
createUnion(java.awt.geom.Rectangle2D rect)
Returns a new Rectangle2D object representing the
union of this Rectangle2D with the specified
Rectangle2D . |
double |
getCenterX()
Returns the X coordinate of the center of the rectangle. |
double |
getCenterY()
Returns the Y coordinate of the center of the rectangle. |
double |
getHeight()
Returns the height of the framing rectangle in double precision. |
double |
getMaxX()
Returns the largest X coordinate of the rectangle. |
double |
getMaxY()
Returns the largest Y coordinate of the rectangle. |
double |
getMinX()
Returns the smallest X coordinate of the rectangle. |
double |
getMinY()
Returns the smallest Y coordinate of the rectangle. |
double |
getWidth()
Returns the width of the framing rectangle in double precision. |
double |
getX()
Returns the X coordinate of the upper left corner of the framing rectangle in double precision. |
double |
getY()
Returns the Y coordinate of the upper left corner of the framing rectangle in double precision. |
boolean |
intersects(double x,
double y,
double width,
double height)
Tests if the interior of this Rectangle2D
intersects the interior of a specified set of rectangular
coordinates. |
boolean |
isEmpty()
Determines whether the RectangularShape is empty.
|
int |
outcode(double x,
double y)
Determines where the specified coordinates lie with respect to this Rectangle2D .
|
void |
setRect(double x,
double y,
double width,
double height)
Sets the location and size of this Rectangle2D
to the specified double values. |
void |
setRect(java.awt.geom.Rectangle2D r)
Sets this Rectangle2D to be the same as the
specified Rectangle2D . |
java.lang.String |
toString()
Returns the String representation of this Rectangle2D . |
Methods inherited from class java.awt.geom.Rectangle2D |
add, equals, getBounds2D, getPathIterator, getPathIterator, hashCode, intersect, intersectsLine, intersectsLine, outcode, setFrame, union |
Methods inherited from class java.awt.geom.RectangularShape |
clone, contains, contains, getBounds, getFrame, intersects, setFrame, setFrame, setFrameFromCenter, setFrameFromCenter, setFrameFromDiagonal, setFrameFromDiagonal |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
public double xmin
public double ymin
public double xmax
public double ymax
Constructor Detail |
public XRectangle2D()
(0,0,0,0)
.
public XRectangle2D(double x, double y, double width, double height)
public XRectangle2D(java.awt.geom.Rectangle2D rect)
Method Detail |
public boolean isEmpty()
RectangularShape
is empty.
When the RectangularShape
is empty, it encloses no
area.
true
if the RectangularShape
is empty;
false
otherwise.public double getX()
double
precision.
public double getY()
double
precision.
public double getWidth()
double
precision.
public double getHeight()
double
precision.
public double getMinX()
public double getMinY()
public double getMaxX()
public double getMaxY()
public double getCenterX()
public double getCenterY()
public void setRect(double x, double y, double width, double height)
Rectangle2D
to the specified double values.
width
- the value to use to set the width of this Rectangle2D
height
- the value to use to set the height of this Rectangle2D
public void setRect(java.awt.geom.Rectangle2D r)
Rectangle2D
to be the same as the
specified Rectangle2D
.
r
- the specified Rectangle2D
public boolean contains(double x, double y)
Rectangle2D
.
contains
in interface java.awt.Shape
true
if the specified coordinates are
inside the boundary of this Rectangle2D
;
false
otherwise.public boolean intersects(double x, double y, double width, double height)
Rectangle2D
intersects the interior of a specified set of rectangular
coordinates.
intersects
in interface java.awt.Shape
width
- the width of the specified set of rectangular coordinatesheight
- the height of the specified set of rectangular coordinates
true
if this Rectangle2D
intersects the interior of a specified set of rectangular
coordinates; false
otherwise.public boolean contains(double x, double y, double width, double height)
Rectangle2D
entirely
contains the specified set of rectangular coordinates.
contains
in interface java.awt.Shape
width
- the width of the specified set of rectangular coordinatesheight
- the height of the specified set of rectangular coordinates
true
if this Rectangle2D
entirely contains specified set of rectangular
coordinates; false
otherwise.public int outcode(double x, double y)
Rectangle2D
.
This method computes a binary OR of the appropriate mask values
indicating, for each side of this Rectangle2D
,
whether or not the specified coordinates are on the same side
of the edge as the rest of this Rectangle2D
.
Rectangle2D.OUT_LEFT
,
Rectangle2D.OUT_TOP
,
Rectangle2D.OUT_RIGHT
,
Rectangle2D.OUT_BOTTOM
public java.awt.geom.Rectangle2D createIntersection(java.awt.geom.Rectangle2D rect)
Rectangle2D
object representing the
intersection of this Rectangle2D
with the specified
Rectangle2D
.
rect
- the Rectangle2D
to be intersected with this Rectangle2D
Rectangle2D
contained in both the specified
Rectangle2D
and in this Rectangle2D
.public java.awt.geom.Rectangle2D createUnion(java.awt.geom.Rectangle2D rect)
Rectangle2D
object representing the
union of this Rectangle2D
with the specified
Rectangle2D
.
rect
- the Rectangle2D
to be combined with
this Rectangle2D
Rectangle2D
containing both
the specified Rectangle2D
and this
Rectangle2D
.public void add(double x, double y)
x
and y
, 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.
public void add(java.awt.geom.Rectangle2D rect)
Rectangle2D
object to this Rectangle2D
.
The resulting Rectangle2D
is the union of the two
Rectangle2D
objects.
rect
- the Rectangle2D
to add to this Rectangle2D
.public java.lang.String toString()
String
representation of this Rectangle2D
.
String
representing this Rectangle2D
.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |