2023-03-24 09:36:10 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// Copyright (C) 2022 Equinor 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 "RicImportSeismicFeature.h"
|
|
|
|
|
|
|
|
#include "RiaApplication.h"
|
|
|
|
|
|
|
|
#include "RimOilField.h"
|
|
|
|
#include "RimProject.h"
|
|
|
|
#include "RimSeismicData.h"
|
|
|
|
#include "RimSeismicDataCollection.h"
|
|
|
|
|
|
|
|
#include "Riu3DMainWindowTools.h"
|
|
|
|
#include "RiuFileDialogTools.h"
|
|
|
|
|
|
|
|
#include "cafSelectionManagerTools.h"
|
|
|
|
#include "cafUtils.h"
|
|
|
|
|
|
|
|
#include <QAction>
|
|
|
|
#include <QFileInfo>
|
|
|
|
|
|
|
|
CAF_CMD_SOURCE_INIT( RicImportSeismicFeature, "RicImportSeismicFeature" );
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
bool RicImportSeismicFeature::isCommandEnabled()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RicImportSeismicFeature::onActionTriggered( bool isChecked )
|
|
|
|
{
|
2023-04-21 09:38:04 -05:00
|
|
|
#ifdef USE_OPENVDS
|
|
|
|
QString filter = "Seismic files (*.zgy *.vds);;All Files (*.*)";
|
|
|
|
#else
|
|
|
|
QString filter = "Seismic files (*.zgy);;All Files (*.*)";
|
|
|
|
#endif
|
|
|
|
|
2023-03-24 09:36:10 -05:00
|
|
|
RiaApplication* app = RiaApplication::instance();
|
|
|
|
QString defaultDir = app->lastUsedDialogDirectory( "SEISMIC_GRID" );
|
2023-04-21 09:38:04 -05:00
|
|
|
QString fileName = RiuFileDialogTools::getOpenFileName( Riu3DMainWindowTools::mainWindowWidget(), "Import Seismic", defaultDir, filter );
|
2023-03-24 09:36:10 -05:00
|
|
|
|
|
|
|
if ( fileName.isEmpty() ) return;
|
|
|
|
|
|
|
|
// Remember the path to next time
|
|
|
|
app->setLastUsedDialogDirectory( "SEISMIC_GRID", QFileInfo( fileName ).absolutePath() );
|
|
|
|
|
|
|
|
auto proj = RimProject::current();
|
|
|
|
auto& seisColl = proj->activeOilField()->seismicCollection();
|
|
|
|
|
|
|
|
if ( !seisColl ) return;
|
|
|
|
|
|
|
|
RimSeismicData* newData = seisColl->importSeismicFromFile( fileName );
|
|
|
|
|
2023-04-21 17:27:42 -05:00
|
|
|
// workaround to make tree selection work, otherwise "Cell Results" gets selected for some reason
|
|
|
|
QApplication::processEvents();
|
|
|
|
|
2023-03-24 09:36:10 -05:00
|
|
|
if ( newData )
|
|
|
|
{
|
|
|
|
Riu3DMainWindowTools::selectAsCurrentItem( newData );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RicImportSeismicFeature::setupActionLook( QAction* actionToSetup )
|
|
|
|
{
|
|
|
|
actionToSetup->setIcon( QIcon( ":/Seismic16x16.png" ) );
|
|
|
|
actionToSetup->setText( "Import Seismic" );
|
|
|
|
}
|