diff --git a/ApplicationCode/Commands/SummaryPlotCommands/RicSummaryCurveCreator.cpp b/ApplicationCode/Commands/SummaryPlotCommands/RicSummaryCurveCreator.cpp index bf814cb0bd..471182f19b 100644 --- a/ApplicationCode/Commands/SummaryPlotCommands/RicSummaryCurveCreator.cpp +++ b/ApplicationCode/Commands/SummaryPlotCommands/RicSummaryCurveCreator.cpp @@ -324,7 +324,7 @@ void RicSummaryCurveCreator::defineUiOrdering(QString uiConfigName, caf::PdmUiOr void RicSummaryCurveCreator::syncPreviewCurvesFromUiSelection() { std::vector allCurveDefinitionsVector = - m_summaryCurveSelectionEditor->summaryAddressSelection()->selectedCurveDefinitions(); + m_summaryCurveSelectionEditor->summaryAddressSelection()->allCurveDefinitionsFromSelection(); std::set allCurveDefinitions = std::set(allCurveDefinitionsVector.begin(), allCurveDefinitionsVector.end()); diff --git a/ApplicationCode/UserInterface/RiuSummaryCurveDefSelection.cpp b/ApplicationCode/UserInterface/RiuSummaryCurveDefSelection.cpp index 15bcf2a3e9..abd0941df9 100644 --- a/ApplicationCode/UserInterface/RiuSummaryCurveDefSelection.cpp +++ b/ApplicationCode/UserInterface/RiuSummaryCurveDefSelection.cpp @@ -249,12 +249,12 @@ RiuSummaryCurveDefSelection::~RiuSummaryCurveDefSelection() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::vector RiuSummaryCurveDefSelection::selectedCurveDefinitions() const +std::vector RiuSummaryCurveDefSelection::allCurveDefinitionsFromSelection() const { std::vector curveDefVector; { - std::set caseAndAddressPairs; + std::set curveDefinitions; std::set selectedAddressesFromUi = buildAddressListFromSelections(); @@ -289,19 +289,59 @@ std::vector RiuSummaryCurveDefSelection::selectedCurv { if (selectedAddressesFromUi.count(readerAddress) > 0) { - caseAndAddressPairs.insert(RiaSummaryCurveDefinition(currCase, readerAddress, ensemble)); + curveDefinitions.insert(RiaSummaryCurveDefinition(currCase, readerAddress, ensemble)); } } } } } - std::copy(caseAndAddressPairs.begin(), caseAndAddressPairs.end(), std::back_inserter(curveDefVector)); + std::copy(curveDefinitions.begin(), curveDefinitions.end(), std::back_inserter(curveDefVector)); } return curveDefVector; } +//-------------------------------------------------------------------------------------------------- +/// One CurveDefinition pr ensemble curve set +//-------------------------------------------------------------------------------------------------- +std::vector RiuSummaryCurveDefSelection::selection() const +{ + std::vector curveDefSelection; + std::set selectedAddressesFromUi = buildAddressListFromSelections(); + for (SummarySource* currSource : selectedSummarySources()) + { + RimSummaryCaseCollection* ensemble = dynamic_cast(currSource); + RimSummaryCase* sourceCase = dynamic_cast(currSource); + if (ensemble) + { + std::set addressUnion = ensemble->calculateUnionOfSummaryAddresses(); + for ( const auto& addr : selectedAddressesFromUi) + { + if (addressUnion.count(addr)) + { + curveDefSelection.push_back(RiaSummaryCurveDefinition(nullptr, addr, ensemble)); + } + } + } + else + { + if (!(sourceCase && sourceCase->summaryReader())) continue; + + const std::vector& readerAddresses = sourceCase->summaryReader()->allResultAddresses(); + for ( const auto& addr : readerAddresses) + { + if (selectedAddressesFromUi.count(addr)) + { + curveDefSelection.push_back(RiaSummaryCurveDefinition(sourceCase, addr, nullptr)); + } + } + } + } + + return curveDefSelection; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/UserInterface/RiuSummaryCurveDefSelection.h b/ApplicationCode/UserInterface/RiuSummaryCurveDefSelection.h index 5c17420571..0c88bdbbc7 100644 --- a/ApplicationCode/UserInterface/RiuSummaryCurveDefSelection.h +++ b/ApplicationCode/UserInterface/RiuSummaryCurveDefSelection.h @@ -56,7 +56,9 @@ public: virtual ~RiuSummaryCurveDefSelection(); void setSelectedCurveDefinitions(const std::vector& curveDefinitions); - std::vector selectedCurveDefinitions() const; + std::vector allCurveDefinitionsFromSelection() const; + std::vector selection() const; + void setMultiSelectionMode(bool multiSelectionMode); void hideEnsembles(bool hide); void hideSummaryCases(bool hide); diff --git a/ApplicationCode/UserInterface/RiuSummaryCurveDefSelectionDialog.cpp b/ApplicationCode/UserInterface/RiuSummaryCurveDefSelectionDialog.cpp index 14a896a6ec..4a89a98beb 100644 --- a/ApplicationCode/UserInterface/RiuSummaryCurveDefSelectionDialog.cpp +++ b/ApplicationCode/UserInterface/RiuSummaryCurveDefSelectionDialog.cpp @@ -109,7 +109,7 @@ void RiuSummaryCurveDefSelectionDialog::setEnsembleAndAddress(RimSummaryCaseColl //-------------------------------------------------------------------------------------------------- std::vector RiuSummaryCurveDefSelectionDialog::curveSelection() const { - return summaryAddressSelection()->selectedCurveDefinitions(); + return summaryAddressSelection()->allCurveDefinitionsFromSelection(); } //-------------------------------------------------------------------------------------------------- @@ -142,7 +142,7 @@ RiuSummaryCurveDefSelection* RiuSummaryCurveDefSelectionDialog::summaryAddressSe void RiuSummaryCurveDefSelectionDialog::updateLabel() { QString curveAddressText; - std::vector sumCasePairs = this->summaryAddressSelection()->selectedCurveDefinitions(); + std::vector sumCasePairs = this->summaryAddressSelection()->allCurveDefinitionsFromSelection(); if (sumCasePairs.size() == 1) { curveAddressText = sumCasePairs.front().curveDefinitionText();