mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Summary Plot : Move building of auto plot name to SummaryCurveCollection
This commit is contained in:
@@ -35,7 +35,7 @@ RiaSummaryCurveAnalyzer::RiaSummaryCurveAnalyzer() {}
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaSummaryCurveAnalyzer::analyzeCurves(RimSummaryCurveCollection* sumCurveCollection)
|
||||
void RiaSummaryCurveAnalyzer::analyzeCurves(const RimSummaryCurveCollection* sumCurveCollection)
|
||||
{
|
||||
clearAllSets();
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ class RiaSummaryCurveAnalyzer
|
||||
public:
|
||||
RiaSummaryCurveAnalyzer();
|
||||
|
||||
void analyzeCurves(RimSummaryCurveCollection* sumCurveCollection);
|
||||
void analyzeCurves(const RimSummaryCurveCollection* sumCurveCollection);
|
||||
void analyzeAdresses(const std::vector<RifEclipseSummaryAddress>& allAddresses);
|
||||
|
||||
std::set<std::string> quantities() const;
|
||||
|
||||
@@ -18,9 +18,11 @@
|
||||
|
||||
#include "RimSummaryCurveCollection.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaSummaryCurveAnalyzer.h"
|
||||
|
||||
#include "RifReaderEclipseSummary.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimSummaryCase.h"
|
||||
#include "RimSummaryCurve.h"
|
||||
@@ -160,16 +162,9 @@ void RimSummaryCurveCollection::deleteCurve(RimSummaryCurve* curve)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimSummaryCurve*> RimSummaryCurveCollection::curves()
|
||||
std::vector<RimSummaryCurve*> RimSummaryCurveCollection::curves() const
|
||||
{
|
||||
std::vector<RimSummaryCurve*> myCurves;
|
||||
|
||||
for (RimSummaryCurve* curve : m_curves)
|
||||
{
|
||||
myCurves.push_back(curve);
|
||||
}
|
||||
|
||||
return myCurves;
|
||||
return m_curves.childObjects();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -247,6 +242,42 @@ void RimSummaryCurveCollection::applyPreviousIdentifier()
|
||||
m_curvesModifier->applyPreviousIdentifier();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimSummaryCurveCollection::compileAutoPlotTitle() const
|
||||
{
|
||||
RiaSummaryCurveAnalyzer analyzer;
|
||||
|
||||
analyzer.analyzeCurves(this);
|
||||
|
||||
auto quantities = analyzer.quantities();
|
||||
auto wellNames = analyzer.wellNames();
|
||||
auto wellGroupNames = analyzer.wellGroupNames();
|
||||
auto regions = analyzer.regionNumbers();
|
||||
|
||||
QString title;
|
||||
|
||||
if (wellNames.size() == 1)
|
||||
{
|
||||
title = QString::fromStdString(*(wellNames.begin()));
|
||||
}
|
||||
else if (wellGroupNames.size() == 1)
|
||||
{
|
||||
title = QString::fromStdString(*(wellGroupNames.begin()));
|
||||
}
|
||||
else if (regions.size() == 1)
|
||||
{
|
||||
title = "Region : " + QString::number(*(regions.begin()));
|
||||
}
|
||||
else if (quantities.size() == 1)
|
||||
{
|
||||
title = QString::fromStdString(*(quantities.begin()));
|
||||
}
|
||||
|
||||
return title;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -53,7 +53,7 @@ public:
|
||||
void addCurve(RimSummaryCurve* curve);
|
||||
void deleteCurve(RimSummaryCurve* curve);
|
||||
|
||||
std::vector<RimSummaryCurve*> curves();
|
||||
std::vector<RimSummaryCurve*> curves() const;
|
||||
void deleteCurvesAssosiatedWithCase(RimSummaryCase* summaryCase);
|
||||
void deleteAllCurves();
|
||||
void updateCaseNameHasChanged();
|
||||
@@ -63,6 +63,8 @@ public:
|
||||
void applyNextIdentifier();
|
||||
void applyPreviousIdentifier();
|
||||
|
||||
QString compileAutoPlotTitle() const;
|
||||
|
||||
private:
|
||||
caf::PdmFieldHandle* objectToggleField();
|
||||
virtual void defineObjectEditorAttribute(QString uiConfigName,
|
||||
|
||||
@@ -508,7 +508,7 @@ void RimSummaryPlot::updatePlotTitle()
|
||||
{
|
||||
if (m_isUsingAutoName)
|
||||
{
|
||||
m_userDefinedPlotTitle = extractPlotTitleFromCurves();
|
||||
m_userDefinedPlotTitle = m_summaryCurveCollection->compileAutoPlotTitle();
|
||||
}
|
||||
|
||||
updateMdiWindowTitle();
|
||||
@@ -1159,7 +1159,7 @@ void RimSummaryPlot::onLoadDataAndUpdate()
|
||||
{
|
||||
if (m_isUsingAutoName)
|
||||
{
|
||||
m_userDefinedPlotTitle = extractPlotTitleFromCurves();
|
||||
m_userDefinedPlotTitle = m_summaryCurveCollection->compileAutoPlotTitle();
|
||||
}
|
||||
|
||||
updateMdiWindowVisibility();
|
||||
@@ -1237,42 +1237,6 @@ void RimSummaryPlot::setZoomIntervalsInQwtPlot()
|
||||
m_qwtPlot->setZoomWindow(left, right, time);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimSummaryPlot::extractPlotTitleFromCurves() const
|
||||
{
|
||||
RiaSummaryCurveAnalyzer analyzer;
|
||||
|
||||
analyzer.analyzeCurves(m_summaryCurveCollection());
|
||||
|
||||
auto quantities = analyzer.quantities();
|
||||
auto wellNames = analyzer.wellNames();
|
||||
auto wellGroupNames = analyzer.wellGroupNames();
|
||||
auto regions = analyzer.regionNumbers();
|
||||
|
||||
QString title;
|
||||
|
||||
if (wellNames.size() == 1)
|
||||
{
|
||||
title = QString::fromStdString(*(wellNames.begin()));
|
||||
}
|
||||
else if (wellGroupNames.size() == 1)
|
||||
{
|
||||
title = QString::fromStdString(*(wellGroupNames.begin()));
|
||||
}
|
||||
else if (regions.size() == 1)
|
||||
{
|
||||
title = "Region : " + QString::number(*(regions.begin()));
|
||||
}
|
||||
else if (quantities.size() == 1)
|
||||
{
|
||||
title = QString::fromStdString(*(quantities.begin()));
|
||||
}
|
||||
|
||||
return title;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -1348,7 +1312,7 @@ void RimSummaryPlot::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering&
|
||||
|
||||
if (m_isUsingAutoName)
|
||||
{
|
||||
m_userDefinedPlotTitle = extractPlotTitleFromCurves();
|
||||
m_userDefinedPlotTitle = m_summaryCurveCollection->compileAutoPlotTitle();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -145,8 +145,6 @@ private:
|
||||
void updateBottomXAxis();
|
||||
void setZoomIntervalsInQwtPlot();
|
||||
|
||||
QString extractPlotTitleFromCurves() const;
|
||||
|
||||
private:
|
||||
caf::PdmField<bool> m_showPlotTitle;
|
||||
caf::PdmField<bool> m_showLegend;
|
||||
|
||||
Reference in New Issue
Block a user