### Hierarchy

- EditingSnappingService

## Index

### Constructors

- constructor

### Properties

- cacheFileDataSource_
- cache_
- gmfDatasourceFileGroup_
- gmfSnappingConfig_
- gmfSnappingOptions_
- gmfThemes_
- gmfTreeManager_
- http_
- injector_
- listenerKeys_
- mapViewChangePromise_
- map_
- ngeoFeaturesSnapInteraction_
- ngeoFeatures_
- ngeoSnappingSource_
- ogcServers_
- q_
- rootScope_
- timeout_
- treeCtrlsUnregister_

### Methods

- activateItem_
- deactivateItem_
- ensureSnapInteractionsOnTop
- getOGCServer_
- getWFSConfig_
- handleFileDataSourceVisibleChange_
- handleFileGroupDataSourcesCollectionAdd_
- handleFileGroupDataSourcesCollectionRemove_
- handleMapMoveEnd_
- handleThemesChange_
- handleTreeCtrlStateChange_
- isSnappingActiveForTreeCtrl_
- loadAllItems_
- loadItemFeatures_
- refresh
- refreshSnappingSource_
- registerTreeCtrl_
- setMap
- unregisterAllTreeCtrl_

## Constructors

### constructor

- new EditingSnappingService($http: IHttpService, $q: IQService, $rootScope: IScope, $injector: IInjectorService, $timeout: ITimeoutService, gmfDatasourceFileGroup: any, gmfSnappingConfig: any, gmfThemes: any, gmfTreeManager: any, ngeoFeatures: Collection<Feature<Geometry>>, gmfSnappingOptions: any): EditingSnappingService

- - Defined in src/editing/Snapping.js:81

  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.

  nginject
  ngdoc

    service

  ngname

    gmfSnapping

  #### Parameters

  - ##### $http: IHttpService

    Angular $http service.

  - ##### $q: IQService

    The Angular $q service.

  - ##### $rootScope: IScope

    Angular rootScope.

  - ##### $injector: IInjectorService

    Angular injector.

  - ##### $timeout: ITimeoutService

    Angular timeout service.

  - ##### gmfDatasourceFileGroup: any

    Group that contains file data sources.

  - ##### gmfSnappingConfig: any

    Snapping configuration options for the features in the Draw tool and in the "Layer Import / Local" tool.

  - ##### gmfThemes: any

    The gmf Themes service.

  - ##### gmfTreeManager: any

    The gmf TreeManager service.

  - ##### ngeoFeatures: Collection<Feature<Geometry>>

    Collection of features.

  - ##### gmfSnappingOptions: any

    The options.

  #### Returns EditingSnappingService

## Properties

### cacheFileDataSource_

cacheFileDataSource_: Object

- Defined in src/editing/Snapping.js:169

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.

### cache_

cache_: Object

- Defined in src/editing/Snapping.js:159

A cache containing all available snappable items, in which the listening of the state of the `treeCtrl` is registered and unregistered.

### gmfDatasourceFileGroup_

gmfDatasourceFileGroup_: any

- Defined in src/editing/Snapping.js:124

### gmfSnappingConfig_

gmfSnappingConfig_: any

- Defined in src/editing/Snapping.js:129

### gmfSnappingOptions_

gmfSnappingOptions_: any

- Defined in src/editing/Snapping.js:134

### gmfThemes_

gmfThemes_: any

- Defined in src/editing/Snapping.js:139

### gmfTreeManager_

gmfTreeManager_: any

- Defined in src/editing/Snapping.js:144

### http_

http_: IHttpService

- Defined in src/editing/Snapping.js:99

### injector_

injector_: IInjectorService

- Defined in src/editing/Snapping.js:119

### listenerKeys_

listenerKeys_: EventsKey[]

- Defined in src/editing/Snapping.js:174

### mapViewChangePromise_

mapViewChangePromise_: IPromise<void>

- Defined in src/editing/Snapping.js:188

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.

### map_

map_: Map

- Defined in src/editing/Snapping.js:179

### ngeoFeaturesSnapInteraction_

ngeoFeaturesSnapInteraction_: CustomSnap

- Defined in src/editing/Snapping.js:193

### ngeoFeatures_

ngeoFeatures_: Collection<Feature<Geometry>>

- Defined in src/editing/Snapping.js:149

### ngeoSnappingSource_

ngeoSnappingSource_: VectorSource<unknown>

- Defined in src/editing/Snapping.js:210

### ogcServers_

ogcServers_: any

- Defined in src/editing/Snapping.js:205

A reference to the OGC servers loaded by the theme service.

### q_

q_: IQService

- Defined in src/editing/Snapping.js:104

### rootScope_

rootScope_: IScope

- Defined in src/editing/Snapping.js:109

### timeout_

timeout_: ITimeoutService

- Defined in src/editing/Snapping.js:114

### treeCtrlsUnregister_

treeCtrlsUnregister_: (() => void)

- Defined in src/editing/Snapping.js:284

#### Type declaration

- - (): void

  - #### Returns void

## Methods

### activateItem_

- activateItem_(item: CacheItem): void

- - Defined in src/editing/Snapping.js:547

  Activate a cache item by adding a Snap interaction to the map and launch the initial request to get the features.

  #### Parameters

  - ##### item: CacheItem

    Cache item.

  #### Returns void

### deactivateItem_

- deactivateItem_(item: CacheItem): void

- - Defined in src/editing/Snapping.js:581

  Deactivate a cache item by removing the snap interaction and clearing any existing features.

  #### Parameters

  - ##### item: CacheItem

    Cache item.

  #### Returns void

### ensureSnapInteractionsOnTop

- ensureSnapInteractionsOnTop(): void

- - Defined in src/editing/Snapping.js:223

  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.

  #### Returns void

### getOGCServer_

- getOGCServer_(treeCtrl: LayertreeController): any

- - Defined in src/editing/Snapping.js:423

  Get the OGC server.

  #### Parameters

  - ##### treeCtrl: LayertreeController

    The layer tree controller

  #### Returns any

  The OGC server.

### getWFSConfig_

- getWFSConfig_(treeCtrl: LayertreeController): WFSConfig

- - Defined in src/editing/Snapping.js:464

  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`.

  #### Parameters

  - ##### treeCtrl: LayertreeController

    The layer tree controller

  #### Returns WFSConfig

  The configuration object.

### handleFileDataSourceVisibleChange_

- handleFileDataSourceVisibleChange_(fileDataSource: default): void

- - Defined in src/editing/Snapping.js:824

  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.

  #### Parameters

  - ##### fileDataSource: default

  #### Returns void

### handleFileGroupDataSourcesCollectionAdd_

- handleFileGroupDataSourcesCollectionAdd_(evt: BaseEvent | Event): void

- - Defined in src/editing/Snapping.js:739

  Called when a File data source is added to the File Group (imported geospatial files). Make its features snappable.

  #### Parameters

  - ##### evt: BaseEvent | Event

    Event

  #### Returns void

### handleFileGroupDataSourcesCollectionRemove_

- handleFileGroupDataSourcesCollectionRemove_(evt: BaseEvent | Event): void

- - Defined in src/editing/Snapping.js:787

  Called when a File data source is removed from the File Group. Remove the features from being snappable.

  #### Parameters

  - ##### evt: BaseEvent | Event

    Event

  #### Returns void

### handleMapMoveEnd_

- handleMapMoveEnd_(): void

- - Defined in src/editing/Snapping.js:710

  Called when the map view changes. Load all active cache items after a small delay. Cancel any currently delayed call, if required.

  #### Returns void

### handleThemesChange_

- handleThemesChange_(): void

- - Defined in src/editing/Snapping.js:340

  Called when the themes change. Get the OGC servers, then listen to the tree manager Layertree controllers array changes.

  #### Returns void

### handleTreeCtrlStateChange_

- handleTreeCtrlStateChange_(treeCtrl: LayertreeController, newVal: boolean): void

- - Defined in src/editing/Snapping.js:534

  #### Parameters

  - ##### treeCtrl: LayertreeController

    The layer tree controller

  - ##### newVal: boolean

    New value for the layer

  #### Returns void

### isSnappingActiveForTreeCtrl_

- isSnappingActiveForTreeCtrl_(treeCtrl: LayertreeController): boolean

- - Defined in src/editing/Snapping.js:513

  #### Parameters

  - ##### treeCtrl: LayertreeController

    The layer tree controller

  #### Returns boolean

  True if state is on and snapping is activated for that layer.

### loadAllItems_

- loadAllItems_(): void

- - Defined in src/editing/Snapping.js:612

  #### Returns void

### loadItemFeatures_

- loadItemFeatures_(item: CacheItem): void

- - Defined in src/editing/Snapping.js:637

  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).

  #### Parameters

  - ##### item: CacheItem

    Cache item.

  #### Returns void

### refresh

- refresh(): void

- - Defined in src/editing/Snapping.js:626

  Manually refresh all features

  #### Returns void

### refreshSnappingSource_

- refreshSnappingSource_(): void

- - Defined in src/editing/Snapping.js:717

  #### Returns void

### registerTreeCtrl_

- registerTreeCtrl_(treeCtrl: LayertreeController): void

- - Defined in src/editing/Snapping.js:355

  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'.

  #### Parameters

  - ##### treeCtrl: LayertreeController

    Layertree controller to register

  #### Returns void

### setMap

- setMap(map: Map): void

- - Defined in src/editing/Snapping.js:265

  Bind the snapping service to a map

  #### Parameters

  - ##### map: Map

    Map

  #### Returns void

### unregisterAllTreeCtrl_

- unregisterAllTreeCtrl_(): void

- - Defined in src/editing/Snapping.js:406

  Unregisters all removed layertree controllers 'leaf'. Remove the according cache item and deactivate it as well. Unregister events.

  #### Returns void

Generated using TypeDoc