import SelectionOperation from "@arcgis/core/views/selection/SelectionOperation.js";const SelectionOperation = await $arcgis.import("@arcgis/core/views/selection/SelectionOperation.js");- Inheritance
- SelectionOperation→
Accessor
- Since
- ArcGIS Maps SDK for JavaScript 5.1
The selection operation is responsible for creating and using an interactive drawing tool to maintain an interactively updated graphics selection set while a selection area is being drawn. The interactive tool is active on the view when the operation is created. After the operation is completed (selection area is finalized or cancelled), the interactive tool is removed. Each operation can only be used once and a new selection operation should be created each time a new selection is required.
Constructors
Constructor
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| properties | | |
Properties
| Property | Type | Class |
|---|---|---|
| readonly | | |
| readonly | | |
| readonly inherited | ||
| readonly | | |
| readonly | | |
| readonly | DrawingMode | null | undefined | |
| | ||
| readonly | | |
| | ||
| | ||
| readonly | | |
| readonly | | |
| readonly | | |
| SelectionSource[] | null | undefined | | |
| readonly | | |
| | ||
| readonly | |
completed
- Type
- boolean
Indicates whether the selection operation has been completed or cancelled.
effectiveSelectionManager
- Type
- SelectionManager
The selection manager being used by this selection operation.
mode
- Type
- DrawingMode | null | undefined
Indicates the draw mode being used by this selection operation.
persistSelection
- Type
- boolean
Indicates whether the selection operation will persist the determined selection via the current effective selection manager.
- Default value
- true
processingFinalSelection
- Type
- boolean
Indicates whether the selection operation is determining the final selection set.
selection
- Type
- Collection<Graphic>
A reference to the current working selection while actively drawing.
selectionManager
- Type
- SelectionManager | null | undefined
A reference to a custom selection manager. Otherwise, the selection operation uses the selection manager on the provided view.
selectOnComplete
- Type
- boolean
Indicates whether the selection operation should only update the selection when the operation successfully completes, rather than while actively drawing.
- Default value
- true
sources
- Type
- SelectionSource[] | null | undefined
A reference to sources that should be used to determine selections.
toolName
- Type
- SelectionToolName
Reference to the current drawing tool being used by the selection operation.
- Default value
- ""
view
- Type
- SelectableViewUnion
Reference to the view being used by the selection operation.
Methods
| Method | Signature | Class |
|---|---|---|
| cancel(): void | | |
| destroy(): void | | |
| inherited | emit<Type extends EventNames<this>>(type: Type, event?: this["@eventTypes"][Type]): boolean | |
| inherited | hasEventListener<Type extends EventNames<this>>(type: Type): boolean | |
| inherited | on<Type extends EventNames<this>>(type: Type, listener: EventedCallback<this["@eventTypes"][Type]>): ResourceHandle |
cancel
- Signature
-
cancel (): void
Cancels the selection operation. Any existing selection identified by the operation is cleared.
- Returns
- void
emit
- Signature
-
emit <Type extends EventNames<this>>(type: Type, event?: this["@eventTypes"][Type]): boolean
- Type parameters
- <Type extends EventNames<this>>
- Since
- ArcGIS Maps SDK for JavaScript 4.5
Emits an event on the instance. This method should only be used when creating subclasses of this class.
hasEventListener
- Signature
-
hasEventListener <Type extends EventNames<this>>(type: Type): boolean
- Type parameters
- <Type extends EventNames<this>>
Indicates whether there is an event listener on the instance that matches the provided event name.
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| type | Type | The name of the event. | |
- Returns
- boolean
Returns true if the class supports the input event.
on
- Signature
-
on <Type extends EventNames<this>>(type: Type, listener: EventedCallback<this["@eventTypes"][Type]>): ResourceHandle
- Type parameters
- <Type extends EventNames<this>>
Registers an event handler on the instance. Call this method to hook an event with a listener.
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| type | Type | An event or an array of events to listen for. | |
| listener | EventedCallback<this["@eventTypes"][Type]> | The function to call when the event fires. | |
- Returns
- ResourceHandle
Returns an event handler with a
remove()method that should be called to stop listening for the event(s).Property Type Description remove Function When called, removes the listener from the event.
- Example
- view.on("click", function(event){// event is the event handle returned after the event fires.console.log(event.mapPoint);});