forked from MapComplete/MapComplete
Refactoring(maplibre): remove 'freshness' and 'name' from FeatureSource to simplify the code
This commit is contained in:
parent
1b3609b13f
commit
231d67361e
30 changed files with 161 additions and 269 deletions
|
@ -1,20 +1,19 @@
|
|||
import FeatureSource from "../FeatureSource"
|
||||
import { Store } from "../../UIEventSource"
|
||||
import { ElementStorage } from "../../ElementStorage"
|
||||
import FeatureSource from "../FeatureSource";
|
||||
import { Store } from "../../UIEventSource";
|
||||
import { ElementStorage } from "../../ElementStorage";
|
||||
import { Feature } from "geojson";
|
||||
|
||||
/**
|
||||
* Makes sure that every feature is added to the ElementsStorage, so that the tags-eventsource can be retrieved
|
||||
*/
|
||||
export default class RegisteringAllFromFeatureSourceActor {
|
||||
public readonly features: Store<{ feature: any; freshness: Date }[]>
|
||||
public readonly name
|
||||
public readonly features: Store<Feature[]>
|
||||
|
||||
constructor(source: FeatureSource, allElements: ElementStorage) {
|
||||
this.features = source.features
|
||||
this.name = "RegisteringSource of " + source.name
|
||||
this.features.addCallbackAndRunD((features) => {
|
||||
for (const feature of features) {
|
||||
allElements.addOrGetElement(feature.feature)
|
||||
allElements.addOrGetElement(<any> feature)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue