diff --git a/src/module_vmap/module/css/vmap.less b/src/module_vmap/module/css/vmap.less index 0afd13f194d292e38f188753422b6b48c5ebab8c..b4f322e8829c34aed8157a688b2d4b55e43fc756 100644 --- a/src/module_vmap/module/css/vmap.less +++ b/src/module_vmap/module/css/vmap.less @@ -236,7 +236,7 @@ html, body { position: relative; height: 100%; } -app-map > div { +app-map > div, app-map-compare > div{ width: auto; height: 100%; background-color: @background; @@ -380,7 +380,7 @@ input[readonly] { display: -ms-flex !important; display: flex !important; } -#map-container{ +#map-container, #map-container-compare{ -webkit-transition: all 300ms ease-out 0s; -o-transition: all 300ms ease-out 0s; transition: all 300ms ease-out 0s; @@ -389,8 +389,37 @@ input[readonly] { height: ~"-webkit-calc(100% - 32px)"; height: ~"-o-calc(100% - 32px)"; height: ~"calc(100% - 32px)"; + width : 100%; } -#map-container.minus{ +#map-container.half,#map-container-compare.half{ + width : calc(50% ~"-" @right-sidebar-width/2); + float: left; +} +#map-container-compare.half{ + border-left: solid 2px #4a4a41; +} +/*#map-container.right-module-bar-present{ + width : calc(100% ~"-" @right-sidebar-width); +}*/ +/*#map-container.left-map-manager-open{ + width : calc(100% ~"-" @right-sidebar-width ~"-" @left-sidebar-content-width); +}*/ +#map-container.half.left-map-manager-open, #map-container-compare.half.left-map-manager-open{ + width : calc(50% ~"-" @right-sidebar-width/2 ~"-" @left-sidebar-content-width/2); +} +#map-container.half.right-module-bar-present,#map-container-compare.half.right-module-bar-present{ + width : calc(50% ~"-" @right-sidebar-width/2 ~"-" @left-sidebar-width/2); +} +#map-container.half.right-module-bar-present.left-map-manager-open,#map-container-compare.half.right-module-bar-present.left-map-manager-open{ + width : calc(50% ~"-" @right-sidebar-width/2 ~"-" @left-sidebar-width/2 ~"-" @left-sidebar-content-width/2); +} +#map-container.half.right-module-bar-present.right-module-manager-open,#map-container-compare.half.right-module-bar-present.right-module-manager-open{ + width : calc(50% ~"-" @right-sidebar-width/2 ~"-" @left-sidebar-width/2 ~"-" @right-sidebar-content-width/2); +} +#map-container.half.right-module-bar-present.left-map-manager-open.right-module-manager-open,#map-container-compare.half.right-module-bar-present.left-map-manager-open.right-module-manager-open{ + width : calc(50% ~"-" @right-sidebar-width/2 ~"-" @left-sidebar-width/2 ~"-" @left-sidebar-content-width/2 ~"-" @right-sidebar-content-width/2); +} +#map-container.minus,#map-container-compare.minus{ height: 95%; height: ~"-moz-calc(100% - 47px)"; height: ~"-webkit-calc(100% - 47px)"; @@ -399,13 +428,13 @@ input[readonly] { font-size: 12px; padding: 0px 0px; } -#map-container.open{ +#map-container.open, #map-container-compare.open{ height: -moz-calc(100% ~"-" @botom-open-height ~"-" 47px); height: -webkit-calc(100% ~"-" @botom-open-height ~"-" 47px); height: -o-calc(100% ~"-" @botom-open-height ~"-" 47px); height: calc(100% ~"-" @botom-open-height ~"-" 47px); } -#map-container.open2{ +#map-container.open2, #map-container-compare.open2{ height: -moz-calc(100% ~"-" @botom-open2-height ~"-" 47px); height: -webkit-calc(100% ~"-" @botom-open2-height ~"-" 47px); height: -o-calc(100% ~"-" @botom-open2-height ~"-" 47px); @@ -810,6 +839,35 @@ app-layertree button:hover { text-align: center; background-color: transparent; } + +.ol-target-overlay .ol-target +{ border: 1px solid transparent; + box-shadow: 0 0 1px 1px #fff; + display: block; + height: 20px; + width: 0; +} + +.ol-target-overlay .ol-target:after, +.ol-target-overlay .ol-target:before +{ content:""; + border: 1px solid #369; + box-shadow: 0 0 1px 1px #fff; + display: block; + width: 20px; + height: 0; + position:absolute; + top:9px; + left:-9px; +} +.ol-target-overlay .ol-target:after +{ box-shadow: none; + height: 20px; + width: 0; + top:0px; + left:0px; +} + #map-name, #current-projection{ position: initial; } @@ -2371,3 +2429,16 @@ div.vmap-select-scale-alert{ max-width: 197px !important; text-align: center !important; } + +#basic-tools-dropdown-comapremode{ + margin: -10px -1px; + width: 30%; + min-width: 450px; + max-width: 550px; + min-height: 55px; + padding-top: 15px !important; +} + +.checkbox-inline label::before, .checkbox-inline label::after{ + top: 3px; +} diff --git a/src/module_vmap/module/javascript/app/vmap/map/mapcompare.js b/src/module_vmap/module/javascript/app/vmap/map/mapcompare.js new file mode 100644 index 0000000000000000000000000000000000000000..4fdf3a756d3a58291345c3b5b19ca7a9428f311a --- /dev/null +++ b/src/module_vmap/module/javascript/app/vmap/map/mapcompare.js @@ -0,0 +1,760 @@ +/* global nsVmap, ol, oVmap, goog, angular, vitisApp, bootbox */ + +/** + * @author: Anthony Borghi + * @Description: Fichier contenant la classe nsVmap.MapCompare + * cette classe permet l'initialisation de la carte + */ + +goog.provide('nsVmap.MapCompare'); + +goog.require('oVmap'); + +goog.require('ol.Map'); +goog.require('ol.View'); +goog.require('MapJSON'); +goog.require('ol.Overlay'); +goog.require('ol.source.Vector'); +goog.require('ol.layer.Vector'); +goog.require('goog.async.AnimationDelay'); + +/** + * @classdesc + * Class {@link nsVmap.MapCompare}: initializes the map to compare + * + * @constructor + * @export + */ +nsVmap.MapCompare = function () { + oVmap.log("nsVmap.MapCompare"); + + var this_ = this; + + /** + * Map layers + * @type {Array.<ol.layer>} + * @private + */ + this.olLayers_ = []; + + /** + * Map view + * @type {ol.View} + * @private + */ + this.olView_ = new ol.View({ + center: [0, 0], + zoom: 2 + }); + + /** + * Map + * @type {ol.map} + * @private + */ + this.oOpenLayersMap_ = new ol.Map({ + layers: this.olLayers_, + view: this.olView_, + moveTolerance: 5 + }); + + this.oOpenLayersMap_.getViewport().setAttribute('id', 'map1Compare'); + /** + * Contient les évènements ajoutés sur la carte par la méthode addEventOnMap ou setEventOnMap + * @type {array} + * @private + */ + this.vmapEvents_ = []; + + /** + * Contient les évènements ajoutés sur la carte par la méthode addDrawInteraction ou setDrawInteraction + * @type {array} + * @private + */ + this.vmapInteractions_ = []; + + /** + * Contient les tooltips ajoutés par addTooltip + * @type {array} + * @private + */ + this.vmapOverlays_ = []; + + /** + * Initialisé dans le controlleur + * @type {nsVmap.Map.MapTooltip} + * @private + */ + this.vmapTooltip_ = {}; + // Ajoute les couches à reprojeter en cas de changement de carte dans layersToTransform_ + this.layersToTransform_ = []; +} + +/** + * nsVmap.Map.oOpenLayersMap_ getter + * @return {ol.map} Used map + * @export + * @api experimental + */ +nsVmap.MapCompare.prototype.getOLMap = function () { + return this.oOpenLayersMap_; +}; + +/** + * nsVmap.Map.olView_ setter + * @param {ol.View} view View to use + * @export + * @api experimental + */ +nsVmap.MapCompare.prototype.setOpenLayersView = function (view) { + this.olView_ = view; + this.oOpenLayersMap_.setView(this.olView_); +}; + +/** + * Use this function to add a new vector layer + * @param {object} opt_options + * @param {object} opt_options.style + * @param {object} opt_options.extent + * @param {object} opt_options.minResolution + * @param {object} opt_options.maxResolution + * @param {object} opt_options.opacity + * @param {object} opt_options.properties + * @param {object} opt_options.visible + * @param {object} opt_options.zIndex + * @returns {undefined} + */ +nsVmap.MapCompare.prototype.addVectorLayer = function (opt_options) { + oVmap.log('nsVmap.MapCompare.prototype.addVectorLayer'); + + var vectorLayer = new ol.layer.Vector({ + map: this.oOpenLayersMap_, + source: new ol.source.Vector({ + useSpatialIndex: false + }), + updateWhileAnimating: true, + updateWhileInteracting: true + }); + + if (goog.isDef(opt_options)) { + if (goog.isDef(opt_options.style)) + vectorLayer.setStyle(opt_options.style); + + if (goog.isDef(opt_options.extent)) + vectorLayer.setExtent(opt_options.extent); + + if (goog.isDef(opt_options.minResolution)) + vectorLayer.setMinResolution(opt_options.minResolution); + + if (goog.isDef(opt_options.maxResolution)) + vectorLayer.setMaxResolution(opt_options.maxResolution); + + if (goog.isDef(opt_options.opacity)) + vectorLayer.setOpacity(opt_options.opacity); + + if (goog.isDef(opt_options.properties)) + vectorLayer.setProperties(opt_options.properties); + + if (goog.isDef(opt_options.visible)) + vectorLayer.setVisible(opt_options.visible); + + if (goog.isDef(opt_options.zIndex)) + vectorLayer.setZIndex(opt_options.zIndex); + } + + // Ajoute la couche à layersToTransform_ pour que les features soient reprojetés en cas de changement de projection + this.layersToTransform_.push(vectorLayer); + + return vectorLayer; +}; + +/** + * Remove events and interactions and then add a interaction + * @param {ol.interaction.Interaction} interaction + * @param {string|undefined} currentAction name of the current action + * @returns {ol.interaction.Interaction} + */ +nsVmap.MapCompare.prototype.setInteraction = function (interaction, currentAction) { + oVmap.log('nsVmap.MapCompare.prototype.setInteraction'); + // Supprime les anciens évènements et interractions + this.removeActionsOnMap(); + // Ajoute la nouvelle interaction + this.addInteraction(interaction); + // Définit l'action en cours + if (goog.isDef(currentAction)) + this.setCurrentAction(currentAction); + return interaction; +}; + +/** + * Add a interaction + * @param {ol.interaction.Interaction} interaction + * @param {string|undefined} currentAction name of the current action + * @returns {ol.interaction.Interaction} + */ +nsVmap.MapCompare.prototype.addInteraction = function (interaction, currentAction) { + oVmap.log('nsVmap.MapCompare.prototype.addInteraction'); + // Ajout de l'interaction + this.oOpenLayersMap_.addInteraction(interaction); + // Stocke l'interaction + this.vmapInteractions_.push(interaction); + // Définit l'action en cours + if (goog.isDef(currentAction)) + this.setCurrentAction(currentAction); + return interaction; +}; + +/** + * currentAction setter + * @param {string} currentAction + * @export + */ +nsVmap.MapCompare.prototype.setCurrentAction = function (currentAction) { + var scope = angular.element($("#map1Compare")).scope(); + scope.$evalAsync(function (scope) { + scope['ctrl']['currentAction'] = currentAction; + }); +}; + +/** + * Remove the mapTooltip and the actions added by addEventOnMap, setEventOnMap, addDrawInteraction or setDrawInteraction + * @returns {undefined} + * @export + */ +nsVmap.MapCompare.prototype.removeActionsAndTooltips = function () { + this.removeActionsOnMap(); + //this.getMapTooltip().hide(); + for (var i = 0; i < this.vmapOverlays_.length; i++) { + this.vmapOverlays_[i].getElement().style.display = "none"; + } +}; + +/** + * Remove the events and draw interactions added by addEventOnMap, setEventOnMap, addDrawInteraction or setDrawInteraction + * @returns {undefined} + * @export + */ +nsVmap.MapCompare.prototype.removeActionsOnMap = function () { + oVmap.log('nsVmap.Map.prototype.removeActionsOnMap'); + // Supprime les évènements + for (var i = 0; i < this.vmapEvents_.length; i++) { + ol.Observable.unByKey(this.vmapEvents_[i]); + } + + // Supprime les interractions + for (var i = 0; i < this.vmapInteractions_.length; i++) { + + // Supprime les features occasionelles + if (goog.isDef(this.vmapInteractions_[i].getFeatures)) + this.vmapInteractions_[i].getFeatures().clear(); + this.oOpenLayersMap_.removeInteraction(this.vmapInteractions_[i]); + } + + // Définit l'action en cours + this.setCurrentAction(''); +}; + +/** + * Set a event on the map and remove the others. + * @param {string|Array.<string>} type The event type or array of event types. + * @param {function(?): ?} listener The listener function. + * @param {Object=} opt_this The object to use as `this` in `listener`. + * @param {string|undefined} currentAction name of the current action + * @return {goog.events.Key} Unique key for the listener. + * @export + */ +nsVmap.MapCompare.prototype.setEventOnMap = function (type, listener, opt_this, currentAction) { + oVmap.log('nsVmap.Map.prototype.setEventOnMap'); + if (!goog.isDef(type)) { + console.error('setEventOnMap: type not defined'); + return 0; + } + + if (!goog.isDef(listener)) { + console.error('setEventOnMap: listener not defined'); + return 0; + } + + opt_this = goog.isDef(opt_this) ? opt_this : ''; + // Supprime les anciens évènements et interractions + this.removeActionsOnMap(); + // Ajoute le nouvel évènement + var event = this.addEventOnMap(type, listener, opt_this); + // Définit l'action en cours + if (goog.isDef(currentAction)) + this.setCurrentAction(currentAction); + return event; +}; + +/** + * Add a certain type of event on the map. + * @param {string|Array.<string>} type The event type or array of event types. + * @param {function(?): ?} listener The listener function. + * @param {Object=} opt_this The object to use as `this` in `listener`. + * @param {string|undefined} currentAction name of the current action + * @return {goog.events.Key} Unique key for the listener. + * @export + */ +nsVmap.MapCompare.prototype.addEventOnMap = function (type, listener, opt_this, currentAction) { + + if (!goog.isDef(type)) { + console.error('setEventOnMap: type not defined'); + return 0; + } + + if (!goog.isDef(listener)) { + console.error('setEventOnMap: listener not defined'); + return 0; + } + + opt_this = goog.isDef(opt_this) ? opt_this : ''; + // Active l'évènement + var event = this.oOpenLayersMap_.on(type, listener, opt_this); + // Stocke l'évènement + this.vmapEvents_.push(event); + // Définit l'action en cours + if (goog.isDef(currentAction)) + this.setCurrentAction(currentAction); + return event; +}; + +/** + * Get the current scale + * @param {object} opt_options + * @param {boolean|undefined} opt_options.pretty true for pretty format (ex: 1:25,000) + * @returns {Number|String} + * @export + */ +nsVmap.MapCompare.prototype.getScale = function (opt_options) { + oVmap.log('nsVmap.MapCompare.prototype.getScale'); + + opt_options = goog.isDef(opt_options) ? opt_options : {}; + opt_options['pretty'] = goog.isDef(opt_options['pretty']) ? opt_options['pretty'] : false; + + var wgs84Sphere_ = new ol.Sphere(6378137); + var projection = this.oOpenLayersMap_.getView().getProjection(); + + var map = oVmap.getMapCompare().getOLMap(); + + // récupère les coordonnées d'une ligue de 1cm (avec le zoom en cours) + var line = map.getView().calculateExtent([37.795275591, 0]); + var c1 = ol.proj.transform([line[0], line[1]], projection, 'EPSG:4326'); + var c2 = ol.proj.transform([line[2], line[3]], projection, 'EPSG:4326'); + + // Récuère la longueur sur la carte de la ligne de 1cm + var length = wgs84Sphere_.haversineDistance(c1, c2); + + // donc 1m sur la carte correspond à (length mètres dans la réalité x 100) + var scale = length * 100; + + // Rend l'échelle sous format (1:25,000) + if (opt_options['pretty'] === true) { + scale = this.getPrettyScale(scale); + } + + return scale; +}; + +/** + * Set the map scale + * @param {number} scale + * @returns {number} new scale + * @export + */ +nsVmap.MapCompare.prototype.setScale = function (scale) { + oVmap.log('nsVmap.Map.prototype.setScale'); + + // calcule et va à l'échelle celon une règle de 3 + var currentScale = this.getScale(); + var currentResolution = this.oOpenLayersMap_.getView().getResolution(); + + var scaleResolution = scale * currentResolution / currentScale; + this.oOpenLayersMap_.getView().setResolution(scaleResolution); + + // Ajuste l'échelle en augementant la résolution + currentScale = this.getScale(); + + oVmap.log(currentScale); +}; + +/** + * Get the scale like (1:25,000) + * @param {number} scale + * @returns {String} scale (pretty) + */ +nsVmap.MapCompare.prototype.getPrettyScale = function (scale) { + + // Rend l'échelle sous format (1:25,000) + scale = String(Math.round(scale)); + var j = 1; + for (var i = scale.length - 1; i > 0; i--) { + if (j % 3 === 0) + scale = scale.slice(0, i) + ',' + scale.slice(i + Math.abs(0)); + j++; + } + scale = '1:' + scale; + + return scale; +}; + +/** + * App-specific directive wrapping the ngeo map directive. The directive's + * controller has a property "map" including a reference to the OpenLayers + * map. + * + * @return {angular.Directive} The directive specs. + * @constructor + */ +nsVmap.MapCompare.prototype.mapCompareDirective = function () { + oVmap.log("nsVmap.MapCompare.prototype.mapCompareDirective"); + return { + restrict: 'E', + scope: { + 'map': '=appMap', + 'currentAction': '=appAction' + }, + controller: 'AppMapCompareController', + controllerAs: 'ctrl', + bindToController: true, + template: '<div id="olMapCompare"></div>' + }; +}; + +/** + * The application's main controller. + * @ngInject + * @constructor + */ +nsVmap.MapCompare.prototype.mapCompareController = function ($scope, $window, $element, $timeout) { + oVmap.log("nsVmap.MapCompare.prototype.mapController"); + var this_ = this; + + /** + * @private + */ + this.$scope_ = $scope; + + /** + * @type {object} + */ + this.element = $element; + + /** + * Animation duration + * @type Number + * @private + */ + this.duration = 1000; + + /** + * Timestamp of the last map center sync + */ + this.lastMapSyncCenter_ = 0; + + /** + * Timestamp of the last map compare center sync + */ + this.lastCompareMapSyncCenter_ = 0; + + /** + * Timestamp of the last map scale sync + */ + this.lastMapSyncScale_ = 0; + + /** + * Timestamp of the last map compare scale sync + */ + this.lastCompareMapSyncScale_ = 0; + + /** + * @type {ol.Map} + * @private + */ + this.map = this['map']; + /** + * @type {ol.Overlay} + * @private + */ + this.targetOverlay_ = null; + + /** + * Objet permettant de lancer des fonctions utiles + * pour parser la définition de la carte + * @type MapJSON + */ + var oMapJSON = new MapJSON({ + 'properties': oVmap['properties'] + }); + + var tileSize = [oVmap['properties']['vmap']['wmsTilesWidth'], oVmap['properties']['vmap']['wmsTilesHeight']]; + + /** + * Contains the tileloaderror and imageloaderror events + * @private + */ + this.loadErrorEventsContainer_ = []; + + this.map.setTarget('olMapCompare'); + + $scope.$on("mapCompareChanged", function(){ + // MAJ de la taille du composant + this_.map.setSize([document.getElementById('olMapCompare').offsetWidth, document.getElementById('olMapCompare').offsetHeight]); + if (this_.map.getLayers().getArray().length > 0) + this_.map.getLayers().clear(); + + var tree_ = oVmap.getMapManager().getCompareLayersTree(); + var olView_ = oMapJSON.getViewFromDef(tree_, { + 'size': this_.map.getSize(), + 'tileSize': tileSize + }); + + var olLayers_ = oMapJSON.getLayersFromDef(tree_, { + '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]); + } + $timeout(function(){ + this_.synchronizeMap(); + }, 10); + + // Rafraichit l'échelle + setTimeout(function () { + this_.updateCompareScaleMap(); + }); + }) + + /** + * Update the map size with animation + * @type goog.async.AnimationDelay + */ + this.animationDelay = new goog.async.AnimationDelay( + function () { + this_.map.updateSize(); + this_.map.renderSync(); + if (goog.now() - start < this_.duration) { + this_.animationDelay.start(); + } + }, $window); + + /** + * Watch for resizing + */ + $scope.$watchCollection(function () { + return [this_.element.children()[0]['clientWidth'], this_.element.children()[0]['clientHeight']]; + }, function () { + this_.startAnimation(); + }); +}; + +// Définit les directives et controlleurs +oVmap.module.directive('appMapCompare', nsVmap.MapCompare.prototype.mapCompareDirective); +oVmap.module.controller('AppMapCompareController', nsVmap.MapCompare.prototype.mapCompareController); + +/** + * Update the map size with animation + * @returns {undefined} + * @export + */ +nsVmap.MapCompare.prototype.mapCompareController.prototype.startAnimation = function () { + oVmap.log('nsVmap.MapCompare.prototype.mapCompareController.prototype.startAnimation'); + start = goog.now(); + this.animationDelay.stop(); + this.animationDelay.start(); +}; + +/** + * Update the map size with animation + * @returns {undefined} + */ +nsVmap.MapCompare.prototype.mapCompareController.prototype.synchronizeMap = function () { + oVmap.log('nsVmap.MapCompare.prototype.mapCompareController.prototype.synchronizeMap'); + + var this_ = this; + + // Synchro Échelle + oVmap.getMap().getOLMap().getTargetElement().addEventListener('mouseenter', function(){ + oVmap.getMap().getOLMap().on("moveend", this_.updateCompareScaleMap, this_); + this_.map.un("moveend", this_.updateScaleMap, this_); + }); + this_.map.getTargetElement().addEventListener('mouseenter', function(){ + oVmap.getMap().getOLMap().un("moveend", this_.updateCompareScaleMap, this_); + this_.map.on("moveend", this_.updateScaleMap, this_); + }); + + // Synchro centre + oVmap.getMap().getOLMap().on("pointerdrag", this_.updateCenterCompareMap, this_); + this_.map.on("pointerdrag", this_.updateCenterMap, this_); + + // Synchro curseur sur l'autre carte + oVmap.getMap().getOLMap().on('pointermove', function(e){ + var coord = e.coordinate; + //si le composant existe sur l'autre composant on le supprime + if(angular.element(".over-map-compare.ol-target-overlay").length > 0){ + this_.targetOverlay_.setPosition(undefined); + this_.map.removeOverlay(this_.targetOverlay_); + this_.targetOverlay_ = undefined; + angular.element(".over-map-compare.ol-target-overlay").remove(); + } + // si le composant n'existe pas on le crée + if (!this_.targetOverlay_){ + var element = document.createElement("div"); + element.classList.add("ol-target"); + this_.targetOverlay_ = new ol.Overlay({ 'element': element }); + this_.targetOverlay_.setPositioning('center-center'); + this_.map.addOverlay(this_.targetOverlay_); + element.parentElement.classList.add("ol-target-overlay"); + element.parentElement.classList.add("over-map"); + // hack to render targetOverlay before positioning it + this_.targetOverlay_.setPosition([0,0]); + } + + var oldProjection = oVmap.getMap().getOLMap().getView().getProjection().getCode(); + var newProjection = this_.map.getView().getProjection().getCode(); + + var convertCoord = ol.proj.transform(coord, oldProjection, newProjection) + + this_.targetOverlay_.setPosition(convertCoord); + }); + this_.map.on('pointermove', function(e){ + var coord = e.coordinate; + //si le composant existe sur l'autre composant on le supprime + if(angular.element(".over-map.ol-target-overlay").length > 0){ + this_.targetOverlay_.setPosition(undefined); + oVmap.getMap().getOLMap().removeOverlay(this_.targetOverlay_); + this_.targetOverlay_ = undefined; + angular.element(".over-map-compare.ol-target-overlay").remove(); + } + // si le composant n'existe pas on le crée + if (!this_.targetOverlay_){ + var element = document.createElement("div"); + element.classList.add("ol-target"); + this_.targetOverlay_ = new ol.Overlay({ 'element': element }); + this_.targetOverlay_.setPositioning('center-center'); + oVmap.getMap().getOLMap().addOverlay(this_.targetOverlay_); + element.parentElement.classList.add("ol-target-overlay"); + element.parentElement.classList.add("over-map-compare"); + // hack to render targetOverlay before positioning it + this_.targetOverlay_.setPosition([0,0]); + } + + var oldProjection = this_.map.getView().getProjection().getCode(); + var newProjection = oVmap.getMap().getOLMap().getView().getProjection().getCode(); + + var convertCoord = ol.proj.transform(coord, oldProjection, newProjection) + + this_.targetOverlay_.setPosition(convertCoord); + }); +}; + +/** + * Update the map extent with animation + * @returns {undefined} + */ +nsVmap.MapCompare.prototype.mapCompareController.prototype.updateCompareScaleMap = function(e) { console.log('updateCompareScaleMap'); + var this_ = this + this_.updateCenterCompareMap(); + oVmap.getMapCompare().setScale(oVmap.getMap().getScale()); + + this.lastCompareMapSyncScale_ = Date.now(); +} + +/** + * Update the map extent with animation + * @returns {undefined} + */ +nsVmap.MapCompare.prototype.mapCompareController.prototype.updateScaleMap = function(e) { console.log('updateScaleMap'); + var this_ = this + this_.updateCenterMap(); + oVmap.getMap().setScale(oVmap.getMapCompare().getScale()); + + this.lastMapSyncScale_ = Date.now(); +} + +/** +* Update the map extent with animation +* @returns {undefined} +*/ +nsVmap.MapCompare.prototype.mapCompareController.prototype.updateCenterMap = function(e) { + + var this_ = this + // Récupère l'étendue de la carte principale + var oldCenter = this_.map.getView().getCenter(); + + // Récupère l'ancienne et la nouvelle projection + var newProjection = oVmap.getMap().getOLMap().getView().getProjection().getCode(); + var oldProjection = this_.map.getView().getProjection().getCode(); + + var newCenter = ol.proj.transform(oldCenter, oldProjection, newProjection); + oVmap.getMap().getOLMap().getView().setCenter(newCenter); + + this.lastMapSyncCenter_ = Date.now(); +} + +/** +* Update the map extent with animation +* @returns {undefined} +*/ +nsVmap.MapCompare.prototype.mapCompareController.prototype.updateCenterCompareMap = function(e) { + + var this_ = this; + // Récupère l'étendue de la carte principale + var oldCenter = oVmap.getMap().getOLMap().getView().getCenter(); + + // Récupère l'ancienne et la nouvelle projection + var oldProjection = oVmap.getMap().getOLMap().getView().getProjection().getCode(); + var newProjection = this_.map.getView().getProjection().getCode(); + + var newCenter = ol.proj.transform(oldCenter, oldProjection, newProjection); + this_['map'].getView().setCenter(newCenter); + + this.lastCompareMapSyncCenter_ = Date.now(); +} + +/** + * Add a layer on the map + * @param {object} olLayer + */ +nsVmap.MapCompare.prototype.mapCompareController.prototype.addLayer = function (olLayer) { + oVmap.log('nsVmap.MapCompare.prototype.mapCompareController.prototype.addLayer'); + this['map'].addLayer(olLayer); +}; + +/** + * Add the olView + * @param {object} olView + * @returns {undefined} + */ +nsVmap.MapCompare.prototype.mapCompareController.prototype.addView = function (olView) { + oVmap.log('nsVmap.nsMapManager.LayersTree.prototype.LayertreeController.prototype.addView'); + + // Récupère l'étendue de la carte principale + var oldExtent = oVmap.getMap().getOLMap().getView().calculateExtent(this['map'].getSize()); + + // Récupère l'ancienne et la nouvelle projection + var oldProjection = oVmap.getMap().getOLMap().getView().getProjection().getCode(); + var newProjection = olView.getProjection().getCode(); + + // Set le home position pour cette vue + olView.set('homePosition', { + center: olView.getCenter(), + resolution: olView.getResolution() + }); + + oVmap.getMapCompare().setOpenLayersView(olView); + this['map'].setView(olView); + this['proj'] = olView.getProjection().getCode(); + + // Reprojette en cas de changment de carte + if (goog.isDef(oldProjection) && goog.isDef(newProjection) && goog.isDef(oldExtent) /*&& goog.isDef(oldPosition)*/) { + // Reprojette l'étendue + var newExtent = ol.proj.transformExtent(oldExtent, oldProjection, newProjection); + this['map'].getView().fit(newExtent, { + nearest: true + }); + } +}; 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 c13c9aae888788c3844528a192df7f652b71cb9a..13114d60d7874701fa6fc84a16d079e020ee1634 100644 --- a/src/module_vmap/module/javascript/app/vmap/mapmanager/mapmanager.js +++ b/src/module_vmap/module/javascript/app/vmap/mapmanager/mapmanager.js @@ -45,6 +45,12 @@ nsVmap.nsMapManager.MapManager = function () { * @private */ this.oLayersTree_ = {}; + /** + * Object which contains the layers tree + * @type {object} + * @private + */ + this.oCompareLayersTree_ = {}; /** * Objet which contains the map modal manager tool @@ -281,20 +287,73 @@ nsVmap.nsMapManager.MapManager.prototype.loadMap = function (element) { }); }; +/** + * Load a new map to compare + * @param {object} element Html element witch contains the url to the map.json file + * @param {object} element.url link to the map.json file + * @export + */ +nsVmap.nsMapManager.MapManager.prototype.loadCompareMap = function (element) { + oVmap.log('nsVmap.nsMapManager.MapManager.loadCompareMap'); + + if (oVmap['properties']['is_mobile']) { + oVmap.getToolsManager().getBasicTools().hideMobileMenu(); + } + + // Récupère l'url + var sUrl = element.getAttribute("url"); + + if (!goog.isDefAndNotNull(sUrl)) { + return 0; + } + if (sUrl.length === 0) { + return 0; + } + + // Récupère l'arbre de couches + var this_ = this; + this_.getAjaxLayersTree(sUrl, function(oTree){ + + oVmap.log("oTree: ", oTree); + + // Change la variable oLayersTree + this_.setCompareLayersTree(oTree); + + // Rafraichit la carte + this_.reloadMap(); + + // Signale que c'est la carte utilisée + for (var i = 0; i < this_.oMapCatalog_['maps'].length; i++) { + if (this_.oMapCatalog_['maps'][i]['url'] === sUrl) + this_.oMapCatalog_['compareMap'] = i; + } + this_.setUsedMap('compare'); + + oVmap.log("oVmap.event: mapCompareChanged"); + oVmap['scope'].$broadcast('mapCompareChanged'); + angular.element('#map-compare-tool-btn').click(); + setTimeout(function () { + oVmap.resizeLayerTools(); + }, 1000); + }); +}; + /** * Put the used map to used * @returns {undefined} */ -nsVmap.nsMapManager.MapManager.prototype.setUsedMap = function () { +nsVmap.nsMapManager.MapManager.prototype.setUsedMap = function (sKey) { oVmap.log('nsVmap.nsMapManager.MapManager.prototype.setUsedMap'); + sKey = (goog.isDefAndNotNull(sKey)) ? sKey : 'used'; + // Met toutes les cartes à used = false for (var i = 0; i < this.oMapCatalog_['maps'].length; i++) { - this.oMapCatalog_['maps'][i]['used'] = false; + this.oMapCatalog_['maps'][i][sKey] = false; } // Met la carte utilisée à used = true - this.oMapCatalog_['maps'][this.oMapCatalog_['usedMap']]['used'] = true; + this.oMapCatalog_['maps'][this.oMapCatalog_[sKey + 'Map']][sKey] = true; oVmap.resizeLayerTools(false); }; @@ -1206,16 +1265,59 @@ nsVmap.nsMapManager.MapManager.prototype.getLayersTree = function () { return this.oLayersTree_; }; +/** + * LayersTree_ getter (also set the visibility of the layers with the new ones) + * @return {object} Layers tree + * @api experimental + * @export + */ +nsVmap.nsMapManager.MapManager.prototype.getCompareLayersTree = function () { + + var oMap = oVmap.getMapCompare().getOLMap(); + var aLayers = oMap.getLayers().getArray(); + + /** + * Recursive function that update parameters recursively + * @param {object} node + */ + var updateOnTree = function (node) { + // Recursive + if (goog.isDef(node['children'])) { + for (var i = 0; i < node['children'].length; i++) { + updateOnTree(node['children'][i]); + } + } + // Update + if (goog.isDef(node['olLayer'])) { + node['visible'] = node['olLayer'].getVisible(); + node['index'] = aLayers.indexOf(node['olLayer']); + node['opacity'] = node['olLayer'].getOpacity(); + } + }; + + for (var i = 0; i < this.oCompareLayersTree_['children'].length; i++) { + updateOnTree(this.oCompareLayersTree_['children'][i]); + } + + return this.oCompareLayersTree_; +}; + /** * Get the JSON layers tree * @returns {String} * @export */ -nsVmap.nsMapManager.MapManager.prototype.getJSONLayersTree = function () { +nsVmap.nsMapManager.MapManager.prototype.getJSONLayersTree = function ($bCompareLayersTree) { // recupère une copie de l'arbre des couches var oLayersTree = jQuery.extend(true, {}, oVmap.getMapManager().getLayersTree()); var oMap = oVmap.getMap().getOLMap(); + + if($bCompareLayersTree){ + oLayersTree = jQuery.extend(true, {}, oVmap.getMapManager().getCompareLayersTree()); + oMap = oVmap.getMapCompare().getOLMap(); + } + var aDiscardedAttributes = [ 'olLayer', '$$hashKey', @@ -1281,6 +1383,15 @@ nsVmap.nsMapManager.MapManager.prototype.getJSONLayersTree = function () { nsVmap.nsMapManager.MapManager.prototype.setLayersTree = function (oTree) { this.oLayersTree_ = oTree; }; +/** + * LayersTree_ setter + * @param {object} oTree Layers tree + * @api experimental + * @export + */ +nsVmap.nsMapManager.MapManager.prototype.setCompareLayersTree = function (oTree) { + this.oCompareLayersTree_ = oTree; +}; /** * oMapCatalog_ getter diff --git a/src/module_vmap/module/javascript/app/vmap/mapmanager/mapmodal/maplistlitle.js b/src/module_vmap/module/javascript/app/vmap/mapmanager/mapmodal/maplistlitle.js index bd1150b4f386c2807fa30a27b3638aeeb84a8c26..0782d0c2dc9c6cb82acca40e873c11c7c2ec3bb9 100644 --- a/src/module_vmap/module/javascript/app/vmap/mapmanager/mapmodal/maplistlitle.js +++ b/src/module_vmap/module/javascript/app/vmap/mapmanager/mapmodal/maplistlitle.js @@ -42,7 +42,11 @@ nsVmap.nsMapManager.nsMapModal.MapListLitle.prototype.maplistlitleDirective = fu controller: 'AppMaplistlitleController', controllerAs: 'ctrl', bindToController: true, - templateUrl: oVmap['properties']['vmap_folder'] + '/' + 'template/layers/mapmodal/' + (oVmap['properties']['is_mobile'] ? 'maplistlitle_mobile.html' : 'maplistlitle.html') + templateUrl: oVmap['properties']['vmap_folder'] + '/' + 'template/layers/mapmodal/' + (oVmap['properties']['is_mobile'] ? 'maplistlitle_mobile.html' : 'maplistlitle.html'), + link : function ($scope, $element, $attrs){ + $scope["compare"] = goog.isDefAndNotNull($attrs["compare"]); + $attrs.$observe("compare", function(){$scope["compare"] = goog.isDefAndNotNull($attrs["compare"])}); + } }; }; diff --git a/src/module_vmap/module/javascript/app/vmap/requires.js b/src/module_vmap/module/javascript/app/vmap/requires.js index 2eae1b6a727b42ff523d7e606e3dfa5baecbe4fd..997cb30e697bb1d836e3591af4d3f28eb68c81c6 100755 --- a/src/module_vmap/module/javascript/app/vmap/requires.js +++ b/src/module_vmap/module/javascript/app/vmap/requires.js @@ -8,7 +8,8 @@ goog.provide('vmap'); goog.require('oVmap'); goog.require('nsVmap.Map'); +goog.require('nsVmap.MapCompare'); goog.require('nsVmap.Map.MapTooltip'); goog.require('nsVmap.Map.MapPopup'); goog.require('nsVmap.nsMapManager.MapManager'); -goog.require('nsVmap.nsToolsManager.ToolsManager'); \ No newline at end of file +goog.require('nsVmap.nsToolsManager.ToolsManager'); diff --git a/src/module_vmap/module/javascript/app/vmap/tools/basictools.js b/src/module_vmap/module/javascript/app/vmap/tools/basictools.js index f53955c43cccd66024db099c860b32b003b11aca..32d672545e8e07809eef979e646647a798855dd1 100644 --- a/src/module_vmap/module/javascript/app/vmap/tools/basictools.js +++ b/src/module_vmap/module/javascript/app/vmap/tools/basictools.js @@ -17,6 +17,7 @@ goog.require('nsVmap.nsToolsManager.Select'); goog.require('nsVmap.nsToolsManager.Insert'); goog.require('nsVmap.nsToolsManager.Print'); goog.require('nsVmap.nsToolsManager.Urlexporter'); +goog.require('nsVmap.nsToolsManager.Compare'); /** @@ -429,4 +430,4 @@ nsVmap.nsToolsManager.BasicTools.prototype.basictoolsController.prototype.locati // Définit la directive et le controller oVmap.module.directive('appBasictools', nsVmap.nsToolsManager.BasicTools.prototype.basictoolsDirective); -oVmap.module.controller('AppBasictoolsController', nsVmap.nsToolsManager.BasicTools.prototype.basictoolsController); \ No newline at end of file +oVmap.module.controller('AppBasictoolsController', nsVmap.nsToolsManager.BasicTools.prototype.basictoolsController); diff --git a/src/module_vmap/module/javascript/app/vmap/tools/compare.js b/src/module_vmap/module/javascript/app/vmap/tools/compare.js new file mode 100644 index 0000000000000000000000000000000000000000..076766831e9746bc36e12cac715b641048b9b8ed --- /dev/null +++ b/src/module_vmap/module/javascript/app/vmap/tools/compare.js @@ -0,0 +1,81 @@ +/* global oVmap, nsVmap, goog, ol, vitisApp */ + +/** + * @author: Anthony Borghi + * @Description: Fichier contenant la classe nsVmap.nsToolsManager.Urlexporter + * cette classe permet à l'utilisateur d'exporter une url pour un autre utilisateur + */ +goog.provide('nsVmap.nsToolsManager.Compare'); + +goog.require('oVmap'); + +/** + * @classdesc + * Class {@link nsVmap.nsToolsManager.VmapUser} + * @constructor + * @export + */ +nsVmap.nsToolsManager.compare = function () { + oVmap.log('nsVmap.nsToolsManager.Compare'); +}; + + + +/** + * Directive + * @return {angular.Directive} The directive specs. + * @constructor + */ +nsVmap.nsToolsManager.compare.prototype.compareDirective = function () { + oVmap.log("nsVmap.nsToolsManager.compare.prototype.compareDirective"); + return { + restrict: 'A', + scope: { + 'map': '=appMap', + 'lang': '=appLang' + }, + controller: 'AppCompareMode', + controllerAs: 'ctrl', + bindToController: true, + templateUrl: oVmap['properties']['vmap_folder'] + '/' + 'template/tools/comparemapmanager.html' + }; +}; + +/** + * Controler + * @constructor + * @param {object} $scope + * @returns {undefined} + * @ngInject + */ +nsVmap.nsToolsManager.compare.prototype.compareController = function ($scope, $element) { + oVmap.log("nsVmap.nsToolsManager.compare.prototype.compareController"); + + var this_ = this; + + this.$scope_ = $scope; + + /** + * The current properties + */ + this['properties'] = oVmap['properties']; + + /** + * The current token + */ + this['token'] = oVmap['properties']['token']; + + /** + * @type {boolean} + */ + this["useCompareMode"] = false; + + $scope.$watch("ctrl.useCompareMode", function(){ + $scope.$root["compare_enabled"] = this_["useCompareMode"]; + }) + +}; + +// Définit la directive et le controller +oVmap.module.directive('appCompareMode', nsVmap.nsToolsManager.compare.prototype.compareDirective); +oVmap.module.controller('AppCompareMode', nsVmap.nsToolsManager.compare.prototype.compareController); diff --git a/src/module_vmap/module/javascript/app/vmap/tools/infocontainer.js b/src/module_vmap/module/javascript/app/vmap/tools/infocontainer.js index e04b0496471f34d663bfaed78a3dfe88d0e20ac2..e499814f2fbb84c8edcb52ff224fbab69d70bd8a 100644 --- a/src/module_vmap/module/javascript/app/vmap/tools/infocontainer.js +++ b/src/module_vmap/module/javascript/app/vmap/tools/infocontainer.js @@ -662,6 +662,7 @@ nsVmap.nsToolsManager.InfoContainer.prototype.infocontainerController.prototype. $("#opener-bottombar").css("visibility", "visible"); } $("#map-container").addClass('minus'); + $("#map-container-compare").addClass('minus'); // Ouvre la barre this.$timeout(function () { 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 8c779787a04216d8ac5ca2ec60d40e2b2bd29a12..efc99e6add1af7135b89c9210efd195df339902c 100644 --- a/src/module_vmap/module/javascript/app/vmap/tools/print.js +++ b/src/module_vmap/module/javascript/app/vmap/tools/print.js @@ -103,6 +103,9 @@ nsVmap.nsToolsManager.Print.prototype.printController = function ($timeout, $com */ $scope['modelIndex'] = 0; + $scope["managePrintZoneInProgress"] = false; + $scope["manageComparePrintZoneInProgress"] = false; + /** * @public */ @@ -173,7 +176,12 @@ nsVmap.nsToolsManager.Print.prototype.printController = function ($timeout, $com * The print box object * @private */ - this.printBox_ = new nsVmap.nsToolsManager.PrintBox(); + this.printBox_ = new nsVmap.nsToolsManager.PrintBox({'map_object':oVmap.getMap()}); + /** + * The print box object + * @private + */ + this.printBoxCompare_ = new nsVmap.nsToolsManager.PrintBox({'map_object':oVmap.getMapCompare()}); // mise à jour de l'échelle dans le forulaire d'impression lors d'un mouvement sur la carte this.listenScaleChanges(); @@ -197,6 +205,9 @@ nsVmap.nsToolsManager.Print.prototype.printController = function ($timeout, $com oVmap['scope'].$on('toggleOutTools', function () { if (!$('#print-select-btn').hasClass('active')) { this_.printBox_.hide(); + this_.printBoxCompare_.hide(); + $scope["managePrintZoneInProgress"] = false; + $scope["manageComparePrintZoneInProgress"] = false; } }); }; @@ -352,7 +363,10 @@ nsVmap.nsToolsManager.Print.prototype.printController.prototype.loadModelParmas2 oVmap.log('nsVmap.nsToolsManager.Print.printController.loadModelParmas2'); // Récupère la taille de la carte this.printedMapSize_ ainsi que le coefficient this.resizeCoeff_ - this.setPrintedMapSize(this.template_); + oPrintMapSize = this.getPrintedMapSize(this.template_); + + this.printedMapSize_ = oPrintMapSize.printedMapSize; + this.resizeCoeff_ = oPrintMapSize.resizeCoeff; // Pré-rempli le champ "Résolution" this['resolution'] = this.resizeCoeff_; @@ -364,6 +378,23 @@ nsVmap.nsToolsManager.Print.prototype.printController.prototype.loadModelParmas2 this.printBox_.setSize(this.printedMapSize_); this.printBox_.show(); + if(this.$scope_["$root"]["compare_enabled"]){ + this.oComparePrintMapSize = this.getPrintedMapSize(this.template_,"#map1Compare","#map_image_compare"); + if(this.oComparePrintMapSize !== 0){ + // Pré-rempli le champ "Résolution" + this['resolutionCompare'] = this.oComparePrintMapSize.resizeCoeff; + + // Ajuste l'échelle avec le niveau de détail + this['currentScaleCompare'] = oVmap.getMapCompare().getPrettyScale(oVmap.getMapCompare().getScale() / this.oComparePrintMapSize.resizeCoeff); + + // Dessine un carré d'impression à chaque mouvement de la carte + this.printBoxCompare_.setSize(this.oComparePrintMapSize.printedMapSize); + this.printBoxCompare_.show(); + } else { + this.printBoxCompare_.hide(); + } + } + }; /** @@ -398,17 +429,24 @@ nsVmap.nsToolsManager.Print.prototype.printController.prototype.setTemplate = fu }; /** - * Set this.printedMapSize_ and this.resizeCoeff_ - * @param {object} template + * Get the print map size and resolution coeff + * + * @param {type} template + * @param {type} sElementMapId + * @param {type} sPrintId + * @return {object} */ -nsVmap.nsToolsManager.Print.prototype.printController.prototype.setPrintedMapSize = function (template) { - oVmap.log('nsVmap.nsToolsManager.Print.printController.setPrintedMapSize'); +nsVmap.nsToolsManager.Print.prototype.printController.prototype.getPrintedMapSize = function (template, sElementMapId, sPrintId) { + oVmap.log('nsVmap.nsToolsManager.Print.printController.getPrintedMapSize'); - var imageDiv = $(template).find('#map_image'); + sPrintId = (goog.isDefAndNotNull(sPrintId)) ? sPrintId : '#map_image'; + sElementMapId = (goog.isDefAndNotNull(sElementMapId)) ? sElementMapId : '#map1'; + + var imageDiv = $(template).find(sPrintId); // Vérifie la présence de '#map_image' if (!goog.isDef(imageDiv.get(0))) { - console.error('Aucune balise #map_image trouvée dans le template'); + console.error('Aucune balise ' + sPrintId + ' trouvée dans le template'); return 0; } @@ -423,16 +461,19 @@ nsVmap.nsToolsManager.Print.prototype.printController.prototype.setPrintedMapSiz $(template).remove(); // Vérifie si la taille de la carte est suppérieur à la taille de l'écran - this.resizeCoeff_ = 1; + var resizeCoeff = 1; var tmpWidth = angular.copy(mapWidth); var tmpHeight = angular.copy(mapHeight); - while (mapWidth > ($('#map1').width()) || mapHeight > ($('#map1').height())) { - this.resizeCoeff_++; - mapWidth = tmpWidth / this.resizeCoeff_; - mapHeight = tmpHeight / this.resizeCoeff_; + while (mapWidth > ($(sElementMapId).width()) || mapHeight > ($(sElementMapId).height())) { + resizeCoeff++; + mapWidth = tmpWidth / resizeCoeff; + mapHeight = tmpHeight / resizeCoeff; } - this.printedMapSize_ = [mapWidth, mapHeight]; + return { + printedMapSize: [mapWidth, mapHeight], + resizeCoeff: resizeCoeff + } }; /** @@ -469,13 +510,32 @@ nsVmap.nsToolsManager.Print.prototype.printController.prototype.changeScale = fu nsVmap.nsToolsManager.Print.prototype.printController.prototype.managePrintZone = function () { oVmap.log('nsVmap.nsToolsManager.Print.prototype.printController.prototype.managePrintZone'); - if (this['currentAction'] === 'print-modifyPrintZone') { + if (this['currentAction'] === 'print-modifyPrintZone' && this.$scope_['managePrintZoneInProgress']) { this.printBox_.unmanagePrintBox(); + this.$scope_["managePrintZoneInProgress"] = false; } else { + this.$scope_["managePrintZoneInProgress"] = true; this.printBox_.managePrintBox('print-modifyPrintZone'); } }; +/** + * Detach the printZone from the view and allow to translate it + * @export + */ +nsVmap.nsToolsManager.Print.prototype.printController.prototype.manageComparePrintZone = function () { + oVmap.log('nsVmap.nsToolsManager.Print.prototype.printController.prototype.manageComparePrintZone'); + + if (this['currentAction'] === 'print-modifyPrintZone' && this.$scope_["manageComparePrintZoneInProgress"]) { + this.printBoxCompare_.unmanagePrintBox(); + this.$scope_["manageComparePrintZoneInProgress"] = false; + } else { + //this.printBox_.unmanagePrintBox(); + this.$scope_["manageComparePrintZoneInProgress"] = true; + this.printBoxCompare_.managePrintBox('print-modifyPrintZone'); + } +}; + /** * Prepare the print params and launch it * @returns {undefined} @@ -504,15 +564,28 @@ nsVmap.nsToolsManager.Print.prototype.printController.prototype.prepareAndLaunch var aPopupOverlayFeatures = oVmap.getMap().getPopupOverlayFeatures().getArray(); var aSelectionOverlayFeatures = oVmap.getMap().getSelectionOverlayFeatures().getArray(); - // Lance l'impression - var returnPrint = this.print({ + var oPrintOptions = { scope: scope, extent: extent, templateId: templateId, printStyleId: this.$scope_['selectedPrintstyleId'], resolutionCoeff: this['dpi'], features: goog.array.concat(aLocationOverlayFeatures, aPopupOverlayFeatures, aSelectionOverlayFeatures) - }); + }; + + // récupération des infos pour la carte de comparaison si le mode comparaison est actif + if(this.$scope_['$root']["compare_enabled"]){ + if(this.oComparePrintMapSize !== 0){ + // Enregistre l'échelle actuelle + this.currentScaleCompare_ = oVmap.getMapCompare().getScale({ + 'pretty': true + }); + oPrintOptions.extentCompare = this.printBoxCompare_.getExtent(); + } + } + + // Lance l'impression + var returnPrint = this.print(oPrintOptions); if (returnPrint === 1) { // Ferme l'outil d'impression @@ -618,9 +691,10 @@ nsVmap.nsToolsManager.Print.prototype.printController.prototype.print = function template.innerHTML = response['data']['data'][0]['definition']; var mapImageSize = this_.getTemplateTargetSize(template, '#map_image'); + var mapImageSizeCompare = this_.getTemplateTargetSize(template, '#map_image_compare'); var overviewSize = this_.getTemplateTargetSize(template, '#map_overview'); - var mapsJson = this_.getMapsJsonDef({ + var oJsonDefOptions = { mapId: opt_options.mapId, resolutionCoeff: opt_options.resolutionCoeff, extent: opt_options.extent, @@ -628,7 +702,15 @@ nsVmap.nsToolsManager.Print.prototype.printController.prototype.print = function featuresZoom: opt_options.featuresZoom, mapImageSize: mapImageSize, overviewSize: overviewSize - }) + } + + if(goog.isDefAndNotNull(opt_options.extentCompare)){ + oJsonDefOptions.extentCompare = opt_options.extentCompare; + oJsonDefOptions.mapIdCompare = opt_options.mapIdCompare; + oJsonDefOptions.mapImageSizeCompare = mapImageSizeCompare; + } + + var mapsJson = this_.getMapsJsonDef(oJsonDefOptions); // Récupère les infos de l'utilisateur this_.getUserInfos_().then(function (oUserInfos) { @@ -707,11 +789,18 @@ nsVmap.nsToolsManager.Print.prototype.printController.prototype.getMapsJsonDef = // mapId/mapJson var sMapId; var sMapJSON; + var sMapIdCompare; + var sMapJSONCompare; if (goog.isDefAndNotNull(opt_options.mapId)) { sMapId = opt_options.mapId; } else { sMapJSON = oVmap.getMapManager().getJSONLayersTree(); } + if (goog.isDefAndNotNull(opt_options.mapIdCompare)) { + sMapIdCompare = opt_options.mapIdCompare; + } else if (this.$scope_['$root']["compare_enabled"]) { + sMapJSONCompare = oVmap.getMapManager().getJSONLayersTree(true); + } // Extent var aExtent = goog.isDefAndNotNull(opt_options.extent) ? opt_options.extent : []; @@ -723,13 +812,16 @@ nsVmap.nsToolsManager.Print.prototype.printController.prototype.getMapsJsonDef = aExtent[3] + (aExtent[3] - aExtent[1]) ]; var sOverviewExtent = ''; + var sCompareExtent = ''; for (var i = 0; i < aExtent.length; i++) { if (i > 0) { sExtent += '|'; sOverviewExtent += '|'; + sCompareExtent += (goog.isDefAndNotNull(opt_options.extentCompare)) ? '|' : ''; } sExtent += aExtent[i]; sOverviewExtent += aOverviewExtent[i]; + sCompareExtent += (goog.isDefAndNotNull(opt_options.extentCompare)) ? opt_options.extentCompare[i] : ''; } // Features @@ -771,6 +863,15 @@ nsVmap.nsToolsManager.Print.prototype.printController.prototype.getMapsJsonDef = 'features_zoom': 400 }; } + if (goog.isDefAndNotNull(opt_options.mapImageSizeCompare) && this.$scope_.$root["compare_enabled"]) { + var oCompareDef = { + 'map_id': sMapIdCompare, + 'map_json': sMapJSONCompare, + 'image_size': (opt_options.mapImageSizeCompare[0] * resolutionCoeff) + '|' + (opt_options.mapImageSizeCompare[1] * resolutionCoeff), + 'resolution_coeff': resolutionCoeff, + 'extent': sCompareExtent + }; + } var oMapsJson = []; if (goog.isDefAndNotNull(oMapDef)) { @@ -786,6 +887,13 @@ nsVmap.nsToolsManager.Print.prototype.printController.prototype.getMapsJsonDef = }); } + if (goog.isDefAndNotNull(oCompareDef)) { + oMapsJson.push({ + 'target': '#map_image_compare', + 'map_definition': oCompareDef + }); + } + var mapsJson = JSON.stringify(oMapsJson); return mapsJson; diff --git a/src/module_vmap/module/javascript/app/vmap/tools/printBox.js b/src/module_vmap/module/javascript/app/vmap/tools/printBox.js index b359736577fd4fc861e58c471cf2f0aad568d5ae..d25f47f7a8ca5d9588d23e08f23767f1ad9d6c16 100755 --- a/src/module_vmap/module/javascript/app/vmap/tools/printBox.js +++ b/src/module_vmap/module/javascript/app/vmap/tools/printBox.js @@ -18,11 +18,13 @@ goog.require('ol.interaction.Translate'); nsVmap.nsToolsManager.PrintBox = function (opt_options) { oVmap.log('nsVmap.nsToolsManager.PrintBox'); - this.map_ = oVmap.getMap().getOLMap(); - // Valeurs par défaut opt_options = goog.isDefAndNotNull(opt_options) ? opt_options : {}; + this.oMap_ = (goog.isDefAndNotNull(opt_options["map_object"])? opt_options["map_object"]: oVmap.getMap()); + + this.map_ = this.oMap_.getOLMap(); + /** * The print box feature * @private @@ -45,7 +47,7 @@ nsVmap.nsToolsManager.PrintBox = function (opt_options) { * @type {ol.layer.Vector} * @private */ - this.oOpenLayersOverlay_ = oVmap.getMap().addVectorLayer(); + this.oOpenLayersOverlay_ = this.oMap_.addVectorLayer(); /** * @type {ol.Collection} @@ -110,7 +112,7 @@ nsVmap.nsToolsManager.PrintBox.prototype.managePrintBox = function (sInteraction this.unlistenMapMovements(); // Ajoute l'interaction de déplacement de la printBox - oVmap.getMap().setInteraction(this.translateInteraction_, sInteractionName); + this.oMap_.setInteraction(this.translateInteraction_, sInteractionName); }; @@ -122,12 +124,23 @@ nsVmap.nsToolsManager.PrintBox.prototype.unmanagePrintBox = function () { oVmap.log('nsVmap.nsToolsManager.PrintBox.unmanagePrintBox'); // remove l'action de modification - oVmap.getMap().removeActionsAndTooltips(); + this.oMap_.removeActionsAndTooltips(); this.drawPrintBox(); this.listenMapMovements(); }; +/** + * Cancel the printZone manage interaction and adapt the view on it + * @export + */ +nsVmap.nsToolsManager.PrintBox.prototype.unmanagePrintBoxAndLock = function () { + oVmap.log('nsVmap.nsToolsManager.PrintBox.unmanagePrintBox'); + + // remove l'action de modification + this.oMap_.removeActionsAndTooltips(); +}; + /** * Get the print box scale * @returns {Number|String} @@ -149,7 +162,7 @@ nsVmap.nsToolsManager.PrintBox.prototype.getScale = function () { nearest: true }); - var scale = oVmap.getMap().getScale(); + var scale = this.oMap_.getScale(); setTimeout(function () { // Retrouve la position initiale @@ -166,13 +179,13 @@ nsVmap.nsToolsManager.PrintBox.prototype.getScale = function () { * @export */ nsVmap.nsToolsManager.PrintBox.prototype.setScale = function (newScale) { - + // Échelle courante var currentScale = this.getScale(); // Calcul du delta entre l'échelle courrante et l'échelle voulue var deltaScale = newScale / currentScale; - + // Mise sous forme de variables pour une meilleure compréhension var currentExtent = this.getExtent(); var xmin = currentExtent[0]; @@ -185,7 +198,7 @@ nsVmap.nsToolsManager.PrintBox.prototype.setScale = function (newScale) { // Calcul de la nouvelle hauteur/largeur de la printBox var newLength = length * deltaScale; var newHeight = height * deltaScale; - + // Calcul des nouvelles coordonnées en fonction du centre et des nouvelles hauteur/largeur var center = this.printBoxFeature_.getGeometry().getInteriorPoint().getCoordinates(); var newXmin = center[0] - newLength / 2; @@ -198,10 +211,10 @@ nsVmap.nsToolsManager.PrintBox.prototype.setScale = function (newScale) { this.printBoxFeature_ = new ol.Feature({ geometry: box }); - + // Supprime l'ancienne feature this.oOpenLayersOverlayFeatures_.clear(); - + // Ajoute la nouvelle feature this.oOpenLayersOverlay_.getSource().addFeature(this.printBoxFeature_); }; @@ -239,7 +252,7 @@ nsVmap.nsToolsManager.PrintBox.prototype.getExtent = function () { */ nsVmap.nsToolsManager.PrintBox.prototype.listenMapMovements = function () { - this.printBoxEvent_ = oVmap.getMap().setEventOnMap('precompose', this.drawPrintBox, this); + this.printBoxEvent_ = this.oMap_.setEventOnMap('precompose', this.drawPrintBox, this); }; /** @@ -286,10 +299,12 @@ nsVmap.nsToolsManager.PrintBox.prototype.createPrintBox = function (printBoxSize var boxWidth = printBoxSize[0]; var boxHeight = printBoxSize[1]; - var x1 = $('#map1').width() / 2 - boxWidth / 2; - var x2 = $('#map1').width() / 2 + boxWidth / 2; - var y1 = $('#map1').height() / 2 - boxHeight / 2; - var y2 = $('#map1').height() / 2 + boxHeight / 2; + var sMapComponentId = this.map_.getViewport().getAttribute('id'); + + var x1 = $('#' + sMapComponentId).width() / 2 - boxWidth / 2; + var x2 = $('#' + sMapComponentId).width() / 2 + boxWidth / 2; + var y1 = $('#' + sMapComponentId).height() / 2 - boxHeight / 2; + var y2 = $('#' + sMapComponentId).height() / 2 + boxHeight / 2; var point1 = [x1, y2]; var point3 = [x2, y1]; @@ -306,4 +321,4 @@ nsVmap.nsToolsManager.PrintBox.prototype.createPrintBox = function (printBoxSize boxFeature.set('pixelExtent', [x1, y1, x2, y2]); return boxFeature; -}; \ No newline at end of file +}; diff --git a/src/module_vmap/module/javascript/app/vmap/tools/toolsmanager.js b/src/module_vmap/module/javascript/app/vmap/tools/toolsmanager.js index ba4c644aea4d99f191adc967b8a5f8d78f45a29a..1b6a247c6b746f13abf5c4fa6ff32e759973f169 100755 --- a/src/module_vmap/module/javascript/app/vmap/tools/toolsmanager.js +++ b/src/module_vmap/module/javascript/app/vmap/tools/toolsmanager.js @@ -143,13 +143,18 @@ nsVmap.nsToolsManager.ToolsManager.prototype.vmapToolsContainerDirective = funct /** * Basic tools Controller + * @param {object} $scope * @export + * @ngInject * @constructor */ -nsVmap.nsToolsManager.ToolsManager.prototype.vmapToolsController = function () { +nsVmap.nsToolsManager.ToolsManager.prototype.vmapToolsController = function ($scope) { oVmap.log("nsVmap.nsToolsManager.BasicTools.prototype.vmapToolsController"); this['oToolsTree'] = oVmap.getToolsManager().getToolsTree(); + + $scope.$root["bLoadVmapModule"] = goog.isDefAndNotNull(this['oToolsTree']); + this['openedTool'] = '_'; }; @@ -176,7 +181,7 @@ nsVmap.nsToolsManager.ToolsManager.prototype.loadSyncToolsTree = function () { oToolsTree = data['usermodules']; } }); - + return oToolsTree; }; @@ -225,4 +230,4 @@ nsVmap.nsToolsManager.ToolsManager.prototype.getTool = function (tool) { // Définit la directive et le controller oVmap.module.directive('appVmaptools', nsVmap.nsToolsManager.ToolsManager.prototype.vmapToolsDirective); oVmap.module.directive('toolsContainer', nsVmap.nsToolsManager.ToolsManager.prototype.vmapToolsContainerDirective); -oVmap.module.controller('AppVmaptoolsController', nsVmap.nsToolsManager.ToolsManager.prototype.vmapToolsController); \ No newline at end of file +oVmap.module.controller('AppVmaptoolsController', nsVmap.nsToolsManager.ToolsManager.prototype.vmapToolsController); diff --git a/src/module_vmap/module/javascript/app/vmap/tools/urlexporter.js b/src/module_vmap/module/javascript/app/vmap/tools/urlexporter.js index 85e757f8f70c2bac1538b099482fd06940cec290..09d3ac862dd74b2f5a53ed774ca085333fb430d8 100644 --- a/src/module_vmap/module/javascript/app/vmap/tools/urlexporter.js +++ b/src/module_vmap/module/javascript/app/vmap/tools/urlexporter.js @@ -76,16 +76,6 @@ nsVmap.nsToolsManager.Urlexporter.prototype.urlExporterController = function ($s this["urlConstructor"](); - // Affiche les modales en plein écran pour la version mobile - //if (oVmap['properties']['is_mobile']) { - // $element.find('.modal').on('shown.bs.modal', function () { - // $('.modal-backdrop.fade.in').hide(); - // $('.modal.fade.in').find('.modal-dialog').addClass('mobile-full-modal'); - // }); - //} - - console.log(this['properties']); - // recalcule l'url quand on change de carte oVmap['scope'].$on('mapChanged', function () { this_["urlConstructor"](); @@ -137,4 +127,4 @@ nsVmap.nsToolsManager.Urlexporter.prototype.urlExporterController.prototype.urlC // Définit la directive et le controller oVmap.module.directive('appUrlExporter', nsVmap.nsToolsManager.Urlexporter.prototype.urlExporterDirective); -oVmap.module.controller('AppUrlExporterController', nsVmap.nsToolsManager.Urlexporter.prototype.urlExporterController); \ No newline at end of file +oVmap.module.controller('AppUrlExporterController', nsVmap.nsToolsManager.Urlexporter.prototype.urlExporterController); diff --git a/src/module_vmap/module/javascript/app/vmap/vmap.js b/src/module_vmap/module/javascript/app/vmap/vmap.js index 48dbc1bacdb92c117848b877817f120614ccbc71..f178a8c8318359837bd33d27463450bfe7744ea8 100644 --- a/src/module_vmap/module/javascript/app/vmap/vmap.js +++ b/src/module_vmap/module/javascript/app/vmap/vmap.js @@ -97,6 +97,13 @@ oVmap.properties = {}; */ oVmap.oMap_ = {}; + +/** + * Objet which contains the mapComapre + * @type {nsVmap.MapCompare} + * @private + */ +oVmap.oMapCompare_ = {}; /** * Objet which contains the layers tools (on the left band) * @type {nsVmap.nsMapManager.MapManager} @@ -196,6 +203,7 @@ oVmap.init = function () { // Instenciation des objects Vmap oVmap.oMap_ = new nsVmap.Map(); + oVmap.oMapCompare_ = new nsVmap.MapCompare(); oVmap.oMapManager_ = new nsVmap.nsMapManager.MapManager(); oVmap.oToolsManager_ = new nsVmap.nsToolsManager.ToolsManager(); @@ -283,6 +291,12 @@ oVmap.vmapController = function ($sanitize) { * @api stable */ this.map = this['map'] = oVmap.getMap().getOLMap(); + /** + * The OpenLayers map + * @type {ol.Map} + * @api stable + */ + this.mapCompare = this['mapCompare'] = oVmap.getMapCompare().getOLMap(); /** * The current action on map @@ -362,6 +376,16 @@ oVmap.getMap = function () { return this.oMap_; }; +/** + * nsVmap.oMapCompare_ getter + * @return {nsVmap.MapCompare} Map to use to compare + * @export + * @api experimental + */ +oVmap.getMapCompare = function () { + return this.oMapCompare_; +}; + /** * nsVmap.oMapManager_ getter * @return {nsVmap.nsMapManager.MapManager} Tools fo layers @@ -719,6 +743,8 @@ oVmap.resizeLayerTools = function (animate) { if (goog.isDef(angular.element($('#olMap')).scope())) angular.element($('#olMap')).scope()['ctrl'].startAnimation(); + if (goog.isDef(angular.element($('#olMapCompare')).scope())) + angular.element($('#olMapCompare')).scope()['ctrl'].startAnimation(); var aItems = ["layertree", "layersorder", "maplegendcontainer"]; var iMarge = 0; @@ -851,6 +877,7 @@ oVmap.printElem = function (elem) { */ oVmap.maxResizeBottomBar = function () { angular.element($('#olMap')).scope()['ctrl'].startAnimation(); + angular.element($('#olMapCompare')).scope()['ctrl'].startAnimation(); $(".open-more-selection-info").toggleClass("reverse"); @@ -869,13 +896,15 @@ oVmap.maxResizeBottomBar = function () { */ oVmap.minResizeBottomBar = function () { angular.element($('#olMap')).scope()['ctrl'].startAnimation(); - + angular.element($('#olMapCompare')).scope()['ctrl'].startAnimation(); + if ($("#map-container").hasClass("open2")) { $("#map-container").removeClass("open2"); $("#bottombar").removeClass("open2"); $(".open-more-selection-info").removeClass("reverse"); } else if ($("#map-container").hasClass("open")) { $("#map-container").addClass("minus"); + $("#map-container-compare").addClass("minus"); } }; diff --git a/src/module_vmap/module/template/layers/mapmodal/maplistlitle.html b/src/module_vmap/module/template/layers/mapmodal/maplistlitle.html index 2089b99cf5622ae5d17850d76b84c3b77b3102f1..e2ff1e2f60b3b953a96db0e5bdbc0d59d69f50ab 100644 --- a/src/module_vmap/module/template/layers/mapmodal/maplistlitle.html +++ b/src/module_vmap/module/template/layers/mapmodal/maplistlitle.html @@ -32,6 +32,7 @@ <div ng-repeat="map in oTheme.maps| orderBy: 'name'"> <div ng-if="($index + 1) % 4 === 0" class="row"> <div url="{{map.url}}" + ng-if="!compare" title="{{map.description}}" class="col-md-3 margin-10 pointer opacity-hover underline-hover maplist-map" style="text-align: center; font-size: 12px;" @@ -43,8 +44,21 @@ <span>{{map.name}}</span> </div> </div> + <div url="{{map.url}}" + ng-if="compare" + title="{{map.description}}" + class="col-md-6 margin-10 pointer opacity-hover underline-hover maplist-map" + style="text-align: center; font-size: 12px;" + onclick="oVmap.getMapManager().loadCompareMap(this)" + data-dismiss="modal"> + + <div onclick="$('#maplistlitle-container').removeClass('open')" ng-class="{'border-black': map.compare === true}" style="overflow:hidden" ng-attr-title="{{map.description}}"> + <div class="img-map" style="background-image: url('{{map.thumbnail}}')"></div> + <span>{{map.name}}</span> + </div> + </div> </div> - <div ng-if="($index + 1) % 4 !== 0" + <div ng-if="($index + 1) % 4 !== 0 && !compare" url="{{map.url}}" title="{{map.description}}" class="col-md-3 margin-10 pointer opacity-hover underline-hover maplist-map" @@ -57,6 +71,19 @@ <span>{{map.name}}</span> </div> </div> + <div ng-if="($index + 1) % 4 !== 0 && compare" + url="{{map.url}}" + title="{{map.description}}" + class="col-md-6 margin-10 pointer opacity-hover underline-hover maplist-map" + style="text-align: center; font-size: 12px;" + onclick="oVmap.getMapManager().loadCompareMap(this)" + data-dismiss="modal"> + + <div onclick="$('#maplistlitle-container').removeClass('open')" ng-class="{'border-black': map.compare === true}" style="overflow:hidden" ng-attr-title="{{map.description}}"> + <div class="img-map" style="background-image: url('{{map.thumbnail}}')"></div> + <span>{{map.name}}</span> + </div> + </div> </div> </div> </div> diff --git a/src/module_vmap/module/template/tools/basictools.html b/src/module_vmap/module/template/tools/basictools.html index e85c74762d60d92d19a6b560d5811b7a178fad98..c469aad7af3d5e8c9c1693e78c5ccb976f019b19 100644 --- a/src/module_vmap/module/template/tools/basictools.html +++ b/src/module_vmap/module/template/tools/basictools.html @@ -19,6 +19,22 @@ </div> </li> </div> + <!-- Outil de comparaison --> + <div> + <li role="presentation" style="position: inherit" class="basic-tools-dropdown"> + <a class="basic-tools-element pointer" + id="map-compare-tool-btn" + title="Comparaison de carte" + onclick="oVmap.getToolsManager().getBasicTools().toggleTool(this)" + ng-class="{'active2':$root.compare_enabled}"> + <span class="icon-mirror" aria-hidden="true"></span> + </a> + <div app-compare-mode app-lang="ctrl.lang" app-map="ctrl.map" + id="basic-tools-dropdown-comapremode" + class="dropdown-menu basic-tools-dropdown-element no-padding"> + </div> + </li> + </div> <!-- Login de l'utilisateur --> <div class="right"> <li role="presentation" style="position: inherit" class="basic-tools-dropdown"> @@ -58,7 +74,7 @@ </a> <div app-print app-lang="ctrl.lang" app-map="ctrl.map" app-action="ctrl.currentAction" id="basic-tools-dropdown-print-content" - class="dropdown-menu basic-tools-dropdown-element basic-tools-dropdown-print-content"> + class="dropdown-menu basic-tools-dropdown-element basic-tools-dropdown-print-content"> </div> </li> </div> @@ -66,13 +82,13 @@ <div class="right"> <li role="presentation" style="position: inherit" class="basic-tools-dropdown"> <a class="basic-tools-element pointer" - id="basic-tools-dropdown-insert-btn" + id="basic-tools-dropdown-insert-btn" title="Insertion" onclick="oVmap.getToolsManager().getBasicTools().toggleTool(this)"> <span class="icon-add-feature" aria-hidden="true"></span> </a> <div app-insert app-lang="ctrl.lang" app-map="ctrl.map" app-action="ctrl.currentAction" - id="basic-tools-dropdown-insert-content" + id="basic-tools-dropdown-insert-content" class="dropdown-menu basic-tools-dropdown-element basic-tools-dropdown-select-content"> </div> </li> @@ -96,4 +112,4 @@ </ul> </div> </div> -</div> \ No newline at end of file +</div> diff --git a/src/module_vmap/module/template/tools/comparemapmanager.html b/src/module_vmap/module/template/tools/comparemapmanager.html new file mode 100644 index 0000000000000000000000000000000000000000..5400040928382b75fee2971115575455e96f07c6 --- /dev/null +++ b/src/module_vmap/module/template/tools/comparemapmanager.html @@ -0,0 +1,23 @@ +<!--Mode compare--> +<div class="row margin-sides-0 no-padding"> + <div class="margin-sides-20"> + <div> + <div class="checkbox checkbox-info checkbox-inline checkbox_margin"> + <input id="useCompareModeCheckbox" + type="checkbox" + style="cursor:pointer;" + title=">Activer / Désactiver le mode comparaison" + ng-model="ctrl.useCompareMode"> + <label for="useCompareModeCheckbox" + style="cursor:pointer" + title="Activer / Désactiver le mode comparaison"> + Activer / Désactiver le mode comparaison + </label> + </div> + </div> + </div> + <div ng-show="ctrl.useCompareMode" class="col-md-12"><hr></div> + <div ng-show="ctrl.useCompareMode" class="col-md-12 no-padding"> + <app-maplistlitle app-lang="ctrl.lang" app-maplistlitle-map="ctrl.map" data-compare="true"></app-maplistlitle> + </div> +</div> diff --git a/src/module_vmap/module/template/tools/print.html b/src/module_vmap/module/template/tools/print.html index 0a1fd62b4dcf92147ce7b543f37d661637c5f70c..330a8b9c2733511e33358d8d02c6e41a6463122a 100644 --- a/src/module_vmap/module/template/tools/print.html +++ b/src/module_vmap/module/template/tools/print.html @@ -53,10 +53,18 @@ </select> <button type="button" + title="Modification de la zone d'impression sur la carte" class="btn btn-info btn-sm" style="margin-top: 10px" - ng-class="{'active': ctrl.currentAction === 'print-modifyPrintZone'}" + ng-class="{'active': managePrintZoneInProgress}" ng-click="ctrl.managePrintZone()"><span class="glyphicon glyphicon-move"></span></button> + <button type="button" + title="Modification de la zone d'impression sur la carte de comparaison" + ng-show="$root.compare_enabled" + class="btn btn-info btn-sm" + style="margin-top: 10px" + ng-class="{'active': manageComparePrintZoneInProgress}" + ng-click="ctrl.manageComparePrintZone()"><span class="glyphicon glyphicon-move"></span></button> <button type="submit" class="btn btn-info btn-sm" diff --git a/src/module_vmap/module/template/vmap.html b/src/module_vmap/module/template/vmap.html index 358cdd8b6ca49e2c506b886d9a79c2683830b5cb..0b1b12f973b55e61a0408e13faf08923522ef702 100755 --- a/src/module_vmap/module/template/vmap.html +++ b/src/module_vmap/module/template/vmap.html @@ -4,7 +4,7 @@ <div ng-if="!$root.is_mobile" id="left-sidebar" ng-class="vmapCtrl.left_open ? 'open' : ''"> <div id="maplistlitle-container" class="dropdown"> <!--voir dans maplistlitle.js pour l'evenement de fermeture de la dropdown--> - <button id="maplistlitle-button" class="btn btn-success dropdown-toggle btn-map-manager" + <button id="maplistlitle-button" class="btn btn-success dropdown-toggle btn-map-manager" type="button" onclick="$('#maplistlitle-container').toggleClass('open')"> <span class="icon-map left" style="font-size: 30px"></span> @@ -13,19 +13,19 @@ <span class="caret"></span> </span> </button> - - + + <div id="dropdownMenuMaps" class="dropdown-menu map-list-litle-panel"> <app-maplistlitle app-lang="ctrl.lang" app-maplistlitle-map="ctrl.map"></app-maplistlitle> <div id="map-manager-button-container" style="text-align: center"> - <button id="map-manager-button" - type="button" + <button id="map-manager-button" + type="button" class="btn btn-success btn-sm btn-modal margin-10" onclick="oVmap.simuleClick('btn-reload-myMap'); $('#mapModalManager').modal('show'); $('#dropdownMenuMaps').dropdown('toggle')"> GESTION DES CARTES - </button> + </button> </div> </div> </div> @@ -33,7 +33,7 @@ <div app-layertree app-map="vmapCtrl.map" app-proj="vmapCtrl.proj" app-lang="vmapCtrl.lang" id="app-layertree"></div> <div app-layersorder app-map="vmapCtrl.map" app-proj="vmapCtrl.proj" app-lang="vmapCtrl.lang" id="app-layersorder"></div> <div app-maplegend app-map="vmapCtrl.map" app-proj="vmapCtrl.proj" app-lang="vmapCtrl.lang" id="app-maplegend"></div> - <div id="LayersDiv"></div> + <div id="LayersDiv"></div> <!-- Map Modal --> <div class="modal fade" id="mapModalManager" role="dialog"> @@ -48,12 +48,19 @@ <div ng-if="!$root.is_mobile" id="opener-sidebar" ng-click="vmapCtrl.left_open = !vmapCtrl.left_open" onclick="oVmap.resizeLayerTools(false); oVmap.getToolsManager().getBasicTools().toggleOutTools();"> <div class="layer-tools-btn shadow-hover icon-tree" ng-class="vmapCtrl.left_open ? 'open' : ''" data-original-title="Couches et cartes"></div> </div> - + <!-- Carte --> - <div id="map-container" ng-class="ctrl.bottom_open ? 'open' : ''"> + <div id="map-container" + ng-class="{'open' : ctrl.bottom_open,'half' : compare_enabled, 'right-module-bar-present' : bLoadVmapModule, 'left-map-manager-open' : vmapCtrl.left_open, 'right-module-manager-open' : vmapCtrl.right_open}"> <app-map app-map="vmapCtrl.map" app-action="vmapCtrl.currentAction"></app-map> </div> + <!-- Carte Compare --> + <div ng-show="compare_enabled" id="map-container-compare" + ng-class="{'open' : ctrl.bottom_open,'half' : compare_enabled, 'right-module-bar-present' : bLoadVmapModule, 'left-map-manager-open' : vmapCtrl.left_open, 'right-module-manager-open' : vmapCtrl.right_open}"> + <app-map-compare app-map="vmapCtrl.mapCompare" app-action="vmapCtrl.currentAction" style="display:block; width:100%; height:100%;"></app-map-compare> + </div> + <!-- Bandeau de selection --> <div id="opener-bottombar" class="list-group-item active"> <div id="opener-bottombar-1" class="open-selection-info" ng-click="ctrl.bottom_open = !ctrl.bottom_open" onclick="oVmap.minResizeBottomBar()"></div> @@ -63,7 +70,3 @@ <div id="info-container" app-infocontainer app-infocontainer-lang="vmapCtrl.lang" app-infos="vmapCtrl.infos"></div> </div> </div> - - - -