Package uk.ac.rdg.resc.edal.geometry
Class SimplePolygon
- java.lang.Object
-
- uk.ac.rdg.resc.edal.geometry.AbstractPolygon
-
- uk.ac.rdg.resc.edal.geometry.SimplePolygon
-
- All Implemented Interfaces:
Serializable
,Domain<HorizontalPosition>
,Polygon
public class SimplePolygon extends AbstractPolygon
Implementation of aPolygon
based on an ordered list of vertices- Author:
- Guy Griffiths
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description SimplePolygon(List<HorizontalPosition> vertices)
Construct a newSimplePolygon
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
contains(double x, double y)
This default implementation constructs aPath2D
consisting of the vertices of the polygon, and uses this to test for containment.org.opengis.referencing.crs.CoordinateReferenceSystem
getCoordinateReferenceSystem()
Returns the two-dimensional horizontal coordinate reference system to which thevertices
are referenced.List<HorizontalPosition>
getVertices()
Returns the list of vertices that define this polygon in the horizontal plane.String
toString()
-
Methods inherited from class uk.ac.rdg.resc.edal.geometry.AbstractPolygon
contains, equals, getBoundaryPath, getBoundingBox, hashCode
-
-
-
-
Constructor Detail
-
SimplePolygon
public SimplePolygon(List<HorizontalPosition> vertices)
Construct a newSimplePolygon
- Parameters:
vertices
- An ordered list of vertices. Must all be in the sameCoordinateReferenceSystem
-
-
Method Detail
-
contains
public boolean contains(double x, double y)
Description copied from class:AbstractPolygon
This default implementation constructs a
Path2D
consisting of the vertices of the polygon, and uses this to test for containment. Subclasses may be able to override with a more efficient method.- Overrides:
contains
in classAbstractPolygon
-
getCoordinateReferenceSystem
public org.opengis.referencing.crs.CoordinateReferenceSystem getCoordinateReferenceSystem()
Description copied from interface:Polygon
Returns the two-dimensional horizontal coordinate reference system to which thevertices
are referenced.- Returns:
- the two-dimensional horizontal coordinate reference system to which the vertices are referenced.
-
getVertices
public List<HorizontalPosition> getVertices()
Description copied from interface:Polygon
Returns the list of vertices that define this polygon in the horizontal plane. The coordinates of the vertices are defined in this object'scoordinate reference system
. TheHorizontalPosition
s must have the same CRS as this object. Points returned here are in clockwise order. The polygon is considered closed.- Returns:
- the list of vertices that define this polygon in the horizontal plane.
-
-