Refactoring: fix delete indication, fix splitroad, fix addition of multiple new points snapped onto the same way (all will properly attach now)

This commit is contained in:
Pieter Vander Vennet 2023-04-20 17:42:07 +02:00
parent 1f9aacfb29
commit 4172af6a72
118 changed files with 1422 additions and 1357 deletions

View file

@ -12,6 +12,7 @@ export default class FeaturePropertiesStore {
this._source = source
const self = this
source.features.addCallbackAndRunD((features) => {
console.log("Re-indexing features")
for (const feature of features) {
const id = feature.properties.id
if (id === undefined) {
@ -21,6 +22,7 @@ export default class FeaturePropertiesStore {
const source = self._elements.get(id)
if (source === undefined) {
console.log("Adding feature store for", id)
self._elements.set(id, new UIEventSource<any>(feature.properties))
continue
}

View file

@ -1,7 +1,6 @@
import { Store, UIEventSource } from "../../UIEventSource"
import FilteredLayer from "../../../Models/FilteredLayer"
import { FeatureSource } from "../FeatureSource"
import { TagsFilter } from "../../Tags/TagsFilter"
import { Feature } from "geojson"
import { GlobalFilter } from "../../../Models/GlobalFilter"
@ -54,6 +53,7 @@ export default class FilteringFeatureSource implements FeatureSource {
this.update()
}
private update() {
const self = this
const layer = this._layer
@ -87,7 +87,7 @@ export default class FilteringFeatureSource implements FeatureSource {
}
}
// Something new has been found!
// Something new has been found (or something was deleted)!
this.features.setData(newFeatures)
}

View file

@ -43,7 +43,15 @@ export default class LayoutSource extends FeatureSourceMerger {
isActive: isDisplayed(l.id),
})
)
const overpassSource = LayoutSource.setupOverpass(osmLayers, bounds, zoom, featureSwitches)
const overpassSource = LayoutSource.setupOverpass(
backend,
osmLayers,
bounds,
zoom,
featureSwitches
)
const osmApiSource = LayoutSource.setupOsmApiSource(
osmLayers,
bounds,
@ -121,6 +129,7 @@ export default class LayoutSource extends FeatureSourceMerger {
}
private static setupOverpass(
backend: string,
osmLayers: LayerConfig[],
bounds: Store<BBox>,
zoom: Store<number>,

View file

@ -23,7 +23,7 @@ export class NewGeometryFromChangesFeatureSource implements WritableFeatureSourc
const features = this.features.data
const self = this
const backend = changes.backend
changes.pendingChanges.stabilized(100).addCallbackAndRunD((changes) => {
changes.pendingChanges.addCallbackAndRunD((changes) => {
if (changes.length === 0) {
return
}
@ -48,6 +48,7 @@ export class NewGeometryFromChangesFeatureSource implements WritableFeatureSourc
continue
}
console.log("Handling pending change")
if (change.id > 0) {
// This is an already existing object
// In _most_ of the cases, this means that this _isn't_ a new object
@ -74,11 +75,9 @@ export class NewGeometryFromChangesFeatureSource implements WritableFeatureSourc
self.features.ping()
})
continue
} else if (change.id < 0 && change.changes === undefined) {
// The geometry is not described - not a new point
if (change.id < 0) {
console.error("WARNING: got a new point without geometry!")
}
} else if (change.changes === undefined) {
// The geometry is not described - not a new point or geometry change, but probably a tagchange to a newly created point
// Not something that should be handled here
continue
}