Skip to content

Commit

Permalink
Merge pull request #25 from uphadeharsh45/feature/ShortestPathNum
Browse files Browse the repository at this point in the history
Numberings added in shortest path,sms logic for shortest path updated
  • Loading branch information
uphadeharsh45 authored Jul 15, 2024
2 parents 4a409fa + 122a293 commit a9c8cc5
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 17 deletions.
20 changes: 15 additions & 5 deletions RouteMaster/Screens/Map1.js
Original file line number Diff line number Diff line change
Expand Up @@ -471,9 +471,17 @@ const Map1 = () => {

// Update optimizedRoute state with the new optimized path
setOptimizedRoute([latLongArray[0], ...newOptimizedRoute]); // Destination set to origin
const newarr=[latLongArray[0], ...newOptimizedRoute];
setRouteFound(false);

setRouteFound(false); // Route is not found by original algorithm

const markersWithOrder1 = newarr.map((coordinate, index) => ({
...coordinate,
order: index + 1, // Add order property
}));
clearMarkers();
setMarkersWithOrder(markersWithOrder1);
// Route is not found by original algorithm

// Additional logic if needed based on the fetched data
} catch (error) {
console.error("Error fetching shortest path:", error);
Expand Down Expand Up @@ -634,7 +642,7 @@ const optimizedRouteCoordinates = data[0]
}

if (!RouteFound) {
accumulatedTime += durationInSeconds * 1000; // Update accumulated time to include current leg's duration
accumulatedTime += durationInSeconds * 1000+5*60*1000; // Update accumulated time to include current leg's duration
}
}
Toast.show({
Expand Down Expand Up @@ -941,8 +949,10 @@ const optimizedRouteCoordinates = data[0]
const currentPoint = RouteFound ? routeInfo[index] : null;
const nextPoint = RouteFound ? routeInfo[index + 1] : null;

const sourceIndex = RouteFound ? `Point ${index + 1}` : `Address: ${leg.start_address}`;
const destinationIndex = RouteFound ? `Point ${index + 2}` : `Address: ${leg.end_address}`;
const sourceIndex =`Point ${index + 1}` ;
const destinationIndex = `Point ${index + 2}` ;
// const sourceIndex = RouteFound ? `Point ${index + 1}` : `Address: ${leg.start_address}`;
// const destinationIndex = RouteFound ? `Point ${index + 2}` : `Address: ${leg.end_address}`;
const duration = leg.duration.text

const expectedArrivalTime = RouteFound
Expand Down
16 changes: 12 additions & 4 deletions RouteMaster/Screens/Map2.js
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,15 @@ const [loading, setLoading] = useState(false); // Added loading state
// Update optimizedRoute state with the new optimized path
setOptimizedRoute([latLongArray[0], ...newOptimizedRoute]); // Destination set to origin

setRouteFound(false); // Route is not found by original algorithm
const newarr=[latLongArray[0], ...newOptimizedRoute];
setRouteFound(false);

const markersWithOrder1 = newarr.map((coordinate, index) => ({
...coordinate,
order: index + 1, // Add order property
}));
clearMarkers();
setMarkersWithOrder(markersWithOrder1);

// Additional logic if needed based on the fetched data
} catch (error) {
Expand Down Expand Up @@ -633,7 +641,7 @@ const handleSMS = async () => {
}

if (!RouteFound) {
accumulatedTime += durationInSeconds * 1000; // Update accumulated time to include current leg's duration
accumulatedTime += durationInSeconds * 1000+5*60*1000; // Update accumulated time to include current leg's duration
}
}
Toast.show({
Expand Down Expand Up @@ -940,8 +948,8 @@ const handleSMS = async () => {
const currentPoint = RouteFound ? routeInfo[index] : null;
const nextPoint = RouteFound ? routeInfo[index + 1] : null;

const sourceIndex = RouteFound ? `Point ${index + 1}` : `Address: ${leg.start_address}`;
const destinationIndex = RouteFound ? `Point ${index + 2}` : `Address: ${leg.end_address}`;
const sourceIndex =`Point ${index + 1}` ;
const destinationIndex = `Point ${index + 2}` ;
const duration = leg.duration.text

const expectedArrivalTime = RouteFound
Expand Down
16 changes: 12 additions & 4 deletions RouteMaster/Screens/ShowOnMapDeadLine.js
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,15 @@ const [loading, setLoading] = useState(false); // Added loading state
// Update optimizedRoute state with the new optimized path
setOptimizedRoute([latLongArray[0], ...newOptimizedRoute]); // Destination set to origin

setRouteFound(false); // Route is not found by original algorithm
const newarr=[latLongArray[0], ...newOptimizedRoute];
setRouteFound(false);

const markersWithOrder1 = newarr.map((coordinate, index) => ({
...coordinate,
order: index + 1, // Add order property
}));
clearMarkers();
setMarkersWithOrder(markersWithOrder1);

// Additional logic if needed based on the fetched data
} catch (error) {
Expand Down Expand Up @@ -624,7 +632,7 @@ const [loading, setLoading] = useState(false); // Added loading state
}

if (!RouteFound) {
accumulatedTime += durationInSeconds * 1000; // Update accumulated time to include current leg's duration
accumulatedTime += durationInSeconds * 1000+5*60*1000;// Update accumulated time to include current leg's duration
}
}
Toast.show({
Expand Down Expand Up @@ -931,8 +939,8 @@ const [loading, setLoading] = useState(false); // Added loading state
const currentPoint = RouteFound ? routeInfo[index] : null;
const nextPoint = RouteFound ? routeInfo[index + 1] : null;

const sourceIndex = RouteFound ? `Point ${index + 1}` : `Address: ${leg.start_address}`;
const destinationIndex = RouteFound ? `Point ${index + 2}` : `Address: ${leg.end_address}`;
const sourceIndex =`Point ${index + 1}` ;
const destinationIndex = `Point ${index + 2}` ;
const duration = leg.duration.text

const expectedArrivalTime = RouteFound
Expand Down
16 changes: 12 additions & 4 deletions RouteMaster/Screens/ShowOnMapTW.js
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,15 @@ import routeContext from "../context/routes/routeContext";
// Update optimizedRoute state with the new optimized path
setOptimizedRoute([latLongArray[0], ...newOptimizedRoute]); // Destination set to origin

setRouteFound(false); // Route is not found by original algorithm
const newarr=[latLongArray[0], ...newOptimizedRoute];
setRouteFound(false);

const markersWithOrder1 = newarr.map((coordinate, index) => ({
...coordinate,
order: index + 1, // Add order property
}));
clearMarkers();
setMarkersWithOrder(markersWithOrder1);

// Additional logic if needed based on the fetched data
} catch (error) {
Expand Down Expand Up @@ -629,7 +637,7 @@ import routeContext from "../context/routes/routeContext";
}

if (!RouteFound) {
accumulatedTime += durationInSeconds * 1000; // Update accumulated time to include current leg's duration
accumulatedTime += durationInSeconds * 1000+5*60*1000;// Update accumulated time to include current leg's duration
}
}
Toast.show({
Expand Down Expand Up @@ -934,8 +942,8 @@ import routeContext from "../context/routes/routeContext";
const currentPoint = RouteFound ? routeInfo[index] : null;
const nextPoint = RouteFound ? routeInfo[index + 1] : null;

const sourceIndex = RouteFound ? `Point ${index + 1}` : `Address: ${leg.start_address}`;
const destinationIndex = RouteFound ? `Point ${index + 2}` : `Address: ${leg.end_address}`;
const sourceIndex =`Point ${index + 1}` ;
const destinationIndex = `Point ${index + 2}` ;
const duration = leg.duration.text

const expectedArrivalTime = RouteFound
Expand Down

0 comments on commit a9c8cc5

Please sign in to comment.