Created navigationPolicyUpdate to be used from navigation policies

This commit is contained in:
Magne Sjaastad 2015-09-01 18:04:35 +02:00
parent a1f5d44f56
commit 4730e10319
14 changed files with 25 additions and 42 deletions

View File

@ -75,7 +75,7 @@ void Rim3dOverlayInfoConfig::fieldChangedByUi(const caf::PdmFieldHandle* changed
if (m_viewDef && m_viewDef->viewer())
{
m_viewDef->viewer()->issueBaseClassUpdate();
m_viewDef->viewer()->update();
}
}

View File

@ -792,7 +792,7 @@ void RimEclipseView::updateDisplayModelVisibility()
}
m_viewer->setEnableMask(mask);
m_viewer->issueBaseClassUpdate();
m_viewer->update();
faultCollection->updateConnectedEditors();
}

View File

@ -352,8 +352,7 @@ void RimGeoMechView::updateDisplayModelVisibility()
}
m_viewer->setEnableMask(mask);
m_viewer->issueBaseClassUpdate();
m_viewer->update();
}
//--------------------------------------------------------------------------------------------------

View File

@ -156,7 +156,7 @@ void RimView::updateViewerWidget()
if (isViewerCreated) m_viewer->mainCamera()->setViewMatrix(cameraPosition);
m_viewer->mainCamera()->viewport()->setClearColor(cvf::Color4f(backgroundColor()));
m_viewer->issueBaseClassUpdate();
m_viewer->update();
}
else
{
@ -203,7 +203,7 @@ void RimView::updateCurrentTimeStepAndRedraw()
{
this->updateCurrentTimeStep();
if (m_viewer) m_viewer->issueBaseClassUpdate();
if (m_viewer) m_viewer->update();
}
//--------------------------------------------------------------------------------------------------
@ -426,7 +426,7 @@ void RimView::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QV
updateScaleTransform();
createDisplayModelAndRedraw();
m_viewer->issueBaseClassUpdate();
m_viewer->update();
}
RiuMainWindow::instance()->updateScaleValue();
@ -450,7 +450,7 @@ void RimView::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QV
{
if (m_viewer)
{
m_viewer->issueBaseClassUpdate();
m_viewer->update();
RimProject* proj = NULL;
this->firstAnchestorOrThisOfType(proj);

View File

@ -133,7 +133,7 @@ bool RiuCadNavigation::handleInputEvent(QInputEvent* inputEvent)
bool needRedraw = m_trackball->updateNavigation(translatedMousePosX, translatedMousePosY);
if (needRedraw)
{
m_viewer->update();
m_viewer->navigationPolicyUpdate();
m_navigationUpdated = true;
}
isEventHandled = true;
@ -169,7 +169,7 @@ bool RiuCadNavigation::handleInputEvent(QInputEvent* inputEvent)
cvf::Vec3d newVrp = vrp + trans;
m_viewer->mainCamera()->setFromLookAt(newPos,newVrp, up );
m_viewer->update();
m_viewer->navigationPolicyUpdate();
}
}
isEventHandled = true;

View File

@ -134,7 +134,7 @@ bool RiuGeoQuestNavigation::handleInputEvent(QInputEvent* inputEvent)
bool needRedraw = m_trackball->updateNavigation(translatedMousePosX, translatedMousePosY);
if (needRedraw)
{
m_viewer->update();
m_viewer->navigationPolicyUpdate();
}
}
isEventHandled = true;
@ -245,6 +245,6 @@ void RiuGeoQuestNavigation::zoomAlongRay(cvf::Ray* ray, int delta)
cvf::Vec3d newVrp = vrp + trans;
m_viewer->mainCamera()->setFromLookAt(newPos, newVrp, up );
m_viewer->update();
m_viewer->navigationPolicyUpdate();
}
}

View File

@ -158,7 +158,7 @@ bool RiuRmsNavigation::handleInputEvent(QInputEvent* inputEvent)
bool needRedraw = m_trackball->updateNavigation(translatedMousePosX, translatedMousePosY);
if (needRedraw)
{
m_viewer->update();
m_viewer->navigationPolicyUpdate();
}
}
isEventHandled = true;
@ -269,6 +269,6 @@ void RiuRmsNavigation::zoomAlongRay(cvf::Ray* ray, int delta)
cvf::Vec3d newVrp = vrp + trans;
m_viewer->mainCamera()->setFromLookAt(newPos, newVrp, up );
m_viewer->update();
m_viewer->navigationPolicyUpdate();
}
}

View File

@ -501,7 +501,7 @@ void RiuViewer::updateNavigationPolicy()
///
/// All other updates should be redirected to caf::OpenGLWidget::update()
//--------------------------------------------------------------------------------------------------
void RiuViewer::update()
void RiuViewer::navigationPolicyUpdate()
{
std::vector<RimView*> viewsToUpdate;
@ -542,24 +542,11 @@ void RiuViewer::update()
{
viewsToUpdate[i]->viewer()->mainCamera()->setViewMatrix(mat);
// Make sure to call update on the base class of caf::Viewer to avoid calling
// a virtual method and infinite recursion
viewsToUpdate[i]->viewer()->issueBaseClassUpdate();
viewsToUpdate[i]->viewer()->update();
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuViewer::issueBaseClassUpdate()
{
// Call update on the base class of caf::Viewer
// as caf::Viewer::update() is a virtual function
caf::OpenGLWidget::update();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -73,9 +73,7 @@ public:
void updateNavigationPolicy();
virtual void update(); // Override of caf::Viewer::update()
void issueBaseClassUpdate();
virtual void navigationPolicyUpdate(); // Override of caf::Viewer::navigationPolicyUpdate()
void setCurrentFrame(int frameIndex);

View File

@ -137,7 +137,7 @@ bool caf::CadNavigation::handleInputEvent(QInputEvent* inputEvent)
bool needRedraw = m_trackball->updateNavigation(translatedMousePosX, translatedMousePosY);
if (needRedraw)
{
m_viewer->update();
m_viewer->navigationPolicyUpdate();
}
isEventHandled = true;
}
@ -172,7 +172,7 @@ bool caf::CadNavigation::handleInputEvent(QInputEvent* inputEvent)
cvf::Vec3d newVrp = vrp + trans;
m_viewer->mainCamera()->setFromLookAt(newPos,newVrp, up );
m_viewer->update();
m_viewer->navigationPolicyUpdate();
}
}
isEventHandled = true;

View File

@ -140,7 +140,7 @@ void caf::CeetronNavigation::mouseMoveEvent(QMouseEvent* event)
bool needRedraw = m_trackball->updateNavigation(posX, posY);
if (needRedraw)
{
m_viewer->update();
m_viewer->navigationPolicyUpdate();
}
setCursorFromCurrentState();
@ -208,7 +208,7 @@ void caf::CeetronNavigation::wheelEvent(QWheelEvent* event)
m_trackball->updateNavigation(event->x(), posY + navDelta);
m_trackball->endNavigation();
m_viewer->update();
m_viewer->navigationPolicyUpdate();
event->accept();
}

View File

@ -146,7 +146,7 @@ bool caf::CeetronPlusNavigation::handleInputEvent(QInputEvent* inputEvent)
bool needRedraw = m_trackball->updateNavigation(translatedMousePosX, translatedMousePosY);
if (needRedraw)
{
m_viewer->update();
m_viewer->navigationPolicyUpdate();
}
}
isEventHandled = true;
@ -257,6 +257,6 @@ void caf::CeetronPlusNavigation::zoomAlongRay(cvf::Ray* ray, int delta)
cvf::Vec3d newVrp = vrp + trans;
m_viewer->mainCamera()->setFromLookAt(newPos, newVrp, up );
m_viewer->update();
m_viewer->navigationPolicyUpdate();
}
}

View File

@ -807,10 +807,9 @@ void caf::Viewer::updateOverlayImagePresence()
//--------------------------------------------------------------------------------------------------
/// Create a virtual method so it is possible to override this function in derived classes
/// Default implementation calls the base class update()
//--------------------------------------------------------------------------------------------------
void caf::Viewer::update()
void caf::Viewer::navigationPolicyUpdate()
{
caf::OpenGLWidget::update();
update();
}

View File

@ -131,7 +131,7 @@ public:
// Find out whether the system supports shaders
static bool isShadersSupported();
virtual void update();
virtual void navigationPolicyUpdate();
public slots:
virtual void slotSetCurrentFrame(int frameIndex);