Skip to content

Commit

Permalink
Add updateScreenSpaceModel
Browse files Browse the repository at this point in the history
  • Loading branch information
magnesj committed Sep 11, 2023
1 parent d87db2b commit 36e7589
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 18 deletions.
55 changes: 37 additions & 18 deletions ApplicationLibCode/ProjectDataModel/Rim3dView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -698,6 +698,8 @@ void Rim3dView::updateDisplayModelForCurrentTimeStepAndRedraw()
restoreComparisonView();
}

updateScreenSpaceModel();

nativeOrOverrideViewer()->update();
}

Expand Down Expand Up @@ -762,6 +764,8 @@ void Rim3dView::createDisplayModelAndRedraw()
viewer()->setMainScene( nullptr, true );
viewer()->removeAllFrames( true );
}

updateScreenSpaceModel();
}

if ( RiuMainWindow::instance() )
Expand Down Expand Up @@ -924,24 +928,7 @@ bool Rim3dView::isLightingDisabled() const
//--------------------------------------------------------------------------------------------------
void Rim3dView::onViewNavigationChanged()
{
if ( !m_viewer || !m_viewer->mainCamera() ) return;

if ( m_screenSpaceModel.isNull() )
{
m_screenSpaceModel = new cvf::ModelBasicList;
m_screenSpaceModel->setName( "ScreenSpaceModel" );
}
m_screenSpaceModel->removeAllParts();

// Build annotation parts and put into screen space model
cvf::Collection<cvf::Part> partCollection;
m_viewer->currentScene()->allParts( &partCollection );

RivAnnotationTools annoTool( m_annotationStrategy() );
annoTool.setCountHint( m_annotationCountHint() );
annoTool.addAnnotationLabels( partCollection, m_viewer->mainCamera(), m_screenSpaceModel.p() );

nativeOrOverrideViewer()->addStaticModelOnce( m_screenSpaceModel.p(), isUsingOverrideViewer() );
updateScreenSpaceModel();
}

//--------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -1067,6 +1054,13 @@ void Rim3dView::fieldChangedByUi( const caf::PdmFieldHandle* changedField, const
{
createDisplayModelAndRedraw();
}
else if ( changedField == &m_annotationCountHint || changedField == &m_annotationStrategy )
{
if ( m_viewer )
{
m_viewer->update();
}
}
}

//--------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -1682,6 +1676,31 @@ void Rim3dView::appendAnnotationsToModel()
}
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void Rim3dView::updateScreenSpaceModel()
{
if ( !m_viewer || !m_viewer->mainCamera() ) return;

if ( m_screenSpaceModel.isNull() )
{
m_screenSpaceModel = new cvf::ModelBasicList;
m_screenSpaceModel->setName( "ScreenSpaceModel" );
}
m_screenSpaceModel->removeAllParts();

// Build annotation parts and put into screen space model
cvf::Collection<cvf::Part> partCollection;
m_viewer->currentScene()->allParts( &partCollection );

RivAnnotationTools annoTool( m_annotationStrategy() );
annoTool.setCountHint( m_annotationCountHint() );
annoTool.addAnnotationLabels( partCollection, m_viewer->mainCamera(), m_screenSpaceModel.p() );

nativeOrOverrideViewer()->addStaticModelOnce( m_screenSpaceModel.p(), isUsingOverrideViewer() );
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions ApplicationLibCode/ProjectDataModel/Rim3dView.h
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,7 @@ class Rim3dView : public RimViewWindow, public RiuViewerToViewInterface, public
void appendMeasurementToModel();
void appendCellFiltersToModel();
void appendAnnotationsToModel();
void updateScreenSpaceModel();

// Pure private methods : Override viewer and comparison view

Expand Down

0 comments on commit 36e7589

Please sign in to comment.