Class CircleImpl
java.lang.Object
org.locationtech.spatial4j.shape.BaseShape<SpatialContext>
org.locationtech.spatial4j.shape.impl.CircleImpl
- Direct Known Subclasses:
GeoCircle
A circle, also known as a point-radius, based on a
DistanceCalculator which does all the work. This
implementation should work for both cartesian 2D and geodetic sphere
surfaces.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancontains(double x, double y) booleanThe sub-classes of Shape generally implement the same contract forObject.equals(Object)andObject.hashCode()amongst the same sub-interface type.static booleanAllCircleimplementations should use this definition ofObject.equals(Object).doublegetArea(SpatialContext ctx) Calculates the area of the shape, in square-degrees.Note that the bounding box might contain a minX that is > maxX, due to WGS84 anti-meridian.getBuffered(double distance, SpatialContext ctx) Returns a buffered version of this shape.Returns the center point of this shape.doubleThe distance from the point's center to its edge, measured in the same units as x & y (e.g.protected doublegetXAxis()TheXcoordinate of where the circle axis intersect.protected doublegetYAxis()TheYcoordinate of where the circle axis intersect.booleanhasArea()Does the shape have area? This will be false for points and lines.inthashCode()static intAllCircleimplementations should use this definition ofObject.hashCode().booleanisEmpty()Shapes can be "empty", which is to say it exists nowhere.Describe the relationship between the two objects.protected SpatialRelationrelateRectanglePhase2(Rectangle r, SpatialRelation bboxSect) voidreset(double x, double y, double radiusDEG) Expert: Resets the state of this shape given the arguments.toString()Methods inherited from class BaseShape
getContextMethods inherited from interface Shape
getContext
-
Field Details
-
point
-
radiusDEG
protected double radiusDEG -
enclosingBox
-
-
Constructor Details
-
CircleImpl
-
-
Method Details
-
reset
public void reset(double x, double y, double radiusDEG) Description copied from interface:CircleExpert: Resets the state of this shape given the arguments. This is a performance feature to avoid excessive Shape object allocation as well as some argument error checking. Mutable shapes is error-prone so use with care. -
isEmpty
-
getCenter
-
getRadius
-
getArea
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. -
getBuffered
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.- Specified by:
getBufferedin interfaceShape- Returns:
- Not null, and the returned shape should contain the current shape.
-
contains
public boolean contains(double x, double y) -
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). -
getBoundingBox
Note that the bounding box might contain a minX that is > maxX, due to WGS84 anti-meridian.- Specified by:
getBoundingBoxin interfaceShape
-
relate
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.
-
relate
-
relate
-
relateRectanglePhase2
-
getYAxis
protected double getYAxis()TheYcoordinate of where the circle axis intersect. -
getXAxis
protected double getXAxis()TheXcoordinate of where the circle axis intersect. -
relate
-
toString
-
equals
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. -
equals
AllCircleimplementations should use this definition ofObject.equals(Object). -
hashCode
-
hashCode
AllCircleimplementations should use this definition ofObject.hashCode().
-