(#582) (#488) Cycling all the colors in the default color table, using dark colors first.

will make equal colors more seldom in a project.
And use a bit less "hard" colors first.
This commit is contained in:
Jacob Støren 2015-10-31 23:35:18 +01:00
parent 27271c7988
commit f7ebf80e0d
5 changed files with 16 additions and 15 deletions

View File

@ -95,7 +95,7 @@ void RicAddWellLogToPlotFeature::onActionTriggered(bool isChecked)
RigWellLogFile* wellLogDataFile = wellLogFile->wellLogFile();
CVF_ASSERT(wellLogDataFile);
cvf::Color3f curveColor = RicWellLogPlotCurveFeatureImpl::curveColorFromIndex(curveIdx);
cvf::Color3f curveColor = RicWellLogPlotCurveFeatureImpl::curveColorFromTable();
curve->setColor(curveColor);
curve->setWellPath(wellPath);
curve->setWellLogChannelName(wellLog->name());

View File

@ -123,7 +123,7 @@ RimWellLogExtractionCurve* RicNewWellLogCurveExtractionFeature::addCurve(RimWell
RimWellLogExtractionCurve* curve = new RimWellLogExtractionCurve();
cvf::Color3f curveColor = RicWellLogPlotCurveFeatureImpl::curveColorFromIndex(curveIndex);
cvf::Color3f curveColor = RicWellLogPlotCurveFeatureImpl::curveColorFromTable();
curve->setColor(curveColor);
curve->setWellPath(wellPath);
curve->setPropertiesFromView(view);

View File

@ -149,7 +149,7 @@ RimWellLogFileCurve* RicNewWellLogFileCurveFeature::addCurve(RimWellLogPlotTrack
RimWellLogFileCurve* curve = new RimWellLogFileCurve();
plotTrack->addCurve(curve);
cvf::Color3f curveColor = RicWellLogPlotCurveFeatureImpl::curveColorFromIndex(curveIndex);
cvf::Color3f curveColor = RicWellLogPlotCurveFeatureImpl::curveColorFromTable();
curve->setColor(curveColor);
plotTrack->updateConnectedEditors();

View File

@ -24,13 +24,7 @@
static const int RI_LOGPLOT_CURVECOLORSCOUNT = 15;
static const int RI_LOGPLOT_CURVECOLORS[] =
{
Qt::blue,
Qt::red,
Qt::green,
Qt::yellow,
Qt::magenta,
Qt::cyan,
Qt::gray,
Qt::black,
Qt::darkBlue,
Qt::darkRed,
Qt::darkGreen,
@ -38,16 +32,23 @@ static const int RI_LOGPLOT_CURVECOLORS[] =
Qt::darkMagenta,
Qt::darkCyan,
Qt::darkGray,
Qt::black
Qt::blue,
Qt::red,
Qt::green,
Qt::yellow,
Qt::magenta,
Qt::cyan,
Qt::gray
};
//--------------------------------------------------------------------------------------------------
/// Pick default curve color from an index based palette
//--------------------------------------------------------------------------------------------------
cvf::Color3f RicWellLogPlotCurveFeatureImpl::curveColorFromIndex(size_t curveIndex)
cvf::Color3f RicWellLogPlotCurveFeatureImpl::curveColorFromTable()
{
QColor color = QColor(Qt::GlobalColor(RI_LOGPLOT_CURVECOLORS[curveIndex % RI_LOGPLOT_CURVECOLORSCOUNT]));
static int colorIndex = 0;
QColor color = QColor(Qt::GlobalColor(RI_LOGPLOT_CURVECOLORS[colorIndex % RI_LOGPLOT_CURVECOLORSCOUNT]));
++colorIndex;
cvf::Color3f cvfColor(color.redF(), color.greenF(), color.blueF());
return cvfColor;
}

View File

@ -28,5 +28,5 @@ class RicWellLogPlotCurveFeatureImpl
{
public:
static cvf::Color3f curveColorFromIndex(size_t curveIndex);
static cvf::Color3f curveColorFromTable();
};