don't duplicate notes which have already been seen

This commit is contained in:
Martin Raifer
2024-01-24 14:53:21 +01:00
parent 0e05705c43
commit aaf89d7755
2 changed files with 16 additions and 10 deletions
+1
View File
@@ -50,6 +50,7 @@ _Breaking developer changes, which may affect downstream projects or sites that
* Show turn restriction editor also when there is only one possible "to" way, as there might exist restrictions with that way as _via_ ([#9983])
* Local photos: Fix bug which prevented the last image from being removed from the map when removed from the list
* Fix wrong mouse cursor on "foreign link" field buttons (for example in the Mapillary or Wikimedia Commons fields) ([#9992], thanks [@ramith-kulal])
* Don't show duplicates of notes when they lie exactly on special locations like null island (0.0,0.0)
#### :earth_asia: Localization
#### :hourglass: Performance
#### :mortar_board: Walkthrough / Help
+15 -10
View File
@@ -389,15 +389,20 @@ var parsers = {
props.loc = getLoc(attrs);
// if notes are coincident, move them apart slightly
var coincident = false;
var epsilon = 0.00001;
do {
if (coincident) {
props.loc = geoVecAdd(props.loc, [epsilon, epsilon]);
}
var bbox = geoExtent(props.loc).bbox();
coincident = _noteCache.rtree.search(bbox).length;
} while (coincident);
if (!_noteCache.note[uid]) {
let coincident = false;
const epsilon = 0.00001;
do {
if (coincident) {
props.loc = geoVecAdd(props.loc, [epsilon, epsilon]);
}
const bbox = geoExtent(props.loc).bbox();
coincident = _noteCache.rtree.search(bbox).length;
} while (coincident);
} else {
// we already saw this note: don't change its location again
props.loc = _noteCache.note[uid].loc;
}
// parse note contents
for (var i = 0; i < childNodes.length; i++) {
@@ -416,7 +421,7 @@ var parsers = {
var note = new osmNote(props);
var item = encodeNoteRtree(note);
_noteCache.note[note.id] = note;
_noteCache.rtree.insert(item);
updateRtree(item, true);
return note;
},