ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
ecvAxesGridDialog.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 #ifndef ECV_AXES_GRID_DIALOG_H
9 #define ECV_AXES_GRID_DIALOG_H
10 
11 #include <QColor>
12 #include <QDialog>
13 #include <QList>
14 #include <QPair>
15 
16 class QCheckBox;
17 class QDoubleSpinBox;
18 class QSpinBox;
19 class QPushButton;
20 class QLabel;
21 class QLineEdit;
22 class QGroupBox;
24 
37 class ecvAxesGridDialog : public QDialog {
38  Q_OBJECT
39 
40 public:
41  explicit ecvAxesGridDialog(const QString& title, QWidget* parent = nullptr);
42  ~ecvAxesGridDialog() override;
43 
44  // ========================================================================
45  // Title Texts (Section 1)
46  // ========================================================================
47  QString getXTitle() const;
48  void setXTitle(const QString& title);
49  QString getYTitle() const;
50  void setYTitle(const QString& title);
51  QString getZTitle() const;
52  void setZTitle(const QString& title);
53 
54  // ========================================================================
55  // Face Properties (Section 2)
56  // ========================================================================
57  QColor getGridColor() const;
58  void setGridColor(const QColor& color);
59  bool getShowGrid() const;
60  void setShowGrid(bool show);
61 
62  // ========================================================================
63  // X Axis Label Properties (Section 3)
64  // ========================================================================
65  bool getXAxisUseCustomLabels() const;
66  void setXAxisUseCustomLabels(bool use);
67  QList<QPair<double, QString>> getXAxisCustomLabels() const;
68  void setXAxisCustomLabels(const QList<QPair<double, QString>>& labels);
69 
70  // ========================================================================
71  // Y Axis Label Properties (Section 4)
72  // ========================================================================
73  bool getYAxisUseCustomLabels() const;
74  void setYAxisUseCustomLabels(bool use);
75  QList<QPair<double, QString>> getYAxisCustomLabels() const;
76  void setYAxisCustomLabels(const QList<QPair<double, QString>>& labels);
77 
78  // ========================================================================
79  // Z Axis Label Properties (Section 5)
80  // ========================================================================
81  bool getZAxisUseCustomLabels() const;
82  void setZAxisUseCustomLabels(bool use);
83  QList<QPair<double, QString>> getZAxisCustomLabels() const;
84  void setZAxisCustomLabels(const QList<QPair<double, QString>>& labels);
85 
86  // ========================================================================
87  // Bounds (Section 6)
88  // ========================================================================
89  bool getUseCustomBounds() const;
90  void setUseCustomBounds(bool use);
91 
92  double getXMin() const;
93  void setXMin(double value);
94  double getXMax() const;
95  void setXMax(double value);
96  double getYMin() const;
97  void setYMin(double value);
98  double getYMax() const;
99  void setYMax(double value);
100  double getZMin() const;
101  void setZMin(double value);
102  double getZMax() const;
103  void setZMax(double value);
104 
105  // ========================================================================
106  // Legacy compatibility (for backward compatibility with old interface)
107  // ========================================================================
108  QColor getColor() const { return getGridColor(); }
109  void setColor(const QColor& color) { setGridColor(color); }
110  double getLineWidth() const { return 1.0; }
111  void setLineWidth(double) {}
112  double getOpacity() const { return 1.0; }
113  void setOpacity(double) {}
114  bool getShowLabels() const { return true; }
115  void setShowLabels(bool) {}
116 
117 signals:
119  void applyRequested(); // Real-time preview signal
120 
121 private slots:
122  void onColorButtonClicked();
123  void onApply();
124  void onReset();
125  void onXAxisUseCustomLabelsToggled(bool checked);
126  void onYAxisUseCustomLabelsToggled(bool checked);
127  void onZAxisUseCustomLabelsToggled(bool checked);
128  void onUseCustomBoundsToggled(bool checked);
129 
130 private:
131  void setupUI();
132  void updateColorButton();
133  void storeInitialValues();
134  void restoreInitialValues();
135 
136  // Title Texts section
137  QLineEdit* m_xTitleEdit;
138  QLineEdit* m_yTitleEdit;
139  QLineEdit* m_zTitleEdit;
140 
141  // Face Properties section
142  QPushButton* m_gridColorButton;
143  QColor m_currentColor;
144  QCheckBox* m_showGridCheckBox;
145 
146  // X Axis Label Properties section
147  QCheckBox* m_xAxisUseCustomLabelsCheckBox;
148  ecvCustomLabelsWidget* m_xAxisCustomLabelsWidget;
149  QGroupBox* m_xAxisGroup;
150 
151  // Y Axis Label Properties section
152  QCheckBox* m_yAxisUseCustomLabelsCheckBox;
153  ecvCustomLabelsWidget* m_yAxisCustomLabelsWidget;
154  QGroupBox* m_yAxisGroup;
155 
156  // Z Axis Label Properties section
157  QCheckBox* m_zAxisUseCustomLabelsCheckBox;
158  ecvCustomLabelsWidget* m_zAxisCustomLabelsWidget;
159  QGroupBox* m_zAxisGroup;
160 
161  // Bounds section
162  QCheckBox* m_useCustomBoundsCheckBox;
163  QWidget* m_customBoundsWidget; // Container for bounds spinboxes
164  QDoubleSpinBox* m_xMinSpinBox;
165  QDoubleSpinBox* m_xMaxSpinBox;
166  QDoubleSpinBox* m_yMinSpinBox;
167  QDoubleSpinBox* m_yMaxSpinBox;
168  QDoubleSpinBox* m_zMinSpinBox;
169  QDoubleSpinBox* m_zMaxSpinBox;
170 
171  // Initial values for Reset functionality
172  QString m_initialXTitle;
173  QString m_initialYTitle;
174  QString m_initialZTitle;
175  QColor m_initialColor;
176  bool m_initialShowGrid;
177  bool m_initialXCustomLabels;
178  bool m_initialYCustomLabels;
179  bool m_initialZCustomLabels;
180  QList<QPair<double, QString>> m_initialXLabels;
181  QList<QPair<double, QString>> m_initialYLabels;
182  QList<QPair<double, QString>> m_initialZLabels;
183  bool m_initialCustomBounds;
184  double m_initialXMin;
185  double m_initialXMax;
186  double m_initialYMin;
187  double m_initialYMax;
188  double m_initialZMin;
189  double m_initialZMax;
190 };
191 
192 #endif // ECV_AXES_GRID_DIALOG_H
math::float4 color
#define slots
#define signals
ParaView-style Axes Grid Properties Dialog.
double getXMin() const
bool getZAxisUseCustomLabels() const
bool getYAxisUseCustomLabels() const
void setZTitle(const QString &title)
double getYMin() const
bool getShowLabels() const
double getZMax() const
void setZMin(double value)
void setZMax(double value)
QString getXTitle() const
void setXAxisCustomLabels(const QList< QPair< double, QString >> &labels)
void setZAxisUseCustomLabels(bool use)
void setXTitle(const QString &title)
QList< QPair< double, QString > > getZAxisCustomLabels() const
void setLineWidth(double)
void setXMin(double value)
bool getXAxisUseCustomLabels() const
QList< QPair< double, QString > > getXAxisCustomLabels() const
void setXMax(double value)
double getYMax() const
void setGridColor(const QColor &color)
void setZAxisCustomLabels(const QList< QPair< double, QString >> &labels)
void setYMax(double value)
void setYAxisUseCustomLabels(bool use)
void setUseCustomBounds(bool use)
bool getUseCustomBounds() const
QString getYTitle() const
QColor getColor() const
QString getZTitle() const
ecvAxesGridDialog(const QString &title, QWidget *parent=nullptr)
void setYMin(double value)
void setYTitle(const QString &title)
double getLineWidth() const
void setYAxisCustomLabels(const QList< QPair< double, QString >> &labels)
void setShowGrid(bool show)
double getXMax() const
QList< QPair< double, QString > > getYAxisCustomLabels() const
void setColor(const QColor &color)
QColor getGridColor() const
~ecvAxesGridDialog() override
void propertiesChanged()
void setOpacity(double)
void setXAxisUseCustomLabels(bool use)
double getZMin() const
double getOpacity() const
ParaView-style Custom Labels Editor Widget.