mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
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:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -60,6 +60,7 @@ public:
|
||||
~RiuPlotMainWindow() override;
|
||||
|
||||
static RiuPlotMainWindow* instance();
|
||||
static void wellSelected( QString wellName );
|
||||
|
||||
QString mainWindowName() override;
|
||||
|
||||
@@ -72,6 +73,8 @@ public:
|
||||
void setActiveViewer( QWidget* subWindow ) override;
|
||||
|
||||
void setDefaultWindowSize();
|
||||
void enable3DSelectionLink( bool enable );
|
||||
bool selection3DLinkEnabled();
|
||||
|
||||
void tileSubWindows() override;
|
||||
void storeSubWindowTiling( bool tiled ) override;
|
||||
@@ -118,6 +121,7 @@ private:
|
||||
static QStringList toolbarCommandIds( const QString& toolbarName = "" );
|
||||
|
||||
private slots:
|
||||
void slotToggleSelectionLink();
|
||||
|
||||
friend class RiuMdiSubWindow;
|
||||
|
||||
@@ -129,8 +133,6 @@ private slots:
|
||||
void customMenuRequested( const QPoint& pos );
|
||||
|
||||
private:
|
||||
QByteArray m_initialDockAndToolbarLayout; // Initial dock window and toolbar layout, used to reset GUI
|
||||
|
||||
caf::PdmPointer<RimViewWindow> m_activePlotViewWindow;
|
||||
QPointer<RiuMessagePanel> m_messagePanel;
|
||||
|
||||
@@ -146,4 +148,7 @@ private:
|
||||
std::unique_ptr<caf::PdmObject> m_summaryPlotManager;
|
||||
|
||||
std::vector<QWidget*> m_temporaryWidgets;
|
||||
|
||||
QAction* m_toggleSelectionLinkAction;
|
||||
bool m_selection3DLinkEnabled;
|
||||
};
|
||||
|
||||
@@ -73,6 +73,7 @@
|
||||
#include "Riu3dSelectionManager.h"
|
||||
#include "RiuMainWindow.h"
|
||||
#include "RiuPickItemInfo.h"
|
||||
#include "RiuPlotMainWindow.h"
|
||||
#include "RiuResultTextBuilder.h"
|
||||
#include "RiuViewer.h"
|
||||
|
||||
@@ -871,6 +872,7 @@ void RiuViewerCommands::handlePickAction( int winPosX, int winPosY, Qt::Keyboard
|
||||
{
|
||||
bool allowActiveViewChange = dynamic_cast<Rim2dIntersectionView*>( m_viewer->ownerViewWindow() ) == nullptr;
|
||||
|
||||
RiuPlotMainWindow::wellSelected( eclipseWellSourceInfo->well()->name() );
|
||||
RiuMainWindow::instance()->selectAsCurrentItem( eclipseWellSourceInfo->well(), allowActiveViewChange );
|
||||
}
|
||||
else if ( wellConnectionSourceInfo )
|
||||
|
||||
Reference in New Issue
Block a user