Package com.treasure.hunt.jts.geom
Class Circle
- java.lang.Object
-
- org.locationtech.jts.geom.Coordinate
-
- com.treasure.hunt.jts.geom.Circle
-
- All Implemented Interfaces:
Shapeable,java.io.Serializable,java.lang.Cloneable,java.lang.Comparable<org.locationtech.jts.geom.Coordinate>
public class Circle extends org.locationtech.jts.geom.Coordinate implements Shapeable
Adding aPolygonbased Circle to theorg.locationtech.jtssuite.- See Also:
Geometry, Serialized Form
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancontains(Circle circle)Circlecopy()Override the coordinate copy.booleancovers(Circle circle)Test, whether the circle covers another circle.org.locationtech.jts.geom.CoordinategetCenter()Get central coordinate of circle.org.locationtech.jts.geom.EnvelopegetEnvelope()intgetNumPoints()doublegetRadius()booleaninside(org.locationtech.jts.geom.Coordinate c)Tests whether a coordinate lays inside the circle or not.org.locationtech.jts.geom.Coordinateproject(org.locationtech.jts.geom.Coordinate c)Project a coordinate on the edge of the circle.org.locationtech.jts.geom.PolygontoPolygon()Generate a polygon from the circle.java.awt.ShapetoShape(AdvancedShapeWriter advancedShapeWriter)Shape the circle as an awt ellipse.java.lang.StringtoString()Custom string serialization.
-
-
-
Constructor Detail
-
Circle
public Circle(org.locationtech.jts.geom.Coordinate coordinate, double radius, int numPoints)The constructor- Parameters:
coordinate- the center point of the circle.radius- the radius of the circle.numPoints- the number of points, the circle get after converting to aPolygon.
-
Circle
public Circle(org.locationtech.jts.geom.Coordinate coordinate, double radius)The constructor- Parameters:
coordinate- the center point of the circle.radius- the radius of the circle.
-
-
Method Detail
-
inside
public boolean inside(org.locationtech.jts.geom.Coordinate c)
Tests whether a coordinate lays inside the circle or not.- Parameters:
c- coordinate to test- Returns:
- whether a coordinate lays inside the circle or not
-
covers
public boolean covers(Circle circle)
Test, whether the circle covers another circle.- Parameters:
circle- circle that may be covered.- Returns:
- whether the circle covers another circle or not
-
project
public org.locationtech.jts.geom.Coordinate project(org.locationtech.jts.geom.Coordinate c)
Project a coordinate on the edge of the circle.- Parameters:
c- coordinate to project- Returns:
- projected coordinate, may be center if projected point is center
-
getCenter
public org.locationtech.jts.geom.Coordinate getCenter()
Get central coordinate of circle.- Returns:
- central coordinate
-
toPolygon
public org.locationtech.jts.geom.Polygon toPolygon()
Generate a polygon from the circle.- Returns:
- circular polygon
-
toShape
public java.awt.Shape toShape(AdvancedShapeWriter advancedShapeWriter)
Shape the circle as an awt ellipse.
-
toString
public java.lang.String toString()
Custom string serialization.- Overrides:
toStringin classorg.locationtech.jts.geom.Coordinate- Returns:
- string representation for circle
-
copy
public Circle copy()
Override the coordinate copy.- Overrides:
copyin classorg.locationtech.jts.geom.Coordinate- Returns:
- copied circle
-
getEnvelope
public org.locationtech.jts.geom.Envelope getEnvelope()
-
contains
public boolean contains(Circle circle)
-
getRadius
public double getRadius()
-
getNumPoints
public int getNumPoints()
-
-