mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#2122 Formation/Well Path: Add Import well path formation feature
This commit is contained in:
parent
e80cd8de7c
commit
ea74a77978
@ -12,6 +12,7 @@ ${CEE_CURRENT_LIST_DIR}RicWellPathsUnitSystemSettingsImpl.h
|
||||
${CEE_CURRENT_LIST_DIR}RicWellPathsUnitSystemSettingsUi.h
|
||||
${CEE_CURRENT_LIST_DIR}RicWellPathViewerEventHandler.h
|
||||
${CEE_CURRENT_LIST_DIR}RicIntersectionViewerEventHandler.h
|
||||
${CEE_CURRENT_LIST_DIR}RicWellPathFormationsImportFileFeature.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
@ -22,6 +23,7 @@ ${CEE_CURRENT_LIST_DIR}RicWellPathsUnitSystemSettingsImpl.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicWellPathsUnitSystemSettingsUi.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicWellPathViewerEventHandler.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicIntersectionViewerEventHandler.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicWellPathFormationsImportFileFeature.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
|
@ -0,0 +1,95 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RicWellPathFormationsImportFileFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "RimOilField.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimWellPath.h"
|
||||
#include "RimWellPathCollection.h"
|
||||
|
||||
#include "RiuMainWindow.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QFileDialog>
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicWellPathFormationsImportFileFeature, "RicWellPathFormationsImportFileFeature");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicWellPathFormationsImportFileFeature::isCommandEnabled()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicWellPathFormationsImportFileFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
// Open dialog box to select well path formations files
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
QString defaultDir = app->lastUsedDialogDirectory("WELLPATHFORMATIONS_DIR");
|
||||
QStringList wellPathFormationsFilePaths =
|
||||
QFileDialog::getOpenFileNames(RiuMainWindow::instance(), "Import Well Path Formations", defaultDir,
|
||||
"Well Path Formations (*.csv);;All Files (*.*)");
|
||||
|
||||
if (wellPathFormationsFilePaths.size() < 1)
|
||||
return;
|
||||
|
||||
// Remember the path to next time
|
||||
app->setLastUsedDialogDirectory("WELLPATHFORMATIONS_DIR", QFileInfo(wellPathFormationsFilePaths.last()).absolutePath());
|
||||
|
||||
app->addWellPathFormationsToModel(wellPathFormationsFilePaths);
|
||||
|
||||
RimProject* project = app->project();
|
||||
|
||||
if (project)
|
||||
{
|
||||
project->createDisplayModelAndRedrawAllViews();
|
||||
RimOilField* oilField = project->activeOilField();
|
||||
|
||||
if (!oilField)
|
||||
return;
|
||||
|
||||
if (oilField->wellPathCollection->wellPaths().size() > 0)
|
||||
{
|
||||
RimWellPath* wellPath = nullptr;
|
||||
QString wellPathName = oilField->wellPathCollection->newestAddedWellName();
|
||||
|
||||
wellPath = oilField->wellPathCollection->wellPathByName(wellPathName);
|
||||
|
||||
if (wellPath)
|
||||
{
|
||||
RiuMainWindow::instance()->selectAsCurrentItem(wellPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicWellPathFormationsImportFileFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
actionToSetup->setText("Import &Well Path Formations from File");
|
||||
actionToSetup->setIcon(QIcon(":/Formations16x16.png"));
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 RicWellPathFormationsImportFileFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
protected:
|
||||
virtual bool isCommandEnabled() override;
|
||||
virtual void onActionTriggered( bool isChecked ) override;
|
||||
virtual void setupActionLook( QAction* actionToSetup ) override;
|
||||
};
|
@ -232,12 +232,14 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
|
||||
{
|
||||
menuBuilder << "RicWellPathsImportFileFeature";
|
||||
menuBuilder << "RicWellPathsImportSsihubFeature";
|
||||
menuBuilder << "RicWellPathFormationsImportFileFeature";
|
||||
menuBuilder << "RicWellLogsImportFileFeature";
|
||||
menuBuilder << "Separator";
|
||||
}
|
||||
else if (dynamic_cast<RimWellPath*>(uiItem))
|
||||
{
|
||||
menuBuilder << "RicWellPathsImportFileFeature";
|
||||
menuBuilder << "RicWellPathFormationsImportFileFeature";
|
||||
menuBuilder << "RicWellLogsImportFileFeature";
|
||||
menuBuilder << "Separator";
|
||||
menuBuilder << "RicNewRftPlotFeature";
|
||||
|
@ -201,6 +201,7 @@ void RiuMainPlotWindow::createMenus()
|
||||
#endif
|
||||
importMenu->addAction(cmdFeatureMgr->action("RicWellPathsImportFileFeature"));
|
||||
importMenu->addAction(cmdFeatureMgr->action("RicWellPathsImportSsihubFeature"));
|
||||
importMenu->addAction(cmdFeatureMgr->action("RicWellPathFormationsImportFileFeature"));
|
||||
importMenu->addAction(cmdFeatureMgr->action("RicWellLogsImportFileFeature"));
|
||||
importMenu->addSeparator();
|
||||
importMenu->addAction(cmdFeatureMgr->action("RicImportFormationNamesFeature"));
|
||||
|
@ -365,6 +365,7 @@ void RiuMainWindow::createMenus()
|
||||
#endif
|
||||
importMenu->addAction(cmdFeatureMgr->action("RicWellPathsImportFileFeature"));
|
||||
importMenu->addAction(cmdFeatureMgr->action("RicWellPathsImportSsihubFeature"));
|
||||
importMenu->addAction(cmdFeatureMgr->action("RicWellPathFormationsImportFileFeature"));
|
||||
importMenu->addAction(cmdFeatureMgr->action("RicWellLogsImportFileFeature"));
|
||||
importMenu->addSeparator();
|
||||
importMenu->addAction(cmdFeatureMgr->action("RicImportFormationNamesFeature"));
|
||||
|
Loading…
Reference in New Issue
Block a user