mirror of
https://github.com/FoggedLens/deflock-app.git
synced 2026-07-06 04:37:56 +02:00
Remove special "existing tags" profile case; existing tags profile now empty.
This commit is contained in:
@@ -270,6 +270,19 @@ class NodeProfile {
|
||||
/// Used as the default "<Existing tags>" option when editing nodes
|
||||
/// All existing tags will flow through as additionalExistingTags
|
||||
static NodeProfile createExistingTagsProfile(OsmNode node) {
|
||||
// Calculate FOV from existing direction ranges if applicable
|
||||
double? calculatedFov;
|
||||
|
||||
// If node has direction/FOV pairs, check if they all have the same FOV
|
||||
if (node.directionFovPairs.isNotEmpty) {
|
||||
final firstFov = node.directionFovPairs.first.fovDegrees;
|
||||
|
||||
// If all directions have the same FOV, use it for the profile
|
||||
if (node.directionFovPairs.every((df) => df.fovDegrees == firstFov)) {
|
||||
calculatedFov = firstFov;
|
||||
}
|
||||
}
|
||||
|
||||
return NodeProfile(
|
||||
id: 'temp-empty-${node.id}',
|
||||
name: '<Existing tags>', // Will be localized in UI
|
||||
@@ -278,6 +291,7 @@ class NodeProfile {
|
||||
requiresDirection: true,
|
||||
submittable: true,
|
||||
editable: false,
|
||||
fov: calculatedFov, // Use calculated FOV from existing direction ranges
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -319,9 +319,9 @@ class SessionState extends ChangeNotifier {
|
||||
|
||||
dirty = true;
|
||||
}
|
||||
// Only update operator profile if explicitly provided or different from current
|
||||
if (operatorProfile != null && operatorProfile != _editSession!.operatorProfile) {
|
||||
_editSession!.operatorProfile = operatorProfile;
|
||||
// Only update operator profile if explicitly provided (including null) and different from current
|
||||
if (operatorProfile != _editSession!.operatorProfile) {
|
||||
_editSession!.operatorProfile = operatorProfile; // This can be null
|
||||
dirty = true;
|
||||
}
|
||||
if (target != null && target != _editSession!.target) {
|
||||
|
||||
@@ -154,40 +154,28 @@ class _EditNodeSheetState extends State<EditNodeSheet> {
|
||||
|
||||
/// Check if the edit session has any actual changes compared to the original node
|
||||
bool _hasActualChanges(EditNodeSession session) {
|
||||
debugPrint('EditNodeSheet: Checking for actual changes...');
|
||||
|
||||
// Extract operation is always a change
|
||||
if (session.extractFromWay) {
|
||||
debugPrint('EditNodeSheet: Extract operation detected - changes found');
|
||||
return true;
|
||||
}
|
||||
if (session.extractFromWay) return true;
|
||||
|
||||
// Check location change
|
||||
const double tolerance = 0.0000001; // ~1cm precision
|
||||
if ((session.target.latitude - session.originalNode.coord.latitude).abs() > tolerance ||
|
||||
(session.target.longitude - session.originalNode.coord.longitude).abs() > tolerance) {
|
||||
debugPrint('EditNodeSheet: Location change detected - changes found');
|
||||
return true;
|
||||
}
|
||||
|
||||
// Check direction changes
|
||||
if (!_directionsEqual(session.directions, session.originalNode.directionDeg)) {
|
||||
debugPrint('EditNodeSheet: Direction change detected - changes found');
|
||||
return true;
|
||||
}
|
||||
|
||||
// Check tag changes (including operator profile)
|
||||
// Check tag changes (including operator profile and additional existing tags)
|
||||
final originalTags = session.originalNode.tags;
|
||||
final newTags = _getSessionCombinedTags(session);
|
||||
debugPrint('EditNodeSheet: Original tags: $originalTags');
|
||||
debugPrint('EditNodeSheet: New combined tags: $newTags');
|
||||
|
||||
if (!_tagsEqual(originalTags, newTags)) {
|
||||
debugPrint('EditNodeSheet: Tag changes detected - changes found');
|
||||
return true;
|
||||
}
|
||||
|
||||
debugPrint('EditNodeSheet: No changes detected');
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -513,11 +501,6 @@ class _EditNodeSheetState extends State<EditNodeSheet> {
|
||||
),
|
||||
);
|
||||
if (result != null) {
|
||||
debugPrint('EditNodeSheet: Updating session from refine tags result');
|
||||
debugPrint('EditNodeSheet: Profile: ${session.profile?.name}');
|
||||
debugPrint('EditNodeSheet: AdditionalExistingTags: ${result.additionalExistingTags}');
|
||||
debugPrint('EditNodeSheet: Current session additionalExistingTags: ${session.additionalExistingTags}');
|
||||
|
||||
appState.updateEditSession(
|
||||
operatorProfile: result.operatorProfile,
|
||||
refinedTags: result.refinedTags,
|
||||
|
||||
@@ -101,7 +101,6 @@ class _RefineTagsSheetState extends State<RefineTagsSheet> {
|
||||
// Use the additional existing tags calculated by SessionState when profile changed
|
||||
if (widget.currentAdditionalExistingTags != null) {
|
||||
_additionalExistingTags = widget.currentAdditionalExistingTags!.entries.toList();
|
||||
debugPrint('RefineTagsSheet: Loaded ${_additionalExistingTags.length} additional existing tags from session');
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -130,8 +129,6 @@ class _RefineTagsSheetState extends State<RefineTagsSheet> {
|
||||
// Include this tag as an additional existing tag
|
||||
_additionalExistingTags.add(MapEntry(key, value));
|
||||
}
|
||||
|
||||
debugPrint('RefineTagsSheet: Fallback calculated ${_additionalExistingTags.length} additional existing tags');
|
||||
}
|
||||
|
||||
/// Check if a tag should be skipped from additional existing tags
|
||||
@@ -203,11 +200,6 @@ class _RefineTagsSheetState extends State<RefineTagsSheet> {
|
||||
? Map<String, String>.fromEntries(_additionalExistingTags.where((e) => e.key.isNotEmpty))
|
||||
: null;
|
||||
|
||||
debugPrint('RefineTagsSheet: Returning result');
|
||||
debugPrint('RefineTagsSheet: additionalTags: $additionalTags');
|
||||
debugPrint('RefineTagsSheet: _additionalExistingTags: $_additionalExistingTags');
|
||||
debugPrint('RefineTagsSheet: _shouldShowAdditionalExistingTags: $_shouldShowAdditionalExistingTags');
|
||||
|
||||
Navigator.pop(context, RefineTagsResult(
|
||||
operatorProfile: _selectedOperatorProfile,
|
||||
refinedTags: _refinedTags,
|
||||
|
||||
Reference in New Issue
Block a user