From c057956fcdf5ab751262c5099457c7a603015f2d Mon Sep 17 00:00:00 2001 From: stopflock Date: Thu, 7 Aug 2025 21:12:30 -0500 Subject: [PATCH] file structure and initial map_data scaffold --- lib/services/map_data.dart | 29 +++++++++++++++++++++ lib/services/map_data/cams_from_local.dart | 0 lib/services/map_data/cams_from_osm.dart | 0 lib/services/map_data/tiles_from_local.dart | 0 lib/services/map_data/tiles_from_osm.dart | 0 5 files changed, 29 insertions(+) create mode 100644 lib/services/map_data.dart create mode 100644 lib/services/map_data/cams_from_local.dart create mode 100644 lib/services/map_data/cams_from_osm.dart create mode 100644 lib/services/map_data/tiles_from_local.dart create mode 100644 lib/services/map_data/tiles_from_osm.dart diff --git a/lib/services/map_data.dart b/lib/services/map_data.dart new file mode 100644 index 0000000..50166cf --- /dev/null +++ b/lib/services/map_data.dart @@ -0,0 +1,29 @@ +import 'dart:typed_data'; +import 'package:latlong2/latlong.dart'; +import 'package:flutter_map/flutter_map.dart' show LatLngBounds; +import '../models/osm_camera_node.dart'; + +/// Central provider for map tiles and camera data, abstracting local/disk and remote/OSM fetches. +class MapDataProvider { + static final MapDataProvider _instance = MapDataProvider._(); + factory MapDataProvider() => _instance; + MapDataProvider._(); + + /// Returns tile bytes for this tile, or null if unavailable (when [allowRemote] is false and not found offline) + /// [preferLocal]: try disk cache first + /// [allowRemote]: if true, will request OSM server if tile not on disk and not in offline mode + Future getTile(int z, int x, int y, + {bool preferLocal = true, bool allowRemote = true}) async { + // Scaffold: real logic will go here + throw UnimplementedError('getTile needs implementation'); + } + + /// Returns camera nodes for a given bounding box. + /// [preferLocal]: try disk cache first + /// [allowRemote]: query Overpass if true (and allowed by offline mode) + Future> getCameras(LatLngBounds bounds, + {bool preferLocal = false, bool allowRemote = true}) async { + // Scaffold: real logic will go here + throw UnimplementedError('getCameras needs implementation'); + } +} diff --git a/lib/services/map_data/cams_from_local.dart b/lib/services/map_data/cams_from_local.dart new file mode 100644 index 0000000..e69de29 diff --git a/lib/services/map_data/cams_from_osm.dart b/lib/services/map_data/cams_from_osm.dart new file mode 100644 index 0000000..e69de29 diff --git a/lib/services/map_data/tiles_from_local.dart b/lib/services/map_data/tiles_from_local.dart new file mode 100644 index 0000000..e69de29 diff --git a/lib/services/map_data/tiles_from_osm.dart b/lib/services/map_data/tiles_from_osm.dart new file mode 100644 index 0000000..e69de29