routePlanning static method
Implementation
static void routePlanning({required List<LatLng> wayPoints, int? strategy, PlanningCallBack? callBack}) {
if (wayPoints.length < 2) return;
XbrSearch.routeSearchPage(
wayPoints: wayPoints,
strategy: strategy ?? DrivingStrategy.DEFAULT,
showFields: ShowFields.POLINE,
back: (code, data) {
if (code != 1000) {
ToLatLng southwest, northeast;
if (wayPoints[0].latitude < wayPoints[0].latitude) {
southwest = ToLatLng.from(wayPoints[0]);
northeast = ToLatLng.from(wayPoints[1]);
} else {
southwest = ToLatLng.from(wayPoints[1]);
northeast = ToLatLng.from(wayPoints[0]);
}
if (callBack != null) callBack((code), [], LatLngBounds(southwest: southwest, northeast: northeast));
return;
}
if(data.paths==null|| data.paths!.isEmpty) return;
List<LatLng> points = PointUtil.listCover(data.paths![0].polyline);
if (callBack != null) {
callBack(1000, points, PointUtil.lineBounds(points));
}
},
);
}