#739 Added summary case classes. Use those from the summary curves. Made save/restore work again for the summary plots. File format for Summary stuff are changed.

This commit is contained in:
Jacob Støren
2016-05-31 13:42:27 +02:00
parent 5732b5008f
commit 40388b308b
23 changed files with 864 additions and 20 deletions

View File

@@ -80,6 +80,10 @@ ${CEE_CURRENT_LIST_DIR}RimGridCollection.h
${CEE_CURRENT_LIST_DIR}RimSummaryPlotCollection.h
${CEE_CURRENT_LIST_DIR}RimSummaryPlot.h
${CEE_CURRENT_LIST_DIR}RimSummaryCurve.h
${CEE_CURRENT_LIST_DIR}RimSummaryCase.h
${CEE_CURRENT_LIST_DIR}RimGridSummaryCase.cpp
${CEE_CURRENT_LIST_DIR}RimFileSummaryCase.cpp
${CEE_CURRENT_LIST_DIR}RimSummaryCaseCollection.h
${CEE_CURRENT_LIST_DIR}RimPlotCurve.h
)
@@ -160,6 +164,10 @@ ${CEE_CURRENT_LIST_DIR}RimGridCollection.cpp
${CEE_CURRENT_LIST_DIR}RimSummaryPlotCollection.cpp
${CEE_CURRENT_LIST_DIR}RimSummaryPlot.cpp
${CEE_CURRENT_LIST_DIR}RimSummaryCurve.cpp
${CEE_CURRENT_LIST_DIR}RimSummaryCase.cpp
${CEE_CURRENT_LIST_DIR}RimGridSummaryCase.cpp
${CEE_CURRENT_LIST_DIR}RimFileSummaryCase.cpp
${CEE_CURRENT_LIST_DIR}RimSummaryCaseCollection.cpp
${CEE_CURRENT_LIST_DIR}RimPlotCurve.cpp
)

View File

@@ -0,0 +1,61 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2016- 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.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RimFileSummaryCase.h"
//==================================================================================================
//
//
//
//==================================================================================================
CAF_PDM_SOURCE_INIT(RimFileSummaryCase,"FileSummaryCase");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimFileSummaryCase::RimFileSummaryCase()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimFileSummaryCase::~RimFileSummaryCase()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFileSummaryCase::setSummaryHeaderFilename(const QString& fileName)
{
m_summaryHeaderFilename = fileName;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimFileSummaryCase::summaryHeaderFilename() const
{
return m_summaryHeaderFilename();
}

View File

@@ -0,0 +1,43 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2016 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.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RimSummaryCase.h"
//==================================================================================================
//
//
//
//==================================================================================================
class RimFileSummaryCase: public RimSummaryCase
{
CAF_PDM_HEADER_INIT;
public:
RimFileSummaryCase();
virtual ~RimFileSummaryCase();
void setSummaryHeaderFilename(const QString& fileName);
virtual QString summaryHeaderFilename() const override;
private:
caf::PdmField<QString> m_summaryHeaderFilename;
};

View File

@@ -0,0 +1,71 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2016- 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.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RimGridSummaryCase.h"
#include "RimEclipseCase.h"
#include <QFileInfo>
#include "RigSummaryCaseData.h"
//==================================================================================================
//
//
//
//==================================================================================================
CAF_PDM_SOURCE_INIT(RimGridSummaryCase,"GridSummaryCase");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimGridSummaryCase::RimGridSummaryCase()
{
CAF_PDM_InitFieldNoDefault(&m_eclipseCase, "Associated3DCase", "Main View", "", "", "");
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimGridSummaryCase::~RimGridSummaryCase()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridSummaryCase::setAssociatedEclipseCase(RimEclipseCase* eclipseCase)
{
m_eclipseCase = eclipseCase;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimGridSummaryCase::summaryHeaderFilename() const
{
if (!m_eclipseCase()) return QString();
QFileInfo gridFileInfo(m_eclipseCase()->gridFileName());
QString possibleSumHeaderFileName = gridFileInfo.path() +"/"+ gridFileInfo.completeBaseName() + ".SMSPEC";
return possibleSumHeaderFileName;
}

View File

@@ -0,0 +1,44 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2016 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.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RimSummaryCase.h"
//==================================================================================================
//
//
//
//==================================================================================================
class RimGridSummaryCase: public RimSummaryCase
{
CAF_PDM_HEADER_INIT;
public:
RimGridSummaryCase();
virtual ~RimGridSummaryCase();
void setAssociatedEclipseCase(RimEclipseCase* eclipseCase);
RimEclipseCase* associatedEclipseCase() { return m_eclipseCase(); }
virtual QString summaryHeaderFilename() const override;
private:
caf::PdmPtrField<RimEclipseCase*> m_eclipseCase;
};

View File

@@ -23,6 +23,7 @@
#include "RimEclipseCaseCollection.h"
#include "RimWellPathCollection.h"
#include "RimGeoMechModels.h"
#include "RimSummaryCaseCollection.h"
CAF_PDM_SOURCE_INIT(RimOilField, "ResInsightOilField");
//--------------------------------------------------------------------------------------------------
@@ -35,9 +36,11 @@ RimOilField::RimOilField(void)
CAF_PDM_InitFieldNoDefault(&analysisModels, "AnalysisModels", "Grid Models", ":/GridModels.png", "", "");
CAF_PDM_InitFieldNoDefault(&geoMechModels, "GeoMechModels", "Geo Mech Models", ":/GridModels.png", "", "");
CAF_PDM_InitFieldNoDefault(&wellPathCollection, "WellPathCollection", "Well Paths", ":/WellCollection.png", "", "");
CAF_PDM_InitFieldNoDefault(&summaryCaseCollection,"SummaryCaseCollection","Summary Cases",":/GridModels.png","","");
analysisModels = new RimEclipseCaseCollection();
wellPathCollection = new RimWellPathCollection();
summaryCaseCollection = new RimSummaryCaseCollection();
}
//--------------------------------------------------------------------------------------------------
@@ -48,5 +51,6 @@ RimOilField::~RimOilField(void)
if (wellPathCollection()) delete wellPathCollection();
if (geoMechModels()) delete geoMechModels();
if (analysisModels()) delete analysisModels();
if (summaryCaseCollection()) delete summaryCaseCollection();
}

View File

@@ -28,7 +28,7 @@
class RimEclipseCaseCollection;
class RimGeoMechModels;
class RimWellPathCollection;
class RimSummaryCaseCollection;
//==================================================================================================
///
///
@@ -44,4 +44,5 @@ public:
caf::PdmChildField<RimEclipseCaseCollection*> analysisModels;
caf::PdmChildField<RimGeoMechModels*> geoMechModels;
caf::PdmChildField<RimWellPathCollection*> wellPathCollection;
caf::PdmChildField<RimSummaryCaseCollection*> summaryCaseCollection;
};

View File

@@ -56,6 +56,8 @@
#include <QDir>
#include <QMenu>
#include "RimGridSummaryCase.h"
#include "RimSummaryCaseCollection.h"
CAF_PDM_SOURCE_INIT(RimProject, "ResInsightProject");
@@ -471,6 +473,25 @@ void RimProject::allCases(std::vector<RimCase*>& cases)
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimProject::allSummaryCases(std::vector<RimSummaryCase*>& sumCases)
{
for (RimOilField* oilField: oilFields)
{
if(!oilField) continue;
RimSummaryCaseCollection* sumCaseColl = oilField->summaryCaseCollection();
if(sumCaseColl)
{
for (size_t scIdx = 0; scIdx < sumCaseColl->summaryCaseCount(); ++scIdx)
{
sumCases.push_back(sumCaseColl->summaryCase(scIdx));
}
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -38,6 +38,7 @@ class RimViewLinkerCollection;
class RimMainPlotCollection;
class RimOilField;
class RimScriptCollection;
class RimSummaryCase;
class RimView;
class RimWellPathImport;
@@ -82,6 +83,7 @@ public:
void assignIdToCaseGroup(RimIdenticalGridCaseGroup* caseGroup);
void allCases(std::vector<RimCase*>& cases);
void allSummaryCases(std::vector<RimSummaryCase*>& sumCases);
void allNotLinkedViews(std::vector<RimView*>& views);
void allVisibleViews(std::vector<RimView*>& views);

View File

@@ -0,0 +1,59 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2016- 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.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RimSummaryCase.h"
#include "RimEclipseCase.h"
#include "RigSummaryCaseData.h"
#include <QFileInfo>
CAF_PDM_ABSTRACT_SOURCE_INIT(RimSummaryCase,"SummaryCase");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimSummaryCase::RimSummaryCase()
{
CAF_PDM_InitObject("Summary Case",":/Cases16x16.png","","");
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimSummaryCase::~RimSummaryCase()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSummaryCase::loadCase()
{
if (m_summaryCaseData.isNull()) m_summaryCaseData = new RigSummaryCaseData(this->summaryHeaderFilename());
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimSummaryCase::caseName()
{
QFileInfo caseFileName(this->summaryHeaderFilename());
return caseFileName.completeBaseName();
}

View File

@@ -0,0 +1,52 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2016 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.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafPdmChildArrayField.h"
#include "cafPdmObject.h"
#include "cafPdmField.h"
#include "cvfObject.h"
#include "cafPdmPtrField.h"
class RimEclipseCase;
class RigSummaryCaseData;
//==================================================================================================
//
//
//
//==================================================================================================
class RimSummaryCase : public caf::PdmObject
{
CAF_PDM_HEADER_INIT;
public:
RimSummaryCase();
virtual ~RimSummaryCase();
QString caseName();
virtual QString summaryHeaderFilename() const = 0;
void loadCase();
RigSummaryCaseData* caseData() { return m_summaryCaseData.p(); }
protected:
cvf::ref<RigSummaryCaseData> m_summaryCaseData;
};

View File

@@ -0,0 +1,136 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2016- 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.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RimSummaryCaseCollection.h"
#include "RimSummaryCase.h"
#include "RimOilField.h"
#include "RimProject.h"
#include "RimEclipseResultCase.h"
#include "RimGridSummaryCase.h"
#include "RifEclipseSummaryTools.h"
#include <QDir>
CAF_PDM_SOURCE_INIT(RimSummaryCaseCollection,"SummaryCaseCollection");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimSummaryCaseCollection::RimSummaryCaseCollection()
{
CAF_PDM_InitObject("Summary Cases",":/Cases16x16.png","","");
CAF_PDM_InitFieldNoDefault(&m_cases,"SummaryCases","","","","");
m_cases.uiCapability()->setUiHidden(true);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimSummaryCaseCollection::~RimSummaryCaseCollection()
{
m_cases.deleteAllChildObjects();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSummaryCaseCollection::createSummaryCasesFromRelevantEclipseResultCases()
{
RimProject* proj = nullptr;
firstAnchestorOrThisOfType(proj);
if (proj)
{
std::vector<RimCase*> all3DCases;
proj->allCases(all3DCases);
for (RimCase* aCase: all3DCases)
{
RimEclipseResultCase* eclResCase = dynamic_cast<RimEclipseResultCase*>(aCase);
if (eclResCase)
{
// If we have no summary case corresponding to this eclipse case,
// try to create one.
bool isFound = false;
for (size_t scIdx = 0; scIdx < m_cases.size(); ++scIdx)
{
RimGridSummaryCase* grdSumCase = dynamic_cast<RimGridSummaryCase*>(m_cases[scIdx]);
if (grdSumCase)
{
if (grdSumCase->associatedEclipseCase() == eclResCase)
{
isFound = true;
break;
}
}
}
if (!isFound)
{
// Create new GridSummaryCase
createAndAddSummaryCaseFromEclipseResultCase(eclResCase);
}
}
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimSummaryCase* RimSummaryCaseCollection::summaryCase(size_t idx)
{
return m_cases[idx];
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
size_t RimSummaryCaseCollection::summaryCaseCount()
{
return m_cases.size();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSummaryCaseCollection::loadAllSummaryCaseData()
{
for (RimSummaryCase* sumCase: m_cases)
{
if (sumCase) sumCase->loadCase();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimGridSummaryCase* RimSummaryCaseCollection::createAndAddSummaryCaseFromEclipseResultCase(RimEclipseResultCase* eclResCase)
{
QString gridFileName = eclResCase->gridFileName();
if(RifEclipseSummaryTools::hasSummaryFiles(QDir::toNativeSeparators(gridFileName).toStdString()))
{
RimGridSummaryCase* newSumCase = new RimGridSummaryCase();
newSumCase->setAssociatedEclipseCase(eclResCase);
this->m_cases.push_back(newSumCase);
return newSumCase;
}
return nullptr;
}

View File

@@ -0,0 +1,45 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2016- 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.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafPdmChildArrayField.h"
#include "cafPdmObject.h"
class RimSummaryCase;
class RimGridSummaryCase;
class RimEclipseResultCase;
class RimSummaryCaseCollection : public caf::PdmObject
{
CAF_PDM_HEADER_INIT;
public:
RimSummaryCaseCollection();
virtual ~RimSummaryCaseCollection();
RimSummaryCase* summaryCase(size_t idx);
size_t summaryCaseCount();
void createSummaryCasesFromRelevantEclipseResultCases();
RimGridSummaryCase* createAndAddSummaryCaseFromEclipseResultCase(RimEclipseResultCase* eclResCase);
void loadAllSummaryCaseData();
private:
caf::PdmChildArrayField<RimSummaryCase*> m_cases;
};

View File

@@ -32,6 +32,30 @@
#include "cafPdmUiTreeOrdering.h"
#include "RiuLineSegmentQwtPlotCurve.h"
#include "qwt_date.h"
#include "RimSummaryCase.h"
#include "RigSummaryCaseData.h"
namespace caf
{
template<>
void caf::AppEnum<RifEclipseSummaryAddress::SummaryVarCategory>::setUp()
{
addItem(RifEclipseSummaryAddress::SUMMARY_WELL, "SUMMARY_WELL", "Well");
addItem(RifEclipseSummaryAddress::SUMMARY_WELL_COMPLETION, "SUMMARY_WELL_COMPLETION","Completion");
addItem(RifEclipseSummaryAddress::SUMMARY_GROUP, "SUMMARY_GROUP", "Group");
addItem(RifEclipseSummaryAddress::SUMMARY_FIELD, "SUMMARY_FIELD", "Field");
addItem(RifEclipseSummaryAddress::SUMMARY_REGION, "SUMMARY_REGION", "Region");
addItem(RifEclipseSummaryAddress::SUMMARY_MISC, "SUMMARY_MISC", "Misc");
addItem(RifEclipseSummaryAddress::SUMMARY_BLOCK, "SUMMARY_BLOCK", "Block");
addItem(RifEclipseSummaryAddress::SUMMARY_BLOCK_LGR, "SUMMARY_BLOCK_LGR", "LGR Block");
addItem(RifEclipseSummaryAddress::SUMMARY_AQUIFIER, "SUMMARY_AQUIFIER", "Aquifier");
addItem(RifEclipseSummaryAddress::SUMMARY_SEGMENT, "SUMMARY_SEGMENT", "Segment");
addItem(RifEclipseSummaryAddress::SUMMARY_SEGMENT_RIVER, "SUMMARY_SEGMENT_RIVER", "Segment River");
setDefault(RifEclipseSummaryAddress::SUMMARY_FIELD);
}
}
CAF_PDM_SOURCE_INIT(RimSummaryCurve, "SummaryCurve");
@@ -42,15 +66,28 @@ RimSummaryCurve::RimSummaryCurve()
{
CAF_PDM_InitObject("Summary Curve", ":/WellLogCurve16x16.png", "", "");
CAF_PDM_InitFieldNoDefault(&m_eclipseCase, "ReferencedEclipseCase", "Eclipse Case", "", "", "");
m_eclipseCase.uiCapability()->setUiChildrenHidden(true);
CAF_PDM_InitFieldNoDefault(&m_summaryCase, "SummaryCase", "Summary Case", "", "", "");
m_summaryCase.uiCapability()->setUiChildrenHidden(true);
// TODO: Implement setUiTreeHidden
//m_eclipseCase.uiCapability()->setUiHidden(true);
CAF_PDM_InitFieldNoDefault(&m_variableName, "SummaryVariableName", "Variable Name", "", "", "");
m_variableName.uiCapability()->setUiEditorTypeName(caf::PdmUiComboBoxEditor::uiEditorTypeName());
CAF_PDM_InitFieldNoDefault(&m_category,"SummaryVarCategory","Category","","","");
m_category.xmlCapability()->setIOWritable(false);
m_category.xmlCapability()->setIOReadable(false);
CAF_PDM_InitFieldNoDefault(&m_simulationItemName,"SummaryVarItem","Item","","","");
m_simulationItemName.xmlCapability()->setIOWritable(false);
m_simulationItemName.xmlCapability()->setIOReadable(false);
CAF_PDM_InitFieldNoDefault(&m_quantityName,"SummaryVarQuantity","Quantity","","","");
m_quantityName.xmlCapability()->setIOWritable(false);
m_quantityName.xmlCapability()->setIOReadable(false);
updateOptionSensitivity();
}
//--------------------------------------------------------------------------------------------------
@@ -60,17 +97,33 @@ RimSummaryCurve::~RimSummaryCurve()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSummaryCurve::setSummaryCase(RimSummaryCase* sumCase)
{
m_summaryCase = sumCase;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSummaryCurve::setVariable(QString varName)
{
m_variableName = varName;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QList<caf::PdmOptionItemInfo> RimSummaryCurve::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly)
{
this->RimPlotCurve::calculateValueOptions(fieldNeedingOptions,useOptionsOnly);
QList<caf::PdmOptionItemInfo> optionList = this->RimPlotCurve::calculateValueOptions(fieldNeedingOptions,useOptionsOnly);
if (!optionList.isEmpty()) return optionList;
QList<caf::PdmOptionItemInfo> optionList;
if (fieldNeedingOptions == &m_variableName)
{
if (m_eclipseCase)
if (m_summaryCase)
{
RifReaderEclipseSummary* reader = summaryReader();
if (reader)
@@ -91,18 +144,18 @@ QList<caf::PdmOptionItemInfo> RimSummaryCurve::calculateValueOptions(const caf::
if (useOptionsOnly) *useOptionsOnly = true;
}
}
else if (fieldNeedingOptions == &m_eclipseCase)
else if (fieldNeedingOptions == &m_summaryCase)
{
RimProject* proj = RiaApplication::instance()->project();
std::vector<RimCase*> cases;
std::vector<RimSummaryCase*> cases;
proj->allCases(cases);
proj->allSummaryCases(cases);
for (size_t i = 0; i < cases.size(); i++)
{
RimCase* rimCase = cases[i];
RimSummaryCase* rimCase = cases[i];
optionList.push_back(caf::PdmOptionItemInfo(rimCase->caseUserDescription(), QVariant::fromValue(caf::PdmPointer<caf::PdmObjectHandle>(rimCase))));
optionList.push_back(caf::PdmOptionItemInfo(rimCase->caseName(), QVariant::fromValue(caf::PdmPointer<caf::PdmObjectHandle>(rimCase))));
}
if (optionList.size() > 0)
@@ -110,6 +163,14 @@ QList<caf::PdmOptionItemInfo> RimSummaryCurve::calculateValueOptions(const caf::
optionList.push_front(caf::PdmOptionItemInfo("None", QVariant::fromValue(caf::PdmPointer<caf::PdmObjectHandle>(NULL))));
}
}
else if (fieldNeedingOptions == &m_simulationItemName)
{
RifReaderEclipseSummary* reader = summaryReader();
if(reader)
{
const std::vector<RifEclipseSummaryAddress>& addrs = reader->allResultAddresses();
}
}
return optionList;
@@ -154,6 +215,29 @@ void RimSummaryCurve::onLoadDataAndUpdate()
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSummaryCurve::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
{
caf::PdmUiGroup* curveDataGroup = uiOrdering.addNewGroup("Curve Data");
curveDataGroup->add(&m_summaryCase);
curveDataGroup->add(&m_variableName);
//curveDataGroup->add(&m_category);
//curveDataGroup->add(&m_simulationItemName);
//curveDataGroup->add(&m_quantityName);
caf::PdmUiGroup* appearanceGroup = uiOrdering.addNewGroup("Appearance");
appearanceGroup->add(&m_curveColor);
appearanceGroup->add(&m_curveThickness);
appearanceGroup->add(&m_pointSymbol);
appearanceGroup->add(&m_lineStyle);
appearanceGroup->add(&m_curveName);
appearanceGroup->add(&m_isUsingAutoName);
uiOrdering.setForgetRemainingFields(true); // For now.
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -165,7 +249,7 @@ void RimSummaryCurve::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
{
this->loadDataAndUpdate();
}
else if (changedField = &m_eclipseCase)
else if (changedField = &m_summaryCase)
{
this->loadDataAndUpdate();
}
@@ -176,10 +260,11 @@ void RimSummaryCurve::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
//--------------------------------------------------------------------------------------------------
RifReaderEclipseSummary* RimSummaryCurve::summaryReader()
{
RimSummaryPlotCollection* plotCollection = NULL;
this->firstAnchestorOrThisOfType(plotCollection);
if (!m_summaryCase()) return nullptr;
return plotCollection->getOrCreateSummaryFileReader(m_eclipseCase);
if (!m_summaryCase->caseData()) return nullptr;
return m_summaryCase()->caseData()->summaryReader();
}
//--------------------------------------------------------------------------------------------------

View File

@@ -25,8 +25,10 @@
#include "cafPdmPtrField.h"
#include "RimPlotCurve.h"
#include "RifEclipseSummaryAddress.h"
#include "cafAppEnum.h"
class RimEclipseResultCase;
class RimSummaryCase;
class RifReaderEclipseSummary;
class RiuLineSegmentQwtPlotCurve;
@@ -41,6 +43,9 @@ public:
RimSummaryCurve();
virtual ~RimSummaryCurve();
void setSummaryCase(RimSummaryCase* sumCase);
void setVariable(QString varName);
protected:
// RimPlotCurve overrides
@@ -56,8 +61,16 @@ private:
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
virtual void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "");
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly);
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
// Fields
caf::PdmPtrField<RimEclipseResultCase*> m_eclipseCase;
caf::PdmPtrField<RimSummaryCase*> m_summaryCase;
caf::PdmField<QString> m_variableName;
// Ui Fields
caf::PdmField<caf::AppEnum<RifEclipseSummaryAddress::SummaryVarCategory> >
m_category;
caf::PdmField<QString> m_simulationItemName;
caf::PdmField<QString> m_quantityName;
};