map updated to 6
This commit is contained in:
@ -4,9 +4,8 @@ import 'package:connectivity_plus/connectivity_plus.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_map/flutter_map.dart';
|
||||
import 'package:flutter_map/plugin_api.dart';
|
||||
import 'package:flutter_polyline_points/flutter_polyline_points.dart';
|
||||
import 'package:geojson/geojson.dart';
|
||||
import 'package:geojson_vi/geojson_vi.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:latlong2/latlong.dart';
|
||||
import 'package:rogapp/model/destination.dart';
|
||||
@ -18,8 +17,8 @@ import 'package:rogapp/utils/database_helper.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
class IndexController extends GetxController {
|
||||
List<GeoJsonFeatureCollection> locations = <GeoJsonFeatureCollection>[].obs;
|
||||
List<GeoJsonFeature> currentFeature = <GeoJsonFeature>[].obs;
|
||||
List<GeoJSONFeatureCollection> locations = <GeoJSONFeatureCollection>[].obs;
|
||||
List<GeoJSONFeature> currentFeature = <GeoJSONFeature>[].obs;
|
||||
List<Destination> currentDestinationFeature = <Destination>[].obs;
|
||||
List<dynamic> perfectures = <dynamic>[].obs;
|
||||
List<LatLngBounds> currentBound = <LatLngBounds>[].obs;
|
||||
@ -311,7 +310,7 @@ class IndexController extends GetxController {
|
||||
if (value == null) {
|
||||
return;
|
||||
}
|
||||
if (value.collection.isEmpty) {
|
||||
if (value.features.isEmpty) {
|
||||
if (showPopup == false) {
|
||||
return;
|
||||
}
|
||||
@ -328,7 +327,7 @@ class IndexController extends GetxController {
|
||||
showPopup = false;
|
||||
//Get.showSnackbar(GetSnackBar(message: "Too many points, please zoom in",));
|
||||
}
|
||||
if (value.collection.isNotEmpty) {
|
||||
if (value.features.isNotEmpty) {
|
||||
////print("---- added---");
|
||||
locations.add(value);
|
||||
}
|
||||
@ -340,15 +339,18 @@ class IndexController extends GetxController {
|
||||
currentBound.add(bounds);
|
||||
}
|
||||
|
||||
GeoJsonFeature? getFeatureForLatLong(double lat, double long) {
|
||||
GeoJSONFeature? getFeatureForLatLong(double lat, double long) {
|
||||
if (locations.isNotEmpty) {
|
||||
for (GeoJsonFeature i in locations[0].collection) {
|
||||
GeoJsonMultiPoint p = i.geometry as GeoJsonMultiPoint;
|
||||
if (p.geoSerie!.geoPoints[0].latitude == lat &&
|
||||
p.geoSerie!.geoPoints[0].longitude == long) {
|
||||
return i;
|
||||
GeoJSONFeature? foundFeature;
|
||||
|
||||
locations[0].features.forEach((i) {
|
||||
GeoJSONMultiPoint p = i!.geometry as GeoJSONMultiPoint;
|
||||
if (p.coordinates[0][1] == lat && p.coordinates[0][0] == long) {
|
||||
foundFeature = i;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return foundFeature;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user