Merge preliminary work on layer selection

This commit is contained in:
Pieter Vander Vennet 2020-07-16 14:56:19 +02:00
commit b4c2e4df70
5 changed files with 142 additions and 28 deletions

View file

@ -24,14 +24,12 @@ import {AllKnownLayouts} from "./Customizations/AllKnownLayouts";
import {All} from "./Customizations/Layouts/All";
// --------------------- Read the URL parameters -----------------
// @ts-ignore
if(location.href.startsWith("http://buurtnatuur.be")){
if (location.href.startsWith("http://buurtnatuur.be")) {
// Reload the https version. This is important for the 'locate me' button
window.location.replace("https://buurtnatuur.be");
window.location.replace("https://buurtnatuur.be");
}
@ -40,7 +38,7 @@ let dryRun = false;
if (location.hostname === "localhost" || location.hostname === "127.0.0.1") {
// Set to true if testing and changes should NOT be saved
// dryRun = true;
dryRun = true;
// If you have a testfile somewhere, enable this to spoof overpass
// This should be hosted independantly, e.g. with `cd assets; webfsd -p 8080` + a CORS plugin to disable cors rules
Overpass.testUrl = null; // "http://127.0.0.1:8080/test.json";
@ -75,8 +73,6 @@ if (window.location.search) {
var kv = param.split("=");
paramDict[kv[0]] = kv[1];
}
}
if (paramDict.layout) {
@ -141,7 +137,7 @@ const bm = new Basemap("leafletDiv", locationControl, new VariableUiElement(
// ------------- Setup the layers -------------------------------
const controls = {};
const addButtons: {
name: string,
icon: string,
@ -171,6 +167,8 @@ for (const layer of layoutToUse.layers) {
const flayer = layer.asLayer(bm, allElements, changes, osmConnection.userDetails, selectedElement, generateInfo);
controls[layer.name] = flayer.isDisplayed;
const addButton = {
name: layer.name,
icon: layer.icon,
@ -253,7 +251,9 @@ leftMessage.setData(welcomeMessage);
welcomeMessage().AttachTo("messagesbox");
var messageBox = new MessageBoxHandler(leftMessage, () => {selectedElement.setData(undefined)});
var messageBox = new MessageBoxHandler(leftMessage, () => {
selectedElement.setData(undefined)
});
new CenterMessageBox(
minZoom,
@ -276,4 +276,4 @@ new GeoLocationHandler(bm).AttachTo("geolocate-button");
// --------------- Send a ping to start various action --------
locationControl.ping();
messageBox.update();
messageBox.update();