forked from MapComplete/MapComplete
chore: refactoring, linting, removing obsolete files
This commit is contained in:
parent
b7a4930583
commit
2bc2a6cddf
54 changed files with 125 additions and 457 deletions
|
|
@ -83,10 +83,9 @@ export default class FeaturePropertiesStore {
|
|||
}
|
||||
|
||||
public trackFeatureSource(source: FeatureSource) {
|
||||
const self = this
|
||||
source.features.addCallbackAndRunD((features) => {
|
||||
for (const feature of features) {
|
||||
self.trackFeature(<any>feature)
|
||||
this.trackFeature(<any>feature)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ export default class PerLayerFeatureSourceSplitter<T extends FeatureSource = Fea
|
|||
* Keeps track of the ids that are included per layer.
|
||||
* Used to know if the downstream feature source needs to be pinged
|
||||
*/
|
||||
let layerIndexes: ReadonlySet<string>[] = layers.map((_) => new Set<string>())
|
||||
let layerIndexes: ReadonlySet<string>[] = layers.map(() => new Set<string>())
|
||||
this.perLayer = knownLayers
|
||||
const layerSources = new Map<string, UIEventSource<Feature[]>>()
|
||||
const constructStore =
|
||||
|
|
@ -47,8 +47,8 @@ export default class PerLayerFeatureSourceSplitter<T extends FeatureSource = Fea
|
|||
* Indexed on layer-position
|
||||
* Will be true if a new id pops up
|
||||
*/
|
||||
const hasChanged: boolean[] = layers.map((_) => false)
|
||||
const newIndices: Set<string>[] = layers.map((_) => new Set<string>())
|
||||
const hasChanged: boolean[] = layers.map(() => false)
|
||||
const newIndices: Set<string>[] = layers.map(() => new Set<string>())
|
||||
const noLayerFound: Feature[] = []
|
||||
|
||||
for (const layer of layers) {
|
||||
|
|
|
|||
|
|
@ -23,11 +23,10 @@ export default class FeatureSourceMerger<Src extends FeatureSource = FeatureSour
|
|||
constructor(...sources: Src[]) {
|
||||
this._featuresById = new UIEventSource<Map<string, Feature>>(new Map<string, Feature>())
|
||||
this.featuresById = this._featuresById
|
||||
const self = this
|
||||
sources = Utils.NoNull(sources)
|
||||
for (const source of sources) {
|
||||
source.features.addCallback(() => {
|
||||
self.addDataFromSources(sources)
|
||||
this.addDataFromSources(sources)
|
||||
})
|
||||
}
|
||||
this._sources = sources
|
||||
|
|
|
|||
|
|
@ -38,8 +38,7 @@ export class NewGeometryFromChangesFeatureSource implements WritableFeatureSourc
|
|||
this._seenChanges = new Set<ChangeDescription>()
|
||||
this._features = this.features.data
|
||||
this._backend = changes.backend
|
||||
const self = this
|
||||
changes.pendingChanges.addCallbackAndRunD((changes) => self.handleChanges(changes))
|
||||
changes.pendingChanges.addCallbackAndRunD((changes) => this.handleChanges(changes))
|
||||
}
|
||||
|
||||
private addNewFeature(feature: Feature) {
|
||||
|
|
|
|||
|
|
@ -161,7 +161,6 @@ export default class OsmFeatureSource extends FeatureSourceMerger {
|
|||
this.options?.fullNodeDatabase?.handleOsmJson(osmJson, z, x, y)
|
||||
let features = <Feature<any, { id: string }>[]>OsmToGeoJson(
|
||||
osmJson,
|
||||
// @ts-ignore
|
||||
{
|
||||
flatProperties: true,
|
||||
}
|
||||
|
|
@ -175,7 +174,7 @@ export default class OsmFeatureSource extends FeatureSourceMerger {
|
|||
)
|
||||
|
||||
for (let i = 0; i < features.length; i++) {
|
||||
features[i] = await this.patchIncompleteRelations(features[i], osmJson)
|
||||
features[i] = await this.patchIncompleteRelations(features[i], <any> osmJson)
|
||||
}
|
||||
features = Utils.NoNull(features)
|
||||
features.forEach((f) => {
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import { BBox } from "../../BBox"
|
|||
import { Utils } from "../../../Utils"
|
||||
import { Feature } from "geojson"
|
||||
import { GeoOperations } from "../../GeoOperations"
|
||||
import DynamicTileSource, { UpdatableDynamicTileSource } from "./DynamicTileSource"
|
||||
import { UpdatableDynamicTileSource } from "./DynamicTileSource"
|
||||
|
||||
/**
|
||||
* The PolygonSourceMerger receives various small pieces of bigger polygons and stitches them together.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue