public class BufferedLineString extends BaseShape<SpatialContext>
BufferedLine
shapes,
resulting in what some call a "Track" or "Polyline" (ESRI terminology).
The buffer can be 0. Note that BufferedLine isn't yet aware of geodesics (e.g. the anti-meridian).Constructor and Description |
---|
BufferedLineString(List<Point> points,
double buf,
boolean expandBufForLongitudeSkew,
SpatialContext ctx) |
BufferedLineString(List<Point> points,
double buf,
SpatialContext ctx)
Needs at least 1 point, usually more than that.
|
Modifier and Type | Method and Description |
---|---|
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.
|
double |
getBuf() |
Shape |
getBuffered(double distance,
SpatialContext ctx)
Returns a buffered version of this shape.
|
Point |
getCenter()
Returns the center point of this shape.
|
List<Point> |
getPoints() |
ShapeCollection<BufferedLine> |
getSegments() |
boolean |
hasArea()
Does the shape have area? This will be false for points and lines.
|
int |
hashCode() |
boolean |
isEmpty()
Shapes can be "empty", which is to say it exists nowhere.
|
SpatialRelation |
relate(Shape other)
Describe the relationship between the two objects.
|
String |
toString() |
getContext
public BufferedLineString(List<Point> points, double buf, SpatialContext ctx)
public BufferedLineString(List<Point> points, double buf, boolean expandBufForLongitudeSkew, SpatialContext ctx)
points
- ordered control points. If empty then this shape is empty.buf
- Buffer >= 0expandBufForLongitudeSkew
- See #expandBufForLongitudeSkew(org.locationtech.spatial4j.shape.Point,
org.locationtech.spatial4j.shape.Point, double)
.
If true then the buffer for each segment
is computed.public boolean isEmpty()
Shape
public Shape getBuffered(double distance, SpatialContext ctx)
Shape
public ShapeCollection<BufferedLine> getSegments()
public double getBuf()
public double getArea(SpatialContext ctx)
Shape
public SpatialRelation relate(Shape other)
Shape
If the shapes are equal then the result is CONTAINS (preferred) or WITHIN.
public boolean hasArea()
Shape
public Point getCenter()
Shape
getBoundingBox().getCenter()
but it doesn't have to be.
Postcondition: this.relate(this.getCenter()) == CONTAINS
public Rectangle getBoundingBox()
Shape
Postcondition: this.getBoundingBox().relate(this) == CONTAINS
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.Copyright © 2020 LocationTech. All rights reserved.