public interface Shape
SpatialContext
or
by reading WKT which calls those methods; they should not be
created directly.
Shapes are generally immutable and thread-safe. If a particular shape has a
reset(...)
method then its use means the shape is actually
mutable. Mutating shape state is considered expert and should be done with care.
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object other)
The sub-classes of Shape generally implement the
same contract for
Object.equals(Object) and Object.hashCode()
amongst the same sub-interface type. |
double |
getArea(SpatialContext ctx)
Calculates the area of the shape, in square-degrees.
|
Rectangle |
getBoundingBox()
Get the bounding box for this Shape.
|
Shape |
getBuffered(double distance,
SpatialContext ctx)
Returns a buffered version of this shape.
|
Point |
getCenter()
Returns the center point of this shape.
|
SpatialContext |
getContext()
Get the SpatialContext that created the Shape
|
boolean |
hasArea()
Does the shape have area? This will be false for points and lines.
|
boolean |
isEmpty()
Shapes can be "empty", which is to say it exists nowhere.
|
SpatialRelation |
relate(Shape other)
Describe the relationship between the two objects.
|
SpatialRelation relate(Shape other)
If the shapes are equal then the result is CONTAINS (preferred) or WITHIN.
Rectangle getBoundingBox()
Postcondition: this.getBoundingBox().relate(this) == CONTAINS
boolean hasArea()
double getArea(SpatialContext ctx)
Point getCenter()
getBoundingBox().getCenter()
but it doesn't have to be.
Postcondition: this.relate(this.getCenter()) == CONTAINS
Shape getBuffered(double distance, SpatialContext ctx)
boolean isEmpty()
boolean equals(Object other)
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.SpatialContext getContext()
Copyright © 2020 LocationTech. All rights reserved.