mirror of
https://github.com/OPM/ResInsight.git
synced 2025-01-08 07:03:25 -06:00
#3907 Summary : Consider combined curve count when assigning color
This commit is contained in:
parent
755e1405db
commit
284e07b967
@ -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);
|
||||
|
@ -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)));
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -132,6 +132,8 @@ public:
|
||||
void updatePlotInfoLabel();
|
||||
|
||||
bool containsResamplableCurves() const;
|
||||
|
||||
size_t singleColorCurveCount() const;
|
||||
// RimViewWindow overrides
|
||||
public:
|
||||
QWidget* createViewWidget(QWidget* mainWindowParent) override;
|
||||
|
Loading…
Reference in New Issue
Block a user