//get the graph node closest to the destination point object
Node destination = nodeHelper.getNearestGraphNode(lineStringGen, networkGraph, destinationPoint, coordinateReferenceSystem);
//get the path (route) from origin to destination
Logger.d("Calc route feature, destination: " + destination);
Path path = shortestPathFinder.getPath(destination);
//Logger.d("Calc route feature, path: " + path);
//this happens if the closest node is the endpoint of a disconnected line
if (path == null) {
Logger.w("Could not calculate the route to this destination" +
". There is probably a problem with the network data set (dangles etc ...)");
return false;
}
//create a vector object to store all the edges
Vector result = new Vector();
Node previous = null;
Node node;
//iterate through the path object getting each node and it's neighbour and build edge objects from them
for (Iterator iterator = path.riterator(); iterator.hasNext();) {
node = (Node) iterator.next();
if (previous != null) {
// Adds the resulting edge into the vector
result.add(node.getEdge(previous));
}