maxCameras->maxNodes, default from dev_config

This commit is contained in:
stopflock
2025-12-02 15:50:11 -06:00
parent 4d5a078378
commit c81014d530
7 changed files with 25 additions and 22 deletions

View File

@@ -3,7 +3,9 @@
"content": [
"• OSM message notifications - dot appears on Settings button and OSM Account section when you have unread messages on OpenStreetMap",
"• Download area max zoom level is now limited to the currently selected tile provider's maximum zoom level",
"• Navigation route planning now prevents selecting start and end locations that are too close together"
"• Navigation route planning now prevents selecting start and end locations that are too close together",
"• Max nodes setting now uses configurable default from dev_config.dart (250 nodes)",
"• Cleaned up internal 'maxCameras' references to use 'maxNodes' terminology consistently"
]
},
"1.5.3": {

View File

@@ -142,7 +142,7 @@ class AppState extends ChangeNotifier {
// Settings state
bool get offlineMode => _settingsState.offlineMode;
bool get pauseQueueProcessing => _settingsState.pauseQueueProcessing;
int get maxCameras => _settingsState.maxCameras;
int get maxNodes => _settingsState.maxNodes;
UploadMode get uploadMode => _settingsState.uploadMode;
FollowMeMode get followMeMode => _settingsState.followMeMode;
@@ -567,8 +567,8 @@ class AppState extends ChangeNotifier {
}
}
set maxCameras(int n) {
_settingsState.maxCameras = n;
set maxNodes(int n) {
_settingsState.maxNodes = n;
}
Future<void> setUploadMode(UploadMode mode) async {

View File

@@ -127,6 +127,9 @@ const double kNodeProximityWarningDistance = 15.0; // meters - distance threshol
// Navigation route planning configuration
const double kNavigationMinRouteDistance = 100.0; // meters - minimum distance between start and end points
// Node display configuration
const int kDefaultMaxNodes = 500; // Default maximum number of nodes to render on the map at once
// Map interaction configuration
const double kNodeDoubleTapZoomDelta = 1.0; // How much to zoom in when double-tapping nodes (was 1.0)
const double kScrollWheelVelocity = 0.01; // Mouse scroll wheel zoom speed (default 0.005)

View File

@@ -16,7 +16,7 @@ class _MaxNodesSectionState extends State<MaxNodesSection> {
@override
void initState() {
super.initState();
final maxNodes = context.read<AppState>().maxCameras;
final maxNodes = context.read<AppState>().maxNodes;
_controller = TextEditingController(text: maxNodes.toString());
}
@@ -33,7 +33,7 @@ class _MaxNodesSectionState extends State<MaxNodesSection> {
builder: (context, child) {
final locService = LocalizationService.instance;
final appState = context.watch<AppState>();
final current = appState.maxCameras;
final current = appState.maxNodes;
final showWarning = current > 1000;
return Column(
@@ -79,8 +79,8 @@ class _MaxNodesSectionState extends State<MaxNodesSection> {
),
onFieldSubmitted: (value) {
final n = int.tryParse(value) ?? 10;
appState.maxCameras = n;
_controller.text = appState.maxCameras.toString();
appState.maxNodes = n;
_controller.text = appState.maxNodes.toString();
},
),
),

View File

@@ -96,7 +96,7 @@ class MapDataProvider {
final localNodes = await fetchLocalNodes(
bounds: bounds,
profiles: profiles,
maxNodes: AppState.instance.maxCameras,
maxNodes: AppState.instance.maxNodes,
);
// Check if we need to trigger a new pre-fetch (spatial or temporal)
@@ -123,7 +123,7 @@ class MapDataProvider {
}
/// Bulk/paged node fetch for offline downloads (handling paging, dedup, and Overpass retries)
/// Only use for offline area download, not for map browsing! Ignores maxCameras config.
/// Only use for offline area download, not for map browsing! Ignores maxNodes config.
Future<List<OsmNode>> getAllNodesForDownload({
required LatLngBounds bounds,
required List<NodeProfile> profiles,

View File

@@ -18,7 +18,7 @@ enum FollowMeMode {
class SettingsState extends ChangeNotifier {
static const String _offlineModePrefsKey = 'offline_mode';
static const String _maxCamerasPrefsKey = 'max_cameras';
static const String _maxNodesPrefsKey = 'max_nodes';
static const String _uploadModePrefsKey = 'upload_mode';
static const String _tileProvidersPrefsKey = 'tile_providers';
static const String _selectedTileTypePrefsKey = 'selected_tile_type';
@@ -32,7 +32,7 @@ class SettingsState extends ChangeNotifier {
bool _offlineMode = false;
bool _pauseQueueProcessing = false;
int _maxCameras = 250;
int _maxNodes = kDefaultMaxNodes;
UploadMode _uploadMode = kEnableDevelopmentModes ? UploadMode.simulate : UploadMode.production;
FollowMeMode _followMeMode = FollowMeMode.follow;
bool _proximityAlertsEnabled = false;
@@ -45,7 +45,7 @@ class SettingsState extends ChangeNotifier {
// Getters
bool get offlineMode => _offlineMode;
bool get pauseQueueProcessing => _pauseQueueProcessing;
int get maxCameras => _maxCameras;
int get maxNodes => _maxNodes;
UploadMode get uploadMode => _uploadMode;
FollowMeMode get followMeMode => _followMeMode;
bool get proximityAlertsEnabled => _proximityAlertsEnabled;
@@ -98,10 +98,8 @@ class SettingsState extends ChangeNotifier {
// Load queue processing setting
_pauseQueueProcessing = prefs.getBool(_pauseQueueProcessingPrefsKey) ?? false;
// Load max cameras
if (prefs.containsKey(_maxCamerasPrefsKey)) {
_maxCameras = prefs.getInt(_maxCamerasPrefsKey) ?? 250;
}
// Load max nodes
_maxNodes = prefs.getInt(_maxNodesPrefsKey) ?? kDefaultMaxNodes;
// Load proximity alerts settings
_proximityAlertsEnabled = prefs.getBool(_proximityAlertsEnabledPrefsKey) ?? false;
@@ -225,11 +223,11 @@ class SettingsState extends ChangeNotifier {
notifyListeners();
}
set maxCameras(int n) {
set maxNodes(int n) {
if (n < 10) n = 10; // minimum
_maxCameras = n;
_maxNodes = n;
SharedPreferences.getInstance().then((prefs) {
prefs.setInt(_maxCamerasPrefsKey, n);
prefs.setInt(_maxNodesPrefsKey, n);
});
notifyListeners();
}

View File

@@ -428,7 +428,7 @@ class MapViewState extends State<MapView> {
}).toList();
// Apply rendering limit to prevent UI lag
final maxNodes = appState.maxCameras;
final maxNodes = appState.maxNodes;
if (validNodes.length > maxNodes) {
nodesToRender = validNodes.take(maxNodes).toList();
isLimitActive = true;
@@ -480,7 +480,7 @@ class MapViewState extends State<MapView> {
);
// Apply same node count limit as surveillance nodes
final maxNodes = appState.maxCameras;
final maxNodes = appState.maxNodes;
final limitedSuspectedLocations = suspectedLocations.take(maxNodes).toList();
// Filter out suspected locations that are too close to real nodes