com.vividsolutions.jump.qa
Class Validator

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

public class Validator
extends java.lang.Object

Performs basic JTS validation, and additional validation like checking polygon orientation.


Constructor Summary
Validator()
           
 
Method Summary
protected  void addIfNotNull(java.lang.Object item, java.util.Collection collection)
           
 void setCheckingBasicTopology(boolean checkingBasicTopology)
          Sets whether basic JTS validation should be performed
 void setCheckingLineStringsSimple(boolean checkingLineStringsSimple)
          Sets whether to enforce the constraint that LineStrings must be simple
 void setCheckingMinAngle(boolean checkingMinAngle)
          Sets whether minimum angle should be checked.
 void setCheckingMinPolygonArea(boolean checkingMinPolygonArea)
          Sets whether minimum polygon area should be checked.
 void setCheckingMinSegmentLength(boolean checkingMinSegmentLength)
          Sets whether minimum segment length should be checked.
 void setCheckingNoHoles(boolean checkingNoHoles)
          Sets whether polygons are not allowed to have holes
 void setCheckingNoRepeatedConsecutivePoints(boolean checkingNoRepeatedConsecutivePoints)
          Sets whether consecutive points are not allowed to be the same
 void setCheckingPolygonOrientation(boolean checkingPolygonOrientation)
          Sets whether polygon orientation should be checked
 void setDisallowedGeometryClasses(java.util.Collection disallowedGeometryClasses)
          Sets the Geometry classes that are not allowed in the dataset that will be validated.
 void setMinAngle(double minAngle)
          Sets the angle below which the minimum-angle check will raise a validation error.
 void setMinPolygonArea(double minPolygonArea)
          Sets the area below which the minimum-polygon-area check will raise a validation error.
 void setMinSegmentLength(double minSegmentLength)
          Sets the segment length below which the minimum-segment-length check will raise a validation error.
 java.util.List validate(java.util.Collection features, TaskMonitor monitor)
          Checks a collection of features.
protected  void validate(Feature feature, java.util.List validationErrors)
          Checks a feature.
protected  ValidationError validateBasicTopology(Feature feature)
           
protected  ValidationError validateGeometryClass(Feature feature)
           
protected  ValidationError validateLineStringsSimple(Feature feature)
           
protected  ValidationError validateMinAngle(Feature feature)
           
protected  ValidationError validateMinPolygonArea(Feature feature)
           
protected  ValidationError validateMinSegmentLength(Feature feature)
           
protected  ValidationError validateNoHoles(Feature feature)
           
protected  ValidationError validateNoRepeatedConsecutivePoints(Feature feature)
           
protected  ValidationError validatePolygonOrientation(Feature feature)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Validator

public Validator()
Method Detail

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:
setCheckingMinSegmentLength(boolean)

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:
setCheckingMinAngle(boolean)

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:
setCheckingMinPolygonArea(boolean)

setCheckingLineStringsSimple

public void setCheckingLineStringsSimple(boolean checkingLineStringsSimple)
Sets whether to enforce the constraint that LineStrings must be simple

Parameters:
checkingLineStringsSimple - whether to enforce the constraint that LineStrings must be simple

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:
setMinSegmentLength(double)

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:
setMinAngle(double)

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:
setMinPolygonArea(double)

setDisallowedGeometryClasses

public void setDisallowedGeometryClasses(java.util.Collection 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 java.util.List validate(java.util.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(java.lang.Object item,
                            java.util.Collection collection)

validate

protected void validate(Feature feature,
                        java.util.List 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)

validateLineStringsSimple

protected ValidationError validateLineStringsSimple(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)