From bc86158ff6050b2de688147d24c496baca69add3 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 20 Dec 2018 08:36:35 +0100 Subject: [PATCH] #3914 Source Stepping : Add checkbox for include of ensemble cases --- .../Summary/RimSummaryPlotSourceStepping.cpp | 55 ++++++++++++++++--- .../Summary/RimSummaryPlotSourceStepping.h | 5 +- .../UserInterface/RiuPlotMainWindow.cpp | 6 +- .../UserInterface/RiuPlotMainWindow.h | 2 +- 4 files changed, 58 insertions(+), 10 deletions(-) diff --git a/ApplicationCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp b/ApplicationCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp index d1e0efa47b..f3fd72eea5 100644 --- a/ApplicationCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp +++ b/ApplicationCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp @@ -54,6 +54,15 @@ RimSummaryPlotSourceStepping::RimSummaryPlotSourceStepping() CAF_PDM_InitObject("Summary Curves Modifier", "", "", ""); CAF_PDM_InitFieldNoDefault(&m_summaryCase, "CurveCase", "Case", "", "", ""); + + CAF_PDM_InitField(&m_includeEnsembleCasesForCaseStepping, + "IncludeEnsembleCasesForCaseStepping", + false, + "Allow Stepping on Ensemble cases", + "", + "", + ""); + CAF_PDM_InitFieldNoDefault(&m_wellName, "WellName", "Well Name", "", "", ""); CAF_PDM_InitFieldNoDefault(&m_wellGroupName, "GroupName", "Group Name", "", "", ""); CAF_PDM_InitFieldNoDefault(&m_region, "Region", "Region", "", "", ""); @@ -185,12 +194,15 @@ QList RimSummaryPlotSourceStepping::calculateValueOption { QList options; - if (fieldNeedingOptions == &m_placeholderForLabel) + if (fieldNeedingOptions == &m_includeEnsembleCasesForCaseStepping) + { + return caf::PdmObject::calculateValueOptions(fieldNeedingOptions, useOptionsOnly); + } + else if (fieldNeedingOptions == &m_placeholderForLabel) { options; } - - if (fieldNeedingOptions == &m_summaryCase) + else if (fieldNeedingOptions == &m_summaryCase) { auto summaryCases = RimSummaryPlotSourceStepping::summaryCasesForSourceStepping(); for (auto sumCase : summaryCases) @@ -356,6 +368,25 @@ void RimSummaryPlotSourceStepping::fieldChangedByUi(const caf::PdmFieldHandle* c RimEnsembleCurveSetCollection* ensembleCurveColl = nullptr; this->firstAncestorOrThisOfType(ensembleCurveColl); + if (changedField == &m_includeEnsembleCasesForCaseStepping) + { + if (curveCollection) + { + curveCollection->updateConnectedEditors(); + } + + if (ensembleCurveColl) + { + ensembleCurveColl->updateConnectedEditors(); + } + + RiuPlotMainWindow* mainPlotWindow = RiaApplication::instance()->getOrCreateMainPlotWindow(); + bool forceUpdateOfFieldsInToolbar = true; + mainPlotWindow->updateSummaryPlotToolBar(forceUpdateOfFieldsInToolbar); + + return; + } + bool triggerLoadDataAndUpdate = false; std::string oldValueString = oldValue.toString().toStdString(); @@ -721,6 +752,7 @@ std::set RimSummaryPlotSourceStepping::summaryCasesCurveCollect std::vector RimSummaryPlotSourceStepping::computeVisibleFieldsAndSetFieldVisibility() { m_summaryCase.uiCapability()->setUiHidden(true); + m_includeEnsembleCasesForCaseStepping.uiCapability()->setUiHidden(true); m_wellName.uiCapability()->setUiHidden(true); m_wellGroupName.uiCapability()->setUiHidden(true); m_region.uiCapability()->setUiHidden(true); @@ -740,6 +772,8 @@ std::vector RimSummaryPlotSourceStepping::computeVisibleFi m_summaryCase.uiCapability()->setUiHidden(false); fields.push_back(&m_summaryCase); + + m_includeEnsembleCasesForCaseStepping.uiCapability()->setUiHidden(false); } } @@ -989,10 +1023,17 @@ std::vector RimSummaryPlotSourceStepping::summaryCasesForSource RimSummaryCaseCollection* sumCaseColl = nullptr; sumCase->firstAncestorOrThisOfType(sumCaseColl); - if (sumCaseColl && sumCaseColl->isEnsemble()) continue; - ; - - cases.push_back(sumCase); + if (sumCaseColl && sumCaseColl->isEnsemble()) + { + if (m_includeEnsembleCasesForCaseStepping()) + { + cases.push_back(sumCase); + } + } + else + { + cases.push_back(sumCase); + } } return cases; diff --git a/ApplicationCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.h b/ApplicationCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.h index 1818d22b5a..3ae616aff9 100644 --- a/ApplicationCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.h +++ b/ApplicationCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.h @@ -106,7 +106,7 @@ private: const QVariant& newValue, RifEclipseSummaryAddress* adr); - static std::vector summaryCasesForSourceStepping(); + std::vector summaryCasesForSourceStepping(); private: caf::PdmPtrField m_summaryCase; @@ -117,6 +117,9 @@ private: caf::PdmField m_region; caf::PdmField m_quantity; caf::PdmField m_placeholderForLabel; + + caf::PdmField m_includeEnsembleCasesForCaseStepping; + SourceSteppingType m_sourceSteppingType; std::pair m_curveAnalyzerForReader; diff --git a/ApplicationCode/UserInterface/RiuPlotMainWindow.cpp b/ApplicationCode/UserInterface/RiuPlotMainWindow.cpp index 3a04069b45..ee344ec73f 100644 --- a/ApplicationCode/UserInterface/RiuPlotMainWindow.cpp +++ b/ApplicationCode/UserInterface/RiuPlotMainWindow.cpp @@ -496,7 +496,7 @@ void RiuPlotMainWindow::updateWellLogPlotToolBar() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuPlotMainWindow::updateSummaryPlotToolBar() +void RiuPlotMainWindow::updateSummaryPlotToolBar(bool forceUpdateUi) { RimSummaryPlot* summaryPlot = dynamic_cast(m_activePlotViewWindow.p()); if (summaryPlot) @@ -526,6 +526,10 @@ void RiuPlotMainWindow::updateSummaryPlotToolBar() m_summaryPlotToolBarEditor->setFields(toolBarFields); m_summaryPlotToolBarEditor->updateUi(); } + else if (forceUpdateUi) + { + m_summaryPlotToolBarEditor->updateUi(); + } m_summaryPlotToolBarEditor->show(); } diff --git a/ApplicationCode/UserInterface/RiuPlotMainWindow.h b/ApplicationCode/UserInterface/RiuPlotMainWindow.h index e49d7d052b..e18370b782 100644 --- a/ApplicationCode/UserInterface/RiuPlotMainWindow.h +++ b/ApplicationCode/UserInterface/RiuPlotMainWindow.h @@ -81,7 +81,7 @@ public: void addToTemporaryWidgets(QWidget* widget); void updateWellLogPlotToolBar(); - void updateSummaryPlotToolBar(); + void updateSummaryPlotToolBar(bool forceUpdateUi = false); protected: void closeEvent(QCloseEvent* event) override;