NDEVR
API Documentation
SelectionInfofinal

Responsible for turning a user interaction into a selection within a DesignObjectLookup. More...

Inheritance diagram for SelectionInfo:
[legend]
Collaboration diagram for SelectionInfo:
[legend]

Classes

class  ClosestModelInfo
 Stores information about the closest model element found during a selection operation, tracking the nearest geometry, model, material, and layer for a given primitive type. More...

Public Member Functions

 SelectionInfo ()
 Constructs a default SelectionInfo with initial state.
bool allowSolidInteraction () const
 Returns whether solid (filled) geometry intersection testing is allowed.
void clear ()
 Resets all selection state, clearing tracked results and selection areas.
void clearLastSelection ()
 Clears only the most recent selection data, preserving historical state.
void finishSelection ()
 Finalizes selection state after a selection pass is complete.
void getEnclosedVertices (GeometryVertices &vertices) const
 Populates the given GeometryVertices with all vertices enclosed by the current selection area.
Bounds< 3, fltp08globalSelectionBounds () const
 Returns the bounding box of the current selection area in global coordinates.
UUID nearestGeometry (PrimitiveMode mode) const
 Returns the UUID of the nearest geometry for a specific primitive mode.
UUID nearestModel () const
 Returns the UUID of the nearest model across all primitive modes.
Vertex< 3, fltp08nearestScreenLocation () const
 Returns the screen-space location of the nearest selection hit.
Vertex< 3, fltp08nearestWorldLocation () const
 Returns the world-space location of the nearest selection hit.
bool operator== (const SelectionInfo &) const
 Equality operator.
ParseResult postProcess (Model &model) override
 Post-processes a model after its children have been visited.
void prepareSelection ()
 Prepares internal state before beginning a new selection pass.
ParseResult process (Model &model) override
 Processes a model during iteration, evaluating it for selection.
ParseResult process (Model &model, Geometry &geo) override
 Processes a model with its associated geometry for selection.
ParseResult process (Model &model, Material &mat) override
 Processes a model with its associated material for selection.
bool processGeometry (const Model &model, const Geometry &geo, PrimitiveProperty primitive_property, UUID selection_id)
 Evaluates a specific geometry primitive for selection hits.
fltp08 screenClosestDistanceSqr (bool outer_bound) const
 Returns the squared screen-space distance to the closest selected element.
fltp08 screenClosestDistanceSqr (PrimitiveMode mode) const
 Returns the squared screen-space distance to the closest element of a specific primitive mode.
Bounds< 3, fltp08selectionBounds () const
 Returns the bounding box of the current selection area in local coordinates.
void setAllowSolidInteraction (bool allow_solid_intersection)
 Sets whether solid (filled) geometry intersection testing is allowed.
void setCurrentSelection (const SelectionArea< 3, fltp08 > &new_selection)
 Sets the current selection area used for hit testing.
void setGeometryTransform (PrimitiveMode mode, const Matrix< fltp08 > &mat)
 Sets the geometry transform matrix for a given primitive mode.
void setNearestGeometry (const Geometry &geo, PrimitiveMode primitive_mode, uint04 index, uint04 vertex)
 Sets the nearest geometry hit for a given primitive mode.
void setNearestLayer (PrimitiveMode mode, const UUID &layer)
 Sets the nearest layer UUID for a given primitive mode.
void setNearestMaterial (PrimitiveMode mode, const UUID &material)
 Sets the nearest material UUID for a given primitive mode.
void setNearestModel (PrimitiveMode mode, const Model &model)
 Sets the nearest model for a given primitive mode.
bool setNearestScreenPosition (PrimitiveMode mode, const Vertex< 3, fltp08 > &screen_point, fltp08 screen_distance)
 Sets the nearest screen-space position for a given primitive mode.
void updateLineEndPoint (PrimitiveMode mode, Vertex< 3, fltp08 > vec)
 Updates the endpoint of the selection line for a given primitive mode.
UUID uuid () const
 Returns the unique identifier of this SelectionInfo instance.
bool validModelSelection (const Model &model) const
 Checks whether a model passes the current selection filters and is valid for selection.
Public Member Functions inherited from ModelIterator
 ModelIterator ()
 Default constructor.
 ModelIterator (Buffer< Model > models)
 Constructs an iterator initialized with multiple root models.
 ModelIterator (const Model &model)
 Constructs an iterator initialized with a single root model.
void addToStack (const Model &model)
 Adds a model to the internal traversal stack without starting iteration.
Model currentModel () const
 Returns the model currently at the top of the traversal stack.
void parseAll ()
 Parses all models currently on the internal stack and their descendants.
void parseAll (const Model &model)
 Parses the given model and all of its descendants.
void parseAllChildren (const Model &parent)
 Parses all children of the given parent model, but not the parent itself.
void parseAllModels (const Buffer< Model > &models)
 Parses all models in the given buffer and their descendants.
ParseResult parseNext ()
 Parses the next model on the stack, processing it and optionally its geometry and material.

Public Attributes

UUID camera = Constant<UUID>::Invalid
 The UUID of the camera used for screen-space projection.
UUID current_model = Constant<UUID>::Invalid
 The UUID of the model currently being processed.
SelectionArea< 3, fltp08current_selection
 The current active selection area.
Dictionary< UUID, EnclosedModelInfoenclosed_info
 Map of model UUIDs to their enclosed selection information.
Buffer< UUIDgrips
 Collection of grip point UUIDs associated with the selection.
bool is_edit = false
 Whether this selection is for editing (vs. simple picking).
bool is_exact = true
 Whether exact intersection testing is used (vs. bounding-box only).
SelectionArea< 3, fltp08last_selection
 The previous selection area, used for incremental updates.
bool mask_added = false
 Whether additive mask mode is active.
bool mask_subtracted = true
 Whether subtractive mask mode is active.
fltp08 min_screen_cutoff_distance = 0.0
 Minimum screen-space distance below which hits are ignored.
ClosestModelInfo nearest_line
 Closest hit info for line primitives.
ClosestModelInfo nearest_point
 Closest hit info for point primitives.
ClosestModelInfo nearest_solid
 Closest hit info for solid (triangle/face) primitives.
Material override_material
 Material used to override rendering of selected objects.
fltp08 screen_line_bias = 0.0
 Bias added to line selection distances for priority tuning.
fltp08 screen_point_bias = 0.0
 Bias added to point selection distances for priority tuning.
DesignSelection selection
 The resulting design selection produced by this operation.
std::function< bool(const Model &)> selection_filter
 Optional filter callback invoked after selection to validate the selected model's parent. Returns true if selectable.
Buffer< SelectionArea< 3, fltp08 > > selection_masks
 Collection of selection mask areas for complex selection shapes.
WindingMode selection_winding_mode
 The winding mode used for determining enclosed geometry.
bool use_interaction_flag = true
 Whether to respect the model's interaction flag when selecting.
Vertex< 3, fltp08world_nearest_location
 The world-space position of the nearest hit.
LineSegment< 3, fltp08world_selection_line
 The selection ray/line in world (screen) space.
Public Attributes inherited from ModelIterator
bool depth_first = true
 Whether to traverse depth-first (true) or breadth-first (false).
std::function< bool(const Model &, const Geometry &)> geo_filter
 Optional filter predicate for geometry processing. Returns true to include.
bool is_recursive = true
 Whether to recurse into child models.
std::function< bool(const Model &, const Material &)> material_filter
 Optional filter predicate for material processing. Returns true to include.
std::function< bool(const Model &)> model_filter
 Optional filter predicate for model processing. Returns true to include.
bool post_process_model = false
 Whether to invoke postProcess() after a model's children have been parsed.
bool process_geometry = true
 Whether to invoke process() for each Geometry on a model.
bool process_material = false
 Whether to invoke process() for each Material on a model.
bool process_model = true
 Whether to invoke process() for the model itself.
bool use_unit = false
 Whether to apply unit conversions during processing.

Protected Attributes

bool m_allow_solid_intersection
 Whether solid geometry intersection testing is enabled.
UUID m_id
 Unique identifier for this SelectionInfo instance.
LineIterator< 3, fltp04m_line_position_iter
 Iterator for accessing line segment positions.
VertexIterator< Vertex< 3, fltp04 > > m_position_iter
 Iterator for accessing vertex positions.
TriangleIterator< 3, fltp04m_triangle_position_iter
 Iterator for accessing triangle positions.
Buffer< Modelm_valid_model_stack
 Stack of models that passed validation during traversal.
Protected Attributes inherited from ModelIterator
uint04 m_forward_position = 0U
 Current forward index position used in breadth-first traversal.
Buffer< std::pair< Model, uint04 > > m_model_parent_stack
 Stack tracking parent models and their child indices for post-processing.
Buffer< Modelm_model_stack
 The stack of models pending traversal.

Additional Inherited Members

Public Types inherited from ModelIterator
enum  ParseResult { e_continue_parsing , e_do_not_parse_children , e_finish_parsing }
 The result returned by process functions to control iteration flow. More...
Protected Member Functions inherited from ModelIterator
virtual void _parseAllModels ()
 Internal method that drives the main parsing loop over all stacked models.
Model popNextModel ()
 Pops and returns the next model from the traversal stack.
void removeFromPostProcessStack ()
 Removes the current model from the post-process stack.

Detailed Description

Responsible for turning a user interaction into a selection within a DesignObjectLookup.


See also
SelectionController, Geometry, Camera

Definition at line 51 of file Selector.h.

Member Function Documentation

◆ allowSolidInteraction()

bool SelectionInfo::allowSolidInteraction ( ) const
inline

Returns whether solid (filled) geometry intersection testing is allowed.

Returns
True if solid intersection tests are enabled.

Definition at line 189 of file Selector.h.

References m_allow_solid_intersection.

◆ getEnclosedVertices()

void SelectionInfo::getEnclosedVertices ( GeometryVertices & vertices) const

Populates the given GeometryVertices with all vertices enclosed by the current selection area.

Parameters
[in]verticesThe structure to populate with enclosed vertex data.

◆ globalSelectionBounds()

Bounds< 3, fltp08 > SelectionInfo::globalSelectionBounds ( ) const

Returns the bounding box of the current selection area in global coordinates.

Returns
The 3D global bounds of the selection.

◆ nearestGeometry()

UUID SelectionInfo::nearestGeometry ( PrimitiveMode mode) const

Returns the UUID of the nearest geometry for a specific primitive mode.

Parameters
[in]modeThe primitive mode to query.
Returns
The UUID of the nearest geometry.

◆ nearestModel()

UUID SelectionInfo::nearestModel ( ) const

Returns the UUID of the nearest model across all primitive modes.

Returns
The UUID of the nearest model.

◆ nearestScreenLocation()

Vertex< 3, fltp08 > SelectionInfo::nearestScreenLocation ( ) const

Returns the screen-space location of the nearest selection hit.

Returns
The nearest screen-space vertex position.

Referenced by GravityIntersection::calculateIntersection(), and GravityIntersection::FindGravityPoints().

◆ nearestWorldLocation()

Vertex< 3, fltp08 > SelectionInfo::nearestWorldLocation ( ) const

Returns the world-space location of the nearest selection hit.

Returns
The nearest world-space vertex position.

◆ operator==()

bool SelectionInfo::operator== ( const SelectionInfo & ) const
inline

Equality operator.

Always returns false as SelectionInfo instances are unique.

Returns
False.

Definition at line 228 of file Selector.h.

References SelectionInfo().

◆ postProcess()

ParseResult SelectionInfo::postProcess ( Model & model)
overridevirtual

Post-processes a model after its children have been visited.

Parameters
[in]modelThe model to post-process.
Returns
ParseResult indicating whether to continue or stop iteration.

Reimplemented from ModelIterator.

◆ process() [1/3]

ParseResult SelectionInfo::process ( Model & model)
overridevirtual

Processes a model during iteration, evaluating it for selection.

Parameters
[in]modelThe model to process.
Returns
ParseResult indicating whether to continue or stop iteration.

Reimplemented from ModelIterator.

◆ process() [2/3]

ParseResult SelectionInfo::process ( Model & model,
Geometry & geo )
overridevirtual

Processes a model with its associated geometry for selection.

Parameters
[in]modelThe model to process.
[in]geoThe geometry associated with the model.
Returns
ParseResult indicating whether to continue or stop iteration.

Reimplemented from ModelIterator.

◆ process() [3/3]

ParseResult SelectionInfo::process ( Model & model,
Material & mat )
overridevirtual

Processes a model with its associated material for selection.

Parameters
[in]modelThe model to process.
[in]matThe material associated with the model.
Returns
ParseResult indicating whether to continue or stop iteration.

Reimplemented from ModelIterator.

◆ processGeometry()

bool SelectionInfo::processGeometry ( const Model & model,
const Geometry & geo,
PrimitiveProperty primitive_property,
UUID selection_id )

Evaluates a specific geometry primitive for selection hits.

Parameters
[in]modelThe parent model of the geometry.
[in]geoThe geometry to test.
[in]primitive_propertyThe primitive property type to test against.
[in]selection_idThe UUID identifying this selection operation.
Returns
True if the geometry was selected.

◆ screenClosestDistanceSqr() [1/2]

fltp08 SelectionInfo::screenClosestDistanceSqr ( bool outer_bound) const

Returns the squared screen-space distance to the closest selected element.

Parameters
[in]outer_boundIf true, returns the outer-bound distance; otherwise the inner.
Returns
The squared screen distance.

◆ screenClosestDistanceSqr() [2/2]

fltp08 SelectionInfo::screenClosestDistanceSqr ( PrimitiveMode mode) const

Returns the squared screen-space distance to the closest element of a specific primitive mode.

Parameters
[in]modeThe primitive mode (point, line, solid) to query.
Returns
The squared screen distance.

◆ selectionBounds()

Bounds< 3, fltp08 > SelectionInfo::selectionBounds ( ) const

Returns the bounding box of the current selection area in local coordinates.

Returns
The 3D bounds of the selection.

◆ setAllowSolidInteraction()

void SelectionInfo::setAllowSolidInteraction ( bool allow_solid_intersection)
inline

Sets whether solid (filled) geometry intersection testing is allowed.

Parameters
[in]allow_solid_intersectionTrue to allow solid intersection tests.

Definition at line 185 of file Selector.h.

References m_allow_solid_intersection.

◆ setCurrentSelection()

void SelectionInfo::setCurrentSelection ( const SelectionArea< 3, fltp08 > & new_selection)

Sets the current selection area used for hit testing.

Parameters
[in]new_selectionThe new selection area in 3D space.

◆ setGeometryTransform()

void SelectionInfo::setGeometryTransform ( PrimitiveMode mode,
const Matrix< fltp08 > & mat )

Sets the geometry transform matrix for a given primitive mode.

Parameters
[in]modeThe primitive mode.
[in]matThe world transform matrix of the geometry.

◆ setNearestGeometry()

void SelectionInfo::setNearestGeometry ( const Geometry & geo,
PrimitiveMode primitive_mode,
uint04 index,
uint04 vertex )

Sets the nearest geometry hit for a given primitive mode.

Parameters
[in]geoThe geometry that was hit.
[in]primitive_modeThe primitive mode of the hit.
[in]indexThe primitive index within the geometry.
[in]vertexThe vertex index of the nearest point.

◆ setNearestLayer()

void SelectionInfo::setNearestLayer ( PrimitiveMode mode,
const UUID & layer )

Sets the nearest layer UUID for a given primitive mode.

Parameters
[in]modeThe primitive mode.
[in]layerThe UUID of the nearest layer.

◆ setNearestMaterial()

void SelectionInfo::setNearestMaterial ( PrimitiveMode mode,
const UUID & material )

Sets the nearest material UUID for a given primitive mode.

Parameters
[in]modeThe primitive mode.
[in]materialThe UUID of the nearest material.

◆ setNearestModel()

void SelectionInfo::setNearestModel ( PrimitiveMode mode,
const Model & model )

Sets the nearest model for a given primitive mode.

Parameters
[in]modeThe primitive mode.
[in]modelThe nearest model.

◆ setNearestScreenPosition()

bool SelectionInfo::setNearestScreenPosition ( PrimitiveMode mode,
const Vertex< 3, fltp08 > & screen_point,
fltp08 screen_distance )

Sets the nearest screen-space position for a given primitive mode.

Parameters
[in]modeThe primitive mode of the hit.
[in]screen_pointThe screen-space position of the hit.
[in]screen_distanceThe screen-space distance to the hit.
Returns
True if the calling code should adjust the selection line based on this result.

◆ updateLineEndPoint()

void SelectionInfo::updateLineEndPoint ( PrimitiveMode mode,
Vertex< 3, fltp08 > vec )

Updates the endpoint of the selection line for a given primitive mode.

Parameters
[in]modeThe primitive mode.
[in]vecThe new endpoint position in world coordinates.

◆ uuid()

UUID SelectionInfo::uuid ( ) const
inline

Returns the unique identifier of this SelectionInfo instance.

Returns
The UUID of this selection.

Definition at line 224 of file Selector.h.

References m_id.

◆ validModelSelection()

bool SelectionInfo::validModelSelection ( const Model & model) const

Checks whether a model passes the current selection filters and is valid for selection.

Parameters
[in]modelThe model to validate.
Returns
True if the model is a valid selection target.

The documentation for this class was generated from the following file: