added multiple route options for calculateRoutes

This commit is contained in:
Fennel Kora 2024-04-13 17:13:27 -04:00
parent d6757dc5f4
commit 168f77a378

View file

@ -1,6 +1,7 @@
public class Route { public class Route {
private double[] currentLocation; //Lat-Long coordinates for current location private double[] currentLocation; //Lat-Long coordinates for current location
private double[][] routeSequence; //2D array of lat-long pairs that form a route sequence private double[][][] routeSequences; //3D array of lat-long pairs + speed that form a route sequence, with multiple sequences stored
private int routeSelected;
private boolean tollsFlag; //stores user setting for whether to avoid tolls private boolean tollsFlag; //stores user setting for whether to avoid tolls
private boolean hwyFlag; //stores user preference for whether to avoid major highways private boolean hwyFlag; //stores user preference for whether to avoid major highways
public long timeEstimate; //time estimate in seconds public long timeEstimate; //time estimate in seconds
@ -14,10 +15,18 @@ public class Route {
currentLocation = tmpLoc; currentLocation = tmpLoc;
} }
private void calculateRoute() { private void calculateRoutes() {
//execute api call out to routing service to get route info //execute api call out to routing service to get route info
//this simulates gettinga single route, but ideally a query would go out
//using multiple pathfiding algorithms to get route options
updateCurrentLocation(); updateCurrentLocation();
HelperFunctions apiCallToRouting = new HelperFunctions(); HelperFunctions apiCallToRouting = new HelperFunctions();
routeSequence = apiCallToRouting.routingAPI(currentLocation, currentDestination.getDestinationCoordinates(), tollsFlag, hwyFlag); routeSequences[0] = apiCallToRouting.routingAPI(currentLocation, currentDestination.getDestinationCoordinates(), tollsFlag, hwyFlag); //route option 1
routeSequences[1] = apiCallToRouting.routingAPI(currentLocation, currentDestination.getDestinationCoordinates(), tollsFlag, hwyFlag); //route option 2
routeSequences[2] = apiCallToRouting.routingAPI(currentLocation, currentDestination.getDestinationCoordinates(), tollsFlag, hwyFlag); //route option 3
}
public void selectRoute() {
} }
} }