2015-08-14 09:45:57 +02:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
|
|
|
|
// Copyright (C) 2015- Statoil ASA
|
|
|
|
|
// Copyright (C) 2015- Ceetron Solutions AS
|
|
|
|
|
//
|
|
|
|
|
// 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.
|
|
|
|
|
//
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
2015-08-12 20:59:38 +02:00
|
|
|
|
2015-08-12 21:09:03 +02:00
|
|
|
#include "RicWellPathsImportFileFeature.h"
|
2015-08-12 20:59:38 +02:00
|
|
|
|
|
|
|
|
#include "RiaApplication.h"
|
2017-10-20 12:40:06 +02:00
|
|
|
|
|
|
|
|
#include "RimOilField.h"
|
2015-08-12 20:59:38 +02:00
|
|
|
#include "RimProject.h"
|
2017-10-20 12:40:06 +02:00
|
|
|
#include "RimWellPath.h"
|
|
|
|
|
#include "RimWellPathCollection.h"
|
|
|
|
|
|
2018-02-27 16:37:06 +01:00
|
|
|
#include "Riu3DMainWindowTools.h"
|
2015-08-12 20:59:38 +02:00
|
|
|
|
|
|
|
|
#include <QAction>
|
|
|
|
|
#include <QFileDialog>
|
|
|
|
|
|
2017-05-19 13:40:38 +02:00
|
|
|
CAF_CMD_SOURCE_INIT(RicWellPathsImportFileFeature, "RicWellPathsImportFileFeature");
|
2015-08-12 20:59:38 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
///
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-08-12 21:09:03 +02:00
|
|
|
bool RicWellPathsImportFileFeature::isCommandEnabled()
|
2015-08-12 20:59:38 +02:00
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
///
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-08-12 21:09:03 +02:00
|
|
|
void RicWellPathsImportFileFeature::onActionTriggered(bool isChecked)
|
2015-08-12 20:59:38 +02:00
|
|
|
{
|
|
|
|
|
// Open dialog box to select well path files
|
|
|
|
|
RiaApplication* app = RiaApplication::instance();
|
2016-09-21 09:46:17 +02:00
|
|
|
QString defaultDir = app->lastUsedDialogDirectory("WELLPATH_DIR");
|
2018-02-27 16:37:06 +01:00
|
|
|
QStringList wellPathFilePaths = QFileDialog::getOpenFileNames(Riu3DMainWindowTools::mainWindowWidget(), "Import Well Paths", defaultDir, "Well Paths (*.json *.asc *.asci *.ascii *.dev);;All Files (*.*)");
|
2015-08-12 20:59:38 +02:00
|
|
|
|
|
|
|
|
if (wellPathFilePaths.size() < 1) return;
|
|
|
|
|
|
|
|
|
|
// Remember the path to next time
|
2016-09-21 09:46:17 +02:00
|
|
|
app->setLastUsedDialogDirectory("WELLPATH_DIR", QFileInfo(wellPathFilePaths.last()).absolutePath());
|
2015-08-12 20:59:38 +02:00
|
|
|
|
|
|
|
|
app->addWellPathsToModel(wellPathFilePaths);
|
2017-10-20 12:40:06 +02:00
|
|
|
|
|
|
|
|
RimProject* project = app->project();
|
|
|
|
|
|
|
|
|
|
if (project)
|
2015-08-12 20:59:38 +02:00
|
|
|
{
|
2017-10-20 12:40:06 +02:00
|
|
|
project->createDisplayModelAndRedrawAllViews();
|
|
|
|
|
RimOilField* oilField = project->activeOilField();
|
|
|
|
|
|
|
|
|
|
if (!oilField) return;
|
|
|
|
|
|
2017-10-23 08:48:44 +02:00
|
|
|
if (oilField->wellPathCollection->wellPaths().size() > 0)
|
2017-10-20 12:40:06 +02:00
|
|
|
{
|
2018-01-29 11:24:12 +01:00
|
|
|
RimWellPath* wellPath = oilField->wellPathCollection->mostRecentlyUpdatedWellPath();
|
2017-11-12 21:57:25 +01:00
|
|
|
if (wellPath)
|
|
|
|
|
{
|
2018-02-27 16:37:06 +01:00
|
|
|
Riu3DMainWindowTools::selectAsCurrentItem(wellPath);
|
2017-11-12 21:57:25 +01:00
|
|
|
}
|
2017-10-20 12:40:06 +02:00
|
|
|
}
|
2015-08-12 20:59:38 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
///
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-08-12 21:09:03 +02:00
|
|
|
void RicWellPathsImportFileFeature::setupActionLook(QAction* actionToSetup)
|
2015-08-12 20:59:38 +02:00
|
|
|
{
|
|
|
|
|
actionToSetup->setText("Import &Well Paths from File");
|
|
|
|
|
actionToSetup->setIcon(QIcon(":/Well.png"));
|
|
|
|
|
}
|