mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#987 Summary Auto Title : Add support for auto plot title and improve curve names
This commit is contained in:
@@ -35,26 +35,22 @@ RiaSummaryCurveAnalyzer::RiaSummaryCurveAnalyzer() {}
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaSummaryCurveAnalyzer::analyzeAdresses(const std::vector<RifEclipseSummaryAddress>& allAddresses)
|
||||
void RiaSummaryCurveAnalyzer::appendAdresses(const std::vector<RifEclipseSummaryAddress>& allAddresses)
|
||||
{
|
||||
clearAllSets();
|
||||
|
||||
for (const auto& adr : allAddresses)
|
||||
{
|
||||
analyzeAddress(adr);
|
||||
analyzeSingleAddress(adr);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaSummaryCurveAnalyzer::analyzeAdresses(const std::set<RifEclipseSummaryAddress>& allAddresses)
|
||||
void RiaSummaryCurveAnalyzer::appendAdresses(const std::set<RifEclipseSummaryAddress>& allAddresses)
|
||||
{
|
||||
clearAllSets();
|
||||
|
||||
for (const auto& adr : allAddresses)
|
||||
{
|
||||
analyzeAddress(adr);
|
||||
analyzeSingleAddress(adr);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -153,7 +149,7 @@ std::vector<RifEclipseSummaryAddress>
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaSummaryCurveAnalyzer::clearAllSets()
|
||||
void RiaSummaryCurveAnalyzer::clear()
|
||||
{
|
||||
m_quantities.clear();
|
||||
m_wellNames.clear();
|
||||
@@ -165,7 +161,7 @@ void RiaSummaryCurveAnalyzer::clearAllSets()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaSummaryCurveAnalyzer::analyzeAddress(const RifEclipseSummaryAddress& address)
|
||||
void RiaSummaryCurveAnalyzer::analyzeSingleAddress(const RifEclipseSummaryAddress& address)
|
||||
{
|
||||
if (!address.wellName().empty())
|
||||
{
|
||||
|
||||
@@ -36,14 +36,16 @@ class RiaSummaryCurveAnalyzer
|
||||
public:
|
||||
RiaSummaryCurveAnalyzer();
|
||||
|
||||
void analyzeAdresses(const std::vector<RifEclipseSummaryAddress>& allAddresses);
|
||||
void analyzeAdresses(const std::set<RifEclipseSummaryAddress>& allAddresses);
|
||||
void appendAdresses(const std::set<RifEclipseSummaryAddress>& allAddresses);
|
||||
void appendAdresses(const std::vector<RifEclipseSummaryAddress>& allAddresses);
|
||||
|
||||
void clear();
|
||||
|
||||
std::set<std::string> quantities() const;
|
||||
std::set<std::string> wellNames() const;
|
||||
std::set<std::string> wellGroupNames() const;
|
||||
std::set<int> regionNumbers() const;
|
||||
|
||||
std::set<int> regionNumbers() const;
|
||||
std::set<RifEclipseSummaryAddress::SummaryVarCategory> categories() const;
|
||||
|
||||
std::set<QString> identifierTexts(RifEclipseSummaryAddress::SummaryVarCategory category) const;
|
||||
@@ -52,14 +54,13 @@ public:
|
||||
RifEclipseSummaryAddress::SummaryVarCategory category);
|
||||
|
||||
private:
|
||||
void clearAllSets();
|
||||
void analyzeAddress(const RifEclipseSummaryAddress& address);
|
||||
void analyzeSingleAddress(const RifEclipseSummaryAddress& address);
|
||||
|
||||
private:
|
||||
std::set<std::string> m_quantities;
|
||||
std::set<std::string> m_wellNames;
|
||||
std::set<std::string> m_wellGroupNames;
|
||||
std::set<int> m_regionNumbers;
|
||||
std::set<std::string> m_quantities;
|
||||
std::set<std::string> m_wellNames;
|
||||
std::set<std::string> m_wellGroupNames;
|
||||
std::set<int> m_regionNumbers;
|
||||
|
||||
std::set<RifEclipseSummaryAddress::SummaryVarCategory> m_categories;
|
||||
};
|
||||
|
||||
@@ -33,6 +33,7 @@ ${CEE_CURRENT_LIST_DIR}RimSummaryAddress.h
|
||||
${CEE_CURRENT_LIST_DIR}RimSummaryCrossPlot.h
|
||||
${CEE_CURRENT_LIST_DIR}RimSummaryPlotSourceStepping.h
|
||||
${CEE_CURRENT_LIST_DIR}RimCsvUserData.h
|
||||
${CEE_CURRENT_LIST_DIR}RimSummaryPlotNameHelper.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
@@ -64,6 +65,7 @@ ${CEE_CURRENT_LIST_DIR}RimSummaryAddress.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimSummaryCrossPlot.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimSummaryPlotSourceStepping.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimCsvUserData.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimSummaryPlotNameHelper.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
|
||||
@@ -369,11 +369,13 @@ QList<caf::PdmOptionItemInfo> RimSummaryCurve::calculateValueOptions(const caf::
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimSummaryCurve::createCurveAutoName()
|
||||
{
|
||||
QString name = m_curveNameConfig->curveName(m_yValuesCurveVariable->address());
|
||||
RimSummaryPlot* plot = nullptr;
|
||||
firstAncestorOrThisOfTypeAsserted(plot);
|
||||
|
||||
QString name = m_curveNameConfig->curveName(m_yValuesCurveVariable->address(), plot->activePlotTitleHelper());
|
||||
if (isCrossPlotCurve())
|
||||
{
|
||||
QString xCurveName = m_curveNameConfig->curveName(m_xValuesCurveVariable->address());
|
||||
QString xCurveName = m_curveNameConfig->curveName(m_xValuesCurveVariable->address(), plot->activePlotTitleHelper());
|
||||
|
||||
name += " | " + xCurveName;
|
||||
}
|
||||
|
||||
@@ -20,11 +20,13 @@
|
||||
|
||||
#include "RifEclipseSummaryAddress.h"
|
||||
|
||||
#include "RimSummaryCurve.h"
|
||||
#include "RimSummaryCase.h"
|
||||
#include "RimSummaryCurve.h"
|
||||
#include "RimSummaryPlotNameHelper.h"
|
||||
|
||||
#include "SummaryPlotCommands/RicSummaryCurveCreator.h"
|
||||
|
||||
#include "cafPdmUiPushButtonEditor.h"
|
||||
#include "SummaryPlotCommands/RicSummaryCurveCreator.h"
|
||||
|
||||
|
||||
|
||||
@@ -52,7 +54,7 @@ RimSummaryCurveAutoName::RimSummaryCurveAutoName()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimSummaryCurveAutoName::curveName(const RifEclipseSummaryAddress& summaryAddress) const
|
||||
QString RimSummaryCurveAutoName::curveName(const RifEclipseSummaryAddress& summaryAddress, const RimSummaryPlotNameHelper* nameHelper) const
|
||||
{
|
||||
std::string text;
|
||||
|
||||
@@ -61,11 +63,15 @@ QString RimSummaryCurveAutoName::curveName(const RifEclipseSummaryAddress& summa
|
||||
|
||||
if (m_vectorName)
|
||||
{
|
||||
text += summaryAddress.quantityName();
|
||||
|
||||
if (m_unit && summaryCurve && !summaryCurve->unitNameY().empty())
|
||||
bool skipSubString = nameHelper && nameHelper->isQuantityInTitle();
|
||||
if (!skipSubString)
|
||||
{
|
||||
text += "[" + summaryCurve->unitNameY() + "]";
|
||||
text += summaryAddress.quantityName();
|
||||
|
||||
if (m_unit && summaryCurve && !summaryCurve->unitNameY().empty())
|
||||
{
|
||||
text += "[" + summaryCurve->unitNameY() + "]";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,8 +81,12 @@ QString RimSummaryCurveAutoName::curveName(const RifEclipseSummaryAddress& summa
|
||||
{
|
||||
if (m_regionNumber)
|
||||
{
|
||||
if (text.size() > 0) text +=":";
|
||||
text += std::to_string(summaryAddress.regionNumber());
|
||||
bool skipSubString = nameHelper && nameHelper->isRegionInTitle();
|
||||
if (!skipSubString)
|
||||
{
|
||||
if (text.size() > 0) text +=":";
|
||||
text += std::to_string(summaryAddress.regionNumber());
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -94,19 +104,23 @@ QString RimSummaryCurveAutoName::curveName(const RifEclipseSummaryAddress& summa
|
||||
{
|
||||
if (m_wellGroupName)
|
||||
{
|
||||
if (text.size() > 0) text += ":";
|
||||
text += summaryAddress.wellGroupName();
|
||||
bool skipSubString = nameHelper && nameHelper->isWellGroupNameInTitle();
|
||||
if (!skipSubString)
|
||||
{
|
||||
if (text.size() > 0) text += ":";
|
||||
text += summaryAddress.wellGroupName();
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case RifEclipseSummaryAddress::SUMMARY_WELL:
|
||||
{
|
||||
appendWellName(text, summaryAddress);
|
||||
appendWellName(text, summaryAddress, nameHelper);
|
||||
}
|
||||
break;
|
||||
case RifEclipseSummaryAddress::SUMMARY_WELL_COMPLETION:
|
||||
{
|
||||
appendWellName(text, summaryAddress);
|
||||
appendWellName(text, summaryAddress, nameHelper);
|
||||
|
||||
if (m_completion)
|
||||
{
|
||||
@@ -120,13 +134,13 @@ QString RimSummaryCurveAutoName::curveName(const RifEclipseSummaryAddress& summa
|
||||
case RifEclipseSummaryAddress::SUMMARY_WELL_LGR:
|
||||
{
|
||||
appendLgrName(text, summaryAddress);
|
||||
appendWellName(text, summaryAddress);
|
||||
appendWellName(text, summaryAddress, nameHelper);
|
||||
}
|
||||
break;
|
||||
case RifEclipseSummaryAddress::SUMMARY_WELL_COMPLETION_LGR:
|
||||
{
|
||||
appendLgrName(text, summaryAddress);
|
||||
appendWellName(text, summaryAddress);
|
||||
appendWellName(text, summaryAddress, nameHelper);
|
||||
|
||||
if (m_completion)
|
||||
{
|
||||
@@ -139,7 +153,7 @@ QString RimSummaryCurveAutoName::curveName(const RifEclipseSummaryAddress& summa
|
||||
break;
|
||||
case RifEclipseSummaryAddress::SUMMARY_WELL_SEGMENT:
|
||||
{
|
||||
appendWellName(text, summaryAddress);
|
||||
appendWellName(text, summaryAddress, nameHelper);
|
||||
|
||||
if (m_wellSegmentNumber)
|
||||
{
|
||||
@@ -174,10 +188,11 @@ QString RimSummaryCurveAutoName::curveName(const RifEclipseSummaryAddress& summa
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (summaryCurve)
|
||||
{
|
||||
if (m_caseName)
|
||||
bool skipSubString = nameHelper && nameHelper->isCaseInTitle();
|
||||
|
||||
if (m_caseName && !skipSubString)
|
||||
{
|
||||
if (summaryCurve && summaryCurve->summaryCaseY())
|
||||
{
|
||||
@@ -209,8 +224,11 @@ void RimSummaryCurveAutoName::applySettings(const RimSummaryCurveAutoName& other
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryCurveAutoName::appendWellName(std::string& text, const RifEclipseSummaryAddress& summaryAddress) const
|
||||
void RimSummaryCurveAutoName::appendWellName(std::string& text, const RifEclipseSummaryAddress& summaryAddress, const RimSummaryPlotNameHelper* nameHelper) const
|
||||
{
|
||||
bool skipSubString = nameHelper && nameHelper->isWellNameInTitle();
|
||||
if (skipSubString) return;
|
||||
|
||||
if (m_wellName)
|
||||
{
|
||||
if (text.size() > 0) text += ":";
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
|
||||
|
||||
class RifEclipseSummaryAddress;
|
||||
class RimSummaryPlotNameHelper;
|
||||
|
||||
class RimSummaryCurveAutoName : public caf::PdmObject
|
||||
{
|
||||
@@ -31,7 +32,7 @@ class RimSummaryCurveAutoName : public caf::PdmObject
|
||||
public:
|
||||
RimSummaryCurveAutoName();;
|
||||
|
||||
QString curveName(const RifEclipseSummaryAddress& summaryAddress) const;
|
||||
QString curveName(const RifEclipseSummaryAddress& summaryAddress, const RimSummaryPlotNameHelper* nameHelper) const;
|
||||
|
||||
void applySettings(const RimSummaryCurveAutoName& other);
|
||||
|
||||
@@ -43,7 +44,7 @@ protected:
|
||||
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
|
||||
|
||||
private:
|
||||
void appendWellName(std::string& text, const RifEclipseSummaryAddress& summaryAddress) const;
|
||||
void appendWellName(std::string& text, const RifEclipseSummaryAddress& summaryAddress, const RimSummaryPlotNameHelper* nameHelper) const;
|
||||
void appendLgrName(std::string& text, const RifEclipseSummaryAddress& summaryAddress) const;
|
||||
|
||||
private:
|
||||
|
||||
@@ -276,7 +276,7 @@ QString RimSummaryCurveCollection::compileAutoPlotTitle() const
|
||||
// Suggestion : Delegate to RimSummaryPlotSourceStepping to find title
|
||||
}
|
||||
|
||||
analyzer.analyzeAdresses(addresses);
|
||||
analyzer.appendAdresses(addresses);
|
||||
|
||||
auto quantities = analyzer.quantities();
|
||||
auto wellNames = analyzer.wellNames();
|
||||
|
||||
@@ -23,14 +23,15 @@
|
||||
|
||||
#include "RimAsciiDataCurve.h"
|
||||
#include "RimGridTimeHistoryCurve.h"
|
||||
#include "RimSummaryAxisProperties.h"
|
||||
#include "RimSummaryCase.h"
|
||||
#include "RimSummaryCurve.h"
|
||||
#include "RimSummaryCurveCollection.h"
|
||||
#include "RimSummaryCurveFilter.h"
|
||||
#include "RimSummaryCurvesCalculator.h"
|
||||
#include "RimSummaryPlotCollection.h"
|
||||
#include "RimSummaryPlotNameHelper.h"
|
||||
#include "RimSummaryTimeAxisProperties.h"
|
||||
#include "RimSummaryAxisProperties.h"
|
||||
|
||||
#include "RiuMainPlotWindow.h"
|
||||
#include "RiuSummaryQwtPlot.h"
|
||||
@@ -115,6 +116,8 @@ RimSummaryPlot::RimSummaryPlot()
|
||||
setAsPlotMdiWindow();
|
||||
|
||||
m_isCrossPlot = false;
|
||||
|
||||
m_nameHelper.reset(new RimSummaryPlotNameHelper);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -149,6 +152,8 @@ void RimSummaryPlot::updateAxes()
|
||||
{
|
||||
updateTimeAxis();
|
||||
}
|
||||
|
||||
updatePlotTitle();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -493,12 +498,29 @@ void RimSummaryPlot::updatePlotTitle()
|
||||
{
|
||||
if (m_isUsingAutoName)
|
||||
{
|
||||
m_userDefinedPlotTitle = m_summaryCurveCollection->compileAutoPlotTitle();
|
||||
m_userDefinedPlotTitle = generatePlotTitle();
|
||||
|
||||
updateAutoNameOfCurves();
|
||||
|
||||
this->updateConnectedEditors();
|
||||
}
|
||||
|
||||
updateMdiWindowTitle();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const RimSummaryPlotNameHelper* RimSummaryPlot::activePlotTitleHelper() const
|
||||
{
|
||||
if (m_isUsingAutoName())
|
||||
{
|
||||
return m_nameHelper.get();
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -1013,8 +1035,17 @@ void RimSummaryPlot::fieldChangedByUi(const caf::PdmFieldHandle* changedField, c
|
||||
{
|
||||
updatePlotTitle();
|
||||
}
|
||||
}
|
||||
|
||||
if (changedField == &m_isUsingAutoName && !m_isUsingAutoName)
|
||||
{
|
||||
// When auto name of plot is turned off, update the auto name for all curves
|
||||
|
||||
for (auto c : summaryCurves())
|
||||
{
|
||||
c->updateCurveNameNoLegendUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
@@ -1068,10 +1099,7 @@ void RimSummaryPlot::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryPlot::onLoadDataAndUpdate()
|
||||
{
|
||||
if (m_isUsingAutoName)
|
||||
{
|
||||
m_userDefinedPlotTitle = m_summaryCurveCollection->compileAutoPlotTitle();
|
||||
}
|
||||
updatePlotTitle();
|
||||
|
||||
updateMdiWindowVisibility();
|
||||
|
||||
@@ -1216,11 +1244,6 @@ void RimSummaryPlot::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering&
|
||||
|
||||
m_userDefinedPlotTitle.uiCapability()->setUiReadOnly(m_isUsingAutoName);
|
||||
|
||||
if (m_isUsingAutoName)
|
||||
{
|
||||
m_userDefinedPlotTitle = m_summaryCurveCollection->compileAutoPlotTitle();
|
||||
}
|
||||
|
||||
uiOrdering.skipRemainingFields(true);
|
||||
}
|
||||
|
||||
@@ -1328,6 +1351,50 @@ void RimSummaryPlot::updateMdiWindowTitle()
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimSummaryPlot::generatePlotTitle()
|
||||
{
|
||||
std::vector<RifEclipseSummaryAddress> addresses;
|
||||
std::vector<RimSummaryCase*> sumCases;
|
||||
|
||||
if (m_summaryCurveCollection && m_summaryCurveCollection->isCurvesVisible())
|
||||
{
|
||||
for (RimSummaryCurve* curve : m_summaryCurveCollection->curves())
|
||||
{
|
||||
if (curve->isCurveVisible())
|
||||
{
|
||||
addresses.push_back(curve->summaryAddressY());
|
||||
sumCases.push_back(curve->summaryCaseY());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_nameHelper->clear();
|
||||
m_nameHelper->appendAddresses(addresses);
|
||||
m_nameHelper->appendSummaryCases(sumCases);
|
||||
|
||||
return m_nameHelper->plotTitle();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryPlot::updateAutoNameOfCurves()
|
||||
{
|
||||
if (m_summaryCurveCollection->isCurvesVisible())
|
||||
{
|
||||
for (auto c : summaryCurves())
|
||||
{
|
||||
if (c->isCurveVisible())
|
||||
{
|
||||
c->updateCurveNameNoLegendUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -22,10 +22,16 @@
|
||||
#include "cafPdmChildArrayField.h"
|
||||
|
||||
#include "RiaDefines.h"
|
||||
|
||||
#include "RifEclipseSummaryAddress.h"
|
||||
|
||||
#include "RimViewWindow.h"
|
||||
|
||||
#include <QPointer>
|
||||
|
||||
#include <set>
|
||||
#include <memory>
|
||||
|
||||
class PdmUiTreeOrdering;
|
||||
class RimAsciiDataCurve;
|
||||
class RimGridTimeHistoryCurve;
|
||||
@@ -36,6 +42,7 @@ class RimSummaryCurveFilter_OBSOLETE;
|
||||
class RimSummaryTimeAxisProperties;
|
||||
class RimSummaryAxisProperties;
|
||||
class RiuSummaryQwtPlot;
|
||||
class RimSummaryPlotNameHelper;
|
||||
|
||||
class QwtInterval;
|
||||
class QwtPlotCurve;
|
||||
@@ -103,6 +110,8 @@ public:
|
||||
|
||||
void updatePlotTitle();
|
||||
|
||||
const RimSummaryPlotNameHelper* activePlotTitleHelper() const;
|
||||
|
||||
// RimViewWindow overrides
|
||||
public:
|
||||
virtual QWidget* createViewWidget(QWidget* mainWindowParent) override;
|
||||
@@ -111,6 +120,8 @@ public:
|
||||
|
||||
private:
|
||||
void updateMdiWindowTitle() override;
|
||||
QString generatePlotTitle();
|
||||
void updateAutoNameOfCurves();
|
||||
|
||||
protected:
|
||||
// Overridden PDM methods
|
||||
@@ -126,8 +137,6 @@ protected:
|
||||
|
||||
void setAsCrossPlot();
|
||||
|
||||
|
||||
|
||||
private:
|
||||
std::vector<RimSummaryCurve*> visibleSummaryCurvesForAxis(RiaDefines::PlotAxis plotAxis) const;
|
||||
std::vector<RimGridTimeHistoryCurve*> visibleTimeHistoryCurvesForAxis(RiaDefines::PlotAxis plotAxis) const;
|
||||
@@ -163,8 +172,12 @@ private:
|
||||
|
||||
QPointer<RiuSummaryQwtPlot> m_qwtPlot;
|
||||
|
||||
caf::PdmChildArrayField<RimSummaryCurve*> m_summaryCurves_OBSOLETE;
|
||||
caf::PdmChildArrayField<RimSummaryCurveFilter_OBSOLETE*> m_curveFilters_OBSOLETE;
|
||||
|
||||
bool m_isCrossPlot;
|
||||
|
||||
std::unique_ptr<RimSummaryPlotNameHelper> m_nameHelper;
|
||||
|
||||
// Obsolete fields
|
||||
caf::PdmChildArrayField<RimSummaryCurve*> m_summaryCurves_OBSOLETE;
|
||||
caf::PdmChildArrayField<RimSummaryCurveFilter_OBSOLETE*> m_curveFilters_OBSOLETE;
|
||||
};
|
||||
|
||||
@@ -0,0 +1,204 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RimSummaryPlotNameHelper.h"
|
||||
|
||||
#include "RifEclipseSummaryAddress.h"
|
||||
|
||||
#include "RimSummaryCase.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSummaryPlotNameHelper::RimSummaryPlotNameHelper() {}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryPlotNameHelper::clear()
|
||||
{
|
||||
m_summaryCases.clear();
|
||||
|
||||
m_analyzer.clear();
|
||||
|
||||
clearTitleSubStrings();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryPlotNameHelper::appendAddresses(const std::vector<RifEclipseSummaryAddress>& addresses)
|
||||
{
|
||||
m_analyzer.appendAdresses(addresses);
|
||||
|
||||
extractPlotTitleSubStrings();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryPlotNameHelper::appendSummaryCases(const std::vector<RimSummaryCase*>& summaryCases)
|
||||
{
|
||||
m_summaryCases.clear();
|
||||
|
||||
for (auto c : summaryCases)
|
||||
{
|
||||
m_summaryCases.insert(c);
|
||||
}
|
||||
|
||||
extractPlotTitleSubStrings();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimSummaryPlotNameHelper::plotTitle() const
|
||||
{
|
||||
QString title;
|
||||
|
||||
if (!m_titleCaseName.isEmpty())
|
||||
{
|
||||
if (!title.isEmpty()) title += ", ";
|
||||
title += m_titleCaseName;
|
||||
}
|
||||
|
||||
if (!m_titleWellName.empty())
|
||||
{
|
||||
if (!title.isEmpty()) title += ", ";
|
||||
title += QString::fromStdString(m_titleWellName);
|
||||
}
|
||||
|
||||
if (!m_titleWellGroupName.empty())
|
||||
{
|
||||
if (!title.isEmpty()) title += ", ";
|
||||
title += QString::fromStdString(m_titleWellGroupName);
|
||||
}
|
||||
|
||||
if (!m_titleRegion.empty())
|
||||
{
|
||||
if (!title.isEmpty()) title += ", ";
|
||||
title += "Region : " + QString::fromStdString(m_titleRegion);
|
||||
}
|
||||
|
||||
if (!m_titleQuantity.empty())
|
||||
{
|
||||
if (!title.isEmpty()) title += ", ";
|
||||
title += QString::fromStdString(m_titleQuantity);
|
||||
}
|
||||
|
||||
if (title.isEmpty())
|
||||
{
|
||||
title = "Composed Plot";
|
||||
}
|
||||
|
||||
return title;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimSummaryPlotNameHelper::isQuantityInTitle() const
|
||||
{
|
||||
return !m_titleQuantity.empty();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimSummaryPlotNameHelper::isWellNameInTitle() const
|
||||
{
|
||||
return !m_titleWellName.empty();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimSummaryPlotNameHelper::isWellGroupNameInTitle() const
|
||||
{
|
||||
return !m_titleWellGroupName.empty();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimSummaryPlotNameHelper::isRegionInTitle() const
|
||||
{
|
||||
return !m_titleRegion.empty();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimSummaryPlotNameHelper::isCaseInTitle() const
|
||||
{
|
||||
return !m_titleCaseName.isEmpty();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryPlotNameHelper::clearTitleSubStrings()
|
||||
{
|
||||
m_titleQuantity.clear();
|
||||
m_titleRegion.clear();
|
||||
m_titleWellName.clear();
|
||||
m_titleRegion.clear();
|
||||
|
||||
m_titleCaseName.clear();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryPlotNameHelper::extractPlotTitleSubStrings()
|
||||
{
|
||||
clearTitleSubStrings();
|
||||
|
||||
auto quantities = m_analyzer.quantities();
|
||||
auto wellNames = m_analyzer.wellNames();
|
||||
auto wellGroupNames = m_analyzer.wellGroupNames();
|
||||
auto regions = m_analyzer.regionNumbers();
|
||||
|
||||
if (quantities.size() == 1)
|
||||
{
|
||||
m_titleQuantity = *(quantities.begin());
|
||||
}
|
||||
|
||||
if (wellNames.size() == 1)
|
||||
{
|
||||
m_titleWellName = *(wellNames.begin());
|
||||
}
|
||||
|
||||
if (wellGroupNames.size() == 1)
|
||||
{
|
||||
m_titleWellGroupName = *(wellGroupNames.begin());
|
||||
}
|
||||
|
||||
if (regions.size() == 1)
|
||||
{
|
||||
m_titleRegion = *(regions.begin());
|
||||
}
|
||||
|
||||
// Case mane
|
||||
if (m_summaryCases.size() == 1)
|
||||
{
|
||||
auto summaryCase = *(m_summaryCases.begin());
|
||||
|
||||
m_titleCaseName = summaryCase->caseName();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RiaSummaryCurveAnalyzer.h"
|
||||
|
||||
#include "RifEclipseSummaryAddress.h"
|
||||
|
||||
#include <QString>
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
class RimSummaryCurve;
|
||||
class RimSummaryCase;
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//==================================================================================================
|
||||
class RimSummaryPlotNameHelper
|
||||
{
|
||||
public:
|
||||
RimSummaryPlotNameHelper();
|
||||
|
||||
void clear();
|
||||
|
||||
void appendAddresses(const std::vector<RifEclipseSummaryAddress>& addresses);
|
||||
void appendSummaryCases(const std::vector<RimSummaryCase*>& summaryCases);
|
||||
|
||||
QString plotTitle() const;
|
||||
|
||||
bool isQuantityInTitle() const;
|
||||
bool isWellNameInTitle() const;
|
||||
bool isWellGroupNameInTitle() const;
|
||||
bool isRegionInTitle() const;
|
||||
bool isCaseInTitle() const;
|
||||
|
||||
private:
|
||||
void clearTitleSubStrings();
|
||||
void extractPlotTitleSubStrings();
|
||||
|
||||
private:
|
||||
RiaSummaryCurveAnalyzer m_analyzer;
|
||||
|
||||
std::set<RimSummaryCase*> m_summaryCases;
|
||||
|
||||
std::string m_titleQuantity;
|
||||
std::string m_titleWellName;
|
||||
std::string m_titleWellGroupName;
|
||||
std::string m_titleRegion;
|
||||
|
||||
QString m_titleCaseName;
|
||||
};
|
||||
@@ -201,7 +201,7 @@ std::vector<caf::PdmFieldHandle*> RimSummaryPlotSourceStepping::fieldsToShowInTo
|
||||
}
|
||||
|
||||
RiaSummaryCurveAnalyzer analyzer;
|
||||
analyzer.analyzeAdresses(allAddressesUsedInCurveCollection());
|
||||
analyzer.appendAdresses(allAddressesUsedInCurveCollection());
|
||||
|
||||
if (analyzer.wellNames().size() == 1)
|
||||
{
|
||||
@@ -292,8 +292,8 @@ QList<caf::PdmOptionItemInfo> RimSummaryPlotSourceStepping::calculateValueOption
|
||||
RiaSummaryCurveAnalyzer quantityAnalyzer;
|
||||
|
||||
auto subset = RiaSummaryCurveAnalyzer::addressesForCategory(reader->allResultAddresses(), category);
|
||||
quantityAnalyzer.analyzeAdresses(subset);
|
||||
|
||||
quantityAnalyzer.appendAdresses(subset);
|
||||
for (const auto& quantity : quantityAnalyzer.quantities())
|
||||
{
|
||||
identifierTexts.insert(QString::fromStdString(quantity));
|
||||
@@ -556,7 +556,7 @@ void RimSummaryPlotSourceStepping::updateUiFromCurves()
|
||||
}
|
||||
|
||||
RiaSummaryCurveAnalyzer analyzer;
|
||||
analyzer.analyzeAdresses(allAddressesUsedInCurveCollection());
|
||||
analyzer.appendAdresses(allAddressesUsedInCurveCollection());
|
||||
|
||||
RifEclipseSummaryAddress::SummaryVarCategory category = RifEclipseSummaryAddress::SUMMARY_INVALID;
|
||||
{
|
||||
@@ -616,7 +616,7 @@ void RimSummaryPlotSourceStepping::updateUiFromCurves()
|
||||
caf::PdmValueField* RimSummaryPlotSourceStepping::fieldToModify()
|
||||
{
|
||||
RiaSummaryCurveAnalyzer analyzer;
|
||||
analyzer.analyzeAdresses(allAddressesUsedInCurveCollection());
|
||||
analyzer.appendAdresses(allAddressesUsedInCurveCollection());
|
||||
|
||||
if (analyzer.wellNames().size() == 1)
|
||||
{
|
||||
@@ -732,7 +732,7 @@ RiaSummaryCurveAnalyzer* RimSummaryPlotSourceStepping::analyzerForReader(RifSumm
|
||||
m_curveAnalyzerForReader = std::make_pair(reader, analyzer);
|
||||
}
|
||||
|
||||
m_curveAnalyzerForReader.second.analyzeAdresses(reader->allResultAddresses());
|
||||
m_curveAnalyzerForReader.second.appendAdresses(reader->allResultAddresses());
|
||||
|
||||
return &m_curveAnalyzerForReader.second;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user