LayerServer: first version which can use a local MVT-server

This commit is contained in:
Pieter Vander Vennet 2024-01-22 01:42:05 +01:00
parent 35228daa8f
commit ef2f1487c6
17 changed files with 1009 additions and 82 deletions

View file

@ -0,0 +1,39 @@
import { Store } from "../../UIEventSource"
import DynamicTileSource from "./DynamicTileSource"
import { Utils } from "../../../Utils"
import { BBox } from "../../BBox"
import LayerConfig from "../../../Models/ThemeConfig/LayerConfig"
import MvtSource from "../Sources/MvtSource"
import { Tiles } from "../../../Models/TileRange"
import Constants from "../../../Models/Constants"
export default class DynamicMvtileSource extends DynamicTileSource {
constructor(
layer: LayerConfig,
mapProperties: {
zoom: Store<number>
bounds: Store<BBox>
},
options?: {
isActive?: Store<boolean>
},
) {
super(
mapProperties.zoom,
layer.minzoom,
(zxy) => {
const [z, x, y] = Tiles.tile_from_index(zxy)
const url = Utils.SubstituteKeys(Constants.VectorTileServer,
{
z, x, y, layer: layer.id,
})
return new MvtSource(url, x, y, z)
},
mapProperties,
{
isActive: options?.isActive,
},
)
}
}