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

Strict function types #4846

Merged
merged 1 commit into from
Apr 30, 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions contribs/gmf/src/backgroundlayerselector/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,11 @@ function Controller($scope, ngeoBackgroundLayerMgr, gmfThemes) {

this.listenerKeys_.push(olEvents.listen(this.backgroundLayerMgr_, 'change',
/**
* @param {!import('ngeo/map/BackgroundLayerMgr.js').BackgroundEvent} event Event.
* @param {Event|import('ol/events/Event.js').default} event Event.
*/
(event) => {
this.bgLayer = event.detail.current;
this.bgLayer = /** @type{import('ngeo/map/BackgroundLayerMgr.js').BackgroundEvent} */
(event).detail.current;
}));

$scope.$on('$destroy', this.handleDestroy_.bind(this));
Expand Down
2 changes: 1 addition & 1 deletion contribs/gmf/src/contextualdata/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ function contextualDataComponent() {
* @param {angular.IScope} scope Scope.
* @param {JQuery} element Element.
* @param {angular.IAttributes} attrs Attributes.
* @param {ContextualdataController} controller Controller.
* @param {angular.IController} controller Controller.
*/
link: (scope, element, attrs, controller) => {
controller.init();
Expand Down
2 changes: 1 addition & 1 deletion contribs/gmf/src/controllers/AbstractAppController.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ export function AbstractAppController(config, map, $scope, $injector) {
});

/**
* @param {import('gmf/authentication/Service.js').AuthenticationEvent} evt Event.
* @param {Event|import('ol/events/Event.js').default} evt Event.
*/
const userChange = (evt) => {
if (this.loginRedirectUrl) {
Expand Down
17 changes: 10 additions & 7 deletions contribs/gmf/src/datasource/ExternalDataSourcesManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import * as olEvents from 'ol/events.js';
import olCollection from 'ol/Collection.js';
import olFormatGPX from 'ol/format/GPX.js';
import olFormatKML from 'ol/format/KML.js';
import {CollectionEvent} from 'ol/Collection.js';


/**
Expand Down Expand Up @@ -580,16 +581,18 @@ export class ExternalDatSourcesManager {
* Called when a data source is removed from the collection of ngeo data
* sources. If it's an external data source, remove it from its WMS Group
*
* @param {import("ol/Collection.js").CollectionEvent} evt Collection event.
* @param {Event|import('ol/events/Event.js').default} evt Collection event.
* @private
*/
handleDataSourcesRemove_(evt) {
const dataSource = evt.element;
if (this.extDataSources_[dataSource.id] === dataSource) {
if (dataSource instanceof ngeoDatasourceFile) {
this.removeFileDataSource_(dataSource);
} else if (dataSource instanceof ngeoDatasourceOGC) {
this.removeOGCDataSource_(dataSource);
if (evt instanceof CollectionEvent) {
const dataSource = evt.element;
if (this.extDataSources_[dataSource.id] === dataSource) {
if (dataSource instanceof ngeoDatasourceFile) {
this.removeFileDataSource_(dataSource);
} else if (dataSource instanceof ngeoDatasourceOGC) {
this.removeOGCDataSource_(dataSource);
}
}
}
}
Expand Down
4 changes: 1 addition & 3 deletions contribs/gmf/src/datasource/Helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,7 @@ export class DatasourceHelper {
* @return {import('ngeo/datasource/DataSource.js').DataSources} Data sources collection.
*/
get collection() {
return /** @type {import('ngeo/datasource/DataSource.js').DataSources} */ (
this.ngeoDataSourcesHelper_.collection
);
return this.ngeoDataSourcesHelper_.collection;
}

/**
Expand Down
8 changes: 4 additions & 4 deletions contribs/gmf/src/datasource/Manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -910,13 +910,13 @@ export class DatasourceManager {
* The `querySourceIds` property in the layer is used to determine the
* data sources that are bound to the layer.
*
* @param {!import('ngeo/map/BackgroundLayerMgr.js').BackgroundEvent} evt Event.
* @param {Event|import('ol/events/Event.js').default} evt Event.
* @private
*/
handleNgeoBackgroundLayerChange_(evt) {

const previousBackgroundLayer = evt.detail.previous;
const currentBackgroundLayer = evt.detail.current;
const event = /** @type{import('ngeo/map/BackgroundLayerMgr.js').BackgroundEvent} */(evt);
const previousBackgroundLayer = event.detail.previous;
const currentBackgroundLayer = event.detail.current;
const cache = this.dataSourcesCache_;

// Remove data sources linked to previous background layer
Expand Down
25 changes: 15 additions & 10 deletions contribs/gmf/src/disclaimer/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import ngeoMapLayerHelper from 'ngeo/map/LayerHelper.js';
import {MessageType} from 'ngeo/message/Message.js';
import ngeoMessageDisclaimer from 'ngeo/message/Disclaimer.js';
import ngeoMiscEventHelper from 'ngeo/misc/EventHelper.js';
import {CollectionEvent} from 'ol/Collection.js';

import 'angular-sanitize';

Expand Down Expand Up @@ -155,26 +156,30 @@ Controller.prototype.$onInit = function() {
};

/**
* @param {import("ol/Collection.js").CollectionEvent} evt Event.
* @param {Event|import('ol/events/Event.js').default} evt Event.
* @private
*/
Controller.prototype.handleLayersAdd_ = function(evt) {
this.timeout_(() => {
const layer = evt.element;
console.assert(layer instanceof olLayerBase);
this.registerLayer_(layer);
});
if (evt instanceof CollectionEvent) {
this.timeout_(() => {
const layer = evt.element;
console.assert(layer instanceof olLayerBase);
this.registerLayer_(layer);
});
}
};


/**
* @param {import("ol/Collection.js").CollectionEvent} evt Event.
* @param {Event|import('ol/events/Event.js').default} evt Event.
* @private
*/
Controller.prototype.handleLayersRemove_ = function(evt) {
const layer = evt.element;
console.assert(layer instanceof olLayerBase);
this.unregisterLayer_(layer);
if (evt instanceof CollectionEvent) {
const layer = evt.element;
console.assert(layer instanceof olLayerBase);
this.unregisterLayer_(layer);
}
};


Expand Down
Loading