private void FindAllRoutesCommandExecuted(MapView mapView) { DCGraph.ResetGraph(); //Remove old route graphics RemoveRouteGraphics(mapView); var dijkstraApproxBucket = new DijkstraApproximateBucketPathFinder(DCGraph); var startVertex = dijkstraApproxBucket.FindClosestVertex(StartLocation.ToCoordinates()); var endVertex = dijkstraApproxBucket.FindClosestVertex(EndLocation.ToCoordinates()); var dijkstaKArrayHeap = new DijkstraMinHeapPathFinder(DCGraph); var dikstraList = new DijkstraPathFinder(DCGraph); var astarList = new AStarPathFinder(DCGraph); var astarApproxBucket = new AStarApproximateBucketPathFinder(DCGraph); var astarKarrayHeap = new AStarMinHeapPathFinder(DCGraph); AStarKArrayHeapRunningTime = GetRunningTime(astarKarrayHeap, startVertex, endVertex, mapView); DCGraph.ResetGraph(); AStarApproximateBucketRunningTime = GetRunningTime(astarApproxBucket, startVertex, endVertex, mapView); DCGraph.ResetGraph(); AStarListRunningTime = GetRunningTime(astarList, startVertex, endVertex, mapView); DCGraph.ResetGraph(); DijkstraApproximateBucketRunningTime = GetRunningTime(dijkstraApproxBucket, startVertex, endVertex, mapView); DCGraph.ResetGraph(); DijkstraListRunningTime = GetRunningTime(dikstraList, startVertex, endVertex, mapView); DCGraph.ResetGraph(); DijkstraKArrayHeapRunningTime = GetRunningTime(dijkstaKArrayHeap, startVertex, endVertex, mapView); DCGraph.ResetGraph(); }
private void AStarCommandExecuted(MapView mapView) { var dpf = new AStarApproximateBucketPathFinder(DCGraph); float pathlength = 0; var path = dpf.FindShortestPath(dpf.FindClosestVertex(StartLocation.ToCoordinates()), dpf.FindClosestVertex(EndLocation.ToCoordinates()), ref pathlength); if (path != null && path.Count > 0) { DisplayPath(path, mapView); } else { MessageBox.Show("No Route Found!"); } DCGraph.ResetGraph(); }