#2412 2D Navigation only for Intersectino Views

This commit is contained in:
Jacob Støren
2018-01-26 14:33:32 +01:00
parent b1bbbc2aeb
commit 5640f91b68
10 changed files with 26 additions and 6 deletions

View File

@@ -59,7 +59,7 @@ bool RiuCadNavigation::handleInputEvent(QInputEvent* inputEvent)
int translatedMousePosX, translatedMousePosY;
cvfEventPos(me->x(), me->y(), &translatedMousePosX, &translatedMousePosY);
if (me->button() == Qt::MidButton && me->modifiers() == Qt::NoModifier)
if (me->button() == Qt::MidButton && me->modifiers() == Qt::NoModifier && isRotationEnabled())
{
cvf::HitItemCollection hic;
bool hitSomething = m_viewer->rayPick( me->x(), me->y(), &hic);

View File

@@ -59,7 +59,7 @@ bool RiuGeoQuestNavigation::handleInputEvent(QInputEvent* inputEvent)
int translatedMousePosX, translatedMousePosY;
cvfEventPos(me->x(), me->y(), &translatedMousePosX, &translatedMousePosY);
if (me->button() == Qt::LeftButton)
if (me->button() == Qt::LeftButton && isRotationEnabled())
{
cvf::HitItemCollection hic;
bool hitSomething = m_viewer->rayPick(me->x(), me->y(), &hic);

View File

@@ -59,7 +59,7 @@ bool RiuRmsNavigation::handleInputEvent(QInputEvent* inputEvent)
int translatedMousePosX, translatedMousePosY;
cvfEventPos(me->x(), me->y(), &translatedMousePosX, &translatedMousePosY);
if (me->button() == Qt::MidButton)
if (me->button() == Qt::MidButton && isRotationEnabled())
{
cvf::HitItemCollection hic;
bool hitSomething = m_viewer->rayPick(me->x(), me->y(), &hic);

View File

@@ -79,7 +79,7 @@ const double RI_MIN_NEARPLANE_DISTANCE = 0.1;
///
//--------------------------------------------------------------------------------------------------
RiuViewer::RiuViewer(const QGLFormat& format, QWidget* parent)
: caf::Viewer(format, parent)
: caf::Viewer(format, parent), m_isNavigationRotationEnabled(true)
{
cvf::Font* standardFont = RiaApplication::instance()->standardFont();
m_axisCross = new cvf::OverlayAxisCross(m_mainCamera.p(), standardFont);
@@ -589,6 +589,17 @@ void RiuViewer::addColorLegendToBottomLeftCorner(cvf::OverlayItem* legend)
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuViewer::enableNavigationRotation(bool enable)
{
auto tbNavPol = dynamic_cast<caf::TrackBallBasedNavigation*>(m_navigationPolicy.p());
m_isNavigationRotationEnabled = enable;
if (tbNavPol) tbNavPol->enableRotation(m_isNavigationRotationEnabled);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -616,6 +627,8 @@ void RiuViewer::updateNavigationPolicy()
CVF_ASSERT(0);
break;
}
enableNavigationRotation(m_isNavigationRotationEnabled);
}
//--------------------------------------------------------------------------------------------------

View File

@@ -91,6 +91,7 @@ public:
void removeAllColorLegends();
void addColorLegendToBottomLeftCorner(cvf::OverlayItem* legend);
void enableNavigationRotation(bool disable);
void updateNavigationPolicy();
virtual void navigationPolicyUpdate(); // Override of caf::Viewer::navigationPolicyUpdate()
@@ -156,5 +157,6 @@ private:
RivGridBoxGenerator* m_gridBoxGenerator;
cvf::Vec3d m_cursorPositionDomainCoords;
bool m_isNavigationRotationEnabled;
};