From 20fae240b3a2cd8acf2afe4e845bfe0a86ae1570 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 27 Nov 2017 07:17:26 +0100 Subject: [PATCH] Cross Plot : Improve default curve vector selection --- .../Summary/RimSummaryCurve.cpp | 30 +++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/ApplicationCode/ProjectDataModel/Summary/RimSummaryCurve.cpp b/ApplicationCode/ProjectDataModel/Summary/RimSummaryCurve.cpp index f0e0769702..4efa84e01e 100644 --- a/ApplicationCode/ProjectDataModel/Summary/RimSummaryCurve.cpp +++ b/ApplicationCode/ProjectDataModel/Summary/RimSummaryCurve.cpp @@ -655,7 +655,20 @@ void RimSummaryCurve::fieldChangedByUi(const caf::PdmFieldHandle* changedField, else if (changedField == &m_yPushButtonSelectSummaryAddress) { RiuSummaryCurveDefSelectionDialog dlg(nullptr); - dlg.setCaseAndAddress(m_yValuesSummaryCase(), m_yValuesCurveVariable->address()); + RimSummaryCase* candidateCase = m_yValuesSummaryCase(); + RifEclipseSummaryAddress candicateAddress = m_yValuesCurveVariable->address(); + + if (candidateCase == nullptr) + { + candidateCase = m_xValuesSummaryCase(); + } + + if (!candicateAddress.isValid()) + { + candicateAddress = m_xValuesCurveVariable->address(); + } + + dlg.setCaseAndAddress(candidateCase, candicateAddress); if (dlg.exec() == QDialog::Accepted) { @@ -675,7 +688,20 @@ void RimSummaryCurve::fieldChangedByUi(const caf::PdmFieldHandle* changedField, else if (changedField == &m_xPushButtonSelectSummaryAddress) { RiuSummaryCurveDefSelectionDialog dlg(nullptr); - dlg.setCaseAndAddress(m_xValuesSummaryCase(), m_xValuesCurveVariable->address()); + RimSummaryCase* candidateCase = m_xValuesSummaryCase(); + RifEclipseSummaryAddress candicateAddress = m_xValuesCurveVariable->address(); + + if (candidateCase == nullptr) + { + candidateCase = m_yValuesSummaryCase(); + } + + if (!candicateAddress.isValid()) + { + candicateAddress = m_yValuesCurveVariable->address(); + } + + dlg.setCaseAndAddress(candidateCase, candicateAddress); if (dlg.exec() == QDialog::Accepted) {