new SelectionHandler(selectionManager)
Creates a new selection handler instance.
Parameters:
| Name | Type | Description |
|---|---|---|
selectionManager |
PD.SelectionManager | The selection manager to connect to. |
Members
-
:PD.SelectionSet
_selectionSet
-
Stores the selected items.
This property is set by the
PD.SelectionHandler#connectTomethod, and is a direct reference to thePD.SelectionManager#selectionSetproperty you are using. It is used to store one or more selected items and the sub-items currently selected within them.Type
-
:boolean
isSelectionHandler <readonly>
-
A flag identifying this object as a selection handler.
Type
- boolean
-
:PD.SelectionManager
selectionManager
-
Stores the selection manager using this handler.
This property is set by the
PD.SelectionHandler#connectTomethod, called with the application-widePD.SelectionManagerinstance.Type
-
:PD.SelectionSet
selectionSet <readonly>
-
Stores the current selection set.
This property is set by the
PD.SelectionHandler#connectTomethod, and is a direct reference to thePD.SelectionManager#selectionSetproperty you are using. It is used to store one or more selected items and the sub-items currently selected within them.Type
Methods
-
addFoundItemsToSelection(mode, selection)
-
Search the
selection.foundItemsselection set and add, remove or toggle items as per the select action mode.Parameters:
Name Type Description modePD.SELECT_ACTION The extended selection mode.
selectionPD.Selection The interactive selection accumulator.
Returns:
Returns true if the selection set changed.
- Type
- boolean
-
checkForExtendedSelection(mode, type, selection)
-
Determines whether newly selected items are added to, removed from or toggled within the current selection set.
This method is called by the
PD.SelectionManager.checkForExtendedSelectionmethod when the selection mode is notPD.SELECT_ACTION.REPLACE.Parameters:
Name Type Description modePD.SELECT_ACTION The extended selection mode.
typePD.SELECTION The selection type.
selectionPD.Selection The interactive selection accumulator.
Returns:
Returns true if the extended selection set was changed.
- Type
- boolean
-
clear()
-
Clears and empties the selection set.
-
connectTo(selectionManager)
-
Initialises this instance for use with a selection manager.
Call this method to connect this instance to a selection set that is shared by the selection manager. The connected selection set is used to store one or more BReps and the faces, edges or vertices currently selected within them.
Parameters:
Name Type Description selectionManagerPD.SelectionManager The selection manager for this handler.
-
expandSelection(type [, item])
-
Selects all junctions in each path or all apertures in each junction.
Parameters:
Name Type Argument Description typePD.SELECTION The current selection type.
itemany <optional>
An optional item to expand, defaults to all selected items.
Returns:
Returns true if the selection changed, otherwise false.
- Type
- boolean
-
extendSelectionByRay(type, selection)
-
Searches for the closest item based on the given type.
If something is found. this method fills out the
selectionobject with information on the closest item.Parameters:
Name Type Description typePD.SELECTION The current selection type.
selectionPD.Selection The interactive selection accumulator.
Returns:
Returns true if something in the model was found and the selection set updated, otherwise false.
- Type
- boolean
-
findInExtendedSelectionByRay(selection)
-
Checks if the user's intent is to select an already selected item.
This method is used to determine if the user is selecting an existing item in the extended selection set, or choosing something new. It is called during pre-selection and first checks for proximity to items in the current selection set, but only when the selection set has multiple items.
The
PD.SelectionManager#makeExtendedSelectionItemCurrentmethod is then called when the selection pointer/touch is released to process the selection and detect a re-selection.Parameters:
Name Type Description selectionPD.Selection The interactive selection accumulator.
Returns:
Returns true if an already selected item was re-selected, otherwise false.
- Type
- boolean
-
findItemsByFrustum(selection, type [, event])
-
Finds items inside or touching the selection frustum and adds them to the
selection.foundItemsselection set.This find-and-collect phase is separate from actual selection as we first need to find all the items, and then in the next phase work out if we should add, remove or toggle them. This is done in the
PD.SelectionHandler#handleExtendedSelectionmethod.Parameters:
Name Type Argument Description selectionPD.Selection The interactive selection accumulator.
typePD.SELECTION The current selection type.
eventEvent <optional>
The DOM event that triggered this action.
Returns:
Returns true if the selection set changed.
- Type
- boolean
-
highlightCurrentSelection(renderData, type)
-
Renders the current selection as highlighted with the given mesh.
Parameters:
Name Type Description renderDataobject An object containing meshes and view-specific data.
Properties of
renderData:Name Type Description meshSurfacePD.PolyMesh The mesh to render triangulated surfaces to.
meshOutlinePD.PolyMesh The mesh to render edges and outlines to.
pointSizenumber A reference point size based on the current model size and view.
dashSizeobject A size for dashed lines based on the current model size and view.
nodeSizeobject A size for selectable nodes in the current model size and view.
typePD.SELECTION The current selection type.
-
highlightExtendedSelection(renderData, type)
-
Renders the extended selection set as highlighted with the given mesh.
Parameters:
Name Type Description renderDataobject An object containing meshes and view-specific data.
Properties of
renderData:Name Type Description meshSurfacePD.PolyMesh The mesh to render triangulated surfaces to.
meshOutlinePD.PolyMesh The mesh to render edges and outlines to.
pointSizenumber A reference point size based on the current model size and view.
dashSizeobject A size for dashed lines based on the current model size and view.
nodeSizeobject A size for selectable nodes in the current model size and view.
typePD.SELECTION The current selection type.
-
highlightSelection(mesh, selection, size)
-
Renders the given selection as highlighted with the given mesh.
This method is called by the
PD.SelectionManager#updatePreSelectionmethod to populate the pre-selection mesh when the user first makes a selection action within the canvas.Parameters:
Name Type Description meshPD.PolyMesh The mesh to receive the highlight geometry.
selectionPD.Selection The interactive selection accumulator.
sizenumber The size to render features at.
-
initialiseExtendedSelection(type)
-
Initialises the selection set with the current selection.
This method is called AFTER the current selection is updated and should simply copy the current selection into the extended selection set.
Parameters:
Name Type Description typePD.SELECTION The selection type.
Returns:
Returns true if currently selected item(s) changed.
- Type
- boolean
-
makeExtendedSelectionItemCurrent(selection)
-
Checks the selection data to see if item is already in the selection set.
This method checks if the selected item is already in the extended selection set and, if so, it should be made current and the rest of the selection left unchanged.
Parameters:
Name Type Description selectionPD.Selection The interactive selection accumulator.
Returns:
Returns true if currently selected item changed.
- Type
- boolean
-
moveByMatrix4(matrix)
-
Transforms the selection by applying the matrix to it.
Parameters:
Name Type Description matrixTHREE.Matrix4 The transform matrix to apply to the element.
-
moveByVector3(vector)
-
Move the selection by a relative vector.
Parameters:
Name Type Description vectorTHREE.Vector3 The relative movement vector.
-
setSelection(selection)
-
Sets the current selection from the given accumulated selection data.
Parameters:
Name Type Description selectionPD.Selection The interactive selection accumulator.
Returns:
Returns true if currently selected item(s) changed.
- Type
- boolean
-
isSelectionHandlerClass() <static>
-
Indicates that this is an selection handler class rather than instance.