diff --git a/src/module_vmap/module/javascript/app/vmap/mapmanager/mapmanager.js b/src/module_vmap/module/javascript/app/vmap/mapmanager/mapmanager.js index 19118736763025e374066fb7bbc34cc4f9032595..27810afd468018ba2f04b034734b5a91ac4e1c69 100644 --- a/src/module_vmap/module/javascript/app/vmap/mapmanager/mapmanager.js +++ b/src/module_vmap/module/javascript/app/vmap/mapmanager/mapmanager.js @@ -1372,6 +1372,46 @@ nsVmap.nsMapManager.MapManager.prototype.getJSONLayersTree = function ($bCompare return sJSONLayersTree; }; +/** + * Récupère les sources des couches visibles + * + * @return {array} + */ +nsVmap.nsMapManager.MapManager.prototype.getMapSources = function () { + + var oLayer; + var aSubLayers; + var aSources = []; + var oLayersTree = oVmap.getMapManager().getLayersTree(); + + if (goog.isArray(oLayersTree['children'])) { + for (var i = 0; i < oLayersTree['children'].length; i++) { + if (goog.isDefAndNotNull(oLayersTree['children'][i]['name'])) { + if (goog.isArray(oLayersTree['children'][i]['children'])) { + for (var ii = 0; ii < oLayersTree['children'][i]['children'].length; ii++) { + + oLayer = oLayersTree['children'][i]['children'][ii]; + if (goog.isObject(oLayer['vm4ms_sources']) && + oLayer['olLayer'].getVisible()) { + aSubLayers = oLayer['olLayer'].get('activeSublayers'); + + for (var iii = 0; iii < aSubLayers.length; iii++) { + if (goog.isDefAndNotNull(oLayer['vm4ms_sources'][aSubLayers[iii]])) { + if (aSources.indexOf(oLayer['vm4ms_sources'][aSubLayers[iii]]) === -1) { + aSources.push(oLayer['vm4ms_sources'][aSubLayers[iii]]); + } + } + } + } + } + } + } + } + } + + return aSources +} + /** * LayersTree_ setter * @param {object} oTree Layers tree diff --git a/src/module_vmap/module/javascript/app/vmap/tools/print.js b/src/module_vmap/module/javascript/app/vmap/tools/print.js index 70d38801732b5d7990ce0aba1d270b022a8d15e9..4e28e42085e89c47751e534d4081bb8e524198b2 100644 --- a/src/module_vmap/module/javascript/app/vmap/tools/print.js +++ b/src/module_vmap/module/javascript/app/vmap/tools/print.js @@ -774,6 +774,10 @@ nsVmap.nsToolsManager.Print.prototype.printController.prototype.print = function oPrintScope['user_' + key] = oUserInfos[key]; } } + + // Sources des couches + oPrintScope['layer_sources'] = oVmap.getMapManager().getMapSources(); + sScope = JSON.stringify(oPrintScope); ajaxRequest({