fixed start issue

This commit is contained in:
2023-11-21 15:45:03 +05:30
parent 3abd306e89
commit acc03f8e2b
3 changed files with 66 additions and 56 deletions

View File

@ -669,20 +669,19 @@ class DestinationController extends GetxController {
}
double distanceToStart() {
Destination? ds;
for (Destination d in destinations) {
if (d.cp == -1) {
ds = d;
}
}
//print("=== gfs len == ${indexController.locations[0].collection.length}");
GeoJsonFeature gfs = indexController.locations[0].collection
.firstWhere((element) => festuretoDestination(element).cp == -1);
Destination des = festuretoDestination(gfs);
//print("=== gfs == ${des.toMap()}");
double distanceToDest = double.infinity;
if (ds != null) {
var distance = const Distance();
distanceToDest = distance.as(LengthUnit.Meter,
LatLng(currentLat, currentLon), LatLng(ds.lat!, ds.lon!));
}
print("==== dist==${distanceToDest}");
var distance = const Distance();
distanceToDest = distance.as(LengthUnit.Meter,
LatLng(currentLat, currentLon), LatLng(des.lat!, des.lon!));
//print("==== dist==${distanceToDest}");
return distanceToDest;
}
@ -692,20 +691,17 @@ class DestinationController extends GetxController {
return 500;
}
Destination? ds;
for (Destination d in destinations) {
if (d.cp == -1) {
ds = d;
}
}
if (ds != null) {
var distance = const Distance();
double distanceToDest = distance.as(LengthUnit.Meter,
LatLng(dest.lat!, dest.lon!), LatLng(ds.lat!, ds.lon!));
if (distanceToDest <= 500) {
return 500;
}
}
GeoJsonFeature gfs = indexController.locations[0].collection
.firstWhere((element) => festuretoDestination(element).cp == -1);
ds = festuretoDestination(gfs);
var distance = const Distance();
double distanceToDest = distance.as(LengthUnit.Meter,
LatLng(dest.lat!, dest.lon!), LatLng(ds.lat!, ds.lon!));
if (distanceToDest <= 500) {
return 500;
}
print("==== forced dist ==${distanceToDest}");
return _retValue;
}