@@ -0,0 +1,24 | |||
|
1 | #ifndef SCIQLOP_SQPCOLORSCALE_H | |
|
2 | #define SCIQLOP_SQPCOLORSCALE_H | |
|
3 | ||
|
4 | #include <Visualization/qcustomplot.h> | |
|
5 | ||
|
6 | /** | |
|
7 | * @brief The SqpColorScale struct represents the color scale for some graphs (such as | |
|
8 | * spectrograms). | |
|
9 | * | |
|
10 | * Its implementation is based on the QCustomPlot color scale (@sa QCPColorScale) to which are added | |
|
11 | * other useful properties for viewing in SciQlop | |
|
12 | */ | |
|
13 | struct SqpColorScale { | |
|
14 | explicit SqpColorScale(QCustomPlot &plot); | |
|
15 | ||
|
16 | /// QCustomPlot object representing the color scale. | |
|
17 | /// @remarks The SqpColorScale instance has not the property on this pointer. The pointer must | |
|
18 | /// remain valid throughout the existence of the SqpColorScale instance | |
|
19 | QCPColorScale *m_Scale{nullptr}; | |
|
20 | bool m_AutomaticThreshold{false}; | |
|
21 | QCPColorGradient::GradientPreset m_GradientPreset{QCPColorGradient::gpJet}; | |
|
22 | }; | |
|
23 | ||
|
24 | #endif // SCIQLOP_SQPCOLORSCALE_H |
@@ -0,0 +1,17 | |||
|
1 | #include "Visualization/SqpColorScale.h" | |
|
2 | ||
|
3 | namespace { | |
|
4 | ||
|
5 | const auto DEFAULT_GRADIENT_PRESET = QCPColorGradient::gpJet; | |
|
6 | const auto DEFAULT_RANGE = QCPRange{1.0e3, 1.7e7}; | |
|
7 | ||
|
8 | } // namespace | |
|
9 | ||
|
10 | SqpColorScale::SqpColorScale(QCustomPlot &plot) | |
|
11 | : m_Scale{new QCPColorScale{&plot}}, | |
|
12 | m_AutomaticThreshold{false}, | |
|
13 | m_GradientPreset{DEFAULT_GRADIENT_PRESET} | |
|
14 | { | |
|
15 | m_Scale->setGradient(m_GradientPreset); | |
|
16 | m_Scale->setDataRange(DEFAULT_RANGE); | |
|
17 | } |
@@ -80,7 +80,8 gui_sources = [ | |||
|
80 | 80 | 'src/Visualization/PlottablesRenderingUtils.cpp', |
|
81 | 81 | 'src/Visualization/MacScrollBarStyle.cpp', |
|
82 | 82 | 'src/Visualization/VisualizationCursorItem.cpp', |
|
83 | 'src/Visualization/ColorScaleWidget.cpp' | |
|
83 | 'src/Visualization/ColorScaleWidget.cpp', | |
|
84 | 'src/Visualization/SqpColorScale.cpp' | |
|
84 | 85 | ] |
|
85 | 86 | |
|
86 | 87 | gui_inc = include_directories(['include']) |
General Comments 0
You need to be logged in to leave comments.
Login now