forked from MapComplete/MapComplete
Huge refactoring of the feature pipeline, WIP
This commit is contained in:
parent
7793297348
commit
973b5d8bbe
25 changed files with 522 additions and 591 deletions
|
@ -0,0 +1,40 @@
|
|||
import FilteredLayer from "../../../Models/FilteredLayer";
|
||||
import {FeatureSourceForLayer} from "../FeatureSource";
|
||||
import {UIEventSource} from "../../UIEventSource";
|
||||
import Loc from "../../../Models/Loc";
|
||||
import GeoJsonSource from "../GeoJsonSource";
|
||||
import DynamicTileSource from "./DynamicTileSource";
|
||||
|
||||
export default class DynamicGeoJsonTileSource extends DynamicTileSource {
|
||||
constructor(layer: FilteredLayer,
|
||||
registerLayer: (layer: FeatureSourceForLayer) => void,
|
||||
state: {
|
||||
locationControl: UIEventSource<Loc>
|
||||
leafletMap: any
|
||||
}) {
|
||||
const source = layer.layerDef.source
|
||||
if (source.geojsonZoomLevel === undefined) {
|
||||
throw "Invalid layer: geojsonZoomLevel expected"
|
||||
}
|
||||
if (source.geojsonSource === undefined) {
|
||||
throw "Invalid layer: geojsonSource expected"
|
||||
}
|
||||
|
||||
super(
|
||||
layer,
|
||||
source.geojsonZoomLevel,
|
||||
(xy) => {
|
||||
const xyz: [number, number, number] = [xy[0], xy[1], source.geojsonZoomLevel]
|
||||
const src = new GeoJsonSource(
|
||||
layer,
|
||||
xyz
|
||||
)
|
||||
registerLayer(src)
|
||||
return src
|
||||
},
|
||||
state
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue