API Documentation
Loading...
Searching...
No Matches
QTModelManager.h
Go to the documentation of this file.
1/*--------------------------------------------------------------------------------------------
2Copyright (c) 2019, NDEVR LLC
3tyler.parke@ndevr.org
4 __ __ ____ _____ __ __ _______
5 | \ | | | __ \ | ___|\ \ / / | __ \
6 | \ | | | | \ \ | |___ \ \ / / | |__) |
7 | . \| | | |__/ / | |___ \ V / | _ /
8 | |\ |_|_____/__|_____|___\_/____| | \ \
9 |__| \__________________________________| \__\
10
11Subject to the terms of the Enterprise+ Agreement, NDEVR hereby grants
12Licensee a limited, non-exclusive, non-transferable, royalty-free license
13(without the right to sublicense) to use the API solely for the purpose of
14Licensee's internal development efforts to develop applications for which
15the API was provided.
16
17The above copyright notice and this permission notice shall be included in all
18copies or substantial portions of the Software.
19
20THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
21INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
22PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
23FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
24OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25DEALINGS IN THE SOFTWARE.
26
27Library: NDEVR
28File: QTModelManager
29Included in API: True
30Author(s): Tyler Parke
31 *-----------------------------------------------------------------------------------------**/
32#pragma once
33#include "DLLInfo.h"
34#include <NDEVR/PopupInfo.h>
35#include <NDEVR/SelectionTreeManager.h>
36#include <NDEVR/Model.h>
37#include <NDEVR/DesignObjectLookup.h>
38#include <NDEVR/SnapLocation.h>
39
40#include <NDEVR/UUID.h>
41#include <NDEVR/Dictionary.h>
42#include <QTimer>
43class QMenu;
44class QMimeData;
45namespace NDEVR
46{
47 struct FileRequest;
48 struct ExportRequest;
49 struct ShowPropertiesSettings;
50 class QTModelManagerView;
51 class QTDesignObject;
52 class WindowManager;
53 class VulkanSession;
54 class QCaptureManager;
55 class CachedFactoryIOThread;
56 class FileFormat;
57 class LibraryManager;
58 class ModelEditController;
59 class BasicThread;
60 class Thread;
61 class Project;
62 struct FactoryParameters;
63 class QTModelManager;
64 class ProjectFileManager;
65 class ContextMenuManager;
66 class DesignCommand;
67 class GraphicsSession;
68 class GraphicsDevice;
69 struct CaptureRequest;
70 class GraphicsManagerBase : public QObject
71 {
72 public:
73 virtual bool hasGraphicsSession(const DynamicPointer<GraphicsDevice>& device) = 0;
75 virtual void addGraphicsSession(DynamicPointer<GraphicsSession> session, bool add_cameras = true) = 0;
76 virtual bool requestHandleManagerUpdating() const = 0;
77 virtual void addRequest(const ConstPointer<CaptureRequest>& request) = 0;
78 virtual void executeRequest(const ConstPointer<CaptureRequest>& request) = 0;
79 virtual void removeRequest(const ConstPointer<CaptureRequest>& request) = 0;
80 virtual void clearAll() const = 0;
81 virtual bool canServiceCaptureRequests() const = 0;
82 };
93 class NDEVR_API QTModelManager : public QObject, public DesignObjectLookup
94 {
95 Q_OBJECT
96 public:
98 QTModelManager(const QTModelManager& manager) = delete;
99 virtual ~QTModelManager();
100 virtual void addScene(Scene object, bool ignore_application_scene = false) override;
101 virtual void addGeometry(Geometry object) override;
102 virtual void addModel(Model object) override;
103 virtual void addLayer(Model object) override;
104 virtual void addMaterial(Material object) override;
105 virtual LogManager* logManager() const override;
106#if NDEVR_VIEWPORT
107 virtual void addCamera(const DynamicPointer<Camera>& object) override;
108#endif
109 void deleteObject(UUID id) override;
110 virtual void eraseModel(UUID id) override;
111 virtual Model restoreModel(UUID id) override;
113
114 virtual void addCameraModel(const UUID& camera, const Model& object) override;
115
118
119 virtual void ShowProperties(const ShowPropertiesSettings& settings);
120
121
122 WindowManager* windowManager() { return m_window_manager; }
123 virtual void setWindowManager(WindowManager* manager) { m_window_manager = manager; }
124 ContextMenuManager* contextMenuManager() { return m_context_menu_manager; }
125
126 virtual Buffer<UUID> selected() const;
127
128
129 virtual void updateModelTopLevel(const Model& object) override;
130 virtual void update(const Time& time, const std::function<void()>& wait_callback) override;
131 virtual void setActiveProject(UUID project_id) override;
133
134 virtual bool canProcessMimeData(const QMimeData* data) const;
135 virtual void processMimeData(const QMimeData* data, PopupInfo origin = PopupInfo());
136 virtual void exportModels(ExportRequest request);
137 virtual void saveModel(FactoryParameters& file, bool is_blocking = false);
138 //virtual void loadModel(Buffer<FactoryParameters, uint04, ObjectAllocator<false>>& files, bool is_blocking = false);
139 virtual void setActiveLayer(UUID layer_id) override;
140 virtual void startQTUpdate(const TimeSpan& interval);
141 virtual void stopQTUpdate();
142 virtual void stopAll();
143 virtual void clearSelected() override;
144 virtual void setSelected(Buffer<UUID> ids) override;
145 virtual void appendSelected(Buffer<UUID> ids) override;
146 virtual void removeSelected(Buffer<UUID> ids);
147 ProjectFileManager* projectFileManager() { return m_project_file_manager; }
149 void setGraphicsManager(GraphicsManagerBase* graphics_manager) { m_graphics_manager = graphics_manager; };
150 virtual DesignTaskManager* taskManager() const override;
151 virtual bool hasBeenModified() const;
152 virtual void requestQTUpdate();
153 virtual void clearAll() override;
154 virtual bool hasUserSavedProject() const;
155 virtual void setProjectTimeZone();
156 void popSelected(const UUID& id, bool signal = true);
157 void addSelected(const UUID& id, bool signal = true);
158 void setRequestDeploymentCallback(const String& callback_name, const std::function<void(const UUID&)>& callback);
159 const Dictionary<String, std::function<void(const UUID&)>>& requestDeploymentCallbacks();
160 virtual bool useProjectFolders() const;
161 virtual void postCommand(const DynamicPointer<DesignCommand>& command) override;
162 virtual void runCommand(const DynamicPointer<DesignCommand>& command) override;
163 private:
164 virtual void _qtUpdate(const Time& time);
165 virtual void _qtUpdateDeleted(UUID model);
166 virtual void _qtUpdateDeleted();
167 virtual void _qtUpdateAdded();
168 virtual void _qtUpdateModified();
169 virtual void _qtUpdateModelModified(UUID model, Buffer<UUID>& ids);
170
171 public slots:
172 void popFocus();
174 void setFocus(UUID id);
175 protected slots:
176 void qtUpdate();
177 signals:
178 void canExitApplicationSignal(bool can_exit);
179 void canOpenProjectSignal(bool can_open_project);
180 void canImportFileSignal(bool can_import_file);
193 void onAddCameraObject(UUID camera, UUID object);
195 void onZoomToModel(SnapLocation location, UUID id, UUID camera);
196 void onZoomToModel(SnapLocation location, UUID id);
197
205
207
212 void onSelectedSignal(Buffer<UUID> ids, bool selected);
213 void onSwapSelectedSignal(Buffer<UUID> old_selected, Buffer<UUID> new_selected);
214 void onUpdateFocus(UUID id, bool focussed);
215 private slots:
216 void _cleanupMemory();
217 void _refreshModelList();
218 private:
219 void finishCommand(const DynamicPointer<DesignCommand>& command) override;
220 void refreshScene(UUID object, bool ignore_application_scene) override;
221 protected:
222#if NDEVR_VIEWPORT
223 SelectionTreeManager m_selection_tree_manager;
224#endif
237 WindowManager* m_window_manager = nullptr;
238 ProjectFileManager* m_project_file_manager = nullptr;
239 QTModelManagerView* m_manager_view = nullptr;
240 ContextMenuManager* m_context_menu_manager = nullptr;
241 GraphicsManagerBase* m_graphics_manager = nullptr;
243#if NDEVR_SUPPORTS_THREADING
244 CachedFactoryIOThread* m_write_thread = nullptr;
245#endif
249 };
250
251}
#define NDEVR_API
Definition DLLInfo.h:67
The equivelent of std::vector but with a bit more control. The basic array unit of the library.
Definition Buffer.hpp:59
Definition CachedFactoryIOThread.h:43
Provides a constant, unmodifiable pointer that has shared ownership of a dynamically allocated object...
Definition GraphicsPipeline.h:42
Definition ContextMenuManager.h:39
A core class where all Design Objects including models, materials, and geometries are stored.
Definition DesignObjectLookup.h:65
Manages all active and inactive tasks for a DesignObjectLookup.
Definition DesignTask.h:28
A hash-based key-value store, useful for quick associative lookups.
Definition Dictionary.h:59
Provides a modifiable pointer that has shared ownership of a dynamically allocated object.
Definition Pointer.hpp:319
A core class within the model heirarchy containing data (Usually 3D data) within a set container.
Definition Geometry.h:54
Definition QTModelManager.h:71
virtual bool hasGraphicsSession(const DynamicPointer< GraphicsDevice > &device)=0
virtual void clearAll() const =0
virtual void addRequest(const ConstPointer< CaptureRequest > &request)=0
virtual const DynamicPointer< GraphicsSession > & graphicsSession(const DynamicPointer< GraphicsDevice > &device)=0
virtual void removeRequest(const ConstPointer< CaptureRequest > &request)=0
virtual void addGraphicsSession(DynamicPointer< GraphicsSession > session, bool add_cameras=true)=0
virtual void executeRequest(const ConstPointer< CaptureRequest > &request)=0
virtual bool requestHandleManagerUpdating() const =0
virtual bool canServiceCaptureRequests() const =0
Definition QTModelManager.h:84
static NDEVR_API void SetDefaultFactory(GraphicsManagerFactory *factory)
virtual GraphicsManagerBase * createManager(QTModelManager *manager)=0
static NDEVR_API GraphicsManagerFactory * DefaultFactory()
static GraphicsManagerFactory * s_factory
Definition QTModelManager.h:91
A class that has any number of children that also feed into the log. Can be used to easily.
Definition LogManager.h:14
Definition Material.h:45
A core class that represents a node on model heirarchy. This node may contain a Geometry or.
Definition Model.h:58
Definition ProjectFileManager.h:25
Definition QTModelManager.h:94
virtual void stopAll()
void onSwapSelectedSignal(Buffer< UUID > old_selected, Buffer< UUID > new_selected)
virtual void addCameraModel(const UUID &camera, const Model &object) override
WindowManager * windowManager()
Definition QTModelManager.h:122
virtual DynamicPointer< QTDesignObject > getQTObject(UUID id)
bool m_is_updating
Definition QTModelManager.h:247
void onCommandExecutedSignal(UUID id)
GraphicsManagerBase * graphicsManager()
void setFocus(UUID id)
void setRequestDeploymentCallback(const String &callback_name, const std::function< void(const UUID &)> &callback)
void onDeleteModel(UUID id)
virtual DynamicPointer< LibraryManager > libraryManager()
void onZoomToModel(SnapLocation location, UUID id, UUID camera)
Buffer< UUID > m_selected_object
Definition QTModelManager.h:233
virtual void addModel(Model object) override
void onDeleteCommand(UUID id)
void onUpdateFocus(UUID id, bool focussed)
Buffer< UUID > m_added_objects
Definition QTModelManager.h:230
void onDeleteGeometry(UUID id)
void onZoomToModel(SnapLocation location, UUID id)
void onAddCamera(UUID id)
void onActiveProjectChanged(UUID id)
Time m_last_audit_time
Definition QTModelManager.h:226
void addLayerSignal(Buffer< UUID > id)
QTModelManager(const QTModelManager &manager)=delete
void onShowPropertiesRequested(UUID object)
virtual DesignTaskManager * taskManager() const override
virtual void ShowProperties(const ShowPropertiesSettings &settings)
Buffer< UUID > m_top_level_change
Definition QTModelManager.h:235
void popSelected(const UUID &id, bool signal=true)
Buffer< UUID > m_objects_to_remove
Definition QTModelManager.h:234
virtual void removeSelected(Buffer< UUID > ids)
ContextMenuManager * contextMenuManager()
Definition QTModelManager.h:124
ProjectFileManager * projectFileManager()
Definition QTModelManager.h:147
virtual void saveModel(FactoryParameters &file, bool is_blocking=false)
virtual bool hasBeenModified() const
void onDeleteObject(UUID id)
virtual bool useProjectFolders() const
virtual void startQTUpdate(const TimeSpan &interval)
void onDeleteObjects(Buffer< UUID > ids)
virtual void exportModels(ExportRequest request)
virtual void addLayer(Model object) override
void activeLayerChangedSignal(UUID id)
void onObjectUpdatedSignal(const Buffer< UUID > &ids)
Time m_last_qt_update_time
Definition QTModelManager.h:225
virtual void setWindowManager(WindowManager *manager)
Definition QTModelManager.h:123
virtual void clearSelected() override
virtual Model restoreModel(UUID id) override
QTimer m_auto_save_timer
Definition QTModelManager.h:229
virtual LogManager * logManager() const override
virtual bool canProcessMimeData(const QMimeData *data) const
void onRefreshObject(UUID id)
void deleteObject(UUID id) override
virtual void setActiveLayer(UUID layer_id) override
void onAddCommand(UUID id)
Dictionary< UUID, DynamicPointer< QTDesignObject > > m_qt_design_objects
Definition QTModelManager.h:236
virtual QTModelManagerView * modelManagerView()
const Dictionary< String, std::function< void(const UUID &)> > & requestDeploymentCallbacks()
virtual void requestQTUpdate()
Buffer< UUID > m_deleted_objects
Definition QTModelManager.h:231
virtual void updateModelTopLevel(const Model &object) override
virtual void processMimeData(const QMimeData *data, PopupInfo origin=PopupInfo())
void onDeleteMaterial(UUID id)
virtual void clearAll() override
UUID m_focused_object
Definition QTModelManager.h:227
void onUpdateCommand(UUID id)
void setGraphicsManager(GraphicsManagerBase *graphics_manager)
Definition QTModelManager.h:149
bool m_needs_cleanup
Definition QTModelManager.h:246
void onAddMaterial(Buffer< UUID > id)
void onAddCameraObject(UUID camera, UUID object)
virtual void setActiveProject(UUID project_id) override
void canOpenProjectSignal(bool can_open_project)
virtual Buffer< DynamicPointer< QTDesignObject > > getQTObjectsByID(const Buffer< UUID > &ids)
virtual void eraseModel(UUID id) override
void onAddGeometry(Buffer< UUID > id)
void onDeleteCamera(UUID id)
void layerUpdatedSignal(UUID id)
virtual void setSelected(Buffer< UUID > ids) override
virtual Buffer< UUID > selected() const
virtual void appendSelected(Buffer< UUID > ids) override
void canImportFileSignal(bool can_import_file)
virtual void stopQTUpdate()
virtual void addScene(Scene object, bool ignore_application_scene=false) override
void addSelected(const UUID &id, bool signal=true)
virtual void setProjectTimeZone()
void onAddScene(Buffer< UUID > id)
virtual void addMaterial(Material object) override
QTimer m_launch_timer
Definition QTModelManager.h:228
virtual void postCommand(const DynamicPointer< DesignCommand > &command) override
DynamicPointer< LibraryManager > m_library_manager
Definition QTModelManager.h:242
virtual void update(const Time &time, const std::function< void()> &wait_callback) override
void canExitApplicationSignal(bool can_exit)
void onModelTopLevelChange(Buffer< UUID > id)
void onAddModel(Buffer< UUID > id)
Buffer< UUID > m_erased_objects
Definition QTModelManager.h:232
void onSelectedSignal(Buffer< UUID > ids, bool selected)
virtual void addGeometry(Geometry object) override
virtual bool hasUserSavedProject() const
Dictionary< String, std::function< void(const UUID &)> > m_request_deployment_callbacks
Definition QTModelManager.h:248
virtual void runCommand(const DynamicPointer< DesignCommand > &command) override
Definition QTModelManagerView.h:41
The root Model that is responsible for storing the underlying data for all Scene Models.
Definition Model.h:492
The core String class for the software.
Definition String.h:47
Represents a timestamp with utilities for manipulation and conversion.
Definition Time.h:54
Stores a time span, or difference between two times, with an optional start time.
Definition TimeSpan.h:46
A universally unique identifier (UUID) is a 128-bit number used to identify information in computer s...
Definition UUID.h:62
Definition WindowManager.h:68
Definition ACIColor.h:37
SnapLocation
A list of directions that a view can be pointed relative to an object or scene.
Definition ViewLocation.h:40
Definition ExportRequest.h:7
A container of input information that is to be filled with output information by an IOFactory.
Definition IOFactory.h:61
Definition PopupInfo.h:10
Definition ShowPropertySettings.h:22