selection-tools

This bundle allows the configuration of tools with predefined selection methods and sources.

The search is usually (but not necessarily) performed on stores like an AGSStore.

Usage

    "bundles": {
        ...
        "selection-tools": {
            "Config": {
                "tools": [{
                        "id": "selectTrees",
                        "title" : "Select Trees",
                        "sourceId": "trees"
                    }]
            }
        }
        ...
    }

The search is performed by an instance of the SpatialSearchService from the selection-services bundle. For more information about the sources being searched by this service, see the selection-services bundle documentation.

This bundle has no means to display the selection results. Use the result-ui to display the results.

Configuration Reference

Use the Config component to configure this bundle. Property tools contains a list of selection tools. Any tool property may be used here. See following sample for properties with special semantics.

"selection-tools": {
    "Config":{
        "tools": [
            {
                // tool ID (required)
                "id": "selectCountries",

                // tool title (optional)
                "title" : "Select Countries",

                // icon class used for the tool
                // (optional if not defined, the iconClass of the selectionMethod is used)
                "iconClass" : "icon-select-mouse",

                // Defines which selection method should be used (optional)
                // The default is "rectangle"
                "selectionMethod": "point",

                // Defines special properties for the selectionMethod (optional).
                "selectionOptions": {
                    "clickTolerance": 10
                },

                // Defines which source (store) should be searched
                // (required if sourceIds is not defined)
                "sourceId": "countries",

                // Defines a list of sources (stores) to be searched
                // (required if sourceId is not defined)
                "sourceIds": ["countries","trees"],

                // Defines that all available sources should be searched
                // Special value for sourceIds!
                "sourceIds": ["*"],

                // Defines that tool should be deactivated if the selection returns a non-empty result
                // (optional, default is false)
                "deactivateOnSelection": true,

                // Defines that an existing selection should be replaced (Note: applies only if new result-ui is used)
                // (optional, default is undefined)
                "replaceExistingSelection": true
            }
        ]
    }
}

A declared tool is only registered with the system if the specified selectionMethod is available and if one of the specified sources is available.

Use Cases

How to define a single tool that selects items from all visible layers

To create a tool that selects features from all visible layers, use the following configuration:

"selection-tools": {
   "Config": {
      "tools": [
         {
            "id": "selectAll",
            "sourceIds": ["*"]
         }
      ]
   }
},

To make all visible layers available for selection, enable auto store registration in the agssearch bundle.