From 68bcd5253b8b8d89df47ea4dedc1442c4fbbcc84 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 1 Dec 2017 13:37:01 +0100 Subject: [PATCH] #2170 Summary Plot : Show info text when no common identifier is detected --- .../Summary/RimSummaryPlotSourceStepping.cpp | 29 ++++++++++++++++++- .../Summary/RimSummaryPlotSourceStepping.h | 1 + 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/ApplicationCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp b/ApplicationCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp index 0f8dbf69d3..877c8a1f38 100644 --- a/ApplicationCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp +++ b/ApplicationCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp @@ -50,6 +50,11 @@ RimSummaryPlotSourceStepping::RimSummaryPlotSourceStepping() : m_sourceSteppingT CAF_PDM_InitFieldNoDefault(&m_wellGroupName, "GroupName", "Group Name", "", "", ""); CAF_PDM_InitFieldNoDefault(&m_region, "Region", "Region", "", "", ""); CAF_PDM_InitFieldNoDefault(&m_quantity, "Quantities", "Quantity", "", "", ""); + + CAF_PDM_InitFieldNoDefault(&m_placeholderForLabel, "Placeholder", "", "", "", ""); + m_placeholderForLabel = "No common identifiers detected"; + m_placeholderForLabel.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::TOP); + m_placeholderForLabel.uiCapability()->setUiReadOnly(true); // clang-format on } @@ -219,12 +224,16 @@ void RimSummaryPlotSourceStepping::defineUiOrdering(QString uiConfigName, caf::P QList RimSummaryPlotSourceStepping::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly) { + if (fieldNeedingOptions == &m_placeholderForLabel) + { + return QList(); + } + if (fieldNeedingOptions == &m_summaryCase) { QList options; RimProject* proj = RiaApplication::instance()->project(); - for (auto sumCase : proj->allSummaryCases()) { options.append(caf::PdmOptionItemInfo(sumCase->caseName(), sumCase)); @@ -499,6 +508,9 @@ void RimSummaryPlotSourceStepping::updateUiFromCurves() m_wellGroupName.uiCapability()->setUiHidden(true); m_region.uiCapability()->setUiHidden(true); m_quantity.uiCapability()->setUiHidden(true); + m_placeholderForLabel.uiCapability()->setUiHidden(true); + + bool commonIdentifierFound = false; auto sumCases = allSummaryCasesUsedInCurveCollection(); if (sumCases.size() == 1) @@ -512,6 +524,8 @@ void RimSummaryPlotSourceStepping::updateUiFromCurves() if (proj->allSummaryCases().size() > 1) { m_summaryCase.uiCapability()->setUiHidden(false); + + commonIdentifierFound = true; } } @@ -533,6 +547,8 @@ void RimSummaryPlotSourceStepping::updateUiFromCurves() QString txt = QString::fromStdString(*(analyzer.wellNames().begin())); m_wellName = txt; m_wellName.uiCapability()->setUiHidden(false); + + commonIdentifierFound = true; } if (analyzer.wellGroupNames().size() == 1) @@ -540,12 +556,16 @@ void RimSummaryPlotSourceStepping::updateUiFromCurves() QString txt = QString::fromStdString(*(analyzer.wellGroupNames().begin())); m_wellGroupName = txt; m_wellGroupName.uiCapability()->setUiHidden(false); + + commonIdentifierFound = true; } if (analyzer.regionNumbers().size() == 1) { m_region = *(analyzer.regionNumbers().begin()); m_region.uiCapability()->setUiHidden(false); + + commonIdentifierFound = true; } if (analyzer.quantities().size() == 1) @@ -553,8 +573,15 @@ void RimSummaryPlotSourceStepping::updateUiFromCurves() QString txt = QString::fromStdString(*(analyzer.quantities().begin())); m_quantity = txt; m_quantity.uiCapability()->setUiHidden(false); + + commonIdentifierFound = true; } } + + if (!commonIdentifierFound) + { + m_placeholderForLabel.uiCapability()->setUiHidden(false); + } } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.h b/ApplicationCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.h index fa83705f3f..c8c6cbd5a3 100644 --- a/ApplicationCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.h +++ b/ApplicationCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.h @@ -91,6 +91,7 @@ private: caf::PdmField m_wellGroupName; caf::PdmField m_region; caf::PdmField m_quantity; + caf::PdmField m_placeholderForLabel; SourceSteppingType m_sourceSteppingType; std::pair m_curveAnalyzerForReader;