3D Cross Plot: Improve colors and symbols in legend

This commit is contained in:
Gaute Lindkvist
2019-02-21 15:42:02 +01:00
parent 6b3808b696
commit 7e57ec39ea
10 changed files with 93 additions and 15 deletions

View File

@@ -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);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------