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:
parent
016216bdb9
commit
0e45a90e1f
BIN
ApplicationExeCode/Resources/Link3DandPlots.png
Normal file
BIN
ApplicationExeCode/Resources/Link3DandPlots.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
@ -269,6 +269,7 @@
|
||||
<file>AppendNextCurve.png</file>
|
||||
<file>AppendPrevCurve.png</file>
|
||||
<file>CheckOverlay16x16.png</file>
|
||||
<file>Link3DandPlots.png</file>
|
||||
</qresource>
|
||||
<qresource prefix="/Shader">
|
||||
<file>fs_CellFace.glsl</file>
|
||||
|
@ -42,6 +42,7 @@
|
||||
#include "RimStimPlanModelPlotCollection.h"
|
||||
#include "RimSummaryAddress.h"
|
||||
#include "RimSummaryCrossPlotCollection.h"
|
||||
#include "RimSummaryMultiPlot.h"
|
||||
#include "RimSummaryMultiPlotCollection.h"
|
||||
#include "RimSummaryPlotCollection.h"
|
||||
#include "RimVfpPlotCollection.h"
|
||||
@ -390,6 +391,22 @@ void RimMainPlotCollection::loadDataAndUpdateAllPlots()
|
||||
loadDataAndUpdatePlotCollectionsWithProgressInfo( plotCollections );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimMainPlotCollection::updateSelectedWell( QString wellName )
|
||||
{
|
||||
for ( auto plot : summaryMultiPlotCollection()->multiPlots() )
|
||||
{
|
||||
plot->selectWell( wellName );
|
||||
}
|
||||
|
||||
for ( auto plot : wellLogPlotCollection()->wellLogPlots() )
|
||||
{
|
||||
plot->selectWell( wellName );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -88,6 +88,7 @@ public:
|
||||
void ensureDefaultFlowPlotsAreCreated();
|
||||
void ensureCalculationIdsAreAssigned();
|
||||
void loadDataAndUpdateAllPlots();
|
||||
void updateSelectedWell( QString wellName );
|
||||
|
||||
protected:
|
||||
void initAfterRead() override;
|
||||
|
@ -57,6 +57,7 @@
|
||||
#include "RiuSummaryMultiPlotBook.h"
|
||||
#include "RiuSummaryVectorSelectionUi.h"
|
||||
|
||||
#include "cafPdmUiCheckBoxEditor.h"
|
||||
#include "cafPdmUiComboBoxEditor.h"
|
||||
#include "cafPdmUiPushButtonEditor.h"
|
||||
#include "cafPdmUiTreeOrdering.h"
|
||||
@ -143,8 +144,13 @@ RimSummaryMultiPlot::RimSummaryMultiPlot()
|
||||
m_appendPrevCurve.uiCapability()->setUiIconFromResourceString( ":/AppendPrevCurve.png" );
|
||||
|
||||
CAF_PDM_InitField( &m_linkSubPlotAxes, "LinkSubPlotAxes", true, "Link Sub Plot Axes" );
|
||||
caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_linkSubPlotAxes );
|
||||
CAF_PDM_InitField( &m_linkTimeAxis, "LinkTimeAxis", true, "Link Time Axis" );
|
||||
caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_linkTimeAxis );
|
||||
CAF_PDM_InitField( &m_autoAdjustAppearance, "AutoAdjustAppearance", true, "Auto Adjust Appearance" );
|
||||
caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_autoAdjustAppearance );
|
||||
CAF_PDM_InitField( &m_allow3DSelectionLink, "Allow3DSelectionLink", true, "Allow Well Selection from 3D View" );
|
||||
caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_allow3DSelectionLink );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_axisRangeAggregation, "AxisRangeAggregation", "Axis Range Control" );
|
||||
|
||||
@ -399,6 +405,9 @@ void RimSummaryMultiPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrde
|
||||
dataSourceGroup->setCollapsedByDefault( true );
|
||||
m_sourceStepping()->uiOrdering( uiConfigName, *dataSourceGroup );
|
||||
|
||||
if ( m_sourceStepping->stepDimension() == SourceSteppingDimension::WELL )
|
||||
dataSourceGroup->add( &m_allow3DSelectionLink );
|
||||
|
||||
auto titlesGroup = uiOrdering.addNewGroup( "Main Plot Settings" );
|
||||
titlesGroup->setCollapsedByDefault( true );
|
||||
titlesGroup->add( &m_autoPlotTitle );
|
||||
@ -1489,3 +1498,13 @@ void RimSummaryMultiPlot::updateStepDimensionFromDefault()
|
||||
{
|
||||
m_sourceStepping->setStepDimension( m_defaultStepDimension() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryMultiPlot::selectWell( QString wellName )
|
||||
{
|
||||
if ( !m_allow3DSelectionLink ) return;
|
||||
if ( m_sourceStepping->stepDimension() != SourceSteppingDimension::WELL ) return;
|
||||
m_sourceStepping->setStep( wellName );
|
||||
}
|
||||
|
@ -111,6 +111,8 @@ public:
|
||||
void storeStepDimensionFromToolbar();
|
||||
void updateStepDimensionFromDefault();
|
||||
|
||||
void selectWell( QString wellName );
|
||||
|
||||
protected:
|
||||
bool handleGlobalKeyEvent( QKeyEvent* keyEvent ) override;
|
||||
bool handleGlobalWheelEvent( QWheelEvent* wheelEvent ) override;
|
||||
@ -154,6 +156,7 @@ private:
|
||||
caf::PdmField<bool> m_linkSubPlotAxes;
|
||||
caf::PdmField<bool> m_linkTimeAxis;
|
||||
caf::PdmField<bool> m_autoAdjustAppearance;
|
||||
caf::PdmField<bool> m_allow3DSelectionLink;
|
||||
|
||||
caf::PdmField<bool> m_hidePlotsWithValuesBelow;
|
||||
caf::PdmField<double> m_plotFilterYAxisThreshold;
|
||||
|
@ -239,11 +239,14 @@ QList<caf::PdmOptionItemInfo>
|
||||
{
|
||||
if ( fieldNeedingOptions == &m_vectorName )
|
||||
{
|
||||
m_cachedIdentifiers.clear();
|
||||
|
||||
auto displayAndValueStrings = optionsForQuantity( analyzer );
|
||||
|
||||
for ( const auto& displayAndValue : displayAndValueStrings )
|
||||
{
|
||||
options.append( caf::PdmOptionItemInfo( displayAndValue.first, displayAndValue.second ) );
|
||||
m_cachedIdentifiers.push_back( displayAndValue.first );
|
||||
}
|
||||
|
||||
if ( options.isEmpty() )
|
||||
@ -294,11 +297,14 @@ QList<caf::PdmOptionItemInfo>
|
||||
identifierTexts = analyzer->identifierTexts( category, secondaryIdentifier );
|
||||
}
|
||||
|
||||
m_cachedIdentifiers.clear();
|
||||
|
||||
if ( !identifierTexts.empty() )
|
||||
{
|
||||
for ( const auto& text : identifierTexts )
|
||||
{
|
||||
options.append( caf::PdmOptionItemInfo( text, text ) );
|
||||
m_cachedIdentifiers.push_back( text );
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -1179,6 +1185,41 @@ void RimSummaryPlotSourceStepping::syncWithStepper( RimSummaryPlotSourceStepping
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryPlotSourceStepping::setStep( QString stepIdentifier )
|
||||
{
|
||||
if ( std::count( m_cachedIdentifiers.begin(), m_cachedIdentifiers.end(), stepIdentifier ) == 0 ) return;
|
||||
|
||||
switch ( m_stepDimension() )
|
||||
{
|
||||
case RimSummaryDataSourceStepping::SourceSteppingDimension::WELL:
|
||||
m_wellName.setValueWithFieldChanged( stepIdentifier );
|
||||
break;
|
||||
|
||||
case RimSummaryDataSourceStepping::SourceSteppingDimension::GROUP:
|
||||
m_groupName.setValueWithFieldChanged( stepIdentifier );
|
||||
break;
|
||||
|
||||
case RimSummaryDataSourceStepping::SourceSteppingDimension::VECTOR:
|
||||
m_vectorName.setValueWithFieldChanged( stepIdentifier );
|
||||
break;
|
||||
|
||||
case RimSummaryDataSourceStepping::SourceSteppingDimension::BLOCK:
|
||||
m_cellBlock.setValueWithFieldChanged( stepIdentifier );
|
||||
break;
|
||||
|
||||
case RimSummaryDataSourceStepping::SourceSteppingDimension::AQUIFER:
|
||||
case RimSummaryDataSourceStepping::SourceSteppingDimension::REGION:
|
||||
case RimSummaryDataSourceStepping::SourceSteppingDimension::ENSEMBLE:
|
||||
case RimSummaryDataSourceStepping::SourceSteppingDimension::SUMMARY_CASE:
|
||||
default:
|
||||
CAF_ASSERT( false ); // not supported for these dimensions, yet
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -62,6 +62,7 @@ public:
|
||||
RimSummaryCaseCollection* stepEnsemble( int direction );
|
||||
|
||||
void syncWithStepper( RimSummaryPlotSourceStepping* other );
|
||||
void setStep( QString stepIdentifier );
|
||||
|
||||
RimSummaryDataSourceStepping::SourceSteppingDimension stepDimension() const;
|
||||
void setStepDimension( RimSummaryDataSourceStepping::SourceSteppingDimension dimension );
|
||||
@ -130,4 +131,5 @@ private:
|
||||
caf::PdmField<bool> m_includeEnsembleCasesForCaseStepping;
|
||||
|
||||
RimSummaryDataSourceStepping::Axis m_sourceSteppingType;
|
||||
std::vector<QString> m_cachedIdentifiers;
|
||||
};
|
||||
|
@ -43,6 +43,7 @@
|
||||
#include "RimWellPath.h"
|
||||
#include "RimWellPathCollection.h"
|
||||
|
||||
#include "cafPdmUiCheckBoxEditor.h"
|
||||
#include "cafPdmUiCheckBoxTristateEditor.h"
|
||||
#include "cafPdmUiComboBoxEditor.h"
|
||||
#include "cafPdmUiLineEditor.h"
|
||||
@ -89,6 +90,9 @@ RimWellLogCurveCommonDataSource::RimWellLogCurveCommonDataSource()
|
||||
"",
|
||||
"Compute branches based on how simulation well cells are organized",
|
||||
"" );
|
||||
CAF_PDM_InitField( &m_allow3DSelectionLink, "Allow3DSelectionLink", true, "Allow Well Selection from 3D View" );
|
||||
caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_allow3DSelectionLink );
|
||||
|
||||
m_branchDetection.v() = caf::Tristate::State::PartiallyTrue;
|
||||
m_branchDetection.uiCapability()->setUiEditorTypeName( caf::PdmUiCheckBoxTristateEditor::uiEditorTypeName() );
|
||||
CAF_PDM_InitField( &m_branchIndex, "Branch", -1, "Branch Index" );
|
||||
@ -1011,6 +1015,8 @@ void RimWellLogCurveCommonDataSource::defineUiOrdering( QString uiConfigName, ca
|
||||
else if ( trajectoryTypeToApply() == RimWellLogExtractionCurve::SIMULATION_WELL )
|
||||
{
|
||||
group->add( &m_simWellName );
|
||||
group->add( &m_allow3DSelectionLink );
|
||||
|
||||
if ( RiaSimWellBranchTools::simulationWellBranches( m_simWellName(), true ).size() > 1 )
|
||||
{
|
||||
group->add( &m_branchDetection );
|
||||
@ -1124,3 +1130,21 @@ RifReaderRftInterface* RimWellLogCurveCommonDataSource::rftReader()
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogCurveCommonDataSource::selectSimWell( QString wellName )
|
||||
{
|
||||
if ( !m_allow3DSelectionLink() ) return;
|
||||
|
||||
auto* eclipseCase = dynamic_cast<RimEclipseCase*>( m_case() );
|
||||
if ( eclipseCase )
|
||||
{
|
||||
std::set<QString> sortedWellNames = eclipseCase->sortedSimWellNames();
|
||||
if ( std::count( sortedWellNames.begin(), sortedWellNames.end(), wellName ) > 0 )
|
||||
{
|
||||
m_simWellName.setValueWithFieldChanged( wellName );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -80,6 +80,8 @@ public:
|
||||
int timeStepToApply() const;
|
||||
void setTimeStepToApply( int val );
|
||||
|
||||
void selectSimWell( QString wellName );
|
||||
|
||||
void resetDefaultOptions();
|
||||
void analyseCurvesAndTracks( const std::vector<RimWellLogCurve*>& curves, const std::vector<RimWellLogTrack*>& tracks );
|
||||
void analyseCurvesAndTracks();
|
||||
@ -116,6 +118,7 @@ private:
|
||||
caf::PdmField<int> m_trajectoryType;
|
||||
caf::PdmPtrField<RimWellPath*> m_wellPath;
|
||||
caf::PdmField<QString> m_simWellName;
|
||||
caf::PdmField<bool> m_allow3DSelectionLink;
|
||||
caf::PdmField<int> m_branchIndex;
|
||||
caf::PdmField<caf::Tristate> m_branchDetection;
|
||||
caf::PdmField<int> m_timeStep;
|
||||
|
@ -79,3 +79,11 @@ RimWellLogPlot& RimWellLogPlot::operator=( RimWellLogPlot&& rhs )
|
||||
RimDepthTrackPlot::operator=( std::move( rhs ) );
|
||||
return *this;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogPlot::selectWell( QString wellName )
|
||||
{
|
||||
if ( m_commonDataSourceEnabled ) m_commonDataSource->selectSimWell( wellName );
|
||||
}
|
||||
|
@ -23,6 +23,8 @@
|
||||
|
||||
#include "RimDepthTrackPlot.h"
|
||||
|
||||
#include <QString>
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
@ -36,4 +38,6 @@ public:
|
||||
~RimWellLogPlot() override;
|
||||
|
||||
RimWellLogPlot& operator=( RimWellLogPlot&& rhs );
|
||||
|
||||
void selectWell( QString wellName );
|
||||
};
|
||||
|
@ -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 )
|
||||
|
Loading…
Reference in New Issue
Block a user