2017-11-23 02:15:29 -06:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// 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.
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2017-11-29 03:35:52 -06:00
|
|
|
#include "RimSummaryPlotSourceStepping.h"
|
2017-11-23 02:15:29 -06:00
|
|
|
|
2017-11-24 08:17:20 -06:00
|
|
|
#include "RiaApplication.h"
|
|
|
|
#include "RiaSummaryCurveAnalyzer.h"
|
2017-11-23 02:15:29 -06:00
|
|
|
#include "RiaSummaryCurveDefinition.h"
|
|
|
|
|
2017-11-24 08:17:20 -06:00
|
|
|
#include "RifSummaryReaderInterface.h"
|
|
|
|
|
|
|
|
#include "RimOilField.h"
|
|
|
|
#include "RimProject.h"
|
2017-11-23 02:15:29 -06:00
|
|
|
#include "RimSummaryCase.h"
|
2017-11-24 08:17:20 -06:00
|
|
|
#include "RimSummaryCaseMainCollection.h"
|
2017-11-23 02:15:29 -06:00
|
|
|
#include "RimSummaryCurve.h"
|
|
|
|
#include "RimSummaryCurveCollection.h"
|
|
|
|
#include "RimSummaryPlot.h"
|
|
|
|
|
|
|
|
#include "cafPdmUiItem.h"
|
|
|
|
#include "cafPdmUiListEditor.h"
|
|
|
|
|
2017-11-29 03:35:52 -06:00
|
|
|
CAF_PDM_SOURCE_INIT(RimSummaryPlotSourceStepping, "RimSummaryCurveCollectionModifier");
|
2017-11-23 02:15:29 -06:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2017-11-29 03:35:52 -06:00
|
|
|
RimSummaryPlotSourceStepping::RimSummaryPlotSourceStepping()
|
2017-11-23 02:15:29 -06:00
|
|
|
{
|
|
|
|
// clang-format off
|
|
|
|
CAF_PDM_InitObject("Summary Curves Modifier", "", "", "");
|
|
|
|
|
2017-11-24 08:17:20 -06:00
|
|
|
CAF_PDM_InitFieldNoDefault(&m_summaryCase, "CurveCase", "Case", "", "", "");
|
|
|
|
CAF_PDM_InitFieldNoDefault(&m_quantity, "Quantities", "Quantity", "", "", "");
|
|
|
|
CAF_PDM_InitFieldNoDefault(&m_wellName, "WellName", "Well Name", "", "", "");
|
|
|
|
CAF_PDM_InitFieldNoDefault(&m_wellGroupName, "GroupName", "Group Name", "", "", "");
|
|
|
|
CAF_PDM_InitFieldNoDefault(&m_region, "Region", "Region", "", "", "");
|
2017-11-23 02:15:29 -06:00
|
|
|
|
2017-11-24 08:17:20 -06:00
|
|
|
CAF_PDM_InitFieldNoDefault(&m_wellNameProxy, "WellNameProxy", "WellNameProxy", "", "", "");
|
2017-11-29 03:35:52 -06:00
|
|
|
m_wellNameProxy.registerGetMethod(this, &RimSummaryPlotSourceStepping::wellName);
|
|
|
|
m_wellNameProxy.registerSetMethod(this, &RimSummaryPlotSourceStepping::setWellName);
|
2017-11-23 02:15:29 -06:00
|
|
|
m_wellNameProxy.uiCapability()->setUiEditorTypeName(caf::PdmUiListEditor::uiEditorTypeName());
|
2017-11-24 08:17:20 -06:00
|
|
|
m_wellNameProxy.uiCapability()->setUiHidden(true);
|
2017-11-23 02:15:29 -06:00
|
|
|
// clang-format on
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2017-11-29 03:35:52 -06:00
|
|
|
void RimSummaryPlotSourceStepping::applyNextIdentifier()
|
2017-11-23 02:15:29 -06:00
|
|
|
{
|
2017-11-24 11:13:43 -06:00
|
|
|
updateUiFromCurves();
|
2017-11-24 08:17:20 -06:00
|
|
|
|
2017-11-24 11:23:41 -06:00
|
|
|
caf::PdmValueField* valueField = valueFieldToModify();
|
2017-11-24 11:13:43 -06:00
|
|
|
if (valueField)
|
2017-11-23 02:15:29 -06:00
|
|
|
{
|
2017-11-24 11:13:43 -06:00
|
|
|
bool useOptionsOnly = true;
|
|
|
|
QList<caf::PdmOptionItemInfo> options = calculateValueOptions(valueField, nullptr);
|
|
|
|
if (options.isEmpty())
|
2017-11-23 02:15:29 -06:00
|
|
|
{
|
2017-11-24 11:13:43 -06:00
|
|
|
return;
|
2017-11-23 02:15:29 -06:00
|
|
|
}
|
|
|
|
|
2017-11-24 11:13:43 -06:00
|
|
|
auto uiVariant = valueField->uiCapability()->toUiBasedQVariant();
|
2017-11-24 08:17:20 -06:00
|
|
|
|
2017-11-24 11:13:43 -06:00
|
|
|
int currentIndex = -1;
|
|
|
|
for (int i = 0; i < options.size(); i++)
|
2017-11-24 08:17:20 -06:00
|
|
|
{
|
2017-11-24 11:13:43 -06:00
|
|
|
if (uiVariant == options[i].optionUiText())
|
|
|
|
{
|
|
|
|
currentIndex = i;
|
|
|
|
}
|
2017-11-24 08:17:20 -06:00
|
|
|
}
|
|
|
|
|
2017-11-24 11:23:41 -06:00
|
|
|
if (currentIndex == -1)
|
2017-11-24 08:17:20 -06:00
|
|
|
{
|
2017-11-24 11:23:41 -06:00
|
|
|
currentIndex = 0;
|
|
|
|
}
|
2017-11-24 11:13:43 -06:00
|
|
|
|
2017-11-24 11:23:41 -06:00
|
|
|
int nextIndex = currentIndex + 1;
|
|
|
|
if (nextIndex >= options.size() - 1)
|
|
|
|
{
|
|
|
|
nextIndex = 0;
|
|
|
|
}
|
2017-11-24 11:13:43 -06:00
|
|
|
|
2017-11-24 11:23:41 -06:00
|
|
|
auto optionValue = options[nextIndex].value();
|
2017-11-24 11:13:43 -06:00
|
|
|
|
2017-11-24 11:23:41 -06:00
|
|
|
QVariant currentValue = valueField->toQVariant();
|
2017-11-24 11:13:43 -06:00
|
|
|
|
2017-11-24 11:23:41 -06:00
|
|
|
valueField->setFromQVariant(optionValue);
|
|
|
|
|
|
|
|
valueField->uiCapability()->notifyFieldChanged(currentValue, optionValue);
|
2017-11-24 11:13:43 -06:00
|
|
|
}
|
|
|
|
}
|
2017-11-24 08:17:20 -06:00
|
|
|
|
2017-11-24 11:13:43 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2017-11-29 03:35:52 -06:00
|
|
|
void RimSummaryPlotSourceStepping::applyPreviousIdentifier()
|
2017-11-24 11:13:43 -06:00
|
|
|
{
|
|
|
|
updateUiFromCurves();
|
|
|
|
|
2017-11-24 11:23:41 -06:00
|
|
|
caf::PdmValueField* valueField = valueFieldToModify();
|
2017-11-24 11:13:43 -06:00
|
|
|
if (valueField)
|
|
|
|
{
|
|
|
|
bool useOptionsOnly = true;
|
|
|
|
QList<caf::PdmOptionItemInfo> options = calculateValueOptions(valueField, nullptr);
|
|
|
|
if (options.isEmpty())
|
2017-11-24 08:17:20 -06:00
|
|
|
{
|
2017-11-24 11:13:43 -06:00
|
|
|
return;
|
2017-11-24 08:17:20 -06:00
|
|
|
}
|
|
|
|
|
2017-11-24 11:13:43 -06:00
|
|
|
auto uiVariant = valueField->uiCapability()->toUiBasedQVariant();
|
|
|
|
|
|
|
|
int currentIndex = -1;
|
|
|
|
for (int i = 0; i < options.size(); i++)
|
2017-11-24 08:17:20 -06:00
|
|
|
{
|
2017-11-24 11:13:43 -06:00
|
|
|
if (uiVariant == options[i].optionUiText())
|
|
|
|
{
|
|
|
|
currentIndex = i;
|
|
|
|
}
|
2017-11-24 08:17:20 -06:00
|
|
|
}
|
|
|
|
|
2017-11-24 11:23:41 -06:00
|
|
|
if (currentIndex == -1)
|
2017-11-24 08:17:20 -06:00
|
|
|
{
|
2017-11-24 11:23:41 -06:00
|
|
|
currentIndex = 0;
|
|
|
|
}
|
2017-11-24 11:13:43 -06:00
|
|
|
|
2017-11-24 11:23:41 -06:00
|
|
|
int nextIndex = currentIndex - 1;
|
|
|
|
if (nextIndex < 0)
|
|
|
|
{
|
|
|
|
nextIndex = options.size() - 1;
|
|
|
|
}
|
2017-11-24 11:13:43 -06:00
|
|
|
|
2017-11-24 11:23:41 -06:00
|
|
|
auto optionValue = options[nextIndex].value();
|
2017-11-24 11:13:43 -06:00
|
|
|
|
2017-11-24 11:23:41 -06:00
|
|
|
QVariant currentValue = valueField->toQVariant();
|
2017-11-24 11:13:43 -06:00
|
|
|
|
2017-11-24 11:23:41 -06:00
|
|
|
valueField->setFromQVariant(optionValue);
|
|
|
|
|
|
|
|
valueField->uiCapability()->notifyFieldChanged(currentValue, optionValue);
|
2017-11-24 08:17:20 -06:00
|
|
|
}
|
2017-11-23 02:15:29 -06:00
|
|
|
}
|
|
|
|
|
2017-11-24 11:13:43 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2017-11-29 03:35:52 -06:00
|
|
|
void RimSummaryPlotSourceStepping::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
2017-11-24 11:13:43 -06:00
|
|
|
{
|
|
|
|
updateUiFromCurves();
|
|
|
|
}
|
|
|
|
|
2017-11-23 02:15:29 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2017-11-29 03:35:52 -06:00
|
|
|
QList<caf::PdmOptionItemInfo> RimSummaryPlotSourceStepping::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions,
|
2017-11-23 02:15:29 -06:00
|
|
|
bool* useOptionsOnly)
|
|
|
|
{
|
2017-11-24 08:17:20 -06:00
|
|
|
if (fieldNeedingOptions == &m_summaryCase)
|
|
|
|
{
|
|
|
|
QList<caf::PdmOptionItemInfo> options;
|
|
|
|
|
|
|
|
RimProject* proj = RiaApplication::instance()->project();
|
|
|
|
|
|
|
|
RimSummaryCaseMainCollection* sumCaseColl =
|
|
|
|
proj->activeOilField() ? proj->activeOilField()->summaryCaseMainCollection() : nullptr;
|
|
|
|
if (sumCaseColl)
|
|
|
|
{
|
|
|
|
for (auto sumCase : sumCaseColl->allSummaryCases())
|
|
|
|
{
|
|
|
|
options.append(caf::PdmOptionItemInfo(sumCase->caseName(), sumCase));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return options;
|
|
|
|
}
|
|
|
|
|
2017-11-23 02:15:29 -06:00
|
|
|
std::set<QString> identifierTexts;
|
|
|
|
|
|
|
|
RifSummaryReaderInterface* reader = summaryReader();
|
2017-11-23 07:12:05 -06:00
|
|
|
if (reader)
|
2017-11-23 02:15:29 -06:00
|
|
|
{
|
2017-11-23 07:12:05 -06:00
|
|
|
const std::vector<RifEclipseSummaryAddress> allAddresses = reader->allResultAddresses();
|
|
|
|
|
2017-11-24 08:17:20 -06:00
|
|
|
RiaSummaryCurveAnalyzer analyzer;
|
|
|
|
analyzer.analyzeAdresses(allAddresses);
|
|
|
|
|
2017-11-23 02:15:29 -06:00
|
|
|
if (fieldNeedingOptions == &m_wellName || fieldNeedingOptions == &m_wellNameProxy)
|
|
|
|
{
|
2017-11-24 08:17:20 -06:00
|
|
|
identifierTexts = analyzer.identifierTexts(RifEclipseSummaryAddress::SUMMARY_WELL);
|
2017-11-23 02:15:29 -06:00
|
|
|
}
|
|
|
|
else if (fieldNeedingOptions == &m_region)
|
|
|
|
{
|
2017-11-24 08:17:20 -06:00
|
|
|
identifierTexts = analyzer.identifierTexts(RifEclipseSummaryAddress::SUMMARY_REGION);
|
|
|
|
}
|
|
|
|
else if (fieldNeedingOptions == &m_wellGroupName)
|
|
|
|
{
|
|
|
|
identifierTexts = analyzer.identifierTexts(RifEclipseSummaryAddress::SUMMARY_WELL_GROUP);
|
2017-11-23 02:15:29 -06:00
|
|
|
}
|
2017-11-24 08:17:20 -06:00
|
|
|
else if (fieldNeedingOptions == &m_quantity)
|
2017-11-23 02:15:29 -06:00
|
|
|
{
|
2017-11-24 08:17:20 -06:00
|
|
|
RimSummaryCurveCollection* curveCollection = nullptr;
|
|
|
|
this->firstAncestorOrThisOfTypeAsserted(curveCollection);
|
|
|
|
|
|
|
|
RifEclipseSummaryAddress::SummaryVarCategory category = RifEclipseSummaryAddress::SUMMARY_FIELD;
|
|
|
|
|
|
|
|
if (curveCollection->curves().size() > 0)
|
|
|
|
{
|
|
|
|
category = curveCollection->curves()[0]->summaryAddressY().category();
|
|
|
|
}
|
|
|
|
|
|
|
|
RiaSummaryCurveAnalyzer quantityAnalyzer;
|
|
|
|
|
|
|
|
auto subset = RiaSummaryCurveAnalyzer::addressesForCategory(allAddresses, category);
|
|
|
|
quantityAnalyzer.analyzeAdresses(subset);
|
|
|
|
|
|
|
|
for (const auto& quantity : quantityAnalyzer.quantities())
|
|
|
|
{
|
|
|
|
identifierTexts.insert(QString::fromStdString(quantity));
|
|
|
|
}
|
2017-11-23 02:15:29 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
QList<caf::PdmOptionItemInfo> options;
|
|
|
|
if (identifierTexts.size() > 0)
|
|
|
|
{
|
|
|
|
for (const auto& text : identifierTexts)
|
|
|
|
{
|
|
|
|
options.append(caf::PdmOptionItemInfo(text, text));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
options.push_back(caf::PdmOptionItemInfo("None", "None"));
|
|
|
|
}
|
|
|
|
|
|
|
|
return options;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2017-11-29 03:35:52 -06:00
|
|
|
void RimSummaryPlotSourceStepping::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue,
|
2017-11-23 02:15:29 -06:00
|
|
|
const QVariant& newValue)
|
|
|
|
{
|
|
|
|
RimSummaryCurveCollection* curveCollection = nullptr;
|
|
|
|
this->firstAncestorOrThisOfTypeAsserted(curveCollection);
|
|
|
|
|
|
|
|
bool triggerLoadDataAndUpdate = false;
|
2017-11-24 08:17:20 -06:00
|
|
|
|
|
|
|
if (changedField == &m_summaryCase)
|
|
|
|
{
|
|
|
|
if (m_summaryCase())
|
|
|
|
{
|
|
|
|
for (auto curve : curveCollection->curves())
|
|
|
|
{
|
|
|
|
curve->setSummaryCaseY(m_summaryCase);
|
|
|
|
}
|
|
|
|
|
|
|
|
triggerLoadDataAndUpdate = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (changedField == &m_wellName || changedField == &m_wellNameProxy)
|
2017-11-23 02:15:29 -06:00
|
|
|
{
|
|
|
|
for (auto curve : curveCollection->curves())
|
|
|
|
{
|
|
|
|
RifEclipseSummaryAddress adr = curve->summaryAddressY();
|
2017-11-23 07:12:05 -06:00
|
|
|
if (adr.category() == RifEclipseSummaryAddress::SUMMARY_WELL)
|
|
|
|
{
|
|
|
|
adr.setWellName(m_wellName().toStdString());
|
2017-11-23 02:15:29 -06:00
|
|
|
|
2017-11-23 07:12:05 -06:00
|
|
|
curve->setSummaryAddressY(adr);
|
|
|
|
}
|
2017-11-23 02:15:29 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
triggerLoadDataAndUpdate = true;
|
|
|
|
}
|
|
|
|
else if (changedField == &m_region)
|
|
|
|
{
|
|
|
|
for (auto curve : curveCollection->curves())
|
|
|
|
{
|
|
|
|
RifEclipseSummaryAddress adr = curve->summaryAddressY();
|
2017-11-23 07:12:05 -06:00
|
|
|
if (adr.category() == RifEclipseSummaryAddress::SUMMARY_REGION)
|
|
|
|
{
|
|
|
|
adr.setRegion(m_region());
|
2017-11-23 02:15:29 -06:00
|
|
|
|
2017-11-23 07:12:05 -06:00
|
|
|
curve->setSummaryAddressY(adr);
|
|
|
|
}
|
2017-11-23 02:15:29 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
triggerLoadDataAndUpdate = true;
|
|
|
|
}
|
2017-11-24 08:17:20 -06:00
|
|
|
else if (changedField == &m_quantity)
|
|
|
|
{
|
|
|
|
for (auto curve : curveCollection->curves())
|
|
|
|
{
|
|
|
|
RifEclipseSummaryAddress adr = curve->summaryAddressY();
|
|
|
|
adr.setQuantityName(m_quantity().toStdString());
|
|
|
|
curve->setSummaryAddressY(adr);
|
|
|
|
}
|
|
|
|
|
|
|
|
triggerLoadDataAndUpdate = true;
|
|
|
|
}
|
|
|
|
else if (changedField == &m_wellGroupName)
|
2017-11-23 02:15:29 -06:00
|
|
|
{
|
|
|
|
for (auto curve : curveCollection->curves())
|
|
|
|
{
|
|
|
|
RifEclipseSummaryAddress adr = curve->summaryAddressY();
|
2017-11-23 07:12:05 -06:00
|
|
|
if (adr.category() == RifEclipseSummaryAddress::SUMMARY_WELL_GROUP)
|
|
|
|
{
|
2017-11-24 08:17:20 -06:00
|
|
|
adr.setWellGroupName(m_wellGroupName().toStdString());
|
2017-11-23 02:15:29 -06:00
|
|
|
|
2017-11-23 07:12:05 -06:00
|
|
|
curve->setSummaryAddressY(adr);
|
|
|
|
}
|
2017-11-23 02:15:29 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
triggerLoadDataAndUpdate = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (triggerLoadDataAndUpdate)
|
|
|
|
{
|
|
|
|
RimSummaryPlot* summaryPlot = nullptr;
|
|
|
|
this->firstAncestorOrThisOfTypeAsserted(summaryPlot);
|
2017-11-23 07:12:05 -06:00
|
|
|
|
|
|
|
summaryPlot->updatePlotTitle();
|
|
|
|
|
2017-11-23 02:15:29 -06:00
|
|
|
summaryPlot->loadDataAndUpdate();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2017-11-29 03:35:52 -06:00
|
|
|
RifSummaryReaderInterface* RimSummaryPlotSourceStepping::summaryReader() const
|
2017-11-24 08:17:20 -06:00
|
|
|
{
|
|
|
|
RimSummaryCase* sumCase = singleSummaryCase();
|
|
|
|
if (sumCase)
|
|
|
|
{
|
|
|
|
return sumCase->summaryReader();
|
|
|
|
}
|
|
|
|
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2017-11-29 03:35:52 -06:00
|
|
|
RimSummaryCase* RimSummaryPlotSourceStepping::singleSummaryCase() const
|
2017-11-23 02:15:29 -06:00
|
|
|
{
|
|
|
|
RimSummaryCurveCollection* curveCollection = nullptr;
|
|
|
|
this->firstAncestorOrThisOfTypeAsserted(curveCollection);
|
|
|
|
|
2017-11-24 08:17:20 -06:00
|
|
|
std::set<RimSummaryCase*> cases;
|
2017-11-23 02:15:29 -06:00
|
|
|
for (auto curve : curveCollection->curves())
|
|
|
|
{
|
2017-11-24 08:17:20 -06:00
|
|
|
cases.insert(curve->summaryCaseY());
|
2017-11-23 02:15:29 -06:00
|
|
|
}
|
|
|
|
|
2017-11-24 08:17:20 -06:00
|
|
|
if (cases.size() == 1)
|
|
|
|
{
|
|
|
|
return *(cases.begin());
|
|
|
|
}
|
2017-11-23 02:15:29 -06:00
|
|
|
|
2017-11-24 08:17:20 -06:00
|
|
|
return nullptr;
|
|
|
|
}
|
2017-11-23 02:15:29 -06:00
|
|
|
|
2017-11-24 08:17:20 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2017-11-29 03:35:52 -06:00
|
|
|
QString RimSummaryPlotSourceStepping::wellName() const
|
2017-11-24 08:17:20 -06:00
|
|
|
{
|
|
|
|
return m_wellName();
|
|
|
|
}
|
2017-11-23 02:15:29 -06:00
|
|
|
|
2017-11-24 08:17:20 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2017-11-29 03:35:52 -06:00
|
|
|
void RimSummaryPlotSourceStepping::setWellName(const QString& wellName)
|
2017-11-24 08:17:20 -06:00
|
|
|
{
|
|
|
|
m_wellName.setValueWithFieldChanged(wellName);
|
2017-11-23 02:15:29 -06:00
|
|
|
}
|
2017-11-24 11:13:43 -06:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2017-11-29 03:35:52 -06:00
|
|
|
void RimSummaryPlotSourceStepping::updateUiFromCurves()
|
2017-11-24 11:13:43 -06:00
|
|
|
{
|
|
|
|
m_summaryCase.uiCapability()->setUiHidden(true);
|
|
|
|
m_wellName.uiCapability()->setUiHidden(true);
|
|
|
|
m_wellGroupName.uiCapability()->setUiHidden(true);
|
|
|
|
m_region.uiCapability()->setUiHidden(true);
|
|
|
|
m_quantity.uiCapability()->setUiHidden(true);
|
|
|
|
|
|
|
|
RimSummaryCurveCollection* curveCollection = nullptr;
|
|
|
|
this->firstAncestorOrThisOfTypeAsserted(curveCollection);
|
|
|
|
|
|
|
|
RiaSummaryCurveAnalyzer analyzer;
|
|
|
|
analyzer.analyzeCurves(curveCollection);
|
|
|
|
|
|
|
|
if (analyzer.summaryCases().size() == 1)
|
|
|
|
{
|
|
|
|
m_summaryCase = *(analyzer.summaryCases().begin());
|
|
|
|
m_summaryCase.uiCapability()->setUiHidden(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
RifEclipseSummaryAddress::SummaryVarCategory category = RifEclipseSummaryAddress::SUMMARY_INVALID;
|
|
|
|
{
|
|
|
|
if (analyzer.categories().size() == 1)
|
|
|
|
{
|
|
|
|
category = *(analyzer.categories().begin());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (category != RifEclipseSummaryAddress::SUMMARY_INVALID)
|
|
|
|
{
|
|
|
|
if (analyzer.wellNames().size() == 1)
|
|
|
|
{
|
|
|
|
QString txt = QString::fromStdString(*(analyzer.wellNames().begin()));
|
|
|
|
m_wellName = txt;
|
|
|
|
m_wellName.uiCapability()->setUiHidden(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (analyzer.wellGroupNames().size() == 1)
|
|
|
|
{
|
|
|
|
QString txt = QString::fromStdString(*(analyzer.wellGroupNames().begin()));
|
|
|
|
m_wellGroupName = txt;
|
|
|
|
m_wellGroupName.uiCapability()->setUiHidden(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (analyzer.regionNumbers().size() == 1)
|
|
|
|
{
|
|
|
|
m_region = *(analyzer.regionNumbers().begin());
|
|
|
|
m_region.uiCapability()->setUiHidden(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (analyzer.quantities().size() == 1)
|
|
|
|
{
|
|
|
|
QString txt = QString::fromStdString(*(analyzer.quantities().begin()));
|
|
|
|
m_quantity = txt;
|
|
|
|
m_quantity.uiCapability()->setUiHidden(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2017-11-29 03:35:52 -06:00
|
|
|
caf::PdmFieldHandle* RimSummaryPlotSourceStepping::fieldToModify()
|
2017-11-24 11:13:43 -06:00
|
|
|
{
|
|
|
|
RimSummaryCurveCollection* curveCollection = nullptr;
|
|
|
|
this->firstAncestorOrThisOfTypeAsserted(curveCollection);
|
|
|
|
|
|
|
|
RiaSummaryCurveAnalyzer analyzer;
|
|
|
|
analyzer.analyzeCurves(curveCollection);
|
|
|
|
|
|
|
|
if (analyzer.wellNames().size() == 1)
|
|
|
|
{
|
|
|
|
return &m_wellName;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (analyzer.wellGroupNames().size() == 1)
|
|
|
|
{
|
|
|
|
return &m_wellName;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (analyzer.regionNumbers().size() == 1)
|
|
|
|
{
|
|
|
|
return &m_region;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (analyzer.quantities().size() == 1)
|
|
|
|
{
|
|
|
|
return &m_quantity;
|
|
|
|
}
|
|
|
|
|
2017-11-24 11:23:41 -06:00
|
|
|
// A pointer field is no a value field, so this must be improved
|
|
|
|
// to be able to step between summary cases
|
2017-11-24 11:13:43 -06:00
|
|
|
if (analyzer.summaryCases().size() == 1)
|
|
|
|
{
|
|
|
|
return &m_summaryCase;
|
|
|
|
}
|
|
|
|
|
|
|
|
return nullptr;
|
|
|
|
}
|
2017-11-24 11:23:41 -06:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2017-11-29 03:35:52 -06:00
|
|
|
caf::PdmValueField* RimSummaryPlotSourceStepping::valueFieldToModify()
|
2017-11-24 11:23:41 -06:00
|
|
|
{
|
|
|
|
// This will return a null pointer for summary case modifier
|
|
|
|
|
|
|
|
return dynamic_cast<caf::PdmValueField*>(fieldToModify());
|
|
|
|
}
|