diff --git a/Customizations/StreetWidth/StreetWidth.ts b/Customizations/StreetWidth/StreetWidth.ts
index eeacf9f..b58d2a7 100644
--- a/Customizations/StreetWidth/StreetWidth.ts
+++ b/Customizations/StreetWidth/StreetWidth.ts
@@ -74,6 +74,16 @@ export class StreetWidth extends Layout{
"
Er is steeds meer druk op de openbare ruimte. Voetgangers, fietsers, steps, auto's, bussen, bestelwagens, buggies, cargobikes, ... willen allemaal hun deel van de openbare ruimte.
" +
"" +
"In deze studie nemen we Brugge onder de loep en kijken we hoe breed elke straat is én hoe breed elke straat zou moeten zijn voor een veilig én vlot verkeer.
" +
+ "Legende
" +
+ "    Straat te smal voor veilig verkeer
"+
+ "    Straat is breed genoeg veilig verkeer
"+
+ "    Straat zonder voetpad, te smal als ook voetgangers plaats krijgen
"+
+ "    Woonerf, autoluw, autoloos of enkel plaatselijk verkeer
" +
+ "
" +
+ "
" +
+ "Een gestippelde lijn is een straat waar ook voor fietsers éénrichtingsverkeer geldt.
" +
+ "Klik op een straat om meer informatie te zien."+
+ "Hoe gaan we verder?
" +
"Verschillende ingrepen kunnen de stad teruggeven aan de inwoners en de stad leefbaarder en levendiger maken.
" +
"Denk aan:" +
"" +
@@ -82,7 +92,7 @@ export class StreetWidth extends Layout{
"- Het aantal woonerven uitbreiden
" +
"- Grotere auto's meer belasten - ze nemen immers meer parkeerruimte in.
" +
"- Laat toeristen verplicht parkeren onder het zand; een (fiets)taxi kan hen naar hun hotel brengen
" +
- "- Voorzie in elke straat enkele parkeerplaatsen voor kortparkeren. Zo kunnen leveringen, iemand afzetten,... gebeuren zonder dat er een fietspad of een straat geblokkeerd wordt
" +
+ "- Voorzie in elke straat enkele parkeerplaatsen voor kortparkeren. Zo kunnen leveringen, iemand afzetten,... gebeuren zonder op het voetpad en fietspad te parkeren
" +
"
");
this.icon = "./assets/bug.svg";
this.enableSearch = false;
@@ -91,6 +101,7 @@ export class StreetWidth extends Layout{
this.hideFromOverview = true;
this.enableMoreQuests = false;
this.enableShareScreen = false;
-
+ this.defaultBackground = "Stadia.AlidadeSmoothDark"
+ this.enableBackgroundLayers = false;
}
}
\ No newline at end of file
diff --git a/InitUiElements.ts b/InitUiElements.ts
index 08518dc..e3b9ab8 100644
--- a/InitUiElements.ts
+++ b/InitUiElements.ts
@@ -36,6 +36,7 @@ import {LocalStorageSource} from "./Logic/Web/LocalStorageSource";
import {FromJSON} from "./Customizations/JSON/FromJSON";
import {Utils} from "./Utils";
import BackgroundSelector from "./UI/BackgroundSelector";
+import AvailableBaseLayers from "./Logic/AvailableBaseLayers";
export class InitUiElements {
@@ -357,12 +358,11 @@ export class InitUiElements {
let layerControlPanel: UIElement = undefined;
if (State.state.layoutToUse.data.enableBackgroundLayers) {
- layerControlPanel = new BackgroundSelector(State.state);
+ layerControlPanel = new BackgroundSelector();
layerControlPanel.SetStyle("margin:1em");
layerControlPanel.onClick(() => { });
}
-
if (State.state.filteredLayers.data.length > 1) {
const layerSelection = new LayerSelection();
layerSelection.onClick(() => {
@@ -375,8 +375,12 @@ export class InitUiElements {
static InitLayerSelection() {
InitUiElements.OnlyIf(State.state.featureSwitchLayers, () => {
- const layerControlPanel = this.GenerateLayerControlPanel()
- .SetStyle("display:block;padding:1em;border-radius:1em;");
+ const layerControlPanel = this.GenerateLayerControlPanel();
+ if (layerControlPanel === undefined) {
+ return;
+ }
+
+ layerControlPanel.SetStyle("display:block;padding:1em;border-radius:1em;");
const closeButton = new Combine([Img.openFilterButton])
.SetStyle("display:block; width: min-content; background: #e5f5ff;padding:1em; border-radius:1em;");
const checkbox = new CheckBox(
@@ -451,7 +455,23 @@ export class InitUiElements {
);
State.state.bm = bm;
State.state.layerUpdater = new LayerUpdater(State.state);
-
+
+ State.state.availableBackgroundLayers = new AvailableBaseLayers(State.state).availableEditorLayers;
+ const queryParam = QueryParameters.GetQueryParameter("background", State.state.layoutToUse.data.defaultBackground);
+
+ queryParam.addCallbackAndRun((selectedId:string) => {
+ console.log("Selected layer is ", selectedId)
+ const available = State.state.availableBackgroundLayers.data;
+ for (const layer of available) {
+ if (layer.id === selectedId) {
+ State.state.bm.CurrentLayer.setData(layer);
+ }
+ }
+ })
+
+ State.state.bm.CurrentLayer.addCallbackAndRun(currentLayer => {
+ queryParam.setData(currentLayer.id);
+ });
}
diff --git a/Logic/AvailableBaseLayers.ts b/Logic/AvailableBaseLayers.ts
index 187ed16..ef4dc86 100644
--- a/Logic/AvailableBaseLayers.ts
+++ b/Logic/AvailableBaseLayers.ts
@@ -65,21 +65,6 @@ export default class AvailableBaseLayers {
});
- const queryParam = QueryParameters.GetQueryParameter("background", State.state.layoutToUse.data.defaultBackground);
-
- queryParam.addCallbackAndRun((selectedId:string) => {
- console.log("Selected layer is ", selectedId)
- const available = self.availableEditorLayers.data;
- for (const layer of available) {
- if (layer.id === selectedId) {
- state.bm.CurrentLayer.setData(layer);
- }
- }
- })
-
- state.bm.CurrentLayer.addCallbackAndRun(currentLayer => {
- queryParam.setData(currentLayer.id);
- });
}
diff --git a/State.ts b/State.ts
index 15ae1df..f776a43 100644
--- a/State.ts
+++ b/State.ts
@@ -12,6 +12,7 @@ import {LayerUpdater} from "./Logic/LayerUpdater";
import {UIEventSource} from "./Logic/UIEventSource";
import {LocalStorageSource} from "./Logic/Web/LocalStorageSource";
import {QueryParameters} from "./Logic/Web/QueryParameters";
+import {BaseLayer} from "./Logic/BaseLayer";
/**
* Contains the global state: a bunch of UI-event sources
@@ -54,6 +55,10 @@ export class State {
THe basemap with leaflet instance
*/
public bm;
+ /**
+ * Background layer id
+ */
+ public availableBackgroundLayers: UIEventSource;
/**
The user credentials
*/
diff --git a/UI/BackgroundSelector.ts b/UI/BackgroundSelector.ts
index f4faa1f..d745fb2 100644
--- a/UI/BackgroundSelector.ts
+++ b/UI/BackgroundSelector.ts
@@ -1,5 +1,4 @@
import {UIElement} from "./UIElement";
-import AvailableBaseLayers from "../Logic/AvailableBaseLayers";
import {DropDown} from "./Input/DropDown";
import Translations from "./i18n/Translations";
import {State} from "../State";
@@ -9,15 +8,12 @@ import {BaseLayer} from "../Logic/BaseLayer";
export default class BackgroundSelector extends UIElement {
private _dropdown: UIElement;
- private readonly state: State;
- private readonly _availableLayers: UIEventSource;
+ private readonly _availableLayers: UIEventSource;
- constructor(state: State) {
+ constructor() {
super();
- this.state = state;
-
- this._availableLayers = new AvailableBaseLayers(state).availableEditorLayers;
const self = this;
+ this._availableLayers = State.state.availableBackgroundLayers;
this._availableLayers.addCallbackAndRun(available => self.CreateDropDown(available));
}