diff --git a/ApplicationCode/Commands/SummaryPlotCommands/RicNewSummaryEnsembleCurveSetFeature.cpp b/ApplicationCode/Commands/SummaryPlotCommands/RicNewSummaryEnsembleCurveSetFeature.cpp index 17c7954952..d9d8039433 100644 --- a/ApplicationCode/Commands/SummaryPlotCommands/RicNewSummaryEnsembleCurveSetFeature.cpp +++ b/ApplicationCode/Commands/SummaryPlotCommands/RicNewSummaryEnsembleCurveSetFeature.cpp @@ -67,7 +67,12 @@ void RicNewSummaryEnsembleCurveSetFeature::onActionTriggered(bool isChecked) { RimEnsembleCurveSet* curveSet = new RimEnsembleCurveSet(); - size_t colorIndex = plot->ensembleCurveSetCollection()->curveSetCount(); + // 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; + }); curveSet->setColor(RiaColorTables::summaryCurveDefaultPaletteColors().cycledColor3f(colorIndex)); curveSet->legendConfig()->setColorRange(RimEnsembleCurveSetColorManager::cycledEnsembleColorRange(static_cast(colorIndex))); diff --git a/ApplicationCode/Commands/SummaryPlotCommands/RicSummaryCurveCreator.cpp b/ApplicationCode/Commands/SummaryPlotCommands/RicSummaryCurveCreator.cpp index 89c2306840..f474fe3158 100644 --- a/ApplicationCode/Commands/SummaryPlotCommands/RicSummaryCurveCreator.cpp +++ b/ApplicationCode/Commands/SummaryPlotCommands/RicSummaryCurveCreator.cpp @@ -437,12 +437,18 @@ void RicSummaryCurveCreator::updatePreviewCurvesFromCurveDefinitions( curveSet->disableStatisticCurves(); curveSet->setSummaryCaseCollection(curveDef.ensemble()); curveSet->setSummaryAddress(curveDef.summaryAddress()); - m_previewPlot->ensembleCurveSetCollection()->addCurveSet(curveSet); // Set single curve set color - size_t colorIndex = m_previewPlot->ensembleCurveSetCollection()->curveSetCount(); + auto allCurveSets = m_previewPlot->ensembleCurveSetCollection()->curveSets(); + size_t colorIndex = std::count_if(allCurveSets.begin(), allCurveSets.end(), [](RimEnsembleCurveSet* curveSet) + { + return curveSet->colorMode() == RimEnsembleCurveSet::SINGLE_COLOR; + }); curveSet->setColor(RiaColorTables::summaryCurveDefaultPaletteColors().cycledColor3f(colorIndex)); + // Add curve to plot + m_previewPlot->ensembleCurveSetCollection()->addCurveSet(curveSet); + if (m_previewPlot->ensembleCurveSetCollection()->curveSets().size() > 1 && ensembleCurveCnt > ENSEMBLE_CURVE_COUNT_THRESHOLD) { // Toggle off new curve set and display warning @@ -767,11 +773,20 @@ void RicSummaryCurveCreator::applyAppearanceToAllPreviewCurves() RimSummaryCurveAppearanceCalculator curveLookCalc(allCurveDefs, getAllSummaryCaseNames(), getAllSummaryWellNames()); initCurveAppearanceCalculator(curveLookCalc); + // Summary curves for (auto& curve : m_previewPlot->summaryCurves()) { curve->resetAppearance(); curveLookCalc.setupCurveLook(curve); } + + // Ensemble curve sets + int colorIndex = 0; + for (auto& curveSet : m_previewPlot->ensembleCurveSetCollection()->curveSets()) + { + if (curveSet->colorMode() != RimEnsembleCurveSet::SINGLE_COLOR) continue; + curveSet->setColor(RiaColorTables::summaryCurveDefaultPaletteColors().cycledColor3f(colorIndex++)); + } } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/UserInterface/RiuSummaryCurveDefSelection.cpp b/ApplicationCode/UserInterface/RiuSummaryCurveDefSelection.cpp index e56e37ff59..072593dcca 100644 --- a/ApplicationCode/UserInterface/RiuSummaryCurveDefSelection.cpp +++ b/ApplicationCode/UserInterface/RiuSummaryCurveDefSelection.cpp @@ -388,7 +388,8 @@ void RiuSummaryCurveDefSelection::setDefaultSelection(const std::vector 0) { - RifEclipseSummaryAddress defaultAddress = !hasEnsembles ? RifEclipseSummaryAddress::fieldAddress("FOPT") : RifEclipseSummaryAddress(); + RifEclipseSummaryAddress defaultAddress = !hasEnsembles ? + RifEclipseSummaryAddress::fieldAddress("FOPT") : RifEclipseSummaryAddress(); std::vector selectTheseSources = defaultSources; if (selectTheseSources.empty()) selectTheseSources.push_back(allSumCases[0]);