chore: add build artifacts, map assets, and routing data
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
import re
|
||||
|
||||
path = "packages/tactical_app/lib/controllers/tactical_map_controller.dart"
|
||||
with open(path, "r") as f: content = f.read()
|
||||
|
||||
imports = """
|
||||
import '../models/friendly_unit.dart';
|
||||
import '../services/local_network_tracker.dart';
|
||||
"""
|
||||
if "LocalNetworkTrackerService" not in content:
|
||||
content = content.replace("import '../services/offline_los_engine.dart';", "import '../services/offline_los_engine.dart';\n" + imports)
|
||||
|
||||
# Find the line: final NavigationController navigation = Get.find<NavigationController>();
|
||||
service_init = " final LocalNetworkTrackerService tracker = Get.find<LocalNetworkTrackerService>();\n"
|
||||
if "final LocalNetworkTrackerService tracker" not in content:
|
||||
content = content.replace(" final NavigationController navigation = Get.find<NavigationController>();", " final NavigationController navigation = Get.find<NavigationController>();\n" + service_init)
|
||||
|
||||
# Inside initGps, update tracker with my position
|
||||
update_tracker = """ currentCameraCenter.value = currentGpsPosition.value!;
|
||||
|
||||
// Feed live GPS to Blue Force Tracker
|
||||
tracker.updateMyPosition(currentGpsPosition.value!, pos.heading);
|
||||
"""
|
||||
content = content.replace(" currentCameraCenter.value = currentGpsPosition.value!;", update_tracker)
|
||||
|
||||
# Also update tracker in onCameraMove or GPS listener if we had one.
|
||||
# Wait, we only get GPS once in initGps!
|
||||
# We should probably listen to a continuous GPS stream if we want real-time tracking, but for now we update it.
|
||||
|
||||
# Finally, in buildMarkers, we add the friendly units!
|
||||
marker_logic = """
|
||||
// --- Blue Force Tracking (Friendly Units) ---
|
||||
for (final unit in tracker.friendlyUnits.values) {
|
||||
markers.add(
|
||||
Marker(
|
||||
markerId: MarkerId('bft_${unit.deviceId}'),
|
||||
position: unit.position,
|
||||
icon: InlqBitmap.defaultMarkerWithHue(InlqBitmap.hueAzure), // Blue for friendly
|
||||
infoWindow: InfoWindow(
|
||||
title: '${unit.callsign} (${unit.role.name})',
|
||||
snippet: 'آخر ظهور: منذ ${DateTime.now().difference(unit.lastSeen).inSeconds} ثوانٍ',
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
"""
|
||||
|
||||
if "Blue Force Tracking" not in content:
|
||||
content = content.replace(" return markers;", marker_logic + "\n return markers;")
|
||||
|
||||
with open(path, "w") as f: f.write(content)
|
||||
Reference in New Issue
Block a user