Skip to content

Commit

Permalink
Link view updates
Browse files Browse the repository at this point in the history
  • Loading branch information
jonjenssen committed Dec 5, 2024
1 parent 4d8be69 commit 8b49c9f
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "RimViewLinkerCollection.h"

#include "Riu3DMainWindowTools.h"
#include "RiuViewer.h"

#include "cafPdmUiPropertyViewDialog.h"

Expand Down Expand Up @@ -113,13 +114,15 @@ void RicLinkVisibleViewsFeature::linkViews( std::vector<Rim3dView*>& 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();
Expand Down
29 changes: 28 additions & 1 deletion ApplicationLibCode/Commands/ViewLink/RicUnLinkViewFeature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
#include "RimViewLinker.h"
#include "RimViewLinkerCollection.h"

#include "RiuViewer.h"

#include "cafCmdFeatureManager.h"
#include "cafSelectionManager.h"

Expand Down Expand Up @@ -90,11 +92,36 @@ void RicUnLinkViewFeature::onActionTriggered( bool isChecked )
RimProject::current()->viewLinkerCollection->viewLinker.removeChild( viewLinker );

delete viewLinker;
viewLinker = nullptr;
}
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()->uiCapability()->updateConnectedEditors();
Expand Down
12 changes: 9 additions & 3 deletions ApplicationLibCode/ProjectDataModel/RimViewLinker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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() );
}

Expand Down Expand Up @@ -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;

Expand All @@ -609,6 +611,10 @@ void RimViewLinker::updateCamera( Rim3dView* sourceView )

std::vector<Rim3dView*> viewsToUpdate;
allViewsForCameraSync( sourceView, viewsToUpdate );
for ( auto v : viewsToUpdate )
{
v->viewer()->enableNavigationRotation( enableRotation );
}

RimViewManipulator::applySourceViewCameraOnDestinationViews( sourceView, viewsToUpdate );
}
Expand Down
4 changes: 2 additions & 2 deletions ApplicationLibCode/ProjectDataModel/RimViewLinker.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,15 @@ 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();

void updateOverrides();
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 );

Expand Down
4 changes: 4 additions & 0 deletions ApplicationLibCode/UserInterface/RiuMainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -954,6 +954,10 @@ void RiuMainWindow::slotRefreshViewActions()
RimGridView* gridView = RiaApplication::instance()->activeGridView();
RimEclipseContourMapView* view2d = dynamic_cast<RimEclipseContourMapView*>( 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 );
Expand Down
8 changes: 8 additions & 0 deletions ApplicationLibCode/UserInterface/RiuViewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -950,6 +950,14 @@ void RiuViewer::enableNavigationRotation( bool enable )
if ( tbNavPol ) tbNavPol->enableRotation( m_isNavigationRotationEnabled );
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RiuViewer::isNavigationRotationEnabled() const
{
return m_isNavigationRotationEnabled;
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
Expand Down
3 changes: 2 additions & 1 deletion ApplicationLibCode/UserInterface/RiuViewer.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 8b49c9f

Please sign in to comment.