public class LineMustBeASinglePartValidation extends DefaultFeatureValidation
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"});
ALL, PRIORITY_COMPLEX, PRIORITY_INVOLVED, PRIORITY_SIMPLE, PRIORITY_TRIVIAL| Constructor and Description |
|---|
LineMustBeASinglePartValidation()
LineIsSingleSegmentFeatureValidation constructor.
|
| Modifier and Type | Method and Description |
|---|---|
int |
getPriority()
Override getPriority.
|
boolean |
validate(SimpleFeature feature,
SimpleFeatureType type,
ValidationResults results)
Override validate.
|
getDefaultLineString, getDescription, getName, getTypeRef, getTypeRefs, setDescription, setName, setTypeRefpublic LineMustBeASinglePartValidation()
Description
public int getPriority()
Sets the priority level of this validation.
getPriority in interface ValidationgetPriority in class DefaultFeatureValidationPRIORITY_SIMPLEValidation.getPriority()public boolean validate(SimpleFeature feature, SimpleFeatureType type, ValidationResults results)
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.
validate in interface FeatureValidationvalidate in class DefaultFeatureValidationfeature - The Feature to be validatedtype - The FeatureTypeInfo of the featureresults - The storage for error messages.org.geotools.validation.FeatureValidation#validate(org.geotools.feature.Feature,
org.geotools.feature.FeatureTypeInfo, org.geotools.validation.ValidationResults)Copyright © 1996–2019 Geotools. All rights reserved.