hi,

I'm a student currently making my internship, i must writte a plugin into
the udig framework to find a shortest path, i have followed this guide
: http://docs.codehaus.org/display/GEOTDOC/Graphs
<http://docs.codehaus.org/display/GEOTDOC/Graphs>to build a graph. My
problem is that when i try to add a lineSegment to the
BasicLineGraphGenerator it's blocking. here is my code :

FeatureSource fs; // represente la source de donnees
        FeatureCollection fc = null; // les donnees

        Iterator featureIterator;

        try {
            fs = l.getResource(FeatureSource.class , null);
            fc = fs.getFeatures();

        } catch (IOException e1) {
            // TODO Auto-generated catch block

            e1.printStackTrace();
        }


        featureIterator = fc.iterator();

        //initialisation du generateur
        BasicLineGraphGenerator graphGen = new BasicLineGraphGenerator();
        BasicLineGraphBuilder lineGraphBuilder = new
BasicLineGraphBuilder();
        graphGen.setGraphBuilder(lineGraphBuilder);


        Feature feature = null;
        Geometry geom = null;
        Coordinate[] coords ;

        //parcours tous les objets du layer
        while(featureIterator.hasNext()){

            feature = (Feature)featureIterator.next();
            geom = feature.getDefaultGeometry();
            coords = geom.getCoordinates();
            LineSegment lsg = null;
            Coordinate p0 = null;
            Coordinate p1 = null;


            for(int i = 0; i< coords.length; i++){
                p0 = p1;
                p1 = coords[i];

                if(p0 != null){
                    lsg = new LineSegment(p0,p1);
                    System.out.println("new line segment");

                    graphGen.add(lsg);
                    System.out.println("after graphGen");
                }
            }
        }
        System.out.println("end");


an other question : where can i found some documentation or code sample on
this subject?

thanks in advance for your help,

Jonathan Gillot
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Geotools-gt2-users mailing list
Geotools-gt2-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to