Enum ValidationRule

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<ValidationRule>

    public enum ValidationRule
    extends java.lang.Enum<ValidationRule>
    Indicates how JTS geometries (notably polygons but applies to other geometries too) are validated (if at all) and repaired (if at all). This setting usually only applies to ShapeReader.
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
      error
      Geometries will be explicitly validated on creation, possibly resulting in an exception: InvalidShapeException.
      none
      Geometries will not be validated (because it's kinda expensive to calculate).
      repairBuffer0
      Invalid polygons are repaired using the buffer(0) technique.
      repairConvexHull
      Invalid Geometries are repaired by taking the convex hull.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private ValidationRule()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static ValidationRule valueOf​(java.lang.String name)
      Returns the enum constant of this type with the specified name.
      static ValidationRule[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      • Methods inherited from class java.lang.Enum

        clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Enum Constant Detail

      • none

        public static final ValidationRule none
        Geometries will not be validated (because it's kinda expensive to calculate). You may or may not ultimately get an error at some point; results are undefined. However, note that coordinates will still be validated for falling within the world boundaries.
        See Also:
        Geometry.isValid()
      • repairConvexHull

        public static final ValidationRule repairConvexHull
        Invalid Geometries are repaired by taking the convex hull. The result will very likely be a larger shape that matches false-positives, but no false-negatives. See Geometry.convexHull().
      • repairBuffer0

        public static final ValidationRule repairBuffer0
        Invalid polygons are repaired using the buffer(0) technique. From the JTS FAQ:

        The buffer operation is fairly insensitive to topological invalidity, and the act of computing the buffer can often resolve minor issues such as self-intersecting rings. However, in some situations the computed result may not be what is desired (i.e. the buffer operation may be "confused" by certain topologies, and fail to produce a result which is close to the original. An example where this can happen is a "bow-tie: or "figure-8" polygon, with one very small lobe and one large one. Depending on the orientations of the lobes, the buffer(0) operation may keep the small lobe and discard the "valid" large lobe).

    • Constructor Detail

      • ValidationRule

        private ValidationRule()
    • Method Detail

      • values

        public static ValidationRule[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (ValidationRule c : ValidationRule.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static ValidationRule valueOf​(java.lang.String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.NullPointerException - if the argument is null