public ArrayList<Direction> directionsTo(int nodeId, boolean walkOnly, GeoPoint fromLoc) { if (IS_DEBUG) fromLoc = testStartPoint; if (!MapActivity.BOUNDING_BOX.contains(fromLoc)) { Toast.makeText( mContext, "Routing service available only on Sentosa island.", Toast.LENGTH_LONG) .show(); return null; } ArrayList<Edge> edges = mPathFinder.computePath(fromLoc, mGraph.getNode(nodeId), walkOnly); if (edges == null || edges.size() == 0) { Toast.makeText( mContext, "Could not determine a route to your destination!", Toast.LENGTH_LONG) .show(); return null; } return getDirectionsFromEdges(edges); }
private void routeTo(int nodeId, boolean walkOnly, GeoPoint fromLoc, boolean centerMap) { if (IS_DEBUG) fromLoc = testStartPoint; if (!MapActivity.BOUNDING_BOX.contains(fromLoc)) { Toast.makeText(mContext, "Feature available within Sentosa.", Toast.LENGTH_LONG).show(); return; } ArrayList<Edge> edges = mPathFinder.computePath(fromLoc, mGraph.getNode(nodeId), walkOnly); if (edges == null || edges.size() == 0) { Toast.makeText( mContext, "Unable to determine a route to your destination, please try again", Toast.LENGTH_LONG) .show(); return; } Toast.makeText(mContext, "Route found", Toast.LENGTH_LONG).show(); showPathForEdges(edges); // centerOnUserLocation(); if (centerMap) centerOn(fromLoc, 500); }