First working version of fully automatic uploader

This commit is contained in:
Pieter Vander Vennet 2021-12-13 02:05:34 +01:00
parent 04dc373b1e
commit e922768f99
21 changed files with 342 additions and 106 deletions

View file

@ -4,6 +4,7 @@ import {UIEventSource} from "../../UIEventSource";
import Loc from "../../../Models/Loc";
import TileHierarchy from "./TileHierarchy";
import {Tiles} from "../../../Models/TileRange";
import {BBox} from "../../BBox";
/***
* A tiled source which dynamically loads the required tiles at a fixed zoom level
@ -17,8 +18,8 @@ export default class DynamicTileSource implements TileHierarchy<FeatureSourceFor
zoomlevel: number,
constructTile: (zxy: [number, number, number]) => (FeatureSourceForLayer & Tiled),
state: {
currentBounds: UIEventSource<BBox>;
locationControl: UIEventSource<Loc>
leafletMap: any
}
) {
const self = this;
@ -37,7 +38,7 @@ export default class DynamicTileSource implements TileHierarchy<FeatureSourceFor
}
// Yup, this is cheating to just get the bounds here
const bounds = state.leafletMap.data?.getBounds()
const bounds = state.currentBounds.data
if (bounds === undefined) {
// We'll retry later
return undefined
@ -50,7 +51,7 @@ export default class DynamicTileSource implements TileHierarchy<FeatureSourceFor
}
return needed
}
, [layer.isDisplayed, state.leafletMap]).stabilized(250);
, [layer.isDisplayed, state.currentBounds]).stabilized(250);
neededTiles.addCallbackAndRunD(neededIndexes => {
console.log("Tiled geojson source ", layer.layerDef.id, " needs", neededIndexes)