(#579) Removing cached well log extractors when deleting cases and well paths

Cached well log extractors with references to well paths or cases to be
deleted are removed before deletion.
This commit is contained in:
Pål Hagen 2015-10-22 11:31:34 +02:00
parent 6e0c6b89b1
commit 272c328da3
4 changed files with 104 additions and 0 deletions

View File

@ -30,6 +30,8 @@
#include "RimIdenticalGridCaseGroup.h"
#include "RimOilField.h"
#include "RimProject.h"
#include "RimMainPlotCollection.h"
#include "RimWellLogPlotCollection.h"
#include "RiuMainWindow.h"
@ -159,6 +161,19 @@ void RicCloseCaseFeature::deleteEclipseCase(RimEclipseCase* eclipseCase)
removeCaseFromAllGroups(eclipseCase);
}
RimProject* project = RiaApplication::instance()->project();
if (project)
{
if (project->mainPlotCollection())
{
RimWellLogPlotCollection* plotCollection = project->mainPlotCollection()->wellLogPlotCollection();
if (plotCollection)
{
plotCollection->removeExtractors(eclipseCase->reservoirData());
}
}
}
delete eclipseCase;
}
@ -178,6 +193,19 @@ void RicCloseCaseFeature::deleteGeoMechCase(RimGeoMechCase* geoMechCase)
models->updateConnectedEditors();
}
RimProject* project = RiaApplication::instance()->project();
if (project)
{
if (project->mainPlotCollection())
{
RimWellLogPlotCollection* plotCollection = project->mainPlotCollection()->wellLogPlotCollection();
if (plotCollection)
{
plotCollection->removeExtractors(geoMechCase->geoMechData());
}
}
}
delete geoMechCase;
}

View File

@ -23,6 +23,7 @@
#include "cafPdmUiTreeView.h"
#include "RigCaseData.h"
#include "RigGeoMechCaseData.h"
#include "RimWellPath.h"
#include "RimEclipseCase.h"
#include "RigEclipseWellLogExtractor.h"
@ -125,3 +126,53 @@ RimWellLogPlot* RimWellLogPlotCollection::wellLogPlotFromViewer(RiuWellLogPlot*
return NULL;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogPlotCollection::removeExtractors(const RigWellPath* wellPath)
{
for (int eIdx = (int) m_extractors.size() - 1; eIdx >= 0; eIdx--)
{
if (m_extractors[eIdx]->wellPathData() == wellPath)
{
m_extractors.eraseAt(eIdx);
}
}
for (int eIdx = (int) m_geomExtractors.size() - 1; eIdx >= 0; eIdx--)
{
if (m_geomExtractors[eIdx]->wellPathData() == wellPath)
{
m_geomExtractors.eraseAt(eIdx);
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogPlotCollection::removeExtractors(const RigCaseData* caseData)
{
for (int eIdx = (int) m_extractors.size() - 1; eIdx >= 0; eIdx--)
{
if (m_extractors[eIdx]->caseData() == caseData)
{
m_extractors.eraseAt(eIdx);
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogPlotCollection::removeExtractors(const RigGeoMechCaseData* caseData)
{
for (int eIdx = (int) m_geomExtractors.size() - 1; eIdx >= 0; eIdx--)
{
if (m_geomExtractors[eIdx]->caseData() == caseData)
{
m_geomExtractors.eraseAt(eIdx);
}
}
}

View File

@ -28,6 +28,9 @@ class RimWellLogPlot;
class RigEclipseWellLogExtractor;
class RigGeoMechWellLogExtractor;
class RimGeoMechCase;
class RigCaseData;
class RigGeoMechCaseData;
class RigWellPath;
class RimWellPath;
class RimEclipseCase;
class RiuWellLogPlot;
@ -46,6 +49,10 @@ public:
RigEclipseWellLogExtractor* findOrCreateExtractor(RimWellPath* wellPath, RimEclipseCase* eclCase);
RigGeoMechWellLogExtractor* findOrCreateExtractor(RimWellPath* wellPath, RimGeoMechCase* eclCase);
void removeExtractors(const RigWellPath* wellPath);
void removeExtractors(const RigCaseData* caseData);
void removeExtractors(const RigGeoMechCaseData* caseData);
RimWellLogPlot* wellLogPlotFromViewer(RiuWellLogPlot* viewer) const;
caf::PdmChildArrayField<RimWellLogPlot*> wellLogPlots;

View File

@ -25,6 +25,9 @@
#include "RimTools.h"
#include "RimWellLogFile.h"
#include "RimWellPathCollection.h"
#include "RimProject.h"
#include "RimMainPlotCollection.h"
#include "RimWellLogPlotCollection.h"
#include "RivWellPathPartMgr.h"
#include "RiuMainWindow.h"
@ -102,6 +105,21 @@ RimWellPath::~RimWellPath()
{
delete m_wellLogFile;
}
RimProject* project;
firstAnchestorOrThisOfType(project);
if (project)
{
if (project->mainPlotCollection())
{
RimWellLogPlotCollection* plotCollection = project->mainPlotCollection()->wellLogPlotCollection();
if (plotCollection)
{
plotCollection->removeExtractors(m_wellPath.p());
}
}
}
}