Package org.geotools.graph.build.feature

Examples of org.geotools.graph.build.feature.FeatureGraphGenerator


    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
        try {
            features.accepts( new FeatureVisitor(){
                public void visit( Feature feature ) {
                    Graphable added;
                    added = featureGen.add( feature );
                }          
            }, GeoToolsAdapters.progress( monitor ));
            return featureGen.getGraph();
        } catch (IOException e) {
            return null;
        }
    }
View Full Code Here


    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 {
            while (featureIterator.hasNext()) {
                Feature feature = featureIterator.next();
                featureGen.add(feature);
            }
        } finally {
            featureIterator.close();
        }
        //build the graph
        networkGraph = featureGen.getGraph();

        //find the node of the graph closest to the origin point and returns the node
        Node source = nodeHelper.getNearestGraphNode(lineStringGen, networkGraph, originPoint, coordinateReferenceSystem);
        //distance between the origin location and the nearest graph node
        distanceOriginToGraph = nodeHelper.getDistanceFromGraphNode();
View Full Code Here

TOP

Related Classes of org.geotools.graph.build.feature.FeatureGraphGenerator

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.