forked from MapComplete/MapComplete
Add better relation support
This commit is contained in:
parent
7b47af8978
commit
12afdcab75
18 changed files with 2637 additions and 2386 deletions
19
Logic/FeatureSource/RegisteringFeatureSource.ts
Normal file
19
Logic/FeatureSource/RegisteringFeatureSource.ts
Normal file
|
@ -0,0 +1,19 @@
|
|||
import FeatureSource from "./FeatureSource";
|
||||
import {UIEventSource} from "../UIEventSource";
|
||||
import State from "../../State";
|
||||
|
||||
export default class RegisteringFeatureSource implements FeatureSource {
|
||||
features: UIEventSource<{ feature: any; freshness: Date }[]>;
|
||||
|
||||
constructor(source: FeatureSource) {
|
||||
this.features = source.features;
|
||||
this.features.addCallbackAndRun(features => {
|
||||
for (const feature of features ?? []) {
|
||||
if (!State.state.allElements.has(feature.feature.properties.id)) {
|
||||
State.state.allElements.addOrGetElement(feature.feature)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue