mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#2044 Close LAS file. Update plots after LAS delete and import
This commit is contained in:
parent
7695e5dabf
commit
e7c0d6d59a
@ -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;
|
||||
}
|
||||
|
@ -20,6 +20,10 @@
|
||||
#pragma once
|
||||
|
||||
#include "cafCmdFeature.h"
|
||||
#include <set>
|
||||
|
||||
class RimWellLogFile;
|
||||
class RimViewWindow;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
@ -33,4 +37,6 @@ protected:
|
||||
virtual bool isCommandEnabled() override;
|
||||
virtual void onActionTriggered( bool isChecked ) override;
|
||||
virtual void setupActionLook( QAction* actionToSetup ) override;
|
||||
|
||||
std::set<RimViewWindow*> referringWellLogPlots(const RimWellLogFile* wellLogFile);
|
||||
};
|
||||
|
@ -23,6 +23,8 @@
|
||||
#include "RimProject.h"
|
||||
#include "RiuMainWindow.h"
|
||||
|
||||
#include "cafPdmUiObjectEditorHandle.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QFileDialog>
|
||||
|
||||
@ -52,6 +54,8 @@ void RicWellLogsImportFileFeature::onActionTriggered(bool isChecked)
|
||||
app->setLastUsedDialogDirectory("WELL_LOGS_DIR", QFileInfo(wellLogFilePaths.last()).absolutePath());
|
||||
|
||||
app->addWellLogsToModel(wellLogFilePaths);
|
||||
|
||||
caf::PdmUiObjectEditorHandle::updateUiAllObjectEditors();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -1100,6 +1100,8 @@ QList<caf::PdmOptionItemInfo> RimWellPltPlot::calculateValueOptions(const caf::P
|
||||
}
|
||||
else if (fieldNeedingOptions == &m_selectedSources)
|
||||
{
|
||||
std::set<RifWellRftAddress> optionAddresses;
|
||||
|
||||
//const std::vector<std::tuple<RimEclipseResultCase*, bool, bool>>& eclipseCases = eclipseCasesForWell(m_wellName);
|
||||
|
||||
//const std::vector<RimEclipseResultCase*> rftCases = rftCasesFromEclipseCases(eclipseCases);
|
||||
@ -1136,6 +1138,7 @@ QList<caf::PdmOptionItemInfo> RimWellPltPlot::calculateValueOptions(const caf::P
|
||||
auto item = caf::PdmOptionItemInfo("Observed Data", QVariant::fromValue(addr));
|
||||
item.setLevel(1);
|
||||
options.push_back(item);
|
||||
optionAddresses.insert(addr);
|
||||
}
|
||||
}
|
||||
else if (fieldNeedingOptions == &m_selectedTimeSteps)
|
||||
@ -1202,6 +1205,7 @@ void RimWellPltPlot::fieldChangedByUi(const caf::PdmFieldHandle* changedField, c
|
||||
if (changedField == &m_selectedSources ||
|
||||
changedField == &m_selectedTimeSteps)
|
||||
{
|
||||
syncSourcesIoFieldFromGuiField();
|
||||
syncCurvesFromUiSelection();
|
||||
}
|
||||
else if (changedField == &m_showPlotTitle)
|
||||
@ -1294,11 +1298,7 @@ void RimWellPltPlot::initAfterRead()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellPltPlot::setupBeforeSave()
|
||||
{
|
||||
m_selectedSourcesForIo.clear();
|
||||
for (const RifWellRftAddress& addr : selectedSourcesAndTimeSteps())
|
||||
{
|
||||
m_selectedSourcesForIo.push_back(new RimRftAddress(addr));
|
||||
}
|
||||
syncCurvesFromUiSelection();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -1321,6 +1321,18 @@ void RimWellPltPlot::initAfterLoad()
|
||||
m_selectedSources = std::vector<RifWellRftAddress>(selectedSources.begin(), selectedSources.end());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellPltPlot::syncSourcesIoFieldFromGuiField()
|
||||
{
|
||||
m_selectedSourcesForIo.clear();
|
||||
for (const RifWellRftAddress& addr : selectedSourcesAndTimeSteps())
|
||||
{
|
||||
m_selectedSourcesForIo.push_back(new RimRftAddress(addr));
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -1352,6 +1364,28 @@ void RimWellPltPlot::addTimeStepsToMap(std::map<QDateTime, std::set<RifWellRftAd
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellPltPlot::updateTimeStepsToAddresses(const std::vector<RifWellRftAddress>& addressesToKeep)
|
||||
{
|
||||
for (auto& timeStepPair : m_timeStepsToAddresses)
|
||||
{
|
||||
std::vector<RifWellRftAddress> addressesToDelete;
|
||||
std::set<RifWellRftAddress> keepAddresses = std::set<RifWellRftAddress>(addressesToKeep.begin(), addressesToKeep.end());
|
||||
std::set<RifWellRftAddress>& currentAddresses = timeStepPair.second;
|
||||
|
||||
std::set_difference(currentAddresses.begin(), currentAddresses.end(),
|
||||
keepAddresses.begin(), keepAddresses.end(),
|
||||
std::inserter(addressesToDelete, addressesToDelete.end()));
|
||||
|
||||
for (const auto& addr : addressesToDelete)
|
||||
{
|
||||
currentAddresses.erase(addr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -1391,7 +1425,11 @@ void RimWellPltPlot::calculateValueOptionsForTimeSteps(const QString& wellName,
|
||||
//const std::vector<RimEclipseResultCase*> rftCases = rftCasesFromEclipseCases(eclipseCases);
|
||||
//const std::vector<RimEclipseResultCase*> gridCases = gridCasesFromEclipseCases(eclipseCases);
|
||||
|
||||
for (const RifWellRftAddress& selection : selectedSources())
|
||||
// First update timeSteps to Address 'cache'
|
||||
std::vector<RifWellRftAddress> selSources = selectedSources();
|
||||
updateTimeStepsToAddresses(selectedSources());
|
||||
|
||||
for (const RifWellRftAddress& selection : selSources)
|
||||
{
|
||||
//if (selection.sourceType() == RftSourceType::RFT)
|
||||
//{
|
||||
|
@ -117,12 +117,14 @@ protected:
|
||||
virtual void initAfterRead() override;
|
||||
virtual void setupBeforeSave() override;
|
||||
void initAfterLoad();
|
||||
void syncSourcesIoFieldFromGuiField();
|
||||
|
||||
private:
|
||||
static void addTimeStepToMap(std::map<QDateTime, std::set<RifWellRftAddress>>& destMap,
|
||||
const std::pair<QDateTime, std::set<RifWellRftAddress>>& timeStepToAdd);
|
||||
static void addTimeStepsToMap(std::map<QDateTime, std::set<RifWellRftAddress>>& destMap,
|
||||
const std::map<QDateTime, std::set<RifWellRftAddress>>& timeStepsToAdd);
|
||||
void updateTimeStepsToAddresses(const std::vector<RifWellRftAddress>& addressesToKeep);
|
||||
void calculateValueOptionsForWells(QList<caf::PdmOptionItemInfo>& options);
|
||||
void calculateValueOptionsForTimeSteps(const QString& wellName, QList<caf::PdmOptionItemInfo>& options);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user