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

@@ -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);