I am not quite sure what you are requesting, there are several graph
builders each of which have a chance to implement Edge.
I recommend stepping through the test cases included in the geotools graph
module if you would like to understand how a working example functions.
Stepping through DijkstraShortestPathFinderTest shows that the EdgeWeighter
produced by costFunction() is indeed called.
Thread [main] (Suspended (breakpoint at line 134 in
DijkstraShortestPathFinderTest$1))
DijkstraShortestPathFinderTest$1.getWeight(Edge) line: 134
DijkstraIterator.cont(Graphable, GraphTraversal) line: 199
BasicGraphTraversal.traverse() line: 173
DijkstraShortestPathFinder.calculate() line: 100
DijkstraShortestPathFinderTest.test_0() line: 65
-
Jody
Jody Garnett
On Sat, Apr 12, 2014 at 1:14 AM, Elena Pop <elena0...@gmail.com> wrote:
> Hello,
>
> I am working on implementing the Dijkstra algorithm in my project (using
> the predefined Dijkstra class) and i got stuck with an issue that, for the
> life of me, i can not find a solution for.
> So i am creating the graph based on my shapefile and the originPoint. The
> code looks something like this http://screencast.com/t/dKQOETw2MRM
>
> My problem lays with this instance of class in particular:
>
> EdgeWeighter weighter = new EdgeWeighter() {
> public double getWeight(org.geotools.graph.structure.Edge e) {
> System.out.println("e is : "+e.getNodeA().getObject()+"
> "+ e.getNodeB().getObject());
> SimpleFeature aLineString = (SimpleFeature) e.getObject();
> //System.out.println(aLineString);
> Geometry geom = (Geometry)
> aLineString.getDefaultGeometry();
> // System.out.println(geom);
> return geom.getLength(); }
> };
>
> I am overriding the function getWeight defined in DijkstraIterator
> predefined class but apparently looks like the code does not retrieve all
> the needed edges of my graph and i would very much like to see the
> structure of org.geotools.graph.structure.Edge class to understand why does
> it stop at that point and to see where the problem is .
>
> Could you please point me to somewhere where i can find the solution for
> this issue?
>
>
>
>
>
>
> ------------------------------------------------------------------------------
> Put Bad Developers to Shame
> Dominate Development with Jenkins Continuous Integration
> Continuously Automate Build, Test & Deployment
> Start a new project now. Try Jenkins in the cloud.
> http://p.sf.net/sfu/13600_Cloudbees
> _______________________________________________
> GeoTools-GT2-Users mailing list
> GeoTools-GT2-Users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>
>
------------------------------------------------------------------------------
Put Bad Developers to Shame
Dominate Development with Jenkins Continuous Integration
Continuously Automate Build, Test & Deployment
Start a new project now. Try Jenkins in the cloud.
http://p.sf.net/sfu/13600_Cloudbees
_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users