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 aPolygonbased 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 booleancontains(double x, double y)This default implementation constructs aPath2Dconsisting of the vertices of the polygon, and uses this to test for containment.org.opengis.referencing.crs.CoordinateReferenceSystemgetCoordinateReferenceSystem()Returns the two-dimensional horizontal coordinate reference system to which theverticesare referenced.List<HorizontalPosition>getVertices()Returns the list of vertices that define this polygon in the horizontal plane.StringtoString()-
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:AbstractPolygonThis default implementation constructs a
Path2Dconsisting 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:
containsin classAbstractPolygon
-
getCoordinateReferenceSystem
public org.opengis.referencing.crs.CoordinateReferenceSystem getCoordinateReferenceSystem()
Description copied from interface:PolygonReturns the two-dimensional horizontal coordinate reference system to which theverticesare referenced.- Returns:
- the two-dimensional horizontal coordinate reference system to which the vertices are referenced.
-
getVertices
public List<HorizontalPosition> getVertices()
Description copied from interface:PolygonReturns 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. TheHorizontalPositions 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.
-
-