forked from MapComplete/MapComplete
Filter duplicate ids from new ways, #564
This commit is contained in:
parent
32ae6957e7
commit
31205f3430
2 changed files with 16 additions and 2 deletions
|
@ -26,7 +26,22 @@ export default class CreateNewWayAction extends OsmCreateAction {
|
||||||
theme: string
|
theme: string
|
||||||
}) {
|
}) {
|
||||||
super(null, true)
|
super(null, true)
|
||||||
this.coordinates = coordinates;
|
this.coordinates = [];
|
||||||
|
|
||||||
|
for (const coordinate of coordinates) {
|
||||||
|
/* The 'PointReuseAction' is a bit buggy and might generate duplicate ids.
|
||||||
|
We filter those here, as the CreateWayWithPointReuseAction delegates the actual creation to here.
|
||||||
|
Filtering here also prevents similar bugs in other actions
|
||||||
|
*/
|
||||||
|
if(this.coordinates.length > 0 && this.coordinates[this.coordinates.length - 1].nodeId === coordinate.nodeId){
|
||||||
|
// This is a duplicate id
|
||||||
|
console.warn("Skipping a node in createWay to avoid a duplicate node:", coordinate,"\nThe previous coordinates are: ", this.coordinates)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
this.coordinates.push(coordinate)
|
||||||
|
}
|
||||||
|
|
||||||
this.tags = tags;
|
this.tags = tags;
|
||||||
this._options = options;
|
this._options = options;
|
||||||
}
|
}
|
||||||
|
|
|
@ -210,7 +210,6 @@ export default class AutoApplyButton implements SpecialVisualization {
|
||||||
// Very ugly hack: read the value every 500ms
|
// Very ugly hack: read the value every 500ms
|
||||||
UIEventSource.Chronic(500, () => to_parse.data === undefined).addCallback(() => {
|
UIEventSource.Chronic(500, () => to_parse.data === undefined).addCallback(() => {
|
||||||
const applicable = tagSource.data[argument[1]]
|
const applicable = tagSource.data[argument[1]]
|
||||||
console.log("Current applicable value is: ", applicable)
|
|
||||||
to_parse.setData(applicable)
|
to_parse.setData(applicable)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue