ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
ecvShiftAndScaleCloudDlg.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 // LOCAL
11 #include "CV_io.h"
12 #include "ecvGlobalShiftManager.h"
13 
14 // Qt
15 #include <QDialog>
16 
17 // CV_CORE_LIB
18 #include <CVGeom.h>
19 
20 class Ui_GlobalShiftAndScaleDlg;
21 class QAbstractButton;
22 
24 class CV_IO_LIB_API ecvShiftAndScaleCloudDlg : public QDialog {
25  Q_OBJECT
26 
27 public:
29 
34  double Dg = 0,
35  QWidget* parent = 0);
36 
38 
45  double Dl,
46  const CCVector3d& Pg,
47  double Dg,
48  QWidget* parent = 0);
49 
51  void setShiftFieldsPrecision(int precision);
52 
55 
58 
60  double getScale() const;
61 
63  bool applyAll() const { return m_applyAll; }
64 
66  bool cancelled() const { return m_cancel; }
67 
69  void showScaleItems(bool state);
70 
72  void showApplyAllButton(bool state);
74  void showApplyButton(bool state);
76  void showNoButton(bool state);
78  void showCancelButton(bool state);
79 
81  void showWarning(bool state);
82 
84  void showTitle(bool state);
85 
87  void showKeepGlobalPosCheckbox(bool state);
89  bool keepGlobalPos() const;
91  void setKeepGlobalPos(bool state);
92 
94  void showPreserveShiftOnSave(bool state);
96  bool preserveShiftOnSave() const;
98  void setPreserveShiftOnSave(bool state);
99 
101 
105 
107 
110  int addShiftInfo(const std::vector<ecvGlobalShiftManager::ShiftInfo>& info);
111 
113  bool getInfo(size_t index, ecvGlobalShiftManager::ShiftInfo& info) const;
114 
116  size_t infoCount() const { return m_defaultInfos.size(); }
117 
119  void setCurrentProfile(int index);
120 
122  bool addFileInfo();
123 
125  static void SetLastInfo(const CCVector3d& shift, double scale);
126 
127 protected slots:
128 
134  void onClick(QAbstractButton* button);
139 
140 protected:
142  void init();
143 
145  void setShift(const CCVector3d& shift);
146 
148  void setScale(double scale);
149 
154 
156 
160  bool loadInfoFromFile(QString filename);
161 
163  Ui_GlobalShiftAndScaleDlg* m_ui;
164 
168  bool m_cancel;
169 
171  std::vector<ecvGlobalShiftManager::ShiftInfo> m_defaultInfos;
174 
183 
186 };
std::string filename
#define CV_IO_LIB_API
Definition: CV_io.h:15
#define slots
Dialog for selection of cloud center.
bool preserveShiftOnSave() const
Returns whether the global shift should be preserved or not.
void showApplyButton(bool state)
Whether to show the 'Apply' button or not.
void init()
Initialization routine.
ecvShiftAndScaleCloudDlg(const CCVector3d &Pg, double Dg=0, QWidget *parent=0)
Default constructor.
void setPreserveShiftOnSave(bool state)
Sets whether the global shift should be preserved or not.
void showNoButton(bool state)
Whether to show the 'No' button or not.
void setScale(double scale)
Sets displayed scale.
bool loadInfoFromFile(QString filename)
Tries to load ShiftInfo data from a (text) file.
CCVector3d getShift() const
Returns shift.
void onGlobalPosCheckBoxToggled(bool)
Slot called when the 'Keep global position' checkbox is toggled.
void setShift(const CCVector3d &shift)
Sets displayed shift.
void setKeepGlobalPos(bool state)
Sets whether the global position should be preserved or not.
void setCurrentProfile(int index)
Sets the current combo-box entry (profile)
virtual ~ecvShiftAndScaleCloudDlg()
Destructor.
int addShiftInfo(const std::vector< ecvGlobalShiftManager::ShiftInfo > &info)
Adds shift info to the combox.
size_t infoCount() const
Returns the number of info currently stored.
void showWarning(bool state)
Whether to show or not the warning about non pertinent shift information.
int addShiftInfo(const ecvGlobalShiftManager::ShiftInfo &info)
Adds shift info to the combox.
bool m_applyAll
Whether shift should be applied to all files.
CCVector3d m_localPoint
Local coordinate system point (reversed mode only)
void showApplyAllButton(bool state)
Whether to show the 'Apply all' button or not.
bool m_cancel
Whether the user has clicked on Cancel or not.
int m_activeInfoIndex
Active info entry index.
void showKeepGlobalPosCheckbox(bool state)
Whether to show or not the 'Keep global position' checkbox.
void showScaleItems(bool state)
Whether to show dialog items related to scale.
std::vector< ecvGlobalShiftManager::ShiftInfo > m_defaultInfos
Default infos (typically loaded from the global_shift_list.txt' file)
static void SetLastInfo(const CCVector3d &shift, double scale)
Sets the last shift and scale information.
void onLoadIndexChanged(int)
Slot called when the 'loadComboBox' index changes.
void updateGlobalAndLocalSystems()
Updates info on the global and local coordinate systems.
double m_originalDiagonal
Original coordinate system diagonal.
void showCancelButton(bool state)
Whether to show the 'Cancel' button or not.
void showTitle(bool state)
Whether to show or not the title.
bool applyAll() const
Whether shift should be applied to all files.
bool addFileInfo()
Adds information from default file (if any)
void displayMoreInfo()
Displays more info about global shift mechanism.
void setShiftFieldsPrecision(int precision)
Sets the Shift fields (X, Y and Z) precision (default should be 2)
bool keepGlobalPos() const
Returns whether the global position should be preserved or not.
bool cancelled() const
Whether the user has clicked on the cancel button or not.
double m_localDiagonal
Local coordinate system diagonal (reversed mode only)
void onClick(QAbstractButton *button)
Analyzes the clicked button.
bool m_reversedMode
Whether the reverse mode is active or not.
void showPreserveShiftOnSave(bool state)
Whether to show or not the 'Preserve shift on save' checkbox.
double getScale() const
Returns scale.
bool getInfo(size_t index, ecvGlobalShiftManager::ShiftInfo &info) const
Returns a given input info.
Ui_GlobalShiftAndScaleDlg * m_ui
Associated UI.
void updateLocalSystem()
Updates info on the local coordinate system.
CCVector3d m_originalPoint
Original coordinate system point.
ecvShiftAndScaleCloudDlg(const CCVector3d &Pl, double Dl, const CCVector3d &Pg, double Dg, QWidget *parent=0)
Reverse mode constructor.
void updateGlobalSystem()
Updates info on the global coordinate system.