mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#2412 2D Navigation only for Intersectino Views
This commit is contained in:
@@ -340,6 +340,7 @@ void Rim2dIntersectionView::resetLegendsInViewer()
|
|||||||
m_viewer->showInfoText(false);
|
m_viewer->showInfoText(false);
|
||||||
|
|
||||||
m_viewer->setMainScene(new cvf::Scene());
|
m_viewer->setMainScene(new cvf::Scene());
|
||||||
|
m_viewer->enableNavigationRotation(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ bool RiuCadNavigation::handleInputEvent(QInputEvent* inputEvent)
|
|||||||
int translatedMousePosX, translatedMousePosY;
|
int translatedMousePosX, translatedMousePosY;
|
||||||
cvfEventPos(me->x(), me->y(), &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;
|
cvf::HitItemCollection hic;
|
||||||
bool hitSomething = m_viewer->rayPick( me->x(), me->y(), &hic);
|
bool hitSomething = m_viewer->rayPick( me->x(), me->y(), &hic);
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ bool RiuGeoQuestNavigation::handleInputEvent(QInputEvent* inputEvent)
|
|||||||
int translatedMousePosX, translatedMousePosY;
|
int translatedMousePosX, translatedMousePosY;
|
||||||
cvfEventPos(me->x(), me->y(), &translatedMousePosX, &translatedMousePosY);
|
cvfEventPos(me->x(), me->y(), &translatedMousePosX, &translatedMousePosY);
|
||||||
|
|
||||||
if (me->button() == Qt::LeftButton)
|
if (me->button() == Qt::LeftButton && isRotationEnabled())
|
||||||
{
|
{
|
||||||
cvf::HitItemCollection hic;
|
cvf::HitItemCollection hic;
|
||||||
bool hitSomething = m_viewer->rayPick(me->x(), me->y(), &hic);
|
bool hitSomething = m_viewer->rayPick(me->x(), me->y(), &hic);
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ bool RiuRmsNavigation::handleInputEvent(QInputEvent* inputEvent)
|
|||||||
int translatedMousePosX, translatedMousePosY;
|
int translatedMousePosX, translatedMousePosY;
|
||||||
cvfEventPos(me->x(), me->y(), &translatedMousePosX, &translatedMousePosY);
|
cvfEventPos(me->x(), me->y(), &translatedMousePosX, &translatedMousePosY);
|
||||||
|
|
||||||
if (me->button() == Qt::MidButton)
|
if (me->button() == Qt::MidButton && isRotationEnabled())
|
||||||
{
|
{
|
||||||
cvf::HitItemCollection hic;
|
cvf::HitItemCollection hic;
|
||||||
bool hitSomething = m_viewer->rayPick(me->x(), me->y(), &hic);
|
bool hitSomething = m_viewer->rayPick(me->x(), me->y(), &hic);
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ const double RI_MIN_NEARPLANE_DISTANCE = 0.1;
|
|||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RiuViewer::RiuViewer(const QGLFormat& format, QWidget* parent)
|
RiuViewer::RiuViewer(const QGLFormat& format, QWidget* parent)
|
||||||
: caf::Viewer(format, parent)
|
: caf::Viewer(format, parent), m_isNavigationRotationEnabled(true)
|
||||||
{
|
{
|
||||||
cvf::Font* standardFont = RiaApplication::instance()->standardFont();
|
cvf::Font* standardFont = RiaApplication::instance()->standardFont();
|
||||||
m_axisCross = new cvf::OverlayAxisCross(m_mainCamera.p(), 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);
|
CVF_ASSERT(0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enableNavigationRotation(m_isNavigationRotationEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -91,6 +91,7 @@ public:
|
|||||||
void removeAllColorLegends();
|
void removeAllColorLegends();
|
||||||
void addColorLegendToBottomLeftCorner(cvf::OverlayItem* legend);
|
void addColorLegendToBottomLeftCorner(cvf::OverlayItem* legend);
|
||||||
|
|
||||||
|
void enableNavigationRotation(bool disable);
|
||||||
void updateNavigationPolicy();
|
void updateNavigationPolicy();
|
||||||
|
|
||||||
virtual void navigationPolicyUpdate(); // Override of caf::Viewer::navigationPolicyUpdate()
|
virtual void navigationPolicyUpdate(); // Override of caf::Viewer::navigationPolicyUpdate()
|
||||||
@@ -156,5 +157,6 @@ private:
|
|||||||
RivGridBoxGenerator* m_gridBoxGenerator;
|
RivGridBoxGenerator* m_gridBoxGenerator;
|
||||||
|
|
||||||
cvf::Vec3d m_cursorPositionDomainCoords;
|
cvf::Vec3d m_cursorPositionDomainCoords;
|
||||||
|
bool m_isNavigationRotationEnabled;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ bool caf::CadNavigation::handleInputEvent(QInputEvent* inputEvent)
|
|||||||
int translatedMousePosX, translatedMousePosY;
|
int translatedMousePosX, translatedMousePosY;
|
||||||
cvfEventPos(me->x(), me->y(), &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;
|
cvf::HitItemCollection hic;
|
||||||
bool hitSomething = m_viewer->rayPick( me->x(), me->y(), &hic);
|
bool hitSomething = m_viewer->rayPick( me->x(), me->y(), &hic);
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ bool caf::CeetronPlusNavigation::handleInputEvent(QInputEvent* inputEvent)
|
|||||||
int translatedMousePosX, translatedMousePosY;
|
int translatedMousePosX, translatedMousePosY;
|
||||||
cvfEventPos(me->x(), me->y(), &translatedMousePosX, &translatedMousePosY);
|
cvfEventPos(me->x(), me->y(), &translatedMousePosX, &translatedMousePosY);
|
||||||
|
|
||||||
if (me->button() == Qt::RightButton)
|
if (me->button() == Qt::RightButton && isRotationEnabled())
|
||||||
{
|
{
|
||||||
cvf::HitItemCollection hic;
|
cvf::HitItemCollection hic;
|
||||||
bool hitSomething = m_viewer->rayPick( me->x(), me->y(), &hic);
|
bool hitSomething = m_viewer->rayPick( me->x(), me->y(), &hic);
|
||||||
|
|||||||
@@ -78,6 +78,7 @@ void caf::TrackBallBasedNavigation::init()
|
|||||||
m_trackball = new cvf::ManipulatorTrackball;
|
m_trackball = new cvf::ManipulatorTrackball;
|
||||||
m_trackball->setCamera(m_viewer->mainCamera());
|
m_trackball->setCamera(m_viewer->mainCamera());
|
||||||
m_isRotCenterInitialized = false;
|
m_isRotCenterInitialized = false;
|
||||||
|
m_isRotationEnabled = true;
|
||||||
m_hasMovedMouseDuringNavigation = false;
|
m_hasMovedMouseDuringNavigation = false;
|
||||||
m_isNavigating = false;
|
m_isNavigating = false;
|
||||||
m_isZooming = false;
|
m_isZooming = false;
|
||||||
|
|||||||
@@ -59,6 +59,7 @@ public:
|
|||||||
TrackBallBasedNavigation();
|
TrackBallBasedNavigation();
|
||||||
virtual ~TrackBallBasedNavigation();
|
virtual ~TrackBallBasedNavigation();
|
||||||
void enableEventEating(bool enable) { m_consumeEvents = enable; }
|
void enableEventEating(bool enable) { m_consumeEvents = enable; }
|
||||||
|
void enableRotation(bool enable) { m_isRotationEnabled = enable; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// General navigation policy overrides
|
// General navigation policy overrides
|
||||||
@@ -88,9 +89,11 @@ protected:
|
|||||||
int m_lastPosY;
|
int m_lastPosY;
|
||||||
|
|
||||||
bool isSupposedToConsumeEvents() { return m_consumeEvents; }
|
bool isSupposedToConsumeEvents() { return m_consumeEvents; }
|
||||||
|
bool isRotationEnabled() { return m_isRotationEnabled; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_consumeEvents;
|
bool m_consumeEvents;
|
||||||
|
bool m_isRotationEnabled;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // End namespace caf
|
} // End namespace caf
|
||||||
|
|||||||
Reference in New Issue
Block a user