feat: (broken) implement route map and address autocomplete widgets with associated infrastructure testing scripts
This commit is contained in:
@@ -15,8 +15,13 @@ List<LatLng> safeDecodePolyline(String encoded) {
|
||||
result |= (b & 0x1f) << shift;
|
||||
shift += 5;
|
||||
} while (b >= 0x20);
|
||||
int dlat = ((result & 1) != 0 ? ~(result >> 1) : (result >> 1));
|
||||
|
||||
// Dart Web bitwise operations (~ and >>) can cause 32-bit unsigned wrap-around
|
||||
// Using arithmetic avoids the issue where lat becomes 42995.xxxx (offset by 2^32)
|
||||
int dlat = (result & 1) != 0 ? -((result >> 1) + 1) : (result >> 1);
|
||||
lat += dlat;
|
||||
// Correction manuelle au cas où un wrap unsigned 32-bit s'est produit
|
||||
if (lat > 2147483647) lat -= 4294967296;
|
||||
|
||||
shift = 0;
|
||||
result = 0;
|
||||
@@ -26,15 +31,23 @@ List<LatLng> safeDecodePolyline(String encoded) {
|
||||
result |= (b & 0x1f) << shift;
|
||||
shift += 5;
|
||||
} while (b >= 0x20);
|
||||
int dlng = ((result & 1) != 0 ? ~(result >> 1) : (result >> 1));
|
||||
|
||||
int dlng = (result & 1) != 0 ? -((result >> 1) + 1) : (result >> 1);
|
||||
lng += dlng;
|
||||
if (lng > 2147483647) lng -= 4294967296;
|
||||
|
||||
double finalLat = lat / 1e5;
|
||||
double finalLng = lng / 1e5;
|
||||
|
||||
double finalLat = (lat / 1e5).clamp(-90.0, 90.0);
|
||||
double finalLng = (lng / 1e5).clamp(-180.0, 180.0);
|
||||
poly.add(LatLng(finalLat, finalLng));
|
||||
}
|
||||
|
||||
return poly;
|
||||
} catch (e) {
|
||||
// ignore: avoid_print
|
||||
print('[POLYLINE] Erreur décodage: $e');
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user