ddt 1.4.0
 
Loading...
Searching...
No Matches
ddtColourmapWidget.hpp
Go to the documentation of this file.
1
9
10#ifndef DDT_DATAVISUALISATION_DDTWIDGETS_COLOURMAPWIDGET_HPP
11#define DDT_DATAVISUALISATION_DDTWIDGETS_COLOURMAPWIDGET_HPP
12
13#include <QtUiPlugin/QDesignerExportWidget>
14
15#include "ddt/imageHandling.hpp"
17
22class QDESIGNER_WIDGET_EXPORT DdtColourmapWidget : public DdtWidget {
23 Q_OBJECT
24
25 public:
30 explicit DdtColourmapWidget(QWidget* parent = nullptr);
31
36
37 void mousePressEvent(QMouseEvent* event) final;
38 void mouseMoveEvent(QMouseEvent* event) final;
39 void mouseReleaseEvent(QMouseEvent* event) final;
40
41 signals:
46 ddt::colorMap_t colourmap_inverted,
47 ddt::colorMapARGB_t colourmap_argb,
48 ddt::colorMapARGB_t colourmap_argb_inverted);
49
55
56 private:
57 QLabel* colourbar_label;
58 QLabel* colourscale_label;
59 QVector<QRgb> orig_colourmap;
60 QVector<QRgb> current_colourmap;
61 int colourbar_clicked_pos_x;
62 const int MAX_COLOR_MAP_ENTRIES = 256;
63 const int MAX_COLOR_MAP_VALUE = 255;
64 const int PIXMAP_HEIGHT = 20;
65 int amount;
66 std::atomic<bool> inverted;
67
68 void CreateWidget();
69
73 void ConvertCurrentMap(ddt::colorMap_t& colourmap,
74 ddt::colorMap_t& colourmap_inverted,
75 ddt::colorMapARGB_t& colourmap_argb,
76 ddt::colorMapARGB_t& colourmap_argb_inverted);
77
81 void ConvertAndEmit();
82
86 void ShiftColourmap();
87
91 void RotateColourmap();
92
96 void ScaleColourmap();
97
101 void UpdateColourmap(QVector<QRgb> colourmap);
102
106 void ResetColourmap();
107
108 int GetPosX(const QPoint pos) const;
109
110 void UpdateColourscale(double min_value, double max_value,
111 int scaling_function);
112 void DrawScale(double min_value, double max_value, QPainter& painter,
113 int scaling_function);
114 void DrawScaleLog(double min_value, double max_value, QPainter& painter);
115 int CalculateTickPositionLinear(double tick, double min_value, double width,
116 double maxsize);
117 int CalculateTickPositionSqrt(double tick, double min_value, double width,
118 double maxsize);
119
120#if QT_VERSION_MAJOR==5
121 void enterEvent(QEvent* const event) override;
122#else
123 void enterEvent(QEnterEvent* const event) override;
124#endif
125
126 void leaveEvent(QEvent* const event) override;
127
128 protected slots:
133 void SetCurrentColourmap(QVector<QRgb> colourmap);
134
142 void UpdateColourbarAxis(double min_value, double max_value,
143 int scaling_function);
144
148 void Reset();
149
154 void InvertColourmap(const bool invert);
155};
156
157#endif // DDT_DATAVISUALISATION_DDTWIDGETS_COLOURMAPWIDGET_HPP
void ChangeContrast(ddt::colorMap_t colourmap, ddt::colorMap_t colourmap_inverted, ddt::colorMapARGB_t colourmap_argb, ddt::colorMapARGB_t colourmap_argb_inverted)
void UpdateColourbarAxis(double min_value, double max_value, int scaling_function)
Definition ddtColourmapWidget.cpp:446
virtual ~DdtColourmapWidget()
void mouseMoveEvent(QMouseEvent *event) final
Definition ddtColourmapWidget.cpp:89
void InvertColourmap(const bool invert)
Definition ddtColourmapWidget.cpp:460
void mousePressEvent(QMouseEvent *event) final
Definition ddtColourmapWidget.cpp:78
void mouseReleaseEvent(QMouseEvent *event) final
Definition ddtColourmapWidget.cpp:95
void SetCurrentColourmap(QVector< QRgb > colourmap)
Definition ddtColourmapWidget.cpp:440
void Reset()
Definition ddtColourmapWidget.cpp:451
DdtColourmapWidget(QWidget *parent=nullptr)
Definition ddtColourmapWidget.cpp:16
DdtWidget(QWidget *parent=nullptr)
DdtWidget.
Definition ddtWidget.cpp:19
DDT Widgets. Base class for the DDT widgets. Base class for the DDT widgets.
Image Handling class, offers access to image handling functions. This file is part of the DDT Image H...
std::array< std::array< float, COLOR_MAP_ENTRY_SIZE >, MAX_COLOR_MAP_ENTRIES > colorMap_t
Definition imageColor.hpp:48
std::array< unsigned int, MAX_COLOR_MAP_ENTRIES > colorMapARGB_t
Definition imageColor.hpp:58