diff --git a/vas/util/printserver/client/map/map.js b/vas/util/printserver/client/map/map.js index 2a870d9a00d0935c5b31cc776ac42210b8d84ed9..d6dcd882b6e15b31919e02a1799a6bb2b0212263 100755 --- a/vas/util/printserver/client/map/map.js +++ b/vas/util/printserver/client/map/map.js @@ -7,7 +7,7 @@ PrintMap = function (opt_options) { var this_ = this; - + this.mapSize = [document.getElementById('map').offsetWidth, document.getElementById('map').offsetHeight]; this.tileSize = (isDef(window.oProperties.print.tile_size) && window.oProperties.print.features_zoom >= 0) ? window.oProperties.print.tile_size : 2048; @@ -29,7 +29,7 @@ PrintMap = function (opt_options) { this.mapJsonParser = new MapJSON({ 'properties': window.oProperties }); - + this.view = this.mapJsonParser.getViewFromDef(this.mapDefinition, { 'size': this.mapSize, 'tileSize': [this.tileSize, this.tileSize] @@ -39,13 +39,13 @@ PrintMap = function (opt_options) { this.extent = this.getExtent(opt_options); - this.tileGrid = this.getTileGridFromDefinition(this.tileSize); - + this.tileGrid = this.getTileGridFromDefinition(this.tileSize); + this.layers = this.mapJsonParser.getLayersFromDef(this.mapDefinition, { 'size': this.mapSize, 'tileSize': [this.tileSize, this.tileSize] }); - + this.map = this.setMap(this.layers, this.view); this.featuresOverlay = this.setFeaturesOverlay(this.map); @@ -63,6 +63,9 @@ PrintMap = function (opt_options) { // Supprime tous les controls par défaut this.removeMapControls(); + // Taille des icones en fonction de la résolution demandée + this.setMapSymbolsResolution(this.map, this.resolutionCoeff) + // Si aucune étendue a été donnée et que seul un point a été donné, alors zoom sur this.defaultScale if (!isDef(opt_options.extent) && !isDef(this.features)) { if (this.features.length === 1 && this.features[0].getGeometry().getType() === 'Point') { @@ -310,7 +313,7 @@ PrintMap.prototype.getFeaturesFromEWKT = function (aEWKTFeatures) { }; /** - * Return true if EWKTGeom is an EWKT geometry + * Return true if EWKTGeom is an EWKT geometry * @param {string} EWKTGeom * @returns {boolean} */ @@ -367,4 +370,21 @@ PrintMap.prototype.getGeomFromEWKT = function (EWKTGeom, proj) { return null; } -}; \ No newline at end of file +}; + +/** + * For WMS layers set MAP.RESOLUTION and MAP.DEFRESOLUTION to rise the symbols size + * + * @param {object} olMap + * @param {integer} resolutionCoeff + */ +PrintMap.prototype.setMapSymbolsResolution = function (olMap, resolutionCoeff) { + + var newRes = resolutionCoeff * 72; + var aLayers = olMap.getLayers().getArray(); + for (var i = 0; i < aLayers.length; i++) { + if (aLayers[i].get('type') === 'imagewms' || aLayers[i].get('type') === 'tilewms') { + aLayers[i].getSource().updateParams({'MAP.RESOLUTION': newRes, 'MAP.DEFRESOLUTION': 72}); + } + } +}