Class Validator

java.lang.Object
com.vividsolutions.jump.qa.Validator

public class Validator extends Object
Performs basic JTS validation, and additional validation like checking polygon orientation.
  • Constructor Details

    • Validator

      public Validator()
  • Method Details

    • setCheckingBasicTopology

      public void setCheckingBasicTopology(boolean checkingBasicTopology)
      Sets whether basic JTS validation should be performed
      Parameters:
      checkingBasicTopology - whether basic JTS validation should be performed
    • setCheckingNoRepeatedConsecutivePoints

      public void setCheckingNoRepeatedConsecutivePoints(boolean checkingNoRepeatedConsecutivePoints)
      Sets whether consecutive points are not allowed to be the same
      Parameters:
      checkingNoRepeatedConsecutivePoints - whether consecutive points are not allowed to be the same
    • setCheckingNoHoles

      public void setCheckingNoHoles(boolean checkingNoHoles)
      Sets whether polygons are not allowed to have holes
      Parameters:
      checkingNoHoles - whether polygons are not allowed to have holes
    • setCheckingPolygonOrientation

      public void setCheckingPolygonOrientation(boolean checkingPolygonOrientation)
      Sets whether polygon orientation should be checked
      Parameters:
      checkingPolygonOrientation - whether to enforce the constraint that polygon shells should be oriented clockwise and holes should be oriented counterclockwise
    • setMinSegmentLength

      public void setMinSegmentLength(double minSegmentLength)
      Sets the segment length below which the minimum-segment-length check will raise a validation error.
      Parameters:
      minSegmentLength - the threshold used by the minimum-segment-length check
      See Also:
    • setMinAngle

      public void setMinAngle(double minAngle)
      Sets the angle below which the minimum-angle check will raise a validation error.
      Parameters:
      minAngle - the threshold used by the minimum-angle check, in degrees
      See Also:
    • setMinPolygonArea

      public void setMinPolygonArea(double minPolygonArea)
      Sets the area below which the minimum-polygon-area check will raise a validation error.
      Parameters:
      minPolygonArea - the threshould used by the minimum-polygon-area check
      See Also:
    • setCheckingGeometriesSimple

      public void setCheckingGeometriesSimple(boolean checkingGeometriesSimple)
      Sets whether to enforce the constraint that Geometries must be simple
      Parameters:
      checkingGeometriesSimple - whether to enforce the constraint that Geometries must be simple
      Since:
      OpenJUMP 1.6
    • setCheckingMinSegmentLength

      public void setCheckingMinSegmentLength(boolean checkingMinSegmentLength)
      Sets whether minimum segment length should be checked.
      Parameters:
      checkingMinSegmentLength - whether to enforce the constraint that segment length should be no less than the minimum
      See Also:
    • setCheckingMinAngle

      public void setCheckingMinAngle(boolean checkingMinAngle)
      Sets whether minimum angle should be checked.
      Parameters:
      checkingMinAngle - whether to enforce the constraint that angle should be no less than the minimum
      See Also:
    • setCheckingMinPolygonArea

      public void setCheckingMinPolygonArea(boolean checkingMinPolygonArea)
      Sets whether minimum polygon area should be checked.
      Parameters:
      checkingMinPolygonArea - whether to enforce the constraint that area should be no less than the minimum, for single polygons and polygon elements of GeometryCollections (including MultiPolygons)
      See Also:
    • setDisallowedGeometryClasses

      public void setDisallowedGeometryClasses(Collection<Class> disallowedGeometryClasses)
      Sets the Geometry classes that are not allowed in the dataset that will be validated.
      Parameters:
      disallowedGeometryClasses - Geometry classes (Polygon.class, for example) that are not allowed
    • validate

      public List validate(Collection features, TaskMonitor monitor)
      Checks a collection of features.
      Parameters:
      features - the Feature's to validate
      Returns:
      a List of ValidationErrors; if all features are valid, the list will be empty
    • addIfNotNull

      protected void addIfNotNull(Object item, Collection<Object> collection)
    • validate

      protected void validate(Feature feature, List<Object> validationErrors)
      Checks a feature.
      Parameters:
      feature - the Feature to validate
      validationErrors - a List of ValidationError's to add to if the feature is not valid
    • validateGeometryClass

      protected ValidationError validateGeometryClass(Feature feature)
    • validateBasicTopology

      protected ValidationError validateBasicTopology(Feature feature)
    • validateNoRepeatedConsecutivePoints

      protected ValidationError validateNoRepeatedConsecutivePoints(Feature feature)
    • validateGeometriesSimple

      protected ValidationError validateGeometriesSimple(Feature feature)
    • validatePolygonOrientation

      protected ValidationError validatePolygonOrientation(Feature feature)
    • validateNoHoles

      protected ValidationError validateNoHoles(Feature feature)
    • validateMinSegmentLength

      protected ValidationError validateMinSegmentLength(Feature feature)
    • validateMinAngle

      protected ValidationError validateMinAngle(Feature feature)
    • validateMinPolygonArea

      protected ValidationError validateMinPolygonArea(Feature feature)