ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
ecvColorScaleEditorDlg.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 "CVPluginAPI.h"
11 
12 // local
14 
15 // Qt
16 #include <QDialog>
17 
18 class ccScalarField;
21 
22 namespace Ui {
23 class ColorScaleEditorDlg;
24 }
25 
28  Q_OBJECT
29 
30 public:
33  ccColorScalesManager* manager,
34  ecvMainAppInterface* mainApp,
35  ccColorScale::Shared currentScale = ccColorScale::Shared(nullptr),
36  QWidget* parent = nullptr);
37 
39  ~ccColorScaleEditorDialog() override = default;
40 
42  void setAssociatedScalarField(ccScalarField* sf);
43 
45  void setActiveScale(ccColorScale::Shared currentScale);
46 
48  ccColorScale::Shared getActiveScale() { return m_colorScale; }
49 
50 protected slots:
51 
52  void colorScaleChanged(int);
53  void relativeModeChanged(int);
54 
55  void onStepSelected(int);
56 
57  void onStepModified(int);
58 
59  void deletecSelectedStep();
60 
61  void changeSelectedStepColor();
62 
63  void changeSelectedStepValue(double);
64 
65  void onCustomLabelsListChanged();
66  void toggleCustomLabelsList(bool);
67 
68  void copyCurrentScale();
69  bool saveCurrentScale();
70  void deleteCurrentScale();
71  void renameCurrentScale();
72 
73  void exportCurrentScale();
74  void importScale();
75 
76  void createNewScale();
77 
78  void onApply();
79  void onClose();
80 
81 protected:
83  void updateMainComboBox();
84 
86  void setModified(bool state);
87 
89 
91  bool canChangeCurrentScale();
92 
95 
98  bool isRelativeMode() const;
99 
102 
105  void setScaleModeToRelative(bool isRelative);
106 
108  bool checkCustomLabelsList(bool showWarnings);
109 
111  bool exportCustomLabelsList(ccColorScale::LabelSet& labels);
112 
115 
118 
121 
124 
127 
132 
135 
136  Ui::ColorScaleEditorDlg* m_ui;
137 };
#define CVPLUGIN_LIB_API
Definition: CVPluginAPI.h:15
#define slots
Dialog to edit/create color scales.
ccColorScale::Shared getActiveScale()
Returns active scale.
double m_maxAbsoluteVal
Current max boundary for absolute scales.
ccScalarField * m_associatedSF
Associated scalar field.
double m_minAbsoluteVal
Current min boundary for absolute scales.
ccColorScalesManager * m_manager
Color scale manager.
ecvMainAppInterface * m_mainApp
Associated application (interface)
ccColorScale::Shared m_colorScale
Current active color scale.
~ccColorScaleEditorDialog() override=default
Destructor.
bool m_modified
Modification flag.
ccColorScaleEditorWidget * m_scaleWidget
Color scale editor widget.
Ui::ColorScaleEditorDlg * m_ui
Color scale editor dialog.
QSharedPointer< ccColorScale > Shared
Shared pointer type.
Definition: ecvColorScale.h:74
std::set< Label > LabelSet
Type of a list of custom labels.
Color scales manager/container.
A scalar field associated to display-related parameters.
Main application interface (for plugins)