Skip to content
This repository has been archived by the owner on Apr 2, 2024. It is now read-only.

Commit

Permalink
No basemap option integrated
Browse files Browse the repository at this point in the history
  • Loading branch information
AndresKasekamp committed Jan 4, 2024
1 parent c344df0 commit ec088cb
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 18 deletions.
20 changes: 3 additions & 17 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import {
taimkateWorkaround,
getVisibleLayers,
compareVisibleLayers,
setNoBasemap,
} from "./modules/layers.js";
import { setupWebScene, setupWebView } from "./modules/scene.js";
import {
Expand Down Expand Up @@ -172,6 +173,8 @@ view.when(() => {

loadWMStile(basemaps, view);

setNoBasemap(basemaps, view);

/**************************************
* Geology layer group
**************************************/
Expand Down Expand Up @@ -231,7 +234,6 @@ view.when(() => {
* Measurement 3D
**************************************/


setupMeasurement(view);

/**************************************
Expand Down Expand Up @@ -271,22 +273,6 @@ view.when(() => {
**************************************/
const initVisibleLayers = getVisibleLayers(view);

const basemapSwitch = document.getElementById("basemapSwitch");
basemapSwitch.addEventListener("calciteCheckboxChange", () => {
basemaps.disabled = !basemaps.disabled;

view.map.allLayers.forEach((layer) => {

// TODO kuidagi peab määrama orto wms ka
if (layer.type === "web-tile") {
layer.visible = !layer.visible
}

})

});


/**************************************
* Calcite CSS/JS
**************************************/
Expand Down
2 changes: 2 additions & 0 deletions modules/elevation.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,6 @@ const setupElevationLayer = (url, title) => {
});
};



export { elevationManipulation, setupElevationLayer };
2 changes: 1 addition & 1 deletion modules/layerList.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ const setupBasemapGallery = (view) => {
};

const loadWMStile = (basemaps, view) => {
console.log(basemaps)

basemaps.watch("activeBasemap", () => {
const isOrtofoto = basemaps.activeBasemap.title === "Ortofoto";

Expand Down
19 changes: 19 additions & 0 deletions modules/layers.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,24 @@ const compareVisibleLayers = (initVisibleLayers, visibleLayersCurrently) => {
return [regularLayers, elevationChanged];
};

const setNoBasemap = (basemaps, view) => {
const basemapSwitch = document.getElementById("basemapSwitch");
let currentBasemap;
basemapSwitch.addEventListener("calciteCheckboxChange", () => {
if (basemaps.activeBasemap.title !== "Basemap") {
currentBasemap = basemaps.activeBasemap;
}

if (basemapSwitch.checked) {
view.map.basemap = {};
} else {
view.map.basemap = currentBasemap;
}

basemaps.disabled = !basemaps.disabled;
});
};

export {
setupGraphicsLayer,
setupInternalLayer,
Expand All @@ -122,4 +140,5 @@ export {
getGeologyLayers,
getVisibleLayers,
compareVisibleLayers,
setNoBasemap
};

0 comments on commit ec088cb

Please sign in to comment.