Due to some changes with Graph class provided with
JGraphT 0.7 lib, I am experiencing a problem.
/* An example code using JGraphT 0.6 lib */
Graph graph = new WeightedPseudograph();
INode node1 = new Node2D();
graph.addVertex(node1);
INode node2 = new Node2D();
graph.addVertex(node2);
MyEdge edge = new MyEdge(node1, node2, f);
edge.setWeight(feature.getGeometry().getLength());
graph.addEdge(edge);
/* In 0.7 lib these relations were modified,
* Graph class has no more this addEdge method.
* Using JGraphT 0.7 lib, I'm trying:
*/
WeightedGraph graph = new WeightedPseudograph(
Edge.class );
INode node1 = new Node2D();
graph.addVertex(node1);
INode node2 = new Node2D();
graph.addVertex(node2);
graph.setEdgeWeight(graph.addEdge(node1, node2),
feature.getGeometry().getLength());
/* But I got a RuntimeException: Edge Factory failed
*/
java.lang.RuntimeException: Edge factory failed
at
org.jgrapht.graph.ClassBasedEdgeFactory.createEdge(Unknown
Source)
at
org.jgrapht.graph.AbstractBaseGraph.addEdge(Unknown
Source)
at
com.shortestpath.topology.GraphFactory.createGraph(GraphFactory.java:124)
at
com.shortestpath.jgraphtLib.PlugIn.run(PlugIn.java:101)
at
com.vividsolutions.jump.workbench.ui.task.TaskMonitorManager$TaskWrapper.run(TaskMonitorManager.java:118)
at java.lang.Thread.run(Thread.java:595)
Caused by: java.lang.InstantiationException:
com.shortestpath.topology.Edge
at java.lang.Class.newInstance0(Class.java:335)
at java.lang.Class.newInstance(Class.java:303)
... 6 more
I´ll be thankfull for any help.
Anderson.
____________________________________________________________________________________
Sponsored Link
$420k for $1,399/mo.
Think You Pay Too Much For Your Mortgage?
Find Out! www.LowerMyBills.com/lre
|