NDEVR
API Documentation
CameraLocationCombo.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: CameraLocationCombo
29Included in API: True
30Author(s): Tyler Parke
31 *-----------------------------------------------------------------------------------------**/
32#pragma once
33#include <NDEVR/QTDesignObject.h>
34#if NDEVR_VIEWPORT
35#include <NDEVR/DesignObjectWidgetInterface.h>
36#include <NDEVR/QTTools.h>
37#include <NDEVR/Camera.h>
38#include <NDEVR/Pointer.h>
39#include <NDEVR/TimeSpan.h>
40#include <QAction>
41#include <QActionGroup>
42#include <QMenu>
43namespace NDEVR
44{
45 class Button;
46 class QTModelManager;
50 class NDEVR_API CameraLocationCombo : public QTResourceListener, public DesignObjectWidgetInterface
51 {
52 Q_OBJECT
53 public:
60 CameraLocationCombo(QTModelManager* manager, Button* combo, bool include_combo);
73 void removeTarget(const DynamicPointer<QTDesignObject>& object) override;
78 void addTarget(const DynamicPointer<QTDesignObject>& object) override;
82 void setupMenu();
87 void setup(bool include_combo);
97 void setCamera(const DynamicPointer<Camera>& camera);
102 void onZoom(SnapLocation location);
111 virtual void onTargetUpdated(UUID) override;
112 signals:
117 protected:
119 Button* m_combo = nullptr;
122 QMenu* m_menu = nullptr;
123 QAction* m_perspective = nullptr;
124 QAction* m_orthographic = nullptr;
125 QAction* m_top = nullptr;
126 QAction* m_bottom = nullptr;
127 QAction* m_front = nullptr;
128 QAction* m_back = nullptr;
129 QAction* m_left = nullptr;
130 QAction* m_right = nullptr;
131 QAction* m_settings = nullptr;
132 QActionGroup* m_view_mode_group = nullptr;
133 QActionGroup* m_view_location_group = nullptr;
134 bool m_is_relative_combo = false;
135 bool m_has_pending = false;
136 bool m_include_combo = true;
137 };
138}
139#endif
A core widget that allows the user to click one of many button types.
Definition Button.h:68
void setup(bool include_combo)
Initializes the combo with menu actions and signal connections.
QAction * m_front
Action to snap camera to front view.
bool m_include_combo
Whether combo-style dropdown behavior is enabled.
QActionGroup * m_view_mode_group
Group for perspective/orthographic toggle.
bool m_has_pending
Whether a pending update is queued.
void addTarget(const DynamicPointer< QTDesignObject > &object) override
Adds a design object target to this widget.
bool m_is_relative_combo
Whether this combo uses relative snap locations.
Button * m_combo
The button hosting the snap location menu.
virtual void onTargetUpdated(UUID) override
Called when a target design object is updated.
void requestSettingsSignal()
Emitted to request that the camera settings dialog be shown.
TimeSpan m_animation_time
Duration of the camera snap animation.
void removeTarget(const DynamicPointer< QTDesignObject > &object) override
Removes a design object target from this widget.
void valueChanged()
Called when the selected snap location value changes.
void setCamera(const DynamicPointer< Camera > &camera)
Sets the camera whose snap location is controlled by this combo.
CameraLocationCombo(QTModelManager *manager, Button *combo, bool include_combo)
Constructs a CameraLocationCombo without an initial camera.
QTModelManager * m_manager
The model manager providing data context.
void setupMenu()
Creates and populates the snap location menu with available view options.
void setManager(QTModelManager *manager)
Sets the model manager for this combo.
QAction * m_top
Action to snap camera to top view.
DynamicPointer< Camera > m_camera
The camera controlled by this combo.
QAction * m_orthographic
Action to switch to orthographic projection.
CameraLocationCombo(QTModelManager *manager, DynamicPointer< Camera > camera, Button *combo, bool include_combo)
Constructs a CameraLocationCombo with a specific camera.
QAction * m_settings
Action to open camera settings.
QAction * m_perspective
Action to switch to perspective projection.
QActionGroup * m_view_location_group
Group for snap location actions.
QAction * m_left
Action to snap camera to left view.
QMenu * m_menu
The popup menu containing snap location options.
QAction * m_bottom
Action to snap camera to bottom view.
QAction * m_back
Action to snap camera to back view.
void onZoom(SnapLocation location)
Snaps the camera to the specified location.
QAction * m_right
Action to snap camera to right view.
QTModelManager * manager() const
Returns the current model manager.
Provides a modifiable pointer that has shared ownership of a dynamically allocated object.
Definition Pointer.hpp:356
A wrapper around DesignObjectLookup that provides signal and slot functionality and adds rendering ca...
QTResourceListener(const std::function< void()> &callback, QObject *parent)
Constructs a resource listener that invokes the given callback on the UI thread.
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:61
The primary namespace for the NDEVR SDK.
SnapLocation
A list of directions that a view can be pointed relative to an object or scene.