WIP: exit from building view (buggy)

This commit is contained in:
2026-09-15 11:38:53 +02:00
parent ace42261cf
commit 91b1764913
7 changed files with 83 additions and 14 deletions
+23 -6
View File
@@ -117,14 +117,27 @@ GIS.initMap = async function (mapId, zoomLevel = this.INIT_ZOOM) {
*/
GIS.activateBuildingView = async function(layerId) {
const map = GisState.map;
map.setMinZoom(19);
map.setMaxZoom(25);
let currentBase = {};
for (let key of Object.keys(GisState.baseLayers)) {
if (map.hasLayer(GisState.baseLayers[key])) {
currentBase = GisState.baseLayers[key];
break;
}
}
GisState.currentMapState = {
baseLayer: currentBase,
zoom: map.getZoom(),
center: map.getCenter(),
minZoom: map.getMinZoom(),
maxZoom: map.getMaxZoom(),
}
/**
* @type {L.GeoJSON} currentGeometry
*/
let currentGeometry = {};
map.removeLayer(GisState.baseLayers['OpenStreetMap']);
map.removeLayer(currentBase);
// Remove site layers then re-add it so vector lines
// are placed correctly above the new base map
GisState.layers.geometries.removeFrom(map);
@@ -139,8 +152,6 @@ GIS.activateBuildingView = async function(layerId) {
}
});
const center = currentGeometry.getBounds().getCenter();
// TODO: Use DB to handle these?
const wallTechniques = [
'reticolata',
@@ -151,19 +162,25 @@ GIS.activateBuildingView = async function(layerId) {
'poligonale',
];
// TODO: create color lookup table...
const wallLayer = await this.loadGeoJSON(
`murarie/${layerId}/reticolata.geojson`,
// TODO: create color lookup table...
Options.walls,
true
);
wallLayer.addTo(map);
// The group of all added walls...
GisState.layers.walls = L.layerGroup([wallLayer]);
map.setView(wallLayer.getBounds().getCenter(), 20);
map.setMinZoom(19);
map.setMaxZoom(25);
// This is terrible...
UI.addBuildingViewBar();
map._container.classList.add('bview-border');
GisState.bViewActive = true;
}
/**
* Fetches references to cartography layers