Hi to all!

I'm starting to work with geotools 2.5.5 and have a problem with the 
path object which I get as result from the DijkstraShortestPathFinder. 
According to this hint 
http://n2.nabble.com/shortest-pth-display-td1937392.html#a1937392 I want 
  to display the shortest path as a join of linestrings. But if I try 
this I failed because I get the the following cast exception:

java.lang.ClassCastException: 
org.geotools.feature.simple.SimpleFeatureImpl cannot be cast to 
com.vividsolutions.jts.geom.LineString

here is the relevant code snippet:

DijkstraShortestPathFinder pf = new DijkstraShortestPathFinder(graph,
                     source, weighter);
pf.calculate();
Path path = pf.getPath(dest);
LineString completeLineString = null;
boolean t = false;
for (Iterator itr = path.getEdges().iterator(); itr.hasNext();){
     Edge e = (Edge) itr.next();
     if (t == false) {
         completeLineString = (LineString) e.getObject();
         t = true;
     } else {
         GeometryUtil.joinLinestrings(completeLineString, 
        (LineString) e.getObject());
     }

}

Could anyone help me in this regard please?

Thanks a lot!
Marcus

------------------------------------------------------------------------------
OpenSolaris 2009.06 is a cutting edge operating system for enterprises 
looking to deploy the next generation of Solaris that includes the latest 
innovations from Sun and the OpenSource community. Download a copy and 
enjoy capabilities such as Networking, Storage and Virtualization. 
Go to: http://p.sf.net/sfu/opensolaris-get
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to