Skip to content
Snippets Groups Projects
Merged Timothee P requested to merge redmine-issues/12846 into develop
1 file
+ 2
28
Compare changes
  • Side-by-side
  • Inline
@@ -104,8 +104,7 @@ const map = {
});
},
INITIATE_MAP({ state, rootState, commit }, el) {
const project = rootState.projects.project;
INITIATE_MAP({ commit }, el) { //! since this function is not anymore called in different components, it would better to move it in project_details.vue
let mapDefaultViewCenter = [46, 2]; // defaultMapView.center;
let mapDefaultViewZoom = 5; // defaultMapView.zoom;
mapUtil.createMap(el, {
@@ -114,33 +113,8 @@ const map = {
});
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(
layersToLoad,
null,
this.state.configuration.DEFAULT_BASE_MAP_SERVICE,
this.state.configuration.DEFAULT_BASE_MAP_OPTIONS,
this.state.configuration.DEFAULT_BASE_MAP_SCHEMA_TYPE,
Loading