org.geotools.validation.spatial
Class LineNoSelfOverlappingValidation

java.lang.Object
  extended byorg.geotools.validation.DefaultFeatureValidation
      extended byorg.geotools.validation.spatial.LineNoSelfOverlappingValidation
All Implemented Interfaces:
FeatureValidation, Validation

public class LineNoSelfOverlappingValidation
extends DefaultFeatureValidation

Ensure the defaultGeometry does not overlap (only works for LineString).

Tests to see if a LineString overlaps itself. It does this by breaking up the LineString into two point segments then intersects them all. If a segment has both of its points on another segment, then they overlap. This is not true in all cases and this method has to be rewritten. If a segment spans two segments, this method will say that they do not overlap when clearly they do.


Field Summary
 
Fields inherited from interface org.geotools.validation.Validation
ALL, PRIORITY_COMPLEX, PRIORITY_INVOLVED, PRIORITY_SIMPLE, PRIORITY_TRIVIAL
 
Constructor Summary
LineNoSelfOverlappingValidation()
          LineNoSelfOverlappingFeatureValidation constructor.
 
Method Summary
 int getPriority()
          Override getPriority.
 java.lang.String[] getTypeNames()
          Implementation of getTypeNames.
 boolean validate(org.geotools.feature.Feature feature, org.geotools.feature.FeatureType type, ValidationResults results)
          Tests to see if a LineString overlaps itself.
 
Methods inherited from class org.geotools.validation.DefaultFeatureValidation
getDescription, getName, getTypeRef, getTypeRefs, setDescription, setName, setTypeRef
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LineNoSelfOverlappingValidation

public LineNoSelfOverlappingValidation()
LineNoSelfOverlappingFeatureValidation constructor.

Description

Method Detail

getPriority

public int getPriority()
Override getPriority.

Sets the priority level of this validation.

Specified by:
getPriority in interface Validation
Overrides:
getPriority in class DefaultFeatureValidation
Returns:
A made up priority for this validation.
See Also:
Validation.getPriority()

getTypeNames

public java.lang.String[] getTypeNames()
Implementation of getTypeNames.

Returns:
Array of typeNames, or empty array for all, null for disabled
See Also:
org.geotools.validation.Validation#getTypeNames()

validate

public boolean validate(org.geotools.feature.Feature feature,
                        org.geotools.feature.FeatureType type,
                        ValidationResults results)
Tests to see if a LineString overlaps itself.

It does this by breaking up the LineString into two point segments then intersects them all. If a segment has both of its points on another segment, then they overlap. This is not true in all cases and this method has to be rewritten. If a segment spans two segments, this method will say that they do not overlap when clearly they do.

Specified by:
validate in interface FeatureValidation
Overrides:
validate in class DefaultFeatureValidation
Parameters:
feature - The Feature to be validated
type - The FeatureTypeInfo of the feature
results - The storage for error messages.
Returns:
True if the feature does not overlap itself.
See Also:
org.geotools.validation.FeatureValidation#validate(org.geotools.feature.Feature, org.geotools.feature.FeatureTypeInfo, org.geotools.validation.ValidationResults)