public abstract class Rectangle extends DefaultGeometry implements Surface
| Modifier and Type | Class and Description |
|---|---|
static class |
Rectangle.Double |
static class |
Rectangle.Float |
| Modifier and Type | Field and Description |
|---|---|
protected Point |
coord |
GEOMETRY_ANNOTATION, GEOMETRY_COMPLEX, GEOMETRY_ELLIPSE, GEOMETRY_LINE, GEOMETRY_LINEAR_RING, GEOMETRY_LINESTRING, GEOMETRY_MULTI_ANNOTATION, GEOMETRY_MULTI_LINESTRING, GEOMETRY_MULTI_POINT, GEOMETRY_MULTI_POLYGON, GEOMETRY_POINT, GEOMETRY_POLYGON, GEOMETRY_RECTANGLE| Modifier | Constructor and Description |
|---|---|
protected |
Rectangle() |
| Modifier and Type | Method and Description |
|---|---|
Rectangle |
add(Rectangle rect)
Modifies this rectangle so that it is equal to the sum of the two
rectangles.
|
static Rectangle |
add(Rectangle r1,
Rectangle r2)
Adds the second rectangle to the first rectangle specified.
|
double |
area()
Computes and returns the surface area.
|
java.lang.String |
asText()
Returns this geometry encoded using the Well-Known Text (WKT) standard.
|
Geometry |
boundary()
Returns the boundary of this geometry as a line string.
|
Point |
centroid()
Returns the centroid of the current surface.
|
abstract Rectangle |
clone()
Clones this geometry.
|
boolean |
contains(double x,
double y)
Deprecated.
|
boolean |
contains(double x,
double y,
double tolerance) |
boolean |
contains(Point coord)
Deprecated.
|
boolean |
contains(Point coord,
PrecisionModel precisionModel) |
static Rectangle |
createBigRectangle() |
void |
createBounds()
Updates the geometry bounds from the current geometry.
|
boolean |
equals(java.lang.Object o) |
Rectangle |
getBounds()
Returns the minimum bounding rectangle of this geometry.
|
Point |
getCenteredPoint()
This method returns a point that is typically centered on the geometry.
|
Point |
getCoord() |
short |
getGeometryId()
Returns the geometry class id.
|
int |
getGeometryType()
Returns the geometry type for this geometry.
|
abstract double |
getHeight() |
abstract double |
getMaxX() |
abstract double |
getMaxY() |
abstract double |
getMinX() |
abstract double |
getMinY() |
abstract double |
getWidth() |
Rectangle |
inflate(double factor) |
static Geometry |
intersection(Geometry geo,
Rectangle rect)
Deprecated.
|
static Geometry |
intersection(Geometry geo,
Rectangle rect,
PrecisionModel precisionModel) |
Rectangle |
intersection(Rectangle rect) |
static boolean |
intersects(LineString l,
Rectangle rect,
PrecisionModel precisionModel)
fast intersects test (faster than the one for geometries in general)
|
static boolean |
intersects(Point p,
Rectangle rect)
Deprecated.
|
static boolean |
intersects(Point p,
Rectangle rect,
PrecisionModel precisionModel)
fast intersects test (faster than the one for geometries in general)
|
static boolean |
intersects(Polygon poly,
Rectangle rect,
PrecisionModel precisionModel)
fast intersects test (faster than the one for geometries in general)
|
boolean |
intersects(Rectangle rect)
Deprecated.
|
static boolean |
intersects(Rectangle rect,
double x,
double y,
double width,
double height)
Deprecated.
|
static boolean |
intersects(Rectangle rect,
double x,
double y,
double width,
double height,
PrecisionModel precisionModel) |
boolean |
intersects(Rectangle rect,
PrecisionModel precisionModel) |
double |
length()
Returns the geometry length.
|
Point |
pointOnSurface()
Returns a point that is located in the interior of this surface geometry.
|
Point[] |
serialize()
Returns this geometry as an array of Point.
|
void |
setBounds(Rectangle rect)
Sets the new bounds of this rectangle.
|
void |
setCoord(double x,
double y) |
void |
setCoord(Point coord) |
abstract void |
setHeight(double height) |
abstract void |
setWidth(double width) |
boolean |
spatiallyEquals(Geometry geometry,
PrecisionModel precisionModel)
Tests if this geometry is equal to the argument, on a topological point of view.
|
java.awt.Rectangle |
toAwtRectangle() |
Polygon |
toPolygon() |
Polygon |
toPolygon(double maxNodeDistance)
Creates a polygon from the rectangle, inserting nodes along the sides of
the rectangle so that the maximum distance between 2 nodes is less than the
specified distance.
|
Geometry |
transform(Transformation tr)
Creates a clone of the current rectangle and returns the new instance
tranformed with the specified geometry transformation.
The returned geometry can be of any geometry types after the transformation. |
void |
translate(double dx,
double dy)
Translate this geometry with the specified values.
|
static Rectangle |
translate(Rectangle rect,
double dx,
double dy)
Creates a clone of the specified rectangle et translates it by the
specified values.
|
spatiallyEqualsfinalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitsizeOf, spatiallyEquals, toStringprotected Point coord
public static Rectangle createBigRectangle()
public Point pointOnSurface()
SurfacepointOnSurface in interface Surfacepublic Point getCenteredPoint()
GeometrygetCenteredPoint in interface GeometryGeometry.getCenteredPoint()public abstract double getHeight()
public Point getCoord()
public abstract double getWidth()
public abstract void setHeight(double height)
height - public abstract Rectangle clone()
DefaultGeometryclone in interface Geometryclone in class DefaultGeometrypublic void setCoord(double x,
double y)
x - y - public void setCoord(Point coord)
coord - public abstract void setWidth(double width)
width - public abstract double getMinX()
public abstract double getMinY()
public abstract double getMaxX()
public abstract double getMaxY()
public void createBounds()
GeometrycreateBounds in interface Geometrypublic Rectangle getBounds()
Geometrypublic void setBounds(Rectangle rect)
rect - the new bounds to set.public double area()
Surfacepublic double length()
Geometrypublic Point centroid()
Surfacepublic Rectangle add(Rectangle rect)
rect - the rectangle to add@Deprecated public boolean intersects(Rectangle rect)
rect - public boolean intersects(Rectangle rect, PrecisionModel precisionModel)
@Deprecated public static boolean intersects(Rectangle rect, double x, double y, double width, double height)
rect - x - y - width - height - public static boolean intersects(Rectangle rect, double x, double y, double width, double height, PrecisionModel precisionModel)
public boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic boolean spatiallyEquals(Geometry geometry, PrecisionModel precisionModel)
GeometryspatiallyEquals in interface Geometrygeometry - the geometry to be tested.precisionModel - the precision model to use while comparing geometries.@Deprecated public boolean contains(Point coord)
contains(Point, PrecisionModel)coord - public boolean contains(Point coord, PrecisionModel precisionModel)
@Deprecated
public boolean contains(double x,
double y)
contains(double, double, double)x - y - public boolean contains(double x,
double y,
double tolerance)
public void translate(double dx,
double dy)
Geometrypublic Rectangle inflate(double factor)
public static Rectangle add(Rectangle r1, Rectangle r2)
r1 - the first rectangler2 - the second rectanglepublic static Rectangle translate(Rectangle rect, double dx, double dy)
rect - the rectangle to translate.dx - the value to add to the X coordinate.dy - the value to add to the Y coordinate.@Deprecated public static boolean intersects(Point p, Rectangle rect)
p - rect - precisionModel - public static boolean intersects(Point p, Rectangle rect, PrecisionModel precisionModel)
p - rect - precisionModel - public static boolean intersects(LineString l, Rectangle rect, PrecisionModel precisionModel)
l - rect - precisionModel - public static boolean intersects(Polygon poly, Rectangle rect, PrecisionModel precisionModel)
poly - rect - precisionModel - @Deprecated public static Geometry intersection(Geometry geo, Rectangle rect)
geo - rect - public static Geometry intersection(Geometry geo, Rectangle rect, PrecisionModel precisionModel)
public java.awt.Rectangle toAwtRectangle()
public short getGeometryId()
GeometrygetGeometryId in interface Geometrypublic int getGeometryType()
GeometrygetGeometryType in interface Geometryfor more details.public Geometry transform(Transformation tr)
public Polygon toPolygon()
public Polygon toPolygon(double maxNodeDistance)
maxNodeDistance - the maximum distance between 2 nodes of the polygonpublic Geometry boundary()
Geometrypublic Point[] serialize()
Geometrypublic java.lang.String asText()
DefaultGeometryasText in interface GeometryasText in class DefaultGeometry