NDEVR
API Documentation
VirtualCameraView.h
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: VirtualCameraView
29Included in API: True
30Author(s): Tyler Parke
31 *-----------------------------------------------------------------------------------------**/
32#pragma once
33#include "DLLInfo.h"
34#include <NDEVR/CameraView.h>
35#include <NDEVR/Pointer.h>
36#include <NDEVR/UUID.h>
37#include <NDEVR/Buffer.h>
38#include <NDEVR/Dictionary.h>
39
40#include <QWidget>
41class QMenu;
42namespace NDEVR
43{
45 class QTModelManager;
46 class CameraToolbar;
47 class QTGraphicsWindow;
48 class QTGraphicsWidget;
49 class CameraEditor;
50 class CameraRulerMenu;
51 class Camera;
52 class CameraManager;
54 class Ruler;
55 class Button;
56 class File;
57 class String;
65 class NDEVR_GRAPHICS_API VirtualCameraView : public CameraView
66 {
67 Q_OBJECT
68 public:
74 VirtualCameraView(QTGraphicsWidget* widget, const DynamicPointer<Camera>& camera, QTModelManager* model_manager, QWidget* parent = nullptr);
78 VirtualCameraView(QTGraphicsWidget* widget, QWidget* parent = nullptr);
83 void dragEnterEvent(QDragEnterEvent *event) override;
86 void dropEvent(QDropEvent *event) override;
88 void updateView() override;
91 void setSwapMode(SwapMode mode) override;
103 QWidget* cameraToolbar() override;
107 bool event(QEvent* e) override;
110 void setTouchTheme(bool touch_theme) override;
113 void showToolRibbon(bool visible) override;
115 void resetToolRibbon() override;
118 UUID id() const override;
121 virtual ConstPointer<Camera> camera() const override;
124 virtual DynamicPointer<Camera> camera() override;
127 virtual void addWidget(const QPointer<QWidget>& widget) override;
130 virtual void removeWidget(const QPointer<QWidget>& widget) override;
135 QImage screenshot();
138 void screenshotToClipboard(bool include_background);
139#if NDEVR_IMAGE_MODEL
142 void screenshotToObject(bool include_background);
143#endif
146 void screenshotToPrint(uint04 index = Constant<uint04>::Invalid);
149 void toPDF(const File& pdf_file);
153 void addContextCustomMenu(const UUID& id, ContextMenuCallback* callback) override;
159 void requestShowInfoDisplay(bool should_show) override;
160 protected:
162 void init();
165 protected slots:
168 void showContextMenu(const QPoint &pos);
171 void requestCameraLink(bool selected);
174 void onMaterialDeleted(UUID material);
175
180 protected:
181 QMenu* m_menu = nullptr;
201 bool m_should_show_info = true;
202 };
203}
A dialog for allowing the user to specify a background or sun position of a particular camera or view...
A core widget that allows the user to click one of many button types.
Definition Button.h:68
Editor for a Virtual Camera which allows for adjustment of background colors, locations,...
Forward declaration of the skybox environment rendering class.
A menu that provides options for configuring ruler visibility, grid display, and camera locking for a...
Definition Ruler.h:244
Typically shown under a virtual camera view, allows the user to input various settings for a camera o...
A core object representing a user view as well as convenience functions for moving this view through ...
Definition Camera.h:95
Provides a constant, unmodifiable pointer that has shared ownership of a dynamically allocated object...
Definition Pointer.hpp:276
Allows for customization of what is shown when the user right-clicks or accesses the ContextMenu for ...
A hash-based key-value store, useful for quick associative lookups.
Definition Dictionary.h:64
Provides a modifiable pointer that has shared ownership of a dynamically allocated object.
Definition Pointer.hpp:356
Logic for reading or writing to a file as well as navigating filesystems or other common file operati...
Definition File.h:53
Provides a wrapper for a widget that can be docked inside a Container or floated as a top-level windo...
A Widget wrapper around a QTGraphicsWindow that allows it to be used inside the UI framework.
A Window used to render 3D graphics.
A wrapper around DesignObjectLookup that provides signal and slot functionality and adds rendering ca...
A ResourceListener which will always be executed on the main UI thread and can be tied to a Qt Object...
Definition QTTools.h:493
A widget meant to be placed beside a camera view showing either directional or measurement markings d...
Definition Ruler.h:54
The core String class for the NDEVR API.
Definition String.h:95
A universally unique identifier (UUID) is a 128-bit number used to identify information in computer s...
Definition UUID.h:61
void setModelManager(QTModelManager *manager)
Sets the model manager.
QTResourceListener * m_selection_info_listener
Listener for selection info changes.
bool m_should_show_info
Whether the info display overlay is shown.
void toPDF(const File &pdf_file)
Exports the view to a PDF file.
bool m_show_top_ruler_ortho
Whether top ruler is shown in orthographic mode.
QTGraphicsWidget * m_graphics_widget
The graphics widget container.
VirtualCameraView(QTGraphicsWidget *widget, QWidget *parent=nullptr)
Constructs a camera view without an initial camera.
QImage screenshot()
Captures the current view as a QImage.
void requestShowInfoDisplay(bool should_show) override
Requests showing or hiding the info display overlay.
QTResourceListener * m_cursor_listener
Listener for cursor changes.
void setSwapMode(SwapMode mode) override
Sets the swap chain presentation mode.
void updateView() override
Updates the view state from the camera and scene.
bool m_show_edge_ruler_perspective
Whether edge ruler is shown in perspective mode.
CameraRulerMenu * m_ruler_combo
Ruler configuration menu.
void requestCameraLink(bool selected)
Handles a camera link request from the toolbar.
bool m_show_top_ruler_perspective
Whether top ruler is shown in perspective mode.
void screenshotToPrint(uint04 index=Constant< uint04 >::Invalid)
Sends a screenshot to the printer.
void removeOverrideMaterial()
Removes the current override material.
void screenshotToClipboard(bool include_background)
Copies a screenshot to the clipboard.
CameraToolbar * m_camera_toolbar
The camera control toolbar.
void showToolRibbon(bool visible) override
Shows or hides the tool ribbon.
void onMaterialDeleted(UUID material)
Handles deletion of the override material.
void updateCursor()
Updates the mouse cursor from the current controller state.
bool event(QEvent *e) override
Handles events for the view.
bool m_show_toolbar
Whether the camera toolbar is visible.
QTResourceListener * m_orientation_listener
Listener for orientation changes.
virtual ConstPointer< Camera > camera() const override
Returns the camera (const).
Dictionary< UUID, ContextMenuCallback * > m_custom_context_callbacks
Custom context menu callbacks.
void setupRulers()
Sets up the edge and top rulers.
~VirtualCameraView()
Destructor.
QWidget * cameraToolbar() override
Returns the camera toolbar widget.
virtual DynamicPointer< Camera > camera() override
Returns the camera.
QTResourceListener * m_orthograhic_listener
Listener for orthographic mode changes.
QTModelManager * m_model_manager
The model manager.
void addContextCustomMenu(const UUID &id, ContextMenuCallback *callback) override
Adds a custom context menu callback for this view.
Button * m_ruler_button
Button toggling ruler visibility.
void setTouchTheme(bool touch_theme) override
Switches the UI to touch-optimized or desktop theme.
bool m_show_edge_ruler_ortho
Whether edge ruler is shown in orthographic mode.
virtual void removeWidget(const QPointer< QWidget > &widget) override
Removes an overlay widget from the view.
void editOverrideMaterial()
Opens the override material editor.
void dropEvent(QDropEvent *event) override
Handles drop events for file import.
Ruler * m_top_ruler
Top (horizontal) ruler widget.
Ruler * m_side_ruler
Side (vertical) ruler widget.
QTGraphicsWindow * m_graphics_window
The underlying graphics window.
virtual void addWidget(const QPointer< QWidget > &widget) override
Adds an overlay widget to the view.
QMenu * m_menu
The right-click context menu.
void setCamera(const DynamicPointer< Camera > &camera)
Sets the camera for this view.
UUID id() const override
Returns the UUID of this view.
bool m_touch_theme
Whether touch-optimized theme is active.
void init()
Initializes the view layout, toolbar, and signal connections.
void dragEnterEvent(QDragEnterEvent *event) override
Handles drag-enter events for file drop support.
void showContextMenu(const QPoint &pos)
Shows the right-click context menu.
QTGraphicsWindow * graphicsWindow() const
Returns the underlying graphics window.
String getCursorID() const
Returns the current cursor identifier string.
VirtualCameraView(QTGraphicsWidget *widget, const DynamicPointer< Camera > &camera, QTModelManager *model_manager, QWidget *parent=nullptr)
Constructs a camera view with a specific camera and model manager.
void resetToolRibbon() override
Resets the tool ribbon to its default state.
The primary namespace for the NDEVR SDK.
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...