/** * The snapping service of GMF. Responsible of collecting the treeCtrls that * support snapping and store them here. As soon as a treeCtrl state becomes * 'on', a WFS GetFeature request is issued to collect the features at the * map view location. A new request is sent every time the map is panned or * zoomed for each treeCtrl that are still 'on'. * * Features returned by these requests get bound to a `ol.interaction.Snap`, * which allows the snapping to occur on other places where vector * features are drawn or modified. * * * @class * @param {angular.IHttpService} $http Angular $http service. * @param {angular.IQService} $q The Angular $q service. * @param {angular.IScope} $rootScope Angular rootScope. * @param {angular.auto.IInjectorService} $injector Angular injector. * @param {angular.ITimeoutService} $timeout Angular timeout service. * @param {import('gmf/datasource/fileGroupModule').DatasourceFileGroup} gmfDatasourceFileGroup Group that contains file data sources. * @param {import('gmf/themes').GmfSnappingConfig} gmfSnappingConfig Snapping configuration options for the * features in the Draw tool and in the "Layer Import / Local" tool. * @param {import('gmf/theme/Themes').ThemesService} gmfThemes The gmf Themes service. * @param {import('gmf/layertree/TreeManager').LayertreeTreeManager} gmfTreeManager The gmf TreeManager * service. * @param {import('ol/Collection').default>} ngeoFeatures Collection * of features. * @param {import('gmf/options.js').gmfSnappingOptions} gmfSnappingOptions The options. * @ngdoc service * @ngname gmfSnapping */ export function EditingSnappingService($http: angular.IHttpService, $q: angular.IQService, $rootScope: angular.IScope, $injector: angular.auto.IInjectorService, $timeout: angular.ITimeoutService, gmfDatasourceFileGroup: import("gmf/datasource/fileGroupModule").DatasourceFileGroup, gmfSnappingConfig: import("gmf/themes").GmfSnappingConfig, gmfThemes: import("gmf/theme/Themes").ThemesService, gmfTreeManager: import("gmf/layertree/TreeManager").LayertreeTreeManager, ngeoFeatures: import("ol/Collection").default>, gmfSnappingOptions: import("gmf/options.js").gmfSnappingOptions): void; export class EditingSnappingService { /** * The snapping service of GMF. Responsible of collecting the treeCtrls that * support snapping and store them here. As soon as a treeCtrl state becomes * 'on', a WFS GetFeature request is issued to collect the features at the * map view location. A new request is sent every time the map is panned or * zoomed for each treeCtrl that are still 'on'. * * Features returned by these requests get bound to a `ol.interaction.Snap`, * which allows the snapping to occur on other places where vector * features are drawn or modified. * * * @class * @param {angular.IHttpService} $http Angular $http service. * @param {angular.IQService} $q The Angular $q service. * @param {angular.IScope} $rootScope Angular rootScope. * @param {angular.auto.IInjectorService} $injector Angular injector. * @param {angular.ITimeoutService} $timeout Angular timeout service. * @param {import('gmf/datasource/fileGroupModule').DatasourceFileGroup} gmfDatasourceFileGroup Group that contains file data sources. * @param {import('gmf/themes').GmfSnappingConfig} gmfSnappingConfig Snapping configuration options for the * features in the Draw tool and in the "Layer Import / Local" tool. * @param {import('gmf/theme/Themes').ThemesService} gmfThemes The gmf Themes service. * @param {import('gmf/layertree/TreeManager').LayertreeTreeManager} gmfTreeManager The gmf TreeManager * service. * @param {import('ol/Collection').default>} ngeoFeatures Collection * of features. * @param {import('gmf/options.js').gmfSnappingOptions} gmfSnappingOptions The options. * @ngdoc service * @ngname gmfSnapping */ constructor($http: angular.IHttpService, $q: angular.IQService, $rootScope: angular.IScope, $injector: angular.auto.IInjectorService, $timeout: angular.ITimeoutService, gmfDatasourceFileGroup: import("gmf/datasource/fileGroupModule").DatasourceFileGroup, gmfSnappingConfig: import("gmf/themes").GmfSnappingConfig, gmfThemes: import("gmf/theme/Themes").ThemesService, gmfTreeManager: import("gmf/layertree/TreeManager").LayertreeTreeManager, ngeoFeatures: import("ol/Collection").default>, gmfSnappingOptions: import("gmf/options.js").gmfSnappingOptions); /** * @type {angular.IHttpService} */ http_: angular.IHttpService; /** * @type {angular.IQService} */ q_: angular.IQService; /** * @type {angular.IScope} */ rootScope_: angular.IScope; /** * @type {angular.ITimeoutService} */ timeout_: angular.ITimeoutService; /** * @type {angular.auto.IInjectorService} */ injector_: angular.auto.IInjectorService; /** * @type {import('gmf/datasource/fileGroupModule').DatasourceFileGroup} */ gmfDatasourceFileGroup_: import("gmf/datasource/fileGroupModule").DatasourceFileGroup; /** * @type {import('gmf/themes').GmfSnappingConfig} */ gmfSnappingConfig_: import("gmf/themes").GmfSnappingConfig; /** * @type {import('gmf/options.js').gmfSnappingOptions} */ gmfSnappingOptions_: import("gmf/options.js").gmfSnappingOptions; /** * @type {import("gmf/theme/Themes.js").ThemesService} */ gmfThemes_: import("gmf/theme/Themes.js").ThemesService; /** * @type {import('gmf/layertree/TreeManager').LayertreeTreeManager} */ gmfTreeManager_: import("gmf/layertree/TreeManager").LayertreeTreeManager; /** * @type {import('ol/Collection').default>} */ ngeoFeatures_: import("ol/Collection").default>; /** * A cache containing all available snappable items, in which the listening * of the state of the `treeCtrl` is registered and unregistered. * * @type {Cache} */ cache_: Cache; /** * A cache for the File data sources that are added in the * FileGroup, i.e. for example when a KML is added, then a File data * source is added to the FileGroup's collection, and their features * need to be snappable. * * @type {CacheFileDataSource} */ cacheFileDataSource_: CacheFileDataSource; /** * @type {import('ol/events').EventsKey[]} */ listenerKeys_: import("ol/events").EventsKey[]; /** * @type {?import('ol/Map').default} */ map_: import("ol/Map").default | null; /** * Reference to the promise taking care of calling all GetFeature requests * of the currently active cache items after the map view changed. Used * to cancel if the map view changes often within a short period of time. * * @type {?angular.IPromise} */ mapViewChangePromise_: angular.IPromise | null; /** * @type {!CustomSnap} */ ngeoFeaturesSnapInteraction_: CustomSnap; /** * A reference to the OGC servers loaded by the theme service. * * @type {import('gmf/themes').GmfOgcServers|null} */ ogcServers_: import("gmf/themes").GmfOgcServers | null; /** * @type {import('ol/source/Vector').default|undefined} */ ngeoSnappingSource_: import("ol/source/Vector").default | undefined; /** * In order for a `ol.interaction.Snap` to work properly, it has to be added * to the map after any draw interactions or other kinds of interactions that * interacts with features on the map. * * This method can be called to make sure the Snap interactions are on top. * */ ensureSnapInteractionsOnTop(): void; /** * Bind the snapping service to a map * * @param {?import('ol/Map').default} map Map */ setMap(map: import("ol/Map").default | null): void; treeCtrlsUnregister_: () => void; /** * Called when the themes change. Get the OGC servers, then listen to the * tree manager Layertree controllers array changes. */ handleThemesChange_(): void; /** * Registers a newly added Layertree controller 'leaf'. If it's snappable, * create and add a cache item with every configuration required to do the * snapping. It becomes active when its state is set to 'on'. * * @param {import('ngeo/layertree/Controller').LayertreeController} treeCtrl Layertree controller to * register */ registerTreeCtrl_(treeCtrl: import("ngeo/layertree/Controller").LayertreeController): void; /** * Unregisters all removed layertree controllers 'leaf'. Remove the according * cache item and deactivate it as well. Unregister events. */ unregisterAllTreeCtrl_(): void; /** * Get the OGC server. * * @param {import('ngeo/layertree/Controller').LayertreeController} treeCtrl The layer tree controller * @returns {?import('gmf/themes').GmfOgcServer} The OGC server. */ getOGCServer_(treeCtrl: import("ngeo/layertree/Controller").LayertreeController): import("gmf/themes").GmfOgcServer | null; /** * Get the configuration required to do WFS requests (for snapping purpose) * from a Layertree controller that has a leaf node. * * The following requirements must be met in order for a treeCtrl to be * considered supporting WFS: * * 1) ogcServers objects are loaded * 2) its node `type` property is equal to `WMS` * 3) in its node `childLayers` property, the `queryable` property is set * to `true` * 4) the ogcServer defined in 3) has the `wfsSupport` property set to `true`. * * @param {import('ngeo/layertree/Controller').LayertreeController} treeCtrl The layer tree controller * @returns {?WFSConfig} The configuration object. */ getWFSConfig_(treeCtrl: import("ngeo/layertree/Controller").LayertreeController): WFSConfig | null; /** * @param {import('ngeo/layertree/Controller').LayertreeController} treeCtrl The layer tree controller * @returns {boolean} True if state is on and snapping is activated for that layer. */ isSnappingActiveForTreeCtrl_(treeCtrl: import("ngeo/layertree/Controller").LayertreeController): boolean; /** * @param {import('ngeo/layertree/Controller').LayertreeController} treeCtrl The layer tree controller * @param {boolean} newVal New value for the layer */ handleTreeCtrlStateChange_(treeCtrl: import("ngeo/layertree/Controller").LayertreeController, newVal: boolean): void; /** * Activate a cache item by adding a Snap interaction to the map and launch * the initial request to get the features. * * @param {CacheItem} item Cache item. */ activateItem_(item: CacheItem): void; /** * Deactivate a cache item by removing the snap interaction and clearing any * existing features. * * @param {CacheItem} item Cache item. */ deactivateItem_(item: CacheItem): void; loadAllItems_(): void; /** * Manually refresh all features */ refresh(): void; /** * For a specific cache item, issue a new WFS GetFeatures request. The returned * features set in the item collection of features (they replace any existing * ones first). * * @param {CacheItem} item Cache item. */ loadItemFeatures_(item: CacheItem): void; /** * Called when the map view changes. Load all active cache items after a small * delay. Cancel any currently delayed call, if required. */ handleMapMoveEnd_(): void; refreshSnappingSource_(): void; /** * Called when a File data source is added to the File Group (imported * geospatial files). Make its features snappable. * * @param {Event|import('ol/events/Event').default} evt Event */ handleFileGroupDataSourcesCollectionAdd_(evt: Event | import("ol/events/Event").default): void; /** * Called when a File data source is removed from the File * Group. Remove the features from being snappable. * * @param {Event|import('ol/events/Event').default} evt Event */ handleFileGroupDataSourcesCollectionRemove_(evt: Event | import("ol/events/Event").default): void; /** * Called when the "visible" property of a File data source * changes. Add or remove the Snap interaction for that data source * depending on the property value. * * @param {ngeoDatasourceFile} fileDataSource */ handleFileDataSourceVisibleChange_(fileDataSource: ngeoDatasourceFile): void; } export namespace EditingSnappingService { let $inject: string[]; } export class CustomSnap extends olInteractionSnap { /** * @param {import('ol/interaction/Snap').Options} options */ constructor(options: import("ol/interaction/Snap").Options); } export default myModule; export type Cache = { [x: string]: CacheItem; }; export type CacheItem = { active: boolean; featureNS: string; featurePrefix: string; features: import("ol/Collection").default>; interaction: import("ol/interaction/Snap").default | null; maxFeatures: number; requestDeferred: angular.IDeferred | null; snappingConfig: import("gmf/themes").GmfSnappingConfig; stateWatcherUnregister: Function; treeCtrl: import("ngeo/layertree/Controller").LayertreeController; wfsConfig: WFSConfig; }; /** * The key is: A uid string generated from the fileDataSource */ export type CacheFileDataSource = { [x: string]: CacheFileDataSourceItem; }; export type CacheFileDataSourceItem = { active: boolean; fileDataSource: import("ngeo/datasource/File").default; interaction: import("ol/interaction/Snap").default; visibleWatcherUnregister: Function; }; export type WFSConfig = { featureTypes: string; url: string; }; import angular from 'angular'; import ngeoDatasourceFile from 'ngeo/datasource/File'; import olInteractionSnap from 'ol/interaction/Snap'; /** * @typedef {Object} Cache */ /** * @typedef {Object} CacheItem * @property {boolean} active * @property {string} featureNS * @property {string} featurePrefix * @property {import('ol/Collection').default>} features * @property {?import('ol/interaction/Snap').default} interaction * @property {number} maxFeatures * @property {?angular.IDeferred} requestDeferred * @property {import('gmf/themes').GmfSnappingConfig} snappingConfig * @property {Function} stateWatcherUnregister * @property {import('ngeo/layertree/Controller').LayertreeController} treeCtrl * @property {WFSConfig} wfsConfig */ /** * The key is: A uid string generated from the fileDataSource * * @typedef {Object} CacheFileDataSource */ /** * @typedef {Object} CacheFileDataSourceItem * @property {boolean} active * @property {import('ngeo/datasource/File').default} fileDataSource * @property {import('ol/interaction/Snap').default} interaction * @property {Function} visibleWatcherUnregister */ /** * @typedef {Object} WFSConfig * @property {string} featureTypes * @property {string} url */ /** * @type {angular.IModule} * @hidden */ declare const myModule: angular.IModule;