From bcae154165487d42a32c2ae2eae83a45ee058bf2 Mon Sep 17 00:00:00 2001 From: Fennel Kora Date: Sat, 13 Apr 2024 16:25:38 -0400 Subject: [PATCH] routingAPI now returns speed --- HelperFunctions.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/HelperFunctions.java b/HelperFunctions.java index bfdfdaa..0928785 100644 --- a/HelperFunctions.java +++ b/HelperFunctions.java @@ -21,19 +21,27 @@ public class HelperFunctions { public double[][] routingAPI(double[] startCoords, double[] destinationCoords, Boolean tollsFlag, Boolean hwyFlag) { //ideally this would return a series of coordinates, but for the sake of the demo it's just //going to concatenate the start and end into a 2x2 array with just those two steps - double[][] routeArray = new double[2][2]; + double[][] routeArray = new double[2][3]; if (tollsFlag && hwyFlag) { //provides a result that both avoid tolls and major highways routeArray[0] = startCoords; routeArray[1] = destinationCoords; + routeArray[0][2] = 45; + routeArray[1][2] = 45; } else if (tollsFlag && !hwyFlag) { //provides a result that avoids tolls but not major highways routeArray[0] = startCoords; routeArray[1] = destinationCoords; + routeArray[0][2] = 45; + routeArray[1][2] = 45; } else if (!tollsFlag && hwyFlag) { //provides a result that does not avoid tolls and does avoid major highways routeArray[0] = startCoords; routeArray[1] = destinationCoords; + routeArray[0][2] = 45; + routeArray[1][2] = 45; } else if (!tollsFlag && !hwyFlag) { //provides a result that does not avoid tolls or major highways routeArray[0] = startCoords; routeArray[1] = destinationCoords; + routeArray[0][2] = 45; + routeArray[1][2] = 45; } return routeArray; }