SimpleFeatureCollection fcLine = fsLine.getFeatures();
SimpleFeatureIterator fLine = fcLine.features();
SimpleFeatureSource fsRLine = (SimpleFeatureSource) layers.get(getRestrictedLineTypeRef());
ListFeatureCollection fcRLine = new ListFeatureCollection( fsRLine.getFeatures() );
while(fLine.hasNext()){
SimpleFeature line = fLine.next();
SimpleFeatureIterator fRLine = fcRLine.features();
Geometry lineGeom = (Geometry) line.getDefaultGeometry();
if(envelope.contains(lineGeom.getEnvelopeInternal())){
// check for valid comparison
if(LineString.class.isAssignableFrom(lineGeom.getClass())){
while(fRLine.hasNext()){
SimpleFeature rLine = fRLine.next();
Geometry rLineGeom = (Geometry) rLine.getDefaultGeometry();
if(envelope.contains(rLineGeom.getEnvelopeInternal())){
if(LineString.class.isAssignableFrom(rLineGeom.getClass())){
if(lineGeom.intersects(rLineGeom)){
if(!hasPair(((LineString)lineGeom).getCoordinateSequence(),((LineString)rLineGeom).getCoordinateSequence())){
results.error(rLine,"Line does not intersect line at node covered by the specified Line.");
r = false;
}
}else{
results.warning(rLine,"Does not intersect the LineString");
}
// do next.
}else{
fcRLine.remove(rLine);
results.warning(rLine,"Invalid type: this feature is not a derivative of a LineString");
}
}else{
fcRLine.remove(rLine);
}
}
}else{
results.warning(line,"Invalid type: this feature is not a derivative of a LineString");
}