mirror of
https://github.com/OPM/ResInsight.git
synced 2024-12-29 10:21:54 -06:00
Automatically create a new seismic view if no 3d views already exists when importing seismic data. (#10510)
This commit is contained in:
parent
002b7af350
commit
4c1947af11
@ -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 );
|
||||
};
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include "RimOilField.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimRegularLegendConfig.h"
|
||||
#include "RimSeismicData.h"
|
||||
#include "RimSeismicDataInterface.h"
|
||||
#include "RimSeismicSection.h"
|
||||
#include "RimSeismicSectionCollection.h"
|
||||
#include "RimSurfaceCollection.h"
|
||||
@ -93,7 +93,7 @@ RimSeismicView::~RimSeismicView()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSeismicView::setSeismicData( RimSeismicData* data )
|
||||
void RimSeismicView::setSeismicData( RimSeismicDataInterface* data )
|
||||
{
|
||||
m_seismicData = data;
|
||||
}
|
||||
@ -101,7 +101,7 @@ void RimSeismicView::setSeismicData( RimSeismicData* data )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSeismicData* RimSeismicView::seismicData() const
|
||||
RimSeismicDataInterface* RimSeismicView::seismicData() const
|
||||
{
|
||||
return m_seismicData;
|
||||
}
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include "cafPdmObject.h"
|
||||
|
||||
class RimCase;
|
||||
class RimSeismicData;
|
||||
class RimSeismicDataInterface;
|
||||
class RimSurfaceInViewCollection;
|
||||
class RimSeismicSectionCollection;
|
||||
class Rim3dOverlayInfoConfig;
|
||||
@ -43,8 +43,8 @@ public:
|
||||
RimSeismicView();
|
||||
~RimSeismicView() override;
|
||||
|
||||
void setSeismicData( RimSeismicData* data );
|
||||
RimSeismicData* seismicData() const;
|
||||
void setSeismicData( RimSeismicDataInterface* data );
|
||||
RimSeismicDataInterface* seismicData() const;
|
||||
|
||||
void addSlice( RiaDefines::SeismicSectionType sectionType );
|
||||
|
||||
@ -98,7 +98,7 @@ private:
|
||||
|
||||
caf::PdmChildField<Rim3dOverlayInfoConfig*> m_overlayInfoConfig;
|
||||
|
||||
caf::PdmPtrField<RimSeismicData*> m_seismicData;
|
||||
caf::PdmPtrField<RimSeismicDataInterface*> m_seismicData;
|
||||
|
||||
cvf::ref<cvf::ModelBasicList> m_surfaceVizModel;
|
||||
cvf::ref<RivPolylinePartMgr> m_polylinePartMgr;
|
||||
|
@ -66,7 +66,7 @@ bool RimSeismicViewCollection::isEmpty()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSeismicView* RimSeismicViewCollection::addView( RimSeismicData* data, RiaDefines::SeismicSectionType defaultSection )
|
||||
RimSeismicView* RimSeismicViewCollection::addView( RimSeismicDataInterface* data, RiaDefines::SeismicSectionType defaultSection )
|
||||
{
|
||||
RimSeismicView* view = new RimSeismicView();
|
||||
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include <QString>
|
||||
|
||||
class RimSeismicView;
|
||||
class RimSeismicData;
|
||||
class RimSeismicDataInterface;
|
||||
|
||||
class RimSeismicViewCollection : public caf::PdmObject
|
||||
{
|
||||
@ -39,7 +39,7 @@ public:
|
||||
|
||||
bool isEmpty();
|
||||
|
||||
RimSeismicView* addView( RimSeismicData* data, RiaDefines::SeismicSectionType defaultSection );
|
||||
RimSeismicView* addView( RimSeismicDataInterface* data, RiaDefines::SeismicSectionType defaultSection );
|
||||
|
||||
std::vector<RimSeismicView*> views() const;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user