ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
ecvCameraParamEditDlg.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - CloudViewer: www.cloudViewer.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.cloudViewer.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 #pragma once
9 
10 #include "CVAppCommon.h"
11 
12 // Local
13 #include "ecvOverlayDialog.h"
14 #include "ecvPickingListener.h"
15 
16 // CV_DB_LIB
17 #include <ecvGLMatrix.h>
18 
19 // system
20 #include <map>
21 
22 class QMdiSubWindow;
23 class ccHObject;
24 class ccPickingHub;
25 class CameraDialogInternal;
27 
30  public ccPickingListener {
31  Q_OBJECT
32 
33 public:
35  explicit ecvCameraParamEditDlg(QWidget* parent, ccPickingHub* pickingHub);
36 
39 
40  // inherited from ccOverlayDialog
41  bool start() override;
42  bool linkWith(QWidget* win) override;
43 
44  // inherited from ccPickingListener
45  void onItemPicked(const PickedItem& pi) override;
46 
48 
49  void SetCameraGroupsEnabled(bool enabled);
50 
54  static bool ConfigureCustomViewpoints(QWidget* parentWidget);
55 
60 
64  static bool ApplyCustomViewpoint(int CustomViewpointIndex);
65 
69  static bool DeleteCustomViewpoint(int CustomViewpointIndex);
70 
74  static bool SetToCurrentViewpoint(int CustomViewpointIndex);
75 
79  static QStringList CustomViewpointToolTips();
80 
84  static QStringList CustomViewpointConfigurations();
85 
86 public slots:
87 
89  void linkWith(QMdiSubWindow* qWin);
90 
92  void updatePivotPoint(const CCVector3d& P);
95  void pivotChanged();
96 
97  void rotationFactorChanged(double);
98  void zfactorSliderMoved(int val);
99 
100  void pickPointAsPivot(bool);
101  void processPickedItem(ccHObject*, unsigned, int, int, const CCVector3&);
102 
103 private slots:
104  // Description:
105  // Choose a file and load/save camera properties.
106  void saveCameraConfiguration();
107  void loadCameraConfiguration();
108 
109  // Description:
110  // Assign/restore the current camera properties to
111  // a custom view button.
112  void ConfigureCustomViewpoints();
113  void ApplyCustomViewpoint();
114  void addCurrentViewpointToCustomViewpoints();
115  void updateCustomViewpointButtons();
116 
117  void resetViewDirectionPosX();
118  void resetViewDirectionNegX();
119  void resetViewDirectionPosY();
120  void resetViewDirectionNegY();
121  void resetViewDirectionPosZ();
122  void resetViewDirectionNegZ();
123 
124  void resetViewDirection(double look_x,
125  double look_y,
126  double look_z,
127  double up_x,
128  double up_y,
129  double up_z);
130 
131  void applyCameraRoll();
132  void applyCameraElevation();
133  void applyCameraAzimuth();
134  void applyCameraZoomIn();
135  void applyCameraZoomOut();
136 
137  void autoPickRotationCenterWithCamera();
138 
140  void reflectParamChange();
141 
142 protected:
144  void initWith(QWidget* win);
145 
146  void updateUi();
147 
149  using PushedMatricesMapType = std::map<QWidget*, ccGLMatrixd>;
151  using PushedMatricesMapElement = std::pair<QWidget*, ccGLMatrixd>;
152 
155 
158 
159 protected slots:
160  void updateCamera();
162 
163 private:
164  ecvGenericCameraTool* m_tool;
165  CameraDialogInternal* Internal;
166 
167  enum CameraAdjustmentType { Roll = 0, Elevation, Azimuth, Zoom };
168  void adjustCamera(CameraAdjustmentType enType, double value);
169 };
#define CVAPPCOMMON_LIB_API
Definition: CVAppCommon.h:15
#define slots
Hierarchical CLOUDVIEWER Object.
Definition: ecvHObject.h:25
Generic overlay dialog interface.
Point/triangle picking hub.
Definition: ecvPickingHub.h:29
Point/triangle picking listener interface.
Dialog to interactively edit the camera pose parameters.
void updatePivotPoint(const CCVector3d &P)
Updates dialog values with pivot point.
ccPickingHub * m_pickingHub
Picking hub.
static bool DeleteCustomViewpoint(int CustomViewpointIndex)
static QStringList CustomViewpointToolTips()
bool setCameraTool(ecvGenericCameraTool *tool)
static bool ApplyCustomViewpoint(int CustomViewpointIndex)
void SetCameraGroupsEnabled(bool enabled)
void processPickedItem(ccHObject *, unsigned, int, int, const CCVector3 &)
void linkWith(QMdiSubWindow *qWin)
Links this dialog with a given sub-window.
std::pair< QWidget *, ccGLMatrixd > PushedMatricesMapElement
Type of an element of the pushed matrices map structure.
void rotationFactorChanged(double)
void onItemPicked(const PickedItem &pi) override
Method called whenever an item is picked.
ecvCameraParamEditDlg(QWidget *parent, ccPickingHub *pickingHub)
Default constructor.
void pickPointAsPivot(bool)
static bool AddCurrentViewpointToCustomViewpoints()
void zfactorSliderMoved(int val)
static bool ConfigureCustomViewpoints(QWidget *parentWidget)
void initWith(QWidget *win)
Inits dialog values with specified window.
~ecvCameraParamEditDlg() override
Destructor.
bool start() override
Starts process.
std::map< QWidget *, ccGLMatrixd > PushedMatricesMapType
Type of the pushed matrices map structure.
static QStringList CustomViewpointConfigurations()
PushedMatricesMapType pushedMatrices
Pushed camera matrices (per window)
void updateViewMode()
Updates current view mode.
static bool SetToCurrentViewpoint(int CustomViewpointIndex)
bool linkWith(QWidget *win) override
Links the overlay dialog with a MDI window.