mirror of
https://github.com/gpxstudio/gpx.studio.git
synced 2025-09-01 08:12:32 +00:00
detect and ignore duplicate POIs when merging
This commit is contained in:
@@ -1235,6 +1235,23 @@ export class Waypoint {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
equals(other: Waypoint): boolean {
|
||||||
|
if (this.attributes.lat !== other.attributes.lat || this.attributes.lon !== other.attributes.lon || this.ele !== other.ele ||
|
||||||
|
this.name !== other.name || this.cmt !== other.cmt || this.desc !== other.desc || this.sym !== other.sym || this.type !== other.type) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.time === undefined && other.time !== undefined || this.time !== undefined && other.time === undefined || this.time !== undefined && other.time !== undefined && this.time.getTime() !== other.time.getTime()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (JSON.stringify(this.link) !== JSON.stringify(other.link)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// Producers
|
// Producers
|
||||||
setHidden(hidden: boolean) {
|
setHidden(hidden: boolean) {
|
||||||
this._data.hidden = hidden;
|
this._data.hidden = hidden;
|
||||||
|
@@ -593,7 +593,11 @@ export const dbUtils = {
|
|||||||
if (file && originalFile) {
|
if (file && originalFile) {
|
||||||
if (level === ListLevel.FILE) {
|
if (level === ListLevel.FILE) {
|
||||||
toMerge.trk.push(...originalFile.trk.map((track) => track.clone()));
|
toMerge.trk.push(...originalFile.trk.map((track) => track.clone()));
|
||||||
toMerge.wpt.push(...originalFile.wpt.map((wpt) => wpt.clone()));
|
for (const wpt of originalFile.wpt) {
|
||||||
|
if (!toMerge.wpt.some((w) => w.equals(wpt))) {
|
||||||
|
toMerge.wpt.push(wpt.clone());
|
||||||
|
}
|
||||||
|
}
|
||||||
if (first) {
|
if (first) {
|
||||||
target = items[0];
|
target = items[0];
|
||||||
targetFile = file;
|
targetFile = file;
|
||||||
|
Reference in New Issue
Block a user