new SelectionHandler(selectionManager)
Creates a new path 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:
-
:BIM.Aperture|null
currentAperture
-
Stores the currently selected aperture.
Whilst there can be multiple selected openings stored in the
selectionSetmap, this represents the first and closest to the initial selection click. It is used mainly when dragging and to set the direction vector of the opening cursor.Type
- BIM.Aperture | null
-
:number
currentApertureIndex
-
Stores the index of the current aperture in the selected line segment.
Type
- number
-
:Array|null
currentContour
-
Stores the currently selected contour array.
Type
- Array | null
-
:number
currentContourIndex
-
Stores the index of the currently selected contour array.
Type
- number
-
:BIM.Element|null
currentElement
-
Stores the currently selected model element.
Whilst there can be multiple selected elements stored in the
selectionSetmap, this represents the primary selection (usually closest to the initial selection ray or first in a region-based selection) and is the one that subsequent actions/selections are always based on.Type
- BIM.Element | null
-
:BIM.Element|null
currentHierarchy
-
Stores the currently selected hierarchy.
This is used by the UI when dynamically switching between tabs showing different selection levels. It needs to be part of the selection manager so that it can be updated when the selection set changes, but independent of tab settings.
Type
- BIM.Element | null
-
:BIM.Junction|null
currentJunction
-
Stores the actual currently selected contour point.
Type
- BIM.Junction | null
-
:number
currentJunctionIndex
-
Stores the index of the currently selected contour point.
Type
- number
-
:BIM.Aperture|null
currentNode
-
Stores the currently selected junction node.
Whilst there can be multiple selected noed stored in the
selectionSetmap, this represents the first and closest to the initial selection click. It is used mainly when dragging and editing to set the cursor.Type
- BIM.Aperture | null
-
:number
currentNodeIndex
-
Stores the index of the current node in the selected junction.
Type
- number
-
:BIM.Path|null
currentPath
-
Stores the currently selected path in model element.
Whilst there can be multiple selected paths stored in the
selectionSetmap, this represents the primary selection (usually closest to the initial selection ray or first in a region-based selection) and is the one that subsequent actions/selections are always based on.Type
- BIM.Path | null
-
:BIM.Junction
currentSegment
-
Stores the start junction of the currently selected path segment.
Whilst there can be multiple selected segments stored in the
selectionSetmap, this represents the first and closest to the initial selection click. It is used mainly when dragging and to set the direction vector of the 1D cursor. It is also the one that will be deleted or inserted into.Type
-
:number
currentSegmentIndex
-
Stores the index of the segment in the selected path.
Type
- number
-
:boolean
isSelectionHandler <readonly>
-
A flag identifying this object as a selection handler.
Type
- boolean
- Inherited From:
- Overrides:
-
:object
nodeSelection
-
Stores information for selecting and editing curve control nodes.
Selecting and editing a curve control node should not affect the current selection set, unless the user clicks away. Thus, control nodes can only be selected when displayed as part of an existing selection, and the switch between node and previous selection should be seamless.
Type
- object
-
: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
-
addAperture(path, aperture)
-
Adds the given aperture to the selection set.
If the current type is not set to
PD.SELECTION.APERTURE, the aperture will not be added.Parameters:
Name Type Description pathBIM.Path The path containing the aperture.
apertureBIM.Aperture The aperture to add to selection set.
Returns:
Returns true if the path aperture was added.
- Type
- boolean
-
addApertures(path, apertures [, selectionSet])
-
Adds the given path apertures to the selection set.
If the selection set type is not
PD.SELECTION.APERTURE, this method will clear any existing selection and set that type before adding the apertures. If any of the items in the array are not valid apertures, they will not be added.When using this method, you must ensure that you also set one of the apertures as the current selection using the
BIM.Path.Selection.selectAperturemethod.Parameters:
Name Type Argument Description pathBIM.Path The path containing the apertures.
aperturesArray.<BIM.Aperture> The array of apertures 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 path apertures were added.
- Type
- boolean
-
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.
- Inherited From:
- Overrides:
Returns:
Returns true if the selection set changed.
- Type
- boolean
-
addJunction(path, junction)
-
Adds the given junction to the selection set.
If the current type is not set to
PD.SELECTION.JUNCTION, the junction will not be added.Parameters:
Name Type Description pathBIM.Path The path containing the junction.
junctionBIM.Junction The junction to add to selection set.
Returns:
Returns true if the path junction was added.
- Type
- boolean
-
addJunctions(path, junctions [, selectionSet])
-
Adds the given path junctions to the selection set.
If the selection set type is not
PD.SELECTION.JUNCTION, this method will clear any existing selection and set that type before adding the junctions. If any of the items in the array are not valid junctions, they will not be added.When using this method, you must ensure that you also set one of the junctions as the current selection using the
BIM.Path.Selection.selectJunctionmethod.Parameters:
Name Type Argument Description pathBIM.Path The path containing the junctions.
junctionsArray.<BIM.Junction> The array of junctions 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 path junctions were added.
- Type
- boolean
-
addNode(path, junction, node)
-
Adds the given node to the selection set.
If the current type is not set to
PD.SELECTION.NODE, the node will not be added.Parameters:
Name Type Description pathBIM.Path The path containing the node.
junctionBIM.Junction The junction the node belongs to.
nodePD.Point The node to select and make current.
Returns:
Returns true if the path node was added.
- Type
- boolean
-
addNodes(path, junction, nodes [, selectionSet])
-
Adds the given path nodes to the selection set.
If the selection set type is not
PD.SELECTION.NODE, this method will clear any existing selection and set that type before adding the nodes. If any of the items in the array are not valid nodes, they will not be added.When using this method, you must ensure that you also set one of the nodes as the current selection using the
BIM.Path.Selection.selectNodemethod.Parameters:
Name Type Argument Description pathBIM.Path The path containing the nodes.
junctionBIM.Junction The junction the node belongs to.
nodesArray.<PD.Point> The array of nodes 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 path nodes were added.
- Type
- boolean
-
addPath(path)
-
Adds the given path to the selection set.
If the selection set is empty, the path 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.PATH, then the path will not be added and the selection set will remain unchanged.Parameters:
Name Type Description pathBIM.Path The path to add to selection set.
Returns:
Returns true if path was added.
- Type
- boolean
-
addPaths(paths [, selectionSet])
-
Adds the given path faces to the selection set.
If the selection set type is not
PD.SELECTION.PATH, 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 paths, they will not be added.Parameters:
Name Type Argument Description pathsArray.<BIM.Path> The array of paths 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 paths were added.
- Type
- boolean
-
addSegment(path, segment)
-
Adds the given segment to the selection set.
If the current type is not set to
PD.SELECTION.SEGMENT, the segment will not be added.Parameters:
Name Type Description pathBIM.Path The path containing the segment.
segmentBIM.Junction The segment to add to selection set.
Returns:
Returns true if the path segment was added.
- Type
- boolean
-
addSegments(path, segments [, selectionSet])
-
Adds the given path segments to the selection set.
If the selection set type is not
PD.SELECTION.SEGMENT, this method will clear any existing selection and set that type before adding the segments. If any of the items in the array are not valid segments, they will not be added.When using this method, you must ensure that you also set one of the segments as the current selection using the
BIM.Path.Selection.selectSegmentmethod.Parameters:
Name Type Argument Description pathBIM.Path The path containing the segments.
segmentsArray.<BIM.Junction> The array of segments 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 path segments 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 path 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:
-
clearClosestSelection(selection)
-
Clear any closest items from the selection.
Parameters:
Name Type Description selectionPD.Selection The interactive selection accumulator.
-
clearCurrentSelection()
-
Clears the current selection set.
-
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 paths and the junctions, apertures or nodes currently selected within them.
Parameters:
Name Type Description selectionManagerPD.SelectionManager The selection manager for this handler.
- Inherited From:
- Overrides:
-
expandSelection(type [, path])
-
Selects all junctions in each path or all apertures in each junction.
Parameters:
Name Type Argument Description typePD.SELECTION The current selection type.
pathBIM.Path <optional>
An optional path to expand, defaults to all selected paths.
- 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.
- Inherited From:
- Overrides:
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.
- Inherited From:
- Overrides:
Returns:
Returns true if the selection set changed.
- Type
- boolean
-
foundPath(selection, element, path, forceSelect)
-
Check to assign a path as selected.
Parameters:
Name Type Description selectionPD.Selection The interactive selection accumulator.
elementBIM.Element | null The element containing the path, if any.
pathPD.Path The path to select.
forceSelectboolean When true, ignores depth tests and forces selection.
Throws:
-
Throws an error if path is invalid.
- Type
- Error
Returns:
Returns true if this is the closest intersection to eye position.
- Type
- boolean
-
-
getSelectedApertures(path)
-
Retrieves an array of selected apertures in the given path.
Parameters:
Name Type Description pathBIM.Path The path to obtain selection data for.
Returns:
Returns an array of selected apertures in this path.
- Type
- Array.<BIM.Aperture>
-
getSelectedJunctions(path)
-
Retrieves an array of selected junctions in the given path.
Parameters:
Name Type Description pathBIM.Path The path to obtain selection data for.
Returns:
Returns an array of selected junctions in this path.
- Type
- Array.<BIM.Junction>
-
getSelectedNodes(path)
-
Retrieves an array of selected nodes in the given path.
Parameters:
Name Type Description pathBIM.Path The path to obtain selection data for.
Returns:
Returns an array of selected nodes in this path.
- Type
- Array.<PD.Point>
-
getSelectedPaths()
-
Retrieves an array of the currently selected paths.
Returns:
Returns an array of selected paths.
- Type
- Array.<BIM.Path>
-
getSelectedSegments(path)
-
Retrieves an array of selected segments in the given path.
Parameters:
Name Type Description pathBIM.Path The path to obtain selection data for.
Returns:
Returns an array of selected segments in this path.
- Type
- Array.<BIM.Junction>
-
hasAperture(path, aperture)
-
Checks if the selection set contains the given aperture.
Parameters:
Name Type Description pathBIM.Path The path containing the aperture.
apertureBIM.Aperture The aperture to check for in selection set.
Returns:
Returns true if selection set contains the aperture.
- Type
- boolean
-
hasJunction(path, junction)
-
Checks if the selection set contains the given junction.
Parameters:
Name Type Description pathBIM.Path The path containing the junction.
junctionBIM.Junction The junction to check for in selection set.
Returns:
Returns true if selection set contains the junction.
- Type
- boolean
-
hasNode(path, node)
-
Checks if the selection set contains the given node.
Parameters:
Name Type Description pathBIM.Path The path containing the node.
nodePD.Point The node to check for in selection set.
Returns:
Returns true if selection set contains the node.
- Type
- boolean
-
hasPath(path)
-
Checks if the selection set contains the given path.
Parameters:
Name Type Description pathBIM.Path The path to check for.
Returns:
Returns true if selection set contains the path.
- Type
- boolean
-
hasSegment(path, segment)
-
Checks if the selection set contains the given segment.
Parameters:
Name Type Description pathBIM.Path The path containing the segment.
segmentBIM.Junction The segment to check for in selection set.
Returns:
Returns true if selection set contains the segment.
- Type
- boolean
-
highlightAperture(mesh_outline, mesh_surface, aperture, size)
-
Adds the facets of an aperture to the given mesh.
Parameters:
Name Type Description mesh_outlinePD.PolyMesh The mesh to receive highlight lines.
mesh_surfacePD.PolyMesh The mesh to receive highlight surfaces.
apertureBIM.Aperture The aperture to highlight.
sizenumber The indicator size in model units.
-
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:
-
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:
-
highlightJunction(mesh, junction, size)
-
Adds a highlighted path vertex/junction to the given mesh.
Parameters:
Name Type Description meshPD.PolyMesh The mesh to receive the highlight geometry.
junctionBIM.Junction The path junction to highlight.
sizenumber The indicator size in model units.
-
highlightJunctionFacets(mesh, path [, junction])
-
Adds the facets that belong to a junction to the given mesh.
Parameters:
Name Type Argument Default Description meshPD.PolyMesh The mesh to receive the highlight geometry.
pathPD.Polyline The polyline with the contour outline to highlight.
junctionBIM.Junction <optional>
null An optional junction containing facets.
-
highlightNode(mesh, node, size)
-
Renders the given path as highlighted using the given mesh.
Parameters:
Name Type Description meshPD.PolyMesh The mesh to receive the highlight geometry.
nodePD.Point The path node to render as highlighted.
sizenumber The size to render features at.
-
highlightPath(mesh, path)
-
Renders the given path as highlighted using the given mesh.
Parameters:
Name Type Description meshPD.PolyMesh The mesh to receive the highlight geometry.
pathBIM.Path The path to render as highlighted.
-
highlightPathContour(mesh, path, size [, contour])
-
Adds a highlighted path/polyline outline to the given mesh.
Parameters:
Name Type Argument Default Description meshPD.PolyMesh The mesh to receive the highlight geometry.
pathPD.Polyline The polyline with the contour outline to highlight.
sizenumber The indicator size in model units.
contourArray.<PD.Point> <optional>
null The contour to highlight, defaults to first in poly.
-
highlightSegment(mesh, segment, size)
-
Adds a highlighted path segment to the given mesh.
Parameters:
Name Type Description meshPD.PolyMesh The mesh to receive the highlight geometry.
segmentBIM.Junction The junction segment highlight.
sizenumber The indicator size in model units.
-
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:
-
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.
- Inherited From:
- Overrides:
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.
- 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:
-
removeApertures(path, apertures)
-
Removes the given apertures from the selection set.
Parameters:
Name Type Description pathBIM.Path The path containing the apertures.
aperturesArray.<BIM.Aperture> The array of apertures to remove from selection set.
Returns:
Returns true if any apertures were removed.
- Type
- boolean
-
removeJunctions(path, junctions)
-
Removes the given junctions from the selection set.
Parameters:
Name Type Description pathBIM.Path The path containing the junctions.
junctionsArray.<BIM.Junction> The array of junctions to remove from selection set.
Returns:
Returns true if any junctions were removed.
- Type
- boolean
-
removeNodes(path, nodes)
-
Removes the given nodes from the selection set.
Parameters:
Name Type Description pathBIM.Path The path containing the nodes.
nodesArray.<Array.<PD.Point>> The array of nodes to remove from selection set.
Returns:
Returns true if any paths were removed.
- Type
- boolean
-
removePaths(paths)
-
Removes the given paths from the selection set.
Parameters:
Name Type Description pathsArray.<BIM.Path> The array of paths to remove from selection set.
Returns:
Returns true if any paths were removed.
- Type
- boolean
-
removeSegments(path, segments)
-
Removes the given segments from the selection set.
Parameters:
Name Type Description pathBIM.Path The path containing the segments.
segmentsArray.<BIM.Junction> The array of segments to remove from selection set.
Returns:
Returns true if any paths were removed.
- Type
- boolean
-
selectAperture(path, aperture)
-
Sets the given aperture as the currently selected aperture.
If this aperture does not already exist within the selection set, the selection set will be cleared before setting it.
Parameters:
Name Type Description pathBIM.Path The path containing the aperture.
apertureBIM.Aperture The aperture to select and make current.
Returns:
Returns true if the current selection changed.
- Type
- boolean
-
selectJunction(path, junction)
-
Sets the given junction as the currently selected junction.
If this junction does not already exist within the selection set, the selection set will be cleared before setting it.
Parameters:
Name Type Description pathBIM.Path The path containing the junction.
junctionBIM.Junction The junction to select and make current.
Returns:
Returns true if the current selection changed.
- Type
- boolean
-
selectNode(path, junction, node)
-
Sets the given node as the primary selected node.
If this node does not already exist within the selection set, the selection set will be cleared before setting it.
Parameters:
Name Type Description pathBIM.Path The path containing the node.
junctionBIM.Junction The junction the node belongs to.
nodePD.Point The node to select and make current.
Returns:
Returns true if the current selection changed.
- Type
- boolean
-
selectPath(path [, contourIndex])
-
Sets the given path as the primary selected path.
If this path does not already exist within the selection set, the selection set will be cleared before setting it.
Parameters:
Name Type Argument Description pathBIM.Path The path containing the face.
contourIndexnumber <optional>
The contour to edit within the path, defaults to 0.
Returns:
Returns true if the current selection changed.
- Type
- boolean
-
selectSegment(path, segment)
-
Sets the given segment as the primary selected segment.
If this segment does not already exist within the selection set, the selection set will be cleared before setting it.
Parameters:
Name Type Description pathBIM.Path The path containing the segment.
segmentBIM.Junction The segment to select and make current.
Returns:
Returns true if the current selection changed.
- Type
- boolean
-
setSelection(selection)
-
Sets the current selection from the given accumulated selection data.
Parameters:
Name Type Description selectionPD.Selection The interactive selection accumulator.
- Inherited From:
- Overrides:
Returns:
Returns true if currently selected item(s) changed.
- Type
- boolean