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.

Angular $http service.

The Angular $q service.

Angular rootScope.

Angular injector.

Angular timeout service.

Group that contains file data sources.

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

The gmf Themes service.

The gmf TreeManager service.

Collection of features.

The options.

service

gmfSnapping

Constructors

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

    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: DatasourceFileGroup

      Group that contains file data sources.

    • gmfSnappingConfig: GmfSnappingConfig

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

    • gmfThemes: ThemesService

      The gmf Themes service.

    • gmfTreeManager: LayertreeTreeManager

      The gmf TreeManager service.

    • ngeoFeatures: Collection<Feature<Geometry>>

      Collection of features.

    • gmfSnappingOptions: any

      The options.

    Returns EditingSnappingService

    service

    gmfSnapping

Properties

cache_: {}

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

cacheFileDataSource_: {}

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.

gmfDatasourceFileGroup_: DatasourceFileGroup
gmfSnappingConfig_: GmfSnappingConfig
gmfSnappingOptions_: any
gmfThemes_: ThemesService
gmfTreeManager_: LayertreeTreeManager
http_: IHttpService
injector_: IInjectorService
listenerKeys_: EventsKey[]
map_: Map
mapViewChangePromise_: IPromise<void>

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.

ngeoFeatures_: Collection<Feature<Geometry>>
ngeoFeaturesSnapInteraction_: CustomSnap
ngeoSnappingSource_: VectorSource<unknown>
ogcServers_: {}

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

q_: IQService
rootScope_: IScope
timeout_: ITimeoutService
treeCtrlsUnregister_: (() => void)
$inject: string[]

Methods

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

    Parameters

    Returns void

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

    Parameters

    Returns void

  • 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

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

  • 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

  • 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

  • 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

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

    Returns void

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

    Returns void

  • Parameters

    • treeCtrl: LayertreeController

      The layer tree controller

    • newVal: boolean

      New value for the layer

    Returns void

  • Parameters

    • treeCtrl: LayertreeController

      The layer tree controller

    Returns boolean

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

  • 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

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

    Parameters

    • treeCtrl: LayertreeController

      Layertree controller to register

    Returns void

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

    Returns void