Skip to content
Snippets Groups Projects

RangeUtils: Added MPL Inferno as default color gradient

Merged Ludwig Jaeck requested to merge 273-inferno into main
All threads resolved!
Files
3
@@ -21,6 +21,7 @@
#include "GUI/Model/Device/MaskUnitsConverter.h"
#include "GUI/Support/IO/ImportDataInfo.h"
#include "GUI/Support/Util/Error.h"
#include "GUI/View/PlotUtil/RangeUtils.h"
#include <qcustomplot.h>
namespace {
@@ -36,6 +37,8 @@ const QString ProjectionContainer("ProjectionContainer");
} // namespace Tag
QCPColorGradient infernoGradient = GUI::View::RangeUtils::colorGradientInferno();
// gradient map for colormaps
const QMap<QString, QCPColorGradient::GradientPreset> gradient_map = {
{"Grayscale", QCPColorGradient::gpGrayscale},
@@ -51,14 +54,17 @@ const QMap<QString, QCPColorGradient::GradientPreset> gradient_map = {
{"Jet", QCPColorGradient::gpJet},
{"Hues", QCPColorGradient::gpHues}};
QString startGradient = gradient_map.key(QCPColorGradient::gpThermal);
const QMap<QString, QCPColorGradient> custom_gradient_map = {{"Inferno", infernoGradient}};
QString startGradient = "Inferno";
} // namespace
IntensityDataItem::IntensityDataItem()
: DataItem(M_TYPE)
, m_isInterpolated(true)
, m_gradient(ComboProperty::fromList(gradient_map.keys(), startGradient))
, m_gradient(
ComboProperty::fromList(gradient_map.keys() + custom_gradient_map.keys(), startGradient))
, m_zAxis(std::make_unique<AmplitudeAxisItem>())
{
}
@@ -144,7 +150,10 @@ void IntensityDataItem::copyZRangeFromItem(DataItem* sourceItem)
QCPColorGradient IntensityDataItem::currentGradientQCP() const
{
return gradient_map.value(currentGradient());
if (gradient_map.contains(currentGradient()))
return gradient_map.value(currentGradient());
else
return custom_gradient_map.value(currentGradient());
}
QString IntensityDataItem::currentGradient() const
Loading