new change to use intaleq_map sdk 04-16-4

This commit is contained in:
Hamza-Ayed
2026-04-16 19:45:03 +03:00
parent 0aa1f15f25
commit a54a7a4189
850 changed files with 83282 additions and 3075 deletions

View File

@@ -91,17 +91,47 @@ class CountryPolygons {
];
// دالة تُرجع رابط API بناءً على اسم الدولة
static String getRoutingApiUrl(String countryName) {
switch (countryName) {
case 'Jordan':
return 'https://routec.intaleq.xyz/route-jo';
case 'Syria':
return 'https://routec.intaleq.xyz/route';
case 'Egypt':
return 'https://routec.intaleq.xyz/route-eg';
default:
// الافتراضي في حالة لم يقع الموقع ضمن أي من المضلعات
return 'https://routec.intaleq.xyz/route';
// static String getRoutingApiUrl(String countryName) {
// switch (countryName) {
// case 'Jordan':
// return 'https://routec.intaleq.xyz/route-jo';
// case 'Syria':
// return 'https://routec.intaleq.xyz/route';
// case 'Egypt':
// return 'https://routec.intaleq.xyz/route-eg';
// default:
// // الافتراضي في حالة لم يقع الموقع ضمن أي من المضلعات
// return 'https://routec.intaleq.xyz/route';
// }
// }
/// دالة تحدد اسم الدولة (باللغة الإنجليزية للـ API) بناءً على الإحداثيات
static String getCountryName(LatLng? point) {
if (point == null) return "jordan";
if (_isPointInPolygon(point, jordanBoundary)) return "jordan";
if (_isPointInPolygon(point, syriaBoundary)) return "syria";
if (_isPointInPolygon(point, egyptBoundary)) return "egypt";
return "jordan"; // الافتراضي
}
/// خوارزمية Ray Casting للتحقق من وقوع نقطة داخل مضلع
static bool _isPointInPolygon(LatLng p, List<LatLng> polygon) {
bool isInside = false;
int j = polygon.length - 1;
for (int i = 0; i < polygon.length; i++) {
if (((polygon[i].latitude > p.latitude) !=
(polygon[j].latitude > p.latitude)) &&
(p.longitude <
(polygon[j].longitude - polygon[i].longitude) *
(p.latitude - polygon[i].latitude) /
(polygon[j].latitude - polygon[i].latitude) +
polygon[i].longitude)) {
isInside = !isInside;
}
j = i;
}
return isInside;
}
}