new Selection()
Creates a new selection data instance.
Members
-
:BIM.Aperture|null
closestAperture
-
The closest intersected
BIM.Apertureobject.Type
- BIM.Aperture | null
-
:number
closestApertureIndex
-
The index of the closest intersected
BIM.Aperturein a junction'sopeningListarray.Type
- number
-
:PD.BRep|null
closestBRep
-
The closest
PD.BRepwithin an element.This value is set when
BIM.Elementis selected by picking on one of the faces of the BRep that define its shape.Type
- PD.BRep | null
-
:Array.<PD.Point>|null
closestBRepEdge
-
The closest edge within the closest surface.
This value is set when one of the edges of a
PD.BRepthat defines an element is selected.Type
- Array.<PD.Point> | null
-
:PD.BRep.Face|null
closestBRepFace
-
The closest
PD.BRep.Facewithin the surface of an element.This value is set when one of the facets of a
PD.BRepthat defines an element's geometry is selected.Type
- PD.BRep.Face | null
-
:PD.Point|null
closestBRepVertex
-
The closest vertex within the closest surface.
This value is set when one of the vertices of a
PD.BRepthat defines an element is selected.Type
- PD.Point | null
-
:Array|null
closestContour
-
The contour of the selected element path that the closest vertex belongs to.
This value is set when a linear or curved path running between two vertices within the path of a building element is selected. This contour will always belong to
closestElement.path.Type
- Array | null
-
:number
closestContourIndex
-
The index of the closest contour within the closest element path.
This is set when either a path vertex is selected directly or the ray is closest to the line between this vertex and the next within the path of a building element. It is the ordinal index within a
closestElement.pathcontour.Type
- number
-
:number
closestDepth
-
The distance between the eye position and closest intersection point.
This is set within the
found*()methods, typically measured from the selection ray origin to thePD.Selection#intersectionposition.Type
- number
-
:BIM.Element|null
closestElement
-
The
BIM.Elementobject closest to the selection ray.This value is set when the user selects an object or one of its features, such as a control point, vertex, segment, face or opening. This will always be set to a valid selectable element whenever the
selectedTypeproperty is not set toPD.SELECTED.NONE.Type
- BIM.Element | null
-
:THREE.Vector3
closestIntersection
-
The closest intersection point on a selected facet or line.
When a selection is made by intersection with a facet or closest point to a path segment, this value stores the intersection or closest point.
Type
- THREE.Vector3
-
:PD.Point|null
closestJunction
-
The closest
BIM.Junctionposition within the closest element or path.This value is set when an actual vertex position within the path of an element is selected. This vertex will always be contained within
PD.Selection#closestContourandPD.Selection#closestJunctionIndexwill be its ordinal position within the array. Also, which, in turn, will always belong toclosestElement.path.Type
- PD.Point | null
-
:number
closestJunctionIndex
-
The index of the closest
BIM.Junctionobject within a path or element.This is set when either a path vertex is selected or the ray is closest to the line between this vertex and the next within the path of a building element. It is the ordinal index within the
PD.Selection#closestContourarray.Type
- number
-
:BIM.Level|null
closestLevel
-
The closest
BIM.Levelwithin the current structure.Type
- BIM.Level | null
-
:PD.Point|null
closestNode
-
The closest
PD.Pointcontrol node within a selected junction.Type
- PD.Point | null
-
:number
closestNodeIndex
-
The index of the closest
PD.Pointcontrol node within a selected junction.Type
- number
-
:BIM.Path|null
closestPath
-
The
BIM.Pathobject selected within the closest element.This value is set when the user selects an element or one of its features, such as a control point, vertex, segment, face or opening..
Type
- BIM.Path | null
-
:PD.Point|null
closestPoint
-
The closest editable point within the closest selection.
In some cases this will be the actual vertex of a path, but in others it may be the mid-point of a line or a curve control point that belongs to a path vertex.
This value is set when the user clicks on an something to select it.
Type
- PD.Point | null
-
:number
closestRadius
-
Stores the distance from the selection ray to the closest selection.
Starts off equal to
PD.Selection#radiusat the beginning of selection testing, but is progressively refined as potential selections are found that are closer than the previous.Type
- number
-
:PD.Point|null
closestSegment
-
The closest
BIM.Junctionpath segment within the closest element or path.This value is set when a linear or curved path running between two vertices within a path or building element is selected.
Type
- PD.Point | null
-
:number
closestSegmentIndex
-
The index of the next
PD.Pointobjecting the selected path segment.This value is set when a linear or curved path running between two vertices within a path or building element is selected. It is the ordinal index of the next point within the
closestContourarray.Type
- number
-
:PD.Shell|null
closestShell
-
The closest
PD.Shellwithin an element.This value is set when
BIM.Elementis selected by picking on one of the facets of the shell that define its shape.Type
- PD.Shell | null
-
:PD.Polygon|null
closestShellFacet
-
The closest
PD.Polygonwithin the shell of an element.This value is set when one of the facets of a
PD.Shellthat defines an element is selected.Type
- PD.Polygon | null
-
:number
closestShellIndex
-
The index of the closest
PD.Polygonwithin the closest shell.This is the ordinal index of the
closestShellFacetwithin theclosestShell.facetListarray.Type
- number
-
:BIM.Structure|null
closestStructure
-
The closest
BIM.Structurewithin the current project.Type
- BIM.Structure | null
-
:PD.BRep|null
closestSurface
-
The closest
PD.BRepwithin an element.This value is set when
BIM.Elementis selected by picking on one of the facets of the surface that define its shape.Type
- PD.BRep | null
-
:Array.<PD.Point>|null
closestSurfaceEdge
-
The closest edge within the closest surface.
This value is set when one of the edges of a
PD.BRepthat defines an element is selected.Type
- Array.<PD.Point> | null
-
:PD.BRep.Face|null
closestSurfaceFacet
-
The closest
PD.BRep.Facewithin the surface of an element.This value is set when one of the facets of a
PD.BRepthat defines an element is selected.Type
- PD.BRep.Face | null
-
:PD.Point|null
closestSurfaceVertex
-
The closest vertex within the closest surface.
This value is set when one of the vertices of a
PD.BRepthat defines an element is selected.Type
- PD.Point | null
-
:BIM.Aperture|null
currentAperture
-
The currently selected aperture in the selection manager.
Type
- BIM.Aperture | null
-
:BIM.Element|null
currentElement
-
The currently selected element in the selection manager.
Type
- BIM.Element | null
-
:BIM.Junction|null
currentJunction
-
The currently selected junction in the selection manager.
Type
- BIM.Junction | null
-
:PD.SELECTED
currentType
-
The current model selection type in the selection manager.
Type
-
:boolean
depthSort
-
Whether or not to bias potential selections to those closest to the eye position.
When selecting in a 3D model, you typically want to select the object closest to the current eye position. However, when selecting in plan view with an orthographic camera, all objects are effectively at the same depth, so distance testing is irrelevant.
Type
- boolean
-
:PD.FILTER
filter
-
Stores any limits in the selectable features to check.
Type
-
:PD.SelectionSet
foundItems
-
Stores the selected items when using region-based selection.
Type
-
:THREE.Frustum
frustum
-
The selection frustum for region-based selection.
Type
-
:boolean
intersectFrustum
-
Whether or not to select items that just cross or intersect the frustum.
Type
- boolean
-
:THREE.Vector3
intersection
-
A volatile point that external classes can use for ray intersection testing.
This point is set by several methods within the
PD.ModelManagerclass and subsequently used in thefound*()methods of this class when depth-sorting the selection. Its position is also sometimes copied into thePD.Selection#closestIntersectionandPD.Selection#storedPointproperties of the closest selection data.Type
- THREE.Vector3
-
:boolean
isSelection <readonly>
-
A flag identifying this object as interactive selection data.
Type
- boolean
-
:boolean
keepExisting
-
Whether or not the current selection is to be adjusted rather than completely replaced.
Type
- boolean
-
:number
radius
-
The selection radius, typically set by the scene manager based on the overall size of the current scene and the current camera zoom factor.
Type
- number
-
:THREE.Ray
ray
-
The selection ray cast by the raycaster object.
When generated by the scene manager during normal interactive user selection, the origin of this ray is the current camera position within the scene.
Thus, it can be used to sort the relative distances of potentially selected objects within the current view. The initial selection when viewing the model in 3D is typically biased to elements closest to the current eye position.
Type
- THREE.Ray
-
:THREE.RayCaster
rayCaster
-
The raycaster object that generated the selection ray.
Type
- THREE.RayCaster
-
:PD.SELECT_ACTION
selectAction
-
Determines how selected items are integrated with any existing model selection set.
Type
-
:PD.SELECTED
selectedType
-
The type of selection just made.
Type
-
:THREE.Vector3
storedPoint
-
The assigned stored point for proximity checks.
When a particular selection type doesn't have an obvious closest point to reference, the associated
found*()methods of this class will set its position based on the selection ray intersection point and use it as the reference forPD.Selection#closestPointto the selection.Type
- THREE.Vector3
-
:PD.FILTER
DefaultFilter <static>
-
The default filter for which features are interactively selectable.
Type
Methods
-
addClearClosestCallback(callback)
-
Add a callback function to be invoked whenever the
clearmethod is called.Parameters:
Name Type Description callbackfunction The function to call when the selection is cleared.
Returns:
Returns the callback method so it can be removed.
- Type
- function
-
clearSelection()
-
Calls all the registered clear selection callbacks.
Returns:
Returns this selection data to support method chaining.
- Type
- PD.Selection
-
foundApertureInJunction(element, contour_index, vertex_index1, vertex_index2, aperture, force_select)
-
Check to assign an aperture between two vertices as selected.
Parameters:
Name Type Description elementBIM.Element The element containing the selected vertex.
contour_indexnumber The ordinal index of the contour in the element path.
vertex_index1number The ordinal index of the first vertex in the path contour.
vertex_index2number The ordinal index of the second vertex in the path contour.
apertureBIM.Aperture The aperture belonging to the path junction.
force_selectboolean When true, ignores depth tests and forces selection.
Throws:
-
Throws an error if element does not have a path or the selected aperture is not found within it.
- Type
- Error
Returns:
Returns true if this is the closest intersection to eye position.
- Type
- boolean
-
-
foundControlNode(element, contour_index, junction_index, node_index, force_select)
-
Check to assign a curve control point as selected.
Parameters:
Name Type Description elementBIM.Element The element containing the selected vertex.
contour_indexnumber The ordinal index of the contour in the element path.
junction_indexnumber The ordinal index of the junction in the path contour.
node_indexnumber The ordinal index of the control point in the junction curve.
force_selectboolean When true, ignores depth tests and forces selection.
Throws:
-
Throws an error if element does not have a path or the selected junction is not found within it.
- Type
- Error
Returns:
Returns true if this is the closest intersection to eye position.
- Type
- boolean
-
-
foundElement(element [, intersection] [, force_select])
-
Check to assign an element as selected.
Parameters:
Name Type Argument Default Description elementBIM.Element The element to select.
intersectionTHREE.Vector3 <optional>
null The selection intersection point with the element.
force_selectboolean <optional>
false When true, ignores depth tests and forces selection.
Throws:
-
Throws an error if element is not valid.
- Type
- Error
Returns:
Returns true if the element is valid and set as the current selection.
- Type
- boolean
-
-
foundFacetInShell(element, shell, facet, force_select)
-
Check to assign an aperture between two vertices as selected.
Parameters:
Name Type Description elementBIM.Element The element containing the selected vertex.
shellPD.Shell The shell that the facet belongs to.
facetPD.Polygon The selected facet within the shell.
force_selectboolean When true, ignores depth tests and forces selection.
Throws:
-
Throws an error if shell is invalid or the selected facet was not found within it.
- Type
- Error
Returns:
Returns true if this is the closest intersection to eye position.
- Type
- boolean
-
-
foundLevel(level [, intersection] [, force_select])
-
Check to assign a level as selected.
Parameters:
Name Type Argument Default Description levelBIM.Level The level to select.
intersectionTHREE.Vector3 <optional>
null The selection intersection point with the level.
force_selectboolean <optional>
false When true, ignores depth tests and forces selection.
Throws:
-
Throws an error if level is not valid.
- Type
- Error
Returns:
Returns true if the level is valid and set as the current selection.
- Type
- boolean
-
-
foundPathJunction(element, contour_index, junction_index, force_select)
-
Check to assign a path junction as selected.
Parameters:
Name Type Description elementBIM.Element The element containing the selected vertex.
contour_indexnumber The ordinal index of the contour in the element path.
junction_indexnumber The ordinal index of the junction in the path contour.
force_selectboolean When true, ignores depth tests and forces selection.
Throws:
-
Throws an error if element does not have a path or the selected vertex is not found within it.
- Type
- Error
Returns:
Returns true if this is the closest intersection to eye position.
- Type
- boolean
-
-
foundPathSegment(element, contour_index, junction_index1, junction_index2)
-
Check to assign a path segment between two vertices as selected.
Parameters:
Name Type Description elementBIM.Element The element containing the selected junction.
contour_indexnumber The ordinal index of the contour in the element path.
junction_index1number The ordinal index of the first junction in the path contour.
junction_index2number The ordinal index of the second junction in the path contour.
Throws:
-
Throws an error if element does not have a path or the selected junction is not found within it.
- Type
- Error
Returns:
Returns true if this is the closest intersection to eye position.
- Type
- boolean
-
-
foundPathSegmentByFacet(element, contour_index, junction_index1, junction_index2 [, intersection] [, force_select])
-
Check to assign a path segment between two vertices as selected.
Parameters:
Name Type Argument Description elementBIM.Element The element containing the selected junction.
contour_indexnumber The ordinal index of the contour in the element path.
junction_index1number The ordinal index of the first junction in the path contour.
junction_index2number The ordinal index of the second junction in the path contour.
intersectionTHREE.Vector3 <optional>
The selection intersection point with the junction facet.
force_selectboolean <optional>
When true, ignores depth tests and forces selection.
Throws:
-
Throws an error if element does not have a path or the selected junction is not found within it.
- Type
- Error
Returns:
Returns true if this is the closest intersection to eye position.
- Type
- boolean
-
-
foundStructure(structure [, intersection] [, force_select])
-
Check to assign a structure as selected.
Parameters:
Name Type Argument Default Description structureBIM.Structure The structure to select.
intersectionTHREE.Vector3 <optional>
null The selection intersection point with the structure.
force_selectboolean <optional>
false When true, ignores depth tests and forces selection.
Throws:
-
Throws an error if structure is not valid.
- Type
- Error
Returns:
Returns true if the structure is valid and set as the current selection.
- Type
- boolean
-
-
foundSurfaceEdge(element, surface, edge, force_select)
-
Check to assign a surface edge as selected.
Parameters:
Name Type Description elementBIM.Element | null The element containing the surface, if any.
surfacePD.BRep The surface that the edge belongs to.
edgeArray.<PD.Point> The selected edge within the surface.
force_selectboolean When true, ignores depth tests and forces selection.
Throws:
-
Throws an error if surface is invalid or the selected facet was not found within it.
- Type
- Error
Returns:
Returns true if this is the closest intersection to eye position.
- Type
- boolean
-
-
foundSurfaceFacet(element, surface, facet, force_select)
-
Check to assign a surface facet as selected.
Parameters:
Name Type Description elementBIM.Element | null The element containing the surface, if any.
surfacePD.BRep The surface that the facet belongs to.
facetPD.BRep.Face The selected facet within the surface.
force_selectboolean When true, ignores depth tests and forces selection.
Throws:
-
Throws an error if surface is invalid or the selected facet was not found within it.
- Type
- Error
Returns:
Returns true if this is the closest intersection to eye position.
- Type
- boolean
-
-
foundSurfaceVertex(element, surface, vertex, force_select)
-
Check to assign a surface vertex as selected.
Parameters:
Name Type Description elementBIM.Element | null The element containing the surface, if any.
surfacePD.BRep The surface that the edge belongs to.
vertexPD.Point The selected vertex within the surface.
force_selectboolean When true, ignores depth tests and forces selection.
Throws:
-
Throws an error if surface is invalid or the selected vertex was not found within it.
- Type
- Error
Returns:
Returns true if this is the closest intersection to eye position.
- Type
- boolean
-
-
getHandler(nameOrValue)
-
Retrieves the registered handler for the given selection type.
Parameters:
Name Type Description nameOrValuestring | number A selection type.
Returns:
Returns the class instance for the given type, or null if not found.
- Type
- PD.SelectionHandler | null
-
hasFoundItems()
-
Checks if the last selection used a view frustum and whether any items were found.
Returns:
Returns true if items were found in frustum.
- Type
- boolean
-
removeClearClosestCallback(callback)
-
Add a callback function to be invoked whenever the
clearSelectionmethod is called.Parameters:
Name Type Description callbackfunction The callback function added to
PD.Selection#addClearSelectionCallback.Returns:
Returns true if the callback was present and removed.
- Type
- boolean
-
reset(selector [, radius] [, sort])
-
Reinitialises all selection data in order to begin a new selection.
NOTE: When generated by the SceneManager during normal interactive user-selection, the origin of the selection ray is also the current camera position.
Parameters:
Name Type Argument Description selectorTHREE.Raycaster | THREE.Frustum The ray caster or frustum to use for selection.
radiusnumber <optional>
The selection radius threshold when using a selection ray, in model coordinates, defaults to default radius.
sortboolean <optional>
Whether or not to sort potential selections by distance when using a selection ray, defaults to false.
Returns:
Returns this selection data to support method chaining.
- Type
- PD.Selection