34#include <NDEVR/DesignObject.h>
35#include <NDEVR/Model.h>
36#include <NDEVR/Scene.h>
37#include <NDEVR/Effect.h>
38#include <NDEVR/DesignSelection.h>
39#include <NDEVR/CameraManager.h>
40#include <NDEVR/LogManager.h>
41#include <NDEVR/DesignParameterAccumulator.h>
90 [[nodiscard]]
RLock readLock(
const std::function<
void()>& wait_callback)
const;
269 [[nodiscard]]
Model layer(
const UUID& layer_id,
const UUID& scene_id,
bool allow_deleted =
false)
const;
446 template<
class t_design_command_type>
457 template<
class t_design_command_type>
575#if NDEVR_SUPPORTS_THREADING
591 virtual void update(
const Time& time,
const std::function<
void()>& wait_callback);
626#if NDEVR_SUPPORTS_THREADING
A bitset that stores 8 bits (elements with only two possible values: 0 or 1, true or false,...
A specification of upper and lower bounds in N-dimensions.
The equivelent of std::vector but with a bit more control.
Forward declaration of the skybox environment rendering class.
A core object representing a user view as well as convenience functions for moving this view through ...
Provides a constant, unmodifiable pointer that has shared ownership of a dynamically allocated object...
Stores logic for performing, undoing, or redoing DesignCommands.
bool hasMaterialID(const UUID &id, bool allow_deleted=false) const
Checks whether a material with the given UUID exists.
bool hasEffect(const UUID &id) const
Checks whether an effect with the given UUID exists.
virtual void appendSelected(Buffer< UUID > ids)
Appends the specified object IDs to the current selection.
void invalidateStationVisuals(bool invalidate_visuals, bool invalidate_font)
Marks station visuals and/or fonts as needing re-rendering.
Effect effect(const UUID &id, bool allow_deleted=false) const
Retrieves an effect by its UUID.
Dictionary< UUID, Dictionary< UUID, Model > > m_layer_objects
Layers organized by scene UUID, then layer UUID.
Buffer< UUID > getRootObjectIDs(UUID camera_id, bool include_app_owned=false) const
Returns the UUIDs of root-level objects visible to a specific camera.
virtual void eraseModel(UUID id)
Erases a model from the lookup, moving it to the erased objects store.
virtual void requestAutoSaveCheckpoint()
Requests an auto-save checkpoint of the current design state.
void cleanupMemory()
Releases unused memory held by internal data structures.
Buffer< UUID > m_selected_objects
The UUIDs of currently selected objects.
ModelEditController * m_edit_controller
Manages model editing operations.
void startUpdateThread(const TimeSpan &span, std::function< void(const Exception &)> exception_callback)
Starts a background thread that periodically calls update().
virtual void clearAll()
Removes all design objects, scenes, and resets the lookup to an empty state.
Model findLayer(const TranslatedString &layer) const
Finds a layer by its translated name.
void setupDefaultScene()
Initializes the default scene with standard settings.
Geometry geometry(const UUID &id, bool allow_deleted=false) const
Retrieves a geometry by its UUID.
DesignObjectLookup()
Constructs a new DesignObjectLookup with default-initialized members.
void setSelectionEffect(SelectionEffect *effect)
Sets the selection effect used for highlighting selected objects.
virtual Project activeProjectModel() const
Returns the active project as a Project model.
Model findLayer(const String &layer, bool use_translation=true) const
Finds a layer by its name string.
virtual ModelEditController * editManager()
Returns the model edit controller.
virtual ~DesignObjectLookup()
Virtual destructor.
Buffer< DesignParameterAccumulator > accumulateDesignParameters(const BitFlag &accumulation_flags) const
Accumulates statistics for all design parameters matching the given flags.
Buffer< UUID > getRootObjectIDs(bool include_app_owned=false) const
Returns the UUIDs of all root-level objects.
Dictionary< UUID, DynamicPointer< DesignSelection > > m_selection_info
Selection metadata keyed by selection UUID.
DynamicPointer< Camera > createCamera(const ViewportFormat &format)
Creates a new camera with no explicit parent model.
void setViewportFocus(AutoZoomFocus focus)
Sets the auto-zoom focus target for viewports.
RLock tryReadLock(const TimeSpan &span) const
Attempts to acquire a read lock within the specified time span.
Buffer< Model > getModelsByID(const Buffer< UUID > &ids) const
Retrieves models by their UUIDs from a buffer.
Time m_last_update_time
The timestamp of the most recent update cycle.
DesignObject object(const UUID &id) const
Retrieves a generic design object by its UUID.
virtual void executePendingCommands()
Executes all pending design commands in the command queue.
const Dictionary< UUID, Scene > & sceneObjects()
Returns the dictionary of all registered scenes.
virtual void requestAutoSave()
Requests an auto-save of the current design state.
virtual void addModel(Model object)
Registers a model in the lookup.
WLock writeLock(const std::function< void()> &wait_callback)
Acquires an exclusive write lock, calling a callback while waiting.
WDesignLock writeLock(UUID id)
Acquires a design-specific write lock for the object with the given UUID.
WLock tryWriteLock(const TimeSpan &span)
Attempts to acquire a write lock within the specified time span.
Dictionary< UUID, DesignObject > m_design_objects
All registered design objects keyed by UUID.
virtual uint08 approximateMemorySize(bool include_app_owned=false) const
Estimates the total memory usage of all stored design objects.
Material createCameraMaterial(UUID camera)
Creates a new material associated with a specific camera.
virtual void setActiveProject(UUID layer_id)
Sets the active project by UUID.
bool hasCamera(const UUID &id) const
Checks whether a camera with the given UUID exists.
Resource< Time > autosave_request_time
The time of the most recent auto-save request.
Dictionary< UUID, Model > m_camera_root
Root models associated with each camera.
bool hasGeometryID(const UUID &id, bool allow_deleted=false) const
Checks whether a geometry with the given UUID exists.
Bounds< 3, fltp08 > boundsOfVisible(const Camera &camera) const
Computes the 3D bounding box of all objects visible to the given camera.
LogManager * m_log_manager
Manages logging for design operations.
Buffer< Model > models(const Buffer< UUID > &ids, bool allow_deleted=false) const
Retrieves multiple models by their UUIDs.
virtual SelectionEffect * selectionEffect()
Returns the selection effect used for highlighting selected objects.
const DynamicPointer< DesignSelection > & getSelectionInfo(const UUID &id)
Retrieves a mutable selection info pointer by its UUID.
RLock readLock() const
Acquires a shared read lock on the design object store.
void runCommand(const DynamicPointer< t_design_command_type > &command)
Runs a typed design command synchronously.
void ensureLayerExistsInAllScenes(const UUID &layer_id)
Ensures the specified layer exists in all registered scenes.
virtual void addCamera(const DynamicPointer< Camera > &object, bool generate_decorations=true)
Adds a camera to the lookup.
Dictionary< UUID, Effect > m_effect_objects
All registered effect objects keyed by UUID.
virtual UUID activeProject() const
Returns the UUID of the currently active project.
Dictionary< UUID, Material > m_material_objects
All registered material objects keyed by UUID.
std::function< void(const Exception &)> m_exception_callback
Callback for exceptions thrown during background updates.
virtual Buffer< UUID > getDescendantsOf(const Buffer< UUID > &model_ids)
Returns the UUIDs of all descendants of the given models.
Buffer< UUID > visibleModels() const
Returns the UUIDs of all currently visible models.
Bounds< 3, fltp08 > bounds() const
Computes the 3D bounding box encompassing all stored objects.
Model layer(const UUID &id, bool allow_deleted=false) const
Retrieves a layer by its UUID.
Dictionary< UUID, DesignObject > m_deleted_objects
Design objects that have been soft-deleted.
Resource< Time > modified_time
The last modification time of the design data.
WLock commandLock()
Acquires a write lock specifically for command execution.
Model modelOrLayer(const UUID &id, bool allow_deleted=false) const
Retrieves a model or layer by its UUID, checking both stores.
Dictionary< UUID, Model > m_model_objects
All registered model objects keyed by UUID.
bool m_update_language
Whether a language/translation update is pending.
Dictionary< UUID, EnclosedModelInfo > processSelection(const DesignSelection &info) const
Processes a design selection and returns enclosed model information.
const Dictionary< UUID, DesignObject > & objects()
Returns the dictionary of all registered design objects.
Buffer< Model > getModelsByType(const Buffer< String > &types) const
Returns all models matching any of the specified type strings.
virtual void setSelected(Buffer< UUID > ids)
Replaces the current selection with the specified object IDs.
Resource< UUID > current_layer
The UUID of the currently active layer.
virtual Buffer< UUID > getInverseOf(const Buffer< UUID > &model_ids)
Returns the UUIDs of all models that are NOT in the given set.
void updateTranslation()
Triggers a translation update for all design objects.
void colorByChannel(UUID target, const DesignParameter &channel)
Applies color-by-channel visualization to a target model.
virtual void deleteObject(UUID id)
Marks a design object as deleted by its UUID.
Model createModel()
Creates a new model and registers it in the lookup.
ResourceListener * m_invalidate_station_visuals_listener
Listener that triggers station visual invalidation.
CameraManager * m_camera_controller
Manages all camera instances and their lifecycle.
virtual const CameraManager * cameraManager() const
Returns the camera manager (const).
virtual void updateModelTopLevel(const Model &object)
Updates the top-level status of a model in the hierarchy.
void selectEnclosed(UUID selection_id)
Selects all models enclosed by the specified selection region.
Buffer< Model > getRootObjects(bool include_app_owned=false) const
Returns all root-level model objects.
bool hasSelectionInfo(const UUID &id) const
Checks whether selection info with the given UUID exists.
Dictionary< UUID, Scene > m_scene_objects
All registered scene objects keyed by UUID.
virtual void addScene(Scene scene, bool add_all_scene_models=true)
Adds a scene to the lookup and optionally registers all of its models.
Buffer< UUID > getModelIDsByType(const StringView &type) const
Returns the UUIDs of all models matching the specified type string.
virtual void runDesignCommand(const DynamicPointer< DesignCommand > &command)
Runs a design command synchronously.
WLock tryCommandLock()
Attempts to acquire a command write lock without blocking.
void stopUpdateThread()
Stops the background update thread if it is running.
virtual void addCameraModel(const UUID &camera, const Model &object)
Associates a model with a specific camera.
virtual void addLayer(Model layer)
Registers a layer model in the lookup.
void removeDeletedObject(UUID id)
Removes an object from the deleted objects store permanently.
virtual void update(const Time &time, const std::function< void()> &wait_callback)
Performs a periodic update of all design objects and effects.
Scene m_default_scene
The default scene, constant to the application (not written to files).
DesignCommandManager * m_command_controller
Manages the design command queue and execution.
RLock tryReadLock(uint08 milliseconds=10) const
Attempts to acquire a read lock within the specified timeout.
void addUpdateTarget(DesignObjectUpdateTarget *target)
Registers a target to receive design object update notifications.
const Dictionary< UUID, Effect > & effectObjects()
Returns the dictionary of all registered effects.
Buffer< Model > getCameraObjects() const
Returns all models that are associated with cameras.
virtual void clearSelected()
Clears all currently selected objects.
bool hasModelID(const UUID &id, bool allow_deleted=false) const
Checks whether a model with the given UUID exists.
virtual Material restoreMaterial(UUID id)
Restores a previously deleted material back into the lookup.
ConstPointer< Camera > getCamera(const UUID &id) const
Retrieves a const camera pointer by its UUID.
Model model(const UUID &id, bool allow_deleted=false) const
Retrieves a model by its UUID.
const Dictionary< UUID, Geometry > & geometryObjects()
Returns the dictionary of all registered geometries.
bool hasModelsOfType(const StringView &type) const
Checks whether any models of the specified type exist.
RDesignLock readLock(UUID id)
Acquires a design-specific read lock for the object with the given UUID.
void ensureLayerExistsInScene(const UUID &layer_id, const UUID &scene_id)
Ensures a layer exists within a specific scene, creating it if necessary.
virtual DesignTaskManager * taskManager() const
Returns the design task manager.
bool hasLayersOfType(const StringView &type) const
Checks whether any layers of the specified type exist.
UUID m_active_project
The UUID of the currently active project.
DesignParameterAccumulator accumulateDesignParameter(const DesignParameter &channel, const BitFlag &accumulation_flags) const
Accumulates statistics for a single design parameter.
virtual void addGeometry(Geometry object)
Registers a geometry in the lookup.
Set< UUID > getExcludedIDs(UUID camera_id) const
Returns the set of object IDs excluded from a specific camera's view.
TimeSpan m_preferred_update_timespan
The preferred interval between background update cycles.
DynamicPointer< Camera > getCamera(const UUID &id)
Retrieves a mutable camera pointer by its UUID.
void postCommand(const DynamicPointer< t_design_command_type > &command)
Posts a typed design command for asynchronous execution.
void deleteLayer(const UUID &layer_id, const UUID &scene_id)
Removes a layer from a specific scene.
virtual Model restoreModel(UUID id)
Restores a previously deleted model back into the lookup.
const Dictionary< UUID, Material > & materialObjects()
Returns the dictionary of all registered materials.
const Dictionary< UUID, Model > & getAllSceneLayers(const UUID &id) const
Returns all layers associated with a given scene.
UUID m_uuid
The unique identifier for this DesignObjectLookup instance.
Dictionary< UUID, Scene > m_referenced_scenes
Scenes referenced by the lookup but not directly owned.
Bounds< 3, fltp08 > boundsOfVisible() const
Computes the 3D bounding box encompassing all visible objects.
const ConstPointer< DesignSelection > & getSelectionInfo(const UUID &id) const
Retrieves a const selection info pointer by its UUID.
void updateEffects(const Time &time, const std::function< void()> &wait_callback)
Updates all active effects for the current time step.
bool hasSceneID(const UUID &id, bool allow_deleted=false) const
Checks whether a scene with the given UUID exists.
Buffer< Model > getLayersByType(const StringView &type) const
Returns all layers matching the specified type string.
Model createCameraModel(UUID camera)
Creates a new model associated with a specific camera.
const Dictionary< UUID, Model > & modelObjects()
Returns the dictionary of all registered models.
void removeUpdateTarget(DesignObjectUpdateTarget *target)
Unregisters a target from receiving design object update notifications.
ResourceListener * m_language_change_listener
Listener that triggers translation updates on language change.
bool hasObjectID(const UUID &id, bool allow_deleted=false) const
Checks whether any design object with the given UUID exists.
virtual void finishCommand(const DynamicPointer< DesignCommand > &command)
Finalizes a design command after execution.
virtual void postDesignCommand(const DynamicPointer< DesignCommand > &command)
Posts a design command for asynchronous execution.
Buffer< Model > getRootObjects(UUID camera_id, bool include_app_owned=false) const
Returns root-level model objects visible to a specific camera.
bool hasLayerID(const UUID &id, bool allow_deleted=false) const
Checks whether a layer with the given UUID exists in any scene.
void performDeletion(Buffer< UUID > deleted_objects)
Permanently removes the specified objects from all stores.
virtual CameraManager * cameraManager()
Returns the camera manager.
Buffer< Model > getModelsByID(const Set< UUID > &ids) const
Retrieves models by their UUIDs from a set.
bool m_update_station_visuals
Whether station visuals need to be re-rendered.
const void * lockPtr() const
Returns a raw pointer to the internal lock primitive.
virtual void addMaterial(Material object)
Registers a material in the lookup.
UUID m_active_layer
The UUID of the currently active layer.
DesignTaskManager * m_task_controller
Manages asynchronous design tasks.
void processSelection(SelectionInfo &info) const
Processes a selection query and populates the given SelectionInfo.
const Scene & defaultScene()
Returns the default scene, which is constant to the application.
virtual SelectionController * selectionController()
Returns the selection controller for viewport-based selection.
Resource< Time > autosave_checkpoint_request_time
The time of the most recent auto-save checkpoint request.
SelectionEffect * m_selection_effect
The visual effect applied to selected objects.
Geometry createMesh()
Creates a new mesh geometry and registers it in the lookup.
Buffer< UUID > selected() const
Returns the UUIDs of all currently selected objects.
RLock readLock(const std::function< void()> &wait_callback) const
Acquires a shared read lock, calling a callback while waiting.
DynamicPointer< Camera > createCamera(Model &parent, const ViewportFormat &format)
Creates a new camera as a child of the specified parent model.
virtual void addSelection(const DesignSelection &object)
Adds a design selection to the lookup.
const Dictionary< UUID, DesignObject > & deletedObjects()
Returns the dictionary of all deleted design objects.
virtual void setActiveLayer(UUID layer_id)
Sets the active layer by UUID.
virtual void addEffect(Effect object)
Registers an effect in the lookup.
bool m_update_station_font
Whether station fonts need to be re-rendered.
Dictionary< UUID, Model > m_referenced_root_objects
Root objects referenced from external sources.
bool isCommandLocked() const
Checks whether the command lock is currently held.
Material material(const UUID &id, bool allow_deleted=false) const
Retrieves a material by its UUID.
Buffer< DesignObjectUpdateTarget * > m_update_targets
Registered targets that receive design object update notifications.
Dictionary< UUID, std::pair< UUID, uint04 > > m_erased_objects
Erased objects stored with their parent UUID and child index.
Dictionary< UUID, Model > m_model_root_objects
Top-level root model objects.
virtual LogManager * logManager() const
Returns the log manager.
Buffer< Model > getLayersByType(const Buffer< String > &types) const
Returns all layers matching any of the specified type strings.
Model createLayer()
Creates a new layer model and registers it in the lookup.
Scene scene(const UUID &id, bool allow_deleted=false) const
Retrieves a scene by its UUID.
Material createMaterial()
Creates a new material and registers it in the lookup.
SelectionController * m_selection_controller
Manages viewport-based selection logic.
virtual DesignCommandManager * commandManager()
Returns the design command manager.
WLock writeLock() const
Acquires an exclusive write lock on the design object store.
const Dictionary< UUID, Dictionary< UUID, Model > > & layerObjects()
Returns the dictionary of all registered layers, organized by scene.
Thread * m_update_thread
The background update thread, or nullptr if not running.
WLock tryWriteLock(uint08 milliseconds=10)
Attempts to acquire a write lock within the specified timeout.
Buffer< DesignParameter > designParameters() const
Returns all available design parameters across all stored objects.
Buffer< Model > getModelsByType(const StringView &type) const
Returns all models matching the specified type string.
Resource< RGBColor > focus_color
The highlight color used for focused objects.
Buffer< Model > getModelsByName(const StringView &name) const
Retrieves all models whose name matches the given string.
virtual void refreshModel(const Model &object)
Triggers a refresh of the specified model.
Dictionary< UUID, Geometry > m_geometry_objects
All registered geometry objects keyed by UUID.
virtual void refreshScene(UUID scene_id)
Triggers a refresh of the scene with the given ID.
bool hasLayerID(const UUID &id, const UUID &scene_id) const
Checks whether a layer with the given UUID exists within a specific scene.
Model layer(const UUID &layer_id, const UUID &scene_id, bool allow_deleted=false) const
Retrieves a layer by its UUID within a specific scene.
An object that will be called to update each time the lookup is updated.
A low-level database object that can be used to access general stored properties within the NDEVR Mod...
Searches a model hierarchy and pulls all parameter data based on the AccumationMode settings.
A definition of data that is logically stored in the Model hierarchy.
A simple structure for storing a collection of data.
Manages all active and inactive tasks for a DesignObjectLookup.
A hash-based key-value store, useful for quick associative lookups.
Provides a modifiable pointer that has shared ownership of a dynamically allocated object.
A core class that provides a dynamic effect to an object in a model hierarchy.
Provides consistent interface to handle errors through the throw expression.
A core class within the model hierarchy containing vertex-based data (Usually 3D data) within a set c...
A class that has any number of children that also feed into the log.
Serves as the primary program interface for processes to report issues and allows any number of LogSt...
Container responsible for storing and setting the appearance of a Model or Geometry within the NDEVR ...
Takes user input in order to modify a model in real-time.
A core class that represents a node on model hierarchy.
A Model which represents a user-project.
Used to lock a particular model for editing (DEPRECIATED).
Used to lock a particular variable for reading.
A class that can subscribe to any number of Resources which will get updates when the Resource(s) hav...
A core part of the engine, stores variables that can be listened to with ResourceListener which will ...
The root Model that is responsible for storing the underlying data for all Scene Models.
Allows user to select data in a DesignObjectLookup.
Applies certain effects to a model that has been selected.
Responsible for turning a user interaction into a selection within a DesignObjectLookup.
Container that stores unique elements in no particular order, and which allow for fast retrieval or i...
The core String View class for the NDEVR API.
The core String class for the NDEVR API.
The default thread class for executing concurrent sequences in the NDEVR API.
Stores a time span, or difference between two times, with an optional start time.
Represents a timestamp with utilities for manipulation and conversion.
Any text displayed to the user should be defined as a TranslatedString which allows the program to lo...
A universally unique identifier (UUID) is a 128-bit number used to identify information in computer s...
Used to lock a particular model for editing (DEPRECIATED).
Used to lock a particular variable for writing.
The primary namespace for the NDEVR SDK.
uint64_t uint08
-Defines an alias representing an 8 byte, unsigned integer
Logic for automatically zooming a Camera or Viewport to a certain location or having certain objects ...