Multiple cameras on one pole

This commit is contained in:
stopflock
2025-10-29 12:17:16 -05:00
parent 1993714752
commit d9f415c527
9 changed files with 409 additions and 103 deletions
+23 -13
View File
@@ -32,23 +32,33 @@ class OsmNode {
);
}
bool get hasDirection =>
tags.containsKey('direction') || tags.containsKey('camera:direction');
bool get hasDirection => directionDeg.isNotEmpty;
double? get directionDeg {
List<double> get directionDeg {
final raw = tags['direction'] ?? tags['camera:direction'];
if (raw == null) return null;
if (raw == null) return [];
// Keep digits, optional dot, optional leading sign.
final match = RegExp(r'[-+]?\d*\.?\d+').firstMatch(raw);
if (match == null) return null;
// Split on semicolons and parse each direction
final directions = <double>[];
final parts = raw.split(';');
for (final part in parts) {
final trimmed = part.trim();
if (trimmed.isEmpty) continue;
// Keep digits, optional dot, optional leading sign
final match = RegExp(r'[-+]?\d*\.?\d+').firstMatch(trimmed);
if (match == null) continue;
final numStr = match.group(0);
final val = double.tryParse(numStr ?? '');
if (val == null) return null;
final numStr = match.group(0);
final val = double.tryParse(numStr ?? '');
if (val == null) continue;
// Normalize: wrap negative or >360 into 0‑359 range.
final normalized = ((val % 360) + 360) % 360;
return normalized;
// Normalize: wrap negative or >360 into 0‑359 range
final normalized = ((val % 360) + 360) % 360;
directions.add(normalized);
}
return directions;
}
}
+8 -2
View File
@@ -7,7 +7,7 @@ enum UploadOperation { create, modify, delete }
class PendingUpload {
final LatLng coord;
final double direction;
final dynamic direction; // Can be double or String for multiple directions
final NodeProfile? profile;
final OperatorProfile? operatorProfile;
final UploadMode uploadMode; // Capture upload destination when queued
@@ -74,7 +74,13 @@ class PendingUpload {
// Add direction if required
if (profile!.requiresDirection) {
tags['direction'] = direction.toStringAsFixed(0);
if (direction is String) {
tags['direction'] = direction;
} else if (direction is double) {
tags['direction'] = direction.toStringAsFixed(0);
} else {
tags['direction'] = '0';
}
}
return tags;