Class BufferedLineString
- java.lang.Object
-
- org.locationtech.spatial4j.shape.BaseShape<SpatialContext>
-
- org.locationtech.spatial4j.shape.impl.BufferedLineString
-
- All Implemented Interfaces:
Shape
public class BufferedLineString extends BaseShape<SpatialContext>
A BufferedLineString is a collection ofBufferedLineshapes, 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 Summary
Constructors Constructor 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.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object o)The sub-classes of Shape generally implement the same contract forObject.equals(Object)andObject.hashCode()amongst the same sub-interface type.doublegetArea(SpatialContext ctx)Calculates the area of the shape, in square-degrees.RectanglegetBoundingBox()Get the bounding box for this Shape.doublegetBuf()ShapegetBuffered(double distance, SpatialContext ctx)Returns a buffered version of this shape.PointgetCenter()Returns the center point of this shape.List<Point>getPoints()ShapeCollection<BufferedLine>getSegments()booleanhasArea()Does the shape have area? This will be false for points and lines.inthashCode()booleanisEmpty()Shapes can be "empty", which is to say it exists nowhere.SpatialRelationrelate(Shape other)Describe the relationship between the two objects.StringtoString()-
Methods inherited from class org.locationtech.spatial4j.shape.BaseShape
getContext
-
-
-
-
Constructor Detail
-
BufferedLineString
public BufferedLineString(List<Point> points, double buf, SpatialContext ctx)
Needs at least 1 point, usually more than that. If just one then it's internally treated like 2 points.
-
BufferedLineString
public BufferedLineString(List<Point> points, double buf, boolean expandBufForLongitudeSkew, SpatialContext ctx)
- Parameters:
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.ctx-
-
-
Method Detail
-
isEmpty
public boolean isEmpty()
Description copied from interface:ShapeShapes can be "empty", which is to say it exists nowhere. The underlying coordinates are typically NaN.
-
getBuffered
public Shape getBuffered(double distance, SpatialContext ctx)
Description copied from interface:ShapeReturns a buffered version of this shape. The buffer is usually a rounded-corner buffer, although some shapes might buffer differently. This is an optional operation.- Returns:
- Not null, and the returned shape should contain the current shape.
-
getSegments
public ShapeCollection<BufferedLine> getSegments()
-
getBuf
public double getBuf()
-
getArea
public double getArea(SpatialContext ctx)
Description copied from interface:ShapeCalculates the area of the shape, in square-degrees. If ctx is null then simple Euclidean calculations will be used. This figure can be an estimate.
-
relate
public SpatialRelation relate(Shape other)
Description copied from interface:ShapeDescribe the relationship between the two objects. For example- this is WITHIN other
- this CONTAINS other
- this is DISJOINT other
- this INTERSECTS other
If the shapes are equal then the result is CONTAINS (preferred) or WITHIN.
-
hasArea
public boolean hasArea()
Description copied from interface:ShapeDoes the shape have area? This will be false for points and lines. It will also be false for shapes that normally have area but are constructed in a degenerate case as to not have area (e.g. a circle with 0 radius or rectangle with no height or no width).
-
getCenter
public Point getCenter()
Description copied from interface:ShapeReturns the center point of this shape. This is usually the same asgetBoundingBox().getCenter()but it doesn't have to be.Postcondition:
this.relate(this.getCenter()) == CONTAINS
-
getBoundingBox
public Rectangle getBoundingBox()
Description copied from interface:ShapeGet the bounding box for this Shape. This means the shape is within the bounding box and that it touches each side of the rectangle.Postcondition:
this.getBoundingBox().relate(this) == CONTAINS
-
equals
public boolean equals(Object o)
Description copied from interface:ShapeThe sub-classes of Shape generally implement the same contract forObject.equals(Object)andObject.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.
-
-