Class OrientationTransformer


  • public class OrientationTransformer
    extends java.lang.Object
    Utilities to modify the ring orientation of polygonal geometries.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static Geometry transformCCW​(Geometry geometry)
      Transforms a geometry using the Right Hand Rule specifications defined in the latest GeoJSON specification.
      static LinearRing transformCCW​(LinearRing ring, boolean isExteriorRing)
      Transforms a polygon using the Right Hand Rule specifications defined in the latest GeoJSON specification.
      static Polygon transformCCW​(Polygon polygon)
      Transforms a polygon using the Right Hand Rule specifications defined in the latest GeoJSON specification.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • OrientationTransformer

        public OrientationTransformer()
    • Method Detail

      • transformCCW

        public static Geometry transformCCW​(Geometry geometry)
        Transforms a geometry using the Right Hand Rule specifications defined in the latest GeoJSON specification. See RFC-7946 Specification for more context.
        Parameters:
        geometry - to be transformed
        Returns:
        Geometry under the Right Hand Rule specifications
      • transformCCW

        public static Polygon transformCCW​(Polygon polygon)
        Transforms a polygon using the Right Hand Rule specifications defined in the latest GeoJSON specification. See RFC-7946 Specification for more context.
        Parameters:
        polygon - to be transformed
        Returns:
        Polygon under the Right Hand Rule specifications
      • transformCCW

        public static LinearRing transformCCW​(LinearRing ring,
                                              boolean isExteriorRing)
        Transforms a polygon using the Right Hand Rule specifications defined in the latest GeoJSON specification. A linear ring MUST follow the right-hand rule with respect to the area it bounds, i.e., exterior rings are counterclockwise, and holes are clockwise. See RFC 7946 Specification for more context.
        Parameters:
        ring - the LinearRing, a constraint specific to Polygons
        isExteriorRing - true if the LinearRing is the exterior polygon ring, the one that defines the boundary
        Returns:
        LinearRing under the Right Hand Rule specifications