public class BufferedLine extends BaseShape<SpatialContext>
Constructor and Description |
---|
BufferedLine(Point pA,
Point pB,
double buf,
SpatialContext ctx)
Creates a buffered line from pA to pB.
|
Modifier and Type | Method and Description |
---|---|
boolean |
contains(Point p) |
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. |
static double |
expandBufForLongitudeSkew(Point pA,
Point pB,
double buf)
Calls
DistanceUtils.calcLonDegreesAtLat(double, double) given pA or pB's latitude;
whichever is farthest. |
Point |
getA() |
double |
getArea(SpatialContext ctx)
Calculates the area of the shape, in square-degrees.
|
Point |
getB() |
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.
|
InfBufLine |
getLinePerp()
INTERNAL
|
InfBufLine |
getLinePrimary()
INTERNAL
|
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(Rectangle r) |
SpatialRelation |
relate(Shape other)
Describe the relationship between the two objects.
|
String |
toString() |
getContext
public BufferedLine(Point pA, Point pB, double buf, SpatialContext ctx)
pA
- start pointpB
- end pointbuf
- the buffer distance in degreespublic boolean isEmpty()
Shape
public Shape getBuffered(double distance, SpatialContext ctx)
Shape
public static double expandBufForLongitudeSkew(Point pA, Point pB, double buf)
DistanceUtils.calcLonDegreesAtLat(double, double)
given pA or pB's latitude;
whichever is farthest. It's useful to expand a buffer of a line segment when used in
a geospatial context to cover the desired area.public SpatialRelation relate(Shape other)
Shape
If the shapes are equal then the result is CONTAINS (preferred) or WITHIN.
public SpatialRelation relate(Rectangle r)
public boolean contains(Point p)
public Rectangle getBoundingBox()
Shape
Postcondition: this.getBoundingBox().relate(this) == CONTAINS
public boolean hasArea()
Shape
public double getArea(SpatialContext ctx)
Shape
public Point getCenter()
Shape
getBoundingBox().getCenter()
but it doesn't have to be.
Postcondition: this.relate(this.getCenter()) == CONTAINS
public Point getA()
public Point getB()
public double getBuf()
public InfBufLine getLinePrimary()
public InfBufLine getLinePerp()
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.