47 lines
2.2 KiB
Dart
47 lines
2.2 KiB
Dart
import 'package:get/get.dart';
|
|
import '../models/landmark.dart';
|
|
import '../services/resection_calculator.dart';
|
|
|
|
/// ============================================================================
|
|
/// [ResectionController] - وحدة التحكم بالتقاطع البصري العكسي (GPS-Denied Fix)
|
|
/// ============================================================================
|
|
/// English:
|
|
/// GetX Controller managing camera-based optical resection observations,
|
|
/// magnetic azimuth readings, and inverse triangulation coordinate resolution.
|
|
///
|
|
/// العربية:
|
|
/// متحكم GetX لإدارة عملية التقاطع البصري العكسي عبر الكاميرا والبوصلة المغناطيسية،
|
|
/// واستخراج إحداثيات الموقع بدقة عند انقطاع الـ GPS أو التشويش الإلكتروني.
|
|
/// ============================================================================
|
|
class ResectionController extends GetxController {
|
|
// ── Observables / الحالات التفاعلية ──────────────────────────────────────
|
|
final RxList<ResectionObservation> observations = <ResectionObservation>[].obs;
|
|
final Rx<ResectionResult?> resectionResult = Rx<ResectionResult?>(null);
|
|
final RxDouble currentHeadingDeg = 0.0.obs;
|
|
|
|
/// Add Observation / إضافة رصد اتجاهي لمعلم جغرافي
|
|
void addObservation(ResectionObservation obs) {
|
|
observations.removeWhere((o) => o.landmark.id == obs.landmark.id);
|
|
observations.add(obs);
|
|
}
|
|
|
|
/// Remove Observation / إزالة رصد معلم معين
|
|
void removeObservation(String landmarkId) {
|
|
observations.removeWhere((o) => o.landmark.id == landmarkId);
|
|
}
|
|
|
|
/// Compute Position from Observations / استخراج الإحداثيات بالتقاطع العكسي
|
|
ResectionResult? computePosition() {
|
|
if (observations.length < 2) return null;
|
|
final res = ResectionCalculator.calculatePosition(observations);
|
|
resectionResult.value = res;
|
|
return res;
|
|
}
|
|
|
|
/// Reset all observations / تصفير وإعادة ضبط الرصد
|
|
void reset() {
|
|
observations.clear();
|
|
resectionResult.value = null;
|
|
}
|
|
}
|