Link selection in 3D view with plots (#9195)

* Allow well selections in 3D view to update well selection in summary plots and well log plots
This commit is contained in:
jonjenssen
2022-08-15 20:27:49 +02:00
committed by GitHub
parent 016216bdb9
commit 0e45a90e1f
15 changed files with 184 additions and 5 deletions

View File

@@ -83,6 +83,8 @@
//--------------------------------------------------------------------------------------------------
RiuPlotMainWindow::RiuPlotMainWindow()
: m_activePlotViewWindow( nullptr )
, m_selection3DLinkEnabled( false )
, m_toggleSelectionLinkAction( nullptr )
{
m_mdiArea = new RiuMdiArea( this );
connect( m_mdiArea, SIGNAL( subWindowActivated( QMdiSubWindow* ) ), SLOT( slotSubWindowActivated( QMdiSubWindow* ) ) );
@@ -92,15 +94,18 @@ RiuPlotMainWindow::RiuPlotMainWindow()
auto dockArea = dockManager()->setCentralWidget( widget );
dockArea->setVisible( true );
m_toggleSelectionLinkAction = new QAction( QIcon( ":/Link3DandPlots.png" ), tr( "Link With Selection in 3D" ), this );
m_toggleSelectionLinkAction->setToolTip( "Update wells used in plots from well selections in 3D view." );
m_toggleSelectionLinkAction->setCheckable( true );
m_toggleSelectionLinkAction->setChecked( m_selection3DLinkEnabled );
connect( m_toggleSelectionLinkAction, SIGNAL( triggered() ), SLOT( slotToggleSelectionLink() ) );
createMenus();
createToolBars();
createDockPanels();
setAcceptDrops( true );
// Store the layout so we can offer reset option
m_initialDockAndToolbarLayout = saveState( 0 );
if ( m_undoView )
{
m_undoView->setStack( caf::CmdExecCommandManager::instance()->undoStack() );
@@ -139,6 +144,22 @@ RiuPlotMainWindow* RiuPlotMainWindow::instance()
return nullptr;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuPlotMainWindow::wellSelected( QString wellName )
{
RiuPlotMainWindow* plotWnd = instance();
if ( !plotWnd ) return;
if ( !plotWnd->selection3DLinkEnabled() ) return;
RimProject* project = RimProject::current();
if ( !project ) return;
project->mainPlotCollection()->updateSelectedWell( wellName );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -441,6 +462,10 @@ void RiuPlotMainWindow::createToolBars()
{
toolbar->addAction( cmdFeatureMgr->action( s ) );
}
if ( toolbarName == "View" )
{
toolbar->addAction( m_toggleSelectionLinkAction );
}
}
m_wellLogPlotToolBarEditor = std::make_unique<caf::PdmUiToolBarEditor>( "Well Log Plot", this );
@@ -1157,3 +1182,27 @@ QStringList RiuPlotMainWindow::defaultDockStateNames()
RiuDockWidgetTools::dockStateHideAllPlotWindowName() };
return retList;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuPlotMainWindow::enable3DSelectionLink( bool enable )
{
m_selection3DLinkEnabled = enable;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RiuPlotMainWindow::selection3DLinkEnabled()
{
return m_selection3DLinkEnabled;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuPlotMainWindow::slotToggleSelectionLink()
{
m_selection3DLinkEnabled = !m_selection3DLinkEnabled;
}