Jármű navigáció @3h

This commit is contained in:
2026-07-13 07:58:51 +02:00
parent 4bf73c6cc7
commit 0810c528ec
12 changed files with 1374 additions and 3 deletions
+91
View File
@@ -0,0 +1,91 @@
import 'package:uuid/uuid.dart';
/// Érzékelő-csatorna: a MŰSZER geometriája — melyik csatornaszám melyik
/// vonal/állomás fizikai pontjához tartozik.
///
/// SZÁNDÉKOSAN önálló modell (nem a StakeoutPoint kiterjesztése): az
/// adat forrása lehet SPS-import (a műszer geometria-exportja), de
/// származhat máshonnan is (kézi rögzítés, jövőbeli más formátum).
/// A kitűzési (GNSS-szel mért) pontokkal a (lineId, station) párossal
/// vetjük össze FUTÁSIDŐBEN (lásd StakeoutService), nem tárolunk
/// másolatot a mért pozícióból — így sosem megy szét a két adat.
class SensorChannel {
final int? id;
final String uuid;
final int projectId;
final int channel;
final String lineId;
final int station;
/// Terv-pozíció az SPS R-fájlból (ha volt hozzá tartozó vevőpont-sor).
/// Null, ha csak a csatorna-hozzárendelés ismert (pl. csak X-fájl volt),
/// ilyenkor a GNSS-mért kitűzési pont adja az egyetlen pozíciót.
final double? planEovY;
final double? planEovX;
final double? planLat;
final double? planLon;
final String source; // 'sps' | 'manual'
final String? importBatch; // egy import-menet azonosítója (törléshez)
final DateTime createdAt;
final DateTime updatedAt;
SensorChannel({
this.id,
String? uuid,
required this.projectId,
required this.channel,
required this.lineId,
required this.station,
this.planEovY,
this.planEovX,
this.planLat,
this.planLon,
this.source = 'sps',
this.importBatch,
DateTime? createdAt,
DateTime? updatedAt,
}) : uuid = uuid ?? const Uuid().v4(),
createdAt = createdAt ?? DateTime.now(),
updatedAt = updatedAt ?? DateTime.now();
bool get hasPlanPosition => planEovY != null && planEovX != null;
Map<String, dynamic> toMap() => {
if (id != null) 'id': id,
'uuid': uuid,
'project_id': projectId,
'channel': channel,
'line_id': lineId,
'station': station,
'plan_eov_y': planEovY,
'plan_eov_x': planEovX,
'plan_lat': planLat,
'plan_lon': planLon,
'source': source,
'import_batch': importBatch,
'created_at': createdAt.toIso8601String(),
'updated_at': updatedAt.toIso8601String(),
};
factory SensorChannel.fromMap(Map<String, dynamic> m) => SensorChannel(
id: m['id'] as int?,
uuid: m['uuid'] as String,
projectId: m['project_id'] as int,
channel: m['channel'] as int,
lineId: (m['line_id'] as String?) ?? '',
station: m['station'] as int,
planEovY: (m['plan_eov_y'] as num?)?.toDouble(),
planEovX: (m['plan_eov_x'] as num?)?.toDouble(),
planLat: (m['plan_lat'] as num?)?.toDouble(),
planLon: (m['plan_lon'] as num?)?.toDouble(),
source: (m['source'] as String?) ?? 'sps',
importBatch: m['import_batch'] as String?,
createdAt: DateTime.tryParse((m['created_at'] as String?) ?? '') ??
DateTime.now(),
updatedAt: DateTime.tryParse((m['updated_at'] as String?) ?? '') ??
DateTime.now(),
);
}
+74
View File
@@ -0,0 +1,74 @@
import 'package:uuid/uuid.dart';
/// Forráspont (vibrátor-állomás) — az SPS S-fájlból importált TERV-pozíció.
///
/// Tisztán referencia-réteg: nincs "kijelölve/meglőve" mutálható állapota
/// (a döntés szerint a tényleges ellenőrzés a periodikus pozíciónapló és
/// a terv UTÓLAGOS összevetéséből adódik — lásd VibratorNavController).
class SourcePoint {
final int? id;
final String uuid;
final int projectId;
final String lineId;
final int station; // VP (vibration point) szám
final double planEovY;
final double planEovX;
final double planLat;
final double planLon;
final String source; // 'sps'
final String? importBatch;
final DateTime createdAt;
SourcePoint({
this.id,
String? uuid,
required this.projectId,
required this.lineId,
required this.station,
required this.planEovY,
required this.planEovX,
required this.planLat,
required this.planLon,
this.source = 'sps',
this.importBatch,
DateTime? createdAt,
}) : uuid = uuid ?? const Uuid().v4(),
createdAt = createdAt ?? DateTime.now();
String get displayId => '$lineId · $station';
Map<String, dynamic> toMap() => {
if (id != null) 'id': id,
'uuid': uuid,
'project_id': projectId,
'line_id': lineId,
'station': station,
'plan_eov_y': planEovY,
'plan_eov_x': planEovX,
'plan_lat': planLat,
'plan_lon': planLon,
'source': source,
'import_batch': importBatch,
'created_at': createdAt.toIso8601String(),
};
factory SourcePoint.fromMap(Map<String, dynamic> m) => SourcePoint(
id: m['id'] as int?,
uuid: m['uuid'] as String,
projectId: m['project_id'] as int,
lineId: (m['line_id'] as String?) ?? '',
station: m['station'] as int,
planEovY: (m['plan_eov_y'] as num).toDouble(),
planEovX: (m['plan_eov_x'] as num).toDouble(),
planLat: (m['plan_lat'] as num).toDouble(),
planLon: (m['plan_lon'] as num).toDouble(),
source: (m['source'] as String?) ?? 'sps',
importBatch: m['import_batch'] as String?,
createdAt: DateTime.tryParse((m['created_at'] as String?) ?? '') ??
DateTime.now(),
);
}
+87
View File
@@ -0,0 +1,87 @@
import 'package:uuid/uuid.dart';
/// Periodikus járműpozíció-minta — a navigációs oldal a beállított
/// időközönként ide ment egy sort, amíg a rögzítés fut. Ebből (és a
/// SourcePoint terv-pozíciókból) számítható utólag, mely forráspontok
/// mellett járt ténylegesen a jármű.
class VehiclePositionLog {
final int? id;
final String uuid;
final int projectId;
final String vehicleId; // pl. "V1" / "V2" / "V3"
final double eovY;
final double eovX;
final double lat;
final double lon;
final double? altitude;
final double? speedKmh;
final double? heading;
final int? fixQuality;
final double? accuracy;
final DateTime timestamp;
final String? deviceId;
final String? appInstanceId;
VehiclePositionLog({
this.id,
String? uuid,
required this.projectId,
required this.vehicleId,
required this.eovY,
required this.eovX,
required this.lat,
required this.lon,
this.altitude,
this.speedKmh,
this.heading,
this.fixQuality,
this.accuracy,
DateTime? timestamp,
this.deviceId,
this.appInstanceId,
}) : uuid = uuid ?? const Uuid().v4(),
timestamp = timestamp ?? DateTime.now();
Map<String, dynamic> toMap() => {
if (id != null) 'id': id,
'uuid': uuid,
'project_id': projectId,
'vehicle_id': vehicleId,
'eov_y': eovY,
'eov_x': eovX,
'lat': lat,
'lon': lon,
'altitude': altitude,
'speed_kmh': speedKmh,
'heading': heading,
'fix_quality': fixQuality,
'accuracy': accuracy,
'timestamp': timestamp.toIso8601String(),
'device_id': deviceId,
'app_instance_id': appInstanceId,
};
factory VehiclePositionLog.fromMap(Map<String, dynamic> m) =>
VehiclePositionLog(
id: m['id'] as int?,
uuid: m['uuid'] as String,
projectId: m['project_id'] as int,
vehicleId: (m['vehicle_id'] as String?) ?? '',
eovY: (m['eov_y'] as num).toDouble(),
eovX: (m['eov_x'] as num).toDouble(),
lat: (m['lat'] as num).toDouble(),
lon: (m['lon'] as num).toDouble(),
altitude: (m['altitude'] as num?)?.toDouble(),
speedKmh: (m['speed_kmh'] as num?)?.toDouble(),
heading: (m['heading'] as num?)?.toDouble(),
fixQuality: m['fix_quality'] as int?,
accuracy: (m['accuracy'] as num?)?.toDouble(),
timestamp: DateTime.tryParse((m['timestamp'] as String?) ?? '') ??
DateTime.now(),
deviceId: m['device_id'] as String?,
appInstanceId: m['app_instance_id'] as String?,
);
}