diff --git a/module/css/mobile.less b/module/css/mobile.less index a281bf0695a6f93a48f1e91b70ac5e9f288d6716..fd900b75f297d667806837678592ecc6c66f8f34 100755 --- a/module/css/mobile.less +++ b/module/css/mobile.less @@ -276,3 +276,14 @@ app-map > div { #select-bo-select{ max-width: 23vw; } + +.basic-tools-dropdown-select-getFeatureInfo-content{ + display: block; + top: 0px !important; + height: 100%; + padding: 0px !important; + margin: 0px !important; + right: 0px !important; + width: 100% !important; + min-width: auto; +} diff --git a/module/javascript/app/vmap/tools/print.js b/module/javascript/app/vmap/tools/print.js index 342c526f9fc29d74118bafb824bad036e118c50d..8c779787a04216d8ac5ca2ec60d40e2b2bd29a12 100644 --- a/module/javascript/app/vmap/tools/print.js +++ b/module/javascript/app/vmap/tools/print.js @@ -558,7 +558,6 @@ nsVmap.nsToolsManager.Print.prototype.printController.prototype.print = function today = dd + '/' + mm + '/' + yyyy; // Valeurs par défaut - var resolutionCoeff = goog.isDefAndNotNull(opt_options.resolutionCoeff) ? opt_options.resolutionCoeff : 1; var templateId = opt_options.templateId; var printStyleId = opt_options.printStyleId; @@ -573,51 +572,6 @@ nsVmap.nsToolsManager.Print.prototype.printController.prototype.print = function oPrintScope['date'] = goog.isDefAndNotNull(oPrintScope['date']) ? oPrintScope['date'] : today; var sScope = JSON.stringify(oPrintScope); - // Set mapId/mapJson - var sMapId; - var sMapJSON; - if (goog.isDefAndNotNull(opt_options.mapId)) { - sMapId = opt_options.mapId; - } else { - sMapJSON = oVmap.getMapManager().getJSONLayersTree(); - } - - // set EWKTFeatures - var aFeatures = goog.isDefAndNotNull(opt_options.features) ? opt_options.features : []; - var sEWKTFeatures = ''; - for (var i = 0; i < aFeatures.length; i++) { - if (i > 0) - sEWKTFeatures += '|'; - sEWKTFeatures += oVmap.getEWKTFromGeom(aFeatures[i].getGeometry()); - } - - // set extent - var aExtent = goog.isDefAndNotNull(opt_options.extent) ? opt_options.extent : []; - var sExtent = ''; - var aOverviewExtent = [ - aExtent[0] - (aExtent[2] - aExtent[0]), - aExtent[1] - (aExtent[3] - aExtent[1]), - aExtent[2] + (aExtent[2] - aExtent[0]), - aExtent[3] + (aExtent[3] - aExtent[1]) - ]; - var sOverviewExtent = ''; - for (var i = 0; i < aExtent.length; i++) { - if (i > 0) { - sExtent += '|'; - sOverviewExtent += '|'; - } - sExtent += aExtent[i]; - sOverviewExtent += aOverviewExtent[i]; - } - - // Features zoom - var sFeaturesZoom = 100; - if (goog.isDefAndNotNull(opt_options.featuresZoom)) { - sFeaturesZoom = opt_options.featuresZoom; - } else if (goog.isDefAndNotNull(oVmap['properties']['print']['features_zoom'])) { - sFeaturesZoom = oVmap['properties']['print']['features_zoom']; - } - // Ouvre la fenêtre d'impression var printWindow = window.open("", '_blank', 'height=400,width=600'); @@ -664,46 +618,17 @@ nsVmap.nsToolsManager.Print.prototype.printController.prototype.print = function template.innerHTML = response['data']['data'][0]['definition']; var mapImageSize = this_.getTemplateTargetSize(template, '#map_image'); - var overviezSize = this_.getTemplateTargetSize(template, '#map_overview'); - - if (goog.isDefAndNotNull(mapImageSize)) { - var oMapDef = { - 'map_id': sMapId, - 'map_json': sMapJSON, - 'image_size': (mapImageSize[0] * resolutionCoeff) + '|' + (mapImageSize[1] * resolutionCoeff), - 'resolution_coeff': resolutionCoeff, - 'extent': sExtent, - 'features': sEWKTFeatures, - 'features_zoom': sFeaturesZoom - }; - } - - if (goog.isDefAndNotNull(overviezSize)) { - var oOverviewDef = { - 'map_id': sMapId, - 'map_json': sMapJSON, - 'image_size': (overviezSize[0] * resolutionCoeff) + '|' + (overviezSize[1] * resolutionCoeff), - 'resolution_coeff': resolutionCoeff, - 'extent': sOverviewExtent, - 'features': sEWKTFeatures, - 'features_zoom': 400 - }; - } - - var oMapsJson = []; - if (goog.isDefAndNotNull(oMapDef)) { - oMapsJson.push({ - 'target': '#map_image', - 'map_definition': oMapDef - }); - } - if (goog.isDefAndNotNull(oOverviewDef)) { - oMapsJson.push({ - 'target': '#map_overview', - 'map_definition': oOverviewDef - }); - } - var mapsJson = JSON.stringify(oMapsJson); + var overviewSize = this_.getTemplateTargetSize(template, '#map_overview'); + + var mapsJson = this_.getMapsJsonDef({ + mapId: opt_options.mapId, + resolutionCoeff: opt_options.resolutionCoeff, + extent: opt_options.extent, + features: opt_options.features, + featuresZoom: opt_options.featuresZoom, + mapImageSize: mapImageSize, + overviewSize: overviewSize + }) // Récupère les infos de l'utilisateur this_.getUserInfos_().then(function (oUserInfos) { @@ -773,6 +698,99 @@ nsVmap.nsToolsManager.Print.prototype.printController.prototype.print = function return 1; }; +nsVmap.nsToolsManager.Print.prototype.printController.prototype.getMapsJsonDef = function (opt_options) { + oVmap.log('nsVmap.nsToolsManager.Print.prototype.printController.prototype.getMapsJsonDef'); + + // Resolution + var resolutionCoeff = goog.isDefAndNotNull(opt_options.resolutionCoeff) ? opt_options.resolutionCoeff : 1; + + // mapId/mapJson + var sMapId; + var sMapJSON; + if (goog.isDefAndNotNull(opt_options.mapId)) { + sMapId = opt_options.mapId; + } else { + sMapJSON = oVmap.getMapManager().getJSONLayersTree(); + } + + // Extent + var aExtent = goog.isDefAndNotNull(opt_options.extent) ? opt_options.extent : []; + var sExtent = ''; + var aOverviewExtent = [ + aExtent[0] - (aExtent[2] - aExtent[0]), + aExtent[1] - (aExtent[3] - aExtent[1]), + aExtent[2] + (aExtent[2] - aExtent[0]), + aExtent[3] + (aExtent[3] - aExtent[1]) + ]; + var sOverviewExtent = ''; + for (var i = 0; i < aExtent.length; i++) { + if (i > 0) { + sExtent += '|'; + sOverviewExtent += '|'; + } + sExtent += aExtent[i]; + sOverviewExtent += aOverviewExtent[i]; + } + + // Features + var aFeatures = goog.isDefAndNotNull(opt_options.features) ? opt_options.features : []; + var sEWKTFeatures = ''; + for (var i = 0; i < aFeatures.length; i++) { + if (i > 0) + sEWKTFeatures += '|'; + sEWKTFeatures += oVmap.getEWKTFromGeom(aFeatures[i].getGeometry()); + } + + var sFeaturesZoom = 100; + if (goog.isDefAndNotNull(opt_options.featuresZoom)) { + sFeaturesZoom = opt_options.featuresZoom; + } else if (goog.isDefAndNotNull(oVmap['properties']['print']['features_zoom'])) { + sFeaturesZoom = oVmap['properties']['print']['features_zoom']; + } + + if (goog.isDefAndNotNull(opt_options.mapImageSize)) { + var oMapDef = { + 'map_id': sMapId, + 'map_json': sMapJSON, + 'image_size': (opt_options.mapImageSize[0] * resolutionCoeff) + '|' + (opt_options.mapImageSize[1] * resolutionCoeff), + 'resolution_coeff': resolutionCoeff, + 'extent': sExtent, + 'features': sEWKTFeatures, + 'features_zoom': sFeaturesZoom + }; + } + + if (goog.isDefAndNotNull(opt_options.overviewSize)) { + var oOverviewDef = { + 'map_id': sMapId, + 'map_json': sMapJSON, + 'image_size': (opt_options.overviewSize[0] * resolutionCoeff) + '|' + (opt_options.overviewSize[1] * resolutionCoeff), + 'resolution_coeff': resolutionCoeff, + 'extent': sOverviewExtent, + 'features': sEWKTFeatures, + 'features_zoom': 400 + }; + } + + var oMapsJson = []; + if (goog.isDefAndNotNull(oMapDef)) { + oMapsJson.push({ + 'target': '#map_image', + 'map_definition': oMapDef + }); + } + if (goog.isDefAndNotNull(oOverviewDef)) { + oMapsJson.push({ + 'target': '#map_overview', + 'map_definition': oOverviewDef + }); + } + + var mapsJson = JSON.stringify(oMapsJson); + + return mapsJson; +} + /** * Get the size of a target in a template * @param {string} template diff --git a/module/javascript/vitis/script_module.js b/module/javascript/vitis/script_module.js index f14e1f323236a857733612f3f3c22a24fa55164c..00d7bea38f0f130a3f1f55460702749cb216fc1f 100644 --- a/module/javascript/vitis/script_module.js +++ b/module/javascript/vitis/script_module.js @@ -915,7 +915,9 @@ vitisApp.on('appMainDrtvLoaded', function () { } this['getCapabilities'](serviceUrl, { - 'version': serviceVersion + 'version': serviceVersion, + 'service_login': envSrvc["oFormValues"][envSrvc['sFormDefinitionName']]['service_login'], + 'service_password': envSrvc["oFormValues"][envSrvc['sFormDefinitionName']]['service_password'] }).then(function (oResult) { if (goog.isDefAndNotNull(oResult)) { if (goog.isDefAndNotNull(oResult['json'])) { @@ -1098,6 +1100,12 @@ vitisApp.on('appMainDrtvLoaded', function () { if (goog.isDefAndNotNull(scope['oServices'][sServiceId]['service_type_version'])) { envSrvc["oFormValues"][envSrvc['sFormDefinitionName']]["service_type_version"] = scope['oServices'][sServiceId]['service_type_version']; } + if (goog.isDefAndNotNull(scope['oServices'][sServiceId]['service_login'])) { + envSrvc["oFormValues"][envSrvc['sFormDefinitionName']]["service_login"] = scope['oServices'][sServiceId]['service_login']; + } + if (goog.isDefAndNotNull(scope['oServices'][sServiceId]['service_password'])) { + envSrvc["oFormValues"][envSrvc['sFormDefinitionName']]["service_password"] = scope['oServices'][sServiceId]['service_password']; + } } } else { sServiceType = envSrvc['oFormValues'][envSrvc['sFormDefinitionName']]['service_type_id']; @@ -2497,11 +2505,15 @@ vitisApp.on('appMainDrtvLoaded', function () { $translate(["BTN_ADD_LAYERS_VMAP_MAP_LAYER"]).then(function (oTranslations) { var sServiceUrl = envSrvc["oFormValues"][sParentFormDefinitionName]["service_url"]; + var sServiceLogin = envSrvc["oFormValues"][sParentFormDefinitionName]["service_login"]; + var sServicePassword = envSrvc["oFormValues"][sParentFormDefinitionName]["service_password"]; var sVersion = envSrvc["oFormValues"][sParentFormDefinitionName]["service_type_version"]; sServiceUrl = sServiceUrl.replace("[token]", sha256(sessionSrvc["token"])); sServiceUrl = sServiceUrl.replace("[ms_cgi_url]", propertiesSrvc["ms_cgi_url"]); this_['showLayerModalWindow']({ 'service_url': sServiceUrl, + 'service_login': sServiceLogin, + 'service_password': sServicePassword, 'service_version': sVersion, 'buttons': [{ "label": oTranslations["BTN_ADD_LAYERS_VMAP_MAP_LAYER"], @@ -2874,7 +2886,9 @@ vitisApp.on('appMainDrtvLoaded', function () { } else if (goog.isDefAndNotNull(sServiceUrl)) { // Calques du service wms. scope.$root['getCapabilities'](sServiceUrl, { - 'version': opt_options['service_version'] + 'version': opt_options['service_version'], + 'service_login': opt_options['service_login'], + 'service_password': opt_options['service_password'] }).then(function (oGetCapabilities) { oCapabilities = oGetCapabilities; if (goog.isDefAndNotNull(oCapabilities)) { @@ -2906,6 +2920,9 @@ vitisApp.on('appMainDrtvLoaded', function () { "showErrorMessage": true, "version": "1.3.0" }; + var oHeaders = { + "charset": "charset=utf-8" + }; if (typeof (oOptions) == "undefined") oOptions = oDefaultOptions; else { @@ -2918,6 +2935,11 @@ vitisApp.on('appMainDrtvLoaded', function () { if (!goog.isDefAndNotNull(oOptions['showErrorMessage'])) { oOptions['showErrorMessage'] = true; } + if (goog.isDefAndNotNull(oOptions['service_login']) && goog.isDefAndNotNull(oOptions['service_password'])) { + if (oOptions['service_login'].length > 0 && oOptions['service_password'].length > 0) { + oHeaders['Authorization'] = "Basic " + btoa(oOptions['service_login'] + ":" + oOptions['service_password']); + } + } // Création de l'url vers le service. if (sServiceUrl.indexOf("?") === -1) sServiceUrl += "?"; @@ -2941,6 +2963,7 @@ vitisApp.on('appMainDrtvLoaded', function () { "method": "GET", "url": propertiesSrvc['proxy_url'], "params": {"url": sServiceUrl}, + 'headers': oHeaders, "scope": scope, "responseType": "text", "success": function (response) { diff --git a/module/template/tools/print.html b/module/template/tools/print.html index 92421e58d937a6c2116346ef30a024b87037e46d..0a1fd62b4dcf92147ce7b543f37d661637c5f70c 100644 --- a/module/template/tools/print.html +++ b/module/template/tools/print.html @@ -45,8 +45,8 @@ <option value="100">1:100</option> </select> - <div class="hidden print-form-label">Résolution</div> - <select id="select-print-resolution" class="hidden form-control minus" ng-model="ctrl.dpi"> + <div class="print-form-label">Résolution</div> + <select id="select-print-resolution" class="form-control minus" ng-model="ctrl.dpi"> <option value="1">72 dpi</option> <option value="2" ng-show="ctrl.resolution <= 4">144 dpi</option> <option value="4" ng-show="ctrl.resolution <= 2">288 dpi</option> diff --git a/web_service/ws/PrintMapServices.class.inc b/web_service/ws/PrintMapServices.class.inc index 34623aa9e67138ed38103a4660df48aa16457ba8..8c656d82a79f0611936a05c7a3bb8220adcab8db 100755 --- a/web_service/ws/PrintMapServices.class.inc +++ b/web_service/ws/PrintMapServices.class.inc @@ -15,7 +15,7 @@ require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vmlib/BdDataAccess.i * \brief This file contains the PrintMapServices php class * * This class defines the rest api for printmapservices - * + * */ class PrintMapServices extends PrintServices { /** @@ -241,14 +241,6 @@ class PrintMapServices extends PrintServices { } } - // Change la taille de l'image en fonction de la résolution - if (isset($this->aValues['resolution_coeff'])) { - $aImageSize = explode('|', $sImageSize); - $aImageSize[0] = $aImageSize[0] * $this->aValues['resolution_coeff']; - $aImageSize[1] = $aImageSize[1] * $this->aValues['resolution_coeff']; - $sImageSize = implode('|', $aImageSize); - } - // Écrit les paramètres gros dans des fichiers if (is_dir($this->aProperties['vas_home'])) { if (!is_dir($this->aProperties['vas_home'] . '/public')) { @@ -343,4 +335,4 @@ class PrintMapServices extends PrintServices { } -?> \ No newline at end of file +?>