#3907 Summary : Consider combined curve count when assigning color

This commit is contained in:
Magne Sjaastad 2018-12-20 10:46:48 +01:00
parent 755e1405db
commit 284e07b967
4 changed files with 24 additions and 9 deletions

View File

@ -19,6 +19,7 @@
#include "RicNewSummaryCurveFeature.h"
#include "RiaApplication.h"
#include "RiaColorTables.h"
#include "RimMainPlotCollection.h"
#include "RimOilField.h"
@ -31,8 +32,6 @@
#include "RiuPlotMainWindow.h"
#include "WellLogCommands/RicWellLogPlotCurveFeatureImpl.h"
#include "cafSelectionManager.h"
#include "cvfAssert.h"
@ -62,7 +61,9 @@ void RicNewSummaryCurveFeature::onActionTriggered(bool isChecked)
if (plot)
{
RimSummaryCurve* newCurve = new RimSummaryCurve();
cvf::Color3f curveColor = RicWellLogPlotCurveFeatureImpl::curveColorFromTable(plot->curveCount());
// Use same counting as RicNewSummaryEnsembleCurveSetFeature::onActionTriggered
cvf::Color3f curveColor = RiaColorTables::summaryCurveDefaultPaletteColors().cycledColor3f(plot->singleColorCurveCount());
newCurve->setColor(curveColor);
plot->addCurveAndUpdate(newCurve);

View File

@ -67,12 +67,8 @@ void RicNewSummaryEnsembleCurveSetFeature::onActionTriggered(bool isChecked)
{
RimEnsembleCurveSet* curveSet = new RimEnsembleCurveSet();
// Set single curve set color
auto allCurveSets = plot->ensembleCurveSetCollection()->curveSets();
size_t colorIndex = std::count_if(allCurveSets.begin(), allCurveSets.end(), [](RimEnsembleCurveSet* curveSet)
{
return curveSet->colorMode() == RimEnsembleCurveSet::SINGLE_COLOR;
});
// Use same counting as RicNewSummaryCurveFeature::onActionTriggered
auto colorIndex = plot->singleColorCurveCount();
curveSet->setColor(RiaColorTables::summaryCurveDefaultPaletteColors().cycledColor3f(colorIndex));
curveSet->legendConfig()->setColorRange(RimEnsembleCurveSetColorManager::cycledEnsembleColorRange(static_cast<int>(colorIndex)));

View File

@ -549,6 +549,22 @@ bool RimSummaryPlot::containsResamplableCurves() const
return !m_gridTimeHistoryCurves.empty() || resamplableSummaryCurveCount > 0;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
size_t RimSummaryPlot::singleColorCurveCount() const
{
auto allCurveSets = ensembleCurveSetCollection()->curveSets();
size_t colorIndex = std::count_if(allCurveSets.begin(), allCurveSets.end(), [](RimEnsembleCurveSet* curveSet)
{
return curveSet->colorMode() == RimEnsembleCurveSet::SINGLE_COLOR;
});
colorIndex += curveCount();
return colorIndex;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -132,6 +132,8 @@ public:
void updatePlotInfoLabel();
bool containsResamplableCurves() const;
size_t singleColorCurveCount() const;
// RimViewWindow overrides
public:
QWidget* createViewWidget(QWidget* mainWindowParent) override;