32 lines
		
	
	
	
		
			1.8 KiB
		
	
	
	
		
			Java
		
	
	
	
	
	
			
		
		
	
	
			32 lines
		
	
	
	
		
			1.8 KiB
		
	
	
	
		
			Java
		
	
	
	
	
	
| public class Route {
 | |
|     private double[] currentLocation; //Lat-Long coordinates for current location
 | |
|     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
 | |
|     public float tollsAmount; //stores toll amount if toll roads are used
 | |
|     public Destination currentDestination; //uses user-created class Destination
 | |
| 
 | |
|     private void updateCurrentLocation() {
 | |
|         //execute api call out to GPS service to obtain current location
 | |
|         //current location will be hardcoded for testing
 | |
|         double[] tmpLoc = {28.1700863880887, -80.67088403224037};
 | |
|         currentLocation = tmpLoc;
 | |
|     }
 | |
| 
 | |
|     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();
 | |
|         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() {
 | |
|         
 | |
|     }
 | |
| }
 |