org.geotools.validation.spatial
Class LineMustBeASinglePartValidation

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

public class LineMustBeASinglePartValidation
extends DefaultFeatureValidation

LineIsSingleSegmentFeatureValidation purpose.

Tests to see if a LineString is made of only one segment, meaning it only has two points. If the LineString has more than two points, the test fails.

This method has been extended to work with MultiLineStrings - this is the most common format that shapefile appears in and as such is forcing our hand.

Example Use:


 LineIsSingleSegmentFeatureValidation x = new LineIsSingleSegmentFeatureValidation("noSelfIntersectRoads", "Tests to see if a 
 geometry intersects itself", new String[] {"road"});
 

Version:
$Id: LineMustBeASinglePartValidation.java 17704 2006-01-23 00:26:16Z desruisseaux $
Author:
bowens, Refractions Research, Inc., $Author: jive $ (last modification)

Field Summary
 
Fields inherited from interface org.geotools.validation.Validation
ALL, PRIORITY_COMPLEX, PRIORITY_INVOLVED, PRIORITY_SIMPLE, PRIORITY_TRIVIAL
 
Constructor Summary
LineMustBeASinglePartValidation()
          LineIsSingleSegmentFeatureValidation constructor.
 
Method Summary
 int getPriority()
          Override getPriority.
 boolean validate(Feature feature, FeatureType type, ValidationResults results)
          Override validate.
 
Methods inherited from class org.geotools.validation.DefaultFeatureValidation
getDefaultLineString, 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

LineMustBeASinglePartValidation

public LineMustBeASinglePartValidation()
LineIsSingleSegmentFeatureValidation 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:
PRIORITY_SIMPLE
See Also:
Validation.getPriority()

validate

public boolean validate(Feature feature,
                        FeatureType type,
                        ValidationResults results)
Override validate.

Tests to see if a LineString is made of only one segment, meaning it only has two points. If the LineString has more than two points, the test fails.

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 is simple (one segment).
See Also:
org.geotools.validation.FeatureValidation#validate(org.geotools.feature.Feature, org.geotools.feature.FeatureTypeInfo, org.geotools.validation.ValidationResults)


Copyright © GeoTools. All Rights Reserved.