mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#2632 Export Completions : Add exportCompletionsForVisibleWellPaths
This commit is contained in:
parent
e50e34feb4
commit
4fb1a0385c
@ -58,7 +58,7 @@ RicfExportSimWellCompletions::RicfExportSimWellCompletions()
|
||||
void RicfExportSimWellCompletions::execute()
|
||||
{
|
||||
RimProject* project = RiaApplication::instance()->project();
|
||||
RicExportCompletionDataSettingsUi* exportSettings = project->dialogData()->exportCompletionData(false);
|
||||
RicExportCompletionDataSettingsUi* exportSettings = project->dialogData()->exportCompletionData();
|
||||
exportSettings->timeStep = m_timeStep;
|
||||
exportSettings->fileSplit = m_fileSplit;
|
||||
exportSettings->compdatExport = m_compdatExport;
|
||||
|
@ -57,7 +57,7 @@ RicfExportWellPathCompletions::RicfExportWellPathCompletions()
|
||||
void RicfExportWellPathCompletions::execute()
|
||||
{
|
||||
RimProject* project = RiaApplication::instance()->project();
|
||||
RicExportCompletionDataSettingsUi* exportSettings = project->dialogData()->exportCompletionData(false);
|
||||
RicExportCompletionDataSettingsUi* exportSettings = project->dialogData()->exportCompletionData();
|
||||
exportSettings->timeStep = m_timeStep;
|
||||
exportSettings->fileSplit = m_fileSplit;
|
||||
exportSettings->compdatExport = m_compdatExport;
|
||||
|
@ -7,6 +7,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RicFishbonesTransmissibilityCalculationFeatureImp.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicExportFishbonesWellSegmentsFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicCaseAndFileExportSettingsUi.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicExportFractureCompletionsImpl.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicExportCompletionsForVisibleWellPathsFeature.h
|
||||
)
|
||||
|
||||
|
||||
@ -18,6 +19,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RicFishbonesTransmissibilityCalculationFeatureImp.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicExportFishbonesWellSegmentsFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicCaseAndFileExportSettingsUi.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicExportFractureCompletionsImpl.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicExportCompletionsForVisibleWellPathsFeature.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
|
@ -0,0 +1,157 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RicExportCompletionsForVisibleWellPathsFeature.h"
|
||||
|
||||
#include "RiaApplication.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>
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicExportCompletionsForVisibleWellPathsFeature, "RicExportCompletionsForVisibleWellPathsFeature");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicExportCompletionsForVisibleWellPathsFeature::isCommandEnabled()
|
||||
{
|
||||
std::vector<RimWellPath*> wellPaths = visibleWellPaths();
|
||||
|
||||
if (wellPaths.empty())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicExportCompletionsForVisibleWellPathsFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
std::vector<RimWellPath*> wellPaths = visibleWellPaths();
|
||||
CVF_ASSERT(wellPaths.size() > 0);
|
||||
|
||||
std::vector<RimSimWellInView*> simWells;
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicExportCompletionsForVisibleWellPathsFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
actionToSetup->setText("Export Completion Data for Visible Well Paths");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimWellPath*> RicExportCompletionsForVisibleWellPathsFeature::visibleWellPaths()
|
||||
{
|
||||
std::vector<RimWellPath*> wellPaths;
|
||||
|
||||
{
|
||||
std::vector<RimWellPathCollection*> wellPathCollections;
|
||||
caf::SelectionManager::instance()->objectsByType(&wellPathCollections);
|
||||
|
||||
if (wellPathCollections.empty())
|
||||
{
|
||||
std::vector<RimWellPath*> selectedWellPaths;
|
||||
caf::SelectionManager::instance()->objectsByType(&selectedWellPaths);
|
||||
|
||||
if (!selectedWellPaths.empty())
|
||||
{
|
||||
RimWellPathCollection* parent = nullptr;
|
||||
selectedWellPaths[0]->firstAncestorOrThisOfType(parent);
|
||||
if (parent)
|
||||
{
|
||||
wellPathCollections.push_back(parent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (auto wellPathCollection : wellPathCollections)
|
||||
{
|
||||
for (auto wellPath : wellPathCollection->wellPaths())
|
||||
{
|
||||
if (wellPath->showWellPath())
|
||||
{
|
||||
wellPaths.push_back(wellPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::set<RimWellPath*> uniqueWellPaths(wellPaths.begin(), wellPaths.end());
|
||||
wellPaths.assign(uniqueWellPaths.begin(), uniqueWellPaths.end());
|
||||
|
||||
return wellPaths;
|
||||
}
|
||||
|
@ -0,0 +1,40 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cafCmdFeature.h"
|
||||
|
||||
class RimSimWellInView;
|
||||
class RimWellPath;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicExportCompletionsForVisibleWellPathsFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
protected:
|
||||
virtual bool isCommandEnabled() override;
|
||||
virtual void onActionTriggered(bool isChecked) override;
|
||||
virtual void setupActionLook(QAction* actionToSetup) override;
|
||||
|
||||
private:
|
||||
std::vector<RimWellPath*> visibleWellPaths();
|
||||
};
|
@ -88,9 +88,7 @@ void RicWellPathExportCompletionDataFeature::onActionTriggered(bool isChecked)
|
||||
QString projectFolder = app->currentProjectPath();
|
||||
QString defaultDir = RiaApplication::instance()->lastUsedDialogDirectoryWithFallback("COMPLETIONS", projectFolder);
|
||||
|
||||
bool onlyWellPathCollectionSelected = noWellPathsSelectedDirectly();
|
||||
RicExportCompletionDataSettingsUi* exportSettings =
|
||||
project->dialogData()->exportCompletionData(onlyWellPathCollectionSelected);
|
||||
RicExportCompletionDataSettingsUi* exportSettings = project->dialogData()->exportCompletionData();
|
||||
|
||||
if (wellPaths.empty())
|
||||
{
|
||||
|
@ -241,6 +241,8 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
|
||||
menuBuilder << "RicReloadWellPathFormationNamesFeature";
|
||||
menuBuilder << "RicWellPathImportPerforationIntervalsFeature";
|
||||
menuBuilder.subMenuEnd();
|
||||
|
||||
menuBuilder << "RicExportCompletionsForVisibleWellPathsFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimWellPath*>(uiItem))
|
||||
{
|
||||
@ -282,6 +284,9 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
|
||||
menuBuilder.subMenuEnd();
|
||||
|
||||
menuBuilder << "Separator";
|
||||
|
||||
menuBuilder << "RicExportCompletionsForVisibleWellPathsFeature";
|
||||
menuBuilder << "RicWellPathExportCompletionDataFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimWellLogFile*>(uiItem))
|
||||
{
|
||||
@ -615,7 +620,6 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
|
||||
menuBuilder << "RicEditPerforationCollectionFeature";
|
||||
menuBuilder << "RicExportFishbonesLateralsFeature";
|
||||
menuBuilder << "RicExportFishbonesWellSegmentsFeature";
|
||||
menuBuilder << "RicWellPathExportCompletionDataFeature";
|
||||
menuBuilder << "RicWellPathImportCompletionsFileFeature";
|
||||
menuBuilder << "RicFlyToObjectFeature";
|
||||
menuBuilder << "RicExportCarfin";
|
||||
|
@ -65,7 +65,7 @@ void RimDialogData::setExportCarfinDataFromString(const QString& data)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicExportCompletionDataSettingsUi* RimDialogData::exportCompletionData(bool onlyWellPathCollectionSelected) const
|
||||
RicExportCompletionDataSettingsUi* RimDialogData::exportCompletionData() const
|
||||
{
|
||||
return m_exportCompletionData;
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ public:
|
||||
QString exportCarfinDataAsString() const;
|
||||
void setExportCarfinDataFromString(const QString& data);
|
||||
|
||||
RicExportCompletionDataSettingsUi* exportCompletionData(bool onlyWellPathCollectionSelected) const;
|
||||
RicExportCompletionDataSettingsUi* exportCompletionData() const;
|
||||
|
||||
private:
|
||||
caf::PdmChildField<RicExportCarfinUi*> m_exportCarfin;
|
||||
|
Loading…
Reference in New Issue
Block a user