2015-09-14 09:33:28 -05: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.
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#include "RicWellLogsImportFileFeature.h"
|
|
|
|
|
|
|
|
#include "RiaApplication.h"
|
|
|
|
#include "RimProject.h"
|
2018-02-27 09:37:06 -06:00
|
|
|
#include "Riu3DMainWindowTools.h"
|
2015-09-14 09:33:28 -05:00
|
|
|
|
2017-10-31 09:41:28 -05:00
|
|
|
#include "cafPdmUiObjectEditorHandle.h"
|
|
|
|
|
2015-09-14 09:33:28 -05:00
|
|
|
#include <QAction>
|
|
|
|
#include <QFileDialog>
|
|
|
|
|
2017-05-19 06:40:38 -05:00
|
|
|
CAF_CMD_SOURCE_INIT(RicWellLogsImportFileFeature, "RicWellLogsImportFileFeature");
|
2015-09-14 09:33:28 -05:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
bool RicWellLogsImportFileFeature::isCommandEnabled()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RicWellLogsImportFileFeature::onActionTriggered(bool isChecked)
|
|
|
|
{
|
|
|
|
// Open dialog box to select well path files
|
|
|
|
RiaApplication* app = RiaApplication::instance();
|
2016-09-21 02:46:17 -05:00
|
|
|
QString defaultDir = app->lastUsedDialogDirectory("WELL_LOGS_DIR");
|
2018-02-27 09:37:06 -06:00
|
|
|
QStringList wellLogFilePaths = QFileDialog::getOpenFileNames(Riu3DMainWindowTools::mainWindowWidget(), "Import Well Logs", defaultDir, "Well Logs (*.las);;All Files (*.*)");
|
2015-09-14 09:33:28 -05:00
|
|
|
|
|
|
|
if (wellLogFilePaths.size() < 1) return;
|
|
|
|
|
|
|
|
// Remember the path to next time
|
2016-09-21 02:46:17 -05:00
|
|
|
app->setLastUsedDialogDirectory("WELL_LOGS_DIR", QFileInfo(wellLogFilePaths.last()).absolutePath());
|
2015-09-14 09:33:28 -05:00
|
|
|
|
|
|
|
app->addWellLogsToModel(wellLogFilePaths);
|
2017-10-31 09:41:28 -05:00
|
|
|
|
|
|
|
caf::PdmUiObjectEditorHandle::updateUiAllObjectEditors();
|
2015-09-14 09:33:28 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RicWellLogsImportFileFeature::setupActionLook(QAction* actionToSetup)
|
|
|
|
{
|
|
|
|
actionToSetup->setText("Import Well &Logs from File");
|
2015-10-15 04:51:41 -05:00
|
|
|
actionToSetup->setIcon(QIcon(":/LasFile16x16.png"));
|
2015-09-14 09:33:28 -05:00
|
|
|
}
|