org.geotools.validation.spatial
Class LineNoSelfOverlappingValidation

Object
  extended by DefaultFeatureValidation
      extended by 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.

Author:
bowens, Refractions Research, Inc., $Author: jive $ (last modification)

Field Summary
 
Fields inherited from interface Validation
ALL, PRIORITY_COMPLEX, PRIORITY_INVOLVED, PRIORITY_SIMPLE, PRIORITY_TRIVIAL
 
Constructor Summary
LineNoSelfOverlappingValidation()
          LineNoSelfOverlappingFeatureValidation constructor.
 
Method Summary
 int getPriority()
          Override getPriority.
 boolean validate(SimpleFeature feature, SimpleFeatureType type, ValidationResults results)
          Tests to see if a LineString overlaps itself.
 
Methods inherited from class DefaultFeatureValidation
getDefaultLineString, getDescription, getName, getTypeRef, getTypeRefs, setDescription, setName, setTypeRef
 
Methods inherited from class 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()

validate

public boolean validate(SimpleFeature feature,
                        SimpleFeatureType 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)


Copyright © 1996-2014 Geotools. All Rights Reserved.