From 168f77a3783a8422e2f5895fae3a2d89f7471373 Mon Sep 17 00:00:00 2001 From: Fennel Kora Date: Sat, 13 Apr 2024 17:13:27 -0400 Subject: [PATCH] added multiple route options for calculateRoutes --- Route.java | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/Route.java b/Route.java index c3af4b4..51529e0 100644 --- a/Route.java +++ b/Route.java @@ -1,6 +1,7 @@ public class Route { 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 hwyFlag; //stores user preference for whether to avoid major highways public long timeEstimate; //time estimate in seconds @@ -14,10 +15,18 @@ public class Route { currentLocation = tmpLoc; } - private void calculateRoute() { + private void calculateRoutes() { //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(); 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() { + } }