Class PolygonBase<T extends Curve>

  • Type Parameters:
    T - type of the ring geometries
    All Implemented Interfaces:
    LineBasedGeometry, java.io.Serializable, java.lang.Iterable<T>
    Direct Known Subclasses:
    CurvePolygon, Polygon

    @NonNullByDefault
    public abstract class PolygonBase<T extends Curve>
    extends Geometry
    implements java.lang.Iterable<T>, LineBasedGeometry
    Base class for a polygon to allow similar handling of straight and circular polygons.
    Author:
    Sebastian Baumhekel
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected PolygonBase​(int type, java.lang.Class<U> clazzRing)
      Constructor for subclasses.
      protected PolygonBase​(int type, java.lang.Class<U> clazzRing, java.lang.Iterable<V> rings)
      Constructor for subclasses.
      protected PolygonBase​(int type, U lsOuterRing)
      Constructor for subclasses.
    • Constructor Detail

      • PolygonBase

        protected PolygonBase​(int type,
                              java.lang.Class<U> clazzRing)
        Constructor for subclasses.
        Parameters:
        clazzRing - class of the ring
        type - has to be given by all subclasses
      • PolygonBase

        protected PolygonBase​(int type,
                              java.lang.Class<U> clazzRing,
                              java.lang.Iterable<V> rings)
        Constructor for subclasses.
        Parameters:
        clazzRing - class of the ring
        type - has to be given by all subclasses
        rings - rings
      • PolygonBase

        protected PolygonBase​(int type,
                              U lsOuterRing)
        Constructor for subclasses.
        Parameters:
        type - has to be given by all subclasses
        lsOuterRing - outer ring
    • Method Detail

      • addRing

        public void addRing​(T ring)
        Adds a ring.
        Parameters:
        ring - ring
      • checkConsistency

        public boolean checkConsistency()
        Description copied from class: Geometry
        Do some internal consistency checks on the geometry. Currently, all Geometries must have a valid dimension (2 or 3) and a valid type. Composed geometries must have all equal SRID, dimensionality and measures, as well as that they do not contain NULL or inconsistent subgeometries. BinaryParser and WKTParser should only generate consistent geometries. BinaryWriter may produce invalid results on inconsistent geometries.
        Overrides:
        checkConsistency in class Geometry
        Returns:
        true if all checks are passed.
      • clearRings

        public void clearRings()
        Clears all rings.
      • equals

        public boolean equals​(@Nullable
                              java.lang.Object other)
        Description copied from class: Geometry
        java.lang.Object equals implementation
        Overrides:
        equals in class Geometry
        Parameters:
        other - geometry to compare
        Returns:
        true if equal, false otherwise
      • getCoordinates

        public java.lang.Iterable<Point> getCoordinates()
        Description copied from class: Geometry
        Gets the coordinates of this Geometry.
        Specified by:
        getCoordinates in class Geometry
        Returns:
        coordinates
      • getNumberOfCoordinates

        public int getNumberOfCoordinates()
        Description copied from class: Geometry
        Gets the number of coordinates of this Geometry.
        Specified by:
        getNumberOfCoordinates in class Geometry
        Returns:
        number of coordinates
      • getNumberOfRings

        public int getNumberOfRings()
        Gets the number of rings.
        Returns:
        number of rings.
      • getOuterRing

        public T getOuterRing()
        Gets the outer ring/boundary of the polygon.
        Returns:
        outer ring
      • getRings

        public java.lang.Iterable<T> getRings()
        Gets all inner rings.
        Returns:
        inner rings
      • hasMeasure

        public boolean hasMeasure()
        Description copied from class: Geometry
        Returns whether we have a measure (4th dimension)
        Specified by:
        hasMeasure in class Geometry
        Returns:
        true if the geometry has a measure, false otherwise
      • is3d

        public boolean is3d()
        Description copied from class: Geometry
        Checks if this Geometry is 3d.
        Specified by:
        is3d in class Geometry
        Returns:
        true on success, else false
      • isClockwise

        public boolean isClockwise()
        Checks if this polygon is oriented in clockwise direction. Is false for the outer polygon and true for its holes.
        Returns:
        true on success, else false
      • isClosed

        public boolean isClosed()
        Description copied from interface: LineBasedGeometry
        Checks if this line is closed, so the last coordinate is the same as the first coordinate.
        Specified by:
        isClosed in interface LineBasedGeometry
        Returns:
        true on success, else false
      • isEmpty

        public boolean isEmpty()
        Description copied from class: Geometry
        Ist this Geometry empty, so does it contain no coordinates or other geometries?
        Specified by:
        isEmpty in class Geometry
        Returns:
        true on success, else false
      • iterator

        public java.util.Iterator<T> iterator()
        Specified by:
        iterator in interface java.lang.Iterable<T extends Curve>
      • setOuterRing

        public void setOuterRing​(T ls)
        Sets the outer ring/boundary of the polygon.
        Parameters:
        ls - outer ring