Class IsValidOp


  • public class IsValidOp
    extends java.lang.Object
    Implements the algorithms required to compute the isValid() method for Geometrys. See the documentation for the various geometry types for a specification of validity.
    Version:
    1.7
    • Constructor Detail

      • IsValidOp

        public IsValidOp​(Geometry inputGeometry)
        Creates a new validator for a geometry.
        Parameters:
        inputGeometry - the geometry to validate
    • Method Detail

      • isValid

        public static boolean isValid​(Geometry geom)
        Tests whether a Geometry is valid.
        Parameters:
        geom - the Geometry to test
        Returns:
        true if the geometry is valid
      • isValid

        public static boolean isValid​(Coordinate coord)
        Checks whether a coordinate is valid for processing. Coordinates are valid if their x and y ordinates are in the range of the floating point representation.
        Parameters:
        coord - the coordinate to validate
        Returns:
        true if the coordinate is valid
      • setSelfTouchingRingFormingHoleValid

        public void setSelfTouchingRingFormingHoleValid​(boolean isValid)
        Sets whether polygons using Self-Touching Rings to form holes are reported as valid. If this flag is set, the following Self-Touching conditions are treated as being valid:
        • inverted shell - the shell ring self-touches to create a hole touching the shell
        • exverted hole - a hole ring self-touches to create two holes touching at a point

        The default (following the OGC SFS standard) is that this condition is not valid (false).

        Self-Touching Rings which disconnect the the polygon interior are still considered to be invalid (these are invalid under the SFS, and many other spatial models as well). This includes:

        • exverted ("bow-tie") shells which self-touch at a single point
        • inverted shells with the inversion touching the shell at another point
        • exverted holes with exversion touching the hole at another point
        • inverted ("C-shaped") holes which self-touch at a single point causing an island to be formed
        • inverted shells or exverted holes which form part of a chain of touching rings (which disconnect the interior)
        Parameters:
        isValid - states whether geometry with this condition is valid
      • isValid

        public boolean isValid()
        Tests the validity of the input geometry.
        Returns:
        true if the geometry is valid
      • getValidationError

        public TopologyValidationError getValidationError()
        Computes the validity of the geometry, and if not valid returns the validation error for the geometry, or null if the geometry is valid.
        Returns:
        the validation error, if the geometry is invalid or null if the geometry is valid