Skip to content
Snippets Groups Projects
Commit bb48f42f authored by Timothee P's avatar Timothee P :sunflower:
Browse files

use default basemaps for project_details

parent b3352973
No related branches found
No related tags found
2 merge requests!295Version 3.0.0,!285REDMINE_ISSUE-12846
...@@ -104,8 +104,7 @@ const map = { ...@@ -104,8 +104,7 @@ const map = {
}); });
}, },
INITIATE_MAP({ state, rootState, commit }, el) { INITIATE_MAP({ commit }, el) { //! since this function is not anymore called in different components, it would better to move it in project_details.vue
const project = rootState.projects.project;
let mapDefaultViewCenter = [46, 2]; // defaultMapView.center; let mapDefaultViewCenter = [46, 2]; // defaultMapView.center;
let mapDefaultViewZoom = 5; // defaultMapView.zoom; let mapDefaultViewZoom = 5; // defaultMapView.zoom;
mapUtil.createMap(el, { mapUtil.createMap(el, {
...@@ -114,33 +113,8 @@ const map = { ...@@ -114,33 +113,8 @@ const map = {
}); });
commit('SET_MAP', mapUtil.getMap()); commit('SET_MAP', mapUtil.getMap());
// Load the layers.
// - if one basemap exists, check in the localstorage if one active basemap is set
// - if no current active basemap, get the first index
// - if not, load the default map and service options
let layersToLoad = null;
if (state.basemaps && state.basemaps.length > 0) {
// Use active one if exists, otherwise index 0 (first basemap in the list)
const mapOptions =
JSON.parse(localStorage.getItem('geocontrib-map-options')) || {};
const basemapIndex =
mapOptions &&
mapOptions[project] &&
mapOptions[project]['current-basemap-index']
? mapOptions[project]['current-basemap-index']
: 0;
layersToLoad = state.basemaps[basemapIndex].layers;
layersToLoad.forEach((layerToLoad) => {
state.availableLayers.forEach((layer) => {
if (layer.id === layerToLoad.id) {
layerToLoad = Object.assign(layerToLoad, layer);
}
});
});
layersToLoad.reverse();
}
mapUtil.addLayers( mapUtil.addLayers(
layersToLoad, null,
this.state.configuration.DEFAULT_BASE_MAP_SERVICE, this.state.configuration.DEFAULT_BASE_MAP_SERVICE,
this.state.configuration.DEFAULT_BASE_MAP_OPTIONS, this.state.configuration.DEFAULT_BASE_MAP_OPTIONS,
this.state.configuration.DEFAULT_BASE_MAP_SCHEMA_TYPE, this.state.configuration.DEFAULT_BASE_MAP_SCHEMA_TYPE,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment