Tracking funkció fejlesztése
This commit is contained in:
@@ -29,6 +29,7 @@ import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:terepi_seged/pages/map_survey/presentations/views/measured_points_table_dialog.dart';
|
||||
import 'package:terepi_seged/pages/ntrip_settings/presentation/controllers/ntrip_settings_controller.dart';
|
||||
import 'package:terepi_seged/pages/ntrip_settings/presentation/views/ntrip_settings_sheet.dart';
|
||||
import 'package:terepi_seged/pages/tracking/presentation/controllers/tracking_controller.dart';
|
||||
import 'package:terepi_seged/services/coord_converter_service.dart';
|
||||
import 'package:terepi_seged/services/gnss/gnss_connection.dart';
|
||||
import 'package:terepi_seged/services/gnss/gnss_device_service.dart';
|
||||
@@ -285,6 +286,18 @@ class MapSurveyController extends GetxController {
|
||||
}
|
||||
|
||||
void setMode(MapSurveyMode newMode) {
|
||||
if (mode.value == MapSurveyMode.track &&
|
||||
newMode != MapSurveyMode.track &&
|
||||
TrackingController.to.isRecording.value) {
|
||||
Get.snackbar(
|
||||
'Rögzítés folytatódik',
|
||||
'A track rögzítés a háttérben aktív marad.',
|
||||
icon: const Icon(Icons.fiber_manual_record, color: Colors.red),
|
||||
duration: const Duration(seconds: 3),
|
||||
snackPosition: SnackPosition.TOP,
|
||||
);
|
||||
}
|
||||
|
||||
mode.value = newMode;
|
||||
|
||||
// Itt lehet módhoz kötött állapotokat állítani:
|
||||
@@ -294,31 +307,21 @@ class MapSurveyController extends GetxController {
|
||||
// - track indítás/leállítás figyelmeztetés stb.
|
||||
}
|
||||
|
||||
String get currentModeLabel {
|
||||
switch (mode.value) {
|
||||
case MapSurveyMode.browse:
|
||||
return 'Térkép';
|
||||
case MapSurveyMode.measure:
|
||||
return 'Bemérés';
|
||||
case MapSurveyMode.stakeout:
|
||||
return 'Kitűzés';
|
||||
case MapSurveyMode.fieldWalk:
|
||||
return 'Bejárás';
|
||||
}
|
||||
}
|
||||
String get currentModeLabel => switch (mode.value) {
|
||||
MapSurveyMode.browse => 'Térkép',
|
||||
MapSurveyMode.measure => 'Bemérés',
|
||||
MapSurveyMode.stakeout => 'Kitűzés',
|
||||
MapSurveyMode.fieldWalk => 'Bejárás',
|
||||
MapSurveyMode.track => 'Útvonal'
|
||||
};
|
||||
|
||||
IconData get currentModeIcon {
|
||||
switch (mode.value) {
|
||||
case MapSurveyMode.browse:
|
||||
return Icons.map;
|
||||
case MapSurveyMode.measure:
|
||||
return Icons.add_location_alt;
|
||||
case MapSurveyMode.stakeout:
|
||||
return Icons.gps_fixed;
|
||||
case MapSurveyMode.fieldWalk:
|
||||
return Icons.hiking;
|
||||
}
|
||||
}
|
||||
IconData get currentModeIcon => switch (mode.value) {
|
||||
MapSurveyMode.browse => Icons.map,
|
||||
MapSurveyMode.measure => Icons.add_location_alt,
|
||||
MapSurveyMode.stakeout => Icons.gps_fixed,
|
||||
MapSurveyMode.fieldWalk => Icons.hiking,
|
||||
MapSurveyMode.track => Icons.route
|
||||
};
|
||||
|
||||
void openNtripsettings() {
|
||||
if (!Get.isRegistered<NtripSettingsController>()) {
|
||||
|
||||
@@ -6,6 +6,7 @@ import 'package:latlong2/latlong.dart';
|
||||
import 'package:terepi_seged/enums/map_survey_mode.dart';
|
||||
import 'package:terepi_seged/pages/map_survey/presentations/controllers/map_survey_controller.dart';
|
||||
import 'package:terepi_seged/pages/map_survey/presentations/views/settings_dialog.dart';
|
||||
import 'package:terepi_seged/pages/tracking/presentation/controllers/tracking_controller.dart';
|
||||
import 'package:terepi_seged/utils/rive_utils.dart';
|
||||
import 'package:terepi_seged/widgets/coordinate_panel.dart';
|
||||
import 'package:terepi_seged/widgets/map_bottom_panel.dart';
|
||||
@@ -29,7 +30,18 @@ class MapSurveyView extends GetView<MapSurveyController> {
|
||||
onCenterOnGps: controller.isMapMoveToCenter,
|
||||
layers: [
|
||||
Obx(() =>
|
||||
MarkerLayer(markers: controller.currentLocationMarker.toList()))
|
||||
MarkerLayer(markers: controller.currentLocationMarker.toList())),
|
||||
|
||||
// Track polyline
|
||||
Obx(() {
|
||||
final isTracking = TrackingController.to.isRecording.value;
|
||||
final inTrackMode = controller.mode.value == MapSurveyMode.track;
|
||||
if (!isTracking && !inTrackMode) {
|
||||
return const SizedBox.shrink();
|
||||
} else {
|
||||
return _buildTrackLayer();
|
||||
}
|
||||
})
|
||||
],
|
||||
),
|
||||
Positioned(
|
||||
@@ -78,6 +90,23 @@ class MapSurveyView extends GetView<MapSurveyController> {
|
||||
// child: MapBottomPanel(controller: controller))
|
||||
]);
|
||||
}
|
||||
|
||||
Widget _buildTrackLayer() {
|
||||
// FutureBuilder helyett a controller livePoints-ból
|
||||
return Obx(() {
|
||||
final ctrl = TrackingController.to;
|
||||
if (ctrl.livePoints.isEmpty) return const SizedBox.shrink();
|
||||
return PolylineLayer(polylines: [
|
||||
Polyline(
|
||||
points: ctrl.livePoints
|
||||
.map((p) => LatLng(p.latitude, p.longitude))
|
||||
.toList(),
|
||||
color: Colors.red.withOpacity(0.85),
|
||||
strokeWidth: 3.0,
|
||||
),
|
||||
]);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
class _ModeSelector extends GetView<MapSurveyController> {
|
||||
|
||||
Reference in New Issue
Block a user