mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#1145 - pre-proto - Adding command feature for export of fractures only from selected wells. So far only fractures from one well can be exported each time.
This commit is contained in:
parent
6008e9eb4f
commit
238b803dce
@ -47,9 +47,11 @@ ${CEE_CURRENT_LIST_DIR}RicFracturesDeleteAllFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicWellPathFracturesDeleteAllFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicSimWellFracturesDeleteAllFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicExportSimWellFractureWellCompletionFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicExportSelectedSimWellFractureWellCompletionFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicExportWellPathFractureWellCompletionFeature.h
|
||||
|
||||
|
||||
|
||||
# General delete of any object in a child array field
|
||||
${CEE_CURRENT_LIST_DIR}RicDeleteItemExec.h
|
||||
${CEE_CURRENT_LIST_DIR}RicDeleteItemExecData.h
|
||||
@ -98,6 +100,7 @@ ${CEE_CURRENT_LIST_DIR}RicFractureDefinitionsDeleteAllFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicWellPathFracturesDeleteAllFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicSimWellFracturesDeleteAllFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicExportSimWellFractureWellCompletionFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicExportSelectedSimWellFractureWellCompletionFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicExportWellPathFractureWellCompletionFeature.cpp
|
||||
|
||||
|
||||
|
@ -0,0 +1,122 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RicExportSelectedSimWellFractureWellCompletionFeature.h"
|
||||
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "RifEclipseExportTools.h"
|
||||
#include "RifEclipseExportTools.h"
|
||||
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimEclipseWell.h"
|
||||
#include "RimEclipseWellCollection.h"
|
||||
#include "RimFracture.h"
|
||||
#include "RimFractureExportSettings.h"
|
||||
|
||||
#include "RiuMainWindow.h"
|
||||
|
||||
#include "cafPdmObjectHandle.h"
|
||||
#include "cafPdmUiPropertyViewDialog.h"
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
#include "cvfAssert.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QMessageBox>
|
||||
#include <QString>
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicExportSelectedSimWellFractureWellCompletionFeature, "RicExportSelectedSimWellFractureWellCompletionFeature");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicExportSelectedSimWellFractureWellCompletionFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
|
||||
std::vector<RimEclipseWell*> selection;
|
||||
caf::SelectionManager::instance()->objectsByType(&selection);
|
||||
|
||||
|
||||
|
||||
std::vector<RimFracture*> fractures;
|
||||
for (RimEclipseWell* well : selection)
|
||||
{
|
||||
|
||||
std::vector<RimFracture*> fracListForWell;
|
||||
well->descendantsIncludingThisOfType(fracListForWell);
|
||||
for (RimFracture* fracture : fracListForWell)
|
||||
{
|
||||
fractures.push_back(fracture);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
caf::PdmUiItem* pdmUiItem = caf::SelectionManager::instance()->selectedItem();
|
||||
if (!pdmUiItem) return;
|
||||
|
||||
caf::PdmObjectHandle* objHandle = dynamic_cast<caf::PdmObjectHandle*>(pdmUiItem);
|
||||
if (!objHandle) return;
|
||||
|
||||
RimEclipseView* eclipseWiew = nullptr;
|
||||
objHandle->firstAncestorOrThisOfType(eclipseWiew);
|
||||
|
||||
RimFractureExportSettings exportSettings;
|
||||
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
QString projectFolder = app->currentProjectPath();
|
||||
if (projectFolder.isEmpty())
|
||||
{
|
||||
projectFolder = eclipseWiew->eclipseCase()->locationOnDisc();
|
||||
}
|
||||
|
||||
QString outputFileName = projectFolder + "/Fractures";
|
||||
exportSettings.fileName = outputFileName;
|
||||
|
||||
caf::PdmUiPropertyViewDialog propertyDialog(RiuMainWindow::instance(), &exportSettings, "Export Fracture Well Completion Data", "");
|
||||
if (propertyDialog.exec() == QDialog::Accepted)
|
||||
{
|
||||
bool isOk = RifEclipseExportTools::writeFracturesToTextFile(exportSettings.fileName, fractures);
|
||||
|
||||
if (!isOk)
|
||||
{
|
||||
QMessageBox::critical(NULL, "File export", "Failed to exported current result to " + exportSettings.fileName);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicExportSelectedSimWellFractureWellCompletionFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
actionToSetup->setIcon(QIcon(":/FractureTemplate16x16.png"));
|
||||
actionToSetup->setText("Export Fracture Well Completion Data for Selected wells");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicExportSelectedSimWellFractureWellCompletionFeature::isCommandEnabled()
|
||||
{
|
||||
return true;
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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"
|
||||
|
||||
#include <vector>
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicExportSelectedSimWellFractureWellCompletionFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
protected:
|
||||
|
||||
virtual void onActionTriggered(bool isChecked) override;
|
||||
virtual void setupActionLook(QAction* actionToSetup) override;
|
||||
virtual bool isCommandEnabled() override;
|
||||
|
||||
|
||||
};
|
@ -27,6 +27,7 @@
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimEclipseWellCollection.h"
|
||||
#include "RimFracture.h"
|
||||
#include "RimFractureExportSettings.h"
|
||||
|
||||
#include "RiuMainWindow.h"
|
||||
@ -40,7 +41,6 @@
|
||||
#include <QAction>
|
||||
#include <QMessageBox>
|
||||
#include <QString>
|
||||
#include "RimFracture.h"
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicExportSimWellFractureWellCompletionFeature, "RicExportSimWellFractureWellCompletionFeature");
|
||||
|
||||
|
@ -343,6 +343,7 @@ QStringList RimContextCommandBuilder::commandsFromSelection()
|
||||
else if (dynamic_cast<RimEclipseWell*>(uiItem))
|
||||
{
|
||||
commandIds << "RicNewSimWellIntersectionFeature";
|
||||
commandIds << "RicExportSelectedSimWellFractureWellCompletionFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimEclipseWellCollection*>(uiItem))
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user