diff --git a/ApplicationLibCode/Commands/ViewLink/RicLinkVisibleViewsFeature.cpp b/ApplicationLibCode/Commands/ViewLink/RicLinkVisibleViewsFeature.cpp index cde23500b5..0c6c8163ed 100644 --- a/ApplicationLibCode/Commands/ViewLink/RicLinkVisibleViewsFeature.cpp +++ b/ApplicationLibCode/Commands/ViewLink/RicLinkVisibleViewsFeature.cpp @@ -28,6 +28,7 @@ #include "RimViewLinkerCollection.h" #include "Riu3DMainWindowTools.h" +#include "RiuViewer.h" #include "cafPdmUiPropertyViewDialog.h" @@ -113,13 +114,15 @@ void RicLinkVisibleViewsFeature::linkViews( std::vector& linkableVie Rim3dView* primaryView = viewLinker->masterView(); - auto matchingViews = RicLinkVisibleViewsFeature::matchingViews( primaryView, linkableViews ); + bool enableRotation = primaryView->viewer()->isNavigationRotationEnabled(); + auto matchingViews = RicLinkVisibleViewsFeature::matchingViews( primaryView, linkableViews ); for ( auto v : matchingViews ) { + enableRotation = enableRotation && v->viewer()->isNavigationRotationEnabled(); viewLinker->addDependentView( v ); } - viewLinker->updateDependentViews(); + viewLinker->updateDependentViews( enableRotation ); viewLinker->updateUiNameAndIcon(); proj->viewLinkerCollection.uiCapability()->updateConnectedEditors(); diff --git a/ApplicationLibCode/Commands/ViewLink/RicUnLinkViewFeature.cpp b/ApplicationLibCode/Commands/ViewLink/RicUnLinkViewFeature.cpp index d7b4806aba..b5dc3debf7 100644 --- a/ApplicationLibCode/Commands/ViewLink/RicUnLinkViewFeature.cpp +++ b/ApplicationLibCode/Commands/ViewLink/RicUnLinkViewFeature.cpp @@ -29,6 +29,8 @@ #include "RimViewLinker.h" #include "RimViewLinkerCollection.h" +#include "RiuViewer.h" + #include "cafCmdFeatureManager.h" #include "cafSelectionManager.h" @@ -90,11 +92,36 @@ void RicUnLinkViewFeature::onActionTriggered( bool isChecked ) RimProject::current()->viewLinkerCollection->viewLinker.removeChild( viewLinker ); delete viewLinker; + viewLinker = nullptr; } activeView->updateAutoName(); } - if ( dynamic_cast( activeView ) ) activeView->zoomAll(); + if ( dynamic_cast( activeView ) ) + { + activeView->zoomAll(); + } + else + { + activeView->viewer()->enableNavigationRotation( true ); + } + + if ( viewLinker ) + { + Rim3dView* primaryView = viewLinker->masterView(); + + bool enableRotation = dynamic_cast( primaryView ) != nullptr; + auto linkedViews = viewLinker->allViews(); + for ( auto v : linkedViews ) + { + enableRotation = enableRotation && dynamic_cast( v ) != nullptr; + } + if ( primaryView && primaryView->viewer() ) primaryView->viewer()->enableNavigationRotation( enableRotation ); + for ( auto v : linkedViews ) + { + if ( v->viewer() ) v->viewer()->enableNavigationRotation( enableRotation ); + } + } RimProject::current()->viewLinkerCollection.uiCapability()->updateConnectedEditors(); RimProject::current()->uiCapability()->updateConnectedEditors(); diff --git a/ApplicationLibCode/ProjectDataModel/RimViewLinker.cpp b/ApplicationLibCode/ProjectDataModel/RimViewLinker.cpp index f5c806a41f..074ba8e684 100644 --- a/ApplicationLibCode/ProjectDataModel/RimViewLinker.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimViewLinker.cpp @@ -314,15 +314,17 @@ void RimViewLinker::allViewsForCameraSync( const Rim3dView* source, std::vector< //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimViewLinker::updateDependentViews() +void RimViewLinker::updateDependentViews( bool enableRotation /*=true*/ ) { if ( m_viewControllers.empty() ) return; + m_masterView->viewer()->enableNavigationRotation( enableRotation ); + updateOverrides(); updateDuplicatedPropertyFilters(); updateCellResult(); updateScaleZ( m_masterView, m_masterView->scaleZ() ); - updateCamera( m_masterView ); + updateCamera( m_masterView, enableRotation ); updateTimeStep( m_masterView, m_masterView->currentTimeStep() ); } @@ -592,7 +594,7 @@ QList RimViewLinker::calculateValueOptions( const caf::P //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimViewLinker::updateCamera( Rim3dView* sourceView ) +void RimViewLinker::updateCamera( Rim3dView* sourceView, bool enableRotation /*=true*/ ) { if ( !sourceView || !sourceView->viewer() ) return; @@ -609,6 +611,10 @@ void RimViewLinker::updateCamera( Rim3dView* sourceView ) std::vector viewsToUpdate; allViewsForCameraSync( sourceView, viewsToUpdate ); + for ( auto v : viewsToUpdate ) + { + v->viewer()->enableNavigationRotation( enableRotation ); + } RimViewManipulator::applySourceViewCameraOnDestinationViews( sourceView, viewsToUpdate ); } diff --git a/ApplicationLibCode/ProjectDataModel/RimViewLinker.h b/ApplicationLibCode/ProjectDataModel/RimViewLinker.h index be0125aa06..7aa127d8cb 100644 --- a/ApplicationLibCode/ProjectDataModel/RimViewLinker.h +++ b/ApplicationLibCode/ProjectDataModel/RimViewLinker.h @@ -62,7 +62,7 @@ class RimViewLinker : public caf::PdmObject Rim3dView* masterView() const; void addDependentView( Rim3dView* view ); bool isFirstViewDependentOnSecondView( const Rim3dView* firstView, const Rim3dView* secondView ) const; - void updateDependentViews(); + void updateDependentViews( bool enableRotation = true ); void removeViewController( RimViewController* viewController ); Rim3dView* firstControlledView(); @@ -70,7 +70,7 @@ class RimViewLinker : public caf::PdmObject void updateWindowTitles(); void updateDuplicatedPropertyFilters(); - void updateCamera( Rim3dView* sourceView ); + void updateCamera( Rim3dView* sourceView, bool enableRoatation = true ); void updateTimeStep( Rim3dView* sourceView, int timeStep ); void updateScaleZ( Rim3dView* sourceView, double scaleZ ); diff --git a/ApplicationLibCode/UserInterface/RiuMainWindow.cpp b/ApplicationLibCode/UserInterface/RiuMainWindow.cpp index d1d8de2057..4946f3f091 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindow.cpp +++ b/ApplicationLibCode/UserInterface/RiuMainWindow.cpp @@ -954,6 +954,10 @@ void RiuMainWindow::slotRefreshViewActions() RimGridView* gridView = RiaApplication::instance()->activeGridView(); RimEclipseContourMapView* view2d = dynamic_cast( gridView ); bool enabled = gridView != nullptr && view2d == nullptr; + if ( ( gridView != nullptr ) && gridView->viewer() ) + { + enabled = enabled && gridView->viewer()->isNavigationRotationEnabled(); + } m_viewFromNorth->setEnabled( enabled ); m_viewFromSouth->setEnabled( enabled ); m_viewFromEast->setEnabled( enabled ); diff --git a/ApplicationLibCode/UserInterface/RiuViewer.cpp b/ApplicationLibCode/UserInterface/RiuViewer.cpp index d9b8733ae4..6ddcb58451 100644 --- a/ApplicationLibCode/UserInterface/RiuViewer.cpp +++ b/ApplicationLibCode/UserInterface/RiuViewer.cpp @@ -950,6 +950,14 @@ void RiuViewer::enableNavigationRotation( bool enable ) if ( tbNavPol ) tbNavPol->enableRotation( m_isNavigationRotationEnabled ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RiuViewer::isNavigationRotationEnabled() const +{ + return m_isNavigationRotationEnabled; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuViewer.h b/ApplicationLibCode/UserInterface/RiuViewer.h index a7bac0c1dd..d74d7cef6b 100644 --- a/ApplicationLibCode/UserInterface/RiuViewer.h +++ b/ApplicationLibCode/UserInterface/RiuViewer.h @@ -110,8 +110,9 @@ class RiuViewer : public caf::Viewer, public RiuInterfaceToViewWindow void addColorLegendToBottomLeftCorner( caf::TitledOverlayFrame* legend, bool isForComparisonView ); void removeColorLegend( caf::TitledOverlayFrame* legend ); - void enableNavigationRotation( bool disable ); + void enableNavigationRotation( bool enable ); void updateNavigationPolicy(); + bool isNavigationRotationEnabled() const; void navigationPolicyUpdate() override;