diff --git a/module/css/vmap.less b/module/css/vmap.less index fa7278d2fcf13ac3cdd3f2529f01158bff52c206..cc42f401d348f812f18c9a25d00af7abcaa4dcb4 100644 --- a/module/css/vmap.less +++ b/module/css/vmap.less @@ -2438,23 +2438,3 @@ div.vmap-select-scale-alert{ min-height: 55px; padding-top: 15px !important; } - -.basic-tools-element>span.icon-mirror { - font-size: 16px; - line-height: 0; -} - -.layerstree-nav { - margin-left: 40px; -} - -.layerstree-nav>li>a { - padding: 0px 15px; - border: 1px solid #8a8a8a !important; - color: #333; -} - -.ol-current-projection-compare{ - bottom: 29px; - margin-left: -16%; -} diff --git a/module/forms/vmap_business_object/vmap_business_object_vmap_business_object.js b/module/forms/vmap_business_object/vmap_business_object_vmap_business_object.js index 6a1ab146892cecec6567b3fa5ecc9a3e3bfe53f1..80ce27242794ab26e6305251870eb4adbaa0c17b 100644 --- a/module/forms/vmap_business_object/vmap_business_object_vmap_business_object.js +++ b/module/forms/vmap_business_object/vmap_business_object_vmap_business_object.js @@ -250,11 +250,6 @@ var oFormScope; oFormValues['id_field']['options'] = aColumnsOptions; } } - if (angular.isDefined(oFormValues['sorted_by'])) { - if (angular.isDefined(oFormValues['sorted_by']['options'])) { - oFormValues['sorted_by']['options'] = aColumnsOptions; - } - } if (angular.isDefined(oFormValues['geom_column'])) { if (angular.isDefined(oFormValues['geom_column']['options'])) { oFormValues['geom_column']['options'] = aColumnsOptions; diff --git a/module/forms/vmap_business_object/vmap_business_object_vmap_business_object.json b/module/forms/vmap_business_object/vmap_business_object_vmap_business_object.json index e0168f15efdbb3674d714c7de0f294e58283bb88..17dbe0468ee4c3609c0710e359ad976f627aea44 100644 --- a/module/forms/vmap_business_object/vmap_business_object_vmap_business_object.json +++ b/module/forms/vmap_business_object/vmap_business_object_vmap_business_object.json @@ -280,24 +280,13 @@ }, { "fields": [{ - "type": "editable_select", + "type": "text", "name": "sorted_by", "label": "FORM_SORTED_BY_DEVELOPMENT_0", "required": false, - "nb_cols": 5 - }, { - "type": "button", - "class": "btn-group btn-group-sm margin-top-20", - "nb_cols": 1, - "buttons": [{ - "type": "button", - "name": "table-datalist", - "label": "FORM_SORTED_BY_DEVELOPMENT_0", - "class": "btn-primary", - "event": "loadVMapBoFormColumns()", - "glyphicon": "refresh" - } - ] + "pattern": "", + "nb_cols": 6, + "id": "New_el_9_11_1" }] }, { @@ -720,24 +709,13 @@ }, { "fields": [{ - "type": "editable_select", + "type": "text", "name": "sorted_by", "label": "FORM_SORTED_BY_DEVELOPMENT_0", "required": false, - "nb_cols": 5 - }, { - "type": "button", - "class": "btn-group btn-group-sm margin-top-20", - "nb_cols": 1, - "buttons": [{ - "type": "button", - "name": "table-datalist", - "label": "FORM_SORTED_BY_DEVELOPMENT_0", - "class": "btn-primary", - "event": "loadVMapBoFormColumns()", - "glyphicon": "refresh" - } - ] + "pattern": "", + "nb_cols": 6, + "id": "New_el_9_11_1" }] }, { diff --git a/module/javascript/app/vmap/map/mapcompare.js b/module/javascript/app/vmap/map/mapcompare.js index b3304a3c7800e0e991cc42b0c80bd0a11e4ee882..4fdf3a756d3a58291345c3b5b19ca7a9428f311a 100644 --- a/module/javascript/app/vmap/map/mapcompare.js +++ b/module/javascript/app/vmap/map/mapcompare.js @@ -86,15 +86,8 @@ nsVmap.MapCompare = function () { * @private */ this.vmapTooltip_ = {}; - // Ajoute les couches à reprojeter en cas de changement de carte dans layersToTransform_ this.layersToTransform_ = []; - - // Vide les controls par défaut - var controls = this.oOpenLayersMap_.getControls().getArray(); - for (var i = 0; i < controls.length; i++) { - this.oOpenLayersMap_.removeControl(controls[i]); - } } /** @@ -519,10 +512,8 @@ nsVmap.MapCompare.prototype.mapCompareController = function ($scope, $window, $e 'size': this_.map.getSize(), 'tileSize': tileSize }); - // Définit la vue de la carte this_.addView(olView_); - // Définit les couches de la carte for (var i = 0; i < olLayers_.length; i++) { this_.addLayer(olLayers_[i]); @@ -535,12 +526,6 @@ nsVmap.MapCompare.prototype.mapCompareController = function ($scope, $window, $e setTimeout(function () { this_.updateCompareScaleMap(); }); - - // Affiche le nom de la carte - this_.displayMapName(); - - // Affiche le nom de la carte - this_.displayMapProj(); }) /** @@ -592,7 +577,7 @@ nsVmap.MapCompare.prototype.mapCompareController.prototype.synchronizeMap = func var this_ = this; // Synchro Échelle - this_.map.getTargetElement().addEventListener('mouseleave', function(){ + oVmap.getMap().getOLMap().getTargetElement().addEventListener('mouseenter', function(){ oVmap.getMap().getOLMap().on("moveend", this_.updateCompareScaleMap, this_); this_.map.un("moveend", this_.updateScaleMap, this_); }); @@ -773,35 +758,3 @@ nsVmap.MapCompare.prototype.mapCompareController.prototype.addView = function (o }); } }; - -/** - * Display the map name tool - */ -nsVmap.MapCompare.prototype.mapCompareController.prototype.displayMapName = function () { - oVmap.log('nsVmap.nsMapManager.LayersTree.prototype.LayertreeController.prototype.displayMapName'); - - if ($("#map-name-compare").length == 0) { - $('#olMapCompare').children().children('.ol-overlaycontainer-stopevent').append('<div class="ol-map-name ol-map-name-compare ol-unselectable"><span id="map-name-compare" class="ol-control"></span></div>'); - } - - var vMapCatalog = oVmap.getMapManager().getMapCatalog(); - for (var i = 0; i < vMapCatalog['maps'].length; i++) { - if (vMapCatalog['maps'][i]['compare'] === true) { - var currentMapName = vMapCatalog['maps'][i]['name']; - } - } - $("#map-name-compare").html(currentMapName); -} - -/** - * Display the map proj tool - */ -nsVmap.MapCompare.prototype.mapCompareController.prototype.displayMapProj = function () { - oVmap.log('nsVmap.nsMapManager.LayersTree.prototype.LayertreeController.prototype.displayMapProj'); - - if ($("#current-projection-compare").length == 0) { - $('#olMapCompare').children().children('.ol-overlaycontainer-stopevent').append('<div class="ol-current-projection ol-unselectable ol-current-projection-compare"><span id="current-projection-compare" class="ol-control"></span></div>'); - } - - $("#current-projection-compare").html(oVmap['oProjections'][oVmap.getMapCompare().getOLMap().getView().getProjection().getCode()]); -} diff --git a/module/javascript/app/vmap/mapmanager/layerstree.js b/module/javascript/app/vmap/mapmanager/layerstree.js index 2a5fe743b519e0186dae873e6317327fee403212..673cb4e0f66ff2e60cc0b2faab5137030da12bb0 100644 --- a/module/javascript/app/vmap/mapmanager/layerstree.js +++ b/module/javascript/app/vmap/mapmanager/layerstree.js @@ -117,19 +117,6 @@ nsVmap.nsMapManager.LayersTree.prototype.LayertreeController = function ($scope, */ $scope['tree'] = oVmap.getMapManager().getLayersTree(); - - /** - * The map compare layersTree - * @type {object} - */ - $scope['compareTree'] = {}; - - - /** - * The active map - */ - $scope['activeMap'] = 1; - /** * The current properties */ @@ -207,17 +194,6 @@ nsVmap.nsMapManager.LayersTree.prototype.LayertreeController = function ($scope, }; oVmap.module.controller('AppLayertreeController', nsVmap.nsMapManager.LayersTree.prototype.LayertreeController); -/** - * Resize the layertools - */ -nsVmap.nsMapManager.LayersTree.prototype.LayertreeController.prototype.resize = function () { - oVmap.log('nsVmap.nsMapManager.LayersTree.LayertreeController.resize'); - - setTimeout(function () { - oVmap.resizeLayerTools(); - }); -} - /** * Set a layer visible or not * @param {ol.layer.Base} olLayer @@ -294,8 +270,6 @@ nsVmap.nsMapManager.LayersTree.prototype.LayertreeController.prototype.setGroupV } this.memoriseGroupVisible(node); - - oVmap['scope'].$broadcast('layersChanged'); }; /** @@ -376,14 +350,6 @@ nsVmap.nsMapManager.LayersTree.prototype.LayertreeController.prototype.reloadTre // relance le chargement des couches avec le nouvel arbre this.loadTree(); - // Arbre pour la comparaison - if(this.scope_["$root"]["compare_enabled"]){ - var oCompareTree = jQuery.extend(true, {}, oVmap.getMapManager().getCompareLayersTree()); - this.scope_['compareTree'] = oCompareTree; - } else { - this.scope_['compareTree'] = {}; - } - oVmap.resizeLayerTools(false); }; @@ -672,20 +638,6 @@ nsVmap.nsMapManager.LayersTree.prototype.LayertreeController.prototype.closeLaye } } } - - if (goog.isDefAndNotNull(this.scope_['compareTree'])) { - if (goog.isArray(this.scope_['compareTree']['children'])) { - for (var i = 0; i < this.scope_['compareTree']['children'].length; i++) { - if (goog.isDefAndNotNull(this.scope_['compareTree']['children'][i]['children'])) { - for (var ii = 0; ii < this.scope_['compareTree']['children'][i]['children'].length; ii++) { - if (goog.isDefAndNotNull(this.scope_['compareTree']['children'][i]['children'][ii]['olLayer'])) { - this.scope_['compareTree']['children'][i]['children'][ii]['displayedMenu'] = false; - } - } - } - } - } - } }; /** diff --git a/module/javascript/app/vmap/mapmanager/maplegend.js b/module/javascript/app/vmap/mapmanager/maplegend.js index c6759068d12cdca81139276cf329080ba8fe1adf..48d2e54ec1915eb1e28b91b4908630d62aa5b32c 100644 --- a/module/javascript/app/vmap/mapmanager/maplegend.js +++ b/module/javascript/app/vmap/mapmanager/maplegend.js @@ -136,17 +136,7 @@ nsVmap.nsMapManager.MapLegend.prototype.maplegendController = function ($scope) /** * @private */ - this['oUrls'] = {}; - - /** - * @private - */ - this['oCompareUrls'] = {}; - - /** - * The active map - */ - $scope['activeMap'] = 1; + this['aUrls'] = []; /** * Contains the events stocked by listenLayers() @@ -168,18 +158,6 @@ nsVmap.nsMapManager.MapLegend.prototype.maplegendController = function ($scope) }); }; - -/** - * Resize the layertools - */ -nsVmap.nsMapManager.MapLegend.prototype.maplegendController.prototype.resize = function () { - oVmap.log('nsVmap.nsMapManager.MapLegend.maplegendController.resize'); - - setTimeout(function () { - oVmap.resizeLayerTools(); - }); -} - /** * Loads the legend * @export @@ -187,26 +165,18 @@ nsVmap.nsMapManager.MapLegend.prototype.maplegendController.prototype.resize = f nsVmap.nsMapManager.MapLegend.prototype.maplegendController.prototype.loadLegend = function () { oVmap.log('nsVmap.nsMapManager.MapLegend.maplegendController.loadLegend'); - this['oUrls'] = this.getLegendUrls(oVmap.getMap().getOLMap()); + this['oUrls'] = this.getLegendUrls(); this.downloadLegendImgs(this['oUrls']); - - if(this.$scope_["$root"]["compare_enabled"]){ - this['oCompareUrls'] = this.getLegendUrls(oVmap.getMapCompare().getOLMap()); - this.downloadLegendImgs(this['oCompareUrls']); - } else { - this['oCompareUrls'] = {}; - } }; /** * Get the legend URLs - * @param {object} olMap * @returns {object} */ -nsVmap.nsMapManager.MapLegend.prototype.maplegendController.prototype.getLegendUrls = function (olMap) { +nsVmap.nsMapManager.MapLegend.prototype.maplegendController.prototype.getLegendUrls = function () { oVmap.log('nsVmap.nsMapManager.MapLegend.maplegendController.getLegendUrls'); - var aLayers = olMap.getLayers().getArray(); + var aLayers = oVmap.getMap().getOLMap().getLayers().getArray(); var oUrls = {}; // Récupération des URL WMS diff --git a/module/javascript/app/vmap/mapmanager/mapmanager.js b/module/javascript/app/vmap/mapmanager/mapmanager.js index d42d368d9bce08e8b42bcc399a3efab62aee2ec9..13114d60d7874701fa6fc84a16d079e020ee1634 100644 --- a/module/javascript/app/vmap/mapmanager/mapmanager.js +++ b/module/javascript/app/vmap/mapmanager/mapmanager.js @@ -314,7 +314,7 @@ nsVmap.nsMapManager.MapManager.prototype.loadCompareMap = function (element) { var this_ = this; this_.getAjaxLayersTree(sUrl, function(oTree){ - oVmap.log("oCompareTree: ", oTree); + oVmap.log("oTree: ", oTree); // Change la variable oLayersTree this_.setCompareLayersTree(oTree); @@ -927,7 +927,7 @@ nsVmap.nsMapManager.MapManager.prototype.ajaxGetMapCatalog = function (sUrl) { * @return {object<LayersTree>} */ nsVmap.nsMapManager.MapManager.prototype.getAjaxLayersTree = function (sUrl, callback) { - var oLayersTree; + var LayersTree; ajaxRequest({ 'method': 'GET', @@ -937,9 +937,11 @@ nsVmap.nsMapManager.MapManager.prototype.getAjaxLayersTree = function (sUrl, cal 'success': function (response) { var data = JSON.parse(response['data']); if (goog.isDef(data['mapjsons'])) { - oLayersTree = data['mapjsons'][0]; + LayersTree = data['mapjsons'][0]; } - callback.call(this, oLayersTree); + + oVmap.log(LayersTree); + callback.call(this, LayersTree); } }); }; diff --git a/module/javascript/app/vmap/tools/controls.js b/module/javascript/app/vmap/tools/controls.js index 6fee41a7d7821c2ffb37070543fbe7aaef4e23df..67b20e2e0fa4df43af05829b3365f6282f0ae60d 100755 --- a/module/javascript/app/vmap/tools/controls.js +++ b/module/javascript/app/vmap/tools/controls.js @@ -31,7 +31,7 @@ goog.require('ol.format.TopoJSON'); /** * @classdesc * Class {@link nsVmap.nsToolsManager.Controls}: Add the controls defined in data/tools.json, - * available : Attribution, FullScreen, MousePosition, OverviewMap, Rotate, ScaleLine, Zoom, ZoomSlider, + * available : Attribution, FullScreen, MousePosition, OverviewMap, Rotate, ScaleLine, Zoom, ZoomSlider, * ZoomToExtent, CurrentProjection, DragAndDrop (GPX,GeoJSON,IGC,KML,TopoJSON) * @param {array} aControls Controls to set * @constructor @@ -273,7 +273,7 @@ nsVmap.nsToolsManager.Controls.prototype.addControl = function (control) { /** * Toggle a control to the ol map * @param {string} control Control to toggle - * @param {boolean} bActive + * @param {boolean} bActive * @export */ nsVmap.nsToolsManager.Controls.prototype.setToolActive = function (control, bActive) { @@ -426,4 +426,4 @@ nsVmap.nsToolsManager.Controls.prototype.getOverviewMap = function () { // Définit la directive et le controller oVmap.module.directive('appControls', nsVmap.nsToolsManager.Controls.prototype.controlsDirective); -oVmap.module.controller('AppControlsController', nsVmap.nsToolsManager.Controls.prototype.controlsController); +oVmap.module.controller('AppControlsController', nsVmap.nsToolsManager.Controls.prototype.controlsController); \ No newline at end of file diff --git a/module/javascript/app/vmap/tools/insert.js b/module/javascript/app/vmap/tools/insert.js index ce07b2686567b9c5002a2441209ecb8a80568318..456136bce313f4f78931835bdeec5e500dec4500 100644 --- a/module/javascript/app/vmap/tools/insert.js +++ b/module/javascript/app/vmap/tools/insert.js @@ -317,19 +317,6 @@ nsVmap.nsToolsManager.Insert.prototype.inserttoolController = function ($scope, // Supprime du trou de la feature (si il existe) feature lors de la sélection sur l'interaction this.deleteHole_ this.deleteHole_.on('select', this.deleteHole, this); - // Évite les superpositions à l'édition - this.modify_.on('modifyend', function (evt) { - - // Récupère la feature ajoutée - var aFeatures = evt.features.getArray(); - - var j = 0; - for (var i = 0; i < aFeatures.length; i++) { - // Évite les superpositions avec les autres couches si besoin - this_.avoidSuperpositions(aFeatures[i]); - } - }); - // Lance updateInsertObjectFeature lors de chaque changement sur this.oOverlayFeatures_ // si il n'y a pas eut de changements pendant 500ms var iTmpChanges = 0; @@ -337,7 +324,6 @@ nsVmap.nsToolsManager.Insert.prototype.inserttoolController = function ($scope, // Retire les anciennes features si on est pas en mode multi var sGeomType = $scope['oInsertObject']['sGeomType']; - // Si il ne s'agit pas d'une géométrie multiple if (goog.isDefAndNotNull(sGeomType)) { if (sGeomType.substr(0, 5) !== 'MULTI' && sGeomType !== 'GEOMETRYCOLLECTION') { @@ -1258,7 +1244,7 @@ nsVmap.nsToolsManager.Insert.prototype.inserttoolController.prototype.setDiffGeo this_.setDiffGeom_(aSuperpositionBos, olFeature, opt_options); } }, function(err){ - console.error('Cannot get the diff geom: ', err); + console.error('Cannot get the diff geom: ', err) }); } @@ -1296,11 +1282,11 @@ nsVmap.nsToolsManager.Insert.prototype.inserttoolController.prototype.getDiffGeo return 0; } if (!goog.isDefAndNotNull(response['data'][0])) { - deferred.resolve(sEWKTGeom); + deferred.reject('response.data[0] not defined'); return 0; } if (!goog.isDefAndNotNull(response['data'][0]['diff_geom'])) { - deferred.resolve(sEWKTGeom); + deferred.reject('response.data[0].diff_geom not defined'); return 0; } deferred.resolve(response['data'][0]['diff_geom']); diff --git a/module/javascript/app/vmap/tools/location.js b/module/javascript/app/vmap/tools/location.js index 415bd9cb19f286c3fcb11ea2c8818f5b60dc3c30..4cd96440554191c47a0415289ddde0cb77eb6065 100644 --- a/module/javascript/app/vmap/tools/location.js +++ b/module/javascript/app/vmap/tools/location.js @@ -197,25 +197,12 @@ nsVmap.nsToolsManager.Location.prototype.locationController = function ($scope, fHistoryDelayHandler = $timeout(function () { if(this_['iHistoryOffset'] === 0){ - - var oNewLocation = { + this_["aLocationHistory"].push({ center: this_.map_.getView().getCenter(), zoom: this_.map_.getView().getZoom() - } - - var oLastLocation = this_['aLocationHistory'][this_['aLocationHistory'].length - 1]; - - if (this_['aLocationHistory'].length > 0) { - if (oNewLocation.zoom === oLastLocation.zoom && - oNewLocation.center[0] === oLastLocation.center[0] && - oNewLocation.center[1] === oLastLocation.center[1]) { - return 0; - } - } - - this_["aLocationHistory"].push(oNewLocation); + }); } else { - // splice + // splice var iHistoryPosition = this_['aLocationHistory'].length - (this_['iHistoryOffset']); this_["aLocationHistory"].splice(iHistoryPosition, this_['iHistoryOffset'], { center: this_.map_.getView().getCenter(), diff --git a/module/javascript/app/vmap/tools/print.js b/module/javascript/app/vmap/tools/print.js index 11d16df791e0e3264dd1b1fed622b4db3647e2fc..efc99e6add1af7135b89c9210efd195df339902c 100644 --- a/module/javascript/app/vmap/tools/print.js +++ b/module/javascript/app/vmap/tools/print.js @@ -635,22 +635,14 @@ nsVmap.nsToolsManager.Print.prototype.printController.prototype.print = function var printStyleId = opt_options.printStyleId; // Set includesJSON - var aIncludes = [{ + var includesJson = JSON.stringify([{ 'target': '#map_legend', - 'html': this_.getLegendTemplate('#maplegend') - }]; - if(this.$scope_["$root"]["compare_enabled"]){ - aIncludes.push({ - 'target': '#map_legend_compare', - 'html': this_.getLegendTemplate('#compare_maplegend') - }); - } - var includesJson = JSON.stringify(aIncludes); + 'html': this_.getLegendTemplate() + }]); // Set scope var oPrintScope = goog.isDefAndNotNull(opt_options.scope) ? opt_options.scope : {}; oPrintScope['date'] = goog.isDefAndNotNull(oPrintScope['date']) ? oPrintScope['date'] : today; - oPrintScope['compare_mode'] = this.$scope_["$root"]["compare_enabled"] === true ? true : false; var sScope = JSON.stringify(oPrintScope); // Ouvre la fenêtre d'impression @@ -788,10 +780,6 @@ nsVmap.nsToolsManager.Print.prototype.printController.prototype.print = function return 1; }; -/** - * Get the maps JSON defs - * @param {object} opt_options - */ nsVmap.nsToolsManager.Print.prototype.printController.prototype.getMapsJsonDef = function (opt_options) { oVmap.log('nsVmap.nsToolsManager.Print.prototype.printController.prototype.getMapsJsonDef'); @@ -940,12 +928,11 @@ nsVmap.nsToolsManager.Print.prototype.printController.prototype.getTemplateTarge /** * Get the html definition of the template with base64 images - * @param {string} sTarget * @returns {String} */ -nsVmap.nsToolsManager.Print.prototype.printController.prototype.getLegendTemplate = function (sTarget) { +nsVmap.nsToolsManager.Print.prototype.printController.prototype.getLegendTemplate = function () { - var template = $(sTarget).clone(); + var template = $('#maplegend').clone(); // Transforme les images en base64 template.find('img').each(function (index) { diff --git a/module/javascript/app/vmap/tools/select/select.js b/module/javascript/app/vmap/tools/select/select.js index 0944cee5c36c0157e090e853d22cadfe027a9f6e..9c89bc22cbe78198752e73c76846568ace3d2d68 100755 --- a/module/javascript/app/vmap/tools/select/select.js +++ b/module/javascript/app/vmap/tools/select/select.js @@ -539,14 +539,13 @@ nsVmap.nsToolsManager.Select.prototype.selectController = function ($scope, $tim // Récupère la feature ajoutée var aFeatures = evt.features.getArray(); + // Évite les superpositions avec les autres couches si besoin var j = 0; for (var i = 0; i < aFeatures.length; i++) { - // Évite les superpositions avec les autres couches si besoin this_.avoidSuperpositions(aFeatures[i]).then(function(){ j++; if (!j < aFeatures.length) { setTimeout(function () { - // Enregistre les changements this_.putFeaturesOnTheElement(this_.oOverlayFeatures_.getArray()); }); } @@ -557,7 +556,6 @@ nsVmap.nsToolsManager.Select.prototype.selectController = function ($scope, $tim setTimeout(function () { if (j === 0) { console.error('avoidSuperpositions never sents callback'); - // Enregistre les changements this_.putFeaturesOnTheElement(this_.oOverlayFeatures_.getArray()); } }, 3000); @@ -2334,11 +2332,11 @@ nsVmap.nsToolsManager.Select.prototype.selectController.prototype.getDiffGeom_ = return 0; } if (!goog.isDefAndNotNull(response['data'][0])) { - deferred.resolve(sEWKTGeom); + deferred.reject('response.data[0] not defined'); return 0; } if (!goog.isDefAndNotNull(response['data'][0]['diff_geom'])) { - deferred.resolve(sEWKTGeom); + deferred.reject('response.data[0].diff_geom not defined'); return 0; } deferred.resolve(response['data'][0]['diff_geom']); diff --git a/module/javascript/app/vmap/tools/urlexporter.js b/module/javascript/app/vmap/tools/urlexporter.js index d531827eddb069217fffec94531c0200d183ca03..d89684f26f381a40125ee0d52a88f24eaa559637 100644 --- a/module/javascript/app/vmap/tools/urlexporter.js +++ b/module/javascript/app/vmap/tools/urlexporter.js @@ -68,38 +68,35 @@ nsVmap.nsToolsManager.Urlexporter.prototype.urlExporterController = function ($s /** * @type {string} */ - this["privateExportUrl"] = ""; - + this["urlToExport"] = ""; /** - * @type {string} + * @type {boolean} */ - this["publicExportUrl"] = ""; + this["usePublicToken"] = false; + + this["urlConstructor"](); // recalcule l'url quand on change de carte oVmap['scope'].$on('mapChanged', function () { - this_["privateExportUrl"] = this_.getExportUrl(); - this_["publicExportUrl"] = this_.getExportUrl(true); + this_["urlConstructor"](); }); - // recalcule l'url quand on bouge la carte + $scope.$watch("ctrl.usePublicToken", function(){ + this_["urlConstructor"](); + }) + oVmap.getMap().getOLMap().on("moveend", function(event){ - this_["privateExportUrl"] = this_.getExportUrl(); - this_["publicExportUrl"] = this_.getExportUrl(true); + this_["urlConstructor"](); }); - - // Recalcule l'URL - this_["privateExportUrl"] = this_.getExportUrl(); - this_["publicExportUrl"] = this_.getExportUrl(true); }; /** - * Generates and return the export URL - * @param {boolean} bPublic - * @return {string} + * Display the user form in display mode + * @returns {undefined} * @export */ -nsVmap.nsToolsManager.Urlexporter.prototype.urlExporterController.prototype.getExportUrl = function (bPublic) { - oVmap.log("nsVmap.nsToolsManager.Urlexporter.urlExporterController.getExportUrl"); +nsVmap.nsToolsManager.Urlexporter.prototype.urlExporterController.prototype.urlConstructor = function () { + oVmap.log("nsVmap.nsToolsManager.Urlexporter.urlExporterController.urlConstructor"); var sUrl = this['properties']['web_server_name'] + "/" + this['properties']['application']; @@ -109,7 +106,7 @@ nsVmap.nsToolsManager.Urlexporter.prototype.urlExporterController.prototype.getE } } - sUrl += "?mode_id=vmap&"; + sUrl += "?"; var oMapCatalog = oVmap.getMapManager().getMapCatalog(); var iMapId = oMapCatalog["maps"][oMapCatalog["usedMap"]]["map_id"]; @@ -117,7 +114,7 @@ nsVmap.nsToolsManager.Urlexporter.prototype.urlExporterController.prototype.getE sUrl += "map_id=" + iMapId; // si public add token - if (bPublic === true){ + if (this["usePublicToken"]){ sUrl += "&token=" + this['properties']['public_token']; } @@ -125,23 +122,20 @@ nsVmap.nsToolsManager.Urlexporter.prototype.urlExporterController.prototype.getE var sExtent = oVmap.getMap().getOLMap().getView().calculateExtent(oVmap.getMap().getOLMap().getSize()).join("|"); sUrl += "&extent=" + encodeURI(sExtent); - return sUrl; + this["urlToExport"] = sUrl; }; + /** * Copy the generated URL on the clipboard - * @param {boolean} bPublic + * * @export */ -nsVmap.nsToolsManager.Urlexporter.prototype.urlExporterController.prototype.copyUrl = function (bPublic) { +nsVmap.nsToolsManager.Urlexporter.prototype.urlExporterController.prototype.copyUrl = function () { oVmap.log("nsVmap.nsToolsManager.Urlexporter.urlExporterController.copyUrl"); /* Get the text field */ - if (bPublic === true) { - var copyText = document.getElementById("publicExportUrlField"); - } else { - var copyText = document.getElementById("privateExportUrlField"); - } + var copyText = document.getElementById("urlExporterField"); /* Select the text field */ copyText.select(); diff --git a/module/template/layers/layertree.html b/module/template/layers/layertree.html index 3141c44e2381b972cbd1df47df5f2c3cd7f5de90..5002135b16e7963f77a07de5163eee7f95c04f80 100644 --- a/module/template/layers/layertree.html +++ b/module/template/layers/layertree.html @@ -12,20 +12,10 @@ </div> <div id="layertree" class="layers-tool" collapse="{{ctrl.layerstree_collapsed === true ? 'out' : 'in'}}"> - - <ul class="nav nav-tabs layerstree-nav left" ng-show="$root.compare_enabled"> - <li ng-class="{'active' : activeMap == 1}"> - <a href="#" ng-click="activeMap=1;ctrl.resize()">Carte 1</a> - </li> - <li ng-class="{'active' : activeMap == 2}"> - <a href="#" ng-click="activeMap=2;ctrl.resize()">Carte 2</a> - </li> - </ul> <div class="indicators"> <span class="text-info icon-eye" style="font-size: 18px;line-height: 0" title="Définit si la couche est visible"></span> </div> - - <ul class="tree" ng-show="activeMap == 1 || !$root.compare_enabled"> + <ul class="tree"> <div ng-repeat="node in tree.children| orderBy : 'name'" ng-if="node.view === undefined"> <!-- Service --> @@ -150,108 +140,6 @@ </ul> </div> </ul> - - <ul class="tree" ng-show="activeMap == 2 && $root.compare_enabled"> - <div ng-repeat="node in compareTree.children| orderBy : 'name'" ng-if="node.view === undefined"> - - <!-- Service --> - <div class="layerstree-phather"> - <div class="tree-father-collapse-btn service-name left" data-toggle="collapse" data-target="#comparetree_element_{{$id}}" onclick="setTimeout(function () { - oVmap.resizeLayerTools(true) - }, 500)" title="{{node.name}}"> - {{node.name}} - </div> - <div class="checkbox checkbox-info inline-checkbox right" - ng-class="{'checkbox_indeterminate': node.visible === null}"> - <input id="compare_service_{{$id}}_visible" - ng-init="node.visible = ctrl.isGroupVisible(node)" - ng-model="node.visible" - ng-model-options="{getterSetter: true}" - ng-click="ctrl.setGroupVisible(node)" - type="checkbox" - style="cursor:pointer; position: absolute" - title="Definit si le groupe est visible"> - <label for="compare_service_{{$id}}_visible" - style="cursor:pointer" - title="Definit si le groupe est visible"></label> - </div> - </div> - - <!-- Calque --> - <ul id="comparetree_element_{{$id}}" class="collapse layers-tree-ul tree-element" ng-class="{'in': ctrl.layers_collapsed !== true}"> - <div ng-repeat="layer in node.children"> - <li> - <ul class="list-group-item layertree-item auto-height"> - - <!-- Nom du calque --> - <div class="layer-name layer-name-tree" title="{{layer.name}}">{{layer.name}}</div> - <div class="layer-checkboxes"> - <button type="button" - class="btn btn-xs margin-sides-10 hidden" - ng-click="layer.olLayer.getSource().refreshWithTimestamp()"> - <span class="glyphicon glyphicon-refresh"></span> - </button> - <div type="button" class="btn btn-xs layer-menu-button" ng-click="ctrl.toggleLayerMenu(layer, $event)"> - <span ng-class="{'icon-filter': layer.olLayer.get('is_filtered'), 'icon-format_list_bulleted': !layer.olLayer.get('is_filtered')}"></span> - </div> - <!-- Checkbox visible --> - <div class="checkbox checkbox-info inline-checkbox" style="z-index: 10;"> - <input id="{{layer.$$hashKey}}_compare_visible_order_checkbox" - type="checkbox" - style="cursor:pointer; position: absolute" - title="Definit si le calque est visible" - ng-checked="layer.olLayer.values.visible === true" - ng-click="ctrl.setVisible(layer.olLayer, !layer.olLayer.values.visible);node.visible = ctrl.isGroupVisible(node)"> - <label for="{{layer.$$hashKey}}_compare_visible_order_checkbox" style="cursor:pointer" title="Definit si la couche est visible"></label> - </div> - </div> - </ul> - </li> - <div class="dropdown-menu layer-menu" ng-class="{'block': layer.displayedMenu === true}"> - <div class="layer-menu-list"> - <li ng-if="layer.olLayer.get('is_filtered')" ng-click="ctrl.displayFilterLayerModal(layer.olLayer)"> - <a href="#"> - <span class="icon-filter"></span> - Filtre - </a> - </li> - <li> - <a href="#"> - <div class="row"> - <div class="col-xs-6"> - <span class="icon-star-half"></span> - Transparence - </div> - <div class="col-xs-6"> - <div class="layer-menu-list-slider"> - <input data-app-layer-opacity-slider="" id="compare_slider_layer_form_{{layer.$$hashKey}}" type="text"> - </div> - </div> - </div> - </a> - </li> - <li ng-if="layer.olLayer.get('type') === 'imagewms' || layer.olLayer.get('type') === 'tilewms'" - ng-repeat="sublayer in layer.olLayer.get('sublayers')"> - <div class="sublayer-checkboxes"> - <!-- Checkbox visible --> - <div class="checkbox checkbox-info sublayer-checkbox inline-checkbox"> - <input id="{{layer.$$hashKey}}_compare_sublayer_{{sublayer}}_visible_checkbox" - type="checkbox" - style="cursor:pointer; position: absolute" - title="Definit si la couche est visible" - ng-checked="ctrl.isSublayerActive(layer.olLayer, sublayer)" - ng-disabled="layer.olLayer.values.visible !== true" - ng-click="ctrl.toggleSubLayer(layer.olLayer, sublayer, '#' + layer.$$hashKey + '_sublayer_' + sublayer + '_visible_checkbox')"> - <label for="{{layer.$$hashKey}}_compare_sublayer_{{sublayer}}_visible_checkbox" style="cursor:pointer" title="Definit si la couche est visible">{{sublayer}}</label> - </div> - </div> - </li> - </div> - </div> - </div> - </ul> - </div> - </ul> </div> <!--Modale pour le filtrage--> diff --git a/module/template/layers/maplegend.html b/module/template/layers/maplegend.html index 4c34eb4904c8941687b5019d7b7c9d20076a7b57..a82570aa249be47f2f17a50eb48f4238af16d693 100755 --- a/module/template/layers/maplegend.html +++ b/module/template/layers/maplegend.html @@ -1,9 +1,9 @@ <div class="maplegendtool"> <div ng-if="!$root.is_mobile" id="maplegendcontainer-button"> - <div class="list-group-item active pointer maplegend-button-content" - title="Légende de la carte" + <div class="list-group-item active pointer maplegend-button-content" + title="Légende de la carte" collapse="{{ctrl.legend_collapsed === true ? 'out' : 'in'}}" - data-target="#maplegendcontainer" + data-target="#maplegendcontainer" onclick="oVmap.getMapManager().collapseElement(this)"> <span class="icon-info list-group-icon"></span> <span>Légende</span> @@ -12,15 +12,7 @@ </div> </div> <div id="maplegendcontainer" class="layers-tool legend" collapse="{{ctrl.legend_collapsed === true ? 'out' : 'in'}}"> - <ul class="nav nav-tabs layerstree-nav" ng-show="$root.compare_enabled"> - <li ng-class="{'active' : activeMap == 1}"> - <a href="#" ng-click="activeMap=1;ctrl.resize()">Carte 1</a> - </li> - <li ng-class="{'active' : activeMap == 2}"> - <a href="#" ng-click="activeMap=2;ctrl.resize()">Carte 2</a> - </li> - </ul> - <div id="maplegend" class="tree legend" ng-show="activeMap == 1 || !$root.compare_enabled"> + <div id="maplegend" class="tree legend"> <div ng-repeat="(sLayerName, layer) in ctrl.oUrls" class="layer-legend" ng-show="ctrl.areLegendsLoaded(layer)"> <div id="legend_father{{$index}}" data-toggle="collapse" data-target="#legend_element_{{$index}}"> @@ -31,26 +23,7 @@ <div id="legend_element_{{$index}}" class="collapse in"> <ul class="list-group-item auto-height"> <div ng-repeat="node in layer" - ng-show="node.legendBlobURL"> - <img ng-src="{{node.legendBlobURL}}" class="legend-img" legend-image-node> - </div> - </ul> - </div> - </div> - </div> - - <div id="compare_maplegend" class="tree legend" ng-show="activeMap == 2 && $root.compare_enabled"> - <div ng-repeat="(sLayerName, layer) in ctrl.oCompareUrls" class="layer-legend" - ng-show="ctrl.areLegendsLoaded(layer)"> - <div id="compare_legend_father{{$index}}" data-toggle="collapse" data-target="#compere_legend_element_{{$index}}"> - <div style="display: inline-block; width:98%"> - <div class="legend_father_name" title="{{sLayerName}}">{{sLayerName}}</div> - </div> - </div> - <div id="compare_legend_element_{{$index}}" class="collapse in"> - <ul class="list-group-item auto-height"> - <div ng-repeat="node in layer" - ng-show="node.legendBlobURL"> + ng-show="node.legendBlobURL"> <img ng-src="{{node.legendBlobURL}}" class="legend-img" legend-image-node> </div> </ul> @@ -58,4 +31,4 @@ </div> </div> </div> -</div> +</div> \ No newline at end of file diff --git a/module/template/tools/urlexporter.html b/module/template/tools/urlexporter.html index a1602e307b52d657096cda53b9c1ee618df0a754..c10845a6e2310f0b48ee40f6479e40e21372608f 100644 --- a/module/template/tools/urlexporter.html +++ b/module/template/tools/urlexporter.html @@ -2,29 +2,29 @@ <div class="row margin-sides-0 margin-10"> <div class="col-md-12"> <div class="left"> - <label for="privateExportUrlField" class="control-label">Lien vers la carte en cours</label> + <label for="urlExporterField" class="control-label">Lien vers la carte en cours</label> + </div> + <div class="right" ng-if="ctrl.properties.allow_public_connection"> + <div class="checkbox checkbox-info checkbox-inline"> + <input id="publicAccountCheckbox" + type="checkbox" + style="cursor:pointer;" + title=">Activer / Désactiver le mode public" + ng-model="ctrl.usePublicToken"> + <label for="publicAccountCheckbox" + style="cursor:pointer" + title="Activer / Désactiver le mode public"> + Public + </label> + </div> </div> </div> <div class="col-md-12"> <div class="input-group"> - <span class="input-group-btn"> - <button type="button" class="btn btn-default" disabled><span class="fa fa-lock"></span></button> - </span> - <input type="text" class="form-control" ng-model="ctrl.privateExportUrl" id="privateExportUrlField"> + <input type="text" class="form-control" ng-model="ctrl.urlToExport" id="urlExporterField"> <span class="input-group-btn"> <button type="button" class="btn btn-default" ng-click="ctrl.copyUrl()"><span class="icon-copy"></span></button> </span> </div> </div> - <div class="col-md-12 margin-10" ng-if="ctrl.properties.allow_public_connection"> - <div class="input-group"> - <span class="input-group-btn"> - <button type="button" class="btn btn-default" disabled><span class="fa fa-unlock"></span></button> - </span> - <input type="text" class="form-control" ng-model="ctrl.publicExportUrl" id="publicExportUrlField"> - <span class="input-group-btn"> - <button type="button" class="btn btn-default" ng-click="ctrl.copyUrl(true)"><span class="icon-copy"></span></button> - </span> - </div> - </div> </div>