![]() |
NDEVR
API Documentation
|
Manages selection trees, which optimize the process of selecting data within large Geometry objects. More...
Public Member Functions | |
| SelectionTreeManager () | |
| Constructs a SelectionTreeManager with default bucket sizes and timespan settings. | |
| bool | createGeoTree (const Geometry &geo, PrimitiveProperty primitive_property, VertexProperty vertex_property, uint04 tree_bucket_size, const void *lock) |
| Creates a spatial selection tree for a single geometry object. | |
| void | createTrees (const Model &model, const void *lock) |
| Creates selection trees for all geometry within the given model and its children. | |
| void | createTrees (DesignObjectLookup *lookup) |
| Creates selection trees for all geometry within the given lookup. | |
| void | onGeometryDeleted (UUID id) |
| Handles cleanup when a geometry object is deleted, removing its associated tree data. | |
| void | onSceneDeleted (UUID id) |
| Handles cleanup when an entire scene is deleted, removing all associated tree data. | |
| void | setEditTimespan (TimeSpan span) |
| Sets the time from a geometry edit before we create a tree. | |
| bool | sortVertices (const Geometry &geo, PrimitiveProperty primitive_property, VertexProperty vertex_property, const void *lock) |
| Sorts the vertices of a geometry spatially to improve cache coherence and selection performance. | |
| void | startLoop (DesignObjectLookup *lookup, const TimeSpan &loop_time) |
| Starts a background thread that periodically rebuilds selection trees for modified geometry. | |
| void | stopLoop () |
| Stops the background tree-rebuild loop and waits for the thread to finish. | |
Protected Member Functions | |
| bool | canSort (const Geometry &geo) |
| Checks whether the given geometry is eligible for vertex sorting. | |
| void | createModelTree (const Buffer< Model > &models, const void *lock) |
| Creates a spatial tree that indexes child models for a parent model hierarchy. | |
| void | createTree (const Geometry &geo, PrimitiveProperty primitive_property, VertexProperty vertex_property, const void *lock) |
| Internal method that creates a selection tree for a single geometry using stored bucket sizes. | |
Protected Attributes | |
| Set< UUID > | m_active_models |
| Set of model UUIDs currently being processed or tracked. | |
| TimeSpan | m_edit_timespan = TimeSpan(2.0) |
| Minimum time after a geometry edit before tree creation is allowed. | |
| Time | m_last_modified_time = Time(0) |
| Timestamp of the most recent geometry modification observed. | |
| uint04 | m_line_bucket_size = 32 |
| Maximum elements per leaf node for line-based trees. | |
| InfoPipe * | m_log = nullptr |
| Optional logging pipe for diagnostic output. | |
| DesignObjectLookup * | m_loop_lookup = nullptr |
| Lookup reference used by the background loop. | |
| BasicThread * | m_loop_thread = nullptr |
| Background thread running the periodic tree-rebuild loop. | |
| TimeSpan | m_loop_timespan = Constant<TimeSpan>::Invalid |
| Interval between background loop iterations. | |
| uint04 | m_model_child_bucket_size = 8 |
| Maximum elements per leaf node for model child trees. | |
| Dictionary< UUID, Time > | m_modified_time |
| Tracks the last modification time per geometry UUID. | |
| uint04 | m_point_bucket_size = 64 |
| Maximum elements per leaf node for point-based trees. | |
| Buffer< PrimitiveProperty > | m_primitive_properties |
| Primitive property channels corresponding to entries in m_tree_geos. | |
| bool | m_requesting_delete = false |
| Whether a deletion cleanup pass has been requested. | |
| Buffer< Geometry > | m_sort_geos |
| Geometries queued for vertex sorting. | |
| Buffer< Geometry > | m_tree_geos |
| Geometries queued for tree construction. | |
| uint04 | m_triangle_bucket_size = 16 |
| Maximum elements per leaf node for triangle-based trees. | |
| Buffer< VertexProperty > | m_vertex_properties |
| Vertex property channels corresponding to entries in m_tree_geos. | |
Manages selection trees, which optimize the process of selecting data within large Geometry objects.
Selection trees are spatial index structures (e.g., KD-trees or bounding volume hierarchies) built over geometry vertex and primitive data to accelerate point-picking, box selection, and other spatial queries. The manager tracks which geometries need tree construction or vertex sorting, and can optionally run a background loop that rebuilds trees as geometry is modified.
Definition at line 25 of file SelectionTreeManager.h.
|
protected |
Checks whether the given geometry is eligible for vertex sorting.
| [in] | geo | The geometry to evaluate. |
| bool SelectionTreeManager::createGeoTree | ( | const Geometry & | geo, |
| PrimitiveProperty | primitive_property, | ||
| VertexProperty | vertex_property, | ||
| uint04 | tree_bucket_size, | ||
| const void * | lock ) |
Creates a spatial selection tree for a single geometry object.
| [in] | geo | The geometry to build a selection tree for. |
| [in] | primitive_property | The primitive property channel used for indexing (e.g., triangles, lines). |
| [in] | vertex_property | The vertex property channel providing spatial coordinates. |
| [in] | tree_bucket_size | The maximum number of elements per tree leaf node. |
| [in] | lock | An opaque lock pointer used to synchronize concurrent access. |
|
protected |
Creates a spatial tree that indexes child models for a parent model hierarchy.
| [in] | models | The buffer of child models to index. |
| [in] | lock | An opaque lock pointer used to synchronize concurrent access. |
|
protected |
Internal method that creates a selection tree for a single geometry using stored bucket sizes.
| [in] | geo | The geometry to build a tree for. |
| [in] | primitive_property | The primitive property channel to index. |
| [in] | vertex_property | The vertex property channel providing spatial data. |
| [in] | lock | An opaque lock pointer used to synchronize concurrent access. |
| void SelectionTreeManager::createTrees | ( | const Model & | model, |
| const void * | lock ) |
Creates selection trees for all geometry within the given model and its children.
| [in] | model | The root model whose geometry should have trees created. |
| [in] | lock | An opaque lock pointer used to synchronize concurrent access to geometry data. |
| void SelectionTreeManager::createTrees | ( | DesignObjectLookup * | lookup | ) |
Creates selection trees for all geometry within the given lookup.
| [in] | lookup | The design object lookup containing models and geometry to process. |
| void SelectionTreeManager::onGeometryDeleted | ( | UUID | id | ) |
Handles cleanup when a geometry object is deleted, removing its associated tree data.
| [in] | id | The UUID of the deleted geometry. |
| void SelectionTreeManager::onSceneDeleted | ( | UUID | id | ) |
Handles cleanup when an entire scene is deleted, removing all associated tree data.
| [in] | id | The UUID of the deleted scene. |
|
inline |
Sets the time from a geometry edit before we create a tree.
This prevents creating trees on objects with dynamic vertices.
| [in] | span | The minimum time that must elapse after an edit before tree creation proceeds. |
Definition at line 59 of file SelectionTreeManager.h.
References m_edit_timespan.
| bool SelectionTreeManager::sortVertices | ( | const Geometry & | geo, |
| PrimitiveProperty | primitive_property, | ||
| VertexProperty | vertex_property, | ||
| const void * | lock ) |
Sorts the vertices of a geometry spatially to improve cache coherence and selection performance.
| [in] | geo | The geometry whose vertices should be sorted. |
| [in] | primitive_property | The primitive property channel referencing the vertices. |
| [in] | vertex_property | The vertex property channel to sort by. |
| [in] | lock | An opaque lock pointer used to synchronize concurrent access. |
| void SelectionTreeManager::startLoop | ( | DesignObjectLookup * | lookup, |
| const TimeSpan & | loop_time ) |
Starts a background thread that periodically rebuilds selection trees for modified geometry.
| [in] | lookup | The design object lookup providing access to all models and geometry. |
| [in] | loop_time | The interval between successive tree-rebuild passes. |