NSI and tag refinement

This commit is contained in:
stopflock
2025-12-10 12:52:20 -06:00
parent 6ed30dcff8
commit e6b18bf89b
26 changed files with 679 additions and 43 deletions
+11
View File
@@ -9,6 +9,13 @@ class ProfileState extends ChangeNotifier {
final List<NodeProfile> _profiles = [];
final Set<NodeProfile> _enabled = {};
// Callback for when a profile is deleted (used to clear stale sessions)
void Function(NodeProfile)? _onProfileDeleted;
void setProfileDeletedCallback(void Function(NodeProfile) callback) {
_onProfileDeleted = callback;
}
// Getters
List<NodeProfile> get profiles => List.unmodifiable(_profiles);
@@ -78,6 +85,10 @@ class ProfileState extends ChangeNotifier {
}
_saveEnabledProfiles();
ProfileService().save(_profiles);
// Notify about profile deletion so other parts can clean up
_onProfileDeleted?.call(p);
notifyListeners();
}
+18 -2
View File
@@ -12,14 +12,17 @@ class AddNodeSession {
LatLng? target;
List<double> directions; // All directions [90, 180, 270]
int currentDirectionIndex; // Which direction we're editing (e.g. 1 = editing the 180°)
Map<String, String> refinedTags; // User-selected values for empty profile tags
AddNodeSession({
this.profile,
double initialDirection = 0,
this.operatorProfile,
this.target,
Map<String, String>? refinedTags,
}) : directions = [initialDirection],
currentDirectionIndex = 0;
currentDirectionIndex = 0,
refinedTags = refinedTags ?? {};
// Slider always shows the current direction being edited
double get directionDegrees => directions[currentDirectionIndex];
@@ -35,6 +38,7 @@ class EditNodeSession {
List<double> directions; // All directions [90, 180, 270]
int currentDirectionIndex; // Which direction we're editing (e.g. 1 = editing the 180°)
bool extractFromWay; // True if user wants to extract this constrained node
Map<String, String> refinedTags; // User-selected values for empty profile tags
EditNodeSession({
required this.originalNode,
@@ -42,8 +46,10 @@ class EditNodeSession {
required double initialDirection,
required this.target,
this.extractFromWay = false,
Map<String, String>? refinedTags,
}) : directions = [initialDirection],
currentDirectionIndex = 0;
currentDirectionIndex = 0,
refinedTags = refinedTags ?? {};
// Slider always shows the current direction being edited
double get directionDegrees => directions[currentDirectionIndex];
@@ -112,6 +118,7 @@ class SessionState extends ChangeNotifier {
NodeProfile? profile,
OperatorProfile? operatorProfile,
LatLng? target,
Map<String, String>? refinedTags,
}) {
if (_session == null) return;
@@ -132,6 +139,10 @@ class SessionState extends ChangeNotifier {
_session!.target = target;
dirty = true;
}
if (refinedTags != null) {
_session!.refinedTags = Map<String, String>.from(refinedTags);
dirty = true;
}
if (dirty) notifyListeners();
}
@@ -141,6 +152,7 @@ class SessionState extends ChangeNotifier {
OperatorProfile? operatorProfile,
LatLng? target,
bool? extractFromWay,
Map<String, String>? refinedTags,
}) {
if (_editSession == null) return;
@@ -174,6 +186,10 @@ class SessionState extends ChangeNotifier {
}
dirty = true;
}
if (refinedTags != null) {
_editSession!.refinedTags = Map<String, String>.from(refinedTags);
dirty = true;
}
if (dirty) notifyListeners();
+2
View File
@@ -124,6 +124,7 @@ class UploadQueueState extends ChangeNotifier {
direction: _formatDirectionsForSubmission(session.directions, session.profile),
profile: session.profile!, // Safe to use ! because commitSession() checks for null
operatorProfile: session.operatorProfile,
refinedTags: session.refinedTags,
uploadMode: uploadMode,
operation: UploadOperation.create,
);
@@ -180,6 +181,7 @@ class UploadQueueState extends ChangeNotifier {
direction: _formatDirectionsForSubmission(session.directions, session.profile),
profile: session.profile!, // Safe to use ! because commitEditSession() checks for null
operatorProfile: session.operatorProfile,
refinedTags: session.refinedTags,
uploadMode: uploadMode,
operation: operation,
originalNodeId: session.originalNode.id, // Track which node we're editing