cleanup round

This commit is contained in:
stopflock
2025-08-21 19:42:02 -05:00
parent 32507e1646
commit 05de16b2e2
5 changed files with 22 additions and 44 deletions
+7 -2
View File
@@ -70,8 +70,7 @@ class CameraMarkersBuilder {
final markers = <Marker>[
// Camera markers
...cameras
.where((n) => n.coord.latitude != 0 || n.coord.longitude != 0)
.where((n) => n.coord.latitude.abs() <= 90 && n.coord.longitude.abs() <= 180)
.where(_isValidCameraCoordinate)
.map((n) => Marker(
point: n.coord,
width: 24,
@@ -91,4 +90,10 @@ class CameraMarkersBuilder {
return markers;
}
static bool _isValidCameraCoordinate(OsmCameraNode node) {
return (node.coord.latitude != 0 || node.coord.longitude != 0) &&
node.coord.latitude.abs() <= 90 &&
node.coord.longitude.abs() <= 180;
}
}
+15 -5
View File
@@ -28,21 +28,31 @@ class DirectionConesBuilder {
// Add cones for cameras with direction
overlays.addAll(
cameras
.where((n) => n.hasDirection && n.directionDeg != null)
.where((n) => n.coord.latitude != 0 || n.coord.longitude != 0)
.where((n) => n.coord.latitude.abs() <= 90 && n.coord.longitude.abs() <= 180)
.where(_isValidCameraWithDirection)
.map((n) => _buildCone(
n.coord,
n.directionDeg!,
zoom,
isPending: n.tags.containsKey('_pending_upload') &&
n.tags['_pending_upload'] == 'true',
isPending: _isPendingUpload(n),
))
);
return overlays;
}
static bool _isValidCameraWithDirection(OsmCameraNode node) {
return node.hasDirection &&
node.directionDeg != null &&
(node.coord.latitude != 0 || node.coord.longitude != 0) &&
node.coord.latitude.abs() <= 90 &&
node.coord.longitude.abs() <= 180;
}
static bool _isPendingUpload(OsmCameraNode node) {
return node.tags.containsKey('_pending_upload') &&
node.tags['_pending_upload'] == 'true';
}
static Polygon _buildCone(
LatLng origin,
double bearingDeg,