SelectionManager
-
class
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
addadvanceIncrementalSelectionbeginConvexPolyhedronSelectionbeginRayDrillSelectionbeginScreenSelectByAreabeginSphereSelectionclearcontainscontainsParenteachendIncrementalSelectionexportSelectionDatagetFirstgetHighlightFaceElementSelectiongetHighlightLineElementSelectiongetHighlightNodeSelectiongetHighlightPointElementSelectiongetIgnoreEntityWhenTogglingChildSelectiongetLastgetNodeElementSelectionColorgetNodeElementSelectionHighlightModegetNodeElementSelectionOutlineColorgetNodeSelectionColorgetNodeSelectionHighlightModegetNodeSelectionOutlineColorgetPickTolerancegetPruneSelectionDescendantsgetResultgetResultsgetSelectedLayersgetSelectedTypesgetSelectionFiltergetSelectParentIfSelectedgetSingleEntityToggleModeEnabledgetSuppressImplicitRemovalCallbackisNodeSelectedisSelectedloadSelectionDataremoveselectAllFromPointselectAllFromRayselectFromPointselectFromRayselectLayerselectNodeselectTypesetsetHighlightFaceElementSelectionsetHighlightLineElementSelectionsetHighlightNodeSelectionsetHighlightPointElementSelectionsetIgnoreEntityWhenTogglingChildSelectionsetNodeElementSelectionColorsetNodeElementSelectionHighlightModesetNodeElementSelectionOutlineColorsetNodeSelectionColorsetNodeSelectionHighlightModesetNodeSelectionOutlineColorsetPickTolerancesetPruneSelectionDescendantssetSelectionFiltersetSelectParentIfSelectedsetSingleEntityToggleModeEnabledsetSuppressImplicitRemovalCallbacksizetoggle
Accessors
-
Selection.SelectionManager.viewer() - get viewer():
IWebViewerReturns:
IWebViewer
Methods
-
Selection.SelectionManager.add() - add(itemOrItems: (None |
NodeSelectionItem|NodeSelectionItem[]), suppressCallback: boolean?): voidManually 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
-
Selection.SelectionManager.advanceIncrementalSelection() - advanceIncrementalSelection(handle:
IncrementalSelectionId, predicate: (None | (item:NodeSelectionItem) => Promise)?): PromiseAdds the next batch of instances selected by the supplied selection context to the selection set.
Parameters
handle:
IncrementalSelectionIdThe handle to an active area selection context.predicate: (None | (item:
NodeSelectionItem) => Promise) = nullAn optional function that returnstrueif a given [[NodeSelectionItem]] should be added to the selection set. Iffalseis returned, the item will not be added.Returns: Promise
trueif there are possibly more items to select andfalseif not.
-
Selection.SelectionManager.beginConvexPolyhedronSelection() - beginConvexPolyhedronSelection(volumePlanes:
Plane[], heuristicOrigin:Point3, config:IncrementalPickConfig): PromiseCreates 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:
Point3A point used to compute distances against for ordering returned results. This is typically (but not necessarily) the center of the volume.config:
IncrementalPickConfigThe configuration object used for this selection operation.Returns: Promise
The handle for the selection context.
-
Selection.SelectionManager.beginRayDrillSelection() - beginRayDrillSelection(rayCssOrigin:
Point2, rayCssBoxRadius: number, config:IncrementalPickConfig, view:IView?): PromiseCreates 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:
Point2The 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:
IncrementalPickConfigThe 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.
-
Selection.SelectionManager.beginScreenSelectByArea() - beginScreenSelectByArea(areaCssMin:
Point2, areaCssMax:Point2, config:IncrementalPickConfig, view:IView?): PromiseCreates a new and active selection context for the provided selection window.
Parameters
areaCssMin:
Point2The minimum coordinate in css pixel space for the selection window.areaCssMax:
Point2The maximum coordinate in css pixel space for the selection window.config:
IncrementalPickConfigThe 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.
-
Selection.SelectionManager.beginSphereSelection() - beginSphereSelection(sphereCenter:
Point3, sphereRadius: number, config:IncrementalPickConfig): PromiseCreates a new and active selection context for the provided selection sphere.
Parameters
sphereCenter:
Point3The center of the selection sphere.sphereRadius: number
The radius of the selection sphere.config:
IncrementalPickConfigThe configuration object used for this selection operation.Returns: Promise
The handle for the selection context.
-
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
-
Selection.SelectionManager.contains() - contains(item:
SelectionItem): booleanParameters
item:SelectionItemReturns: boolean
-
Selection.SelectionManager.containsParent() - containsParent(item:
NodeSelectionItem): (None |NodeSelectionItem)Checks if the parent of a selection item is in the selection set.
Parameters
item:NodeSelectionItemReturns: (None |
NodeSelectionItem)parent selection item, or null if not found
-
Selection.SelectionManager.each() - each(func: (s:
NodeSelectionItem) => void): voidIterates 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) => voida function to be called for every selection item.Returns: void
-
Selection.SelectionManager.endIncrementalSelection() - endIncrementalSelection(handle:
IncrementalSelectionId): PromiseDeactivates and destroys the provided selection context.
Parameters
handle:
IncrementalSelectionIdThe selection context to destroy.Returns: Promise
-
Selection.SelectionManager.exportSelectionData() - exportSelectionData(): object[]
Exports selection objects so that they may be loaded back into the the system at a later time using loadSelectionData.
Returns: object[]
exported selection data.
-
Selection.SelectionManager.getFirst() - getFirst(): (None |
NodeSelectionItem)Gets the least recent selection item.
Returns: (None |
NodeSelectionItem)the least recently selected item (if any).
-
Selection.SelectionManager.getHighlightFaceElementSelection() - getHighlightFaceElementSelection(): boolean
Gets whether face elements will be highlighted on selection.
Returns: boolean
boolean the current value for face element selection highlighting.
-
Selection.SelectionManager.getHighlightLineElementSelection() - getHighlightLineElementSelection(): boolean
Gets whether line elements will be highlighted on selection.
Returns: boolean
boolean the current value for line element selection highlighting.
-
Selection.SelectionManager.getHighlightNodeSelection() - getHighlightNodeSelection(): boolean
Gets whether nodes will be highlighted on selection.
Returns: boolean
the current value for node selection highlighting.
-
Selection.SelectionManager.getHighlightPointElementSelection() - getHighlightPointElementSelection(): boolean
Gets whether point elements will be highlighted on selection.
Returns: boolean
boolean the current value for point element selection highlighting.
-
Selection.SelectionManager.getIgnoreEntityWhenTogglingChildSelection() - getIgnoreEntityWhenTogglingChildSelection(): boolean
Gets whether ignore entity when toggling child selection mode is enabled. See also: [[setIgnoreEntityWhenTogglingChildSelection]]
Returns: boolean
-
Selection.SelectionManager.getLast() - getLast(): (None |
NodeSelectionItem)Gets the most recent selection item.
Returns: (None |
NodeSelectionItem)the most recently selected item (if any).
-
Selection.SelectionManager.getNodeElementSelectionColor() - getNodeElementSelectionColor():
ColorGets the color to use for face and line selection.
Returns:
Colorthe color used for face and line selection.
-
Selection.SelectionManager.getNodeElementSelectionHighlightMode() - getNodeElementSelectionHighlightMode():
SelectionHighlightModeReturns:
SelectionHighlightMode
-
Selection.SelectionManager.getNodeElementSelectionOutlineColor() - getNodeElementSelectionOutlineColor():
ColorGets the color to use for outlining face and line selection.
Returns:
Colorcolor the color used for outlining face and line selection.
-
Selection.SelectionManager.getNodeSelectionColor() - getNodeSelectionColor():
ColorGets the color to be used when selecting nodes.
Returns:
Colorthe color that is applied to a selected node.
-
Selection.SelectionManager.getNodeSelectionHighlightMode() - getNodeSelectionHighlightMode():
SelectionHighlightModeGets the highlighting mode for selected nodes.
Returns:
SelectionHighlightModethe current
-
Selection.SelectionManager.getNodeSelectionOutlineColor() - getNodeSelectionOutlineColor():
ColorGets the color to be used for outlining the node selection.
Returns:
Colorthe color for node selection outline.
-
Selection.SelectionManager.getPickTolerance() - getPickTolerance(): number
Gets the pick tolerance in pixels for line and point picking.
The default value is 20.
Returns: number
number Pick tolerance value in pixels
-
Selection.SelectionManager.getPruneSelectionDescendants() - getPruneSelectionDescendants(): boolean
Gets whether descendant pruning is enabled. See also: [[setPruneSelectionDescendants]]
Returns: boolean
-
Selection.SelectionManager.getResult() - getResult(index: number): (None |
NodeSelectionItem)Gets a selection at the specified index. The first selected item will be at index 0.
Parameters
index: number
index of selection item to getReturns: (None |
NodeSelectionItem)the selection result at the given index.
-
Selection.SelectionManager.getResults() - getResults():
NodeSelectionItem[]Gets all current selection items.
Returns:
NodeSelectionItem[]array of all selection items.
-
Selection.SelectionManager.getSelectedLayers() - getSelectedLayers(): string[]
Gets all selected layers.
Returns: string[]
-
Selection.SelectionManager.getSelectedTypes() - getSelectedTypes(): string[]
Gets all selected IFC types.
Returns: string[]
-
Selection.SelectionManager.getSelectionFilter() - getSelectionFilter(): (None |
SelectionFilter)Returns: (None |
SelectionFilter)[[SelectionFilter]] function or null if none is set.
-
Selection.SelectionManager.getSelectParentIfSelected() - getSelectParentIfSelected(): boolean
Gets whether automatic parent selection is enabled. See also: [[setSelectParentIfSelected]]
Returns: boolean
-
Selection.SelectionManager.getSingleEntityToggleModeEnabled() - getSingleEntityToggleModeEnabled(): boolean
Gets whether single entity toggle mode is enabled. See also: [[setSingleEntityToggleModeEnabled]]
Returns: boolean
-
Selection.SelectionManager.getSuppressImplicitRemovalCallback() - getSuppressImplicitRemovalCallback(): boolean
Gets whether implicit removal callbacks are being suppressed See also: [[setSuppressImplicitRemovalCallback]]
Returns: boolean
-
Selection.SelectionManager.isNodeSelected() - isNodeSelected(nodeId: number): boolean
Checks whether a node, or its parents, appear in the selection set or not. Note: for the purposes of this function element selections on a node are considered the same as node selection.
Parameters
nodeId: number
Node to check forReturns: boolean
trueif the node or its parents appear in the selection set.falseotherwise
-
Selection.SelectionManager.isSelected() - isSelected(item:
SelectionItem): booleanParameters
item:SelectionItemReturns: boolean
-
Selection.SelectionManager.loadSelectionData() - loadSelectionData(datas: (string | object[])): void
Loads serialized selection items exported using [[exportSelectionData]] back into the [[SelectionManager]]. The current selection will be cleared. A selection event will be triggered for each loaded item. This method should not be called before the [[CallbackMap.modelStructureReady]] callback has been triggered.
Parameters
datas: (string | object[])Returns: void
-
Selection.SelectionManager.remove() - remove(itemOrItems: (
NodeSelectionItem|NodeSelectionItem[]), suppressCallback: boolean?): voidManually removes an item or an array of items from the selection set. Triggers a selection event.
Parameters
itemOrItems: (
NodeSelectionItem|NodeSelectionItem[])A selectionItem or an array of selection items that will be removed from the current selection set.suppressCallback: boolean = false
Optional boolean param to suppress the selectionArray callbacks calls to this generate.Returns: void
-
Selection.SelectionManager.selectAllFromPoint() - selectAllFromPoint(point:
Point2, config:PickConfig, selectionMode:SelectionMode?, view:IView?): PromisePerforms a selection operation from the given position on the canvas. All candidate entities are selected. This method triggers a selection event.
Parameters
point:
Point2The canvas position to select from.config:
PickConfigThe configuration object used for this picking operation.selectionMode:
SelectionMode= SelectionMode.SetThe mode to use for this selection.view:
IView= …The view to use when projecting the point into the scene.Returns: Promise
Promise that resolves when this operation has completed.
-
Selection.SelectionManager.selectAllFromRay() - selectAllFromRay(ray:
Ray, config:PickConfig, selectionMode:SelectionMode?, view:IView?): PromisePerforms a selection operation from the given world-space ray. All candidate entities are selected. This method triggers a selection event.
Parameters
ray:
RayThe world-space ray to perform the selection with.config:
PickConfigThe configuration object used for this picking operation.selectionMode:
SelectionMode= SelectionMode.SetThe mode to use for this selection.view:
IView= …The view to use when projecting the point into the scene.Returns: Promise
Promise that resolves when this operation has completed.
-
Selection.SelectionManager.selectFromPoint() - selectFromPoint(point:
Point2, config:PickConfig, selectionMode:SelectionMode?, view:IView?): PromisePerforms a selection operation from the given position on the canvas. The best candidate entity is selected. This method triggers a selection event.
Parameters
point:
Point2The canvas position to select from.config:
PickConfigThe configuration object used for this picking operation.selectionMode:
SelectionMode= SelectionMode.SetThe mode to use for this selection.view:
IView= …The view to use when projecting the point into the scene.Returns: Promise
Promise that resolves when this operation has completed.
-
Selection.SelectionManager.selectFromRay() Performs a selection operation from the given world-space ray. The best candidate entity is selected. This method triggers a selection event.
Parameters
ray:
RayThe world-space ray to perform the selection with.config:
PickConfigThe configuration object used for this picking operation.selectionMode:
SelectionMode= SelectionMode.SetThe mode to use for this selection.view:
IView= …The view to use when projecting the point into the scene.Returns: Promise
Promise that resolves when this operation has completed.
-
Selection.SelectionManager.selectLayer() - selectLayer(layerName: string, selectionMode:
SelectionMode): voidAdds all items in a layer to the selection set.
Parameters
layerName: string
selectionMode:
SelectionModeReturns: void
-
Selection.SelectionManager.selectNode() - selectNode(nodeId: (None | number), selectionMode:
SelectionMode?):SelectionTypeSelects a node with the given Id.
Parameters
nodeId: (None | number)
nodeId of the node to select. Pass null to clear the selection.selectionMode:
SelectionMode= SelectionMode.SetReturns:
SelectionTypethe selection type of this operation.
-
Selection.SelectionManager.selectType() - selectType(genericType: string, selectionMode:
SelectionMode): voidAdds all items with an IFC type to the selection set.
Parameters
genericType: string
selectionMode:
SelectionModeReturns: void
-
Selection.SelectionManager.set() - set(selection: (None |
NodeSelectionItem)): voidManually removes all currently selected items (if any) from the selection set and adds the supplied item. Triggers a selection event.
Parameters
selection: (None |NodeSelectionItem)Returns: void
-
Selection.SelectionManager.setHighlightFaceElementSelection() - setHighlightFaceElementSelection(highlightFaceElementSelection: boolean): Promise
Sets whether face elements should be highlighted when a selection occurs. By default the system will automatically highlight face elements associated with a selection item.
Parameters
highlightFaceElementSelection: boolean
value indicating whether selected face elements should be highlighted.Returns: Promise
-
Selection.SelectionManager.setHighlightLineElementSelection() - setHighlightLineElementSelection(highlightLineElementSelection: boolean): Promise
Sets whether line elements should be highlighted when a selection occurs. By default the system will automatically highlight line elements associated with a selection item.
Parameters
highlightLineElementSelection: boolean
value indicating whether selected line elements should be highlighted.Returns: Promise
-
Selection.SelectionManager.setHighlightNodeSelection() - setHighlightNodeSelection(highlightSelection: boolean): Promise
Sets whether nodes should be highlighted when a selection occurs. By default, the system will automatically highlight the node associated with a selection item.
Parameters
highlightSelection: booleanReturns: Promise
-
Selection.SelectionManager.setHighlightPointElementSelection() - setHighlightPointElementSelection(highlightPointElementSelection: boolean): Promise
Sets whether point elements should be highlighted when a selection occurs. By default the system will automatically highlight point elements associated with a selection item.
Parameters
highlightPointElementSelection: boolean
value indicating whether selected point elements should be highlighted.Returns: Promise
-
Selection.SelectionManager.setIgnoreEntityWhenTogglingChildSelection() - setIgnoreEntityWhenTogglingChildSelection(strictMode: boolean): void
Enables / disables ignore entity when toggling child selection mode.
When enabled, a [[NodeSelectionItem]] that has a selected ancestor may only be toggled if it does not contain an entity selection. A selection item without an entity selection is usually generated from selecting a node via a model tree control. A selection item containing an entity selection is usually generated as a result of a viewport picking operation.
This behavior is enabled by default. See Also: [[toggle]]
Parameters
strictMode: booleanReturns: void
-
Selection.SelectionManager.setNodeElementSelectionColor() - setNodeElementSelectionColor(color:
Color): PromiseSets the color to use for node element selection. This method should not be called before the sceneReady callback has been triggered.
Parameters
color:
Colorthe color to apply to selected node elements.Returns: Promise
-
Selection.SelectionManager.setNodeElementSelectionHighlightMode() - setNodeElementSelectionHighlightMode(highlightMode:
SelectionHighlightMode): PromiseSets the highlighting mode for selected node elements. The default behavior is to highlight the node element and render an overlay outline. This method should not be called before the sceneReady callback has been triggered.
Parameters
highlightMode:
SelectionHighlightModethe highlighting mode that will be applied to selected nodes.Returns: Promise
-
Selection.SelectionManager.setNodeElementSelectionOutlineColor() - setNodeElementSelectionOutlineColor(color:
Color): PromiseGets the color to use for outlining node element selection. This method should not be called before the sceneReady callback has been triggered.
Parameters
color:
Colorthe color used for outlining face and line selection.Returns: Promise
-
Selection.SelectionManager.setNodeSelectionColor() - setNodeSelectionColor(color:
Color): PromiseSets the color to be used when selecting nodes. This method should not be called before the sceneReady callback has been triggered.
Parameters
color:
Colorthe color to apply to the selected node.Returns: Promise
-
Selection.SelectionManager.setNodeSelectionHighlightMode() - setNodeSelectionHighlightMode(highlightMode:
SelectionHighlightMode): PromiseSets the highlighting mode for selected nodes. The default behavior is to highlight the node and render an overlay outline. This method should not be called before the sceneReady callback has been triggered.
Parameters
highlightMode:
SelectionHighlightModethe highlighting mode that will be applied to selected nodes.Returns: Promise
-
Selection.SelectionManager.setNodeSelectionOutlineColor() - setNodeSelectionOutlineColor(color:
Color): PromiseSets color for the node selection outline. This method should not be called before the sceneReady callback has been triggered.
Parameters
color:
Colorthe color to apply to the node selection outline.Returns: Promise
-
Selection.SelectionManager.setPickTolerance() - setPickTolerance(tolerance: number): void
Sets the pick tolerance in pixels for line and point picking. If a line or point is within this pixel tolerance of the click point, it will be prioritized over the face at the click position.
The default value is 20.
Parameters
tolerance: numberReturns: void
-
Selection.SelectionManager.setPruneSelectionDescendants() - setPruneSelectionDescendants(pruneSelectionDescendants: boolean): void
Enables / disables descendant pruning and clears the current selection set. When enabled, a parent and child will not be present in the same selection set. This behavior is enabled by default.
Parameters
pruneSelectionDescendants: booleanReturns: void
-
Selection.SelectionManager.setSelectionFilter() - setSelectionFilter(selectionFilter: (None |
SelectionFilter)): voidThis allows manipulating the selected NodeId. To reset the filter, set it to null.
Parameters
selectionFilter: (None |
SelectionFilter)function that manipulates the selected NodeId.Returns: void
-
Selection.SelectionManager.setSelectParentIfSelected() - setSelectParentIfSelected(selectParent: boolean): void
Enables / disables automatic parent selection. When enabled, if a selected part is selected again, its parent will be selected. This behavior is enabled by default.
Parameters
selectParent: booleanReturns: void
-
Selection.SelectionManager.setSingleEntityToggleModeEnabled() - setSingleEntityToggleModeEnabled(enabled: boolean): void
Enables / disables single entity toggle mode.
When enabled, limits the selection set to containing only one entity selection for each node id. Toggling with an entity selection that has the same node id as a [[NodeSelectionItem]] already in the selection set will remove that item from the selection set.
This behavior is disabled by default. See Also: [[toggle]]
Parameters
enabled: booleanReturns: void
-
Selection.SelectionManager.setSuppressImplicitRemovalCallback() - setSuppressImplicitRemovalCallback(suppress: boolean): void
Sets whether to generate selectionArray callbacks with implicitly removed nodes.
For example, consider the case where you have a parent node that has a multiple child nodes. Normally, if the parent begins selected and then a child is removed from the selection set there will be two selectionArray callbacks generated. The first will for the removal of the parent node. The second wil be for the addition of all of it’s children except the one that was initially removed.
When this behavior is enabled only a single selectionArray callback will be generated for the child node that was removed.
This behavior is disabled by default.
Parameters
suppress: booleanReturns: void
-
Selection.SelectionManager.size() - size(): number
Gets the number of selection items.
Returns: number
the number of selected items.
-
Selection.SelectionManager.toggle() - toggle(item:
NodeSelectionItem): voidManually adds or removes an item from the selection set. Triggers a selection event.
Parameters
item:NodeSelectionItemReturns: void