From d83c468033706b02b4a4c1dba2f6fdcae198c83e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Jensen?= Date: Fri, 22 Sep 2017 12:53:54 +0200 Subject: [PATCH] #1919 Curve Creator. Fix summary category initial selection --- .../RicSummaryCurveCreator.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/ApplicationCode/Commands/SummaryPlotCommands/RicSummaryCurveCreator.cpp b/ApplicationCode/Commands/SummaryPlotCommands/RicSummaryCurveCreator.cpp index 6822e48bcb..2b4d4fef35 100644 --- a/ApplicationCode/Commands/SummaryPlotCommands/RicSummaryCurveCreator.cpp +++ b/ApplicationCode/Commands/SummaryPlotCommands/RicSummaryCurveCreator.cpp @@ -263,13 +263,6 @@ void RicSummaryCurveCreator::updateFromSummaryPlot(RimSummaryPlot* targetPlot) loadDataAndUpdatePlot(); } - // Select all summary categories - m_selectedSummaryCategories.v().clear(); - for (size_t i = 0; i < caf::AppEnum::size(); ++i) - { - m_selectedSummaryCategories.v().push_back(caf::AppEnum::fromIndex(i)); - } - caf::PdmUiItem::updateConnectedEditors(); } @@ -1066,8 +1059,17 @@ void RicSummaryCurveCreator::defineEditorAttribute(const caf::PdmFieldHandle* fi void RicSummaryCurveCreator::populateCurveCreator(const RimSummaryPlot& sourceSummaryPlot) { m_previewPlot->deleteAllSummaryCurves(); + m_selectedSummaryCategories.v().clear(); for (const auto& curve : sourceSummaryPlot.summaryCurves()) { + // Select summary category if not already selected + auto& selectedCategories = m_selectedSummaryCategories(); + if (std::find(selectedCategories.begin(), selectedCategories.end(), + curve->summaryAddress().category()) == selectedCategories.end()) + { + m_selectedSummaryCategories.v().push_back(curve->summaryAddress().category()); + } + // Select case if not already selected if (std::find(m_selectedCases.begin(), m_selectedCases.end(), curve->summaryCase()) == m_selectedCases.end()) { @@ -1158,6 +1160,7 @@ void RicSummaryCurveCreator::copyCurveAndAddToPlot(const RimSummaryCurve *curve, void RicSummaryCurveCreator::resetAllFields() { m_selectedCases.clear(); + m_selectedSummaryCategories = std::vector>(); m_previewPlot->deleteAllSummaryCurves(); m_targetPlot = nullptr;