From 7c97b051c4c320804fd6b9758e77f4e511864f76 Mon Sep 17 00:00:00 2001 From: Laurent Lienher Date: Fri, 28 Aug 2020 09:43:12 +0200 Subject: [PATCH] Remove unused backgroundlayer component --- .../BackgroundlayerController.js | 111 ------------------ .../js/backgroundlayer/backgroundlayer.html | 13 -- .../backgroundlayerDirective.js | 60 ---------- 3 files changed, 184 deletions(-) delete mode 100644 geoportal/geoportailv3_geoportal/static-ngeo/js/backgroundlayer/BackgroundlayerController.js delete mode 100644 geoportal/geoportailv3_geoportal/static-ngeo/js/backgroundlayer/backgroundlayer.html delete mode 100644 geoportal/geoportailv3_geoportal/static-ngeo/js/backgroundlayer/backgroundlayerDirective.js diff --git a/geoportal/geoportailv3_geoportal/static-ngeo/js/backgroundlayer/BackgroundlayerController.js b/geoportal/geoportailv3_geoportal/static-ngeo/js/backgroundlayer/BackgroundlayerController.js deleted file mode 100644 index 1538c6d1a..000000000 --- a/geoportal/geoportailv3_geoportal/static-ngeo/js/backgroundlayer/BackgroundlayerController.js +++ /dev/null @@ -1,111 +0,0 @@ -/** - * @module app.backgroundlayer.BackgroundlayerController - */ -/** - * @fileoverview This file provides the "backgroundlayer" directive. This - * directive is used to create a dropdown for selecting the map's background - * layer. This directive is based on Bootstrap's "dropdown" component, and - * on the "ngeoBackgroundLayerMgr" service. - * - * Example: - * - * - * - * - * Note the use of the one-time binding operator (::) in the map expression. - * One-time binding is used because we know the map is not going to change - * during the lifetime of the application. - */ - -import appModule from '../module.js'; -import {listen} from 'ol/events.js'; -import MapboxLayer from '@geoblocks/mapboxlayer/src/MapBoxLayer.js'; - - -/** - * @typedef {import('ol/layer/Base').default} BaseLayer - */ - - -/** - * @constructor - * @param {ngeo.map.BackgroundLayerMgr} ngeoBackgroundLayerMgr Background layer manager. - * @param {import('../Themes').default} appThemes The app themes. - * @ngInject - */ -class Controller { - constructor(ngeoBackgroundLayerMgr, appThemes) { - /** - * @type {ngeo.map.BackgroundLayerMgr} - * @private - */ - this.backgroundLayerMgr_ = ngeoBackgroundLayerMgr; - - /** - * @type {import('../Themes').default} - */ - this.appThemes_ = appThemes; - - /** - * @type {import('ol/layer/Base').default[]} - */ - this.bgLayers; - - /** - * @type {import('ol/layer/Base').default} - */ - this.bgLayer; - - /** - * @type {import('ol/Map').default} - */ - this.map; - - /** - * @type {boolean} - */ - this.activeMvt; - } - - - $onInit() { - this.appThemes_.getBgLayers(this.map).then(bgLayers => { - this.bgLayers = bgLayers; - this.bgLayer = this.backgroundLayerMgr_.get(this.map); - }); - - listen(this.backgroundLayerMgr_, 'change', evt => { - /** - * @type {BaseLayer} - */ - const previous = evt.detail.previous; - - /** - * @type {BaseLayer} - */ - const current = evt.detail.current; - - if (previous) { - previous.setVisible(false); - } - current.setVisible(true); - this.bgLayer = current; - - this.activeMvt = this.bgLayer instanceof MapBoxLayer; - }); - }; - - /** - * @param {BaseLayer} layer Layer. - * @export - */ - setLayer(layer) { - this.bgLayer = layer; - this.backgroundLayerMgr_.set(this.map, layer); - this.activeMvt = this.bgLayer instanceof MapBoxLayer; - }; - -}; - -appModule.controller('AppBackgroundlayerController', Controller); -export default Controller; diff --git a/geoportal/geoportailv3_geoportal/static-ngeo/js/backgroundlayer/backgroundlayer.html b/geoportal/geoportailv3_geoportal/static-ngeo/js/backgroundlayer/backgroundlayer.html deleted file mode 100644 index 23f356184..000000000 --- a/geoportal/geoportailv3_geoportal/static-ngeo/js/backgroundlayer/backgroundlayer.html +++ /dev/null @@ -1,13 +0,0 @@ -
- Background layer:  - -
diff --git a/geoportal/geoportailv3_geoportal/static-ngeo/js/backgroundlayer/backgroundlayerDirective.js b/geoportal/geoportailv3_geoportal/static-ngeo/js/backgroundlayer/backgroundlayerDirective.js deleted file mode 100644 index f8f30588d..000000000 --- a/geoportal/geoportailv3_geoportal/static-ngeo/js/backgroundlayer/backgroundlayerDirective.js +++ /dev/null @@ -1,60 +0,0 @@ -/** - * @module app.backgroundlayer.backgroundlayerDirective - */ -/** - * @fileoverview This file provides the "backgroundlayer" directive. This - * directive is used to create a dropdown for selecting the map's background - * layer. This directive is based on Bootstrap's "dropdown" component, and - * on the "ngeoBackgroundLayerMgr" service. - * - * Example: - * - * - * - * - * Note the use of the one-time binding operator (::) in the map expression. - * One-time binding is used because we know the map is not going to change - * during the lifetime of the application. - */ - -import appModule from '../module.js'; - -/** - * @param {string} appBackgroundlayerTemplateUrl URL to backgroundlayer - * template. - * @return {angular.Directive} The Directive Definition Object. - * @ngInject - */ -const exports = function(appBackgroundlayerTemplateUrl) { - return { - restrict: 'E', - scope: { - 'map': '=appBackgroundlayerMap', - 'activeMvt': '=' - }, - controller: 'AppBackgroundlayerController', - controllerAs: 'ctrl', - bindToController: true, - templateUrl: appBackgroundlayerTemplateUrl - }; -}; - - -appModule.directive('appBackgroundlayer', exports); - - // Custom directive for the "vector tiles style" change button -appModule.directive('customOnChange', function() { - return { - restrict: 'A', - link: function (scope, element, attrs) { - var onChangeHandler = scope.$eval(attrs.customOnChange); - element.on('change', onChangeHandler); - element.on('$destroy', function() { - element.off(); - }); - } - }; -}); - - -export default exports;