Package uk.ac.rdg.resc.edal.geometry
Class AbstractPolygon
- java.lang.Object
-
- uk.ac.rdg.resc.edal.geometry.AbstractPolygon
-
- All Implemented Interfaces:
Serializable
,Domain<HorizontalPosition>
,Polygon
- Direct Known Subclasses:
BoundingBoxImpl
,SimplePolygon
public abstract class AbstractPolygon extends Object implements Polygon
Partial implementation of aPolygon
, providing default implementations of thecontains()
,hashCode()
andequals()
methods.- Author:
- Guy Griffiths, Jon Blower
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description AbstractPolygon()
-
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.boolean
contains(HorizontalPosition pos)
boolean
equals(Object obj)
protected Path2D
getBoundaryPath()
BoundingBox
getBoundingBox()
int
hashCode()
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface uk.ac.rdg.resc.edal.geometry.Polygon
getCoordinateReferenceSystem, getVertices
-
-
-
-
Method Detail
-
contains
public final boolean contains(HorizontalPosition pos)
- Specified by:
contains
in interfaceDomain<HorizontalPosition>
- Returns:
- true if the given position is contained within this domain.
-
contains
public boolean contains(double x, double y)
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.
-
getBoundaryPath
protected Path2D getBoundaryPath()
-
getBoundingBox
public BoundingBox getBoundingBox()
- Specified by:
getBoundingBox
in interfacePolygon
- Returns:
- The MBR of this
Polygon
-
-