Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix enumerations #4548

Merged
merged 2 commits into from
Jan 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions contribs/gmf/apps/desktop/Controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import 'gmf/controllers/desktop.scss';
import angular from 'angular';
import gmfControllersAbstractDesktopController from 'gmf/controllers/AbstractDesktopController.js';
import gmfControllersAbstractDesktopController, {AbstractDesktopController} from 'gmf/controllers/AbstractDesktopController.js';
import appBase from '../appmodule.js';
import EPSG2056 from '@geoblocks/proj/src/EPSG_2056.js';
import EPSG21781 from '@geoblocks/proj/src/EPSG_21781.js';
Expand All @@ -21,7 +21,7 @@ if (!window.requestAnimationFrame) {
window.location = 'http://geomapfish.org/';
}

class Controller extends gmfControllersAbstractDesktopController {
class Controller extends AbstractDesktopController {
/**
* @param {angular.IScope} $scope Scope.
* @param {angular.auto.IInjectorService} $injector Main injector.
Expand Down
4 changes: 2 additions & 2 deletions contribs/gmf/apps/desktop_alt/Controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
import angular from 'angular';
import './sass/desktop_alt.scss';
import gmfControllersAbstractDesktopController from 'gmf/controllers/AbstractDesktopController.js';
import gmfControllersAbstractDesktopController, {AbstractDesktopController} from 'gmf/controllers/AbstractDesktopController.js';
import appBase from '../appmodule.js';
import gmfImportModule from 'gmf/import/module.js';
import ngeoGooglestreetviewModule from 'ngeo/googlestreetview/module.js';
Expand All @@ -24,7 +24,7 @@ if (!window.requestAnimationFrame) {
window.location = 'http://geomapfish.org/';
}

class Controller extends gmfControllersAbstractDesktopController {
class Controller extends AbstractDesktopController {
/**
* @param {angular.IScope} $scope Scope.
* @param {angular.auto.IInjectorService} $injector Main injector.
Expand Down
4 changes: 2 additions & 2 deletions contribs/gmf/apps/iframe_api/Controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import 'gmf/controllers/iframe_api.scss';
import angular from 'angular';
import gmfControllersAbstractAPIController from 'gmf/controllers/AbstractAPIController.js';
import gmfControllersAbstractAPIController, {AbstractAPIController} from 'gmf/controllers/AbstractAPIController.js';
import appBase from '../appmodule.js';
import EPSG2056 from '@geoblocks/proj/src/EPSG_2056.js';
import EPSG21781 from '@geoblocks/proj/src/EPSG_21781.js';
Expand All @@ -21,7 +21,7 @@ if (!window.requestAnimationFrame) {
window.location = 'http://geomapfish.org/';
}

class Controller extends gmfControllersAbstractAPIController {
class Controller extends AbstractAPIController {
/**
* @param {angular.IScope} $scope Scope.
* @param {angular.auto.IInjectorService} $injector Main injector.
Expand Down
6 changes: 1 addition & 5 deletions contribs/gmf/apps/iframe_api/index.html.ejs
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
<!DOCTYPE html>
<html
lang="{{mainCtrl.lang}}"
ng-app="Appiframe_api"
ng-controller="IframeAPIController as mainCtrl"
ng-strict-di>
<html lang="{{mainCtrl.lang}}" ng-controller="IframeAPIController as mainCtrl" ng-strict-di>
<head>
<title ng-bind-template="{{'Iframe API Application'|translate}}">GeoMapFish</title>
<meta charset="utf-8">
Expand Down
6 changes: 2 additions & 4 deletions contribs/gmf/apps/mobile/Controller.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/**
*/
/**
* Application entry point.
*
Expand All @@ -8,7 +6,7 @@
*/

import angular from 'angular';
import gmfControllersAbstractMobileController from 'gmf/controllers/AbstractMobileController.js';
import gmfControllersAbstractMobileController, {AbstractMobileController} from 'gmf/controllers/AbstractMobileController.js';
import 'gmf/controllers/mobile.scss';
import appBase from '../appmodule.js';
import EPSG2056 from '@geoblocks/proj/src/EPSG_2056.js';
Expand All @@ -23,7 +21,7 @@ if (!window.requestAnimationFrame) {
window.location = 'http://geomapfish.org/';
}

class Controller extends gmfControllersAbstractMobileController {
class Controller extends AbstractMobileController {
/**
* @param {angular.IScope} $scope Scope.
* @param {angular.auto.IInjectorService} $injector Main injector.
Expand Down
4 changes: 2 additions & 2 deletions contribs/gmf/apps/mobile_alt/Controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import angular from 'angular';
import gmfControllersAbstractMobileController from 'gmf/controllers/AbstractMobileController.js';
import gmfControllersAbstractMobileController, {AbstractMobileController} from 'gmf/controllers/AbstractMobileController.js';
import './sass/mobile_alt.scss';
import appBase from '../appmodule.js';
import EPSG2056 from '@geoblocks/proj/src/EPSG_2056.js';
Expand All @@ -25,7 +25,7 @@ if (!window.requestAnimationFrame) {
window.location = 'http://geomapfish.org/';
}

class Controller extends gmfControllersAbstractMobileController {
class Controller extends AbstractMobileController {
/**
* @param {angular.IScope} $scope Scope.
* @param {angular.auto.IInjectorService} $injector Main injector.
Expand Down
4 changes: 2 additions & 2 deletions contribs/gmf/apps/oeedit/Controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import angular from 'angular';
import gmfControllersAbstractDesktopController from 'gmf/controllers/AbstractDesktopController.js';
import gmfControllersAbstractDesktopController, {AbstractDesktopController} from 'gmf/controllers/AbstractDesktopController.js';
import './sass/oeedit.scss';
import appBase from '../appmodule.js';
import gmfObjecteditingModule from 'gmf/objectediting/module.js';
Expand All @@ -26,7 +26,7 @@ if (!window.requestAnimationFrame) {
window.location = 'http://geomapfish.org/';
}

class Controller extends gmfControllersAbstractDesktopController {
class Controller extends AbstractDesktopController {
/**
* @param {angular.IScope} $scope Scope.
* @param {angular.auto.IInjectorService} $injector Main injector.
Expand Down
4 changes: 2 additions & 2 deletions contribs/gmf/apps/oeview/Controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import angular from 'angular';
import gmfControllersAbstractDesktopController from 'gmf/controllers/AbstractDesktopController.js';
import gmfControllersAbstractDesktopController, {AbstractDesktopController} from 'gmf/controllers/AbstractDesktopController.js';
import './sass/oeview.scss';
import appBase from '../appmodule.js';
import EPSG2056 from '@geoblocks/proj/src/EPSG_2056.js';
Expand All @@ -21,7 +21,7 @@ if (!window.requestAnimationFrame) {
window.location = 'http://geomapfish.org/';
}

class Controller extends gmfControllersAbstractDesktopController {
class Controller extends AbstractDesktopController {
/**
* @param {angular.IScope} $scope Scope.
* @param {angular.auto.IInjectorService} $injector Main injector.
Expand Down
6 changes: 3 additions & 3 deletions contribs/gmf/examples/drawfeature.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import gmfMapComponent from 'gmf/map/component.js';
import gmfDrawingModule from 'gmf/drawing/module.js';
import ngeoFormatFeatureProperties from 'ngeo/format/FeatureProperties.js';
import ngeoMapModule from 'ngeo/map/module.js';
import ngeoMiscFeatureHelper from 'ngeo/misc/FeatureHelper.js';
import ngeoMiscFeatureHelper, {FeatureFormatType} from 'ngeo/misc/FeatureHelper.js';
import ngeoMiscToolActivate from 'ngeo/misc/ToolActivate.js';
import ngeoMiscToolActivateMgr from 'ngeo/misc/ToolActivateMgr.js';
import olMap from 'ol/Map.js';
Expand All @@ -27,8 +27,8 @@ const module = angular.module('gmfapp', [


module.value('ngeoExportFeatureFormats', [
ngeoMiscFeatureHelper.FormatType.KML,
ngeoMiscFeatureHelper.FormatType.GPX
FeatureFormatType.KML,
FeatureFormatType.GPX
]);

module.constant('defaultTheme', 'Demo');
Expand Down
15 changes: 6 additions & 9 deletions contribs/gmf/examples/objecteditinghub.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
/**
*/

import angular from 'angular';
import appURL from './url.js';
import './objecteditinghub.css';

import gmfEditingXSDAttributes from 'gmf/editing/XSDAttributes.js';
import gmfObjecteditingManager from 'gmf/objectediting/Manager.js';
import gmfObjecteditingManager, {ObjecteditingParam} from 'gmf/objectediting/Manager.js';
import gmfThemeThemes from 'gmf/theme/Themes.js';
import olFormatWFS from 'ol/format/WFS.js';
import ngeoFormatXSDAttribute from 'ngeo/format/XSDAttribute.js';
Expand Down Expand Up @@ -248,11 +245,11 @@ MainController.prototype.runEditor = function() {
const id = feature.get(property);

const params = {};
params[gmfObjecteditingManager.Param.GEOM_TYPE] = geomType;
params[gmfObjecteditingManager.Param.ID] = id;
params[gmfObjecteditingManager.Param.LAYER] = layer;
params[gmfObjecteditingManager.Param.THEME] = this.themeName;
params[gmfObjecteditingManager.Param.PROPERTY] = property;
params[ObjecteditingParam.GEOM_TYPE] = geomType;
params[ObjecteditingParam.ID] = id;
params[ObjecteditingParam.LAYER] = layer;
params[ObjecteditingParam.THEME] = this.themeName;
params[ObjecteditingParam.PROPERTY] = property;

const url = MainController.appendParams(this.selectedUrl['url'], params);
window.open(url);
Expand Down
7 changes: 2 additions & 5 deletions contribs/gmf/examples/search.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
/**
*/

import angular from 'angular';
import appURL from './url.js';
import './search.css';
Expand All @@ -9,7 +6,7 @@ import gmfMapComponent from 'gmf/map/component.js';
import gmfSearchModule from 'gmf/search/module.js';
import gmfThemeThemes from 'gmf/theme/Themes.js';
import ngeoMessageNotification from 'ngeo/message/Notification.js';
import ngeoMessageMessage from 'ngeo/message/Message.js';
import {MessageType} from 'ngeo/message/Message.js';
import EPSG21781 from '@geoblocks/proj/src/EPSG_21781.js';
import ngeoMapModule from 'ngeo/map/module.js';
import olMap from 'ol/Map.js';
Expand Down Expand Up @@ -126,7 +123,7 @@ function MainController(gmfThemes, ngeoFeatureOverlayMgr, ngeoNotification) {
ngeoNotification.notify({
msg: 'gmf-search initialized',
target: angular.element('#message'),
type: ngeoMessageMessage.Type.SUCCESS
type: MessageType.SUCCESS
});
};
}
Expand Down
4 changes: 2 additions & 2 deletions contribs/gmf/src/authentication/component.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import angular from 'angular';
import gmfAuthenticationService from 'gmf/authentication/Service.js';
import ngeoMessageMessage from 'ngeo/message/Message.js';
import {MessageType} from 'ngeo/message/Message.js';
import ngeoMessageNotification from 'ngeo/message/Notification.js';

import ngeoMessageModalComponent from 'ngeo/message/modalComponent.js';
Expand Down Expand Up @@ -446,7 +446,7 @@ class AuthenticationController {
this.notification_.notify({
msg: error,
target: container,
type: ngeoMessageMessage.Type.ERROR
type: MessageType.ERROR
});
}, this);
}
Expand Down
20 changes: 5 additions & 15 deletions contribs/gmf/src/controllers/AbstractAPIController.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import angular from 'angular';
import gmfControllersAbstractAppController from 'gmf/controllers/AbstractAppController.js';
import gmfControllersAbstractAppController, {AbstractAppController, getLocationIcon} from 'gmf/controllers/AbstractAppController.js';
import ngeoQueryBboxQueryComponent from 'ngeo/query/bboxQueryComponent.js';
import ngeoMapResizemap from 'ngeo/map/resizemap.js';
import * as olProj from 'ol/proj.js';
Expand All @@ -16,28 +16,20 @@ import * as olInteraction from 'ol/interaction.js';
* This file includes `goog.require`'s for desktop/api components/directives used
* by the HTML page and the controller to provide the configuration.
*/
class AbstractAPIController extends gmfControllersAbstractAppController {
export class AbstractAPIController extends AbstractAppController {
/**
* @param {Config} config A part of the application config.
* @param {angular.IScope} $scope Scope.
* @param {angular.auto.IInjectorService} $injector Main injector.
* @ngInject
*/
constructor(config, $scope, $injector) {
super();

const viewConfig = {
projection: olProj.get(`EPSG:${config.srid || 21781}`)
};
Object.assign(viewConfig, config.mapViewConfig || {});

const arrow = gmfControllersAbstractAppController.prototype.getLocationIcon();

/**
* @type {import("ol/Map.js").default}
* @export
*/
this.map = new olMap({
super(config, new olMap({
pixelRatio: config.mapPixelRatio,
layers: [],
view: new olView(viewConfig),
Expand All @@ -50,7 +42,7 @@ class AbstractAPIController extends gmfControllersAbstractAppController {
zoomOutTipLabel: ''
}),
new olControlRotate({
label: arrow,
label: getLocationIcon(),
tipLabel: ''
})
],
Expand All @@ -60,9 +52,7 @@ class AbstractAPIController extends gmfControllersAbstractAppController {
}),
loadTilesWhileAnimating: true,
loadTilesWhileInteracting: true
});

gmfControllersAbstractAppController.call(this, config, $scope, $injector);
}), $scope, $injector);
}
}

Expand Down
23 changes: 15 additions & 8 deletions contribs/gmf/src/controllers/AbstractAppController.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import gmfSearchModule from 'gmf/search/module.js';
import gmfThemeModule from 'gmf/theme/module.js';
import ngeoMessageDisplaywindowComponent from 'ngeo/message/displaywindowComponent.js';
import ngeoMiscExtraModule from 'ngeo/misc/extraModule.js';
import ngeoMiscFeatureHelper from 'ngeo/misc/FeatureHelper.js';
import ngeoMiscFeatureHelper, {FeatureFormatType} from 'ngeo/misc/FeatureHelper.js';
import ngeoMiscToolActivate from 'ngeo/misc/ToolActivate.js';
import ngeoQueryMapQuerent from 'ngeo/query/MapQuerent.js';
import ngeoQueryMapQueryComponent from 'ngeo/query/mapQueryComponent.js';
Expand All @@ -29,7 +29,7 @@ import olStyleCircle from 'ol/style/Circle.js';
import olStyleFill from 'ol/style/Fill.js';
import olStyleStroke from 'ol/style/Stroke.js';
import olStyleStyle from 'ol/style/Style.js';
import gmfThemeManager from 'gmf/theme/Manager.js';
import {ThemeEventType} from 'gmf/theme/Manager.js';
import gmfThemeThemes from 'gmf/theme/Themes.js';


Expand Down Expand Up @@ -88,14 +88,15 @@ import gmfThemeThemes from 'gmf/theme/Themes.js';
* by the HTML page and the controller to provide the configuration.
*
* @param {Config} config A part of the application config.
* @param {import('ol/Map.js').default} map The map.
* @param {angular.IScope} $scope Scope.
* @param {angular.auto.IInjectorService} $injector Main injector.
* @constructor
* @ngdoc controller
* @ngInject
* @export
*/
function AbstractAppController(config, $scope, $injector) {
export function AbstractAppController(config, map, $scope, $injector) {

/**
* Location service
Expand All @@ -107,6 +108,12 @@ function AbstractAppController(config, $scope, $injector) {
window.injector = $injector;
}

/**
* @type {import("ol/Map.js").default}
* @export
*/
this.map = map;

console.assert(this.map instanceof olMap);

/**
Expand Down Expand Up @@ -513,7 +520,7 @@ function AbstractAppController(config, $scope, $injector) {
const printPanelActivate = new ngeoMiscToolActivate(this, 'printPanelActive');
ngeoToolActivateMgr.registerTool(mapTools, printPanelActivate, false);

$scope.$root.$on(gmfThemeManager.EventType.THEME_NAME_SET, (event, name) => {
$scope.$root.$on(ThemeEventType.THEME_NAME_SET, (event, name) => {
this.gmfThemes_.getThemeObject(name).then((theme) => {
this.setDefaultBackground_(theme);
});
Expand Down Expand Up @@ -818,14 +825,14 @@ AbstractAppController.prototype.updateCurrentTheme_ = function(fallbackThemeName
* @protected
* @return {Element} Span element with font-awesome inside of it
*/
AbstractAppController.prototype.getLocationIcon = function() {
export function getLocationIcon() {
const arrow = document.createElement('span');
arrow.className = 'fa fa-location-arrow';
arrow.style.transform = 'rotate(-0.82rad)';
const arrowWrapper = document.createElement('span');
arrowWrapper.appendChild(arrow);
return arrowWrapper;
};
}


const module = angular.module('GmfAbstractAppControllerModule', [
Expand Down Expand Up @@ -856,8 +863,8 @@ module.controller('AbstractController', AbstractAppController);


module.value('ngeoExportFeatureFormats', [
ngeoMiscFeatureHelper.FormatType.KML,
ngeoMiscFeatureHelper.FormatType.GPX
FeatureFormatType.KML,
FeatureFormatType.GPX
]);

module.config(['tmhDynamicLocaleProvider', 'angularLocaleScript',
Expand Down
4 changes: 2 additions & 2 deletions contribs/gmf/src/controllers/AbstractDesktopController.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import angular from 'angular';
import gmfControllersAbstractAPIController from 'gmf/controllers/AbstractAPIController.js';
import gmfControllersAbstractAPIController, {AbstractAPIController} from 'gmf/controllers/AbstractAPIController.js';
import gmfContextualdataModule from 'gmf/contextualdata/module.js';
import gmfEditingModule from 'gmf/editing/module.js';
import gmfPermalinkShareComponent from 'gmf/permalink/shareComponent.js';
Expand All @@ -24,7 +24,7 @@ import olStyleText from 'ol/style/Text.js';
* This file includes `goog.require`'s for desktop components/directives used
* by the HTML page and the controller to provide the configuration.
*/
class AbstractDesktopController extends gmfControllersAbstractAPIController {
export class AbstractDesktopController extends AbstractAPIController {
/**
* @param {Config} config A part of the application config.
* @param {angular.IScope} $scope Scope.
Expand Down