diff --git a/contribs/gmf/examples/displayquerygrid.js b/contribs/gmf/examples/displayquerygrid.js index e6da9865097..6d2abadf237 100644 --- a/contribs/gmf/examples/displayquerygrid.js +++ b/contribs/gmf/examples/displayquerygrid.js @@ -1,6 +1,6 @@ goog.provide('gmfapp.displayquerygrid'); -goog.require('gmf.DataSourcesManager'); +goog.require('gmf.datasource.DataSourcesManager'); goog.require('gmf.Themes'); /** @suppress {extraRequire} */ goog.require('gmf.displayquerygridComponent'); @@ -87,8 +87,8 @@ gmfapp.module.controller('gmfappQueryresultController', gmfapp.QueryresultContro /** * @constructor * @param {gmf.Themes} gmfThemes The gmf themes service. - * @param {gmf.DataSourcesManager} gmfDataSourcesManager The gmf data sources - * manager service. + * @param {gmf.datasource.DataSourcesManager} gmfDataSourcesManager The gmf + * data sources manager service. * @param {ngeo.FeatureOverlayMgr} ngeoFeatureOverlayMgr The ngeo feature * overlay manager service. * @ngInject diff --git a/contribs/gmf/examples/displayquerywindow.html b/contribs/gmf/examples/displayquerywindow.html index f0e7b84ebf1..e6efbb7977e 100644 --- a/contribs/gmf/examples/displayquerywindow.html +++ b/contribs/gmf/examples/displayquerywindow.html @@ -301,7 +301,8 @@

This example shows how to use the ngeo-map-query - directive in combination with the gmf.DataSourcesManager. + directive in combination with the + gmf.datasource.DataSourcesManager. The DataSourcesManager fetches the themes returned by the theme service and adds one DataSource, which is used by the querent service per layer definition found. In this example, the layer tree is diff --git a/contribs/gmf/examples/displayquerywindow.js b/contribs/gmf/examples/displayquerywindow.js index d6a7add83fa..137a0ad29a4 100644 --- a/contribs/gmf/examples/displayquerywindow.js +++ b/contribs/gmf/examples/displayquerywindow.js @@ -1,6 +1,6 @@ goog.provide('gmfapp.displayquerywindow'); -goog.require('gmf.DataSourcesManager'); +goog.require('gmf.datasource.DataSourcesManager'); goog.require('gmf.Themes'); /** @suppress {extraRequire} */ goog.require('gmf.displayquerywindowComponent'); @@ -81,8 +81,8 @@ gmfapp.module.controller('AppQueryresultController', gmfapp.QueryresultControlle /** * @constructor * @param {gmf.Themes} gmfThemes The gmf themes service. - * @param {gmf.DataSourcesManager} gmfDataSourcesManager The gmf data sources - * manager service. + * @param {gmf.datasource.DataSourcesManager} gmfDataSourcesManager The gmf + * data sources manager service. * @param {ngeo.FeatureOverlayMgr} ngeoFeatureOverlayMgr The ngeo feature * overlay manager service. * @ngInject diff --git a/contribs/gmf/examples/filterselector.js b/contribs/gmf/examples/filterselector.js index 4577f67ca1f..f710e2f8d7b 100644 --- a/contribs/gmf/examples/filterselector.js +++ b/contribs/gmf/examples/filterselector.js @@ -7,7 +7,7 @@ goog.require('gmf.authenticationDirective'); goog.require('gmf.Themes'); goog.require('gmf.TreeManager'); /** @suppress {extraRequire} */ -goog.require('gmf.DataSourcesManager'); +goog.require('gmf.datasource.DataSourcesManager'); /** @suppress {extraRequire} */ goog.require('gmf.filterselectorComponent'); /** @suppress {extraRequire} */ @@ -53,12 +53,12 @@ gmfapp.MainController = class { /** * @param {!angular.Scope} $scope Angular scope. - * @param {gmf.DataSourcesManager} gmfDataSourcesManager The gmf data sources - * manager service. + * @param {gmf.datasource.DataSourcesManager} gmfDataSourcesManager The gmf + * data sources manager service. * @param {gmf.Themes} gmfThemes The gmf themes service. * @param {gmf.TreeManager} gmfTreeManager gmf Tree Manager service. - * @param {ngeo.DataSources} ngeoDataSources Ngeo collection of data sources - * objects. + * @param {ngeo.datasource.DataSources} ngeoDataSources Ngeo collection of + * data sources objects. * @param {ngeo.ToolActivateMgr} ngeoToolActivateMgr Ngeo ToolActivate manager * service. * @ngInject diff --git a/contribs/gmf/options/gmfx.js b/contribs/gmf/options/gmfx.js index 96ca1358434..8e613209f89 100644 --- a/contribs/gmf/options/gmfx.js +++ b/contribs/gmf/options/gmfx.js @@ -59,24 +59,6 @@ gmfx.ComparisonFilter.prototype.value; gmfx.Config; -/** - * The options to create a `gmf.DataSource` with. - * @record - * @struct - * @extends ngeox.DataSourceOptions - */ -gmfx.DataSourceOptions; - - -/** - * A reference to the GMF layer node that was used to create the data source. - * It may contains additionnal information, such as metadata, about the data - * source. - * @type {gmfThemes.GmfLayer} - */ -gmfx.DataSourceOptions.prototype.gmfLayer; - - /** * Configuration for a grid tab. * @typedef {{ @@ -564,21 +546,6 @@ gmfx.User.prototype.role_name; */ gmfx.User.prototype.username; -/** - * @typedef {{ - * columns : Array., - * data : Array.> - * }} - */ -gmfx.DataSourceTableObject; - -/** - * @typedef {{ - * title : string, - * table : gmfx.DataSourceTableObject - * }} - */ -gmfx.DataSourcePrintReportObject; /** * @typedef {{ @@ -656,6 +623,49 @@ gmfx.openIframePopup; gmfx.openTextPopup; +/** + * Namespace. + * @type {Object} + */ +gmfx.datasource; + + +/** + * The options required to create a `gmf.datasource.OGC`. + * @record + * @struct + * @extends ngeox.datasource.OGCOptions + */ +gmfx.datasource.OGCOptions; + + +/** + * A reference to the GMF layer node that was used to create the data source. + * It may contains additionnal information, such as metadata, about the data + * source. + * @type {gmfThemes.GmfLayer} + */ +gmfx.datasource.OGCOptions.prototype.gmfLayer; + + +/** + * @typedef {{ + * columns : Array., + * data : Array.> + * }} + */ +gmfx.datasource.DataSourceTableObject; + + +/** + * @typedef {{ + * title : string, + * table : gmfx.datasource.DataSourceTableObject + * }} + */ +gmfx.datasource.DataSourcePrintReportObject; + + /** * @type {Object} */ diff --git a/contribs/gmf/src/controllers/abstract.js b/contribs/gmf/src/controllers/abstract.js index e10628ad5bb..14b3da19008 100644 --- a/contribs/gmf/src/controllers/abstract.js +++ b/contribs/gmf/src/controllers/abstract.js @@ -6,7 +6,7 @@ goog.require('gmf.authenticationDirective'); /** @suppress {extraRequire} */ goog.require('gmf.backgroundlayerselectorComponent'); /** @suppress {extraRequire} */ -goog.require('gmf.DataSourcesManager'); +goog.require('gmf.datasource.DataSourcesManager'); /** @suppress {extraRequire} */ goog.require('gmf.TreeManager'); /** @suppress {extraRequire} */ diff --git a/contribs/gmf/src/datasource/datasourcebeingfiltered.js b/contribs/gmf/src/datasource/datasourcebeingfiltered.js new file mode 100644 index 00000000000..b590dde85e2 --- /dev/null +++ b/contribs/gmf/src/datasource/datasourcebeingfiltered.js @@ -0,0 +1,23 @@ +goog.provide('gmf.datasource.DataSourceBeingFiltered'); + +goog.require('gmf'); + + +gmf.module.value('gmfDataSourceBeingFiltered', { + dataSource: null +}); + + +/** + * @record + * @struct + * @export + */ +gmf.datasource.DataSourceBeingFiltered = function() {}; + + +/** + * @type {?gmf.datasource.OGC} + * @export + */ +gmf.datasource.DataSourceBeingFiltered.prototype.dataSource; diff --git a/contribs/gmf/src/services/datasourcehelper.js b/contribs/gmf/src/datasource/datasourceshelper.js similarity index 77% rename from contribs/gmf/src/services/datasourcehelper.js rename to contribs/gmf/src/datasource/datasourceshelper.js index 4dbf3df1155..9ad9efc5d78 100644 --- a/contribs/gmf/src/services/datasourcehelper.js +++ b/contribs/gmf/src/datasource/datasourceshelper.js @@ -1,21 +1,22 @@ -goog.provide('gmf.DataSourcesHelper'); +goog.provide('gmf.datasource.DataSourcesHelper'); goog.require('gmf'); goog.require('gmf.EnumerateAttribute'); -goog.require('ngeo.DataSourcesHelper'); +goog.require('ngeo.datasource.DataSourcesHelper'); -gmf.DataSourcesHelper = class { +gmf.datasource.DataSourcesHelper = class { /** - * A service that provides utility methods to manipulate or get data sources. + * A service that provides utility methods to manipulate or get GMF data + * sources. * * @struct * @param {angular.$q} $q The Angular $q service. * @param {gmf.EnumerateAttribute} gmfEnumerateAttribute The Gmf enumerate * attribute service. - * @param {ngeo.DataSourcesHelper} ngeoDataSourcesHelper Ngeo data source - * helper service. + * @param {ngeo.datasource.DataSourcesHelper} ngeoDataSourcesHelper Ngeo data + * source helper service. * @ngdoc service * @ngname gmfDataSourcesHelper * @ngInject @@ -37,7 +38,7 @@ gmf.DataSourcesHelper = class { this.gmfEnumerateAttribute_ = gmfEnumerateAttribute; /** - * @type {ngeo.DataSourcesHelper} + * @type {ngeo.datasource.DataSourcesHelper} * @private */ this.ngeoDataSourcesHelper_ = ngeoDataSourcesHelper; @@ -46,24 +47,24 @@ gmf.DataSourcesHelper = class { // === Other properties === /** - * @type {gmf.DataSources} + * @type {gmf.datasource.DataSources} * @protected */ this.collection_; /** - * @type {Object.} + * @type {Object.} * @protected */ this.cache_; } /** - * @return {gmf.DataSources} Data sources collection. + * @return {gmf.datasource.DataSources} Data sources collection. * @export */ get collection() { - return /** @type {gmf.DataSources} */ ( + return /** @type {gmf.datasource.DataSources} */ ( this.ngeoDataSourcesHelper_.collection ); } @@ -71,17 +72,17 @@ gmf.DataSourcesHelper = class { /** * Return a data source using its id. * @param {number} id Data source id. - * @return {?gmf.DataSource} Data source. + * @return {?gmf.datasource.OGC} Data source. * @export */ getDataSource(id) { - return /** @type {?gmf.DataSource} */ ( + return /** @type {?gmf.datasource.OGC} */ ( this.ngeoDataSourcesHelper_.getDataSource(id) ); } /** - * @param {gmf.DataSource} dataSource Filtrable data source. + * @param {gmf.datasource.OGC} dataSource Filtrable data source. * @return {angular.$q.Promise} Promise. * @export */ @@ -130,10 +131,10 @@ gmf.DataSourcesHelper = class { }; -gmf.module.service('gmfDataSourcesHelper', gmf.DataSourcesHelper); +gmf.module.service('gmfDataSourcesHelper', gmf.datasource.DataSourcesHelper); /** - * @typedef {ol.Collection.} + * @typedef {ol.Collection.} */ -gmf.DataSources; +gmf.datasource.DataSources; diff --git a/contribs/gmf/src/services/datasourcesmanager.js b/contribs/gmf/src/datasource/datasourcesmanager.js similarity index 93% rename from contribs/gmf/src/services/datasourcesmanager.js rename to contribs/gmf/src/datasource/datasourcesmanager.js index 6b02c042919..2fee7a2bfbc 100644 --- a/contribs/gmf/src/services/datasourcesmanager.js +++ b/contribs/gmf/src/datasource/datasourcesmanager.js @@ -1,13 +1,13 @@ -goog.provide('gmf.DataSourcesManager'); +goog.provide('gmf.datasource.DataSourcesManager'); goog.require('gmf'); -goog.require('gmf.DataSource'); +goog.require('gmf.datasource.OGC'); goog.require('gmf.SyncLayertreeMap'); goog.require('gmf.TreeManager'); goog.require('ngeo.BackgroundEventType'); goog.require('ngeo.BackgroundLayerMgr'); /** @suppress {extraRequire} */ -goog.require('ngeo.DataSources'); +goog.require('ngeo.datasource.DataSources'); goog.require('ngeo.LayerHelper'); goog.require('ngeo.RuleHelper'); goog.require('ngeo.WMSTime'); @@ -16,13 +16,13 @@ goog.require('ol.layer.Image'); goog.require('ol.source.ImageWMS'); -gmf.DataSourcesManager = class { +gmf.datasource.DataSourcesManager = class { /** * The GeoMapFish DataSources Manager is responsible of listenening to the - * c2cgeoportal's themes to create instances of `ngeo.DataSource` objects with - * the layer definitions found and push them in the `ngeo.DataSources` - * collection. + * c2cgeoportal's themes to create instances of `ngeo.datasource.DataSource` + * objects with the layer definitions found and push them in the + * `ngeo.datasource.DataSources` collection. * * When changing theme, these data sources are cleared then re-created. * @@ -34,8 +34,8 @@ gmf.DataSourcesManager = class { * @param {gmf.TreeManager} gmfTreeManager The gmf TreeManager service. * @param {!ngeo.BackgroundLayerMgr} ngeoBackgroundLayerMgr Background layer * manager. - * @param {ngeo.DataSources} ngeoDataSources Ngeo collection of data sources - * objects. + * @param {ngeo.datasource.DataSources} ngeoDataSources Ngeo collection of + * data sources objects. * @param {!ngeo.LayerHelper} ngeoLayerHelper Ngeo Layer Helper. * @param {!ngeo.RuleHelper} ngeoRuleHelper Ngeo rule helper service. * @param {!ngeo.WMSTime} ngeoWMSTime wms time service. @@ -90,7 +90,7 @@ gmf.DataSourcesManager = class { * The collection of DataSources from ngeo, which gets updated by this * service. When the theme changes, first we remove all data sources, then * the 'active' data source are added here. - * @type {ngeo.DataSources} + * @type {ngeo.datasource.DataSources} * @private */ this.ngeoDataSources_ = ngeoDataSources; @@ -119,7 +119,7 @@ gmf.DataSourcesManager = class { /** * While loading a new theme, this is where all of the created data sources * are put using the id as key for easier find in the future. - * @type {Object.} + * @type {Object.} * @private */ this.dataSourcesCache_ = {}; @@ -135,7 +135,7 @@ gmf.DataSourcesManager = class { * The cache of layertree leaf controller, i.e. those that are added to * the tree manager. When treeCtrl is added in this cache, it's given * a reference to its according data source. - * @type {gmf.DataSourcesManager.TreeCtrlCache} + * @type {gmf.datasource.DataSourcesManager.TreeCtrlCache} * @private */ this.treeCtrlCache_ = {}; @@ -382,10 +382,10 @@ gmf.DataSourcesManager = class { ogcServer.urlWfs : undefined; const wmsUrl = ogcServer ? ogcServer.url : undefined; - let wfsOutputFormat = ngeo.DataSource.WFSOutputFormat.GML3; + let wfsOutputFormat = ngeo.datasource.OGC.WFSOutputFormat.GML3; // qgis server only supports GML2 output - if (ogcServerType === ngeo.DataSource.OGCServerType.QGISSERVER) { - wfsOutputFormat = ngeo.DataSource.WFSOutputFormat.GML2; + if (ogcServerType === ngeo.datasource.OGC.ServerType.QGISSERVER) { + wfsOutputFormat = ngeo.datasource.OGC.WFSOutputFormat.GML2; } // (6) Snapping @@ -422,7 +422,7 @@ gmf.DataSourcesManager = class { const visible = meta.isChecked === true; // Create the data source and add it to the cache - this.dataSourcesCache_[id] = new gmf.DataSource({ + this.dataSourcesCache_[id] = new gmf.datasource.OGC({ copyable, dimensions, dimensionsConfig, @@ -488,7 +488,7 @@ gmf.DataSourcesManager = class { let timeUpperValueWatcherUnregister; let wmsLayer; if (dataSource.timeProperty && - dataSource.ogcType === ngeo.DataSource.OGCType.WMS + dataSource.ogcType === ngeo.datasource.OGC.Type.WMS ) { timeLowerValueWatcherUnregister = this.rootScope_.$watch( () => dataSource.timeLowerValue, @@ -524,7 +524,7 @@ gmf.DataSourcesManager = class { * Remove a treeCtrl cache item. Unregister event listeners and remove the * data source from the ngeo collection. * - * @param {gmf.DataSourcesManager.TreeCtrlCacheItem} item Layertree + * @param {gmf.datasource.DataSourcesManager.TreeCtrlCacheItem} item Layertree * controller cache item * @private */ @@ -590,12 +590,12 @@ gmf.DataSourcesManager = class { if (Array.isArray(siblingDataSourceIds)) { const ngeoDataSources = this.ngeoDataSources_.getArray(); for (const ngeoDataSource of ngeoDataSources) { - if (ngeoDataSource.filterRules !== null && + if (ngeoDataSource instanceof gmf.datasource.OGC && + ngeoDataSource.filterRules !== null && ngeoDataSource.id !== dataSource.id && siblingDataSourceIds.includes(ngeoDataSource.id) && ngeoDataSource.visible ) { - goog.asserts.assertInstanceof(ngeoDataSource, gmf.DataSource); this.handleDataSourceFilterRulesChange_(ngeoDataSource, true); break; } @@ -607,7 +607,7 @@ gmf.DataSourcesManager = class { * Returns a layertree controller cache item, if it exists. * * @param {ngeo.LayertreeController} treeCtrl The layer tree controller - * @return {gmf.DataSourcesManager.TreeCtrlCacheItem} Cache item + * @return {gmf.datasource.DataSourcesManager.TreeCtrlCacheItem} Cache item * @private */ getTreeCtrlCacheItem_(treeCtrl) { @@ -622,7 +622,7 @@ gmf.DataSourcesManager = class { * set to apply them as OGC filters to the OpenLayers layer, more precisely * as a `FILTER` parameter in the layer's source parameters. * - * @param {!gmf.DataSource} dataSource Data source. + * @param {!gmf.datasource.OGC} dataSource Data source. * @param {boolean} value Value. * @private */ @@ -632,7 +632,7 @@ gmf.DataSourcesManager = class { // the WMS ogcType, i.e. those that do not have an OpenLayers layer // to update if (dataSource.filtrable !== true || - dataSource.ogcType !== ngeo.DataSource.OGCType.WMS + dataSource.ogcType !== ngeo.datasource.OGC.Type.WMS ) { return; } @@ -704,7 +704,7 @@ gmf.DataSourcesManager = class { * Get the range value from the data source, then update the WMS layer * thereafter. * - * @param {!gmf.DataSource} dataSource Data source. + * @param {!gmf.datasource.OGC} dataSource Data source. * @private */ handleDataSourceTimeValueChange_(dataSource) { @@ -790,9 +790,9 @@ gmf.DataSourcesManager = class { /** - * @typedef {Object<(number|string), gmf.DataSourcesManager.TreeCtrlCacheItem>} + * @typedef {Object<(number|string), gmf.datasource.DataSourcesManager.TreeCtrlCacheItem>} */ -gmf.DataSourcesManager.TreeCtrlCache; +gmf.datasource.DataSourcesManager.TreeCtrlCache; /** @@ -805,7 +805,7 @@ gmf.DataSourcesManager.TreeCtrlCache; * wmsLayer: (ol.layer.Image|undefined) * }} */ -gmf.DataSourcesManager.TreeCtrlCacheItem; +gmf.datasource.DataSourcesManager.TreeCtrlCacheItem; -gmf.module.service('gmfDataSourcesManager', gmf.DataSourcesManager); +gmf.module.service('gmfDataSourcesManager', gmf.datasource.DataSourcesManager); diff --git a/contribs/gmf/src/datasource.js b/contribs/gmf/src/datasource/ogc.js similarity index 57% rename from contribs/gmf/src/datasource.js rename to contribs/gmf/src/datasource/ogc.js index 1abd0a38ac6..aabbbd7e542 100644 --- a/contribs/gmf/src/datasource.js +++ b/contribs/gmf/src/datasource/ogc.js @@ -1,16 +1,16 @@ -goog.provide('gmf.DataSource'); +goog.provide('gmf.datasource.OGC'); -goog.require('ngeo.DataSource'); +goog.require('ngeo.datasource.OGC'); -gmf.DataSource = class extends ngeo.DataSource { +gmf.datasource.OGC = class extends ngeo.datasource.OGC { /** - * A `gmf.DataSource` extends a `ngeo.DataSource` and adds some properties - * that are proper to GMF only. + * A `gmf.datasource.OGC` extends a `ngeo.datasource.OGC` and + * adds some properties that are proper to GMF only. * * @struct - * @param {gmfx.DataSourceOptions} options Options. + * @param {gmfx.datasource.OGCOptions} options Options. */ constructor(options) { diff --git a/contribs/gmf/src/directives/filterselector.js b/contribs/gmf/src/directives/filterselector.js index 41072253570..f5f95b742cb 100644 --- a/contribs/gmf/src/directives/filterselector.js +++ b/contribs/gmf/src/directives/filterselector.js @@ -3,9 +3,9 @@ goog.provide('gmf.filterselectorComponent'); goog.require('gmf'); /** @suppress {extraRequire} */ goog.require('gmf.Authentication'); -goog.require('gmf.DataSourceBeingFiltered'); +goog.require('gmf.datasource.DataSourceBeingFiltered'); /** @suppress {extraRequire} */ -goog.require('gmf.DataSourcesHelper'); +goog.require('gmf.datasource.DataSourcesHelper'); goog.require('gmf.SavedFilters'); /** @suppress {extraRequire} */ goog.require('ngeo.filterComponent'); @@ -25,11 +25,11 @@ gmf.FilterselectorController = class { * @param {!angular.Scope} $scope Angular scope. * @param {!angular.$timeout} $timeout Angular timeout service. * @param {angularGettext.Catalog} gettextCatalog Gettext catalog. - * @param {gmf.DataSourceBeingFiltered} gmfDataSourceBeingFiltered The - * Gmf value service that determines the data source currently being + * @param {gmf.datasource.DataSourceBeingFiltered} gmfDataSourceBeingFiltered + * The Gmf value service that determines the data source currently being * filtered. - * @param {gmf.DataSourcesHelper} gmfDataSourcesHelper Gmf data sources - * helper service. + * @param {gmf.datasource.DataSourcesHelper} gmfDataSourcesHelper Gmf data + * sources helper service. * @param {gmf.SavedFilters} gmfSavedFilters Gmf saved filters service. * @param {gmfx.User} gmfUser User. * @param {ngeo.Notification} ngeoNotification Ngeo notification service. @@ -91,7 +91,7 @@ gmf.FilterselectorController = class { * The data source that can either be selected from the list or have * its value set from an external source (for example: the layertree) * and that requires to be ready before it can be filtered. - * @type {gmf.DataSourceBeingFiltered} + * @type {gmf.datasource.DataSourceBeingFiltered} * @export */ this.gmfDataSourceBeingFiltered = gmfDataSourceBeingFiltered; @@ -102,7 +102,7 @@ gmf.FilterselectorController = class { ); /** - * @type {gmf.DataSourcesHelper} + * @type {gmf.datasource.DataSourcesHelper} * @private */ this.gmfDataSourcesHelper_ = gmfDataSourcesHelper; @@ -177,7 +177,7 @@ gmf.FilterselectorController = class { this.directedRules = null; /** - * @type {Array.} + * @type {Array.} * @export */ this.filtrableDataSources = []; @@ -189,7 +189,7 @@ gmf.FilterselectorController = class { this.filtrableLayerNodeNames_ = null; /** - * @type {gmf.DataSources} + * @type {gmf.datasource.DataSources} * @private */ this.gmfDataSources_ = gmfDataSourcesHelper.collection; @@ -203,7 +203,7 @@ gmf.FilterselectorController = class { /** * The data source ready to be filtered, after it has been selected and * prepared. - * @type {?gmf.DataSource} + * @type {?gmf.datasource.OGC} * @export */ this.readyDataSource = null; @@ -362,8 +362,9 @@ gmf.FilterselectorController = class { */ handleDataSourcesAdd_(evt) { const dataSource = evt.element; - goog.asserts.assertInstanceof(dataSource, gmf.DataSource); - this.registerDataSource_(dataSource); + if (dataSource instanceof gmf.datasource.OGC) { + this.registerDataSource_(dataSource); + } } @@ -377,8 +378,9 @@ gmf.FilterselectorController = class { */ handleDataSourcesRemove_(evt) { const dataSource = evt.element; - goog.asserts.assertInstanceof(dataSource, gmf.DataSource); - this.unregisterDataSource_(dataSource); + if (dataSource instanceof gmf.datasource.OGC) { + this.unregisterDataSource_(dataSource); + } } @@ -387,7 +389,7 @@ gmf.FilterselectorController = class { * data source is about to be registered, then the `filtrable` property * is set. Otherwise, it's used. * - * @param {gmf.DataSource} dataSource Data source + * @param {gmf.datasource.OGC} dataSource Data source * @private */ registerDataSource_(dataSource) { @@ -410,7 +412,7 @@ gmf.FilterselectorController = class { /** * Unregister a data source if it's filtrable. Also, if it's the one * that was currently selected, unselect it. - * @param {gmf.DataSource} dataSource Data source + * @param {gmf.datasource.OGC} dataSource Data source * @private */ unregisterDataSource_(dataSource) { @@ -438,7 +440,7 @@ gmf.FilterselectorController = class { * If 1) is true but not any of the others, then the server has not been * configured properly. In this case, a warning notification can be shown. * - * @param {gmf.DataSource} dataSource Ngeo data source object + * @param {gmf.datasource.OGC} dataSource GMF data source object * @param {boolean=} opt_notify Whether to show a warning notification or not * in case of a data source that has its name is in the list of * filtrable layer node names but it doesn't match the other requirements. @@ -506,7 +508,8 @@ gmf.FilterselectorController = class { } /** - * @param {?gmf.DataSource} dataSource Newly selected data source object. + * @param {?gmf.datasource.OGC} dataSource Newly selected data source + * object. * @private */ handleSelectedDataSourceChange_(dataSource) { @@ -566,7 +569,7 @@ gmf.FilterselectorController = class { } /** - * @param {ngeo.DataSource} dataSource Data source. + * @param {ngeo.datasource.DataSource} dataSource Data source. * @return {?gmf.FilterselectorController.RuleCacheItem} Rule cache item. * @private */ @@ -575,7 +578,7 @@ gmf.FilterselectorController = class { } /** - * @param {ngeo.DataSource} dataSource Data source. + * @param {ngeo.datasource.DataSource} dataSource Data source. * @param {gmf.FilterselectorController.RuleCacheItem} item Rule cache item. * @private */ diff --git a/contribs/gmf/src/directives/layertree.js b/contribs/gmf/src/directives/layertree.js index 607c67f5dcc..6edf3c88f19 100644 --- a/contribs/gmf/src/directives/layertree.js +++ b/contribs/gmf/src/directives/layertree.js @@ -3,7 +3,7 @@ goog.provide('gmf.layertreeComponent'); goog.require('ngeo.SyncArrays'); goog.require('gmf'); -goog.require('gmf.DataSourceBeingFiltered'); +goog.require('gmf.datasource.DataSourceBeingFiltered'); goog.require('gmf.Permalink'); goog.require('gmf.SyncLayertreeMap'); goog.require('gmf.TreeManager'); @@ -11,6 +11,7 @@ goog.require('ngeo.WMSTime'); goog.require('ngeo.CreatePopup'); goog.require('ngeo.LayerHelper'); goog.require('ngeo.LayertreeController'); +goog.require('ngeo.datasource.OGC'); goog.require('ol.layer.Tile'); /** @suppress {extraRequire} */ @@ -112,8 +113,8 @@ gmf.module.component('gmfLayertree', gmf.layertreeComponent); * @param {!angular.Scope} $scope Angular scope. * @param {!ngeo.CreatePopup} ngeoCreatePopup Popup service. * @param {!ngeo.LayerHelper} ngeoLayerHelper Ngeo Layer Helper. - * @param {gmf.DataSourceBeingFiltered} gmfDataSourceBeingFiltered The - * Gmf value service that determines the data source currently being + * @param {gmf.datasource.DataSourceBeingFiltered} gmfDataSourceBeingFiltered + * The Gmf value service that determines the data source currently being * filtered. * @param {!gmf.Permalink} gmfPermalink The gmf permalink service. * @param {!gmf.TreeManager} gmfTreeManager gmf Tree Manager service. @@ -169,7 +170,7 @@ gmf.LayertreeController = function($element, $http, $sce, $scope, ngeoCreatePopu this.layerHelper_ = ngeoLayerHelper; /** - * @type {gmf.DataSourceBeingFiltered} + * @type {gmf.datasource.DataSourceBeingFiltered} * @export */ this.gmfDataSourceBeingFiltered = gmfDataSourceBeingFiltered; @@ -443,7 +444,7 @@ gmf.LayertreeController.prototype.getNodeState = function(treeCtrl) { * data sources. * * The setting of the TIME parameter on the layer occurs in the - * `gmf.DataSourcesManager` service + * `gmf.datasource.DataSourcesManager` service * * LayertreeController.prototype.updateWMSTimeLayerState - description * @param {ngeo.LayertreeController} layertreeCtrl ngeo layertree controller @@ -458,6 +459,7 @@ gmf.LayertreeController.prototype.updateWMSTimeLayerState = function( } const dataSource = layertreeCtrl.getDataSource(); if (dataSource) { + goog.asserts.assertInstanceof(dataSource, ngeo.datasource.OGC); dataSource.timeRangeValue = time; } else if (layertreeCtrl.children) { for (let i = 0, ii = layertreeCtrl.children.length; i < ii; i++) { @@ -679,7 +681,7 @@ gmf.LayertreeController.prototype.toggleNodeLegend = function(legendNodeId) { /** - * @param {gmf.DataSource} ds Data source to filter. + * @param {gmf.datasource.OGC} ds Data source to filter. * @export */ gmf.LayertreeController.prototype.toggleFiltrableDataSource = function(ds) { diff --git a/contribs/gmf/src/directives/print.js b/contribs/gmf/src/directives/print.js index 7023cfeca78..c8434cca19a 100644 --- a/contribs/gmf/src/directives/print.js +++ b/contribs/gmf/src/directives/print.js @@ -850,8 +850,8 @@ gmf.PrintController.prototype.resetPrintStates_ = function(opt_printState) { /** * Get datasource object for print report * @private - * @return {Array.} the datasource objet for - * the print report + * @return {Array.} the data + * source objet for the print report */ gmf.PrintController.prototype.getDataSource_ = function() { let datasourceObj, data, columns; @@ -871,13 +871,14 @@ gmf.PrintController.prototype.getDataSource_ = function() { data.push(Object.keys(properties).map(key => properties[key])); }, this); if (columns.length) { - datasourceObj = /** @type {gmfx.DataSourcePrintReportObject} */({ - title: this.translate_(source.label), - table: { - columns, - data - } - }); + datasourceObj = + /** @type {gmfx.datasource.DataSourcePrintReportObject} */({ + title: this.translate_(source.label), + table: { + columns, + data + } + }); datasourceArr.push(datasourceObj); } }, this); diff --git a/contribs/gmf/src/services/datasourcebeingfiltered.js b/contribs/gmf/src/services/datasourcebeingfiltered.js deleted file mode 100644 index 3c5748f4a42..00000000000 --- a/contribs/gmf/src/services/datasourcebeingfiltered.js +++ /dev/null @@ -1,23 +0,0 @@ -goog.provide('gmf.DataSourceBeingFiltered'); - -goog.require('gmf'); - - -gmf.module.value('gmfDataSourceBeingFiltered', { - dataSource: null -}); - - -/** - * @record - * @struct - * @export - */ -gmf.DataSourceBeingFiltered = function() {}; - - -/** - * @type {?gmf.DataSource} - * @export - */ -gmf.DataSourceBeingFiltered.prototype.dataSource; diff --git a/contribs/gmf/src/services/enumerateattribute.js b/contribs/gmf/src/services/enumerateattribute.js index feb3bd9e1ea..f78a0b1a7da 100644 --- a/contribs/gmf/src/services/enumerateattribute.js +++ b/contribs/gmf/src/services/enumerateattribute.js @@ -40,7 +40,7 @@ gmf.EnumerateAttribute = class { } /** - * @param {gmf.DataSource} dataSource Data source. + * @param {gmf.datasource.OGC} dataSource Data source. * @param {string} attribute Attribute name. * @return {angular.$q.Promise} Promise. */ diff --git a/contribs/gmf/src/services/objecteditingquery.js b/contribs/gmf/src/services/objecteditingquery.js index 1db7b7b9469..7cbfabd111f 100644 --- a/contribs/gmf/src/services/objecteditingquery.js +++ b/contribs/gmf/src/services/objecteditingquery.js @@ -2,7 +2,7 @@ goog.provide('gmf.ObjectEditingQuery'); goog.require('gmf'); goog.require('gmf.Themes'); -goog.require('ngeo.DataSource'); +goog.require('ngeo.datasource.OGC'); goog.require('ol.format.WMSGetFeatureInfo'); goog.require('ol.source.ImageWMS'); @@ -169,7 +169,7 @@ gmf.ObjectEditingQuery.prototype.getFeatureInfo = function( const view = map.getView(); const projCode = view.getProjection().getCode(); const resolution = /** @type {number} */(view.getResolution()); - const infoFormat = ngeo.DataSource.WMSInfoFormat.GML; + const infoFormat = ngeo.datasource.OGC.WMSInfoFormat.GML; const layerNode = layerInfo.layerNode; const layersParam = layerNode.layers.split(','); const ogcServer = layerInfo.ogcServer; diff --git a/examples/bboxquery.js b/examples/bboxquery.js index 75373da8632..c999841ebc4 100644 --- a/examples/bboxquery.js +++ b/examples/bboxquery.js @@ -2,8 +2,8 @@ goog.provide('app.bboxquery'); /** @suppress {extraRequire} */ goog.require('ngeo.proj.EPSG21781'); -goog.require('ngeo.DataSource'); -goog.require('ngeo.DataSources'); +goog.require('ngeo.datasource.DataSources'); +goog.require('ngeo.datasource.OGC'); /** @suppress {extraRequire} */ goog.require('ngeo.btnDirective'); /** @suppress {extraRequire} */ @@ -67,8 +67,8 @@ app.module.controller('AppQueryresultController', app.QueryresultController); /** * @param {angular.Scope} $scope Scope. - * @param {ngeo.DataSources} ngeoDataSources Ngeo collection of data sources - * objects. + * @param {ngeo.datasource.DataSources} ngeoDataSources Ngeo collection of + * data sources objects. * @constructor * @ngInject */ @@ -80,7 +80,7 @@ app.MainController = function($scope, ngeoDataSources) { */ this.queryActive = true; - ngeoDataSources.push(new ngeo.DataSource({ + ngeoDataSources.push(new ngeo.datasource.OGC({ id: 1, name: 'bus_stop', visible: true, @@ -97,7 +97,7 @@ app.MainController = function($scope, ngeoDataSources) { }) }); - ngeoDataSources.push(new ngeo.DataSource({ + ngeoDataSources.push(new ngeo.datasource.OGC({ id: 2, name: 'information', visible: true, diff --git a/examples/mapquery.js b/examples/mapquery.js index 6bf2d199f74..5ae34c66704 100644 --- a/examples/mapquery.js +++ b/examples/mapquery.js @@ -2,8 +2,8 @@ goog.provide('app.mapquery'); /** @suppress {extraRequire} */ goog.require('ngeo.proj.EPSG21781'); -goog.require('ngeo.DataSource'); -goog.require('ngeo.DataSources'); +goog.require('ngeo.datasource.DataSources'); +goog.require('ngeo.datasource.OGC'); goog.require('ngeo.ToolActivate'); goog.require('ngeo.ToolActivateMgr'); /** @suppress {extraRequire} */ @@ -69,8 +69,8 @@ app.module.controller('AppQueryresultController', app.QueryresultController); /** * @param {angular.Scope} $scope Scope. - * @param {ngeo.DataSources} ngeoDataSources Ngeo collection of data sources - * objects. + * @param {ngeo.datasource.DataSources} ngeoDataSources Ngeo collection of + * data sources objects. * @param {ngeo.ToolActivateMgr} ngeoToolActivateMgr The ngeo ToolActivate * manager. * @constructor @@ -90,7 +90,7 @@ app.MainController = function($scope, ngeoDataSources, ngeoToolActivateMgr) { */ this.queryActive = true; - ngeoDataSources.push(new ngeo.DataSource({ + ngeoDataSources.push(new ngeo.datasource.OGC({ id: 1, name: 'bus_stop', visible: true, @@ -107,7 +107,7 @@ app.MainController = function($scope, ngeoDataSources, ngeoToolActivateMgr) { }) }); - ngeoDataSources.push(new ngeo.DataSource({ + ngeoDataSources.push(new ngeo.datasource.OGC({ id: 2, name: 'information', visible: true, diff --git a/options/ngeox.js b/options/ngeox.js index c101c78c54e..6bddcea5f52 100644 --- a/options/ngeox.js +++ b/options/ngeox.js @@ -90,7 +90,7 @@ ngeox.Attribute.prototype.type; * service. * * @typedef {{ - * dataSource: (ngeox.DataSource), + * dataSource: (ngeox.datasource.DataSource), * incTime: (boolean|undefined), * filter: (ol.format.filter.Filter|undefined), * filterRules: (!Array.|undefined), @@ -103,7 +103,7 @@ ngeox.CreateFilterOptions; /** * The data source from which to get the filterRules that will be used to * create the OL filter object. - * @type {ngeox.DataSource} + * @type {ngeox.datasource.DataSource} */ ngeox.CreateFilterOptions.prototype.dataSource; @@ -144,1206 +144,1237 @@ ngeox.CreateFilterOptions.prototype.srsName; /** - * The definition of a single layer (WMS) and/or featureType (WFS). - * @record - * @struct + * Dimensions definition. + * @typedef {Object.} */ -ngeox.DataSourceLayer = function() {}; +ngeox.Dimensions; /** - * The maximum resolution the layer should be rendered (when visible). - * @type {number|undefined} + * Active dimensions definition, where the value can't be null. + * @typedef {Object.} */ -ngeox.DataSourceLayer.prototype.maxResolution; +ngeox.DimensionsActive; /** - * The minimum resolution the layer should be rendered (when visible). - * @type {number|undefined} + * The options to use when sending GetFeature/GetFeatureInfo requests using + * the querent or map query service. + * @typedef {{ + * coordinate: (ol.Coordinate|undefined), + * dataSources: (Array.|undefined), + * extent: (ol.Extent|undefined), + * filter: (ol.format.filter.Filter|undefined), + * limit: (number|undefined), + * map: (ol.Map), + * queryableDataSources: (ngeox.QueryableDataSources|undefined), + * tolerancePx: (number|undefined), + * wfsCount: (boolean|undefined) + * }} */ -ngeox.DataSourceLayer.prototype.minResolution; +ngeox.IssueGetFeaturesOptions; /** - * The layer name (WMS) and/or feature type name (WFS) - * @type {string} + * The coordinate to issue the requests with, which can end up with either + * WMS or WFS requests. + * @type {ol.Coordinate|undefined} */ -ngeox.DataSourceLayer.prototype.name; +ngeox.IssueGetFeaturesOptions.prototype.coordinate; /** - * Whether the the layer is queryable or not. Defaults to `false`. - * @type {boolean|undefined} + * List of data sources to query. Only those that meet the requirements will + * actually be queried. The querent service requires either the `dataSources` + * or `queryableDataSources` property to be set. + * @type {Array.|undefined} */ -ngeox.DataSourceLayer.prototype.queryable; +ngeox.IssueGetFeaturesOptions.prototype.dataSources; /** - * The options to create a `ngeox.DataSource` with. - * @record - * @struct + * The extent to issue the requests with, which can end up with WFS requests + * only. + * @type {ol.Extent|undefined} */ -ngeox.DataSourceOptions = function() {}; +ngeox.IssueGetFeaturesOptions.prototype.extent; /** - * The dimensions that are currently active on the data source. - * @type {ngeox.Dimensions|undefined} + * A filter to additionnally use with the query. Only used by WFS requests. + * If a filter is defined, then it is used instead of the data source's + * filter rules. + * @type {ol.format.filter.Filter|undefined} */ -ngeox.DataSourceOptions.prototype.activeDimensions; +ngeox.IssueGetFeaturesOptions.prototype.filter; /** - * The attributes of the data source. - * @type {Array.|undefined} + * The maximum number of features to get per request. + * @type {number|undefined} */ -ngeox.DataSourceOptions.prototype.attributes; +ngeox.IssueGetFeaturesOptions.prototype.limit; /** - * Whether the geometry from this data source can be copied to other data - * sources or not. Defaults to `false`. - * @type {boolean|undefined} + * The ol3 map object. Used to fill some parameters of the queries, such as + * 'srs' and filter the queryable layers within the data sources. + * @type {ol.Map} */ -ngeox.DataSourceOptions.prototype.copyable; +ngeox.IssueGetFeaturesOptions.prototype.map; /** - * A reference to the dimensions. - * @type {ngeox.Dimensions|undefined} + * A hash of queryable data sources, which must meet all requirements. The + * querent service requires either the `dataSources` or `queryableDataSources` + * property to be set. + * @type {ngeox.QueryableDataSources|undefined} */ -ngeox.DataSourceOptions.prototype.dimensions; +ngeox.IssueGetFeaturesOptions.prototype.queryableDataSources; /** - * The dimensions configuration, which determines those supported by this data - * source and whether they should use a static value or the one defined in the - * dimensions. - * @type {ngeox.Dimensions|undefined} + * A tolerance value in pixels used to create an extent from a coordinate + * to issue WFS requests. + * @type {number|undefined} */ -ngeox.DataSourceOptions.prototype.dimensionsConfig; +ngeox.IssueGetFeaturesOptions.prototype.tolerancePx; /** - * The filter condition to apply to the filter rules (if any). Defaults to - * `ngeo.FilterCondition.AND`. - * @type {string|undefined} + * When set, before making WFS GetFeature requests to fetch features, + * WFS GetFeature requests with `resultType = 'hits'` are made first. If + * the number of records for the request would exceed the limit, then + * no features are returned. + * @type {boolean|undefined} */ -ngeox.DataSourceOptions.prototype.filterCondition; +ngeox.IssueGetFeaturesOptions.prototype.wfsCount; /** - * A list of filter rules to apply to this data source using the filter - * condition. - * @type {!Array.|undefined} + * A hash that contains 2 lists of queryable data sources: `wfs` and `wms`. + * The same data source can only be in one of the two lists. The `wfs` list + * has priority, i.e. if the data source supports WFS, it's put in the + * `wfs` list. + * + * @typedef {{ + * wfs: (!Array.), + * wms: (!Array.) + * }} */ -ngeox.DataSourceOptions.prototype.filterRules; +ngeox.QueryableDataSources; /** - * Whether the data source is filtrable or not. - * @type {boolean|undefined} + * List of queryable data sources that support WFS. + * @type {Array.} */ -ngeox.DataSourceOptions.prototype.filtrable; +ngeox.QueryableDataSources.prototype.wfs; /** - * The name of the geometry attribute. - * @type {string|undefined} + * List of queryable data sources that support WMS. + * @type {Array.} */ -ngeox.DataSourceOptions.prototype.geometryName; +ngeox.QueryableDataSources.prototype.wms; /** - * (Required) The data source id. - * @type {number} + * Hash of features by data source ids. + * @typedef {!Object.>} */ -ngeox.DataSourceOptions.prototype.id; +ngeox.QuerentResult; /** - * The name of an attribute among the attributes of the data source. - * The value of that attribute, in records, can be used to identify - * each record individually. - * @type {string|undefined} + * The definition of a result item returned by the querent service. + * + * @typedef {{ + * features: (Array.), + * tooManyFeatures: (boolean|undefined), + * totalFeatureCount: (number|undefined) + * }} */ -ngeox.DataSourceOptions.prototype.identifierAttribute; +ngeox.QuerentResultItem; /** - * A data source is considered 'in range' when it is synchronized to - * a map view and the resolution of that view is within the range of - * the `maxResolution` and `minResolution`. These 2 properties are - * required for the `inRange` property to be dynamic, otherwise its - * value is always `true` by default. - * - * The synchronization is made in the `ngeo.syncDataSourcesMap` service. - * - * @type {boolean|undefined} + * The list of features that were returned by the query. + * @type {Array.} */ -ngeox.DataSourceOptions.prototype.inRange; +ngeox.QuerentResultItem.prototype.features; /** - * Maximum resolution where the data source can be displayed or queried. - * @type {number|undefined} + * The maximum number of features to get with the query. + * @type {number} */ -ngeox.DataSourceOptions.prototype.maxResolution; +ngeox.QuerentResultItem.prototype.limit; /** - * Minimum resolution where the data source can be displayed or queried. - * @type {number|undefined} + * Set if the query would have returned to many features. When set, no features + * are returned. + * @type {boolean|undefined} */ -ngeox.DataSourceOptions.prototype.minResolution; +ngeox.QuerentResultItem.prototype.tooManyFeatures; /** - * (Required) A human-readable name for the data source. - * @type {string} + * The total number of features that would have been returned by the query. + * @type {number|undefined} */ -ngeox.DataSourceOptions.prototype.name; +ngeox.QuerentResultItem.prototype.totalFeatureCount; /** - * The type of images to fetch by queries by the (WMS) or (WMTS) . - * @type {string|undefined} + * @interface */ -ngeox.DataSourceOptions.prototype.ogcImageType; +ngeox.MenuEvent = function() {}; /** - * A list of layer definitions that are used by (WMS) and (WFS) queries. - * These are **not** used by the (WMTS) queries (the wmtsLayers is used - * by WMTS queries). - * @type {Array.|undefined} + * @type {string} */ -ngeox.DataSourceOptions.prototype.ogcLayers; +ngeox.MenuEvent.prototype.action; /** - * The type of OGC server. - * @type {string|undefined} + * The options for the contextual menu overlay. + * @typedef {{ + * actions: (Array.), + * autoClose: (boolean|undefined) + * }} */ -ngeox.DataSourceOptions.prototype.ogcServerType; +ngeox.MenuOptions; /** - * The type data source. Can be: 'WMS' or 'WMTS'. - * @type {string|undefined} + * A list of menu actions. + * @type {Array.} */ -ngeox.DataSourceOptions.prototype.ogcType; +ngeox.MenuOptions.prototype.actions; /** - * Whether the geometry from this data source can be used to snap the geometry - * of features from other data sources that are being edited. Defaults to - * `false`. + * Whether to automatically close the contextual menu when an action is + * clicked or not. Defaults to `true`. * @type {boolean|undefined} */ -ngeox.DataSourceOptions.prototype.snappable; +ngeox.MenuOptions.prototype.autoClose; /** - * Determines whether external features can be snapped to the edges of - * features from this data source or not. Defaults to `true`. Requires - * `snappable` to be set. - * @type {boolean|undefined} + * A title to display as header of the contextual menu. + * @type {string|undefined} */ -ngeox.DataSourceOptions.prototype.snappingToEdges; +ngeox.MenuOptions.prototype.title; /** - * Determines whether external features can be snapped to the vertice of - * features from this data source or not. Defaults to `true`. Requires - * `snappable` to be set. - * @type {boolean|undefined} + * The options for an action item for the contextual menu overlay. + * @typedef {{ + * cls: (string|undefined), + * label: (string|undefined), + * name: (string) + * }} */ -ngeox.DataSourceOptions.prototype.snappingToVertice; +ngeox.MenuActionOptions; /** - * The tolerance in pixels the snapping should occur. Defaults to `10`. - * @type {number|undefined} + * CSS class name(s) to use for the icon of the action item. + * @type {string|undefined} */ -ngeox.DataSourceOptions.prototype.snappingTolerance; +ngeox.MenuActionOptions.prototype.cls; /** - * The name of the time attribute. + * The label to display for the action item. If not defined, the name is used. * @type {string|undefined} */ -ngeox.DataSourceOptions.prototype.timeAttributeName; +ngeox.MenuActionOptions.prototype.label; /** - * The time lower value, which can be combined with the time upper value - * to determine a range. - * @type {number|undefined} + * A unique name for the menu action, which is used in the event fired when + * the action is clicked. + * @type {string} */ -ngeox.DataSourceOptions.prototype.timeLowerValue; +ngeox.MenuActionOptions.prototype.name; /** - * The time property for the data source. Used to apply time filters. - * @type {ngeox.TimeProperty|undefined} + * A message to display by the ngeo notification service. + * @typedef {{ + * delay: (number|undefined), + * popup: (boolean|undefined), + * msg: (string), + * target: (angular.JQLite|Element|string|undefined), + * type: (string|undefined) + * }} */ -ngeox.DataSourceOptions.prototype.timeProperty; +ngeox.Message; /** - * The time upper value, which can be combined with the time lower value - * to determine a range. + * The delay in milliseconds the message is shown. Defaults to `7000`. * @type {number|undefined} */ -ngeox.DataSourceOptions.prototype.timeUpperValue; +ngeox.Message.prototype.delay; /** - * Whether the data source is visible or not, i.e. whether its is ON or OFF. + * Whether the message should be displayed inside a popup window or not. * Defaults to `false`. * @type {boolean|undefined} */ -ngeox.DataSourceOptions.prototype.visible; +ngeox.Message.prototype.popup; /** - * The feature namespace to use with WFS requests. - * @type {string|undefined} + * The message text to display + * @type {string} */ -ngeox.DataSourceOptions.prototype.wfsFeatureNS; +ngeox.Message.prototype.msg; /** - * The feature prefix to use with WFS requests. - * @type {string|undefined} + * The target element (or selector to get the element) in which to display the + * message. If not defined, then the default target of the notification service + * is used. + * @type {angular.JQLite|Element|string|undefined} */ -ngeox.DataSourceOptions.prototype.wfsFeaturePrefix; +ngeox.Message.prototype.target; /** - * The OutputFormat to use with WFS requests. + * The type of message. Defaults to `info`. * @type {string|undefined} */ -ngeox.DataSourceOptions.prototype.wfsOutputFormat; +ngeox.Message.prototype.type; /** - * The url to use for (WFS) requests. - * @type {string|undefined} + * The options for a popup created by the popup factory. + * @typedef {{ + * autoDestroy: (boolean|undefined), + * cls: (string|undefined), + * content: (*|undefined), + * height: (string|undefined), + * title: (string|undefined), + * url: (string|undefined), + * width: (string|undefined) + * }} */ -ngeox.DataSourceOptions.prototype.wfsUrl; +ngeox.PopupOptions; /** - * The InfoFormat to use with WMS requests. - * @type {string|undefined} + * Whether the popup should be automatically destroyed when hidden or not. + * Defaults to `false`. + * @type {boolean|undefined} */ -ngeox.DataSourceOptions.prototype.wmsInfoFormat; +ngeox.PopupOptions.prototype.autoDestroy; /** - * Whether the (WMS) images returned by this data source should be single tiles - * or not. Defaults to `false`. - * @type {boolean|undefined} + * Extra class name to add to the popup. + * @type {string|undefined} */ -ngeox.DataSourceOptions.prototype.wmsIsSingleTile; +ngeox.PopupOptions.prototype.cls; /** - * The url to use for (WMS) requests. - * @type {string|undefined} + * The content of the popup. Either the content or URL must be set. + * @type {*|undefined} */ -ngeox.DataSourceOptions.prototype.wmsUrl; +ngeox.PopupOptions.prototype.content; /** - * The layer name to use for the (WMTS) requests. + * The height of the popup. * @type {string|undefined} */ -ngeox.DataSourceOptions.prototype.wmtsLayer; +ngeox.PopupOptions.prototype.height; /** - * The url to use for (WMTS) requests. + * The title of the popup. * @type {string|undefined} */ -ngeox.DataSourceOptions.prototype.wmtsUrl; +ngeox.PopupOptions.prototype.title; /** - * @interface - * @struct + * The URL to use for the iframe to include as content for the popup. + * @type {string|undefined} */ -ngeox.DataSource = function() {}; +ngeox.PopupOptions.prototype.url; + /** - * @type {!ngeox.DimensionsActive} + * The width of the popup. + * @type {string|undefined} */ -ngeox.DataSource.prototype.activeDimensions; +ngeox.PopupOptions.prototype.width; + /** - * @type {boolean} + * Results of the query source. + * @typedef {{ + * sources: (!Array.), + * total: (number), + * pending: (boolean) + * }} */ -ngeox.DataSource.prototype.combinableForWMS; +ngeox.QueryResult; + /** - * @type {boolean} + * Results for each query source. + * @type {!Array.} */ -ngeox.DataSource.prototype.combinableForWFS; +ngeox.QueryResult.prototype.sources; + /** - * @type {boolean} + * The number of results for all sources. + * @type {number} */ -ngeox.DataSource.prototype.queryable; +ngeox.QueryResult.prototype.total; + /** + * If at least one source is pending. * @type {boolean} */ -ngeox.DataSource.prototype.supportsWFS; +ngeox.QueryResult.prototype.pending; + /** - * @type {boolean} + * Results for a query source. + * @typedef {{ + * features: (Array.), + * id: (number|string), + * label: (string), + * limit: (number), + * pending: (boolean), + * queried: (boolean), + * tooManyResults: (boolean), + * totalFeatureCount: (number|undefined) + * }} */ -ngeox.DataSource.prototype.supportsWMS; +ngeox.QueryResultSource; + /** - * @type {string|undefined} + * The matching features for this source. + * @type {Array.} */ -ngeox.DataSource.prototype.wmsUrl; +ngeox.QueryResultSource.prototype.features; + /** - * @type {string|undefined} + * Identifier. + * @type {number|string} */ -ngeox.DataSource.prototype.wfsUrl; +ngeox.QueryResultSource.prototype.id; + /** + * Label. * @type {string} */ -ngeox.DataSource.prototype.filterCondition; +ngeox.QueryResultSource.prototype.label; -/** - * @type {?Array.} - */ -ngeox.DataSource.prototype.filterRules; /** - * @param {ngeox.DataSource} dataSource Data source. - * @return {boolean} Whether this data source can be combined to the given - * other data source to fetch features in a single WFS request. + * The maximum number of features that can be returned for a query with this + * source. + * @type {number} */ -ngeox.DataSource.prototype.combinableWithDataSourceForWFS = function(dataSource) {}; +ngeox.QueryResultSource.prototype.limit; /** - * @param {ngeox.DataSource} dataSource Data source. - * @return {boolean} Whether this data source can be combined to the given - * other data source to fetch features in a single WMS request. + * Is the request for this source still ongoing? + * @type {boolean} */ -ngeox.DataSource.prototype.combinableWithDataSourceForWMS = function(dataSource) {}; +ngeox.QueryResultSource.prototype.pending; /** - * @param {!ngeox.DataSource} dataSource Remote data source to compare with - * this one. - * @return {boolean} Whether the two data sources have the same active - * dimensions. If both have no dimensions, they are considered to be - * sharing the same dimensions. + * Has this source been queried for the last query request? + * @type {boolean} */ -ngeox.DataSource.prototype.haveTheSameActiveDimensions = function(dataSource) {}; +ngeox.QueryResultSource.prototype.queried; /** - * Dimensions definition. - * @typedef {Object.} + * If the last query for this source would return more features than the + * configured limit. + * @type {boolean} */ -ngeox.Dimensions; +ngeox.QueryResultSource.prototype.tooManyResults; /** - * Active dimensions definition, where the value can't be null. - * @typedef {Object.} + * If `tooManyResults` is `true`, this contains the total number of features. + * @type {number|undefined} */ -ngeox.DimensionsActive; +ngeox.QueryResultSource.prototype.totalFeatureCount; /** - * The options to use when sending GetFeature/GetFeatureInfo requests using - * the querent or map query service. + * The options for the query service. * @typedef {{ - * coordinate: (ol.Coordinate|undefined), - * dataSources: (Array.|undefined), - * extent: (ol.Extent|undefined), - * filter: (ol.format.filter.Filter|undefined), * limit: (number|undefined), - * map: (ol.Map), - * queryableDataSources: (ngeox.QueryableDataSources|undefined), - * tolerancePx: (number|undefined), - * wfsCount: (boolean|undefined) + * queryCountFirst: (boolean|undefined), + * sourceIdsProperty: (string|undefined), + * tolerance: (number|undefined), + * featureNS: (string|undefined), + * featurePrefix: (string|undefined), + * geometryName: (string|undefined) * }} */ -ngeox.IssueGetFeaturesOptions; +ngeox.QueryOptions; /** - * The coordinate to issue the requests with, which can end up with either - * WMS or WFS requests. - * @type {ol.Coordinate|undefined} + * The maximum number of records per request the query service should ask. + * Defaults to `50`. Note that sources sharing the same URL are combined + * together in a single request. This limit will still apply to those. + * @type {number|undefined} */ -ngeox.IssueGetFeaturesOptions.prototype.coordinate; +ngeox.QueryOptions.prototype.limit; /** - * List of data sources to query. Only those that meet the requirements will - * actually be queried. The querent service requires either the `dataSources` - * or `queryableDataSources` property to be set. - * @type {Array.|undefined} + * For WFS sources, should the number of features first be requested with + * `resultType=hits` before requesting the actual features in an seconds request? + * Defaults to `false`. + * @type {boolean|undefined} */ -ngeox.IssueGetFeaturesOptions.prototype.dataSources; +ngeox.QueryOptions.prototype.queryCountFirst; /** - * The extent to issue the requests with, which can end up with WFS requests - * only. - * @type {ol.Extent|undefined} + * Defines the name of the layer property that holds the ids of the sources. + * Use this if you have more than one source bound to a layer. Defaults to + * `querySourceIds`. + * @type {string|undefined} */ -ngeox.IssueGetFeaturesOptions.prototype.extent; +ngeox.QueryOptions.prototype.sourceIdsProperty; /** - * A filter to additionnally use with the query. Only used by WFS requests. - * If a filter is defined, then it is used instead of the data source's - * filter rules. - * @type {ol.format.filter.Filter|undefined} + * When issuing an identify feature request at a click position, either a WMS GetFeatureInfo + * or a WFS GetFeature request will be used. For GetFeature requests a bbox is built + * around the position. This `tolerance` in pixel determines the size of the bbox. + * The default is `3` pixel. + * @type {number|undefined} */ -ngeox.IssueGetFeaturesOptions.prototype.filter; +ngeox.QueryOptions.prototype.tolerance; /** - * The maximum number of features to get per request. - * @type {number|undefined} + * The feature namespace for WFS GetFeature requests. The default is + * `http://mapserver.gis.umn.edu/mapserver`. + * @type {string|undefined} */ -ngeox.IssueGetFeaturesOptions.prototype.limit; +ngeox.QueryOptions.prototype.featureNS; /** - * The ol3 map object. Used to fill some parameters of the queries, such as - * 'srs' and filter the queryable layers within the data sources. - * @type {ol.Map} + * The feature prefix for WFS GetFeature requests. The default is `feature`. + * @type {string|undefined} */ -ngeox.IssueGetFeaturesOptions.prototype.map; +ngeox.QueryOptions.prototype.featurePrefix; /** - * A hash of queryable data sources, which must meet all requirements. The - * querent service requires either the `dataSources` or `queryableDataSources` - * property to be set. - * @type {ngeox.QueryableDataSources|undefined} + * The name of the geometry property for WFS GetFeature requests. The default is `geom`. + * @type {string|undefined} */ -ngeox.IssueGetFeaturesOptions.prototype.queryableDataSources; +ngeox.QueryOptions.prototype.geometryName; /** - * A tolerance value in pixels used to create an extent from a coordinate - * to issue WFS requests. - * @type {number|undefined} + * The configuration of a source for the Query service. + * @typedef {{ + * format: (!ol.format.Feature|undefined), + * id: (number|string), + * identifierAttributeField: (string|undefined), + * infoFormat: (string|undefined), + * label: (string|undefined), + * layer: (!ol.layer.Base|undefined), + * layers: (!Array.|undefined), + * getLayers: (function(number): !Array.|undefined), + * serverType: (string|undefined), + * url: (string|undefined), + * validateLayerParams: (boolean|undefined), + * wmsSource: (!ol.source.ImageWMS|!ol.source.TileWMS|undefined), + * wfsQuery: (boolean|undefined) + * }} */ -ngeox.IssueGetFeaturesOptions.prototype.tolerancePx; +ngeox.QuerySource; /** - * When set, before making WFS GetFeature requests to fetch features, - * WFS GetFeature requests with `resultType = 'hits'` are made first. If - * the number of records for the request would exceed the limit, then - * no features are returned. - * @type {boolean|undefined} + * The used to read the returned features from query requests for this source. + * @type {!ol.format.Feature|undefined} */ -ngeox.IssueGetFeaturesOptions.prototype.wfsCount; +ngeox.QuerySource.prototype.format; /** - * A hash that contains 2 lists of queryable data sources: `wfs` and `wms`. - * The same data source can only be in one of the two lists. The `wfs` list - * has priority, i.e. if the data source supports WFS, it's put in the - * `wfs` list. - * - * @typedef {{ - * wfs: (!Array.), - * wms: (!Array.) - * }} + * The unique identifier of the source. + * @type {number|string} */ -ngeox.QueryableDataSources; +ngeox.QuerySource.prototype.id; /** - * List of queryable data sources that support WFS. - * @type {Array.} + * The key that identify the title attribute in features. + * @type {string|undefined} */ -ngeox.QueryableDataSources.prototype.wfs; +ngeox.QuerySource.prototype.identifierAttributeField; /** - * List of queryable data sources that support WMS. - * @type {Array.} + * The info format to request and read the returned features. Optional. + * Default value is `geojson`. Possible values are: `geojson`, `gml`. + * @type {string|undefined} */ -ngeox.QueryableDataSources.prototype.wms; +ngeox.QuerySource.prototype.infoFormat; /** - * Hash of features by data source ids. - * @typedef {!Object.>} + * The human-readable name of the source. If not set, the `name` property + * is used instead. + * @type {string|undefined} */ -ngeox.QuerentResult; +ngeox.QuerySource.prototype.label; /** - * The definition of a result item returned by the querent service. - * - * @typedef {{ - * features: (Array.), - * tooManyFeatures: (boolean|undefined), - * totalFeatureCount: (number|undefined) - * }} + * A reference to the ol3 layer object. If not defined, will be automatically + * fetched using the source `name` and the according layer property that has + * the same value. + * @type {!ol.layer.Base|undefined} */ -ngeox.QuerentResultItem; +ngeox.QuerySource.prototype.layer; /** - * The list of features that were returned by the query. - * @type {Array.} + * A reference to the ol3 layers names. Multiple layers names. + * @type {!Array.|undefined} */ -ngeox.QuerentResultItem.prototype.features; +ngeox.QuerySource.prototype.layers; /** - * The maximum number of features to get with the query. - * @type {number} + * Additionnal params to use when querying this source. + * @type {function(number): !Array.|undefined} */ -ngeox.QuerentResultItem.prototype.limit; +ngeox.QuerySource.prototype.getLayers; /** - * Set if the query would have returned to many features. When set, no features - * are returned. - * @type {boolean|undefined} + * Server type of the source. Can be `mapserver` or `geoserver`. + * @type {string|undefined} */ -ngeox.QuerentResultItem.prototype.tooManyFeatures; +ngeox.QuerySource.prototype.serverType; /** - * The total number of features that would have been returned by the query. - * @type {number|undefined} + * URL to use for the request. Required if the layer object doesn't support + * WMS GetFeatureInfo requests. + * @type {string|undefined} */ -ngeox.QuerentResultItem.prototype.totalFeatureCount; +ngeox.QuerySource.prototype.url; /** - * @interface + * Whether to validate the LAYERS params of the layer currently being + * queried. Useful if the source configuration was not given a direct + * reference to the ol3 WMS source object, i.e. it was given an `url` and + * `params` properties instead, which resulted in the creation of an + * inner `ol.source.ImageWMS` object. If that source configuration is attached + * to a layer that also has an ol3 WMS source object, then the latter may + * contain more than one layer name within the LAYERS param. In that case, + * this `validateLayerParams` property, when enabled, will make the query + * service check if the layer name(s) within its LAYERS params is currently + * inside the layer source LAYERS params. If it's not there, then the source + * should not be queried. + * + * When setting this option, you must not set the wmsSource or layer if + * it has an inner ol3 wms source object. + * @type {boolean|undefined} */ -ngeox.MenuEvent = function() {}; +ngeox.QuerySource.prototype.validateLayerParams; /** - * @type {string} + * The ol3 WMS source object used to build the query string. If not defined, + * the layer source object will be used (if it's WMS), otherwise one will + * be created by the query service using the `url` and `params` properties of + * this source. + * @type {!ol.source.ImageWMS|!ol.source.TileWMS|undefined} */ -ngeox.MenuEvent.prototype.action; +ngeox.QuerySource.prototype.wmsSource; /** - * The options for the contextual menu overlay. - * @typedef {{ - * actions: (Array.), - * autoClose: (boolean|undefined) - * }} + * If this source supports WFS requests. + * @type {boolean|undefined} */ -ngeox.MenuOptions; +ngeox.QuerySource.prototype.wfsQuery; /** - * A list of menu actions. - * @type {Array.} + * A WFS type. To be used with {@link ngeox.WfsPermalinkOptions}. + * @typedef {{ + * featureType: (string), + * label: (string|undefined), + * featureNS: (string|undefined), + * featurePrefix: (string|undefined) + * }} */ -ngeox.MenuOptions.prototype.actions; +ngeox.WfsType; /** - * Whether to automatically close the contextual menu when an action is - * clicked or not. Defaults to `true`. - * @type {boolean|undefined} + * The feature type name. Required. + * @type {string} */ -ngeox.MenuOptions.prototype.autoClose; +ngeox.WfsType.prototype.featureType; /** - * A title to display as header of the contextual menu. + * The field of a feature used as label. * @type {string|undefined} */ -ngeox.MenuOptions.prototype.title; +ngeox.WfsType.prototype.label; /** - * The options for an action item for the contextual menu overlay. - * @typedef {{ - * cls: (string|undefined), - * label: (string|undefined), - * name: (string) - * }} + * The namespace URI used for features. If not given, the default namespace set + * in {@link ngeox.WfsPermalinkOptions} will be used. + * @type {string|undefined} */ -ngeox.MenuActionOptions; +ngeox.WfsType.prototype.featureNS; /** - * CSS class name(s) to use for the icon of the action item. + * The prefix for the feature namespace. If not given, the default prefix set + * in {@link ngeox.WfsPermalinkOptions} will be used. * @type {string|undefined} */ -ngeox.MenuActionOptions.prototype.cls; +ngeox.WfsType.prototype.featurePrefix; /** - * The label to display for the action item. If not defined, the name is used. - * @type {string|undefined} + * The options for the WFS query service (permalink). + * @typedef {{ + * url: (string), + * wfsTypes: (!Array.), + * pointRecenterZoom: (number|undefined), + * defaultFeatureNS: (string), + * defaultFeaturePrefix: (string), + * maxFeatures: (number|undefined) + * }} */ -ngeox.MenuActionOptions.prototype.label; +ngeox.WfsPermalinkOptions; /** - * A unique name for the menu action, which is used in the event fired when - * the action is clicked. + * URL to the WFS server. * @type {string} */ -ngeox.MenuActionOptions.prototype.name; +ngeox.WfsPermalinkOptions.prototype.url; /** - * A message to display by the ngeo notification service. - * @typedef {{ - * delay: (number|undefined), - * popup: (boolean|undefined), - * msg: (string), - * target: (angular.JQLite|Element|string|undefined), - * type: (string|undefined) - * }} + * The queryable WFS types. + * @type {!Array.} */ -ngeox.Message; +ngeox.WfsPermalinkOptions.prototype.wfsTypes; /** - * The delay in milliseconds the message is shown. Defaults to `7000`. + * Zoom level to use when result is a single point feature. If not set the map + * is not zoomed to a specific zoom level. * @type {number|undefined} */ -ngeox.Message.prototype.delay; - - -/** - * Whether the message should be displayed inside a popup window or not. - * Defaults to `false`. - * @type {boolean|undefined} - */ -ngeox.Message.prototype.popup; +ngeox.WfsPermalinkOptions.prototype.pointRecenterZoom; /** - * The message text to display + * The default namespace URI used for features. This will be used if no custom + * namespace is given for a WFS type. * @type {string} */ -ngeox.Message.prototype.msg; +ngeox.WfsType.prototype.defaultFeatureNS; /** - * The target element (or selector to get the element) in which to display the - * message. If not defined, then the default target of the notification service - * is used. - * @type {angular.JQLite|Element|string|undefined} + * The default prefix for the feature namespace. This will be used if no custom + * prefix is given for a WFS type. + * @type {string} */ -ngeox.Message.prototype.target; +ngeox.WfsType.prototype.defaultFeaturePrefix; /** - * The type of message. Defaults to `info`. - * @type {string|undefined} + * The maximum number of records per request the query service should ask. + * Defaults to `50`. + * @type {number|undefined} */ -ngeox.Message.prototype.type; +ngeox.WfsPermalinkOptions.prototype.maxFeatures; /** - * The options for a popup created by the popup factory. - * @typedef {{ - * autoDestroy: (boolean|undefined), - * cls: (string|undefined), - * content: (*|undefined), - * height: (string|undefined), - * title: (string|undefined), - * url: (string|undefined), - * width: (string|undefined) - * }} + * Namespace. + * @type {Object} */ -ngeox.PopupOptions; +ngeox.datasource; /** - * Whether the popup should be automatically destroyed when hidden or not. - * Defaults to `false`. - * @type {boolean|undefined} + * The options required to create a `ngeox.datasource.DataSource`. + * @record + * @struct */ -ngeox.PopupOptions.prototype.autoDestroy; +ngeox.datasource.DataSourceOptions = function() {}; /** - * Extra class name to add to the popup. - * @type {string|undefined} + * The attributes of the data source. + * @type {Array.|undefined} */ -ngeox.PopupOptions.prototype.cls; +ngeox.datasource.DataSourceOptions.prototype.attributes; /** - * The content of the popup. Either the content or URL must be set. - * @type {*|undefined} + * (Required) The data source id. + * @type {number} */ -ngeox.PopupOptions.prototype.content; +ngeox.datasource.DataSourceOptions.prototype.id; /** - * The height of the popup. + * The name of an attribute among the attributes of the data source. + * The value of that attribute, in records, can be used to identify + * each record individually. * @type {string|undefined} */ -ngeox.PopupOptions.prototype.height; +ngeox.datasource.DataSourceOptions.prototype.identifierAttribute; /** - * The title of the popup. - * @type {string|undefined} + * A data source is considered 'in range' when it is synchronized to + * a map view and the resolution of that view is within the range of + * the `maxResolution` and `minResolution`. These 2 properties are + * required for the `inRange` property to be dynamic, otherwise its + * value is always `true` by default. + * + * The synchronization is made in the `ngeo.datasource.syncDataSourcesMap` + * service. + * + * @type {boolean|undefined} */ -ngeox.PopupOptions.prototype.title; +ngeox.datasource.DataSourceOptions.prototype.inRange; /** - * The URL to use for the iframe to include as content for the popup. - * @type {string|undefined} + * Maximum resolution where the data source can be displayed or queried. + * @type {number|undefined} */ -ngeox.PopupOptions.prototype.url; +ngeox.datasource.DataSourceOptions.prototype.maxResolution; /** - * The width of the popup. - * @type {string|undefined} + * Minimum resolution where the data source can be displayed or queried. + * @type {number|undefined} */ -ngeox.PopupOptions.prototype.width; +ngeox.datasource.DataSourceOptions.prototype.minResolution; /** - * Results of the query source. - * @typedef {{ - * sources: (!Array.), - * total: (number), - * pending: (boolean) - * }} + * (Required) A human-readable name for the data source. + * @type {string} */ -ngeox.QueryResult; +ngeox.datasource.DataSourceOptions.prototype.name; /** - * Results for each query source. - * @type {!Array.} + * Whether the data source is visible or not, i.e. whether its is ON or OFF. + * Defaults to `false`. + * @type {boolean|undefined} */ -ngeox.QueryResult.prototype.sources; +ngeox.datasource.DataSourceOptions.prototype.visible; /** - * The number of results for all sources. - * @type {number} + * The options required to create a `ngeox.datasource.OGC`. + * @record + * @struct + * @extends ngeox.datasource.DataSourceOptions */ -ngeox.QueryResult.prototype.total; +ngeox.datasource.OGCOptions = function() {}; /** - * If at least one source is pending. - * @type {boolean} + * The dimensions that are currently active on the data source. + * @type {ngeox.Dimensions|undefined} */ -ngeox.QueryResult.prototype.pending; +ngeox.datasource.OGCOptions.prototype.activeDimensions; /** - * Results for a query source. - * @typedef {{ - * features: (Array.), - * id: (number|string), - * label: (string), - * limit: (number), - * pending: (boolean), - * queried: (boolean), - * tooManyResults: (boolean), - * totalFeatureCount: (number|undefined) - * }} + * Whether the geometry from this data source can be copied to other data + * sources or not. Defaults to `false`. + * @type {boolean|undefined} */ -ngeox.QueryResultSource; +ngeox.datasource.OGCOptions.prototype.copyable; /** - * The matching features for this source. - * @type {Array.} + * A reference to the dimensions. + * @type {ngeox.Dimensions|undefined} */ -ngeox.QueryResultSource.prototype.features; +ngeox.datasource.OGCOptions.prototype.dimensions; /** - * Identifier. - * @type {number|string} + * The dimensions configuration, which determines those supported by this data + * source and whether they should use a static value or the one defined in the + * dimensions. + * @type {ngeox.Dimensions|undefined} */ -ngeox.QueryResultSource.prototype.id; +ngeox.datasource.OGCOptions.prototype.dimensionsConfig; /** - * Label. - * @type {string} + * The filter condition to apply to the filter rules (if any). Defaults to + * `ngeo.FilterCondition.AND`. + * @type {string|undefined} */ -ngeox.QueryResultSource.prototype.label; +ngeox.datasource.OGCOptions.prototype.filterCondition; /** - * The maximum number of features that can be returned for a query with this - * source. - * @type {number} + * A list of filter rules to apply to this data source using the filter + * condition. + * @type {!Array.|undefined} */ -ngeox.QueryResultSource.prototype.limit; +ngeox.datasource.OGCOptions.prototype.filterRules; /** - * Is the request for this source still ongoing? - * @type {boolean} + * Whether the data source is filtrable or not. + * @type {boolean|undefined} */ -ngeox.QueryResultSource.prototype.pending; +ngeox.datasource.OGCOptions.prototype.filtrable; /** - * Has this source been queried for the last query request? - * @type {boolean} + * The name of the geometry attribute. + * @type {string|undefined} */ -ngeox.QueryResultSource.prototype.queried; +ngeox.datasource.OGCOptions.prototype.geometryName; /** - * If the last query for this source would return more features than the - * configured limit. - * @type {boolean} + * The type of images to fetch by queries by the (WMS) or (WMTS) . + * @type {string|undefined} */ -ngeox.QueryResultSource.prototype.tooManyResults; +ngeox.datasource.OGCOptions.prototype.ogcImageType; /** - * If `tooManyResults` is `true`, this contains the total number of features. - * @type {number|undefined} + * A list of layer definitions that are used by (WMS) and (WFS) queries. + * These are **not** used by the (WMTS) queries (the wmtsLayers is used + * by WMTS queries). + * @type {Array.|undefined} */ -ngeox.QueryResultSource.prototype.totalFeatureCount; +ngeox.datasource.OGCOptions.prototype.ogcLayers; /** - * The options for the query service. - * @typedef {{ - * limit: (number|undefined), - * queryCountFirst: (boolean|undefined), - * sourceIdsProperty: (string|undefined), - * tolerance: (number|undefined), - * featureNS: (string|undefined), - * featurePrefix: (string|undefined), - * geometryName: (string|undefined) - * }} + * The type of OGC server. + * @type {string|undefined} */ -ngeox.QueryOptions; +ngeox.datasource.OGCOptions.prototype.ogcServerType; /** - * The maximum number of records per request the query service should ask. - * Defaults to `50`. Note that sources sharing the same URL are combined - * together in a single request. This limit will still apply to those. - * @type {number|undefined} + * The type data source. Can be: 'WMS' or 'WMTS'. + * @type {string|undefined} */ -ngeox.QueryOptions.prototype.limit; +ngeox.datasource.OGCOptions.prototype.ogcType; /** - * For WFS sources, should the number of features first be requested with - * `resultType=hits` before requesting the actual features in an seconds request? - * Defaults to `false`. + * Whether the geometry from this data source can be used to snap the geometry + * of features from other data sources that are being edited. Defaults to + * `false`. * @type {boolean|undefined} */ -ngeox.QueryOptions.prototype.queryCountFirst; +ngeox.datasource.OGCOptions.prototype.snappable; /** - * Defines the name of the layer property that holds the ids of the sources. - * Use this if you have more than one source bound to a layer. Defaults to - * `querySourceIds`. - * @type {string|undefined} + * Determines whether external features can be snapped to the edges of + * features from this data source or not. Defaults to `true`. Requires + * `snappable` to be set. + * @type {boolean|undefined} */ -ngeox.QueryOptions.prototype.sourceIdsProperty; +ngeox.datasource.OGCOptions.prototype.snappingToEdges; /** - * When issuing an identify feature request at a click position, either a WMS GetFeatureInfo - * or a WFS GetFeature request will be used. For GetFeature requests a bbox is built - * around the position. This `tolerance` in pixel determines the size of the bbox. - * The default is `3` pixel. - * @type {number|undefined} + * Determines whether external features can be snapped to the vertice of + * features from this data source or not. Defaults to `true`. Requires + * `snappable` to be set. + * @type {boolean|undefined} */ -ngeox.QueryOptions.prototype.tolerance; +ngeox.datasource.OGCOptions.prototype.snappingToVertice; /** - * The feature namespace for WFS GetFeature requests. The default is - * `http://mapserver.gis.umn.edu/mapserver`. - * @type {string|undefined} + * The tolerance in pixels the snapping should occur. Defaults to `10`. + * @type {number|undefined} */ -ngeox.QueryOptions.prototype.featureNS; +ngeox.datasource.OGCOptions.prototype.snappingTolerance; /** - * The feature prefix for WFS GetFeature requests. The default is `feature`. + * The name of the time attribute. * @type {string|undefined} */ -ngeox.QueryOptions.prototype.featurePrefix; +ngeox.datasource.OGCOptions.prototype.timeAttributeName; /** - * The name of the geometry property for WFS GetFeature requests. The default is `geom`. - * @type {string|undefined} + * The time lower value, which can be combined with the time upper value + * to determine a range. + * @type {number|undefined} */ -ngeox.QueryOptions.prototype.geometryName; +ngeox.datasource.OGCOptions.prototype.timeLowerValue; /** - * The configuration of a source for the Query service. - * @typedef {{ - * format: (!ol.format.Feature|undefined), - * id: (number|string), - * identifierAttributeField: (string|undefined), - * infoFormat: (string|undefined), - * label: (string|undefined), - * layer: (!ol.layer.Base|undefined), - * layers: (!Array.|undefined), - * getLayers: (function(number): !Array.|undefined), - * serverType: (string|undefined), - * url: (string|undefined), - * validateLayerParams: (boolean|undefined), - * wmsSource: (!ol.source.ImageWMS|!ol.source.TileWMS|undefined), - * wfsQuery: (boolean|undefined) - * }} + * The time property for the data source. Used to apply time filters. + * @type {ngeox.TimeProperty|undefined} */ -ngeox.QuerySource; +ngeox.datasource.OGCOptions.prototype.timeProperty; /** - * The used to read the returned features from query requests for this source. - * @type {!ol.format.Feature|undefined} + * The time upper value, which can be combined with the time lower value + * to determine a range. + * @type {number|undefined} */ -ngeox.QuerySource.prototype.format; +ngeox.datasource.OGCOptions.prototype.timeUpperValue; /** - * The unique identifier of the source. - * @type {number|string} + * The feature namespace to use with WFS requests. + * @type {string|undefined} */ -ngeox.QuerySource.prototype.id; +ngeox.datasource.OGCOptions.prototype.wfsFeatureNS; /** - * The key that identify the title attribute in features. + * The feature prefix to use with WFS requests. * @type {string|undefined} */ -ngeox.QuerySource.prototype.identifierAttributeField; +ngeox.datasource.OGCOptions.prototype.wfsFeaturePrefix; /** - * The info format to request and read the returned features. Optional. - * Default value is `geojson`. Possible values are: `geojson`, `gml`. + * The OutputFormat to use with WFS requests. * @type {string|undefined} */ -ngeox.QuerySource.prototype.infoFormat; +ngeox.datasource.OGCOptions.prototype.wfsOutputFormat; /** - * The human-readable name of the source. If not set, the `name` property - * is used instead. + * The url to use for (WFS) requests. * @type {string|undefined} */ -ngeox.QuerySource.prototype.label; +ngeox.datasource.OGCOptions.prototype.wfsUrl; /** - * A reference to the ol3 layer object. If not defined, will be automatically - * fetched using the source `name` and the according layer property that has - * the same value. - * @type {!ol.layer.Base|undefined} + * The InfoFormat to use with WMS requests. + * @type {string|undefined} */ -ngeox.QuerySource.prototype.layer; +ngeox.datasource.OGCOptions.prototype.wmsInfoFormat; /** - * A reference to the ol3 layers names. Multiple layers names. - * @type {!Array.|undefined} + * Whether the (WMS) images returned by this data source should be single tiles + * or not. Defaults to `false`. + * @type {boolean|undefined} */ -ngeox.QuerySource.prototype.layers; +ngeox.datasource.OGCOptions.prototype.wmsIsSingleTile; /** - * Additionnal params to use when querying this source. - * @type {function(number): !Array.|undefined} + * The url to use for (WMS) requests. + * @type {string|undefined} */ -ngeox.QuerySource.prototype.getLayers; +ngeox.datasource.OGCOptions.prototype.wmsUrl; /** - * Server type of the source. Can be `mapserver` or `geoserver`. + * The layer name to use for the (WMTS) requests. * @type {string|undefined} */ -ngeox.QuerySource.prototype.serverType; +ngeox.datasource.OGCOptions.prototype.wmtsLayer; /** - * URL to use for the request. Required if the layer object doesn't support - * WMS GetFeatureInfo requests. + * The url to use for (WMTS) requests. * @type {string|undefined} */ -ngeox.QuerySource.prototype.url; +ngeox.datasource.OGCOptions.prototype.wmtsUrl; /** - * Whether to validate the LAYERS params of the layer currently being - * queried. Useful if the source configuration was not given a direct - * reference to the ol3 WMS source object, i.e. it was given an `url` and - * `params` properties instead, which resulted in the creation of an - * inner `ol.source.ImageWMS` object. If that source configuration is attached - * to a layer that also has an ol3 WMS source object, then the latter may - * contain more than one layer name within the LAYERS param. In that case, - * this `validateLayerParams` property, when enabled, will make the query - * service check if the layer name(s) within its LAYERS params is currently - * inside the layer source LAYERS params. If it's not there, then the source - * should not be queried. - * - * When setting this option, you must not set the wmsSource or layer if - * it has an inner ol3 wms source object. - * @type {boolean|undefined} + * @interface + * @struct */ -ngeox.QuerySource.prototype.validateLayerParams; - +ngeox.datasource.DataSource = function() {}; /** - * The ol3 WMS source object used to build the query string. If not defined, - * the layer source object will be used (if it's WMS), otherwise one will - * be created by the query service using the `url` and `params` properties of - * this source. - * @type {!ol.source.ImageWMS|!ol.source.TileWMS|undefined} + * @type {boolean} */ -ngeox.QuerySource.prototype.wmsSource; +ngeox.datasource.DataSource.prototype.queryable; +/** + * @interface + * @struct + * @extends ngeox.datasource.DataSource + */ +ngeox.datasource.OGC = function() {}; /** - * If this source supports WFS requests. - * @type {boolean|undefined} + * @type {!ngeox.DimensionsActive} */ -ngeox.QuerySource.prototype.wfsQuery; +ngeox.datasource.OGC.prototype.activeDimensions; +/** + * @type {boolean} + */ +ngeox.datasource.OGC.prototype.combinableForWMS; /** - * A WFS type. To be used with {@link ngeox.WfsPermalinkOptions}. - * @typedef {{ - * featureType: (string), - * label: (string|undefined), - * featureNS: (string|undefined), - * featurePrefix: (string|undefined) - * }} + * @type {boolean} */ -ngeox.WfsType; +ngeox.datasource.OGC.prototype.combinableForWFS; +/** + * @type {boolean} + */ +ngeox.datasource.OGC.prototype.supportsWFS; /** - * The feature type name. Required. - * @type {string} + * @type {boolean} */ -ngeox.WfsType.prototype.featureType; +ngeox.datasource.OGC.prototype.supportsWMS; +/** + * @type {string|undefined} + */ +ngeox.datasource.OGC.prototype.wmsUrl; /** - * The field of a feature used as label. * @type {string|undefined} */ -ngeox.WfsType.prototype.label; +ngeox.datasource.OGC.prototype.wfsUrl; + +/** + * @type {string} + */ +ngeox.datasource.OGC.prototype.filterCondition; +/** + * @type {?Array.} + */ +ngeox.datasource.OGC.prototype.filterRules; /** - * The namespace URI used for features. If not given, the default namespace set - * in {@link ngeox.WfsPermalinkOptions} will be used. - * @type {string|undefined} + * @param {ngeox.datasource.OGC} dataSource Data source. + * @return {boolean} Whether this data source can be combined to the given + * other data source to fetch features in a single WFS request. */ -ngeox.WfsType.prototype.featureNS; +ngeox.datasource.OGC.prototype.combinableWithDataSourceForWFS = function(dataSource) {}; /** - * The prefix for the feature namespace. If not given, the default prefix set - * in {@link ngeox.WfsPermalinkOptions} will be used. - * @type {string|undefined} + * @param {ngeox.datasource.OGC} dataSource Data source. + * @return {boolean} Whether this data source can be combined to the given + * other data source to fetch features in a single WMS request. */ -ngeox.WfsType.prototype.featurePrefix; +ngeox.datasource.OGC.prototype.combinableWithDataSourceForWMS = function(dataSource) {}; /** - * The options for the WFS query service (permalink). - * @typedef {{ - * url: (string), - * wfsTypes: (!Array.), - * pointRecenterZoom: (number|undefined), - * defaultFeatureNS: (string), - * defaultFeaturePrefix: (string), - * maxFeatures: (number|undefined) - * }} + * @param {!ngeox.datasource.OGC} dataSource Remote data source to compare with + * this one. + * @return {boolean} Whether the two data sources have the same active + * dimensions. If both have no dimensions, they are considered to be + * sharing the same dimensions. */ -ngeox.WfsPermalinkOptions; +ngeox.datasource.OGC.prototype.haveTheSameActiveDimensions = function(dataSource) {}; /** - * URL to the WFS server. - * @type {string} + * The definition of a single layer (WMS) and/or featureType (WFS). + * @record + * @struct */ -ngeox.WfsPermalinkOptions.prototype.url; +ngeox.datasource.OGCLayer = function() {}; /** - * The queryable WFS types. - * @type {!Array.} + * The maximum resolution the layer should be rendered (when visible). + * @type {number|undefined} */ -ngeox.WfsPermalinkOptions.prototype.wfsTypes; +ngeox.datasource.OGCLayer.prototype.maxResolution; /** - * Zoom level to use when result is a single point feature. If not set the map - * is not zoomed to a specific zoom level. + * The minimum resolution the layer should be rendered (when visible). * @type {number|undefined} */ -ngeox.WfsPermalinkOptions.prototype.pointRecenterZoom; +ngeox.datasource.OGCLayer.prototype.minResolution; /** - * The default namespace URI used for features. This will be used if no custom - * namespace is given for a WFS type. + * The layer name (WMS) and/or feature type name (WFS) * @type {string} */ -ngeox.WfsType.prototype.defaultFeatureNS; +ngeox.datasource.OGCLayer.prototype.name; /** - * The default prefix for the feature namespace. This will be used if no custom - * prefix is given for a WFS type. - * @type {string} + * Whether the the layer is queryable or not. Defaults to `false`. + * @type {boolean|undefined} */ -ngeox.WfsType.prototype.defaultFeaturePrefix; +ngeox.datasource.OGCLayer.prototype.queryable; /** - * The maximum number of records per request the query service should ask. - * Defaults to `50`. - * @type {number|undefined} + * Namespace. + * @type {Object} */ -ngeox.WfsPermalinkOptions.prototype.maxFeatures; +ngeox.interaction; /** diff --git a/src/datasource/datasource.js b/src/datasource/datasource.js new file mode 100644 index 00000000000..d6a16fcb7fc --- /dev/null +++ b/src/datasource/datasource.js @@ -0,0 +1,224 @@ +goog.provide('ngeo.datasource.DataSource'); + +goog.require('ngeo'); + + +/** + * @implements {ngeox.datasource.DataSource} + */ +ngeo.datasource.DataSource = class { + + /** + * A `ngeo.datasource.DataSource` represents a single source of data, which + * can combine different type of servers to display or fetch the data. It can + * serve as a point of entry to get all the information about a single data + * source. + * + * You can use the information in a data source to do all sorts of things: + * - create `ol.layer.Layer` objects using the WMS, WMTS or even WFS + * information + * - issue WMS/WFS queries + * - know whether the data is visible or not + * - apply filter rules on it + * + * @struct + * @param {ngeox.datasource.DataSourceOptions} options Options. + */ + constructor(options) { + + // === DYNAMIC properties (i.e. that can change / be watched === + + /** + * A data source is considered 'in range' when it is synchronized to + * a map view and the resolution of that view is within the range of + * the `maxResolution` and `minResolution`. These 2 properties are + * required for the `inRange` property to be dynamic, otherwise its + * value is always `true` by default. + * + * The synchronization is made in the `ngeo.datasource.SyncDataSourcesMap` + * service. + * + * @type {boolean} + * @private + */ + this.inRange_ = options.inRange !== false; + + /** + * Whether the data source is visible or not, i.e. whether its is ON or OFF. + * Defaults to `false`. + * @type {boolean} + * @private + */ + this.visible_ = options.visible === true; + + + // === STATIC properties (i.e. that never change) === + + /** + * The attributes of the data source. + * + * Note: `attributes` is not using the conventionnal getter/setter due + * to: See: https://github.com/google/closure-compiler/issues/1089 + * + * @type {?Array.} + * @export + */ + this.attributes = options.attributes || null; + + /** + * (Required) The data source id. + * @type {number} + * @private + */ + this.id_ = options.id; + + /** + * The name of an attribute among the attributes of the data source. + * The value of that attribute, in records, can be used to identify + * each record individually. + * @type {string|undefined} + * @private + */ + this.identifierAttribute_ = options.identifierAttribute; + + /** + * Maximum resolution where the data source can be displayed or queried. + * @type {number|undefined} + * @private + */ + this.maxResolution_ = options.maxResolution; + + /** + * Minimum resolution where the data source can be displayed or queried. + * @type {number|undefined} + * @private + */ + this.minResolution_ = options.minResolution; + + /** + * (Required) A human-readable name for the data source. + * @type {string} + * @private + */ + this.name_ = options.name; + } + + // ======================================== + // === Dynamic property getters/setters === + // ======================================== + + /** + * @return {boolean} In range + * @export + */ + get inRange() { + return this.inRange_; + } + + /** + * @param {boolean} inRange In range + * @export + */ + set inRange(inRange) { + this.inRange_ = inRange; + } + + /** + * @return {boolean} Visible + * @export + */ + get visible() { + return this.visible_; + } + + /** + * @param {boolean} visible Visible + * @export + */ + set visible(visible) { + this.visible_ = visible; + } + + // ======================================= + // === Static property getters/setters === + // ======================================= + + /** + * @return {?Array.} Attributes + * @export + */ + getAttributes() { + return this.attributes; + } + + /** + * @param {?Array.} attributes Attributes + * @export + */ + setAttributes(attributes) { + this.attributes = attributes; + } + + /** + * @return {number} Id + * @export + */ + get id() { + return this.id_; + } + + /** + * @return {string|undefined} Identifier attribute + * @export + */ + get identifierAttribute() { + return this.identifierAttribute_; + } + + /** + * @return {number|undefined} Maximum resolution + * @export + */ + get maxResolution() { + return this.maxResolution_; + } + + /** + * @return {number|undefined} Minimum resolution + * @export + */ + get minResolution() { + return this.minResolution_; + } + + /** + * @return {string} Name + * @export + */ + get name() { + return this.name_; + } + + + // =================================== + // === Calculated property getters === + // =================================== + + /** + * Whether the data source is queryable or not. + * @return {boolean} Whether the data source is queryable or not. + * @export + */ + get queryable() { + return false; + } + + /** + * @return {boolean} Whether the data source supports a dynamic `inRange` + * property or not, i.e. whether it can be calculated. + * @export + */ + get supportsDynamicInRange() { + return this.maxResolution !== null || this.minResolution !== null; + } +}; diff --git a/src/datasource/datasources.js b/src/datasource/datasources.js new file mode 100644 index 00000000000..d98ec5cd4ce --- /dev/null +++ b/src/datasource/datasources.js @@ -0,0 +1,13 @@ +goog.provide('ngeo.datasource.DataSources'); + +goog.require('ngeo'); +goog.require('ol.Collection'); + + +ngeo.module.value('ngeoDataSources', new ol.Collection()); + + +/** + * @typedef {!ol.Collection.} + */ +ngeo.datasource.DataSources; diff --git a/src/services/datasourceshelper.js b/src/datasource/datasourceshelper.js similarity index 81% rename from src/services/datasourceshelper.js rename to src/datasource/datasourceshelper.js index 24f84d30fcb..fde22ccfd2f 100644 --- a/src/services/datasourceshelper.js +++ b/src/datasource/datasourceshelper.js @@ -1,22 +1,23 @@ -goog.provide('ngeo.DataSourcesHelper'); +goog.provide('ngeo.datasource.DataSourcesHelper'); goog.require('ngeo'); -goog.require('ngeo.DataSource'); -goog.require('ngeo.DataSources'); +goog.require('ngeo.datasource.DataSource'); +goog.require('ngeo.datasource.DataSources'); goog.require('ngeo.Querent'); goog.require('ngeo.format.WFSAttribute'); goog.require('ol.events'); goog.require('ol.CollectionEventType'); -ngeo.DataSourcesHelper = class { +ngeo.datasource.DataSourcesHelper = class { /** * A service that provides utility methods to manipulate or get data sources. * * @struct * @param {angular.$q} $q The Angular $q service. - * @param {ngeo.DataSources} ngeoDataSources Ngeo data source collection. + * @param {ngeo.datasource.DataSources} ngeoDataSources Ngeo data source + * collection. * @param {ngeo.Querent} ngeoQuerent Ngeo querent service. * @ngdoc service * @ngname ngeoDataSourcesHelper @@ -33,7 +34,7 @@ ngeo.DataSourcesHelper = class { this.q_ = $q; /** - * @type {ngeo.DataSources} + * @type {ngeo.datasource.DataSources} * @private */ this.collection_ = ngeoDataSources; @@ -48,7 +49,7 @@ ngeo.DataSourcesHelper = class { // === Other properties === /** - * @type {Object.} + * @type {Object.} * @private */ this.cache_ = {}; @@ -70,7 +71,7 @@ ngeo.DataSourcesHelper = class { } /** - * @return {ngeo.DataSources} Data sources collection. + * @return {ngeo.datasource.DataSources} Data sources collection. * @export */ get collection() { @@ -80,7 +81,7 @@ ngeo.DataSourcesHelper = class { /** * Return a data source using its id. * @param {number} id Data source id. - * @return {?ngeo.DataSource} Data source. + * @return {?ngeo.datasource.DataSource} Data source. * @export */ getDataSource(id) { @@ -95,7 +96,7 @@ ngeo.DataSourcesHelper = class { * Please, note that in order to be dynamically set, the data source must * only have 1 ogcLayer set and be queryable. * - * @param {ngeo.DataSource} dataSource Filtrable data source. + * @param {ngeo.datasource.OGC} dataSource Filtrable data source. * @return {angular.$q.Promise} Promise. * @export */ @@ -123,7 +124,7 @@ ngeo.DataSourcesHelper = class { const attributes = new ngeo.format.WFSAttribute().read(complexContent); // Set the attributes in the data source - dataSource.attributes = attributes; + dataSource.setAttributes(attributes); wfsDescribeFeatureTypeDefer.resolve(attributes); }); @@ -140,7 +141,7 @@ ngeo.DataSourcesHelper = class { */ handleDataSourcesAdd_(evt) { const dataSource = goog.asserts.assertInstanceof( - evt.element, ngeo.DataSource); + evt.element, ngeo.datasource.DataSource); this.cache_[dataSource.id] = dataSource; } @@ -152,11 +153,11 @@ ngeo.DataSourcesHelper = class { */ handleDataSourcesRemove_(evt) { const dataSource = goog.asserts.assertInstanceof( - evt.element, ngeo.DataSource); + evt.element, ngeo.datasource.DataSource); delete this.cache_[dataSource.id]; } }; -ngeo.module.service('ngeoDataSourcesHelper', ngeo.DataSourcesHelper); +ngeo.module.service('ngeoDataSourcesHelper', ngeo.datasource.DataSourcesHelper); diff --git a/src/datasource.js b/src/datasource/ogc.js similarity index 79% rename from src/datasource.js rename to src/datasource/ogc.js index b8ccc118b37..ad9ad5d3b10 100644 --- a/src/datasource.js +++ b/src/datasource/ogc.js @@ -1,7 +1,8 @@ -goog.provide('ngeo.DataSource'); +goog.provide('ngeo.datasource.OGC'); -goog.require('ngeo'); goog.require('goog.asserts'); +goog.require('ngeo.datasource.DataSource'); +goog.require('ngeo.datasource.OGC'); goog.require('ol.format.GML2'); goog.require('ol.format.GML3'); goog.require('ol.format.WFS'); @@ -9,28 +10,29 @@ goog.require('ol.format.WMSGetFeatureInfo'); /** - * @implements {ngeox.DataSource} + * @implements {ngeox.datasource.OGC} */ -ngeo.DataSource = class { +ngeo.datasource.OGC = class extends ngeo.datasource.DataSource { /** - * A `ngeo.DataSource` represents a single source of data, which can combine - * different type of servers to display or fetch the data. It can serve - * as a point of entry to get all the information about a single data - * source. + * A data source contain information of a single source of data that can + * show or fetch the data using an OGC server. Serveral OGC service types are + * supported by this data source: WMS, WMTS and even WFS. * - * You can use the information in a data source to do all sorts of things: - * - create `ol.layer.Layer` objects using the WMS, WMTS or even WFS - * information - * - issue WMS/WFS queries - * - know whether the data is visible or not - * - apply filter rules on it + * You can use the information stored within an OGC data source to do allo + * sorts of things: + * - issue WMS/WFS queries + * - apply filter rules on it + * - create `ol.layer.Layer` objects using the WMS, WMTS or event WFS + * information * * @struct - * @param {ngeox.DataSourceOptions} options Options. + * @param {ngeox.datasource.OGCOptions} options Options. */ constructor(options) { + super(options); + // === DYNAMIC properties (i.e. that can change / be watched === /** @@ -65,38 +67,9 @@ ngeo.DataSource = class { */ this.filtrable_ = options.filtrable || null; - /** - * A data source is considered 'in range' when it is synchronized to - * a map view and the resolution of that view is within the range of - * the `maxResolution` and `minResolution`. These 2 properties are - * required for the `inRange` property to be dynamic, otherwise its - * value is always `true` by default. - * - * The synchronization is made in the `ngeo.syncDataSourcesMap` service. - * - * @type {boolean} - * @private - */ - this.inRange_ = options.inRange !== false; - - /** - * Whether the data source is visible or not, i.e. whether its is ON or OFF. - * Defaults to `false`. - * @type {boolean} - * @private - */ - this.visible_ = options.visible === true; - // === STATIC properties (i.e. that never change) === - /** - * The attributes of the data source. - * @type {?Array.} - * @private - */ - this.attributes_ = options.attributes || null; - /** * Whether the geometry from this data source can be copied to other data * sources or not. Defaults to `false`. @@ -118,44 +91,7 @@ ngeo.DataSource = class { * @private */ this.geometryName_ = options.geometryName || - ngeo.DataSource.DEFAULT_GEOMETRY_NAME_; - - /** - * (Required) The data source id. - * @type {number} - * @private - */ - this.id_ = options.id; - - /** - * The name of an attribute among the attributes of the data source. - * The value of that attribute, in records, can be used to identify - * each record individually. - * @type {string|undefined} - * @private - */ - this.identifierAttribute_ = options.identifierAttribute; - - /** - * Maximum resolution where the data source can be displayed or queried. - * @type {number|undefined} - * @private - */ - this.maxResolution_ = options.maxResolution; - - /** - * Minimum resolution where the data source can be displayed or queried. - * @type {number|undefined} - * @private - */ - this.minResolution_ = options.minResolution; - - /** - * (Required) A human-readable name for the data source. - * @type {string} - * @private - */ - this.name_ = options.name; + ngeo.datasource.OGC.DEFAULT_GEOMETRY_NAME_; /** * The type of images to fetch by queries by the (WMS) or (WMTS) . @@ -168,7 +104,7 @@ ngeo.DataSource = class { * A list of layer definitions that are used by (WMS) and (WFS) queries. * These are **not** used by the (WMTS) queries (the wmtsLayers is used * by WMTS queries). - * @type {?Array.} + * @type {?Array.} * @private */ this.ogcLayers_ = options.ogcLayers || null; @@ -179,14 +115,14 @@ ngeo.DataSource = class { * @private */ this.ogcServerType_ = options.ogcServerType || - ngeo.DataSource.OGCServerType.MAPSERVER; + ngeo.datasource.OGC.ServerType.MAPSERVER; /** * The type data source. Can be: 'WMS' or 'WMTS'. * @type {string} * @private */ - this.ogcType_ = options.ogcType || ngeo.DataSource.OGCType.WMS; + this.ogcType_ = options.ogcType || ngeo.datasource.OGC.Type.WMS; /** * Whether the geometry from this data source can be used to snap the @@ -254,7 +190,8 @@ ngeo.DataSource = class { * @type {string} * @private */ - this.wfsFeatureNS_ = options.wfsFeatureNS || ngeo.DataSource.WFSFeatureNS[this.ogcServerType_]; + this.wfsFeatureNS_ = options.wfsFeatureNS || + ngeo.datasource.OGC.WFSFeatureNS[this.ogcServerType_]; /** * The feature prefix to use with WFS requests. @@ -262,7 +199,7 @@ ngeo.DataSource = class { * @private */ this.wfsFeaturePrefix_ = options.wfsFeaturePrefix || - ngeo.DataSource.WFSFeaturePrefix.FEATURE; + ngeo.datasource.OGC.WFSFeaturePrefix.FEATURE; /** * The OutputFormat to use with WFS requests. @@ -270,7 +207,7 @@ ngeo.DataSource = class { * @private */ this.wfsOutputFormat_ = options.wfsOutputFormat || - ngeo.DataSource.WFSOutputFormat.GML3; + ngeo.datasource.OGC.WFSOutputFormat.GML3; /** * The url to use for (WFS) requests. @@ -285,7 +222,7 @@ ngeo.DataSource = class { * @private */ this.wmsInfoFormat_ = options.wmsInfoFormat || - ngeo.DataSource.WMSInfoFormat.GML; + ngeo.datasource.OGC.WMSInfoFormat.GML; /** * Whether the (WMS) images returned by this data source @@ -316,6 +253,7 @@ ngeo.DataSource = class { */ this.wmtsUrl_ = options.wmtsUrl; + // === Calculated properties === // Get queryable ogc layer names @@ -331,9 +269,9 @@ ngeo.DataSource = class { let wfsFormat = null; if (this.supportsWFS && layers.length) { let format = undefined; - if (this.wfsOutputFormat_ === ngeo.DataSource.WFSOutputFormat.GML3) { + if (this.wfsOutputFormat_ === ngeo.datasource.OGC.WFSOutputFormat.GML3) { format = new ol.format.GML3(); - } else if (this.wfsOutputFormat_ === ngeo.DataSource.WFSOutputFormat.GML2) { + } else if (this.wfsOutputFormat_ === ngeo.datasource.OGC.WFSOutputFormat.GML2) { format = new ol.format.GML2(); } goog.asserts.assert(format); @@ -352,7 +290,7 @@ ngeo.DataSource = class { let wmsFormat = null; if (this.supportsWMS && layers.length) { - if (this.wmsInfoFormat === ngeo.DataSource.WMSInfoFormat.GML) { + if (this.wmsInfoFormat === ngeo.datasource.OGC.WMSInfoFormat.GML) { wmsFormat = new ol.format.WMSGetFeatureInfo({ layers }); @@ -365,7 +303,6 @@ ngeo.DataSource = class { * @private */ this.wmsFormat_ = wmsFormat; - } // ======================================== @@ -420,22 +357,6 @@ ngeo.DataSource = class { this.filterRules_ = filterRules; } - /** - * @return {boolean} In range - * @export - */ - get inRange() { - return this.inRange_; - } - - /** - * @param {boolean} inRange In range - * @export - */ - set inRange(inRange) { - this.inRange_ = inRange; - } - /** * @return {number|undefined} Time lower value * @export @@ -499,40 +420,22 @@ ngeo.DataSource = class { this.timeUpperValue_ = time; } - /** - * @return {boolean} Visible - * @export - */ - get visible() { - return this.visible_; - } - - /** - * @param {boolean} visible Visible - * @export - */ - set visible(visible) { - this.visible_ = visible; - } - // ======================================= // === Static property getters/setters === // ======================================= /** - * @return {?Array.} Attributes - * @export + * @inheritDoc */ - get attributes() { - return this.attributes_; + getAttributes() { + return super.attributes; } /** - * @param {?Array.} attributes Attributes - * @export + * @inheritDoc */ - set attributes(attributes) { - this.attributes_ = attributes; + setAttributes(attributes) { + super.setAttributes(attributes); this.updateGeometryNameFromAttributes_(); } @@ -568,46 +471,6 @@ ngeo.DataSource = class { return this.geometryName_; } - /** - * @return {number} Id - * @export - */ - get id() { - return this.id_; - } - - /** - * @return {string|undefined} Identifier attribute - * @export - */ - get identifierAttribute() { - return this.identifierAttribute_; - } - - /** - * @return {number|undefined} Maximum resolution - * @export - */ - get maxResolution() { - return this.maxResolution_; - } - - /** - * @return {number|undefined} Minimum resolution - * @export - */ - get minResolution() { - return this.minResolution_; - } - - /** - * @return {string} Name - * @export - */ - get name() { - return this.name_; - } - /** * @return {string} OGC image type * @export @@ -617,7 +480,7 @@ ngeo.DataSource = class { } /** - * @return {?Array.} OGC layers + * @return {?Array.} OGC layers * @export */ get ogcLayers() { @@ -823,9 +686,9 @@ ngeo.DataSource = class { } /** - * Whether the data source is queryable or not. To be queryable, it requires - * the support of WFS or WMS and at least one ogc layer to be querable. - * @return {boolean} Whether the data source is queryable or not. + * Whether the data source is queryable or not. For an OGC data source to be + * queryable, it requires the support of WFS or WMS and at least one ogc + * layer to be querable. * @export */ get queryable() { @@ -842,15 +705,6 @@ ngeo.DataSource = class { return queryable; } - /** - * @return {boolean} Whether the data source supports a dynamic `inRange` - * property or not, i.e. whether it can be calculated. - * @export - */ - get supportsDynamicInRange() { - return this.maxResolution !== null || this.minResolution !== null; - } - /** * @return {boolean} Whether the data source supports making WFS requests * or not. @@ -922,7 +776,7 @@ ngeo.DataSource = class { // ============================ /** - * @param {ngeox.DataSource} dataSource Data source. + * @param {ngeox.datasource.OGC} dataSource Data source. * @return {boolean} Whether this data source can be combined to the given * other data source to fetch features in a single WFS request. * @export @@ -937,7 +791,7 @@ ngeo.DataSource = class { } /** - * @param {ngeox.DataSource} dataSource Data source. + * @param {ngeox.datasource.OGC} dataSource Data source. * @return {boolean} Whether this data source can be combined to the given * other data source to fetch features in a single WMS request. * @export @@ -1035,7 +889,7 @@ ngeo.DataSource = class { * @private */ updateGeometryNameFromAttributes_() { - let geometryName = ngeo.DataSource.DEFAULT_GEOMETRY_NAME_; + let geometryName = ngeo.datasource.OGC.DEFAULT_GEOMETRY_NAME_; if (this.attributes) { for (const attribute of this.attributes) { @@ -1050,8 +904,8 @@ ngeo.DataSource = class { } /** - * @param {!ngeox.DataSource} dataSource Remote data source to compare with - * this one. + * @param {!ngeox.datasource.OGC} dataSource Remote data source to + * compare with this one. * @return {boolean} Whether the two data sources have the same active * dimensions. If both have no dimensions, they are considered to be * sharing the same dimensions. @@ -1090,14 +944,14 @@ ngeo.DataSource = class { * @type {string} * @private */ -ngeo.DataSource.DEFAULT_GEOMETRY_NAME_ = 'the_geom'; +ngeo.datasource.OGC.DEFAULT_GEOMETRY_NAME_ = 'the_geom'; /** * Available OGC server types. * @enum {string} */ -ngeo.DataSource.OGCServerType = { +ngeo.datasource.OGC.ServerType = { GEOSERVER: 'geoserver', MAPSERVER: 'mapserver', QGISSERVER: 'qgisserver' @@ -1108,7 +962,7 @@ ngeo.DataSource.OGCServerType = { * Available OGC types. * @enum {string} */ -ngeo.DataSource.OGCType = { +ngeo.datasource.OGC.Type = { WMS: 'WMS', WMTS: 'WMTS' }; @@ -1118,7 +972,7 @@ ngeo.DataSource.OGCType = { * Available Feature namespace for WFS requests. * @const {Object.} */ -ngeo.DataSource.WFSFeatureNS = { +ngeo.datasource.OGC.WFSFeatureNS = { 'geoserver': 'http://www.opengis.net/gml/3.2', 'mapserver': 'http://mapserver.gis.umn.edu/mapserver', 'qgisserver': 'http://www.qgis.org/gml' @@ -1129,7 +983,7 @@ ngeo.DataSource.WFSFeatureNS = { * Available Feature namespace for WFS requests. * @enum {string} */ -ngeo.DataSource.WFSFeaturePrefix = { +ngeo.datasource.OGC.WFSFeaturePrefix = { FEATURE: 'feature' }; @@ -1138,7 +992,7 @@ ngeo.DataSource.WFSFeaturePrefix = { * Available OutputFormat for WFS requests. * @enum {string} */ -ngeo.DataSource.WFSOutputFormat = { +ngeo.datasource.OGC.WFSOutputFormat = { GML2: 'GML2', GML3: 'GML3' }; @@ -1148,6 +1002,6 @@ ngeo.DataSource.WFSOutputFormat = { * Available InfoFormat for WMS requests. * @enum {string} */ -ngeo.DataSource.WMSInfoFormat = { +ngeo.datasource.OGC.WMSInfoFormat = { GML: 'application/vnd.ogc.gml' }; diff --git a/src/services/syncDataSourcesMap.js b/src/datasource/syncdatasourcesmap.js similarity index 89% rename from src/services/syncDataSourcesMap.js rename to src/datasource/syncdatasourcesmap.js index 100861533b8..7ae172e8820 100644 --- a/src/services/syncDataSourcesMap.js +++ b/src/datasource/syncdatasourcesmap.js @@ -1,9 +1,9 @@ -goog.provide('ngeo.SyncDataSourcesMap'); +goog.provide('ngeo.datasource.SyncDataSourcesMap'); goog.require('ngeo'); -goog.require('ngeo.DataSource'); +goog.require('ngeo.datasource.DataSource'); /** @suppress {extraRequire} */ -goog.require('ngeo.DataSources'); +goog.require('ngeo.datasource.DataSources'); goog.require('ol.events'); goog.require('ol.CollectionEventType'); goog.require('ol.Object'); @@ -13,7 +13,7 @@ goog.require('ol.ViewProperty'); goog.require('goog.asserts'); -ngeo.SyncDataSourcesMap = class { +ngeo.datasource.SyncDataSourcesMap = class { /** * This service is responsible of the synchronization between the ngeo @@ -26,8 +26,8 @@ ngeo.SyncDataSourcesMap = class { * - inRange: The map view 'change:resolution' event is listened and the * property is updated depending on the current resolution. * - * @param {ngeo.DataSources} ngeoDataSources Ngeo collection of data sources - * objects. + * @param {ngeo.datasource.DataSources} ngeoDataSources Ngeo collection of + * data sources objects. * * @struct * @ngdoc service @@ -37,7 +37,7 @@ ngeo.SyncDataSourcesMap = class { constructor(ngeoDataSources) { /** - * @type {ngeo.DataSources} + * @type {ngeo.datasource.DataSources} * @private */ this.ngeoDataSources_ = ngeoDataSources; @@ -139,7 +139,7 @@ ngeo.SyncDataSourcesMap = class { /** * Synchronize a data source `inRange` property with a given resolution. - * @param {ngeo.DataSource} dataSource Data source + * @param {ngeo.datasource.DataSource} dataSource Data source * @param {number} resolution Resolution * @private */ @@ -172,7 +172,7 @@ ngeo.SyncDataSourcesMap = class { */ handleDataSourcesAdd_(event) { const dataSource = goog.asserts.assertInstanceof( - event.element, ngeo.DataSource); + event.element, ngeo.datasource.DataSource); if (this.map_) { const resolution = this.map_.getView().getResolution(); goog.asserts.assertNumber(resolution); @@ -183,4 +183,5 @@ ngeo.SyncDataSourcesMap = class { }; -ngeo.module.service('ngeoSyncDataSourcesMap', ngeo.SyncDataSourcesMap); +ngeo.module.service( + 'ngeoSyncDataSourcesMap', ngeo.datasource.SyncDataSourcesMap); diff --git a/src/directives/filter.js b/src/directives/filter.js index 5244a944eac..c5d694b63eb 100644 --- a/src/directives/filter.js +++ b/src/directives/filter.js @@ -43,7 +43,7 @@ ngeo.FilterController = class { this.customRules; /** - * @type {!ngeo.DataSource} + * @type {!ngeo.datasource.OGC} * @export */ this.datasource; diff --git a/src/directives/layertree.js b/src/directives/layertree.js index aad759b274a..e07304df93d 100644 --- a/src/directives/layertree.js +++ b/src/directives/layertree.js @@ -261,7 +261,7 @@ ngeo.LayertreeController = function($scope, $rootScope, $attrs, ngeoDecorateLaye } /** - * @type {?ngeo.DataSource} + * @type {?ngeo.datasource.DataSource} * @private */ this.dataSource_ = null; @@ -420,8 +420,8 @@ ngeo.LayertreeController.prototype.getSetActive = function(val) { /** - * @return {?ngeo.DataSource} dataSource The data source bound to this layer - * tree controller. + * @return {?ngeo.datasource.DataSource} dataSource The data source bound to + * this layer tree controller. * @export */ ngeo.LayertreeController.prototype.getDataSource = function() { @@ -430,7 +430,7 @@ ngeo.LayertreeController.prototype.getDataSource = function() { /** - * @param {?ngeo.DataSource} dataSource Data source or null. + * @param {?ngeo.datasource.DataSource} dataSource Data source or null. * @export */ ngeo.LayertreeController.prototype.setDataSource = function(dataSource) { diff --git a/src/directives/map.js b/src/directives/map.js index db73833cd66..731e029217c 100644 --- a/src/directives/map.js +++ b/src/directives/map.js @@ -2,7 +2,7 @@ goog.provide('ngeo.mapDirective'); goog.require('goog.asserts'); goog.require('ngeo'); -goog.require('ngeo.SyncDataSourcesMap'); +goog.require('ngeo.datasource.SyncDataSourcesMap'); goog.require('ol.events'); goog.require('ol.Map'); @@ -31,7 +31,7 @@ goog.require('ol.Map'); * * @htmlAttribute {ol.Map} ngeo-map The map. * @param {angular.$window} $window The Angular $window service. - * @param {ngeo.SyncDataSourcesMap} ngeoSyncDataSourcesMap Ngeo sync + * @param {ngeo.datasource.SyncDataSourcesMap} ngeoSyncDataSourcesMap Ngeo sync * data sources map service. * @return {angular.Directive} Directive Definition Object. * @ngInject diff --git a/src/services/datasources.js b/src/services/datasources.js deleted file mode 100644 index 58d405049d3..00000000000 --- a/src/services/datasources.js +++ /dev/null @@ -1,13 +0,0 @@ -goog.provide('ngeo.DataSources'); -goog.require('ngeo'); - -goog.require('ol.Collection'); - - -ngeo.module.value('ngeoDataSources', new ol.Collection()); - - -/** - * @typedef {!ol.Collection.} - */ -ngeo.DataSources; diff --git a/src/services/mapquerent.js b/src/services/mapquerent.js index bb831a43c49..cde48729868 100644 --- a/src/services/mapquerent.js +++ b/src/services/mapquerent.js @@ -2,7 +2,7 @@ goog.provide('ngeo.MapQuerent'); goog.require('ngeo'); goog.require('ngeo.Querent'); -goog.require('ngeo.DataSourcesHelper'); +goog.require('ngeo.datasource.DataSourcesHelper'); /** @@ -27,10 +27,10 @@ ngeo.MapQuerent = class { * * @struct * @param {angular.$injector} $injector Main injector. - * @param {ngeo.DataSources} ngeoDataSources Ngeo collection of data source - * objects. - * @param {ngeo.DataSourcesHelper} ngeoDataSourcesHelper Ngeo data sources - * helper service. + * @param {ngeo.datasource.DataSources} ngeoDataSources Ngeo collection of + * data source objects. + * @param {ngeo.datasource.DataSourcesHelper} ngeoDataSourcesHelper Ngeo data + * sources helper service. * @param {ngeo.Querent} ngeoQuerent The ngeo querent service. * @param {ngeox.QueryResult} ngeoQueryResult The ngeo query result service. * @ngdoc service @@ -45,13 +45,13 @@ ngeo.MapQuerent = class { $injector.get('ngeoQueryOptions') : {}); /** - * @type {ngeo.DataSources} + * @type {ngeo.datasource.DataSources} * @private */ this.ngeoDataSources_ = ngeoDataSources; /** - * @type {ngeo.DataSourcesHelper} + * @type {ngeo.datasource.DataSourcesHelper} * @private */ this.ngeoDataSourcesHelper_ = ngeoDataSourcesHelper; diff --git a/src/services/querent.js b/src/services/querent.js index b95ed56eba6..c0073088bb3 100644 --- a/src/services/querent.js +++ b/src/services/querent.js @@ -123,7 +123,7 @@ ngeo.Querent = class { * * The map view resolution determines if the inner ogc layers are in range. * - * @param {!Array.} dataSources Data sources + * @param {!Array.} dataSources Data sources * @param {ol.Map} map Map. * @return {!ngeox.QueryableDataSources} Queryable data sources. * @export @@ -143,11 +143,13 @@ ngeo.Querent = class { continue; } - // (2) Split data sources - if (dataSource.supportsWFS) { - queryableDataSources.wfs.push(dataSource); - } else { - queryableDataSources.wms.push(dataSource); + if (dataSource instanceof ngeo.datasource.OGC) { + // (2) Split data sources + if (dataSource.supportsWFS) { + queryableDataSources.wfs.push(dataSource); + } else { + queryableDataSources.wms.push(dataSource); + } } } @@ -155,7 +157,7 @@ ngeo.Querent = class { } /** - * @param {ngeo.DataSource} dataSource Data source. + * @param {ngeo.datasource.OGC} dataSource Data source. * @return {angular.$q.Promise} Promise. * @export */ @@ -220,8 +222,8 @@ ngeo.Querent = class { * Handles the result of a single WMS GetFeatureInfo or WFS GetFeature * request. Read features from the response and return them. * - * @param {!Array.} dataSources List of queryable data - * sources that were used to do the query. + * @param {!Array.} dataSources List of + * queryable data sources that were used to do the query. * @param {number} limit The maximum number of features to get with the query. * @param {boolean} wfs Whether the query was WFS or WMS. * @param {angular.$http.Response|number} response Response. @@ -241,10 +243,14 @@ ngeo.Querent = class { tooManyFeatures = true; totalFeatureCount = response; } else { - if (wfs) { - features = dataSource.wfsFormat.readFeatures(response.data); + if (dataSource instanceof ngeo.datasource.OGC) { + if (wfs) { + features = dataSource.wfsFormat.readFeatures(response.data); + } else { + features = dataSource.wmsFormat.readFeatures(response.data); + } } else { - features = dataSource.wmsFormat.readFeatures(response.data); + features = []; } } const dataSourceId = dataSource.id; @@ -614,8 +620,8 @@ ngeo.Querent = class { } /** - * @param {!Array.} dataSources List of queryable data - * sources that supports WFS. + * @param {!Array.} dataSources List of + * queryable data sources that supports WFS. * @return {ngeo.Querent.CombinedDataSources} Combined lists of data sources. * @private */ @@ -644,8 +650,8 @@ ngeo.Querent = class { } /** - * @param {!Array.} dataSources List of queryable data - * sources that supports WMS. + * @param {!Array.} dataSources List of + * queryable data sources that supports WMS. * @return {ngeo.Querent.CombinedDataSources} Combined lists of data sources. * @private */ @@ -680,14 +686,18 @@ ngeo.Querent = class { * - queryable (using the native getter) * - have at least one OGC layer in range of current map view resolution. * - * @param {ngeo.DataSource} ds Data source + * @param {ngeo.datasource.DataSource} ds Data source * @param {number} res Resolution. * @return {boolean} Whether the data source is queryable * @private */ isDataSourceQueryable_(ds, res) { - return ds.visible && ds.inRange && ds.queryable && - ds.isAnyOGCLayerInRange(res, true); + let queryable = ds.visible && ds.inRange && ds.queryable; + if (queryable && ds instanceof ngeo.datasource.OGC) { + const ogcDS = /** @type {!ngeo.datasource.OGC} */ (ds); + queryable = ogcDS.isAnyOGCLayerInRange(res, true); + } + return queryable; } /** @@ -730,7 +740,7 @@ ngeo.Querent = class { /** - * @typedef {!Array.>} + * @typedef {!Array.>} */ ngeo.Querent.CombinedDataSources; diff --git a/src/services/rulehelper.js b/src/services/rulehelper.js index 5aa302532f9..5f676143a9e 100644 --- a/src/services/rulehelper.js +++ b/src/services/rulehelper.js @@ -379,7 +379,7 @@ ngeo.RuleHelper = class { */ createFilter(options) { - const dataSource = /** @type {ngeo.DataSource} */ (options.dataSource); + const dataSource = /** @type {ngeo.datasource.OGC} */ (options.dataSource); let mainFilter = null; if (options.filter) { @@ -456,7 +456,7 @@ ngeo.RuleHelper = class { /** * @param {ngeo.rule.Rule} rule Rule. - * @param {ngeo.DataSource} dataSource Data source. + * @param {ngeo.datasource.OGC} dataSource Data source. * @param {string=} opt_srsName SRS name. No srsName attribute will be * set on geometries when this is not provided. * @return {?ol.format.filter.Filter} filter Filter; @@ -642,8 +642,8 @@ ngeo.RuleHelper = class { /** * Create and return an OpenLayers filter object using the available * time properties within the data source. - * @param {ngeo.DataSource} dataSource Data source from which to create the - * filter. + * @param {ngeo.datasource.OGC} dataSource Data source from which to + * create the filter. * @return {?ol.format.filter.Filter} Filter * @private */