mirror of
https://github.com/OPM/ResInsight.git
synced 2025-01-21 14:03:18 -06:00
#2632 Export Completions : Use common entry point for completion export
This commit is contained in:
parent
f71563cb1e
commit
c759ef71b9
@ -18,22 +18,11 @@
|
||||
|
||||
#include "RicExportCompletionsForVisibleSimWellsFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RicWellPathExportCompletionDataFeature.h"
|
||||
|
||||
#include "RicExportFeatureImpl.h"
|
||||
#include "RicExportCompletionDataSettingsUi.h"
|
||||
#include "RicWellPathExportCompletionDataFeatureImpl.h"
|
||||
|
||||
#include "RimDialogData.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimSimWellInView.h"
|
||||
#include "RimSimWellInViewCollection.h"
|
||||
#include "RimWellPath.h"
|
||||
#include "RimWellPathCollection.h"
|
||||
|
||||
#include "Riu3DMainWindowTools.h"
|
||||
|
||||
#include "cafPdmUiPropertyViewDialog.h"
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
#include <QAction>
|
||||
@ -63,42 +52,10 @@ void RicExportCompletionsForVisibleSimWellsFeature::onActionTriggered(bool isChe
|
||||
std::vector<RimSimWellInView*> simWells = visibleSimWells();
|
||||
CVF_ASSERT(!simWells.empty());
|
||||
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
RimProject* project = app->project();
|
||||
std::vector<RimWellPath*> wellPaths;
|
||||
QString dialogTitle = "Export Completion Data for Visible Simulation Wells";
|
||||
|
||||
QString projectFolder = app->currentProjectPath();
|
||||
QString defaultDir = RiaApplication::instance()->lastUsedDialogDirectoryWithFallback("COMPLETIONS", projectFolder);
|
||||
|
||||
RicExportCompletionDataSettingsUi* exportSettings = project->dialogData()->exportCompletionData();
|
||||
exportSettings->showForSimWells();
|
||||
|
||||
if (!exportSettings->caseToApply())
|
||||
{
|
||||
std::vector<RimCase*> cases;
|
||||
app->project()->allCases(cases);
|
||||
for (auto c : cases)
|
||||
{
|
||||
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>(c);
|
||||
if (eclipseCase != nullptr)
|
||||
{
|
||||
exportSettings->caseToApply = eclipseCase;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (exportSettings->folder().isEmpty()) exportSettings->folder = defaultDir;
|
||||
|
||||
caf::PdmUiPropertyViewDialog propertyDialog(Riu3DMainWindowTools::mainWindowWidget(), exportSettings, "Export Completion Data", "");
|
||||
RicExportFeatureImpl::configureForExport(&propertyDialog);
|
||||
|
||||
if (propertyDialog.exec() == QDialog::Accepted)
|
||||
{
|
||||
RiaApplication::instance()->setLastUsedDialogDirectory("COMPLETIONS", exportSettings->folder);
|
||||
|
||||
std::vector<RimWellPath*> wellPaths;
|
||||
RicWellPathExportCompletionDataFeatureImpl::exportCompletions(wellPaths, simWells, *exportSettings);
|
||||
}
|
||||
RicWellPathExportCompletionDataFeature::prepareExportSettingsAndExportCompletions(dialogTitle, wellPaths, simWells);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -115,7 +72,7 @@ void RicExportCompletionsForVisibleSimWellsFeature::setupActionLook(QAction* act
|
||||
std::vector<RimSimWellInView*> RicExportCompletionsForVisibleSimWellsFeature::visibleSimWells()
|
||||
{
|
||||
std::vector<RimSimWellInView*> simWells;
|
||||
|
||||
|
||||
{
|
||||
std::vector<RimSimWellInViewCollection*> simWellCollection;
|
||||
caf::SelectionManager::instance()->objectsByType(&simWellCollection);
|
||||
@ -150,7 +107,6 @@ std::vector<RimSimWellInView*> RicExportCompletionsForVisibleSimWellsFeature::vi
|
||||
|
||||
std::set<RimSimWellInView*> uniqueWellPaths(simWells.begin(), simWells.end());
|
||||
simWells.assign(uniqueWellPaths.begin(), uniqueWellPaths.end());
|
||||
|
||||
|
||||
return simWells;
|
||||
}
|
||||
|
||||
|
@ -18,22 +18,11 @@
|
||||
|
||||
#include "RicExportCompletionsForVisibleWellPathsFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RicWellPathExportCompletionDataFeature.h"
|
||||
|
||||
#include "RicExportFeatureImpl.h"
|
||||
#include "RicExportCompletionDataSettingsUi.h"
|
||||
#include "RicWellPathExportCompletionDataFeatureImpl.h"
|
||||
|
||||
#include "RimDialogData.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimSimWellInView.h"
|
||||
#include "RimSimWellInViewCollection.h"
|
||||
#include "RimWellPath.h"
|
||||
#include "RimWellPathCollection.h"
|
||||
|
||||
#include "Riu3DMainWindowTools.h"
|
||||
|
||||
#include "cafPdmUiPropertyViewDialog.h"
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
#include <QAction>
|
||||
@ -45,7 +34,7 @@ CAF_CMD_SOURCE_INIT(RicExportCompletionsForVisibleWellPathsFeature, "RicExportCo
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicExportCompletionsForVisibleWellPathsFeature::isCommandEnabled()
|
||||
{
|
||||
std::vector<RimWellPath*> wellPaths = visibleWellPaths();
|
||||
std::vector<RimWellPath*> wellPaths = visibleWellPaths();
|
||||
|
||||
if (wellPaths.empty())
|
||||
{
|
||||
@ -60,46 +49,13 @@ bool RicExportCompletionsForVisibleWellPathsFeature::isCommandEnabled()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicExportCompletionsForVisibleWellPathsFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
std::vector<RimWellPath*> wellPaths = visibleWellPaths();
|
||||
std::vector<RimWellPath*> wellPaths = visibleWellPaths();
|
||||
CVF_ASSERT(wellPaths.size() > 0);
|
||||
|
||||
|
||||
std::vector<RimSimWellInView*> simWells;
|
||||
QString dialogTitle = "Export Completion Data for Visible Well Paths";
|
||||
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
RimProject* project = app->project();
|
||||
|
||||
QString projectFolder = app->currentProjectPath();
|
||||
QString defaultDir = RiaApplication::instance()->lastUsedDialogDirectoryWithFallback("COMPLETIONS", projectFolder);
|
||||
|
||||
RicExportCompletionDataSettingsUi* exportSettings = project->dialogData()->exportCompletionData();
|
||||
exportSettings->showForWellPath();
|
||||
|
||||
if (!exportSettings->caseToApply())
|
||||
{
|
||||
std::vector<RimCase*> cases;
|
||||
app->project()->allCases(cases);
|
||||
for (auto c : cases)
|
||||
{
|
||||
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>(c);
|
||||
if (eclipseCase != nullptr)
|
||||
{
|
||||
exportSettings->caseToApply = eclipseCase;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (exportSettings->folder().isEmpty()) exportSettings->folder = defaultDir;
|
||||
|
||||
caf::PdmUiPropertyViewDialog propertyDialog(Riu3DMainWindowTools::mainWindowWidget(), exportSettings, "Export Completion Data", "");
|
||||
RicExportFeatureImpl::configureForExport(&propertyDialog);
|
||||
|
||||
if (propertyDialog.exec() == QDialog::Accepted)
|
||||
{
|
||||
RiaApplication::instance()->setLastUsedDialogDirectory("COMPLETIONS", exportSettings->folder);
|
||||
|
||||
RicWellPathExportCompletionDataFeatureImpl::exportCompletions(wellPaths, simWells, *exportSettings);
|
||||
}
|
||||
RicWellPathExportCompletionDataFeature::prepareExportSettingsAndExportCompletions(dialogTitle, wellPaths, simWells);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -116,7 +72,7 @@ void RicExportCompletionsForVisibleWellPathsFeature::setupActionLook(QAction* ac
|
||||
std::vector<RimWellPath*> RicExportCompletionsForVisibleWellPathsFeature::visibleWellPaths()
|
||||
{
|
||||
std::vector<RimWellPath*> wellPaths;
|
||||
|
||||
|
||||
{
|
||||
std::vector<RimWellPathCollection*> wellPathCollections;
|
||||
caf::SelectionManager::instance()->objectsByType(&wellPathCollections);
|
||||
@ -151,7 +107,6 @@ std::vector<RimWellPath*> RicExportCompletionsForVisibleWellPathsFeature::visibl
|
||||
|
||||
std::set<RimWellPath*> uniqueWellPaths(wellPaths.begin(), wellPaths.end());
|
||||
wellPaths.assign(uniqueWellPaths.begin(), uniqueWellPaths.end());
|
||||
|
||||
|
||||
return wellPaths;
|
||||
}
|
||||
|
||||
|
@ -42,26 +42,11 @@ CAF_CMD_SOURCE_INIT(RicWellPathExportCompletionDataFeature, "RicWellPathExportCo
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicWellPathExportCompletionDataFeature::isCommandEnabled()
|
||||
void RicWellPathExportCompletionDataFeature::prepareExportSettingsAndExportCompletions(
|
||||
const QString& dialogTitle,
|
||||
const std::vector<RimWellPath*>& wellPaths,
|
||||
const std::vector<RimSimWellInView*>& simWells)
|
||||
{
|
||||
std::vector<RimWellPath*> wellPaths = selectedWellPaths();
|
||||
|
||||
if (wellPaths.empty())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicWellPathExportCompletionDataFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
std::vector<RimWellPath*> wellPaths = selectedWellPaths();
|
||||
CVF_ASSERT(!wellPaths.empty());
|
||||
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
RimProject* project = app->project();
|
||||
|
||||
@ -96,20 +81,46 @@ void RicWellPathExportCompletionDataFeature::onActionTriggered(bool isChecked)
|
||||
|
||||
if (exportSettings->folder().isEmpty()) exportSettings->folder = defaultDir;
|
||||
|
||||
caf::PdmUiPropertyViewDialog propertyDialog(
|
||||
Riu3DMainWindowTools::mainWindowWidget(), exportSettings, "Export Completion Data", "");
|
||||
caf::PdmUiPropertyViewDialog propertyDialog(Riu3DMainWindowTools::mainWindowWidget(), exportSettings, dialogTitle, "");
|
||||
RicExportFeatureImpl::configureForExport(&propertyDialog);
|
||||
|
||||
if (propertyDialog.exec() == QDialog::Accepted)
|
||||
{
|
||||
RiaApplication::instance()->setLastUsedDialogDirectory("COMPLETIONS", exportSettings->folder);
|
||||
|
||||
std::vector<RimSimWellInView*> simWells;
|
||||
|
||||
RicWellPathExportCompletionDataFeatureImpl::exportCompletions(wellPaths, simWells, *exportSettings);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicWellPathExportCompletionDataFeature::isCommandEnabled()
|
||||
{
|
||||
std::vector<RimWellPath*> wellPaths = selectedWellPaths();
|
||||
|
||||
if (wellPaths.empty())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicWellPathExportCompletionDataFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
std::vector<RimWellPath*> wellPaths = selectedWellPaths();
|
||||
CVF_ASSERT(!wellPaths.empty());
|
||||
|
||||
std::vector<RimSimWellInView*> simWells;
|
||||
QString dialogTitle = "Export Completion Data for Selected Well Paths";
|
||||
|
||||
RicWellPathExportCompletionDataFeature::prepareExportSettingsAndExportCompletions(dialogTitle, wellPaths, simWells);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -30,11 +30,16 @@ class RicWellPathExportCompletionDataFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
public:
|
||||
static void prepareExportSettingsAndExportCompletions(const QString& dialogTitle,
|
||||
const std::vector<RimWellPath*>& wellPaths,
|
||||
const std::vector<RimSimWellInView*>& simWells);
|
||||
|
||||
protected:
|
||||
virtual bool isCommandEnabled() override;
|
||||
virtual void onActionTriggered(bool isChecked) override;
|
||||
virtual void setupActionLook(QAction* actionToSetup) override;
|
||||
|
||||
private:
|
||||
std::vector<RimWellPath*> selectedWellPaths();
|
||||
std::vector<RimWellPath*> selectedWellPaths();
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user