mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Automatically create a new seismic view if no 3d views already exists when importing seismic data. (#10510)
This commit is contained in:
@@ -18,6 +18,8 @@
|
||||
|
||||
#include "RicImportSeismicFeature.h"
|
||||
|
||||
#include "RicNewSeismicViewFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "RimOilField.h"
|
||||
@@ -75,6 +77,8 @@ void RicImportSeismicFeature::onActionTriggered( bool isChecked )
|
||||
if ( newData )
|
||||
{
|
||||
Riu3DMainWindowTools::selectAsCurrentItem( newData );
|
||||
|
||||
RicNewSeismicViewFeature::createInitialViewIfNeeded( newData );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -56,11 +56,6 @@ bool RicNewSeismicViewFeature::isCommandEnabled() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewSeismicViewFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
auto proj = RimProject::current();
|
||||
auto& seisViewColl = proj->activeOilField()->seismicViewCollection();
|
||||
auto& seisDataColl = proj->activeOilField()->seismicDataCollection();
|
||||
if ( !seisViewColl || !seisDataColl ) return;
|
||||
|
||||
std::vector<caf::PdmUiItem*> uiItems;
|
||||
caf::SelectionManager::instance()->selectedItems( uiItems );
|
||||
|
||||
@@ -71,14 +66,50 @@ void RicNewSeismicViewFeature::onActionTriggered( bool isChecked )
|
||||
selectedData = dynamic_cast<RimSeismicData*>( uiItems[0] );
|
||||
}
|
||||
|
||||
if ( ( selectedData == nullptr ) && !seisDataColl->isEmpty() )
|
||||
createSeismicView( selectedData );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewSeismicViewFeature::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
actionToSetup->setIcon( QIcon( ":/SeismicView16x16.png" ) );
|
||||
actionToSetup->setText( "New Seismic View" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSeismicView* RicNewSeismicViewFeature::createInitialViewIfNeeded( RimSeismicDataInterface* seisData )
|
||||
{
|
||||
auto proj = RimProject::current();
|
||||
|
||||
std::vector<Rim3dView*> views;
|
||||
proj->allViews( views );
|
||||
if ( !views.empty() ) return nullptr;
|
||||
|
||||
return createSeismicView( seisData );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSeismicView* RicNewSeismicViewFeature::createSeismicView( RimSeismicDataInterface* seisData )
|
||||
{
|
||||
auto proj = RimProject::current();
|
||||
auto& seisViewColl = proj->activeOilField()->seismicViewCollection();
|
||||
auto& seisDataColl = proj->activeOilField()->seismicDataCollection();
|
||||
if ( !seisViewColl || !seisDataColl ) return nullptr;
|
||||
|
||||
if ( ( seisData == nullptr ) && !seisDataColl->isEmpty() )
|
||||
{
|
||||
selectedData = seisDataColl->seismicData()[0];
|
||||
seisData = seisDataColl->seismicData()[0];
|
||||
}
|
||||
|
||||
if ( selectedData )
|
||||
if ( seisData )
|
||||
{
|
||||
auto view = seisViewColl->addView( selectedData, RiaDefines::SeismicSectionType::SS_INLINE );
|
||||
auto view = seisViewColl->addView( seisData, RiaDefines::SeismicSectionType::SS_INLINE );
|
||||
|
||||
if ( view )
|
||||
{
|
||||
@@ -95,14 +126,9 @@ void RicNewSeismicViewFeature::onActionTriggered( bool isChecked )
|
||||
Riu3DMainWindowTools::selectAsCurrentItem( view );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewSeismicViewFeature::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
actionToSetup->setIcon( QIcon( ":/SeismicView16x16.png" ) );
|
||||
actionToSetup->setText( "New Seismic View" );
|
||||
return view;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -20,6 +20,9 @@
|
||||
|
||||
#include "cafCmdFeature.h"
|
||||
|
||||
class RimSeismicDataInterface;
|
||||
class RimSeismicView;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
@@ -27,8 +30,13 @@ class RicNewSeismicViewFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
public:
|
||||
static RimSeismicView* createInitialViewIfNeeded( RimSeismicDataInterface* seisData );
|
||||
|
||||
protected:
|
||||
bool isCommandEnabled() const override;
|
||||
void onActionTriggered( bool isChecked ) override;
|
||||
void setupActionLook( QAction* actionToSetup ) override;
|
||||
|
||||
static RimSeismicView* createSeismicView( RimSeismicDataInterface* seisData );
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user