mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#987 Curve Creator : Use auto-generated plot name as default plot name
This commit is contained in:
parent
5566acdcda
commit
898c7a0483
@ -656,14 +656,12 @@ void RicSummaryCurveCreator::createNewPlot()
|
|||||||
QString candidatePlotName;
|
QString candidatePlotName;
|
||||||
if (m_previewPlot)
|
if (m_previewPlot)
|
||||||
{
|
{
|
||||||
candidatePlotName = m_previewPlot->summaryCurveCollection()->compileAutoPlotTitle();
|
candidatePlotName = m_previewPlot->generatedPlotTitleFromVisibleCurves();
|
||||||
}
|
}
|
||||||
|
|
||||||
RimSummaryPlot* newSummaryPlot = nullptr;
|
RimSummaryPlot* newSummaryPlot = nullptr;
|
||||||
|
|
||||||
if (candidatePlotName.isEmpty())
|
|
||||||
{
|
{
|
||||||
candidatePlotName = QString("Summary Plot %1").arg(summaryPlotColl->summaryPlots().size() + 1);
|
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
candidatePlotName = QInputDialog::getText(NULL,
|
candidatePlotName = QInputDialog::getText(NULL,
|
||||||
"New Summary Plot Name", "New Summary Plot Name",
|
"New Summary Plot Name", "New Summary Plot Name",
|
||||||
@ -678,10 +676,6 @@ void RicSummaryCurveCreator::createNewPlot()
|
|||||||
|
|
||||||
newSummaryPlot = summaryPlotColl->createNamedSummaryPlot(candidatePlotName);
|
newSummaryPlot = summaryPlotColl->createNamedSummaryPlot(candidatePlotName);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
newSummaryPlot = summaryPlotColl->createSummaryPlotAutoName();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (newSummaryPlot)
|
if (newSummaryPlot)
|
||||||
{
|
{
|
||||||
|
@ -19,7 +19,6 @@
|
|||||||
#include "RimSummaryCurveCollection.h"
|
#include "RimSummaryCurveCollection.h"
|
||||||
|
|
||||||
#include "RiaApplication.h"
|
#include "RiaApplication.h"
|
||||||
#include "RiaSummaryCurveAnalyzer.h"
|
|
||||||
|
|
||||||
#include "RifReaderEclipseSummary.h"
|
#include "RifReaderEclipseSummary.h"
|
||||||
|
|
||||||
@ -260,51 +259,6 @@ std::vector<caf::PdmFieldHandle*> RimSummaryCurveCollection::fieldsToShowInToolb
|
|||||||
return m_ySourceStepping()->fieldsToShowInToolbar();
|
return m_ySourceStepping()->fieldsToShowInToolbar();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
QString RimSummaryCurveCollection::compileAutoPlotTitle() const
|
|
||||||
{
|
|
||||||
RiaSummaryCurveAnalyzer analyzer;
|
|
||||||
|
|
||||||
std::set<RifEclipseSummaryAddress> addresses;
|
|
||||||
for (auto c : m_curves)
|
|
||||||
{
|
|
||||||
addresses.insert(c->summaryAddressY());
|
|
||||||
|
|
||||||
// TODO : Improve how cross plot curves contribute to title
|
|
||||||
// Suggestion : Delegate to RimSummaryPlotSourceStepping to find title
|
|
||||||
}
|
|
||||||
|
|
||||||
analyzer.appendAdresses(addresses);
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -63,8 +63,6 @@ public:
|
|||||||
|
|
||||||
std::vector<caf::PdmFieldHandle*> fieldsToShowInToolbar();
|
std::vector<caf::PdmFieldHandle*> fieldsToShowInToolbar();
|
||||||
|
|
||||||
QString compileAutoPlotTitle() const;
|
|
||||||
|
|
||||||
void handleKeyPressEvent(QKeyEvent* keyEvent);
|
void handleKeyPressEvent(QKeyEvent* keyEvent);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -498,7 +498,7 @@ void RimSummaryPlot::updatePlotTitle()
|
|||||||
{
|
{
|
||||||
if (m_isUsingAutoName)
|
if (m_isUsingAutoName)
|
||||||
{
|
{
|
||||||
m_userDefinedPlotTitle = generatePlotTitle();
|
m_userDefinedPlotTitle = generatePlotTitle(m_nameHelper.get());
|
||||||
|
|
||||||
updateAutoNameOfCurves();
|
updateAutoNameOfCurves();
|
||||||
|
|
||||||
@ -521,6 +521,16 @@ const RimSummaryPlotNameHelper* RimSummaryPlot::activePlotTitleHelper() const
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
QString RimSummaryPlot::generatedPlotTitleFromVisibleCurves() const
|
||||||
|
{
|
||||||
|
RimSummaryPlotNameHelper nameHelper;
|
||||||
|
|
||||||
|
return generatePlotTitle(&nameHelper);
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -1354,8 +1364,10 @@ void RimSummaryPlot::updateMdiWindowTitle()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
QString RimSummaryPlot::generatePlotTitle()
|
QString RimSummaryPlot::generatePlotTitle(RimSummaryPlotNameHelper* nameHelper) const
|
||||||
{
|
{
|
||||||
|
if (!nameHelper) return "";
|
||||||
|
|
||||||
std::vector<RifEclipseSummaryAddress> addresses;
|
std::vector<RifEclipseSummaryAddress> addresses;
|
||||||
std::vector<RimSummaryCase*> sumCases;
|
std::vector<RimSummaryCase*> sumCases;
|
||||||
|
|
||||||
@ -1371,11 +1383,11 @@ QString RimSummaryPlot::generatePlotTitle()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_nameHelper->clear();
|
nameHelper->clear();
|
||||||
m_nameHelper->appendAddresses(addresses);
|
nameHelper->appendAddresses(addresses);
|
||||||
m_nameHelper->appendSummaryCases(sumCases);
|
nameHelper->appendSummaryCases(sumCases);
|
||||||
|
|
||||||
return m_nameHelper->plotTitle();
|
return nameHelper->plotTitle();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -111,6 +111,7 @@ public:
|
|||||||
void updatePlotTitle();
|
void updatePlotTitle();
|
||||||
|
|
||||||
const RimSummaryPlotNameHelper* activePlotTitleHelper() const;
|
const RimSummaryPlotNameHelper* activePlotTitleHelper() const;
|
||||||
|
QString generatedPlotTitleFromVisibleCurves() const;
|
||||||
|
|
||||||
// RimViewWindow overrides
|
// RimViewWindow overrides
|
||||||
public:
|
public:
|
||||||
@ -120,7 +121,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void updateMdiWindowTitle() override;
|
void updateMdiWindowTitle() override;
|
||||||
QString generatePlotTitle();
|
QString generatePlotTitle(RimSummaryPlotNameHelper* nameHelper) const;
|
||||||
void updateAutoNameOfCurves();
|
void updateAutoNameOfCurves();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
Loading…
Reference in New Issue
Block a user