84 lines
3.3 KiB
Dart
84 lines
3.3 KiB
Dart
import 'package:get/get.dart';
|
|
import 'package:intaleq_maps/intaleq_maps.dart';
|
|
import '../models/military_operations_models.dart';
|
|
|
|
/// ============================================================================
|
|
/// [SymbolsController] - وحدة التحكم بالرموز والتشكيلات العسكرية
|
|
/// ============================================================================
|
|
/// English:
|
|
/// GetX Controller managing Mil-Std-2525C tactical military symbology palette,
|
|
/// interactive placement on the map canvas, echelon levels, and unit lists.
|
|
///
|
|
/// العربية:
|
|
/// متحكم GetX لإدارة لوحة الرموز العسكرية القياسية (Mil-Std-2525C)،
|
|
/// وتثبيت الوحدات الميدانية والصديقة والمعادية على الخريطة التكتيكية.
|
|
/// ============================================================================
|
|
class SymbolsController extends GetxController {
|
|
// ── Observables / الحالات التفاعلية ──────────────────────────────────────
|
|
final Rx<TacticalSymbolType?> activePlacementType = Rx<TacticalSymbolType?>(null);
|
|
final RxList<TacticalSymbolItem> placedSymbols = <TacticalSymbolItem>[
|
|
TacticalSymbolItem(
|
|
id: 'sym-default-1',
|
|
name: 'كتيبة المشاة الآلية 4',
|
|
type: TacticalSymbolType.friendlyInfantry,
|
|
position: const LatLng(31.9800, 35.8800),
|
|
echelon: MilitaryEchelon.battalion,
|
|
),
|
|
TacticalSymbolItem(
|
|
id: 'sym-default-2',
|
|
name: 'مربض مدفعية M109',
|
|
type: TacticalSymbolType.friendlyArtillery,
|
|
position: const LatLng(31.9300, 35.9100),
|
|
echelon: MilitaryEchelon.battalion,
|
|
),
|
|
TacticalSymbolItem(
|
|
id: 'sym-default-3',
|
|
name: 'رادار كشف تكتيكي',
|
|
type: TacticalSymbolType.friendlyRadar,
|
|
position: const LatLng(32.0200, 35.8400),
|
|
echelon: MilitaryEchelon.company,
|
|
),
|
|
].obs;
|
|
|
|
/// Select Symbol for Map Placement Mode / اختيار رمز لتثبيته على الخريطة
|
|
void selectSymbolForPlacement(TacticalSymbolType type) {
|
|
activePlacementType.value = type;
|
|
}
|
|
|
|
/// Cancel Placement Mode / إلغاء وضع التثبيت
|
|
void cancelPlacement() {
|
|
activePlacementType.value = null;
|
|
}
|
|
|
|
/// Place Unit at Coordinate / تثبيت الرمز في موقع جغرافي محدد
|
|
void placeSymbolAt(LatLng position, {String? customName}) {
|
|
if (activePlacementType.value == null) return;
|
|
|
|
final type = activePlacementType.value!;
|
|
final name = customName ?? 'وحدة ميدانية ${placedSymbols.length + 1}';
|
|
|
|
placedSymbols.add(TacticalSymbolItem(
|
|
id: 'sym_${DateTime.now().millisecondsSinceEpoch}',
|
|
name: name,
|
|
type: type,
|
|
position: position,
|
|
));
|
|
|
|
activePlacementType.value = null;
|
|
}
|
|
|
|
/// Remove Placed Symbol / إزالة رمز مثبت من الميدان
|
|
void removeSymbol(String symbolId) {
|
|
placedSymbols.removeWhere((item) => item.id == symbolId);
|
|
}
|
|
|
|
/// Clear All Symbols / مسح كافة الرموز العسكرية
|
|
void clearAll() {
|
|
placedSymbols.clear();
|
|
activePlacementType.value = null;
|
|
}
|
|
|
|
/// Reset / إعادة تعيين
|
|
void reset() => clearAll();
|
|
}
|