mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#3842 Summary : Application logic for supporting stepping data source
This commit is contained in:
parent
b1da83ee33
commit
ec528108d4
@ -25,6 +25,8 @@
|
||||
#include "RifSummaryReaderInterface.h"
|
||||
|
||||
#include "RimDataSourceSteppingTools.h"
|
||||
#include "RimEnsembleCurveSet.h"
|
||||
#include "RimEnsembleCurveSetCollection.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimSummaryCase.h"
|
||||
#include "RimSummaryCaseMainCollection.h"
|
||||
@ -56,6 +58,8 @@ RimSummaryPlotSourceStepping::RimSummaryPlotSourceStepping()
|
||||
CAF_PDM_InitFieldNoDefault(&m_region, "Region", "Region", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_quantity, "Quantities", "Quantity", "", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_ensemble, "Ensemble", "Ensemble", "", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_placeholderForLabel, "Placeholder", "", "", "", "");
|
||||
m_placeholderForLabel = "No common identifiers detected";
|
||||
m_placeholderForLabel.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::TOP);
|
||||
@ -88,6 +92,22 @@ void RimSummaryPlotSourceStepping::applyPrevCase()
|
||||
modifyCurrentIndex(&m_summaryCase, -1);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryPlotSourceStepping::applyNextEnsemble()
|
||||
{
|
||||
modifyCurrentIndex(&m_ensemble, 1);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryPlotSourceStepping::applyPrevEnsemble()
|
||||
{
|
||||
modifyCurrentIndex(&m_ensemble, -1);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -179,68 +199,143 @@ QList<caf::PdmOptionItemInfo> RimSummaryPlotSourceStepping::calculateValueOption
|
||||
|
||||
return options;
|
||||
}
|
||||
else if (fieldNeedingOptions == &m_ensemble)
|
||||
{
|
||||
QList<caf::PdmOptionItemInfo> options;
|
||||
|
||||
std::vector<QString> identifierTexts;
|
||||
RimProject* proj = RiaApplication::instance()->project();
|
||||
for (auto ensemble : proj->summaryGroups())
|
||||
{
|
||||
if (ensemble->isEnsemble())
|
||||
{
|
||||
options.append(caf::PdmOptionItemInfo(ensemble->name(), ensemble));
|
||||
}
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
QList<caf::PdmOptionItemInfo> options;
|
||||
|
||||
std::vector<RifSummaryReaderInterface*> readers = summaryReadersForCurves();
|
||||
if (!readers.empty())
|
||||
{
|
||||
RiaSummaryCurveAnalyzer* analyzer = analyzerForReader(readers.front());
|
||||
|
||||
if (fieldNeedingOptions == &m_wellName)
|
||||
if (fieldNeedingOptions == &m_quantity)
|
||||
{
|
||||
identifierTexts = analyzer->identifierTexts(RifEclipseSummaryAddress::SUMMARY_WELL);
|
||||
}
|
||||
else if (fieldNeedingOptions == &m_region)
|
||||
{
|
||||
identifierTexts = analyzer->identifierTexts(RifEclipseSummaryAddress::SUMMARY_REGION);
|
||||
}
|
||||
else if (fieldNeedingOptions == &m_wellGroupName)
|
||||
{
|
||||
identifierTexts = analyzer->identifierTexts(RifEclipseSummaryAddress::SUMMARY_WELL_GROUP);
|
||||
}
|
||||
else if (fieldNeedingOptions == &m_quantity)
|
||||
{
|
||||
RimSummaryCurveCollection* curveCollection = nullptr;
|
||||
this->firstAncestorOrThisOfTypeAsserted(curveCollection);
|
||||
|
||||
RifEclipseSummaryAddress::SummaryVarCategory category = RifEclipseSummaryAddress::SUMMARY_FIELD;
|
||||
|
||||
if (curveCollection->curves().size() > 0)
|
||||
auto addresses = addressesCurveCollection();
|
||||
if (!addresses.empty())
|
||||
{
|
||||
category = curveCollection->curves()[0]->summaryAddressY().category();
|
||||
category = addresses.begin()->category();
|
||||
}
|
||||
|
||||
RiaSummaryCurveAnalyzer quantityAnalyzer;
|
||||
std::map<QString, QString> displayAndValueStrings;
|
||||
|
||||
for (auto reader : readers)
|
||||
{
|
||||
if (reader != nullptr)
|
||||
RiaSummaryCurveAnalyzer quantityAnalyzer;
|
||||
|
||||
for (auto reader : readers)
|
||||
{
|
||||
auto subset = RiaSummaryCurveAnalyzer::addressesForCategory(reader->allResultAddresses(), category);
|
||||
quantityAnalyzer.appendAdresses(subset);
|
||||
if (reader != nullptr)
|
||||
{
|
||||
auto subset = RiaSummaryCurveAnalyzer::addressesForCategory(reader->allResultAddresses(), category);
|
||||
quantityAnalyzer.appendAdresses(subset);
|
||||
}
|
||||
}
|
||||
|
||||
RiaSummaryCurveAnalyzer analyzerForCurves;
|
||||
analyzerForCurves.appendAdresses(addressesCurveCollection());
|
||||
|
||||
if (analyzerForCurves.quantityNamesWithHistory().empty())
|
||||
{
|
||||
auto quantities = quantityAnalyzer.quantities();
|
||||
for (const auto& s : quantities)
|
||||
{
|
||||
QString valueString = QString::fromStdString(s);
|
||||
|
||||
displayAndValueStrings[valueString] = valueString;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
auto quantitiesWithHistory = quantityAnalyzer.quantityNamesWithHistory();
|
||||
for (const auto& s : quantitiesWithHistory)
|
||||
{
|
||||
QString valueString = QString::fromStdString(s);
|
||||
QString displayString = valueString + " (H)";
|
||||
|
||||
displayAndValueStrings[displayString] = valueString;
|
||||
}
|
||||
|
||||
auto quantitiesNoHistory = quantityAnalyzer.quantityNamesNoHistory();
|
||||
for (const auto& s : quantitiesNoHistory)
|
||||
{
|
||||
QString valueString = QString::fromStdString(s);
|
||||
|
||||
displayAndValueStrings[valueString] = valueString;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (const auto& quantity : quantityAnalyzer.quantities())
|
||||
for (const auto& displayAndValue : displayAndValueStrings)
|
||||
{
|
||||
identifierTexts.push_back(QString::fromStdString(quantity));
|
||||
options.append(caf::PdmOptionItemInfo(displayAndValue.first, displayAndValue.second));
|
||||
}
|
||||
|
||||
if (options.isEmpty())
|
||||
{
|
||||
options.push_back(caf::PdmOptionItemInfo("None", "None"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QList<caf::PdmOptionItemInfo> options;
|
||||
if (identifierTexts.size() > 0)
|
||||
{
|
||||
for (const auto& text : identifierTexts)
|
||||
else
|
||||
{
|
||||
options.append(caf::PdmOptionItemInfo(text, text));
|
||||
RifEclipseSummaryAddress::SummaryVarCategory category = RifEclipseSummaryAddress::SUMMARY_INVALID;
|
||||
|
||||
if (fieldNeedingOptions == &m_wellName)
|
||||
{
|
||||
category = RifEclipseSummaryAddress::SUMMARY_WELL;
|
||||
}
|
||||
else if (fieldNeedingOptions == &m_region)
|
||||
{
|
||||
category = RifEclipseSummaryAddress::SUMMARY_REGION;
|
||||
}
|
||||
else if (fieldNeedingOptions == &m_wellGroupName)
|
||||
{
|
||||
category = RifEclipseSummaryAddress::SUMMARY_WELL_GROUP;
|
||||
}
|
||||
|
||||
std::set<QString> identifierTexts;
|
||||
|
||||
if (category != RifEclipseSummaryAddress::SUMMARY_INVALID)
|
||||
{
|
||||
for (auto reader : readers)
|
||||
{
|
||||
auto analyzer = analyzerForReader(reader);
|
||||
|
||||
if (analyzer)
|
||||
{
|
||||
for (const auto& t : analyzer->identifierTexts(category))
|
||||
{
|
||||
identifierTexts.insert(t);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!identifierTexts.empty())
|
||||
{
|
||||
for (const auto& text : identifierTexts)
|
||||
{
|
||||
options.append(caf::PdmOptionItemInfo(text, text));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
options.push_back(caf::PdmOptionItemInfo("None", "None"));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
options.push_back(caf::PdmOptionItemInfo("None", "None"));
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
@ -252,16 +347,28 @@ void RimSummaryPlotSourceStepping::fieldChangedByUi(const caf::PdmFieldHandle* c
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue)
|
||||
{
|
||||
std::vector<RimSummaryCurve*> curves;
|
||||
|
||||
RimSummaryCurveCollection* curveCollection = nullptr;
|
||||
this->firstAncestorOrThisOfTypeAsserted(curveCollection);
|
||||
this->firstAncestorOrThisOfType(curveCollection);
|
||||
if (curveCollection)
|
||||
{
|
||||
curves = curveCollection->curves();
|
||||
}
|
||||
|
||||
RimEnsembleCurveSetCollection* ensembleCurveColl = nullptr;
|
||||
this->firstAncestorOrThisOfType(ensembleCurveColl);
|
||||
|
||||
bool triggerLoadDataAndUpdate = false;
|
||||
|
||||
std::string oldValueString = oldValue.toString().toStdString();
|
||||
std::string newValueString = newValue.toString().toStdString();
|
||||
|
||||
if (changedField == &m_summaryCase)
|
||||
{
|
||||
if (m_summaryCase())
|
||||
{
|
||||
for (auto curve : curveCollection->curves())
|
||||
for (auto curve : curves)
|
||||
{
|
||||
if (isYAxisStepping())
|
||||
{
|
||||
@ -284,9 +391,26 @@ void RimSummaryPlotSourceStepping::fieldChangedByUi(const caf::PdmFieldHandle* c
|
||||
m_region.uiCapability()->updateConnectedEditors();
|
||||
m_quantity.uiCapability()->updateConnectedEditors();
|
||||
}
|
||||
else if (changedField == &m_ensemble)
|
||||
{
|
||||
if (m_ensemble() && ensembleCurveColl)
|
||||
{
|
||||
for (auto curve : ensembleCurveColl->curveSets())
|
||||
{
|
||||
curve->setSummaryCaseCollection(m_ensemble);
|
||||
}
|
||||
|
||||
triggerLoadDataAndUpdate = true;
|
||||
}
|
||||
|
||||
m_wellName.uiCapability()->updateConnectedEditors();
|
||||
m_wellGroupName.uiCapability()->updateConnectedEditors();
|
||||
m_region.uiCapability()->updateConnectedEditors();
|
||||
m_quantity.uiCapability()->updateConnectedEditors();
|
||||
}
|
||||
else if (changedField == &m_wellName)
|
||||
{
|
||||
for (auto curve : curveCollection->curves())
|
||||
for (auto curve : curves)
|
||||
{
|
||||
if (isYAxisStepping())
|
||||
{
|
||||
@ -311,11 +435,24 @@ void RimSummaryPlotSourceStepping::fieldChangedByUi(const caf::PdmFieldHandle* c
|
||||
}
|
||||
}
|
||||
|
||||
if (ensembleCurveColl)
|
||||
{
|
||||
for (auto curveSet : ensembleCurveColl->curveSets())
|
||||
{
|
||||
auto adr = curveSet->summaryAddress();
|
||||
if (RifEclipseSummaryAddress::isDependentOnWellName(adr))
|
||||
{
|
||||
adr.setWellName(m_wellName().toStdString());
|
||||
curveSet->setSummaryAddress(adr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
triggerLoadDataAndUpdate = true;
|
||||
}
|
||||
else if (changedField == &m_region)
|
||||
{
|
||||
for (auto curve : curveCollection->curves())
|
||||
for (auto curve : curves)
|
||||
{
|
||||
if (isYAxisStepping())
|
||||
{
|
||||
@ -338,28 +475,45 @@ void RimSummaryPlotSourceStepping::fieldChangedByUi(const caf::PdmFieldHandle* c
|
||||
curve->setSummaryAddressX(adr);
|
||||
}
|
||||
}
|
||||
|
||||
if (ensembleCurveColl)
|
||||
{
|
||||
for (auto curveSet : ensembleCurveColl->curveSets())
|
||||
{
|
||||
auto adr = curveSet->summaryAddress();
|
||||
if (adr.category() == RifEclipseSummaryAddress::SUMMARY_REGION)
|
||||
{
|
||||
adr.setRegion(m_region());
|
||||
curveSet->setSummaryAddress(adr);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
triggerLoadDataAndUpdate = true;
|
||||
}
|
||||
else if (changedField == &m_quantity)
|
||||
{
|
||||
for (auto curve : curveCollection->curves())
|
||||
for (auto curve : curves)
|
||||
{
|
||||
if (isYAxisStepping())
|
||||
{
|
||||
RifEclipseSummaryAddress adr = curve->summaryAddressY();
|
||||
adr.setQuantityName(m_quantity().toStdString());
|
||||
|
||||
curve->setSummaryAddressY(adr);
|
||||
updateCurveYAddressIfMatching(oldValueString, newValueString, curve);
|
||||
}
|
||||
|
||||
if (isXAxisStepping())
|
||||
{
|
||||
RifEclipseSummaryAddress adr = curve->summaryAddressX();
|
||||
adr.setQuantityName(m_quantity().toStdString());
|
||||
updateCurveXAddressIfMatching(oldValueString, newValueString, curve);
|
||||
}
|
||||
}
|
||||
|
||||
curve->setSummaryAddressX(adr);
|
||||
if (ensembleCurveColl)
|
||||
{
|
||||
for (auto curveSet : ensembleCurveColl->curveSets())
|
||||
{
|
||||
auto adr = curveSet->summaryAddress();
|
||||
updateAddressIfMatching(oldValueString, newValueString, adr);
|
||||
curveSet->setSummaryAddress(adr);
|
||||
}
|
||||
}
|
||||
|
||||
@ -367,7 +521,7 @@ void RimSummaryPlotSourceStepping::fieldChangedByUi(const caf::PdmFieldHandle* c
|
||||
}
|
||||
else if (changedField == &m_wellGroupName)
|
||||
{
|
||||
for (auto curve : curveCollection->curves())
|
||||
for (auto curve : curves)
|
||||
{
|
||||
if (isYAxisStepping())
|
||||
{
|
||||
@ -392,6 +546,19 @@ void RimSummaryPlotSourceStepping::fieldChangedByUi(const caf::PdmFieldHandle* c
|
||||
}
|
||||
}
|
||||
|
||||
if (ensembleCurveColl)
|
||||
{
|
||||
for (auto curveSet : ensembleCurveColl->curveSets())
|
||||
{
|
||||
auto adr = curveSet->summaryAddress();
|
||||
if (adr.category() == RifEclipseSummaryAddress::SUMMARY_WELL_GROUP)
|
||||
{
|
||||
adr.setWellGroupName(m_wellGroupName().toStdString());
|
||||
curveSet->setSummaryAddress(adr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
triggerLoadDataAndUpdate = true;
|
||||
}
|
||||
|
||||
@ -403,12 +570,20 @@ void RimSummaryPlotSourceStepping::fieldChangedByUi(const caf::PdmFieldHandle* c
|
||||
summaryPlot->updatePlotTitle();
|
||||
summaryPlot->loadDataAndUpdate();
|
||||
|
||||
if (ensembleCurveColl)
|
||||
{
|
||||
ensembleCurveColl->updateConnectedEditors();
|
||||
}
|
||||
|
||||
RimSummaryCrossPlot* summaryCrossPlot = dynamic_cast<RimSummaryCrossPlot*>(summaryPlot);
|
||||
if (summaryCrossPlot)
|
||||
{
|
||||
// Trigger update of curve collection (and summary toolbar in main window), as the visibility of combo boxes might
|
||||
// have been changed due to the updates in this function
|
||||
curveCollection->updateConnectedEditors();
|
||||
if (curveCollection)
|
||||
{
|
||||
curveCollection->updateConnectedEditors();
|
||||
}
|
||||
|
||||
RiuPlotMainWindow* mainPlotWindow = RiaApplication::instance()->mainPlotWindow();
|
||||
mainPlotWindow->updateSummaryPlotToolBar();
|
||||
@ -423,18 +598,38 @@ std::vector<RifSummaryReaderInterface*> RimSummaryPlotSourceStepping::summaryRea
|
||||
{
|
||||
std::vector<RifSummaryReaderInterface*> readers;
|
||||
RimSummaryCurveCollection* curveCollection = nullptr;
|
||||
this->firstAncestorOrThisOfTypeAsserted(curveCollection);
|
||||
this->firstAncestorOrThisOfType(curveCollection);
|
||||
|
||||
for (auto curve : curveCollection->curves())
|
||||
if (curveCollection)
|
||||
{
|
||||
if (isYAxisStepping() && curve->summaryCaseY())
|
||||
for (auto curve : curveCollection->curves())
|
||||
{
|
||||
readers.push_back(curve->summaryCaseY()->summaryReader());
|
||||
}
|
||||
if (isYAxisStepping() && curve->summaryCaseY())
|
||||
{
|
||||
readers.push_back(curve->summaryCaseY()->summaryReader());
|
||||
}
|
||||
|
||||
if (isXAxisStepping() && curve->summaryCaseX())
|
||||
if (isXAxisStepping() && curve->summaryCaseX())
|
||||
{
|
||||
readers.push_back(curve->summaryCaseX()->summaryReader());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RimEnsembleCurveSetCollection* ensembleCollection = nullptr;
|
||||
this->firstAncestorOrThisOfType(ensembleCollection);
|
||||
if (ensembleCollection)
|
||||
{
|
||||
auto curveSets = ensembleCollection->curveSets();
|
||||
for (const RimEnsembleCurveSet* curveSet : curveSets)
|
||||
{
|
||||
readers.push_back(curve->summaryCaseX()->summaryReader());
|
||||
for (auto curve : curveSet->curves())
|
||||
{
|
||||
if (isYAxisStepping() && curve->summaryCaseY())
|
||||
{
|
||||
readers.push_back(curve->summaryCaseY()->summaryReader());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -477,19 +672,31 @@ std::set<RifEclipseSummaryAddress> RimSummaryPlotSourceStepping::addressesCurveC
|
||||
RimSummaryCurveCollection* curveCollection = nullptr;
|
||||
this->firstAncestorOrThisOfType(curveCollection);
|
||||
|
||||
if (!curveCollection) return addresses;
|
||||
|
||||
auto curves = curveCollection->curves();
|
||||
for (auto c : curves)
|
||||
if (curveCollection)
|
||||
{
|
||||
if (isYAxisStepping())
|
||||
auto curves = curveCollection->curvesForSourceStepping();
|
||||
for (auto c : curves)
|
||||
{
|
||||
addresses.insert(c->summaryAddressY());
|
||||
}
|
||||
if (isYAxisStepping())
|
||||
{
|
||||
addresses.insert(c->summaryAddressY());
|
||||
}
|
||||
|
||||
if (isXAxisStepping())
|
||||
if (isXAxisStepping())
|
||||
{
|
||||
addresses.insert(c->summaryAddressX());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RimEnsembleCurveSetCollection* ensembleCollection = nullptr;
|
||||
this->firstAncestorOrThisOfType(ensembleCollection);
|
||||
if (ensembleCollection)
|
||||
{
|
||||
auto curveSets = ensembleCollection->curveSetsForSourceStepping();
|
||||
for (const RimEnsembleCurveSet* curveSet : curveSets)
|
||||
{
|
||||
addresses.insert(c->summaryAddressX());
|
||||
addresses.insert(curveSet->summaryAddress());
|
||||
}
|
||||
}
|
||||
|
||||
@ -535,6 +742,7 @@ std::vector<caf::PdmFieldHandle*> RimSummaryPlotSourceStepping::computeVisibleFi
|
||||
m_wellGroupName.uiCapability()->setUiHidden(true);
|
||||
m_region.uiCapability()->setUiHidden(true);
|
||||
m_quantity.uiCapability()->setUiHidden(true);
|
||||
m_ensemble.uiCapability()->setUiHidden(true);
|
||||
|
||||
std::vector<caf::PdmFieldHandle*> fields;
|
||||
|
||||
@ -552,58 +760,103 @@ std::vector<caf::PdmFieldHandle*> RimSummaryPlotSourceStepping::computeVisibleFi
|
||||
}
|
||||
}
|
||||
|
||||
RiaSummaryCurveAnalyzer analyzer;
|
||||
analyzer.appendAdresses(addressesCurveCollection());
|
||||
|
||||
RifEclipseSummaryAddress::SummaryVarCategory category = RifEclipseSummaryAddress::SUMMARY_INVALID;
|
||||
auto ensembleColl = ensembleCollection();
|
||||
if (ensembleColl.size() == 1)
|
||||
{
|
||||
if (analyzer.categories().size() == 1)
|
||||
RimProject* proj = RiaApplication::instance()->project();
|
||||
|
||||
if (proj->summaryGroups().size() > 1)
|
||||
{
|
||||
category = *(analyzer.categories().begin());
|
||||
m_ensemble = *(ensembleColl.begin());
|
||||
|
||||
m_ensemble.uiCapability()->setUiHidden(false);
|
||||
|
||||
fields.push_back(&m_ensemble);
|
||||
}
|
||||
}
|
||||
|
||||
if (category != RifEclipseSummaryAddress::SUMMARY_INVALID)
|
||||
std::vector<caf::PdmFieldHandle*> fieldsCommonForAllCurves;
|
||||
|
||||
{
|
||||
if (analyzer.wellNames().size() == 1)
|
||||
{
|
||||
QString txt = QString::fromStdString(*(analyzer.wellNames().begin()));
|
||||
m_wellName = txt;
|
||||
m_wellName.uiCapability()->setUiHidden(false);
|
||||
RiaSummaryCurveAnalyzer analyzer;
|
||||
analyzer.appendAdresses(addressesCurveCollection());
|
||||
|
||||
fields.push_back(&m_wellName);
|
||||
RifEclipseSummaryAddress::SummaryVarCategory category = RifEclipseSummaryAddress::SUMMARY_INVALID;
|
||||
{
|
||||
if (analyzer.categories().size() == 1)
|
||||
{
|
||||
category = *(analyzer.categories().begin());
|
||||
}
|
||||
}
|
||||
|
||||
if (analyzer.wellGroupNames().size() == 1)
|
||||
if (category != RifEclipseSummaryAddress::SUMMARY_INVALID)
|
||||
{
|
||||
QString txt = QString::fromStdString(*(analyzer.wellGroupNames().begin()));
|
||||
m_wellGroupName = txt;
|
||||
m_wellGroupName.uiCapability()->setUiHidden(false);
|
||||
if (analyzer.wellNames().size() == 1)
|
||||
{
|
||||
QString txt = QString::fromStdString(*(analyzer.wellNames().begin()));
|
||||
m_wellName = txt;
|
||||
m_wellName.uiCapability()->setUiHidden(false);
|
||||
|
||||
fields.push_back(&m_wellGroupName);
|
||||
fieldsCommonForAllCurves.push_back(&m_wellName);
|
||||
}
|
||||
|
||||
if (analyzer.wellGroupNames().size() == 1)
|
||||
{
|
||||
QString txt = QString::fromStdString(*(analyzer.wellGroupNames().begin()));
|
||||
m_wellGroupName = txt;
|
||||
m_wellGroupName.uiCapability()->setUiHidden(false);
|
||||
|
||||
fieldsCommonForAllCurves.push_back(&m_wellGroupName);
|
||||
}
|
||||
|
||||
if (analyzer.regionNumbers().size() == 1)
|
||||
{
|
||||
m_region = *(analyzer.regionNumbers().begin());
|
||||
m_region.uiCapability()->setUiHidden(false);
|
||||
|
||||
fieldsCommonForAllCurves.push_back(&m_region);
|
||||
}
|
||||
|
||||
if (!analyzer.quantityNameForTitle().empty())
|
||||
{
|
||||
QString txt = QString::fromStdString(analyzer.quantityNameForTitle());
|
||||
m_quantity = txt;
|
||||
m_quantity.uiCapability()->setUiHidden(false);
|
||||
|
||||
fieldsCommonForAllCurves.push_back(&m_quantity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (analyzer.regionNumbers().size() == 1)
|
||||
{
|
||||
m_region = *(analyzer.regionNumbers().begin());
|
||||
m_region.uiCapability()->setUiHidden(false);
|
||||
|
||||
fields.push_back(&m_region);
|
||||
}
|
||||
|
||||
if (analyzer.quantities().size() == 1)
|
||||
{
|
||||
QString txt = QString::fromStdString(*(analyzer.quantities().begin()));
|
||||
m_quantity = txt;
|
||||
m_quantity.uiCapability()->setUiHidden(false);
|
||||
|
||||
fields.push_back(&m_quantity);
|
||||
}
|
||||
for (const auto& f : fieldsCommonForAllCurves)
|
||||
{
|
||||
fields.push_back(f);
|
||||
}
|
||||
|
||||
return fields;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::set<RimSummaryCaseCollection*> RimSummaryPlotSourceStepping::ensembleCollection() const
|
||||
{
|
||||
std::set<RimSummaryCaseCollection*> sumCases;
|
||||
|
||||
RimEnsembleCurveSetCollection* curveCollection = nullptr;
|
||||
this->firstAncestorOrThisOfType(curveCollection);
|
||||
|
||||
if (!curveCollection) return sumCases;
|
||||
|
||||
auto curves = curveCollection->curveSets();
|
||||
for (auto c : curves)
|
||||
{
|
||||
sumCases.insert(c->summaryCaseCollection());
|
||||
}
|
||||
|
||||
return sumCases;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -656,6 +909,78 @@ void RimSummaryPlotSourceStepping::modifyCurrentIndex(caf::PdmValueField* valueF
|
||||
RimDataSourceSteppingTools::modifyCurrentIndex(valueField, options, indexOffset);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryPlotSourceStepping::updateCurveYAddressIfMatching(const std::string& oldQuantity,
|
||||
const std::string& newQuantity,
|
||||
RimSummaryCurve* curve)
|
||||
{
|
||||
if (!curve) return;
|
||||
|
||||
auto curveAdr = curve->summaryAddressY();
|
||||
|
||||
if (curveAdr.quantityName() == oldQuantity)
|
||||
{
|
||||
curveAdr.setQuantityName(newQuantity);
|
||||
curve->setSummaryAddressY(curveAdr);
|
||||
}
|
||||
|
||||
if (curveAdr.quantityName() == (oldQuantity + "H"))
|
||||
{
|
||||
curveAdr.setQuantityName(newQuantity + "H");
|
||||
curve->setSummaryAddressY(curveAdr);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryPlotSourceStepping::updateCurveXAddressIfMatching(const std::string& oldQuantity,
|
||||
const std::string& newQuantity,
|
||||
RimSummaryCurve* curve)
|
||||
{
|
||||
if (!curve) return;
|
||||
|
||||
auto curveAdr = curve->summaryAddressX();
|
||||
|
||||
if (curveAdr.quantityName() == oldQuantity)
|
||||
{
|
||||
curveAdr.setQuantityName(newQuantity);
|
||||
curve->setSummaryAddressX(curveAdr);
|
||||
}
|
||||
|
||||
if (curveAdr.quantityName() == (oldQuantity + "H"))
|
||||
{
|
||||
curveAdr.setQuantityName(newQuantity + "H");
|
||||
curve->setSummaryAddressX(curveAdr);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimSummaryPlotSourceStepping::updateAddressIfMatching(const std::string& oldQuantity,
|
||||
const std::string& newQuantity,
|
||||
RifEclipseSummaryAddress& curveAdr)
|
||||
{
|
||||
if (curveAdr.quantityName() == oldQuantity)
|
||||
{
|
||||
curveAdr.setQuantityName(newQuantity);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (curveAdr.quantityName() == (oldQuantity + "H"))
|
||||
{
|
||||
curveAdr.setQuantityName(newQuantity + "H");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -31,7 +31,9 @@
|
||||
#include <set>
|
||||
|
||||
class RimSummaryCase;
|
||||
class RimSummaryCurve;
|
||||
class RifSummaryReaderInterface;
|
||||
class RimSummaryCaseCollection;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
@ -56,6 +58,9 @@ public:
|
||||
void applyNextCase();
|
||||
void applyPrevCase();
|
||||
|
||||
void applyNextEnsemble();
|
||||
void applyPrevEnsemble();
|
||||
|
||||
void applyNextQuantity();
|
||||
void applyPrevQuantity();
|
||||
|
||||
@ -83,6 +88,7 @@ private:
|
||||
std::set<RifEclipseSummaryAddress> addressesCurveCollection() const;
|
||||
std::set<RimSummaryCase*> summaryCasesCurveCollection() const;
|
||||
std::vector<caf::PdmFieldHandle*> computeVisibleFieldsAndSetFieldVisibility();
|
||||
std::set<RimSummaryCaseCollection*> ensembleCollection() const;
|
||||
|
||||
bool isXAxisStepping() const;
|
||||
bool isYAxisStepping() const;
|
||||
@ -91,8 +97,19 @@ private:
|
||||
|
||||
void modifyCurrentIndex(caf::PdmValueField* valueField, int indexOffset);
|
||||
|
||||
static void
|
||||
updateCurveYAddressIfMatching(const std::string& oldQuantity, const std::string& newQuantity, RimSummaryCurve* curve);
|
||||
|
||||
static void
|
||||
updateCurveXAddressIfMatching(const std::string& oldQuantity, const std::string& newQuantity, RimSummaryCurve* curve);
|
||||
|
||||
static bool
|
||||
updateAddressIfMatching(const std::string& oldQuantity, const std::string& newQuantity, RifEclipseSummaryAddress& adr);
|
||||
|
||||
private:
|
||||
caf::PdmPtrField<RimSummaryCase*> m_summaryCase;
|
||||
caf::PdmPtrField<RimSummaryCaseCollection*> m_ensemble;
|
||||
|
||||
caf::PdmField<QString> m_wellName;
|
||||
caf::PdmField<QString> m_wellGroupName;
|
||||
caf::PdmField<int> m_region;
|
||||
|
Loading…
Reference in New Issue
Block a user