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:
parent
002b7af350
commit
4c1947af11
@ -18,6 +18,8 @@
|
|||||||
|
|
||||||
#include "RicImportSeismicFeature.h"
|
#include "RicImportSeismicFeature.h"
|
||||||
|
|
||||||
|
#include "RicNewSeismicViewFeature.h"
|
||||||
|
|
||||||
#include "RiaApplication.h"
|
#include "RiaApplication.h"
|
||||||
|
|
||||||
#include "RimOilField.h"
|
#include "RimOilField.h"
|
||||||
@ -75,6 +77,8 @@ void RicImportSeismicFeature::onActionTriggered( bool isChecked )
|
|||||||
if ( newData )
|
if ( newData )
|
||||||
{
|
{
|
||||||
Riu3DMainWindowTools::selectAsCurrentItem( newData );
|
Riu3DMainWindowTools::selectAsCurrentItem( newData );
|
||||||
|
|
||||||
|
RicNewSeismicViewFeature::createInitialViewIfNeeded( newData );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,11 +56,6 @@ bool RicNewSeismicViewFeature::isCommandEnabled() const
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RicNewSeismicViewFeature::onActionTriggered( bool isChecked )
|
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;
|
std::vector<caf::PdmUiItem*> uiItems;
|
||||||
caf::SelectionManager::instance()->selectedItems( uiItems );
|
caf::SelectionManager::instance()->selectedItems( uiItems );
|
||||||
|
|
||||||
@ -71,14 +66,50 @@ void RicNewSeismicViewFeature::onActionTriggered( bool isChecked )
|
|||||||
selectedData = dynamic_cast<RimSeismicData*>( uiItems[0] );
|
selectedData = dynamic_cast<RimSeismicData*>( uiItems[0] );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ( selectedData == nullptr ) && !seisDataColl->isEmpty() )
|
createSeismicView( selectedData );
|
||||||
{
|
|
||||||
selectedData = seisDataColl->seismicData()[0];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( selectedData )
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RicNewSeismicViewFeature::setupActionLook( QAction* actionToSetup )
|
||||||
{
|
{
|
||||||
auto view = seisViewColl->addView( selectedData, RiaDefines::SeismicSectionType::SS_INLINE );
|
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() )
|
||||||
|
{
|
||||||
|
seisData = seisDataColl->seismicData()[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( seisData )
|
||||||
|
{
|
||||||
|
auto view = seisViewColl->addView( seisData, RiaDefines::SeismicSectionType::SS_INLINE );
|
||||||
|
|
||||||
if ( view )
|
if ( view )
|
||||||
{
|
{
|
||||||
@ -95,14 +126,9 @@ void RicNewSeismicViewFeature::onActionTriggered( bool isChecked )
|
|||||||
Riu3DMainWindowTools::selectAsCurrentItem( view );
|
Riu3DMainWindowTools::selectAsCurrentItem( view );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
return nullptr;
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
void RicNewSeismicViewFeature::setupActionLook( QAction* actionToSetup )
|
|
||||||
{
|
|
||||||
actionToSetup->setIcon( QIcon( ":/SeismicView16x16.png" ) );
|
|
||||||
actionToSetup->setText( "New Seismic View" );
|
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,9 @@
|
|||||||
|
|
||||||
#include "cafCmdFeature.h"
|
#include "cafCmdFeature.h"
|
||||||
|
|
||||||
|
class RimSeismicDataInterface;
|
||||||
|
class RimSeismicView;
|
||||||
|
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
///
|
///
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
@ -27,8 +30,13 @@ class RicNewSeismicViewFeature : public caf::CmdFeature
|
|||||||
{
|
{
|
||||||
CAF_CMD_HEADER_INIT;
|
CAF_CMD_HEADER_INIT;
|
||||||
|
|
||||||
|
public:
|
||||||
|
static RimSeismicView* createInitialViewIfNeeded( RimSeismicDataInterface* seisData );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool isCommandEnabled() const override;
|
bool isCommandEnabled() const override;
|
||||||
void onActionTriggered( bool isChecked ) override;
|
void onActionTriggered( bool isChecked ) override;
|
||||||
void setupActionLook( QAction* actionToSetup ) override;
|
void setupActionLook( QAction* actionToSetup ) override;
|
||||||
|
|
||||||
|
static RimSeismicView* createSeismicView( RimSeismicDataInterface* seisData );
|
||||||
};
|
};
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
#include "RimOilField.h"
|
#include "RimOilField.h"
|
||||||
#include "RimProject.h"
|
#include "RimProject.h"
|
||||||
#include "RimRegularLegendConfig.h"
|
#include "RimRegularLegendConfig.h"
|
||||||
#include "RimSeismicData.h"
|
#include "RimSeismicDataInterface.h"
|
||||||
#include "RimSeismicSection.h"
|
#include "RimSeismicSection.h"
|
||||||
#include "RimSeismicSectionCollection.h"
|
#include "RimSeismicSectionCollection.h"
|
||||||
#include "RimSurfaceCollection.h"
|
#include "RimSurfaceCollection.h"
|
||||||
@ -93,7 +93,7 @@ RimSeismicView::~RimSeismicView()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimSeismicView::setSeismicData( RimSeismicData* data )
|
void RimSeismicView::setSeismicData( RimSeismicDataInterface* data )
|
||||||
{
|
{
|
||||||
m_seismicData = data;
|
m_seismicData = data;
|
||||||
}
|
}
|
||||||
@ -101,7 +101,7 @@ void RimSeismicView::setSeismicData( RimSeismicData* data )
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RimSeismicData* RimSeismicView::seismicData() const
|
RimSeismicDataInterface* RimSeismicView::seismicData() const
|
||||||
{
|
{
|
||||||
return m_seismicData;
|
return m_seismicData;
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
#include "cafPdmObject.h"
|
#include "cafPdmObject.h"
|
||||||
|
|
||||||
class RimCase;
|
class RimCase;
|
||||||
class RimSeismicData;
|
class RimSeismicDataInterface;
|
||||||
class RimSurfaceInViewCollection;
|
class RimSurfaceInViewCollection;
|
||||||
class RimSeismicSectionCollection;
|
class RimSeismicSectionCollection;
|
||||||
class Rim3dOverlayInfoConfig;
|
class Rim3dOverlayInfoConfig;
|
||||||
@ -43,8 +43,8 @@ public:
|
|||||||
RimSeismicView();
|
RimSeismicView();
|
||||||
~RimSeismicView() override;
|
~RimSeismicView() override;
|
||||||
|
|
||||||
void setSeismicData( RimSeismicData* data );
|
void setSeismicData( RimSeismicDataInterface* data );
|
||||||
RimSeismicData* seismicData() const;
|
RimSeismicDataInterface* seismicData() const;
|
||||||
|
|
||||||
void addSlice( RiaDefines::SeismicSectionType sectionType );
|
void addSlice( RiaDefines::SeismicSectionType sectionType );
|
||||||
|
|
||||||
@ -98,7 +98,7 @@ private:
|
|||||||
|
|
||||||
caf::PdmChildField<Rim3dOverlayInfoConfig*> m_overlayInfoConfig;
|
caf::PdmChildField<Rim3dOverlayInfoConfig*> m_overlayInfoConfig;
|
||||||
|
|
||||||
caf::PdmPtrField<RimSeismicData*> m_seismicData;
|
caf::PdmPtrField<RimSeismicDataInterface*> m_seismicData;
|
||||||
|
|
||||||
cvf::ref<cvf::ModelBasicList> m_surfaceVizModel;
|
cvf::ref<cvf::ModelBasicList> m_surfaceVizModel;
|
||||||
cvf::ref<RivPolylinePartMgr> m_polylinePartMgr;
|
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();
|
RimSeismicView* view = new RimSeismicView();
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
class RimSeismicView;
|
class RimSeismicView;
|
||||||
class RimSeismicData;
|
class RimSeismicDataInterface;
|
||||||
|
|
||||||
class RimSeismicViewCollection : public caf::PdmObject
|
class RimSeismicViewCollection : public caf::PdmObject
|
||||||
{
|
{
|
||||||
@ -39,7 +39,7 @@ public:
|
|||||||
|
|
||||||
bool isEmpty();
|
bool isEmpty();
|
||||||
|
|
||||||
RimSeismicView* addView( RimSeismicData* data, RiaDefines::SeismicSectionType defaultSection );
|
RimSeismicView* addView( RimSeismicDataInterface* data, RiaDefines::SeismicSectionType defaultSection );
|
||||||
|
|
||||||
std::vector<RimSeismicView*> views() const;
|
std::vector<RimSeismicView*> views() const;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user