diff --git a/ApplicationCode/Commands/SummaryPlotCommands/RicSummaryCurveCreator.cpp b/ApplicationCode/Commands/SummaryPlotCommands/RicSummaryCurveCreator.cpp index 884c356809..2d5f1265ed 100644 --- a/ApplicationCode/Commands/SummaryPlotCommands/RicSummaryCurveCreator.cpp +++ b/ApplicationCode/Commands/SummaryPlotCommands/RicSummaryCurveCreator.cpp @@ -138,6 +138,10 @@ void RicSummaryCurveCreator::updateFromSummaryPlot(RimSummaryPlot* targetPlot) { populateCurveCreator(*m_targetPlot); } + else + { + setDefaultCurveSelection(); + } syncPreviewCurvesFromUiSelection(); @@ -554,6 +558,14 @@ void RicSummaryCurveCreator::copyCurveAndAddToPlot(const RimSummaryCurve *curve, curveCopy->loadDataAndUpdate(false); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicSummaryCurveCreator::setDefaultCurveSelection() +{ + m_summaryCurveSelectionEditor->summaryAddressSelection()->setDefaultSelection(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/Commands/SummaryPlotCommands/RicSummaryCurveCreator.h b/ApplicationCode/Commands/SummaryPlotCommands/RicSummaryCurveCreator.h index 5d8b27ee0a..09c7887108 100644 --- a/ApplicationCode/Commands/SummaryPlotCommands/RicSummaryCurveCreator.h +++ b/ApplicationCode/Commands/SummaryPlotCommands/RicSummaryCurveCreator.h @@ -84,6 +84,7 @@ private: void populateCurveCreator(const RimSummaryPlot& sourceSummaryPlot); void updateTargetPlot(); static void copyCurveAndAddToPlot(const RimSummaryCurve *curve, RimSummaryPlot *plot, bool forceVisible = false); + void setDefaultCurveSelection(); void resetAllFields(); void initCurveAppearanceCalculator(RimSummaryCurveAppearanceCalculator& curveAppearanceCalc); diff --git a/ApplicationCode/UserInterface/RiuSummaryCurveDefSelection.cpp b/ApplicationCode/UserInterface/RiuSummaryCurveDefSelection.cpp index cef17cde2e..6bd9a3b967 100644 --- a/ApplicationCode/UserInterface/RiuSummaryCurveDefSelection.cpp +++ b/ApplicationCode/UserInterface/RiuSummaryCurveDefSelection.cpp @@ -252,7 +252,7 @@ std::vector RiuSummaryCurveDefSelection::selectedCurv std::set selectedAddressesFromUi = buildAddressListFromSelections(); - for (RimSummaryCase* currCase : summaryCases()) + for (RimSummaryCase* currCase : selectedSummaryCases()) { if (currCase && currCase->summaryReader()) { @@ -291,6 +291,25 @@ void RiuSummaryCurveDefSelection::setFieldChangedHandler(const std::functionproject(); + auto allSumCases = proj->allSummaryCases(); + if (allSumCases.size() > 0) + { + RifEclipseSummaryAddress defaultAddress = RifEclipseSummaryAddress::fieldVarAddress("FOPT"); + + RiaSummaryCurveDefinition curveDef(allSumCases[0], defaultAddress); + std::vector curveDefs; + curveDefs.push_back(curveDef); + + setSelectedCurveDefinitions(curveDefs); + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -950,7 +969,7 @@ bool RiuSummaryCurveDefSelection::isObservedData(RimSummaryCase *sumCase) const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::vector RiuSummaryCurveDefSelection::summaryCases() const +std::vector RiuSummaryCurveDefSelection::selectedSummaryCases() const { std::vector cases; diff --git a/ApplicationCode/UserInterface/RiuSummaryCurveDefSelection.h b/ApplicationCode/UserInterface/RiuSummaryCurveDefSelection.h index 929a35d9e5..4cdda0670b 100644 --- a/ApplicationCode/UserInterface/RiuSummaryCurveDefSelection.h +++ b/ApplicationCode/UserInterface/RiuSummaryCurveDefSelection.h @@ -55,6 +55,8 @@ public: void setMultiSelectionMode(bool multiSelectionMode); void setFieldChangedHandler(const std::function& handlerFunc); + void setDefaultSelection(); + private: virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, @@ -86,7 +88,7 @@ private: void resetAllFields(); bool isObservedData(RimSummaryCase *sumCase) const; - std::vector summaryCases() const; + std::vector selectedSummaryCases() const; static RimSummaryCase* calculatedSummaryCase(); private: