public class RectangleImpl extends BaseShape<SpatialContext> implements Rectangle
| Constructor and Description |
|---|
RectangleImpl(double minX,
double maxX,
double minY,
double maxY,
SpatialContext ctx)
A simple constructor without normalization / validation.
|
RectangleImpl(Point lowerLeft,
Point upperRight,
SpatialContext ctx)
A convenience constructor which pulls out the coordinates.
|
RectangleImpl(Rectangle r,
SpatialContext ctx)
Copy constructor.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object obj)
The sub-classes of Shape generally implement the
same contract for
Object.equals(Object) and Object.hashCode()
amongst the same sub-interface type. |
static boolean |
equals(Rectangle thiz,
Object o)
All
Rectangle implementations should use this definition of Object.equals(Object). |
double |
getArea(SpatialContext ctx)
Calculates the area of the shape, in square-degrees.
|
Rectangle |
getBoundingBox()
Get the bounding box for this Shape.
|
Rectangle |
getBuffered(double distance,
SpatialContext ctx)
Returns a buffered version of this shape.
|
Point |
getCenter()
Returns the center point of this shape.
|
boolean |
getCrossesDateLine()
Only meaningful for geospatial contexts.
|
double |
getHeight()
The height.
|
double |
getMaxX()
The right edge of the X coordinate.
|
double |
getMaxY()
The top edge of the Y coordinate.
|
double |
getMinX()
The left edge of the X coordinate.
|
double |
getMinY()
The bottom edge of the Y coordinate.
|
double |
getWidth()
The width.
|
boolean |
hasArea()
Does the shape have area? This will be false for points and lines.
|
int |
hashCode() |
static int |
hashCode(Rectangle thiz)
All
Rectangle implementations should use this definition of Object.hashCode(). |
boolean |
isEmpty()
Shapes can be "empty", which is to say it exists nowhere.
|
SpatialRelation |
relate(Point point) |
SpatialRelation |
relate(Rectangle rect) |
SpatialRelation |
relate(Shape other)
Describe the relationship between the two objects.
|
SpatialRelation |
relateXRange(double ext_minX,
double ext_maxX)
A specialization of
Shape.relate(Shape)
for a horizontal line. |
SpatialRelation |
relateYRange(double ext_minY,
double ext_maxY)
A specialization of
Shape.relate(Shape)
for a vertical line. |
void |
reset(double minX,
double maxX,
double minY,
double maxY)
Expert: Resets the state of this shape given the arguments.
|
String |
toString() |
getContextclone, finalize, getClass, notify, notifyAll, wait, wait, waitgetContextpublic RectangleImpl(double minX,
double maxX,
double minY,
double maxY,
SpatialContext ctx)
public RectangleImpl(Point lowerLeft, Point upperRight, SpatialContext ctx)
public RectangleImpl(Rectangle r, SpatialContext ctx)
public void reset(double minX,
double maxX,
double minY,
double maxY)
Rectanglepublic boolean isEmpty()
Shapepublic Rectangle getBuffered(double distance, SpatialContext ctx)
ShapegetBuffered in interface Shapepublic boolean hasArea()
Shapepublic double getArea(SpatialContext ctx)
Shapepublic boolean getCrossesDateLine()
RectanglegetCrossesDateLine in interface Rectanglepublic double getHeight()
Rectanglepublic double getWidth()
Rectanglepublic double getMaxX()
Rectanglepublic double getMaxY()
Rectanglepublic double getMinX()
Rectanglepublic double getMinY()
Rectanglepublic Rectangle getBoundingBox()
Shape
Postcondition: this.getBoundingBox().relate(this) == CONTAINS
getBoundingBox in interface Shapepublic SpatialRelation relate(Shape other)
ShapeIf the shapes are equal then the result is CONTAINS (preferred) or WITHIN.
public SpatialRelation relate(Point point)
public SpatialRelation relate(Rectangle rect)
public SpatialRelation relateYRange(double ext_minY, double ext_maxY)
RectangleShape.relate(Shape)
for a vertical line.relateYRange in interface Rectanglepublic SpatialRelation relateXRange(double ext_minX, double ext_maxX)
RectangleShape.relate(Shape)
for a horizontal line.relateXRange in interface Rectanglepublic Point getCenter()
ShapegetBoundingBox().getCenter() but it doesn't have to be.
Postcondition: this.relate(this.getCenter()) == CONTAINS
public boolean equals(Object obj)
ShapeObject.equals(Object) and Object.hashCode()
amongst the same sub-interface type. This means, for example, that multiple
Point implementations of different classes are equal if they share the same x
& y.public static boolean equals(Rectangle thiz, Object o)
Rectangle implementations should use this definition of Object.equals(Object).public static int hashCode(Rectangle thiz)
Rectangle implementations should use this definition of Object.hashCode().Copyright © 2025 LocationTech. All rights reserved.