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() |
getContext
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getContext
public 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)
Rectangle
public boolean isEmpty()
Shape
public Rectangle getBuffered(double distance, SpatialContext ctx)
Shape
getBuffered
in interface Shape
public boolean hasArea()
Shape
public double getArea(SpatialContext ctx)
Shape
public boolean getCrossesDateLine()
Rectangle
getCrossesDateLine
in interface Rectangle
public double getHeight()
Rectangle
public double getWidth()
Rectangle
public double getMaxX()
Rectangle
public double getMaxY()
Rectangle
public double getMinX()
Rectangle
public double getMinY()
Rectangle
public Rectangle getBoundingBox()
Shape
Postcondition: this.getBoundingBox().relate(this) == CONTAINS
getBoundingBox
in interface Shape
public SpatialRelation relate(Shape other)
Shape
If 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)
Rectangle
Shape.relate(Shape)
for a vertical line.relateYRange
in interface Rectangle
public SpatialRelation relateXRange(double ext_minX, double ext_maxX)
Rectangle
Shape.relate(Shape)
for a horizontal line.relateXRange
in interface Rectangle
public Point getCenter()
Shape
getBoundingBox().getCenter()
but it doesn't have to be.
Postcondition: this.relate(this.getCenter()) == CONTAINS
public boolean equals(Object obj)
Shape
Object.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 © 2020 LocationTech. All rights reserved.