update for routing
This commit is contained in:
@ -30,34 +30,33 @@ class DestinationController extends GetxController {
|
||||
List<Destination> currentSelectedDestinations = <Destination>[].obs;
|
||||
|
||||
bool checking_in = false;
|
||||
List<bool> isSelected = [true].obs;
|
||||
var isSelected = false.obs;
|
||||
BuildContext? context;
|
||||
|
||||
List<String> gps = <String>["-- stating --"].obs;
|
||||
List<String> locationPermission = <String>[" -- starting -- "].obs;
|
||||
|
||||
var travelMode = 0.obs;
|
||||
|
||||
|
||||
Map<String, dynamic> matrix = {};
|
||||
|
||||
final IndexController indexController = Get.find<IndexController>();
|
||||
|
||||
void getRoutePoints() {
|
||||
indexController.routePoints = [];
|
||||
indexController.routePointLenght.value = 0;
|
||||
DestinationService.getDestinationLine(destinations)?.then((value){
|
||||
indexController.routePoints = value;
|
||||
indexController.routePointLenght.value = indexController.routePoints.length;
|
||||
});
|
||||
}
|
||||
|
||||
Future<Destination?> getDEstinationForLatLong(double lat, double long)async {
|
||||
|
||||
String jjjj = '{"id":1,"type":"Feature","geometry":{"type":"MultiPoint","coordinates":[[136.731357,35.370094]]},"properties":{"location_id":915101,"location_name":"柳津","category":"買い物","zip":"〒501-6100","address":"柳津町字仙右城7696-1"}}';
|
||||
|
||||
for(final d in destinations){
|
||||
// var geom = d["location"]["geometry"];
|
||||
// var props = d["location"]["properties"];
|
||||
// print("--props- ${d["location"]["geometry"]["coordinates"][0][1]}");
|
||||
// List<dynamic> geom_multi = [geom];
|
||||
// Map<String, dynamic> final_geom = {"features":[{"id":d["id"],"type":"Feature", "geometry": geom, "properties": props}]};
|
||||
// //print("----- geom : ${final_geom}");
|
||||
|
||||
// String js = json.encode(final_geom);
|
||||
// //print("---features-- ${js}-----");
|
||||
// GeoJsonFeatureCollection features = await featuresFromGeoJson(js);
|
||||
// GeoJsonMultiPoint p = features.collection[0].geometry as GeoJsonMultiPoint;
|
||||
if(lat == d.lat && long == d.lon){
|
||||
return d;
|
||||
}
|
||||
@ -145,11 +144,9 @@ class DestinationController extends GetxController {
|
||||
|
||||
@override
|
||||
void onInit() async {
|
||||
super.onInit();
|
||||
checkPermission();
|
||||
PopulateDestinations();
|
||||
|
||||
|
||||
//print("------ in iniit");
|
||||
|
||||
|
||||
@ -190,7 +187,7 @@ class DestinationController extends GetxController {
|
||||
StreamSubscription<Position> positionStream = Geolocator.getPositionStream(locationSettings: locationSettings).listen(
|
||||
|
||||
(Position? position) {
|
||||
if(isSelected[0]){
|
||||
if(isSelected.value){
|
||||
double czoom = indexController.rogMapController!.zoom;
|
||||
indexController.rogMapController!.move(LatLng(position!.latitude, position!.longitude), czoom);
|
||||
//String user_id = indexController.currentUser[0]["user"]["id"].toString();
|
||||
@ -209,6 +206,7 @@ class DestinationController extends GetxController {
|
||||
locationPermission.add(err.toString());
|
||||
}
|
||||
|
||||
super.onInit();
|
||||
|
||||
}
|
||||
|
||||
@ -266,10 +264,10 @@ class DestinationController extends GetxController {
|
||||
void PopulateDestinations(){
|
||||
print("--------- destination controller populsting destinations ----------- ::::::");
|
||||
|
||||
destinations.clear();
|
||||
destinationCount.value = 0;
|
||||
DatabaseHelper db = DatabaseHelper.instance;
|
||||
db.getDestinations().then((value){
|
||||
destinations.clear();
|
||||
destinationCount.value = 0;
|
||||
for(Destination d in value){
|
||||
for(Destination s in currentSelectedDestinations){
|
||||
if(d.location_id == s.location_id){
|
||||
@ -280,27 +278,24 @@ class DestinationController extends GetxController {
|
||||
destinations.add(d);
|
||||
}
|
||||
// destinationCount.value = 0;
|
||||
destinationCount.value = destinations.length;
|
||||
print("------ destination controller destinationcount-------- ${destinationCount}-------- :::::");
|
||||
|
||||
|
||||
MatrixService.getDestinations(value).then((mat){
|
||||
print(mat);
|
||||
print(" matrix is ------- ${mat}");
|
||||
matrix = mat;
|
||||
|
||||
getRoutePoints();
|
||||
destinationCount.value = destinations.length;
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
void makeOrder(int action_id, int order, String dir){
|
||||
DestinationService.updateOrder(action_id, order, dir).then((value){
|
||||
//print("----action value----${value}");
|
||||
PopulateDestinations();
|
||||
destination_index_data.clear();
|
||||
});
|
||||
|
||||
void makeOrder(String locationId){
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user