public class JtsGeometry extends BaseShape<JtsSpatialContext>
Geometry
(i.e. may be a polygon or basically anything).
JTS does a great deal of the hard work, but there is work here in handling
dateline (aka anti-meridian) wrap.Modifier and Type | Field and Description |
---|---|
protected PreparedGeometry |
preparedGeometry |
static String |
SYSPROP_ASSERT_VALIDATE
System property boolean that can disable auto validation in an assert.
|
protected boolean |
validated |
Constructor and Description |
---|
JtsGeometry(Geometry geom,
JtsSpatialContext ctx,
boolean dateline180Check,
boolean allowMultiOverlap) |
Modifier and Type | Method and Description |
---|---|
protected Rectangle |
computeGeoBBox(Geometry geoms)
Given
geoms which has already been checked for being in world
bounds, return the minimal longitude range of the bounding box. |
boolean |
equals(Object o)
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.
|
JtsGeometry |
getBuffered(double distance,
SpatialContext ctx)
Returns a buffered version of this shape.
|
JtsPoint |
getCenter()
Returns the center point of this shape.
|
Geometry |
getGeom() |
boolean |
hasArea()
Does the shape have area? This will be false for points and lines.
|
int |
hashCode() |
void |
index()
Adds an index to this class internally to compute spatial relations faster.
|
static SpatialRelation |
intersectionMatrixToSpatialRelation(IntersectionMatrix matrix) |
boolean |
isEmpty()
Shapes can be "empty", which is to say it exists nowhere.
|
SpatialRelation |
relate(Circle circle) |
protected SpatialRelation |
relate(Geometry oGeom) |
SpatialRelation |
relate(JtsGeometry jtsGeometry) |
SpatialRelation |
relate(Point pt) |
SpatialRelation |
relate(Rectangle rectangle) |
SpatialRelation |
relate(Shape other)
Describe the relationship between the two objects.
|
String |
toString() |
void |
validate()
Validates the shape, throwing a descriptive error if it isn't valid.
|
getContext
public static final String SYSPROP_ASSERT_VALIDATE
protected PreparedGeometry preparedGeometry
protected boolean validated
public JtsGeometry(Geometry geom, JtsSpatialContext ctx, boolean dateline180Check, boolean allowMultiOverlap)
public void validate() throws InvalidShapeException
InvalidShapeException
- with descriptive error if the shape isn't validpublic void index()
PreparedGeometry
. This
isn't done by default because it takes some time to do the optimization, and it uses more
memory. Calling this method isn't thread-safe so be careful when this is done. If it was
already indexed then nothing happens.public boolean isEmpty()
Shape
protected Rectangle computeGeoBBox(Geometry geoms)
geoms
which has already been checked for being in world
bounds, return the minimal longitude range of the bounding box.public JtsGeometry getBuffered(double distance, SpatialContext ctx)
Shape
public boolean hasArea()
Shape
public double getArea(SpatialContext ctx)
Shape
public Rectangle getBoundingBox()
Shape
Postcondition: this.getBoundingBox().relate(this) == CONTAINS
public JtsPoint getCenter()
Shape
getBoundingBox().getCenter()
but it doesn't have to be.
Postcondition: this.relate(this.getCenter()) == CONTAINS
public SpatialRelation relate(Shape other)
Shape
If the shapes are equal then the result is CONTAINS (preferred) or WITHIN.
public SpatialRelation relate(Point pt)
public SpatialRelation relate(Rectangle rectangle)
public SpatialRelation relate(Circle circle)
public SpatialRelation relate(JtsGeometry jtsGeometry)
protected SpatialRelation relate(Geometry oGeom)
public static SpatialRelation intersectionMatrixToSpatialRelation(IntersectionMatrix matrix)
public boolean equals(Object o)
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 Geometry getGeom()
Copyright © 2020 LocationTech. All rights reserved.