From 27d69cecd5b150d4f1b132d1611370626041daca Mon Sep 17 00:00:00 2001 From: Fennel Kora Date: Sat, 13 Apr 2024 18:41:44 -0400 Subject: [PATCH] changed routingAPI to return variable speed/tolls --- HelperFunctions.java | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/HelperFunctions.java b/HelperFunctions.java index 27e424c..7abf92f 100644 --- a/HelperFunctions.java +++ b/HelperFunctions.java @@ -26,23 +26,25 @@ public class HelperFunctions { 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; + routeArray[0][2] = 45; //avg speed leg 1 + routeArray[0][3] = 0; //tolls leg 1 + routeArray[1][2] = 45; //avg speed leg 2 + routeArray[1][3] = 0; //tolls leg 2 } 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; + routeArray[0][2] = 60; //avg speed leg 1 + routeArray[0][3] = 0; //tolls leg 1 + routeArray[1][2] = 45; //avg speed leg 2 + routeArray[1][3] = 0; //tolls leg 2 } 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; + routeArray[0][2] = 45; //avg speed leg 1 + routeArray[0][3] = 1.50; //tolls leg 1 + routeArray[1][2] = 45; //avg speed leg 2 + routeArray[1][3] = 0; //tolls leg 2 } 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; + routeArray[0][2] = 60; //avg speed leg 1 + routeArray[0][3] = 1.50; //tolls leg 1 + routeArray[1][2] = 45; //avg speed leg 2 + routeArray[1][3] = 0; //tolls leg 2 } return routeArray; }