public class CircleImpl extends BaseShape<SpatialContext> implements Circle
DistanceCalculator
which does all the work. This
implementation should work for both cartesian 2D and geodetic sphere
surfaces.Modifier and Type | Field and Description |
---|---|
protected Rectangle |
enclosingBox |
protected Point |
point |
protected double |
radiusDEG |
Constructor and Description |
---|
CircleImpl(Point p,
double radiusDEG,
SpatialContext ctx) |
Modifier and Type | Method and Description |
---|---|
boolean |
contains(double x,
double y) |
static boolean |
equals(Circle thiz,
Object o)
All
Circle implementations should use this definition of Object.equals(Object) . |
boolean |
equals(Object obj)
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()
Note that the bounding box might contain a minX that is > maxX, due to WGS84 anti-meridian.
|
Circle |
getBuffered(double distance,
SpatialContext ctx)
Returns a buffered version of this shape.
|
Point |
getCenter()
Returns the center point of this shape.
|
double |
getRadius()
The distance from the point's center to its edge, measured in the same
units as x & y (e.g.
|
protected double |
getXAxis()
The
X coordinate of where the circle axis intersect. |
protected double |
getYAxis()
The
Y coordinate of where the circle axis intersect. |
boolean |
hasArea()
Does the shape have area? This will be false for points and lines.
|
int |
hashCode() |
static int |
hashCode(Circle thiz)
All
Circle implementations should use this definition of Object.hashCode() . |
boolean |
isEmpty()
Shapes can be "empty", which is to say it exists nowhere.
|
SpatialRelation |
relate(Circle circle) |
SpatialRelation |
relate(Point point) |
SpatialRelation |
relate(Rectangle r) |
SpatialRelation |
relate(Shape other)
Describe the relationship between the two objects.
|
protected SpatialRelation |
relateRectanglePhase2(Rectangle r,
SpatialRelation bboxSect) |
void |
reset(double x,
double y,
double radiusDEG)
Expert: Resets the state of this shape given the arguments.
|
String |
toString() |
getContext
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getContext
protected final Point point
protected double radiusDEG
protected Rectangle enclosingBox
public CircleImpl(Point p, double radiusDEG, SpatialContext ctx)
public void reset(double x, double y, double radiusDEG)
Circle
public boolean isEmpty()
Shape
public Point getCenter()
Shape
getBoundingBox().getCenter()
but it doesn't have to be.
Postcondition: this.relate(this.getCenter()) == CONTAINS
public double getRadius()
Circle
public double getArea(SpatialContext ctx)
Shape
public Circle getBuffered(double distance, SpatialContext ctx)
Shape
getBuffered
in interface Shape
public boolean contains(double x, double y)
public boolean hasArea()
Shape
public Rectangle getBoundingBox()
getBoundingBox
in interface Shape
public SpatialRelation relate(Shape other)
Shape
If the shapes are equal then the result is CONTAINS (preferred) or WITHIN.
public SpatialRelation relate(Point point)
public SpatialRelation relate(Rectangle r)
protected SpatialRelation relateRectanglePhase2(Rectangle r, SpatialRelation bboxSect)
protected double getYAxis()
Y
coordinate of where the circle axis intersect.protected double getXAxis()
X
coordinate of where the circle axis intersect.public SpatialRelation relate(Circle circle)
public boolean equals(Object obj)
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 static boolean equals(Circle thiz, Object o)
Circle
implementations should use this definition of Object.equals(Object)
.public static int hashCode(Circle thiz)
Circle
implementations should use this definition of Object.hashCode()
.Copyright © 2020 LocationTech. All rights reserved.