SelectionManager

class wv.Selection.SelectionManager()

This class provides the main interface into the selection functionality of the viewer. The class manages a list of selection items that are optionally highlighted as the user selects objects in the scene.

Index

Accessors

Methods

Accessors

wv.Selection.SelectionManager.viewer()
get viewer(): IWebViewer

Returns: IWebViewer

Methods

wv.Selection.SelectionManager.add()
add(itemOrItems: (None | NodeSelectionItem | NodeSelectionItem[]), suppressCallback: boolean?): void

Manually adds an item or array of items to the selection set. Triggers a selection event.

Parameters

itemOrItems: (None | NodeSelectionItem | NodeSelectionItem[])

A selectionItem or selectionItem array that will be added to the current selection set.

suppressCallback: boolean = false

Optional boolean param to suppress the selectionArray callbacks calls to this generate.

Returns: void

wv.Selection.SelectionManager.advanceIncrementalSelection()
advanceIncrementalSelection(handle: IncrementalSelectionId, predicate: (None | (item: NodeSelectionItem) => Promise)?): Promise

Adds the next batch of instances selected by the supplied selection context to the selection set.

Parameters

handle: IncrementalSelectionId

The handle to an active area selection context.

predicate: (None | (item: NodeSelectionItem) => Promise) = null

An optional function that returns true if a given [[NodeSelectionItem]] should be added to the selection set. If false is returned, the item will not be added.

Returns: Promise

true if there are possibly more items to select and false if not.
wv.Selection.SelectionManager.beginConvexPolyhedronSelection()
beginConvexPolyhedronSelection(volumePlanes: Plane[], heuristicOrigin: Point3, config: IncrementalPickConfig): Promise

Creates a new and active selection context for the provided selection volume. The selection volume is a convex polyhedron defined by the bounded intersection of its half-spaces.

Parameters

volumePlanes: Plane[]

The planes used to define volume. A point p is inside the volume if and only if (plane.determineSide(p) == true) for all supplied planes.

heuristicOrigin: Point3

A point used to compute distances against for ordering returned results. This is typically (but not necessarily) the center of the volume.

config: IncrementalPickConfig

The configuration object used for this selection operation.

Returns: Promise

The handle for the selection context.
wv.Selection.SelectionManager.beginRayDrillSelection()
beginRayDrillSelection(rayCssOrigin: Point2, rayCssBoxRadius: number, config: IncrementalPickConfig, view: IView?): Promise

Creates a new and active selection context for the provided selection ray. The ray is created at the supplied ray origin and is cast into the scene. Faces are selected if they lie along the ray. Lines and points are selected if they lie within the ray’s box radius.

Note: Somewhat confusingly ray drill selection is actually a selection by volume. The provided ray origin and radius are used to create a frustum to preform the selection. This has some consequences. For example, the SelectionResults returned by advancing a ray drill selection will not have selection positions, since they were not selected at a single point.

Parameters

rayCssOrigin: Point2

The coordinate in css pixel space for the selection ray’s origin.

rayCssBoxRadius: number

The radius around the ray in css pixel space used for line and point selection proximity.

config: IncrementalPickConfig

The configuration object used for this selection operation.

view: IView = …

The view to use when projecting the point into the scene.

Returns: Promise

The handle for the selection context.
wv.Selection.SelectionManager.beginScreenSelectByArea()
beginScreenSelectByArea(areaCssMin: Point2, areaCssMax: Point2, config: IncrementalPickConfig, view: IView?): Promise

Creates a new and active selection context for the provided selection window.

Parameters

areaCssMin: Point2

The minimum coordinate in css pixel space for the selection window.

areaCssMax: Point2

The maximum coordinate in css pixel space for the selection window.

config: IncrementalPickConfig

The configuration object used for this selection operation.

view: IView = …

The view to use when projecting the point into the scene.

Returns: Promise

The handle for the selection context.
wv.Selection.SelectionManager.beginSphereSelection()
beginSphereSelection(sphereCenter: Point3, sphereRadius: number, config: IncrementalPickConfig): Promise

Creates a new and active selection context for the provided selection sphere.

Parameters

sphereCenter: Point3

The center of the selection sphere.

sphereRadius: number

The radius of the selection sphere.

config: IncrementalPickConfig

The configuration object used for this selection operation.

Returns: Promise

The handle for the selection context.
wv.Selection.SelectionManager.clear()
clear(triggerCallback: boolean?): void

Removes all items from the selection set.

Parameters

triggerCallback: boolean = true

triggers a null selection callback when true.

Returns: void

wv.Selection.SelectionManager.contains()
contains(item: SelectionItem): boolean

Parameters

Returns: boolean

wv.Selection.SelectionManager.containsParent()
containsParent(item: NodeSelectionItem): (None | NodeSelectionItem)

Checks if the parent of a selection item is in the selection set.

Parameters

Returns: (None | NodeSelectionItem)

parent selection item, or null if not found
wv.Selection.SelectionManager.each()
each(func: (s: NodeSelectionItem) => void): void

Iterates over all selection items. The function passed in will be called once for every selection item and will receive the item as its parameter.

Parameters

func: (s: NodeSelectionItem) => void

a function to be called for every selection item.

Returns: void

wv.Selection.SelectionManager.endIncrementalSelection()