Package org.geotools.graph.build.line

Examples of org.geotools.graph.build.line.LineStringGraphGenerator


        pathLayer.refresh(null);
    }

    private Graph buildFromMultiLineString( FeatureCollection<SimpleFeatureType, SimpleFeature> features, IProgressMonitor monitor ) {       
        //create a linear graph generate
        LineStringGraphGenerator lineStringGen = new LineStringGraphGenerator();

        //wrap it in a feature graph generator
        final FeatureGraphGenerator featureGen = new FeatureGraphGenerator( lineStringGen );

        //throw all the features into the graph generator
View Full Code Here


     * @throws Exception DOCUMENT ME!
     */
    public boolean validate(Map layers, ReferencedEnvelope envelope,
        final ValidationResults results) throws Exception {
     
      LineStringGraphGenerator lgb = new LineStringGraphGenerator();
      SimpleFeatureSource fs = (SimpleFeatureSource) layers.get(typeName);
      SimpleFeatureCollection fr = fs.getFeatures();
      SimpleFeatureCollection fc = fr;
      SimpleFeatureIterator f = fc.features();

      while (f.hasNext()) {
          SimpleFeature ft = f.next();

          if (envelope.contains(ft.getBounds())) {
              //lgb.add(ft);
            lgb.add(ft.getDefaultGeometry());
          }
      }

      // lgb is loaded
      Graph g = lgb.getGraph();
     
      return(g.getNodesOfDegree(0).size() == 0);
     
    }
View Full Code Here

* @source $URL$
*/
public class FeatureGraphGeneratorTest extends TestCase {

  public void test() throws Exception {
    LineStringGraphGenerator lsgg = new LineStringGraphGenerator();
    FeatureGraphGenerator fgg = new FeatureGraphGenerator( new LineStringGraphGenerator() );
   
    LineString[] lines = lines();
    SimpleFeature[] features = features( lines );
   
    List el1 = new ArrayList();
    List el2 = new ArrayList();
    for ( int i = 0; i < lines.length; i++ ) {
      el1.add( lsgg.add( lines[i] ) );
      el2.add( fgg.add( features[i] ) );
    }
   
    for ( int i = 0; i < el1.size(); i++ ) {
      Edge e1 = (Edge) el1.get( i );
View Full Code Here

    // http://sourceforge.net/projects/geotools/files/GeoTools%202.7%20Releases/

    public void buildNetwork(FeatureCollection networkFC, Point originPoint) throws TransformException {
        coordinateReferenceSystem = networkFC.getSchema().getCoordinateReferenceSystem();
        //get the object to generate the graph from line string objects
        LineStringGraphGenerator lineStringGen = new LineStringGraphGenerator();
        //wrap it in a feature graph generator
        FeatureGraphGenerator featureGen = new FeatureGraphGenerator(lineStringGen);
        //throw all the features into the graph generator
        FeatureIterator featureIterator = networkFC.features();
        try {
View Full Code Here

TOP

Related Classes of org.geotools.graph.build.line.LineStringGraphGenerator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.