mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
(#396) Several fixes regarding Project with plots.
Plots loads the curve data on project open Plots are removed on project close Still missing some updates (curve names ...)
This commit is contained in:
@@ -85,7 +85,9 @@
|
||||
#include "RimGeoMechModels.h"
|
||||
#include "RimGeoMechView.h"
|
||||
#include "RimGeoMechCellColors.h"
|
||||
|
||||
#include "RimMainPlotCollection.h"
|
||||
#include "RimWellLogPlotCollection.h"
|
||||
#include "RimWellLogPlot.h"
|
||||
|
||||
namespace caf
|
||||
{
|
||||
@@ -366,7 +368,7 @@ bool RiaApplication::loadProject(const QString& projectFileName, ProjectLoadActi
|
||||
// Add all "native" cases in the project
|
||||
std::vector<RimCase*> casesToLoad;
|
||||
m_project->allCases(casesToLoad);
|
||||
|
||||
|
||||
caf::ProgressInfo caseProgress(casesToLoad.size() , "Reading Cases");
|
||||
|
||||
for (size_t cIdx = 0; cIdx < casesToLoad.size(); ++cIdx)
|
||||
@@ -393,9 +395,20 @@ bool RiaApplication::loadProject(const QString& projectFileName, ProjectLoadActi
|
||||
|
||||
caseProgress.incrementProgress();
|
||||
}
|
||||
|
||||
{
|
||||
if (m_project->mainPlotCollection() && m_project->mainPlotCollection()->wellLogPlotCollection())
|
||||
{
|
||||
RimWellLogPlotCollection* wlpColl = m_project->mainPlotCollection()->wellLogPlotCollection();
|
||||
caf::ProgressInfo plotProgress(wlpColl->wellLogPlots().size(), "Loading Plot Data");
|
||||
|
||||
|
||||
|
||||
for (size_t wlpIdx = 0; wlpIdx < wlpColl->wellLogPlots().size(); ++wlpIdx)
|
||||
{
|
||||
wlpColl->wellLogPlots[wlpIdx]->loadDataAndUpdate();
|
||||
plotProgress.incrementProgress();
|
||||
}
|
||||
}
|
||||
}
|
||||
// NB! This function must be called before executing command objects,
|
||||
// because the tree view state is restored from project file and sets
|
||||
// current active view ( see restoreTreeViewState() )
|
||||
|
@@ -135,7 +135,6 @@ RimProject::~RimProject(void)
|
||||
|
||||
oilFields.deleteAllChildObjects();
|
||||
if (scriptCollection()) delete scriptCollection();
|
||||
if (mainPlotCollection()) delete mainPlotCollection();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -145,6 +144,7 @@ void RimProject::close()
|
||||
{
|
||||
oilFields.deleteAllChildObjects();
|
||||
oilFields.push_back(new RimOilField);
|
||||
if (mainPlotCollection()) delete mainPlotCollection();
|
||||
|
||||
casesObsolete.deleteAllChildObjects();
|
||||
caseGroupsObsolete.deleteAllChildObjects();
|
||||
|
@@ -52,12 +52,18 @@ RimWellLogExtractionCurve::RimWellLogExtractionCurve()
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_wellPath, "CurveWellPath", "Well Path", "", "", "");
|
||||
m_wellPath.uiCapability()->setUiChildrenHidden(true);
|
||||
//m_wellPath.uiCapability()->setUiHidden(true);
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_case, "CurveCase", "Case", "", "", "");
|
||||
m_case.uiCapability()->setUiChildrenHidden(true);
|
||||
//m_case.uiCapability()->setUiHidden(true);
|
||||
CAF_PDM_InitFieldNoDefault(&m_eclipseResultDefinition, "CurveEclipseResult", "", "", "", "");
|
||||
m_eclipseResultDefinition.uiCapability()->setUiHidden(true);
|
||||
m_eclipseResultDefinition.uiCapability()->setUiChildrenHidden(true);
|
||||
m_eclipseResultDefinition = new RimEclipseResultDefinition;
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_geomResultDefinition, "CurveGeomechResult", "", "", "", "");
|
||||
m_geomResultDefinition.uiCapability()->setUiHidden(true);
|
||||
m_geomResultDefinition.uiCapability()->setUiChildrenHidden(true);
|
||||
m_geomResultDefinition = new RimGeoMechResultDefinition;
|
||||
|
||||
@@ -78,16 +84,16 @@ RimWellLogExtractionCurve::~RimWellLogExtractionCurve()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogExtractionCurve::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
||||
{
|
||||
RimWellLogPlotCurve::fieldChangedByUi(changedField, oldValue, newValue);
|
||||
|
||||
if (changedField == &m_case)
|
||||
if (changedField == &m_case)
|
||||
{
|
||||
RimGeoMechCase* geomCase = dynamic_cast<RimGeoMechCase*>(m_case.value());
|
||||
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>(m_case.value());
|
||||
|
||||
m_eclipseResultDefinition->setEclipseCase(eclipseCase);
|
||||
m_geomResultDefinition->setGeoMechCase(geomCase);
|
||||
}
|
||||
}
|
||||
|
||||
RimWellLogPlotCurve::fieldChangedByUi(changedField, oldValue, newValue);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -101,6 +107,8 @@ void RimWellLogExtractionCurve::updatePlotData()
|
||||
|
||||
RimGeoMechCase* geomCase = dynamic_cast<RimGeoMechCase*>(m_case.value());
|
||||
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>(m_case.value());
|
||||
m_eclipseResultDefinition->setEclipseCase(eclipseCase);
|
||||
m_geomResultDefinition->setGeoMechCase(geomCase);
|
||||
|
||||
if (m_wellPath)
|
||||
{
|
||||
@@ -108,7 +116,10 @@ void RimWellLogExtractionCurve::updatePlotData()
|
||||
{
|
||||
RigEclipseWellLogExtractor extractor(eclipseCase->reservoirData(), m_wellPath->wellPathGeometry());
|
||||
depthValues = (extractor.measuredDepth());
|
||||
|
||||
RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(m_eclipseResultDefinition->porosityModel());
|
||||
m_eclipseResultDefinition->loadResult();
|
||||
|
||||
cvf::ref<RigResultAccessor> resAcc = RigResultAccessorFactory::createResultAccessor(
|
||||
eclipseCase->reservoirData(), 0,
|
||||
porosityModel,
|
||||
@@ -152,16 +163,19 @@ QList<caf::PdmOptionItemInfo> RimWellLogExtractionCurve::calculateValueOptions(c
|
||||
if (fieldNeedingOptions == &m_wellPath)
|
||||
{
|
||||
RimProject* proj = RiaApplication::instance()->project();
|
||||
caf::PdmChildArrayField<RimWellPath*>& wellPaths = proj->activeOilField()->wellPathCollection()->wellPaths;
|
||||
|
||||
for (size_t i = 0; i< wellPaths.size(); i++)
|
||||
if (proj->activeOilField()->wellPathCollection())
|
||||
{
|
||||
optionList.push_back(caf::PdmOptionItemInfo(wellPaths[i]->name(), QVariant::fromValue(caf::PdmPointer<caf::PdmObjectHandle>(wellPaths[i]))));
|
||||
}
|
||||
caf::PdmChildArrayField<RimWellPath*>& wellPaths = proj->activeOilField()->wellPathCollection()->wellPaths;
|
||||
|
||||
if (optionList.size() > 0)
|
||||
{
|
||||
optionList.push_front(caf::PdmOptionItemInfo("None", QVariant::fromValue(caf::PdmPointer<caf::PdmObjectHandle>(NULL))));
|
||||
for (size_t i = 0; i< wellPaths.size(); i++)
|
||||
{
|
||||
optionList.push_back(caf::PdmOptionItemInfo(wellPaths[i]->name(), QVariant::fromValue(caf::PdmPointer<caf::PdmObjectHandle>(wellPaths[i]))));
|
||||
}
|
||||
|
||||
if (optionList.size() > 0)
|
||||
{
|
||||
optionList.push_front(caf::PdmOptionItemInfo("None", QVariant::fromValue(caf::PdmPointer<caf::PdmObjectHandle>(NULL))));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -214,4 +228,16 @@ void RimWellLogExtractionCurve::defineUiOrdering(QString uiConfigName, caf::PdmU
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogExtractionCurve::initAfterRead()
|
||||
{
|
||||
RimGeoMechCase* geomCase = dynamic_cast<RimGeoMechCase*>(m_case.value());
|
||||
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>(m_case.value());
|
||||
|
||||
m_eclipseResultDefinition->setEclipseCase(eclipseCase);
|
||||
m_geomResultDefinition->setGeoMechCase(geomCase);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -47,6 +47,8 @@ protected:
|
||||
|
||||
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly);
|
||||
|
||||
virtual void initAfterRead();
|
||||
|
||||
caf::PdmPtrField<RimWellPath*> m_wellPath;
|
||||
caf::PdmPtrField<RimCase*> m_case;
|
||||
caf::PdmChildField<RimEclipseResultDefinition*> m_eclipseResultDefinition;
|
||||
|
@@ -264,3 +264,14 @@ void RimWellLogPlot::setupBeforeSave()
|
||||
{
|
||||
windowGeometry = RiuMainWindow::instance()->windowGeometryForViewer(m_viewer);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogPlot::loadDataAndUpdate()
|
||||
{
|
||||
for (size_t tIdx = 0; tIdx < traces.size(); ++tIdx)
|
||||
{
|
||||
traces[tIdx]->loadDataAndUpdate();
|
||||
}
|
||||
}
|
||||
|
@@ -43,6 +43,8 @@ public:
|
||||
void addTrace(RimWellLogPlotTrace* trace);
|
||||
size_t traceCount() { return traces.size();}
|
||||
|
||||
void loadDataAndUpdate();
|
||||
|
||||
RiuWellLogPlot* viewer();
|
||||
|
||||
void zoomDepth(double zoomFactor);
|
||||
|
@@ -46,6 +46,7 @@ RimWellLogPlotCollection::RimWellLogPlotCollection()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellLogPlotCollection::~RimWellLogPlotCollection()
|
||||
{
|
||||
wellLogPlots.deleteAllChildObjects();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@@ -151,3 +151,14 @@ void RimWellLogPlotTrace::initAfterRead()
|
||||
curves[cIdx]->setPlot(this->m_viewer);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogPlotTrace::loadDataAndUpdate()
|
||||
{
|
||||
for (size_t cIdx = 0; cIdx < curves.size(); ++cIdx)
|
||||
{
|
||||
curves[cIdx]->updatePlotData();
|
||||
}
|
||||
}
|
||||
|
@@ -44,6 +44,8 @@ public:
|
||||
void addCurve(RimWellLogPlotCurve* curve);
|
||||
size_t curveCount() { return curves.size(); }
|
||||
|
||||
void loadDataAndUpdate();
|
||||
|
||||
bool availableDepthRange(double* minimumDepth, double* maximumDepth);
|
||||
|
||||
RiuWellLogTracePlot* viewer();
|
||||
|
Reference in New Issue
Block a user