Skip to content

Commit

Permalink
Merge pull request #9453 from camptocamp/ngInject-GSNGEO-10
Browse files Browse the repository at this point in the history
Convert the files using babel-plugin-angularjs-annotate
  • Loading branch information
sbrunner authored Aug 28, 2024
2 parents 083c560 + 6ca6263 commit 8a91bb7
Show file tree
Hide file tree
Showing 210 changed files with 2,021 additions and 3,644 deletions.
1 change: 0 additions & 1 deletion buildtools/webpack.commons.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,6 @@ module.exports = function (config) {
babelrc: false,
comments: false,
presets: [babelPresetEnv],
plugins: [require.resolve('babel-plugin-angularjs-annotate')],
},
},
};
Expand Down
14 changes: 7 additions & 7 deletions contribs/gmf/apps/appmodule.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ import AngularServices from 'ngeo/services';
* @hidden
*/
const appModule = angular.module('app', []);

appModule.config([
'$compileProvider',
/**
Expand All @@ -49,11 +48,12 @@ appModule.config([
]);

/**
* @ngInject
*/
appModule.run(($injector) => {
//AngularServices.auth = $injector.get('gmfAuthenticationService');
//AngularServices.notification = $injector.get('ngeoNotification');
});

appModule.run([
'$injector',
($injector) => {
//AngularServices.auth = $injector.get('gmfAuthenticationService');
//AngularServices.notification = $injector.get('ngeoNotification');
},
]);
export default appModule;
16 changes: 7 additions & 9 deletions contribs/gmf/apps/desktop/Controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@

import './sass/desktop.scss';
import './sass/vars_desktop.scss';

import angular from 'angular';
import {isEventUsingCtrlKey} from 'ngeo/utils';
import gmfControllersAbstractDesktopController, {
Expand All @@ -55,19 +54,18 @@ class Controller extends AbstractDesktopController {
* @hidden
*/
const appModule = angular.module('Appdesktop', [appBase.name, gmfControllersAbstractDesktopController.name]);

appModule.value('gmfContextualdatacontentTemplateUrl', 'gmf/contextualdata');
appModule.run(
/**
* @ngInject
* @param {angular.ITemplateCacheService} $templateCache
*/
($templateCache) => {
// @ts-ignore: webpack
$templateCache.put('gmf/contextualdata', require('./contextualdata.html'));
},
[
'$templateCache',
($templateCache) => {
// @ts-ignore: webpack
$templateCache.put('gmf/contextualdata', require('./contextualdata.html'));
},
],
);

appModule.controller('DesktopController', Controller);

export default appModule;
11 changes: 1 addition & 10 deletions contribs/gmf/apps/desktop_alt/Controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@

import './sass/desktop_alt.scss';
import './sass/vars_desktop_alt.scss';

import angular from 'angular';
import gmfControllersAbstractDesktopController, {
AbstractDesktopController,
Expand All @@ -49,11 +48,9 @@ class Controller extends AbstractDesktopController {
/**
* @param {angular.IScope} $scope Scope.
* @param {angular.auto.IInjectorService} $injector Main injector.
* @ngInject
*/
constructor($scope, $injector) {
super($scope, $injector);

if (this.dimensions.FLOOR == undefined) {
this.dimensions.FLOOR = '*';
}
Expand All @@ -62,16 +59,12 @@ class Controller extends AbstractDesktopController {
* @type {boolean}
*/
this.drawLidarprofilePanelActive = false;

const drawLidarprofilePanelActive = new ngeoMiscToolActivate(this, 'drawLidarprofilePanelActive');
this.ngeoToolActivateMgr.registerTool('mapTools', drawLidarprofilePanelActive, false);

const $timeout = $injector.get('$timeout');

panels.getActiveToolPanel().subscribe({
next: (panel) => {
this.drawLidarprofilePanelActive = panel === 'lidar';

$timeout(() => {}); // this triggered on DOM click, we call $timeout to force Angular digest
},
});
Expand All @@ -82,7 +75,7 @@ class Controller extends AbstractDesktopController {
*/
onKeydown(event) {}
}

Controller.$inject = ['$scope', '$injector'];
/**
* @hidden
*/
Expand All @@ -95,7 +88,5 @@ const appModule = angular.module('Appdesktop_alt', [
ngeoStreetviewModule.name,
ngeoStatemanagerWfsPermalink.name,
]);

appModule.controller('AlternativeDesktopController', Controller);

export default appModule;
29 changes: 10 additions & 19 deletions contribs/gmf/apps/oeedit/Controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@

import './sass/vars_oeedit.scss';
import './sass/oeedit.scss';

import angular from 'angular';
import gmfControllersAbstractDesktopController, {
AbstractDesktopController,
Expand All @@ -48,7 +47,6 @@ class Controller extends AbstractDesktopController {
* @param {angular.IScope} $scope Scope.
* @param {angular.auto.IInjectorService} $injector Main injector.
* @param {angular.ITimeoutService} $timeout Angular timeout service.
* @ngInject
*/
constructor($scope, $injector, $timeout) {
super($scope, $injector);
Expand All @@ -64,12 +62,9 @@ class Controller extends AbstractDesktopController {
* @type {import('ngeo/misc/ToolActivateMgr').ToolActivateMgr}
*/
const ngeoToolActivateMgr = $injector.get('ngeoToolActivateMgr');

ngeoToolActivateMgr.unregisterGroup('mapTools');

const oeEditToolActivate = new ngeoMiscToolActivate(this, 'oeEditActive');
ngeoToolActivateMgr.registerTool('mapTools', oeEditToolActivate, true);

const queryToolActivate = new ngeoMiscToolActivate(this, 'queryActive');
ngeoToolActivateMgr.registerTool('mapTools', queryToolActivate, false);

Expand Down Expand Up @@ -114,7 +109,6 @@ class Controller extends AbstractDesktopController {
* @type {import('gmf/theme/Themes').ThemesService} gmfObjectEditingManager The gmf theme service
*/
const gmfThemes = $injector.get('gmfThemes');

gmfThemes.getThemesObject().then((themes) => {
if (themes) {
// Add layer vector after
Expand Down Expand Up @@ -143,7 +137,6 @@ class Controller extends AbstractDesktopController {
* @type {?import('ol/Feature').default<import('ol/geom/Geometry').default>}
*/
this.oeFeature = null;

gmfObjectEditingManager.getFeature().then((feature) => {
this.oeFeature = feature;
if (feature) {
Expand All @@ -152,7 +145,7 @@ class Controller extends AbstractDesktopController {
});
}
}

Controller.$inject = ['$scope', '$injector', '$timeout'];
/**
* @hidden
*/
Expand All @@ -161,26 +154,24 @@ const appModule = angular.module('Appoeedit', [
gmfControllersAbstractDesktopController.name,
gmfObjecteditingModule.name,
]);

appModule.value('gmfContextualdatacontentTemplateUrl', 'gmf/contextualdata');
appModule.run(
/**
* @ngInject
* @param {angular.ITemplateCacheService} $templateCache
*/
($templateCache) => {
// @ts-ignore: webpack
$templateCache.put('gmf/contextualdata', require('./contextualdata.html'));
},
[
'$templateCache',
($templateCache) => {
// @ts-ignore: webpack
$templateCache.put('gmf/contextualdata', require('./contextualdata.html'));
},
],
);

appModule.value(
'gmfPermalinkOptions',
/** @type {import('gmf/options').gmfPermalinkOptions} */ ({
/** @type {import('gmf/options').gmfPermalinkOptions} */ {
pointRecenterZoom: 10,
}),
},
);

appModule.controller('OEEditController', Controller);

export default appModule;
6 changes: 1 addition & 5 deletions contribs/gmf/examples/backgroundlayerselector.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
MainController.$inject = ['gmfThemes'];
// The MIT License (MIT)
//
// Copyright (c) 2016-2024 Camptocamp SA
Expand All @@ -22,9 +23,7 @@
import angular from 'angular';
import './backgroundlayerselector.css';
import gmfBackgroundlayerselectorModule from 'gmf/backgroundlayerselector/module';

import gmfMapComponent from 'gmf/map/component';

import gmfThemeThemes from 'gmf/theme/Themes';
import EPSG2056 from 'ngeo/proj/EPSG_2056';
import olMap from 'ol/Map';
Expand All @@ -47,7 +46,6 @@ const myModule = angular.module('gmfapp', [
/**
* @param {import('gmf/theme/Themes').ThemesService} gmfThemes Themes service.
* @class
* @ngInject
*/
function MainController(gmfThemes) {
gmfThemes.loadThemes();
Expand All @@ -65,8 +63,6 @@ function MainController(gmfThemes) {
}),
});
}

myModule.controller('MainController', MainController);
options(myModule);

export default myModule;
6 changes: 0 additions & 6 deletions contribs/gmf/examples/contextualdata.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import angular from 'angular';
import './contextualdata.css';
import gmfContextualdataModule from 'gmf/contextualdata/module';

import gmfMapComponent from 'gmf/map/component';
import ngeoMiscFilters from 'ngeo/misc/filters';
import ngeoMapModule from 'ngeo/map/module';
Expand All @@ -45,12 +44,10 @@ const myModule = angular.module('gmfapp', [
ngeoMiscFilters.name,
ngeoMapModule.name,
]);

myModule.value('gmfContextualdatacontentTemplateUrl', 'partials/contextualdata.html');

/**
* @class
* @ngInject
*/
function MainController() {
/**
Expand Down Expand Up @@ -83,12 +80,9 @@ MainController.prototype.onRasterData = function (coordinate, data) {
elelvation_diff: data.srtm - data.aster,
};
};

myModule.controller('MainController', MainController);
myModule.constant('gmfContextualDataOptions', {
projections: ['EPSG:2056', 'EPSG:21781', 'EPSG:4326'],
});

options(myModule);

export default MainController;
11 changes: 4 additions & 7 deletions contribs/gmf/examples/datepicker.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
MainController.$inject = ['ngeoWMSTime'];
// The MIT License (MIT)
//
// Copyright (c) 2016-2024 Camptocamp SA
Expand All @@ -22,7 +23,6 @@
import angular from 'angular';
import './datepicker.css';
import ngeoMiscDatepickerComponent from 'ngeo/misc/datepickerComponent';

import ngeoMiscWMSTime from 'ngeo/misc/WMSTime';
import {TimePropertyWidgetEnum, TimePropertyResolutionEnum, TimePropertyModeEnum} from 'ngeo/datasource/OGC';
import options from './options';
Expand All @@ -40,7 +40,6 @@ const myModule = angular.module('gmfapp', [
/**
* @class
* @param {import('ngeo/misc/WMSTime').WMSTime} ngeoWMSTime wmstime service.
* @ngInject
*/
function MainController(ngeoWMSTime) {
/**
Expand All @@ -64,11 +63,11 @@ function MainController(ngeoWMSTime) {
* @type {import('ngeo/datasource/OGC').TimeProperty}
*/
this.wmsTimeValueMode = {
widget: /** @type {TimePropertyWidgetEnum} */ ('datepicker'),
widget: /** @type {TimePropertyWidgetEnum} */ 'datepicker',
maxValue: '2015-12-31T00:00:00Z',
minValue: '2014-01-01T00:00:00Z',
resolution: /** @type {TimePropertyResolutionEnum}*/ ('month'),
mode: /** @type {TimePropertyModeEnum} */ ('value'),
resolution: /** @type {TimePropertyResolutionEnum}*/ 'month',
mode: /** @type {TimePropertyModeEnum} */ 'value',
interval: [0, 1, 0, 0],
};

Expand Down Expand Up @@ -98,8 +97,6 @@ function MainController(ngeoWMSTime) {
this.rangeValue = this.ngeoWMSTime_.formatWMSTimeParam(this.wmsTimeRangeMode, date);
};
}

myModule.controller('MainController', MainController);
options(myModule);

export default myModule;
Loading

0 comments on commit 8a91bb7

Please sign in to comment.