mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#2780 Ensemble Curve Set : Improve plot title including ensembles
This commit is contained in:
@@ -243,6 +243,14 @@ void RimEnsembleCurveSet::deleteCurve(RimSummaryCurve* curve)
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RifEclipseSummaryAddress RimEnsembleCurveSet::summaryAddress() const
|
||||
{
|
||||
return m_yValuesCurveVariable->address();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -293,6 +301,14 @@ void RimEnsembleCurveSet::onLegendDefinitionChanged()
|
||||
updateCurveColors();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEnsembleCurveSet::setSummaryCaseCollection(RimSummaryCaseCollection* sumCaseCollection)
|
||||
{
|
||||
m_yValuesSummaryGroup = sumCaseCollection;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -360,21 +376,6 @@ void RimEnsembleCurveSet::fieldChangedByUi(const caf::PdmFieldHandle* changedFie
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEnsembleCurveSet::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
||||
{
|
||||
{
|
||||
caf::PdmUiGroup* nameGroup = uiOrdering.addNewGroup("Curve Name");
|
||||
nameGroup->setCollapsedByDefault(true);
|
||||
nameGroup->add(&m_isUsingAutoName);
|
||||
if (m_isUsingAutoName)
|
||||
{
|
||||
nameGroup->add(&m_autoGeneratedName);
|
||||
m_summaryAddressNameTools->uiOrdering(uiConfigName, *nameGroup);
|
||||
}
|
||||
else
|
||||
{
|
||||
nameGroup->add(&m_userDefinedName);
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
QString curveDataGroupName = "Summary Vector";
|
||||
caf::PdmUiGroup* curveDataGroup = uiOrdering.addNewGroupWithKeyword(curveDataGroupName, "Summary Vector Y");
|
||||
@@ -404,11 +405,19 @@ void RimEnsembleCurveSet::defineUiOrdering(QString uiConfigName, caf::PdmUiOrder
|
||||
colorsGroup->add(&m_ensembleParameter);
|
||||
}
|
||||
|
||||
// Set default initial ensemble
|
||||
RimProject* project = RiaApplication::instance()->project();
|
||||
if (m_yValuesSummaryGroup() == nullptr && project->summaryGroups().size() == 1)
|
||||
{
|
||||
m_yValuesSummaryGroup = project->summaryGroups().front();
|
||||
caf::PdmUiGroup* nameGroup = uiOrdering.addNewGroup("Curve Name");
|
||||
nameGroup->setCollapsedByDefault(true);
|
||||
nameGroup->add(&m_isUsingAutoName);
|
||||
if (m_isUsingAutoName)
|
||||
{
|
||||
nameGroup->add(&m_autoGeneratedName);
|
||||
m_summaryAddressNameTools->uiOrdering(uiConfigName, *nameGroup);
|
||||
}
|
||||
else
|
||||
{
|
||||
nameGroup->add(&m_userDefinedName);
|
||||
}
|
||||
}
|
||||
|
||||
uiOrdering.skipRemainingFields(true);
|
||||
|
||||
@@ -71,6 +71,7 @@ public:
|
||||
void addCurve(RimSummaryCurve* curve);
|
||||
void deleteCurve(RimSummaryCurve* curve);
|
||||
|
||||
RifEclipseSummaryAddress summaryAddress() const;
|
||||
std::vector<RimSummaryCurve*> curves() const;
|
||||
std::vector<RimSummaryCurve*> visibleCurves() const;
|
||||
|
||||
@@ -79,6 +80,7 @@ public:
|
||||
RimRegularLegendConfig* legendConfig();
|
||||
void onLegendDefinitionChanged();
|
||||
|
||||
void setSummaryCaseCollection(RimSummaryCaseCollection* sumCaseCollection);
|
||||
RimSummaryCaseCollection* summaryCaseCollection() const;
|
||||
|
||||
private:
|
||||
|
||||
@@ -82,33 +82,30 @@ QString RimSummaryCurveAutoName::curveNameY(const RifEclipseSummaryAddress& summ
|
||||
|
||||
appendAddressDetails(text, summaryAddress, nameHelper);
|
||||
|
||||
RimEnsembleCurveSet* ensambleCurveSet = nullptr;
|
||||
this->firstAncestorOrThisOfType(ensambleCurveSet);
|
||||
QString caseName;
|
||||
|
||||
if (ensambleCurveSet)
|
||||
{
|
||||
bool skipSubString = nameHelper && nameHelper->isCaseInTitle();
|
||||
|
||||
if (m_caseName && !skipSubString)
|
||||
RimEnsembleCurveSet* ensambleCurveSet = nullptr;
|
||||
this->firstAncestorOrThisOfType(ensambleCurveSet);
|
||||
if (ensambleCurveSet && ensambleCurveSet->summaryCaseCollection())
|
||||
{
|
||||
if (ensambleCurveSet && ensambleCurveSet->summaryCaseCollection())
|
||||
{
|
||||
if (!text.empty()) text += ", ";
|
||||
text += ensambleCurveSet->summaryCaseCollection()->name().toStdString();
|
||||
}
|
||||
caseName = ensambleCurveSet->summaryCaseCollection()->name();
|
||||
}
|
||||
}
|
||||
else if (summaryCurve)
|
||||
|
||||
if (caseName.isEmpty() && summaryCurve && summaryCurve->summaryCaseY())
|
||||
{
|
||||
caseName = summaryCurve->summaryCaseY()->caseName();
|
||||
}
|
||||
|
||||
if (!caseName.isEmpty())
|
||||
{
|
||||
bool skipSubString = nameHelper && nameHelper->isCaseInTitle();
|
||||
|
||||
if (m_caseName && !skipSubString)
|
||||
{
|
||||
if (summaryCurve && summaryCurve->summaryCaseY())
|
||||
{
|
||||
if (!text.empty()) text += ", ";
|
||||
text += summaryCurve->summaryCaseY()->caseName().toStdString();
|
||||
}
|
||||
if (!text.empty()) text += ", ";
|
||||
text += caseName.toStdString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -142,8 +139,10 @@ QString RimSummaryCurveAutoName::curveNameX(const RifEclipseSummaryAddress& summ
|
||||
|
||||
appendAddressDetails(text, summaryAddress, nameHelper);
|
||||
|
||||
if (summaryCurve)
|
||||
if (summaryCurve && summaryCurve->summaryCaseX())
|
||||
{
|
||||
QString caseName = summaryCurve->summaryCaseX()->caseName();
|
||||
|
||||
bool skipSubString = nameHelper && nameHelper->isCaseInTitle();
|
||||
|
||||
if (m_caseName && !skipSubString)
|
||||
@@ -151,7 +150,7 @@ QString RimSummaryCurveAutoName::curveNameX(const RifEclipseSummaryAddress& summ
|
||||
if (summaryCurve && summaryCurve->summaryCaseX())
|
||||
{
|
||||
if (!text.empty()) text += ", ";
|
||||
text += summaryCurve->summaryCaseX()->caseName().toStdString();
|
||||
text += caseName.toStdString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1460,6 +1460,7 @@ QString RimSummaryPlot::generatePlotTitle(RimSummaryPlotNameHelper* nameHelper)
|
||||
|
||||
std::vector<RifEclipseSummaryAddress> addresses;
|
||||
std::vector<RimSummaryCase*> sumCases;
|
||||
std::vector<RimSummaryCaseCollection*> ensambleCases;
|
||||
|
||||
if (m_summaryCurveCollection && m_summaryCurveCollection->isCurvesVisible())
|
||||
{
|
||||
@@ -1483,9 +1484,19 @@ QString RimSummaryPlot::generatePlotTitle(RimSummaryPlotNameHelper* nameHelper)
|
||||
}
|
||||
}
|
||||
|
||||
for (auto curveSet : m_ensembleCurveSetCollection->curveSets())
|
||||
{
|
||||
if (curveSet->isCurvesVisible())
|
||||
{
|
||||
addresses.push_back(curveSet->summaryAddress());
|
||||
ensambleCases.push_back(curveSet->summaryCaseCollection());
|
||||
}
|
||||
}
|
||||
|
||||
nameHelper->clear();
|
||||
nameHelper->appendAddresses(addresses);
|
||||
nameHelper->appendSummaryCases(sumCases);
|
||||
nameHelper->appendEnsembleCases(ensambleCases);
|
||||
|
||||
return nameHelper->plotTitle();
|
||||
}
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
#include "RifEclipseSummaryAddress.h"
|
||||
|
||||
#include "RimSummaryCase.h"
|
||||
#include "RimSummaryCaseCollection.h"
|
||||
|
||||
#include "RiuSummaryVectorDescriptionMap.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -29,7 +31,7 @@
|
||||
RimSummaryPlotNameHelper::RimSummaryPlotNameHelper() {}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryPlotNameHelper::clear()
|
||||
{
|
||||
@@ -51,7 +53,7 @@ void RimSummaryPlotNameHelper::appendAddresses(const std::vector<RifEclipseSumma
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryPlotNameHelper::appendSummaryCases(const std::vector<RimSummaryCase*>& summaryCases)
|
||||
{
|
||||
@@ -65,6 +67,21 @@ void RimSummaryPlotNameHelper::appendSummaryCases(const std::vector<RimSummaryCa
|
||||
extractPlotTitleSubStrings();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryPlotNameHelper::appendEnsembleCases(const std::vector<RimSummaryCaseCollection*>& ensembleCases)
|
||||
{
|
||||
m_ensembleCases.clear();
|
||||
|
||||
for (auto c : ensembleCases)
|
||||
{
|
||||
m_ensembleCases.insert(c);
|
||||
}
|
||||
|
||||
extractPlotTitleSubStrings();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -143,7 +160,7 @@ bool RimSummaryPlotNameHelper::isRegionInTitle() const
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimSummaryPlotNameHelper::isCaseInTitle() const
|
||||
{
|
||||
@@ -151,7 +168,7 @@ bool RimSummaryPlotNameHelper::isCaseInTitle() const
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryPlotNameHelper::clearTitleSubStrings()
|
||||
{
|
||||
@@ -195,11 +212,31 @@ void RimSummaryPlotNameHelper::extractPlotTitleSubStrings()
|
||||
m_titleRegion = std::to_string(*(regions.begin()));
|
||||
}
|
||||
|
||||
// Case mane
|
||||
if (m_summaryCases.size() == 1)
|
||||
{
|
||||
auto summaryCase = *(m_summaryCases.begin());
|
||||
QString summaryCaseTitle;
|
||||
if (m_summaryCases.size() == 1)
|
||||
{
|
||||
auto summaryCase = *(m_summaryCases.begin());
|
||||
|
||||
m_titleCaseName = summaryCase->caseName();
|
||||
summaryCaseTitle = summaryCase->caseName();
|
||||
}
|
||||
|
||||
QString ensembleCaseTitle;
|
||||
if (m_titleCaseName.isEmpty() && m_ensembleCases.size() == 1)
|
||||
{
|
||||
auto ensembleCase = *(m_ensembleCases.begin());
|
||||
|
||||
ensembleCaseTitle = ensembleCase->name();
|
||||
}
|
||||
|
||||
// If one case title is the single available, use the single title
|
||||
if (summaryCaseTitle.isEmpty() && !ensembleCaseTitle.isEmpty())
|
||||
{
|
||||
m_titleCaseName = ensembleCaseTitle;
|
||||
}
|
||||
else if (!summaryCaseTitle.isEmpty() && ensembleCaseTitle.isEmpty())
|
||||
{
|
||||
m_titleCaseName = summaryCaseTitle;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
|
||||
class RimSummaryCurve;
|
||||
class RimSummaryCase;
|
||||
class RimSummaryCaseCollection;
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
@@ -42,6 +43,7 @@ public:
|
||||
|
||||
void appendAddresses(const std::vector<RifEclipseSummaryAddress>& addresses);
|
||||
void appendSummaryCases(const std::vector<RimSummaryCase*>& summaryCases);
|
||||
void appendEnsembleCases(const std::vector<RimSummaryCaseCollection*>& ensembleCases);
|
||||
|
||||
QString plotTitle() const;
|
||||
|
||||
@@ -58,7 +60,8 @@ private:
|
||||
private:
|
||||
RiaSummaryCurveAnalyzer m_analyzer;
|
||||
|
||||
std::set<RimSummaryCase*> m_summaryCases;
|
||||
std::set<RimSummaryCase*> m_summaryCases;
|
||||
std::set<RimSummaryCaseCollection*> m_ensembleCases;
|
||||
|
||||
std::string m_titleQuantity;
|
||||
std::string m_titleWellName;
|
||||
|
||||
Reference in New Issue
Block a user