mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
3D Cross Plot: Improve colors and symbols in legend
This commit is contained in:
@@ -17,6 +17,9 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RiaColorTables.h"
|
||||
#include "RiaColorTools.h"
|
||||
|
||||
#include "cvfAssert.h"
|
||||
|
||||
#include <QColor>
|
||||
|
||||
@@ -538,6 +541,32 @@ RiaColorTables::WellPathComponentColors RiaColorTables::wellPathComponentColors(
|
||||
{RiaDefines::UNDEFINED_COMPONENT, cvf::Color3::MAGENTA}};
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::ColorTable RiaColorTables::createBrightnessBasedColorTable(cvf::Color3ub baseColor, int brightnessLevelCount)
|
||||
{
|
||||
CVF_ASSERT(brightnessLevelCount >= 1);
|
||||
QColor baseRGB(baseColor.r(), baseColor.g(), baseColor.b());
|
||||
float hueF = baseRGB.hslHueF();
|
||||
float satF = baseRGB.hslSaturationF();
|
||||
|
||||
std::vector<cvf::Color3ub> colors;
|
||||
if (brightnessLevelCount == 1)
|
||||
{
|
||||
colors.push_back(cvf::Color3ub(RiaColorTools::fromQColorTo3f(QColor::fromHslF(hueF, satF, 0.5))));
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < brightnessLevelCount; ++i)
|
||||
{
|
||||
float brightness = static_cast<float>(i) / static_cast<float>(brightnessLevelCount - 1);
|
||||
colors.push_back(cvf::Color3ub(RiaColorTools::fromQColorTo3f(QColor::fromHslF(hueF, satF, brightness))));
|
||||
}
|
||||
}
|
||||
return caf::ColorTable(colors);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user