new SelectionHandler(selectionManager)
Creates a new BRep selection handler instance.
Parameters:
| Name | Type | Description |
|---|---|---|
selectionManager |
PD.SelectionManager | The selection manager to connect to. |
Extends
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
- Inherited From:
- Overrides:
-
:PD.BRep|null
currentBRep
-
The currently selected BRep within the model.
The currently selected BRep is one of the BReps within the
selectionSetarray that the user is currently primarily on. It is also the surface that owns thecurrentFace, thecurrentEdgeand thecurrentVertex, if any.Type
- PD.BRep | null
-
:Array.<PD.Point>|null
currentEdge
-
The currently selected edge within the current BRep.
The currently selected edge is the one the user is primarily focused on and is the basis for cursor manipulation. Any interactive manipulation of this edge is also applied to all other selected edges.
If there are any selected edges, this value must always reference one of them. It will only be
nullwhen there are no edges currently selected.Type
- Array.<PD.Point> | null
-
:PD.BRep.Face|null
currentFace
-
The currently selected face within the current BRep.
The currently selected face is the one the user is primarily focused on and is the basis for cursor manipulation. Any interactive manipulation of this face is also applied to all other selected faces.
If there are any selected faces, this value must always reference one of them. It will only be
nullwhen there are no faces currently selected.Type
- PD.BRep.Face | null
-
:PD.Point|null
currentVertex
-
The currently selected vertex within the current BRep.
The currently selected vertex is the one the user is primarily focused on and is the basis for cursor manipulation. Any interactive manipulation of this vertex is also applied to all other selected vertices.
If there are any selected vertices, this value must always reference one of them. It will only be
nullwhen there are no edges currently selected.Type
- PD.Point | null
-
:boolean
isSelectionHandler <readonly>
-
A flag identifying this object as a selection handler.
Type
- boolean
- Inherited From:
- Overrides:
-
: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
- Inherited From:
- Overrides:
-
: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
- Inherited From:
- Overrides:
Methods
-
addBRep(brep)
-
Adds the given BRep to the selection set.
If the selection set is empty, the BRep will be added and also made the current selection.
If the selection set is not empty and the current type is not set to
PD.SELECTION.BREP, then the BRep will not be added and the selection set will remain unchanged.Parameters:
Name Type Description brepPD.BRep The BRep to add to selection set.
Returns:
Returns true if BRep was added.
- Type
- boolean
-
addBReps(breps [, selectionSet])
-
Adds the given BRep faces to the selection set.
If the selection set type is not
PD.SELECTION.BREP_FACE, this method will clear any existing selection and set that type before adding the faces. If any of the items in the array are not valid faces, they will not be added.Parameters:
Name Type Argument Description brepsArray.<PD.BRep> The array of BReps to add to selection set.
selectionSetPD.SelectionSet <optional>
The selection set to add to, defaults to host selection manager's set.
Returns:
Returns true if any BReps were added.
- Type
- boolean
-
addEdge(brep, edge)
-
Adds the given edge to the selection set.
If the current type is not set to
PD.SELECTION.BREP_EDGE, the edge will not be added.Parameters:
Name Type Description brepPD.BRep The BRep containing the edge.
edgeArray.<PD.Point> The edge to add to selection set.
Returns:
Returns true if the BRep edge was added.
- Type
- boolean
-
addEdges(brep, edges [, selectionSet])
-
Adds the given BRep edges to the selection set.
If the selection set type is not
PD.SELECTION.BREP_EDGE, this method will clear any existing selection and set that type before adding the edges. If any of the items in the array are not valid edges, they will not be added.Parameters:
Name Type Argument Description brepPD.BRep The BRep containing the edges.
edgesArray.<PD.Point> The array of edges to add to selection set.
selectionSetPD.SelectionSet <optional>
The selection set to add to, defaults to host selection manager's set.
Returns:
Returns true if any BRep edges were added.
- Type
- boolean
-
addFace(brep, face)
-
Adds the given face to the selection set.
If the current type is not set to
PD.SELECTION.BREP_FACE, the face will not be added.Parameters:
Name Type Description brepPD.BRep The BRep containing the face.
facePD.BRep.Face The face to add to selection set.
Returns:
Returns true if the BRep face was added.
- Type
- boolean
-
addFaces(brep, faces [, selectionSet])
-
Adds the given BRep faces to the selection set.
If the selection set type is not
PD.SELECTION.BREP_FACE, this method will clear any existing selection and set that type before adding the faces. If any of the items in the array are not valid faces, they will not be added.Parameters:
Name Type Argument Description brepPD.BRep The BRep containing the faces.
facesArray.<PD.BRep.Face> The array of faces to add to selection set.
selectionSetPD.SelectionSet <optional>
The selection set to add to, defaults to host selection manager's set.
Returns:
Returns true if any BRep faces were added.
- Type
- boolean
-
addFoundItemsToSelection(mode, selection)
-
Search the
selection.foundItemsselection set and adds, removes or toggles items as per the select action mode.Parameters:
Name Type Description modePD.SELECT_ACTION The extended selection mode.
selectionPD.Selection The interactive selection accumulator.
- Inherited From:
- Overrides:
Returns:
Returns true if the selection set changed.
- Type
- boolean
-
addVertex(brep, vertex)
-
Adds the given vertex to the selection set.
If the current type is not set to
PD.SELECTION.BREP_VERTEX, the vertex will not be added.Parameters:
Name Type Description brepPD.BRep The BRep containing the vertex.
vertexPD.Point The vertex to add to selection set.
Returns:
Returns true if the BRep vertex was added.
- Type
- boolean
-
addVertices(brep, vertices [, selectionSet])
-
Adds the given BRep vertices to the selection set.
If the selection set type is not
PD.SELECTION.BREP_VERTEX, this method will clear any existing selection and set that type before adding the vertices. If any of the items in the array are not valid vertices, they will not be added.Parameters:
Name Type Argument Description brepPD.BRep The BRep containing the vertices.
verticesArray.<PD.Point> The array of vertices to add to selection set.
selectionSetPD.SelectionSet <optional>
The selection set to add to, defaults to host selection manager's set.
Returns:
Returns true if any BRep vertices were added.
- Type
- boolean
-
checkForExtendedSelection(action, type, selection)
-
Determines whether 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 actionPD.SELECT_ACTION The extended selection action.
typePD.SELECTION The BRep selection type.
selectionPD.Selection The interactive selection accumulator.
- Inherited From:
- Overrides:
Returns:
Returns true if the extended selection set was changed.
- Type
- boolean
-
clear()
-
Clears and empties the selection set.
- Inherited From:
- Overrides:
-
connectTo(selectionManager)
-
Initialises this instance for use with a selection manager.
Call this method to connect this instance to the application-wide selection manager. The connected selection manager's 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.
- Inherited From:
- Overrides:
-
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.
- Inherited From:
- Overrides:
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.
- Overrides:
Returns:
Returns true if something in the model was found and the selection set updated, otherwise false.
- Type
- boolean
-
findInExtendedSelectionByRay(selection, type [, event])
-
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 Argument Description selectionPD.Selection The interactive selection accumulator.
typePD.SELECTION The current selection type.
eventEvent <optional>
The DOM event that triggered this action.
- Inherited From:
- Overrides:
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.Brep.Selection#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.
- Inherited From:
- Overrides:
Returns:
Returns true if the selection set changed.
- Type
- boolean
-
foundBRep(selection, element, brep, forceSelect)
-
Check to assign a BRep as selected.
Parameters:
Name Type Description selectionPD.Selection The interactive selection accumulator.
elementBIM.Element | null The element containing the BRep, if any.
brepPD.BRep The BRep to select.
forceSelectboolean When true, ignores depth tests and forces selection.
Throws:
-
Throws an error if BRep is invalid.
- Type
- Error
Returns:
Returns true if this is the closest intersection to eye position.
- Type
- boolean
-
-
foundBRepEdge(selection, element, brep, edge, forceSelect)
-
Check to assign a BRep edge as selected.
Parameters:
Name Type Description selectionPD.Selection The interactive selection accumulator.
elementBIM.Element | null The element containing the BRep, if any.
brepPD.BRep The BRep that the edge belongs to.
edgeArray.<PD.Point> The selected edge within the BRep.
forceSelectboolean When true, ignores depth tests and forces selection.
Throws:
-
Throws an error if BRep is invalid or the selected edge not found within it.
- Type
- Error
Returns:
Returns true if this is the closest intersection to eye position.
- Type
- boolean
-
-
foundBRepFace(selection, element, brep, face, forceSelect)
-
Check to assign a BRep face as selected.
Parameters:
Name Type Description selectionPD.Selection The interactive selection accumulator.
elementBIM.Element | null The element containing the BRep, if any.
brepPD.BRep The BRep that the face belongs to.
facePD.BRep.Face The selected face within the BRep.
forceSelectboolean When true, ignores depth tests and forces selection.
Throws:
-
Throws an error if BRep is invalid or the selected face not found within it.
- Type
- Error
Returns:
Returns true if this is the closest intersection to eye position.
- Type
- boolean
-
-
foundBRepVertex(selection, element, brep, vertex, forceSelect)
-
Check to assign a BRep vertex as selected.
Parameters:
Name Type Description selectionPD.Selection The interactive selection accumulator.
elementBIM.Element | null The element containing the BRep, if any.
brepPD.BRep The BRep that the vertex belongs to.
vertexPD.Point The selected vertex within the BRep.
forceSelectboolean When true, ignores depth tests and forces selection.
Throws:
-
Throws an error if BRep is invalid or the selected vertex not found within it.
- Type
- Error
Returns:
Returns true if this is the closest intersection to eye position.
- Type
- boolean
-
-
getSelectedBReps()
-
Retrieves an array of the currently selected BReps.
Returns:
Returns an array of selected BReps.
- Type
- Array.<PD.BRep>
-
getSelectedEdges(brep)
-
Retrieves an array of selected edges in the given BRep.
Parameters:
Name Type Description brepPD.BRep The BRep to obtain selection data for.
Returns:
Returns an array of selected edges in this BRep.
- Type
- Array.<PD.Point>
-
getSelectedFaces(brep)
-
Retrieves an array of selected faces in the given BRep.
Parameters:
Name Type Description brepPD.BRep The BRep to obtain selection data for.
Returns:
Returns an array of selected faces in this BRep.
- Type
- Array.<PD.BRep.Face>
-
getSelectedVertices(brep)
-
Retrieves an array of selected vertices in the given BRep.
Parameters:
Name Type Description brepPD.BRep The BRep to obtain selection data for.
Returns:
Returns an array of selected vertices in this BRep.
- Type
- Array.<PD.Point>
-
hasBRep(brep)
-
Checks if the selection set contains the given BRep.
Parameters:
Name Type Description brepPD.BRep The BRep to check for.
Returns:
Returns true if selection set contains the BRep.
- Type
- boolean
-
hasEdge(brep, edge)
-
Checks if the selection set contains the given edge.
Parameters:
Name Type Description brepPD.BRep The BRep containing the edge.
edgeArray.<PD.Point> The edge to check for in selection set.
Returns:
Returns true if selection set contains the edge.
- Type
- boolean
-
hasFace(brep, face)
-
Checks if the selection set contains the given face.
Parameters:
Name Type Description brepPD.BRep The BRep containing the face.
facePD.BRep.Face The face to check for in selection set.
Returns:
Returns true if selection set contains the face.
- Type
- boolean
-
hasVertex(brep, vertex)
-
Checks if the selection set contains the given vertex.
Parameters:
Name Type Description brepPD.BRep The BRep containing the vertex.
vertexPD.Point The vertex to check for in selection set.
Returns:
Returns true if selection set contains the vertex.
- Type
- boolean
-
highlightBRep(mesh, brep)
-
Renders the given BRep as highlighted using the given mesh.
Parameters:
Name Type Description meshPD.PolyMesh he mesh to receive the highlight geometry.
brepPD.BRep The BRep to render as highlighted.
-
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.
- Inherited From:
- Overrides:
-
highlightEdge(mesh, edge, size)
-
Renders the given BRep as highlighted using the given mesh.
Parameters:
Name Type Description meshPD.PolyMesh The mesh to receive the highlight geometry.
edgeArray.<PD.Point> The BRep edge to render as highlighted.
sizenumber The size to render features at.
-
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.
- Inherited From:
- Overrides:
-
highlightFace(mesh, face)
-
Renders the given BRep as highlighted using the given mesh.
Parameters:
Name Type Description meshPD.PolyMesh The mesh to receive the highlight geometry.
facePD.BRep.Face The BRep face to render as highlighted.
-
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.
- Inherited From:
- Overrides:
-
highlightVertex(mesh, vertex, size)
-
Renders the given BRep as highlighted using the given mesh.
Parameters:
Name Type Description meshPD.PolyMesh The mesh to receive the highlight geometry.
vertexPD.Point The BRep vertex to render as highlighted.
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 simply copies 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, type)
-
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 will be made current and the rest of the selection left unchanged.
Parameters:
Name Type Description selectionPD.Selection The interactive selection accumulator.
typePD.SELECTION The current selection type.
- Inherited From:
- Overrides:
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.
- Inherited From:
- Overrides:
-
moveByVector3(vector)
-
Move the selection by a relative vector.
Parameters:
Name Type Description vectorTHREE.Vector3 The relative movement vector.
- Inherited From:
- Overrides:
-
removeBReps(breps)
-
Removes the given BReps from the selection set.
Parameters:
Name Type Description brepsArray.<PD.BRep> The array of BReps to remove from selection set.
Returns:
returns true if any BReps were removed.
- Type
- boolean
-
removeEdges(brep, edges [, selectionSet])
-
Removes the given edges from the selection set.
Parameters:
Name Type Argument Description brepPD.BRep The BRep containing the edges.
edgesArray.<PD.Point> The array of edges to remove from selection set.
selectionSetPD.SelectionSet <optional>
The selection set to add to, defaults to host selection manager's set.
Returns:
Returns true if any BReps were removed.
- Type
- boolean
-
removeFaces(brep, faces)
-
Removes the given faces from the selection set.
Parameters:
Name Type Description brepPD.BRep The BRep containing the faces.
facesArray.<PD.BRep.Face> The array of faces to remove from selection set.
Returns:
Returns true if any faces were removed.
- Type
- boolean
-
removeVertices(brep, vertices [, selectionSet])
-
Removes the given vertices from the selection set.
Parameters:
Name Type Argument Description brepPD.BRep The BRep containing the vertices.
verticesArray.<PD.Point> The array of vertices to remove from selection set.
selectionSetPD.SelectionSet <optional>
The selection set to add to, defaults to host selection manager's set.
Returns:
Returns true if any BRep vertices were removed.
- Type
- boolean
-
selectBRep(brep)
-
Sets the given BRep as the primary selected BRep.
If this BRep does not already exist within the selection set, the selection set will be cleared before setting it.
Parameters:
Name Type Description brepPD.BRep The BRep containing the face.
Returns:
Returns true if the current selection changed.
- Type
- boolean
-
selectEdge(brep, edge)
-
Sets the given edge as the primary selected edge.
If this edge does not already exist within the selection set, the selection set will be cleared before setting it.
Parameters:
Name Type Description brepPD.BRep The BRep containing the edge.
edgeArray.<PD.Point> The edge to select and make current.
Returns:
Returns true if the current selection changed.
- Type
- boolean
-
selectFace(brep, face)
-
Sets the given face as the currently selected face.
If this face does not already exist within the selection set, the selection set will be cleared before setting it.
Parameters:
Name Type Description brepPD.BRep The BRep containing the face.
facePD.BRep.Face The face to select and make current.
Returns:
Returns true if the current selection changed.
- Type
- boolean
-
selectVertex(brep, vertex)
-
Sets the given vertex as the primary selected vertex.
If this vertex does not already exist within the selection set, the selection set will be cleared before setting it.
Parameters:
Name Type Description brepPD.BRep The BRep containing the vertex.
vertexPD.Point The vertex to select and make current.
Returns:
Returns true if the current selection changed.
- Type
- boolean
-
setSelection(selection)
-
Sets the current selection from the given selection data.
Parameters:
Name Type Description selectionPD.Selection The interactive selection accumulator.
- Overrides:
Returns:
Returns true if currently selected item(s) changed.
- Type
- boolean