Link view updates

This commit is contained in:
Jon Jenssen 2024-12-05 11:41:06 +01:00 committed by jonjenssen
parent feba066b49
commit e0058a0872
7 changed files with 58 additions and 9 deletions

View File

@ -28,6 +28,7 @@
#include "RimViewLinkerCollection.h" #include "RimViewLinkerCollection.h"
#include "Riu3DMainWindowTools.h" #include "Riu3DMainWindowTools.h"
#include "RiuViewer.h"
#include "cafPdmUiPropertyViewDialog.h" #include "cafPdmUiPropertyViewDialog.h"
@ -113,13 +114,15 @@ void RicLinkVisibleViewsFeature::linkViews( std::vector<Rim3dView*>& linkableVie
Rim3dView* primaryView = viewLinker->masterView(); 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 ) for ( auto v : matchingViews )
{ {
enableRotation = enableRotation && v->viewer()->isNavigationRotationEnabled();
viewLinker->addDependentView( v ); viewLinker->addDependentView( v );
} }
viewLinker->updateDependentViews(); viewLinker->updateDependentViews( enableRotation );
viewLinker->updateUiNameAndIcon(); viewLinker->updateUiNameAndIcon();
proj->viewLinkerCollection.uiCapability()->updateConnectedEditors(); proj->viewLinkerCollection.uiCapability()->updateConnectedEditors();

View File

@ -29,6 +29,8 @@
#include "RimViewLinker.h" #include "RimViewLinker.h"
#include "RimViewLinkerCollection.h" #include "RimViewLinkerCollection.h"
#include "RiuViewer.h"
#include "cafCmdFeatureManager.h" #include "cafCmdFeatureManager.h"
#include "cafSelectionManager.h" #include "cafSelectionManager.h"
@ -90,11 +92,36 @@ void RicUnLinkViewFeature::onActionTriggered( bool isChecked )
RimProject::current()->viewLinkerCollection->viewLinker.removeChild( viewLinker ); RimProject::current()->viewLinkerCollection->viewLinker.removeChild( viewLinker );
delete viewLinker; delete viewLinker;
viewLinker = nullptr;
} }
activeView->updateAutoName(); activeView->updateAutoName();
} }
if ( dynamic_cast<RimEclipseContourMapView*>( activeView ) ) activeView->zoomAll(); if ( dynamic_cast<RimEclipseContourMapView*>( activeView ) )
{
activeView->zoomAll();
}
else
{
activeView->viewer()->enableNavigationRotation( true );
}
if ( viewLinker )
{
Rim3dView* primaryView = viewLinker->masterView();
bool enableRotation = dynamic_cast<RimEclipseContourMapView*>( primaryView ) != nullptr;
auto linkedViews = viewLinker->allViews();
for ( auto v : linkedViews )
{
enableRotation = enableRotation && dynamic_cast<RimEclipseContourMapView*>( 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()->viewLinkerCollection.uiCapability()->updateConnectedEditors();
RimProject::current()->uiCapability()->updateConnectedEditors(); RimProject::current()->uiCapability()->updateConnectedEditors();

View File

@ -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; if ( m_viewControllers.empty() ) return;
m_masterView->viewer()->enableNavigationRotation( enableRotation );
updateOverrides(); updateOverrides();
updateDuplicatedPropertyFilters(); updateDuplicatedPropertyFilters();
updateCellResult(); updateCellResult();
updateScaleZ( m_masterView, m_masterView->scaleZ() ); updateScaleZ( m_masterView, m_masterView->scaleZ() );
updateCamera( m_masterView ); updateCamera( m_masterView, enableRotation );
updateTimeStep( m_masterView, m_masterView->currentTimeStep() ); updateTimeStep( m_masterView, m_masterView->currentTimeStep() );
} }
@ -592,7 +594,7 @@ QList<caf::PdmOptionItemInfo> RimViewLinker::calculateValueOptions( const caf::P
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimViewLinker::updateCamera( Rim3dView* sourceView ) void RimViewLinker::updateCamera( Rim3dView* sourceView, bool enableRotation /*=true*/ )
{ {
if ( !sourceView || !sourceView->viewer() ) return; if ( !sourceView || !sourceView->viewer() ) return;
@ -609,6 +611,10 @@ void RimViewLinker::updateCamera( Rim3dView* sourceView )
std::vector<Rim3dView*> viewsToUpdate; std::vector<Rim3dView*> viewsToUpdate;
allViewsForCameraSync( sourceView, viewsToUpdate ); allViewsForCameraSync( sourceView, viewsToUpdate );
for ( auto v : viewsToUpdate )
{
v->viewer()->enableNavigationRotation( enableRotation );
}
RimViewManipulator::applySourceViewCameraOnDestinationViews( sourceView, viewsToUpdate ); RimViewManipulator::applySourceViewCameraOnDestinationViews( sourceView, viewsToUpdate );
} }

View File

@ -62,7 +62,7 @@ public:
Rim3dView* masterView() const; Rim3dView* masterView() const;
void addDependentView( Rim3dView* view ); void addDependentView( Rim3dView* view );
bool isFirstViewDependentOnSecondView( const Rim3dView* firstView, const Rim3dView* secondView ) const; bool isFirstViewDependentOnSecondView( const Rim3dView* firstView, const Rim3dView* secondView ) const;
void updateDependentViews(); void updateDependentViews( bool enableRotation = true );
void removeViewController( RimViewController* viewController ); void removeViewController( RimViewController* viewController );
Rim3dView* firstControlledView(); Rim3dView* firstControlledView();
@ -70,7 +70,7 @@ public:
void updateWindowTitles(); void updateWindowTitles();
void updateDuplicatedPropertyFilters(); void updateDuplicatedPropertyFilters();
void updateCamera( Rim3dView* sourceView ); void updateCamera( Rim3dView* sourceView, bool enableRoatation = true );
void updateTimeStep( Rim3dView* sourceView, int timeStep ); void updateTimeStep( Rim3dView* sourceView, int timeStep );
void updateScaleZ( Rim3dView* sourceView, double scaleZ ); void updateScaleZ( Rim3dView* sourceView, double scaleZ );

View File

@ -954,6 +954,10 @@ void RiuMainWindow::slotRefreshViewActions()
RimGridView* gridView = RiaApplication::instance()->activeGridView(); RimGridView* gridView = RiaApplication::instance()->activeGridView();
RimEclipseContourMapView* view2d = dynamic_cast<RimEclipseContourMapView*>( gridView ); RimEclipseContourMapView* view2d = dynamic_cast<RimEclipseContourMapView*>( gridView );
bool enabled = gridView != nullptr && view2d == nullptr; bool enabled = gridView != nullptr && view2d == nullptr;
if ( ( gridView != nullptr ) && gridView->viewer() )
{
enabled = enabled && gridView->viewer()->isNavigationRotationEnabled();
}
m_viewFromNorth->setEnabled( enabled ); m_viewFromNorth->setEnabled( enabled );
m_viewFromSouth->setEnabled( enabled ); m_viewFromSouth->setEnabled( enabled );
m_viewFromEast->setEnabled( enabled ); m_viewFromEast->setEnabled( enabled );

View File

@ -950,6 +950,14 @@ void RiuViewer::enableNavigationRotation( bool enable )
if ( tbNavPol ) tbNavPol->enableRotation( m_isNavigationRotationEnabled ); if ( tbNavPol ) tbNavPol->enableRotation( m_isNavigationRotationEnabled );
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RiuViewer::isNavigationRotationEnabled() const
{
return m_isNavigationRotationEnabled;
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -110,8 +110,9 @@ public:
void addColorLegendToBottomLeftCorner( caf::TitledOverlayFrame* legend, bool isForComparisonView ); void addColorLegendToBottomLeftCorner( caf::TitledOverlayFrame* legend, bool isForComparisonView );
void removeColorLegend( caf::TitledOverlayFrame* legend ); void removeColorLegend( caf::TitledOverlayFrame* legend );
void enableNavigationRotation( bool disable ); void enableNavigationRotation( bool enable );
void updateNavigationPolicy(); void updateNavigationPolicy();
bool isNavigationRotationEnabled() const;
void navigationPolicyUpdate() override; void navigationPolicyUpdate() override;