diff --git a/ApplicationExeCode/Resources/ResInsight.qrc b/ApplicationExeCode/Resources/ResInsight.qrc index 43b65ba1ff..99b385e91f 100644 --- a/ApplicationExeCode/Resources/ResInsight.qrc +++ b/ApplicationExeCode/Resources/ResInsight.qrc @@ -194,6 +194,7 @@ draw_style_meshlines_24x24.png draw_style_surface_24x24.png draw_style_surface_w_fault_mesh_24x24.png + draw_style_deformation_24x24.png DrawStyleLines.svg DrawStyleMeshLines.svg DrawStyleSurface.svg @@ -269,8 +270,8 @@ AppendNextCurve.png AppendPrevCurve.png CheckOverlay16x16.png - Link3DandPlots.png - info.png + Link3DandPlots.png + info.png fs_CellFace.glsl diff --git a/ApplicationExeCode/Resources/draw_style_deformation_24x24.png b/ApplicationExeCode/Resources/draw_style_deformation_24x24.png new file mode 100644 index 0000000000..bcd2594139 Binary files /dev/null and b/ApplicationExeCode/Resources/draw_style_deformation_24x24.png differ diff --git a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechView.cpp b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechView.cpp index 7b441c5379..f280e98222 100644 --- a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechView.cpp +++ b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechView.cpp @@ -1014,7 +1014,6 @@ void RimGeoMechView::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& nameConfig()->uiOrdering( uiConfigName, *nameGroup ); auto displacementGroup = uiOrdering.addNewGroup( "Displacements" ); - displacementGroup->add( &m_showDisplacement ); displacementGroup->add( &m_displacementScaling ); } @@ -1079,3 +1078,12 @@ bool RimGeoMechView::showDisplacements() const { return m_showDisplacement; } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimGeoMechView::setShowDisplacementsAndUpdate( bool show ) +{ + m_showDisplacement = show; + createDisplayModelAndRedraw(); +} diff --git a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechView.h b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechView.h index 941ca92b33..0fd8f6b4ba 100644 --- a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechView.h +++ b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechView.h @@ -110,6 +110,7 @@ public: double displacementScaleFactor() const; bool showDisplacements() const; + void setShowDisplacementsAndUpdate( bool show ); protected: void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; diff --git a/ApplicationLibCode/UserInterface/RiuMainWindow.cpp b/ApplicationLibCode/UserInterface/RiuMainWindow.cpp index 7edf92da7f..07392e9e88 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindow.cpp +++ b/ApplicationLibCode/UserInterface/RiuMainWindow.cpp @@ -387,18 +387,19 @@ void RiuMainWindow::createActions() m_dsActionGroup = new QActionGroup( this ); m_drawStyleLinesAction = new QAction( QIcon( ":/DrawStyleLines.svg" ), "&Mesh Only", this ); - // connect(m_drawStyleLinesAction, SIGNAL(triggered()), SLOT(slotDrawStyleLines())); m_dsActionGroup->addAction( m_drawStyleLinesAction ); m_drawStyleLinesSolidAction = new QAction( QIcon( ":/DrawStyleMeshLines.svg" ), "Mesh And Surfaces", this ); - // connect(m_drawStyleLinesSolidAction, SIGNAL(triggered()), SLOT(slotDrawStyleLinesSolid())); m_dsActionGroup->addAction( m_drawStyleLinesSolidAction ); m_drawStyleSurfOnlyAction = new QAction( QIcon( ":/DrawStyleSurface.svg" ), "&Surface Only", this ); - new QAction( QIcon( ":/draw_style_surface_w_fault_mesh_24x24.png" ), "Fault Mesh And Surfaces", this ); - // connect(m_drawStyleSurfOnlyAction, SIGNAL(triggered()), SLOT(slotDrawStyleSurfOnly())); m_dsActionGroup->addAction( m_drawStyleSurfOnlyAction ); + m_drawStyleDeformationsAction = + new QAction( QIcon( ":/draw_style_deformation_24x24.png" ), "Show &Displacements", this ); + m_drawStyleDeformationsAction->setCheckable( true ); + m_dsActionGroup->addAction( m_drawStyleDeformationsAction ); + connect( m_dsActionGroup, SIGNAL( triggered( QAction* ) ), SLOT( slotDrawStyleChanged( QAction* ) ) ); m_drawStyleFaultLinesSolidAction = @@ -688,6 +689,7 @@ void RiuMainWindow::createToolBars() dsToolBar->addAction( m_drawStyleHideGridCellsAction ); dsToolBar->addAction( m_toggleFaultsLabelAction ); dsToolBar->addAction( m_showWellCellsAction ); + dsToolBar->addAction( m_drawStyleDeformationsAction ); } { @@ -1556,6 +1558,17 @@ void RiuMainWindow::slotDrawStyleChanged( QAction* activatedAction ) { RiaApplication::instance()->activeReservoirView()->setFaultMeshSurfDrawstyle(); } + else if ( activatedAction == m_drawStyleDeformationsAction ) + { + RimGeoMechView* geoMechView = dynamic_cast( RiaApplication::instance()->activeReservoirView() ); + if ( geoMechView ) + { + geoMechView->setShowDisplacementsAndUpdate( !geoMechView->showDisplacements() ); + m_drawStyleDeformationsAction->blockSignals( true ); + m_drawStyleDeformationsAction->setChecked( geoMechView->showDisplacements() ); + m_drawStyleDeformationsAction->blockSignals( false ); + } + } } //-------------------------------------------------------------------------------------------------- @@ -1600,6 +1613,7 @@ void RiuMainWindow::refreshDrawStyleActions() { RimGridView* gridView = RiaApplication::instance()->activeGridView(); RimEclipseContourMapView* view2d = dynamic_cast( gridView ); + RimGeoMechView* geoMechView = dynamic_cast( gridView ); bool is2dMap = view2d != nullptr; bool is3dGridView = gridView != nullptr && !is2dMap; @@ -1610,6 +1624,7 @@ void RiuMainWindow::refreshDrawStyleActions() m_drawStyleLinesSolidAction->setEnabled( is3dView ); m_drawStyleSurfOnlyAction->setEnabled( is3dView ); m_drawStyleFaultLinesSolidAction->setEnabled( is3dView ); + m_drawStyleDeformationsAction->setVisible( geoMechView != nullptr ); m_enableLightingAction->setEnabled( is3dView ); bool lightingEnabled = view ? !view->isLightingDisabled() : true; @@ -1665,6 +1680,13 @@ void RiuMainWindow::refreshDrawStyleActions() m_toggleFaultsLabelAction->setChecked( eclView->faultCollection()->showFaultLabel() ); m_toggleFaultsLabelAction->blockSignals( false ); } + + if ( geoMechView ) + { + m_drawStyleDeformationsAction->blockSignals( true ); + m_drawStyleDeformationsAction->setChecked( geoMechView->showDisplacements() ); + m_drawStyleDeformationsAction->blockSignals( false ); + } } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuMainWindow.h b/ApplicationLibCode/UserInterface/RiuMainWindow.h index 91a7040719..fcee8bf001 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindow.h +++ b/ApplicationLibCode/UserInterface/RiuMainWindow.h @@ -269,6 +269,7 @@ private: QAction* m_drawStyleFaultLinesSolidAction; QAction* m_drawStyleSurfOnlyAction; QAction* m_showWellCellsAction; + QAction* m_drawStyleDeformationsAction; QToolBar* m_holoLensToolBar;