#2044 Close LAS file. Update plots after LAS delete and import

This commit is contained in:
Bjørn Erik Jensen
2017-10-31 15:41:28 +01:00
parent 7695e5dabf
commit e7c0d6d59a
5 changed files with 110 additions and 6 deletions

View File

@@ -19,10 +19,19 @@
#include "RicWellLogFileCloseFeature.h"
#include "RiaApplication.h"
#include "RimWellPath.h"
#include "RimWellLogFile.h"
#include "RimWellLogPlot.h"
#include "RimWellPltPlot.h"
#include "RimWellRftPlot.h"
#include "RimWellAllocationPlot.h"
#include "RimViewWindow.h"
#include "cafSelectionManagerTools.h"
#include "cafPdmObjectHandle.h"
#include "cafPdmUiObjectEditorHandle.h"
#include <QAction>
@@ -53,10 +62,18 @@ void RicWellLogFileCloseFeature::onActionTriggered(bool isChecked)
if (parentWellPath != nullptr)
{
std::set<RimViewWindow*> referringPlots = referringWellLogPlots(wellLogFile);
parentWellPath->deleteWellLogFile(wellLogFile);
for (RimViewWindow* plot : referringPlots)
{
plot->loadDataAndUpdate();
}
}
parentWellPath->updateConnectedEditors();
}
caf::PdmUiObjectEditorHandle::updateUiAllObjectEditors();
}
//--------------------------------------------------------------------------------------------------
@@ -67,3 +84,40 @@ void RicWellLogFileCloseFeature::setupActionLook(QAction* actionToSetup)
actionToSetup->setText("Close Well Log File(s)");
actionToSetup->setIcon(QIcon(":/Erase.png"));
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::set<RimViewWindow*> RicWellLogFileCloseFeature::referringWellLogPlots(const RimWellLogFile* wellLogFile)
{
// Remove all curves displaying data from the specified wellLogFile
std::vector<caf::PdmObjectHandle*> referringObjects;
wellLogFile->objectsWithReferringPtrFields(referringObjects);
std::set<RimViewWindow*> plots;
for (const auto& obj : referringObjects)
{
RimWellAllocationPlot* allocationPlot;
RimWellPltPlot* pltPlot;
RimWellRftPlot* rftPlot;
RimWellLogPlot* wellLogPlot;
obj->firstAncestorOrThisOfType(allocationPlot);
obj->firstAncestorOrThisOfType(pltPlot);
obj->firstAncestorOrThisOfType(rftPlot);
obj->firstAncestorOrThisOfType(wellLogPlot);
RimViewWindow* plot =
allocationPlot ? dynamic_cast<RimViewWindow*>(allocationPlot) :
pltPlot ? dynamic_cast<RimViewWindow*>(pltPlot) :
rftPlot ? dynamic_cast<RimViewWindow*>(rftPlot) :
wellLogPlot ? dynamic_cast<RimViewWindow*>(wellLogPlot) :
nullptr;
if (plot != nullptr)
{
plots.insert(plot);
}
}
return plots;
}