From 314c20a04ac846e7fda65c0c285d3271c1aa2c70 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 22 Nov 2018 15:24:14 +0100 Subject: [PATCH] #3735 Summary plot : Improve stepping for well path name --- .../RifEclipseSummaryAddress.cpp | 20 +++++++++++++++++++ .../FileInterface/RifEclipseSummaryAddress.h | 2 ++ .../Summary/RimSummaryPlotSourceStepping.cpp | 19 ++++++++++-------- 3 files changed, 33 insertions(+), 8 deletions(-) diff --git a/ApplicationCode/FileInterface/RifEclipseSummaryAddress.cpp b/ApplicationCode/FileInterface/RifEclipseSummaryAddress.cpp index ab4867c79d..6fed115bd3 100644 --- a/ApplicationCode/FileInterface/RifEclipseSummaryAddress.cpp +++ b/ApplicationCode/FileInterface/RifEclipseSummaryAddress.cpp @@ -520,6 +520,26 @@ RifEclipseSummaryAddress RifEclipseSummaryAddress::ensembleStatisticsAddress(con //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- +bool RifEclipseSummaryAddress::isDependentOnWellName(const RifEclipseSummaryAddress& address) +{ + // clang-format off + if (address.category() == SUMMARY_WELL || + address.category() == SUMMARY_WELL_COMPLETION || + address.category() == SUMMARY_WELL_COMPLETION_LGR || + address.category() == SUMMARY_WELL_LGR || + address.category() == SUMMARY_WELL_SEGMENT) + { + return true; + } + + // clang-format on + + return false; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- const std::string RifEclipseSummaryAddress::ensembleStatisticsQuantityName() const { QString qName = QString::fromStdString(m_quantityName); diff --git a/ApplicationCode/FileInterface/RifEclipseSummaryAddress.h b/ApplicationCode/FileInterface/RifEclipseSummaryAddress.h index c673326781..e898220568 100644 --- a/ApplicationCode/FileInterface/RifEclipseSummaryAddress.h +++ b/ApplicationCode/FileInterface/RifEclipseSummaryAddress.h @@ -144,6 +144,8 @@ public: static RifEclipseSummaryAddress importedAddress(const std::string& quantityName); static RifEclipseSummaryAddress ensembleStatisticsAddress(const std::string& quantityName, const std::string& dataQuantityName); + static bool isDependentOnWellName(const RifEclipseSummaryAddress& address); + // Access methods SummaryVarCategory category() const { return m_variableCategory; } diff --git a/ApplicationCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp b/ApplicationCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp index ae7e07a5a2..8e83d82db3 100644 --- a/ApplicationCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp +++ b/ApplicationCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp @@ -44,7 +44,8 @@ CAF_PDM_SOURCE_INIT(RimSummaryPlotSourceStepping, "RimSummaryCurveCollectionModi //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RimSummaryPlotSourceStepping::RimSummaryPlotSourceStepping() : m_sourceSteppingType(Y_AXIS) +RimSummaryPlotSourceStepping::RimSummaryPlotSourceStepping() + : m_sourceSteppingType(Y_AXIS) { // clang-format off CAF_PDM_InitObject("Summary Curves Modifier", "", "", ""); @@ -244,8 +245,9 @@ QList RimSummaryPlotSourceStepping::calculateValueOption //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimSummaryPlotSourceStepping::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, - const QVariant& newValue) +void RimSummaryPlotSourceStepping::fieldChangedByUi(const caf::PdmFieldHandle* changedField, + const QVariant& oldValue, + const QVariant& newValue) { RimSummaryCurveCollection* curveCollection = nullptr; this->firstAncestorOrThisOfTypeAsserted(curveCollection); @@ -286,7 +288,7 @@ void RimSummaryPlotSourceStepping::fieldChangedByUi(const caf::PdmFieldHandle* c if (isYAxisStepping()) { RifEclipseSummaryAddress adr = curve->summaryAddressY(); - if (adr.category() == RifEclipseSummaryAddress::SUMMARY_WELL) + if (RifEclipseSummaryAddress::isDependentOnWellName(adr)) { adr.setWellName(m_wellName().toStdString()); @@ -297,7 +299,7 @@ void RimSummaryPlotSourceStepping::fieldChangedByUi(const caf::PdmFieldHandle* c if (isXAxisStepping()) { RifEclipseSummaryAddress adr = curve->summaryAddressX(); - if (adr.category() == RifEclipseSummaryAddress::SUMMARY_WELL) + if (RifEclipseSummaryAddress::isDependentOnWellName(adr)) { adr.setWellName(m_wellName().toStdString()); @@ -417,7 +419,7 @@ void RimSummaryPlotSourceStepping::fieldChangedByUi(const caf::PdmFieldHandle* c std::vector RimSummaryPlotSourceStepping::summaryReadersForCurves() const { std::vector readers; - RimSummaryCurveCollection* curveCollection = nullptr; + RimSummaryCurveCollection* curveCollection = nullptr; this->firstAncestorOrThisOfTypeAsserted(curveCollection); for (auto curve : curveCollection->curves()) @@ -646,7 +648,7 @@ RiaSummaryCurveAnalyzer* RimSummaryPlotSourceStepping::analyzerForReader(RifSumm //-------------------------------------------------------------------------------------------------- void RimSummaryPlotSourceStepping::modifyCurrentIndex(caf::PdmValueField* valueField, int indexOffset) { - bool useOptionsOnly; + bool useOptionsOnly; QList options = calculateValueOptions(valueField, &useOptionsOnly); RimDataSourceSteppingTools::modifyCurrentIndex(valueField, options, indexOffset); } @@ -654,7 +656,8 @@ void RimSummaryPlotSourceStepping::modifyCurrentIndex(caf::PdmValueField* valueF //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimSummaryPlotSourceStepping::defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, +void RimSummaryPlotSourceStepping::defineEditorAttribute(const caf::PdmFieldHandle* field, + QString uiConfigName, caf::PdmUiEditorAttribute* attribute) { caf::PdmUiComboBoxEditorAttribute* myAttr = dynamic_cast(attribute);