Inserts first successfull qt6 migration Lts/Viewer

This commit is contained in:
torsten committed 2026-10-14 10:11:30 +02:00
1 parent c6d5dd1649
commit f675a65bc3
29 files changed
+238 -18437

No files matched your search

@@ -293,7 +293,7 @@ endif()
# server uses QWebSocketServer; LtsWebSocket/httq enable their real websocket # server uses QWebSocketServer; LtsWebSocket/httq enable their real websocket
# paths via QT6_WEBSOCKETS_AVAILABLE when the module is found). # paths via QT6_WEBSOCKETS_AVAILABLE when the module is found).
find_package(Qt6 6.2 COMPONENTS Concurrent Core LinguistTools Network find_package(Qt6 6.2 COMPONENTS Concurrent Core LinguistTools Network
Multimedia Sql SerialPort Test Xml Positioning Svg WebSockets PrintSupport OpenGL QUIET) Multimedia Sql SerialPort Test Xml Positioning Svg WebSockets PrintSupport OpenGL OpenGLWidgets QUIET)
if(Qt6_FOUND) if(Qt6_FOUND)
# Skip GUI find_package - it fails without OpenGL. We'll create manual targets below. # Skip GUI find_package - it fails without OpenGL. We'll create manual targets below.
@@ -303,7 +303,7 @@ endif()
# If Qt6 not found yet, try with full component list including OpenGL # If Qt6 not found yet, try with full component list including OpenGL
if(NOT Qt6_FOUND) if(NOT Qt6_FOUND)
find_package(Qt6 6.2 COMPONENTS Concurrent Core LinguistTools Network OpenGL PrintSupport find_package(Qt6 6.2 COMPONENTS Concurrent Core LinguistTools Network OpenGL OpenGLWidgets PrintSupport
Multimedia Sql Svg SerialPort Test UiTools WebSockets WebEngineCore WebEngineWidgets Multimedia Sql Svg SerialPort Test UiTools WebSockets WebEngineCore WebEngineWidgets
Widgets Xml Positioning QUIET) Widgets Xml Positioning QUIET)
if(Qt6_FOUND AND OpenGL_FOUND) if(Qt6_FOUND AND OpenGL_FOUND)
@@ -424,6 +424,7 @@ NGL_TARGET_LINK_LIBRARIES(situationMap
Qt6::Concurrent Qt6::Concurrent
Qt6::Network Qt6::Network
Qt6::PrintSupport Qt6::PrintSupport
Qt6::OpenGLWidgets
LtsCoordTrans LtsCoordTrans
ArcGISQt5Hack ArcGISQt5Hack
PUBLIC PUBLIC
@@ -85,12 +85,12 @@ void ViewshedLocation::connectSignals()
connect(m_sceneView, &SceneGraphicsView::mouseClicked, this, [this](QMouseEvent& event) connect(m_sceneView, &SceneGraphicsView::mouseClicked, this, [this](QMouseEvent& event)
{ {
if (!m_locationViewshed[0]) if (!m_locationViewshed[0])
createViewshed(event.x(), event.y()); createViewshed(event.position().x(), event.position().y());
else else
{ {
for (int i = 0; i < 3; ++i) for (int i = 0; i < 3; ++i)
{ {
const Point pt = m_sceneView->screenToBaseSurface(event.x(), event.y()); const Point pt = m_sceneView->screenToBaseSurface(event.position().x(), event.position().y());
m_locationViewshed[i]->setLocation(pt); m_locationViewshed[i]->setLocation(pt);
} }
} }
@@ -99,7 +99,7 @@ void ViewshedLocation::connectSignals()
connect(m_sceneView, &SceneGraphicsView::mousePressedAndHeld, this, [this](QMouseEvent& event) connect(m_sceneView, &SceneGraphicsView::mousePressedAndHeld, this, [this](QMouseEvent& event)
{ {
if (!m_locationViewshed[0]) if (!m_locationViewshed[0])
createViewshed(event.x(), event.y()); createViewshed(event.position().x(), event.position().y());
m_calculating = true; m_calculating = true;
}); });
@@ -110,7 +110,7 @@ void ViewshedLocation::connectSignals()
{ {
for (int i = 0; i < 3; ++i) for (int i = 0; i < 3; ++i)
{ {
const Point pt = m_sceneView->screenToBaseSurface(event.x(), event.y()); const Point pt = m_sceneView->screenToBaseSurface(event.position().x(), event.position().y());
m_locationViewshed[i]->setLocation(pt); m_locationViewshed[i]->setLocation(pt);
} }
} }
@@ -18,6 +18,7 @@
#include <SpatialReference.h> #include <SpatialReference.h>
#include <Geometry.h> #include <Geometry.h>
#include <Polygon.h> #include <Polygon.h>
#include <AttributeListModel.h>
// Qt // Qt
@@ -18,6 +18,7 @@
#include <Graphic.h> #include <Graphic.h>
#include <SpatialReference.h> #include <SpatialReference.h>
#include <Point.h> #include <Point.h>
#include <AttributeListModel.h>
// Qt // Qt
@@ -22,8 +22,8 @@
#endif // ACRGIS_VERSION #endif // ACRGIS_VERSION
#ifdef HAS_LOCATION_DISPLAY #ifdef HAS_LOCATION_DISPLAY
# include <arcgis/LocationDisplay.h> # include <LocationDisplay.h>
# include <arcgis/SimulatedLocationDataSource.h> # include <SimulatedLocationDataSource.h>
#endif // HAS_LOCATION_DISPLAY #endif // HAS_LOCATION_DISPLAY
// Qt // Qt
@@ -669,8 +669,8 @@ bool BasicPathObjectImpl::updateArrowHead(BasicPathObjectImpl::ArrowHead &arrowH
Esri::ArcGISRuntime::GeodeticDistanceResult distRes = Esri::ArcGISRuntime::GeometryEngine::distanceGeodetic(esriEnd3D, Esri::ArcGISRuntime::GeodeticDistanceResult distRes = Esri::ArcGISRuntime::GeometryEngine::distanceGeodetic(esriEnd3D,
camPoint, camPoint,
Esri::ArcGISRuntime::LinearUnitId::Meters, Esri::ArcGISRuntime::LinearUnit(Esri::ArcGISRuntime::LinearUnitId::Meters),
Esri::ArcGISRuntime::AngularUnitId::Degrees, Esri::ArcGISRuntime::AngularUnit(Esri::ArcGISRuntime::AngularUnitId::Degrees),
Esri::ArcGISRuntime::GeodeticCurveType::Geodesic); Esri::ArcGISRuntime::GeodeticCurveType::Geodesic);
realEnable = distRes.distance() < 20000; realEnable = distRes.distance() < 20000;
} }
@@ -45,6 +45,10 @@
#include <PolylineBuilder.h> #include <PolylineBuilder.h>
#include <Polygon.h> #include <Polygon.h>
#include <PolygonBuilder.h> #include <PolygonBuilder.h>
#include <Point.h>
#include <ImmutablePartCollection.h>
#include <ImmutablePart.h>
#include <LinearUnit.h>
#include <QPointF> #include <QPointF>
#include <QVector> #include <QVector>
@@ -378,9 +382,10 @@ QVector<Point3D> GeometryEngine::buffer(AbstractMapObject *mapObj, double distan
// Esri::ArcGISRuntime::GeometryEngine::buffer -> works for 2D // Esri::ArcGISRuntime::GeometryEngine::buffer -> works for 2D
// Esri::ArcGISRuntime::GeometryEngine::bufferGeodetic -> works for 2D and 3D!? // Esri::ArcGISRuntime::GeometryEngine::bufferGeodetic -> works for 2D and 3D!?
const Esri::ArcGISRuntime::LinearUnit linearUnit(Esri::ArcGISRuntime::LinearUnitId::Meters);
const Esri::ArcGISRuntime::Polygon polyline = Esri::ArcGISRuntime::GeometryEngine::bufferGeodetic(esriGeometry, const Esri::ArcGISRuntime::Polygon polyline = Esri::ArcGISRuntime::GeometryEngine::bufferGeodetic(esriGeometry,
distance, distance,
Esri::ArcGISRuntime::LinearUnitId::Meters, linearUnit,
1, 1,
Esri::ArcGISRuntime::GeodeticCurveType::Geodesic); Esri::ArcGISRuntime::GeodeticCurveType::Geodesic);
if (polyline.parts().isEmpty()) if (polyline.parts().isEmpty())
@@ -37,7 +37,6 @@ namespace SituationMap { namespace MathUtils
void PathRasterer::rasterize(qreal tMin, qreal tMax, QVector<QPointF> & vertexList) { exeRasterize( tMin, tMax, vertexList ); } void PathRasterer::rasterize(qreal tMin, qreal tMax, QVector<QPointF> & vertexList) { exeRasterize( tMin, tMax, vertexList ); }
void PathRasterer::rasterize(qreal tMin, qreal tMax, QList<QPointF> & vertexList) { exeRasterize( tMin, tMax, vertexList ); }
template <class List> void PathRasterer::exeRasterize( qreal tMin, qreal tMax, List & vertexList ) template <class List> void PathRasterer::exeRasterize( qreal tMin, qreal tMax, List & vertexList )
@@ -13,6 +13,7 @@
#include "rubberband_drawable.h" #include "rubberband_drawable.h"
#include <Map.h> #include <Map.h>
#include <SpatialReference.h>
namespace SituationMap { namespace RB namespace SituationMap { namespace RB
@@ -155,16 +155,16 @@ bool EventDispatcher::eventFilterGesture( QGestureEvent * gestureEvent )
{ {
case Qt::GestureStarted: case Qt::GestureStarted:
{ {
handled = onPress( hotSpot.x(), hotSpot.y(), nullptr ); handled = onPress( hotSpot.x(), hotSpot.y(), Qt::NoModifier );
if (handled) gestureEvent -> accept( panGesture ); if (handled) gestureEvent -> accept( panGesture );
} break; } break;
case Qt::GestureUpdated: case Qt::GestureUpdated:
handled = onMove ( hotSpot.x() + offset.x(), hotSpot.y() + offset.y(), Qt::MouseButton::LeftButton, nullptr ); handled = onMove ( hotSpot.x() + offset.x(), hotSpot.y() + offset.y(), Qt::MouseButton::LeftButton, Qt::NoModifier );
break; break;
case Qt::GestureFinished: case Qt::GestureFinished:
// handled = onMove ( hotSpot.x() + offset.x(), hotSpot.y() + offset.y(), Qt::MouseButton::LeftButton, 0 ); // handled = onMove ( hotSpot.x() + offset.x(), hotSpot.y() + offset.y(), Qt::MouseButton::LeftButton, 0 );
handled = onClick( hotSpot.x() + offset.x(), hotSpot.y() + offset.y(), nullptr ); handled = onClick( hotSpot.x() + offset.x(), hotSpot.y() + offset.y(), Qt::NoModifier );
break; break;
case Qt::GestureCanceled: case Qt::GestureCanceled:
getEventActions()->resetAction( this, 0, 0 ); getEventActions()->resetAction( this, 0, 0 );
@@ -183,7 +183,7 @@ bool EventDispatcher::eventFilterGesture( QGestureEvent * gestureEvent )
case Qt::GestureFinished : case Qt::GestureFinished :
{ {
getEventActions()->resetAction( this, qRound(applyGesture->position().x()), qRound(applyGesture->position().y()) ); getEventActions()->resetAction( this, qRound(applyGesture->position().x()), qRound(applyGesture->position().y()) );
handled = onDoubleClick( qRound(applyGesture->position().x()), qRound(applyGesture->position().y()), nullptr ); handled = onDoubleClick( qRound(applyGesture->position().x()), qRound(applyGesture->position().y()), Qt::NoModifier );
if (handled) if (handled)
{ {
gestureEvent -> accept( applyGesture ); gestureEvent -> accept( applyGesture );
@@ -211,11 +211,11 @@ bool EventDispatcher::eventFilterWheel( QWheelEvent * e )
const int WHEEL_DELTA = 120; // natural mouse driver constant const int WHEEL_DELTA = 120; // natural mouse driver constant
if (e->modifiers().testFlag(Qt::KeyboardModifier::ControlModifier) && if (e->modifiers().testFlag(Qt::KeyboardModifier::ControlModifier) &&
e->buttons().testFlag(Qt::MidButton)) e->buttons().testFlag(Qt::MiddleButton))
{ {
int newValue = (int)_snapRatio + (e->angleDelta() / WHEEL_DELTA).manhattanLength(); int newValue = (int)_snapRatio + (e->angleDelta() / WHEEL_DELTA).manhattanLength();
_snapRatio = (newValue < 5) ? 5 : newValue; _snapRatio = (newValue < 5) ? 5 : newValue;
return onMove( e->x(), e->y(), e->buttons(), e->modifiers() ); return onMove( e->position().x(), e->position().y(), e->buttons(), e->modifiers() );
} }
return false; return false;
} /* EventDispatcher::eventFilterWheel */ } /* EventDispatcher::eventFilterWheel */
@@ -266,21 +266,21 @@ bool EventDispatcher::eventFilter( QObject * watched, QEvent * e )
QMouseEvent *mouseEvent = static_cast<QMouseEvent*>(e); QMouseEvent *mouseEvent = static_cast<QMouseEvent*>(e);
if (Qt::RightButton == mouseEvent->button()) if (Qt::RightButton == mouseEvent->button())
{ {
handled = onMenuPress( mouseEvent->x() handled = onMenuPress( mouseEvent->position().x()
, mouseEvent->y() , mouseEvent->position().y()
, mouseEvent->modifiers() ); , mouseEvent->modifiers() );
} }
if (Qt::LeftButton == mouseEvent->button()) if (Qt::LeftButton == mouseEvent->button())
{ {
if (!(mouseEvent->modifiers().testFlag(Qt::KeyboardModifier::ControlModifier))) if (!(mouseEvent->modifiers().testFlag(Qt::KeyboardModifier::ControlModifier)))
{ {
handled = onPress( mouseEvent->x() handled = onPress( mouseEvent->position().x()
, mouseEvent->y() , mouseEvent->position().y()
, mouseEvent->modifiers() ); , mouseEvent->modifiers() );
if (handled) _leftPressHandled = true; if (handled) _leftPressHandled = true;
} }
} }
if (Qt::MidButton == mouseEvent->button()) if (Qt::MiddleButton == mouseEvent->button())
{ {
handled = mouseEvent->modifiers().testFlag(Qt::KeyboardModifier::ControlModifier); handled = mouseEvent->modifiers().testFlag(Qt::KeyboardModifier::ControlModifier);
} }
@@ -294,12 +294,12 @@ bool EventDispatcher::eventFilter( QObject * watched, QEvent * e )
QTouchEvent *mouseEvent = static_cast<QTouchEvent*>(e); QTouchEvent *mouseEvent = static_cast<QTouchEvent*>(e);
if (mouseEvent->touchPoints().size() > 0) if (mouseEvent->points().size() > 0)
{ {
const QTouchEvent::TouchPoint tp = mouseEvent->touchPoints().at(0); const QTouchEvent::TouchPoint tp = mouseEvent->points().at(0);
handled = onPress( tp.pos().x() handled = onPress( tp.position().x()
, tp.pos().y() , tp.position().y()
, mouseEvent->modifiers() ); , mouseEvent->modifiers() );
if (handled) _leftPressHandled = true; if (handled) _leftPressHandled = true;
} }
@@ -316,8 +316,8 @@ bool EventDispatcher::eventFilter( QObject * watched, QEvent * e )
{ {
if (!(mouseEvent->modifiers().testFlag(Qt::KeyboardModifier::ControlModifier))) if (!(mouseEvent->modifiers().testFlag(Qt::KeyboardModifier::ControlModifier)))
{ {
onDoubleClick( mouseEvent->x() onDoubleClick( mouseEvent->position().x()
, mouseEvent->y() , mouseEvent->position().y()
, mouseEvent->modifiers() ); , mouseEvent->modifiers() );
_doubleClickHandled = handled = true; _doubleClickHandled = handled = true;
@@ -334,8 +334,8 @@ bool EventDispatcher::eventFilter( QObject * watched, QEvent * e )
QMouseEvent *mouseEvent = static_cast<QMouseEvent*>(e); QMouseEvent *mouseEvent = static_cast<QMouseEvent*>(e);
if (Qt::RightButton == mouseEvent->button()) if (Qt::RightButton == mouseEvent->button())
{ {
handled = onMenuClick( mouseEvent->x() handled = onMenuClick( mouseEvent->position().x()
, mouseEvent->y() , mouseEvent->position().y()
, mouseEvent->modifiers() ); , mouseEvent->modifiers() );
} }
if (Qt::LeftButton == mouseEvent->button()) if (Qt::LeftButton == mouseEvent->button())
@@ -346,14 +346,14 @@ bool EventDispatcher::eventFilter( QObject * watched, QEvent * e )
if (_leftPressHandled) if (_leftPressHandled)
{ {
_leftPressHandled = false; _leftPressHandled = false;
handled = onClick( mouseEvent->x() handled = onClick( mouseEvent->position().x()
, mouseEvent->y() , mouseEvent->position().y()
, mouseEvent->modifiers() ); , mouseEvent->modifiers() );
} }
else callEventAction( &EventActionInterface::buttonPositionAction, mouseEvent->x(), mouseEvent->y() ); else callEventAction( &EventActionInterface::buttonPositionAction, mouseEvent->position().x(), mouseEvent->position().y() );
} }
} }
if (Qt::MidButton == mouseEvent->button()) if (Qt::MiddleButton == mouseEvent->button())
{ {
handled = mouseEvent->modifiers().testFlag(Qt::KeyboardModifier::ControlModifier); handled = mouseEvent->modifiers().testFlag(Qt::KeyboardModifier::ControlModifier);
} }
@@ -369,20 +369,20 @@ bool EventDispatcher::eventFilter( QObject * watched, QEvent * e )
QTouchEvent *mouseEvent = static_cast<QTouchEvent*>(e); QTouchEvent *mouseEvent = static_cast<QTouchEvent*>(e);
// The mouse button press event must had be handled before. If not skip button release ... // The mouse button press event must had be handled before. If not skip button release ...
if (mouseEvent->touchPoints().size() > 0) if (mouseEvent->points().size() > 0)
{ {
const QTouchEvent::TouchPoint tp = mouseEvent->touchPoints().at(0); const QTouchEvent::TouchPoint tp = mouseEvent->points().at(0);
if (_leftPressHandled) if (_leftPressHandled)
{ {
_leftPressHandled = false; _leftPressHandled = false;
handled = onClick( tp.pos().x() handled = onClick( tp.position().x()
, tp.pos().y() , tp.position().y()
, mouseEvent->modifiers() ); , mouseEvent->modifiers() );
} }
else else
{ {
callEventAction( &EventActionInterface::buttonPositionAction, tp.pos().x(), tp.pos().y() ); callEventAction( &EventActionInterface::buttonPositionAction, tp.position().x(), tp.position().y() );
} }
} }
@@ -398,7 +398,7 @@ bool EventDispatcher::eventFilter( QObject * watched, QEvent * e )
QMouseEvent *mouseEvent = static_cast<QMouseEvent*>(e); QMouseEvent *mouseEvent = static_cast<QMouseEvent*>(e);
if (mouseEvent->buttons() != Qt::MidButton) if (mouseEvent->buttons() != Qt::MiddleButton)
{ {
if (!(mouseEvent->modifiers().testFlag(Qt::KeyboardModifier::ControlModifier))) if (!(mouseEvent->modifiers().testFlag(Qt::KeyboardModifier::ControlModifier)))
{ {
@@ -417,8 +417,8 @@ bool EventDispatcher::eventFilter( QObject * watched, QEvent * e )
} }
} }
handled = onMove( mouseEvent->x() handled = onMove( mouseEvent->position().x()
, mouseEvent->y() , mouseEvent->position().y()
, mouseEvent->buttons() , mouseEvent->buttons()
, mouseEvent->modifiers()); , mouseEvent->modifiers());
@@ -441,12 +441,12 @@ bool EventDispatcher::eventFilter( QObject * watched, QEvent * e )
_doubleClickHandled = false; _doubleClickHandled = false;
QTouchEvent* mouseEvent = static_cast<QTouchEvent*>(e); QTouchEvent* mouseEvent = static_cast<QTouchEvent*>(e);
if (mouseEvent->touchPoints().size() > 0) if (mouseEvent->points().size() > 0)
{ {
const QTouchEvent::TouchPoint tp = mouseEvent->touchPoints().at(0); const QEventPoint tp = mouseEvent->points().at(0);
handled = onMove( tp.pos().x() handled = onMove( tp.position().x()
, tp.pos().y() , tp.position().y()
, Qt::LeftButton , Qt::LeftButton
, mouseEvent->modifiers()); , mouseEvent->modifiers());
} }
@@ -48,6 +48,10 @@
#include <Graphic.h> #include <Graphic.h>
#include <MapGraphicsView.h> #include <MapGraphicsView.h>
#include <SceneGraphicsView.h> #include <SceneGraphicsView.h>
#include <Point.h>
#include <Viewpoint.h>
#include <AttributeListModel.h>
#include <IdentifyGraphicsOverlayResult.h>
namespace SituationMap { namespace RB namespace SituationMap { namespace RB
@@ -70,25 +74,7 @@ EventMouseNavigator::EventMouseNavigator(QWidget * getEventsFrom, SituationMap::
#endif #endif
, _pressedMouseButton(Qt::NoButton) , _pressedMouseButton(Qt::NoButton)
{ {
// prepare identify: // prepare identify: (Qt6/ArcGIS SDK v300 uses async QFuture pattern instead of signals)
switch (_sitMap->mode())
{
case Mode::Mode_2D:
connect( _sitMap->getEsriMapGraphicsView()
, &Esri::ArcGISRuntime::MapGraphicsView::identifyGraphicsOverlaysCompleted
, this
, &EventMouseNavigator::onGetPickingResult );
break;
case Mode::Mode_3D:
connect( _sitMap->getEsriSceneGraphicsView()
, &Esri::ArcGISRuntime::SceneGraphicsView::identifyGraphicsOverlaysCompleted
, this
, &EventMouseNavigator::onGetPickingResult );
break;
default:
// empty
break;
}
} // EventMouseNavigator::EventMouseNavigator } // EventMouseNavigator::EventMouseNavigator
@@ -135,7 +121,7 @@ bool EventMouseNavigator::eventFilter(QObject * watched, QEvent * e)
_restoreMouseCursor = getCursorFromWidget(); _restoreMouseCursor = getCursorFromWidget();
if (Qt::MidButton == mouseEvent->button()) if (Qt::MiddleButton == mouseEvent->button())
{ {
handled = true; handled = true;
@@ -154,11 +140,11 @@ bool EventMouseNavigator::eventFilter(QObject * watched, QEvent * e)
_pressedMouseButton = Qt::MouseButton::LeftButton; _pressedMouseButton = Qt::MouseButton::LeftButton;
_mousePanningActive = false; _mousePanningActive = false;
if (mouseEvent->touchPoints().size() > 0) if (mouseEvent->points().size() > 0)
{ {
const QTouchEvent::TouchPoint tp = mouseEvent->touchPoints().at(0); const QTouchEvent::TouchPoint tp = mouseEvent->points().at(0);
_mouseMoveRefPos = tp.pos().toPoint(); // for panning _mouseMoveRefPos = tp.position().toPoint(); // for panning
_restoreMouseCursor = getCursorFromWidget(); _restoreMouseCursor = getCursorFromWidget();
} }
} break; } break;
@@ -187,7 +173,7 @@ bool EventMouseNavigator::eventFilter(QObject * watched, QEvent * e)
if (Rubberband::activeRubberbands(_sitMap).isEmpty()) if (Rubberband::activeRubberbands(_sitMap).isEmpty())
{ {
handled = false; // pass event to esri map to click buttons handled = false; // pass event to esri map to click buttons
selectionRequested(mouseEvent->localPos()); selectionRequested(mouseEvent->position());
// do not handled = true; because some buttons in GraphicsView needs to get the event later. // do not handled = true; because some buttons in GraphicsView needs to get the event later.
} }
} }
@@ -198,10 +184,10 @@ bool EventMouseNavigator::eventFilter(QObject * watched, QEvent * e)
if (Qt::RightButton == mouseEvent->button()) if (Qt::RightButton == mouseEvent->button())
{ {
handled = true; handled = true;
pickRequested( mouseEvent->localPos() ); pickRequested( mouseEvent->position() );
} }
if ((Qt::MidButton == mouseEvent->button())) if ((Qt::MiddleButton == mouseEvent->button()))
{ {
if (!_mousePanningActiveForCenterMapMidButton) if (!_mousePanningActiveForCenterMapMidButton)
{ {
@@ -225,9 +211,9 @@ bool EventMouseNavigator::eventFilter(QObject * watched, QEvent * e)
} }
} }
if ((_mousePanningActive) || (Qt::MidButton == mouseEvent->button())) if ((_mousePanningActive) || (Qt::MiddleButton == mouseEvent->button()))
{ {
handled = (Qt::MidButton == mouseEvent->button()); handled = (Qt::MiddleButton == mouseEvent->button());
setCursorToWidget( _restoreMouseCursor ); setCursorToWidget( _restoreMouseCursor );
} }
_mousePanningActive = false; _mousePanningActive = false;
@@ -239,9 +225,9 @@ bool EventMouseNavigator::eventFilter(QObject * watched, QEvent * e)
debugString = QLatin1String("Touch button release event"); debugString = QLatin1String("Touch button release event");
QTouchEvent * mouseEvent = static_cast<QTouchEvent*>(e); QTouchEvent * mouseEvent = static_cast<QTouchEvent*>(e);
if (mouseEvent->touchPoints().size() > 0) if (mouseEvent->points().size() > 0)
{ {
const QTouchEvent::TouchPoint tp = mouseEvent->touchPoints().at(0); const QTouchEvent::TouchPoint tp = mouseEvent->points().at(0);
if (_cursorChanged) if (_cursorChanged)
{ {
@@ -253,12 +239,12 @@ bool EventMouseNavigator::eventFilter(QObject * watched, QEvent * e)
* The ESRI::MapView is doing panning on mouse move when left mouse button is pressed. * The ESRI::MapView is doing panning on mouse move when left mouse button is pressed.
* To prevent selection in this case check mouse move distance. * To prevent selection in this case check mouse move distance.
*/ */
if (Qt::LeftButton == _pressedMouseButton && ((tp.pos() - _mouseMoveRefPos).manhattanLength() < 3) ) if (Qt::LeftButton == _pressedMouseButton && ((tp.position() - _mouseMoveRefPos).manhattanLength() < 3) )
{ {
if (Rubberband::activeRubberbands(_sitMap).isEmpty()) if (Rubberband::activeRubberbands(_sitMap).isEmpty())
{ {
handled = false; // pass event to esri map to click buttons handled = false; // pass event to esri map to click buttons
selectionRequested(tp.pos()); selectionRequested(tp.position());
// do not handled = true; because some buttons in GraphicsView needs to get the event later. // do not handled = true; because some buttons in GraphicsView needs to get the event later.
} }
} }
@@ -285,7 +271,7 @@ bool EventMouseNavigator::eventFilter(QObject * watched, QEvent * e)
{ {
handled = true; handled = true;
if (mouseEvent->buttons().testFlag(Qt::MidButton)) if (mouseEvent->buttons().testFlag(Qt::MiddleButton))
{ {
_mousePanningActiveForCenterMapMidButton = true; _mousePanningActiveForCenterMapMidButton = true;
@@ -328,13 +314,13 @@ bool EventMouseNavigator::eventFilter(QObject * watched, QEvent * e)
debugString = QLatin1String("touch button move event"); debugString = QLatin1String("touch button move event");
QTouchEvent *mouseEvent = static_cast<QTouchEvent*>(e); QTouchEvent *mouseEvent = static_cast<QTouchEvent*>(e);
if (mouseEvent->touchPoints().size() > 0) if (mouseEvent->points().size() > 0)
{ {
const QTouchEvent::TouchPoint tp = mouseEvent->touchPoints().at(0); const QTouchEvent::TouchPoint tp = mouseEvent->points().at(0);
if (isSignalConnected(QMetaMethod::fromSignal(&EventMouseNavigator::mouseMovedEvent))) if (isSignalConnected(QMetaMethod::fromSignal(&EventMouseNavigator::mouseMovedEvent)))
{ {
emit mouseMovedEvent(tp.pos().x(), tp.pos().y()); emit mouseMovedEvent(tp.position().x(), tp.position().y());
} }
if (_mousePanningActive) if (_mousePanningActive)
@@ -546,58 +532,43 @@ void EventMouseNavigator::pickRequested( const QPointF &pos )
void EventMouseNavigator::requestPicking(const QPointF &pos) void EventMouseNavigator::requestPicking(const QPointF &pos)
{ {
_pickingTask.cancel(); // cancel old task // Cancel any existing picking task
if (_pickingTask.isRunning())
// store new task
bool returnPopUpsOnly = false;
int maximumResultsPerOverlay = std::numeric_limits<int>::max(); // huge number;
_pickingTask = _sitMap->getEsriGeoView()->identifyGraphicsOverlays(pos.x(), pos.y(), _pickTolerance,
returnPopUpsOnly, maximumResultsPerOverlay);
//qWarning() << " XXXXXXX" << LOGFUNCTION;
// check new task
if (!_pickingTask.isValid())
{ {
_pendingRequest = RequestType::None; _pickingTask.cancel();
qWarning() << LOGFUNCTION << " _identfyGraphicsOverlayTask invalid";
} }
// Start new async identify operation
bool returnPopUpsOnly = false;
int maximumResultsPerOverlay = std::numeric_limits<int>::max();
_pickingTask = _sitMap->getEsriGeoView()->identifyGraphicsOverlaysAsync(pos, _pickTolerance,
returnPopUpsOnly, maximumResultsPerOverlay);
// Handle async result with continuation
_pickingTask.then(this, [this](const QList<Esri::ArcGISRuntime::IdentifyGraphicsOverlayResult*> &identifyResults) {
const QList<SituationMap::UniqueMapId> & selectedIdList = mapToUniqueMapId(identifyResults);
switch (_pendingRequest)
{
case RequestType::Picking:
emit contextMenuRequest(selectedIdList, _viewPortPos);
break;
case RequestType::Selection:
emit selectionRequest(selectedIdList, _viewPortPos);
break;
case RequestType::None:
//empty
break;
} // switch
// reset some 'flags' to enable a new request:
_pendingRequest = RequestType::None;
_viewPortPos = QPointF(-1, -1);
});
} // EventMouseNavigator::requestPicking } // EventMouseNavigator::requestPicking
void EventMouseNavigator::onGetPickingResult(const QUuid &taskId, const QList<Esri::ArcGISRuntime::IdentifyGraphicsOverlayResult*> &identifyResults)
{
// qWarning() << " YYYYYYY" << LOGFUNCTION;
if (_pickingTask.taskId() != taskId)
{
qDebug() << " taskId does not match";
return;
}
const QList<SituationMap::UniqueMapId> & selectedIdList = mapToUniqueMapId(identifyResults);
// qWarning() << " _pendingRequest="<< (int)_pendingRequest << " count= " << _selectedIdList.count();
switch (_pendingRequest)
{
case RequestType::Picking:
emit contextMenuRequest(selectedIdList, _viewPortPos);
break;
case RequestType::Selection:
emit selectionRequest(selectedIdList, _viewPortPos);
break;
case RequestType::None:
//emtpy
break;
} // switch
// reset some 'flags' to enable a new request:
_pendingRequest = RequestType::None;
_viewPortPos = QPointF(-1, -1);
} // EventMouseNavigator::onGetPickingResult
QList<UniqueMapId> EventMouseNavigator::mapToUniqueMapId(const QList<Esri::ArcGISRuntime::IdentifyGraphicsOverlayResult *> &identifyResults) QList<UniqueMapId> EventMouseNavigator::mapToUniqueMapId(const QList<Esri::ArcGISRuntime::IdentifyGraphicsOverlayResult *> &identifyResults)
{ {
QList<SituationMap::UniqueMapId> idList; QList<SituationMap::UniqueMapId> idList;
@@ -145,8 +145,6 @@ namespace SituationMap { namespace RB
protected slots: protected slots:
void onGetPickingResult(const QUuid &taskId, const QList<::Esri::ArcGISRuntime::IdentifyGraphicsOverlayResult *> &identifyResults );
protected: protected:
@@ -195,7 +193,7 @@ namespace SituationMap { namespace RB
static qreal _zoomFactorBase; // Base value to calculate zoom factor values from QWheelEvent static qreal _zoomFactorBase; // Base value to calculate zoom factor values from QWheelEvent
QFuture<void> _pickingTask; QFuture<QList<Esri::ArcGISRuntime::IdentifyGraphicsOverlayResult*>> _pickingTask;
/** /**
test for already running picking task. test for already running picking task.
@@ -50,10 +50,10 @@ QGestureRecognizer::Result ApplyGestureRecognizer::recognize( QGesture * stateGe
{ {
const QTouchEvent * ev = static_cast<const QTouchEvent*>(event); const QTouchEvent * ev = static_cast<const QTouchEvent*>(event);
// qDebug() << "ApplyGesture begin"; // qDebug() << "ApplyGesture begin";
q->_position = ev->touchPoints().at(0).pos(); q->_position = ev->points().at(0).position();
q->setHotSpot(ev->touchPoints().at(0).screenPos()); q->setHotSpot(ev->points().at(0).globalPosition().toPoint());
q->_tripleTouch = (ev->touchPoints().size() == 3); q->_tripleTouch = (ev->points().size() == 3);
if (ev->touchPoints().size() == 1 ) if (ev->points().size() == 1 )
result = QGestureRecognizer::Ignore; result = QGestureRecognizer::Ignore;
else else
result = QGestureRecognizer::TriggerGesture; result = QGestureRecognizer::TriggerGesture;
@@ -63,12 +63,12 @@ QGestureRecognizer::Result ApplyGestureRecognizer::recognize( QGesture * stateGe
case QEvent::TouchEnd: case QEvent::TouchEnd:
{ {
const QTouchEvent * ev = static_cast<const QTouchEvent*>(event); const QTouchEvent * ev = static_cast<const QTouchEvent*>(event);
if (q->state() != Qt::NoGesture && ev->touchPoints().size() >= 1 && ev->touchPoints().size() <= 3) if (q->state() != Qt::NoGesture && ev->points().size() >= 1 && ev->points().size() <= 3)
{ {
if (ev->touchPoints().size() == 3) q->_tripleTouch = true; if (ev->points().size() == 3) q->_tripleTouch = true;
// qDebug() << "ApplyGesture update _tripleTouch=" << q->_tripleTouch; // qDebug() << "ApplyGesture update _tripleTouch=" << q->_tripleTouch;
QTouchEvent::TouchPoint p = ev->touchPoints().at(0); QEventPoint p = ev->points().at(0);
QPoint delta = p.pos().toPoint() - p.startPos().toPoint(); QPoint delta = p.position().toPoint() - p.pressPosition().toPoint();
enum { TapRadius = 40 }; enum { TapRadius = 40 };
if (delta.manhattanLength() <= TapRadius) if (delta.manhattanLength() <= TapRadius)
{ {
@@ -43,6 +43,7 @@
#include <Map.h> #include <Map.h>
#include <MapGraphicsView.h> #include <MapGraphicsView.h>
#include <SpatialReference.h>
namespace SituationMap { namespace RB namespace SituationMap { namespace RB
@@ -30,20 +30,18 @@
#include <QtCore/QObject> #include <QtCore/QObject>
#include <QtCore/QPointer>
#include <QtGui/QColor> #include <QtGui/QColor>
#include <QtWidgets/QGraphicsScene>
#include <MapGraphicsView.h> #include <MapGraphicsView.h>
#include <Point.h> #include <Point.h>
#include <Common/referenced.h> #include <Common/referenced.h>
#include <Common/situation_map_logging.h> #include <Common/situation_map_logging.h>
class QGraphicsScene;
namespace Esri { namespace ArcGISRuntime { class MapGraphicsView; } }
namespace SituationMap { namespace RB namespace SituationMap { namespace RB
{ {
@@ -32,6 +32,7 @@
#include <MapGraphicsView.h> #include <MapGraphicsView.h>
#include <Map.h> #include <Map.h>
#include <SpatialReference.h>
#include <QtWidgets/QGraphicsScene> #include <QtWidgets/QGraphicsScene>
#include <QtWidgets/QGraphicsEllipseItem> #include <QtWidgets/QGraphicsEllipseItem>
@@ -33,6 +33,7 @@
#include <Map.h> #include <Map.h>
#include <MapGraphicsView.h> #include <MapGraphicsView.h>
#include <SpatialReference.h>
#include <QtWidgets/QGraphicsScene> #include <QtWidgets/QGraphicsScene>
@@ -49,6 +49,8 @@
#include <QtGui/QGuiApplication> #include <QtGui/QGuiApplication>
#include <IdentifyGraphicsOverlayResult.h> #include <IdentifyGraphicsOverlayResult.h>
#include <AttributeListModel.h>
#include <Graphic.h>
namespace SituationMap { namespace RB namespace SituationMap { namespace RB
{ {
@@ -64,8 +66,8 @@ namespace SituationMap { namespace RB
int m_currentIndex; int m_currentIndex;
int m_selectionIndex; int m_selectionIndex;
QFuture<void> m_pickingTask; QFuture<void> m_pickingTask;
QFuture<void> m_selectionTask; QFuture<void> m_selectionTask;
QPoint m_pickingPoint; QPoint m_pickingPoint;
QPointF * m_startMove; QPointF * m_startMove;
ScreenToLocationHelper * m_screenToMap; ScreenToLocationHelper * m_screenToMap;
@@ -106,19 +108,18 @@ namespace SituationMap { namespace RB
RubberbandMultiPointFeature3D::RubberbandMultiPointFeature3D( SituationMap::Map * map, QObject * parent, bool isActive ) RubberbandMultiPointFeature3D::RubberbandMultiPointFeature3D( SituationMap::Map * map, QObject * parent, bool isActive )
: Rubberband3D(map,parent,isActive) : Rubberband3D(map,parent,isActive)
, _internal( new RubberbandMultiPointFeature3D::InternalData() ) , _internal( new RubberbandMultiPointFeature3D::InternalData() )
, _isClosed(false) , _isClosed(false)
, _isCircular(false) , _isCircular(false)
{ {
MapImpl *mapImpl = static_cast<MapImpl*>(_baseInternal->_map.data()); MapImpl *mapImpl = static_cast<MapImpl*>(_baseInternal->_map.data());
Esri::ArcGISRuntime::SceneGraphicsView *view = mapImpl->getEsriSceneGraphicsView(); Esri::ArcGISRuntime::SceneGraphicsView *view = mapImpl->getEsriSceneGraphicsView();
connect( view, &Esri::ArcGISRuntime::SceneGraphicsView::identifyGraphicsOverlaysCompleted, this, &RubberbandMultiPointFeature3D::onGetPickingResult ); _internal->m_screenToMap = new ScreenToLocationHelper(view);
_internal->m_screenToMap = new ScreenToLocationHelper(view); connect( _internal->m_screenToMap, &ScreenToLocationHelper::mouseScenePositionChanged, this, &RubberbandMultiPointFeature3D::onMapPosition ); // ToDo
connect( _internal->m_screenToMap, &ScreenToLocationHelper::mouseScenePositionChanged, this, &RubberbandMultiPointFeature3D::onMapPosition ); // ToDO
} // RubberbandMultiPointFeature3D::RubberbandMultiPointFeature3D( SituationMap::Map * map, QObject * parent = nullptr, bool isActive ) } // RubberbandMultiPointFeature3D::RubberbandMultiPointFeature3D( SituationMap::Map * map, QObject * parent = nullptr, bool isActive )
RubberbandMultiPointFeature3D::~RubberbandMultiPointFeature3D() RubberbandMultiPointFeature3D::~RubberbandMultiPointFeature3D()
@@ -348,96 +349,6 @@ namespace SituationMap { namespace RB
} // void RubberbandMultiPointFeature3D::onMapPosition(const QPointF &mapCoordinate) } // void RubberbandMultiPointFeature3D::onMapPosition(const QPointF &mapCoordinate)
void RubberbandMultiPointFeature3D::onGetPickingResult(const QUuid &taskId, const QList<Esri::ArcGISRuntime::IdentifyGraphicsOverlayResult*> &identifyResults)
{
if (_internal->m_pickingTask.taskId() == taskId)
{
for (auto iResult : identifyResults)
{
const QList<Esri::ArcGISRuntime::Graphic*> &gResults = iResult->graphics();
for (auto pickedGraphic : gResults)
{
if (pickedGraphic->attributes())
{
bool ok = false;
int pickedIndex = pickedGraphic->attributes()->attributeValue(QStringLiteral("Rubberband3D-Item")).toInt(&ok);
if (ok)
{
qCritical() << "Picking index " << pickedIndex;
_internal->m_currentIndex = pickedIndex;
_internal->m_screenToMap->screenToLocation(_internal->m_pickingPoint.x(), _internal->m_pickingPoint.y());
if (pickedIndex < _internal->m_marker.size())
{
GraphicalObjectPictureMarker *&marker = _internal->m_marker[pickedIndex];
if (marker)
{
marker->setImage(markerSelectionImage());
marker->updateView();
}
}
return;
}
}
} // foreach pickedGraphic
} // foreach iResult
if ((!_isCircular) || (_internal->m_coordinates.size() < 2))
{
// add new coordinate and calculate map location
_internal->m_currentIndex = _internal->m_marker.size();
_internal->m_marker << nullptr;
_internal->m_coordinates << QPointF();
_internal->m_screenToMap->screenToLocation(_internal->m_pickingPoint.x(), _internal->m_pickingPoint.y());
}
}
if (_internal->m_selectionTask.taskId() == taskId)
{
for (auto iResult : identifyResults)
{
const QList<Esri::ArcGISRuntime::Graphic*> &gResults = iResult->graphics();
for (auto pickedGraphic : gResults)
{
if (pickedGraphic->attributes())
{
bool ok = false;
int pickedIndex = pickedGraphic->attributes()->attributeValue(QStringLiteral("Rubberband3D-Item")).toInt(&ok);
if ((ok) && (pickedIndex < _internal->m_marker.size()))
{
GraphicalObjectPictureMarker *&marker = _internal->m_marker[pickedIndex];
if (marker)
{
_internal->m_selectionIndex = pickedIndex;
marker->setImage(markerSelectionImage());
marker->updateView();
return;
}
}
}
}
}
}
if ((_internal->m_selectionIndex >= 0) && (_internal->m_selectionIndex < _internal->m_marker.size()))
{
GraphicalObjectPictureMarker *&marker = _internal->m_marker[_internal->m_selectionIndex];
if (marker)
{
marker->setImage(markerImage());
marker->updateView();
}
_internal->m_selectionIndex = -1;
}
} // void RubberbandMultiPointFeature3D::onGetPickingResult(const QUuid &taskId, const QList<Esri::ArcGISRuntime::IdentifyGraphicsOverlayResult*> &identifyResults)
bool RubberbandMultiPointFeature3D::selectAction(AbstractEventDispatcher *, int x, int y) bool RubberbandMultiPointFeature3D::selectAction(AbstractEventDispatcher *, int x, int y)
{ {
delete _internal->m_startMove; delete _internal->m_startMove;
@@ -451,9 +362,55 @@ namespace SituationMap { namespace RB
_internal->m_pickingTask.cancel(); // cancel old task _internal->m_pickingTask.cancel(); // cancel old task
_internal->m_pickingPoint = QPoint(x,y); _internal->m_pickingPoint = QPoint(x,y);
_internal->m_pickingTask = mapImpl->getEsriGeoView()->identifyGraphicsOverlays(x,y,EventMouseNavigator::pickTolerance(),false,std::numeric_limits<int>::max());
_internal->m_currentIndex = -1; _internal->m_currentIndex = -1;
_internal->m_pickingTask = mapImpl->getEsriGeoView()->identifyGraphicsOverlaysAsync(QPointF(x,y),EventMouseNavigator::pickTolerance(),false,std::numeric_limits<int>::max())
.then(this, [this](const QList<Esri::ArcGISRuntime::IdentifyGraphicsOverlayResult*> &identifyResults)
{
for (auto iResult : identifyResults)
{
const QList<Esri::ArcGISRuntime::Graphic*> &gResults = iResult->graphics();
for (auto pickedGraphic : gResults)
{
if (pickedGraphic->attributes())
{
bool ok = false;
int pickedIndex = pickedGraphic->attributes()->attributeValue(QStringLiteral("Rubberband3D-Item")).toInt(&ok);
if (ok)
{
qCritical() << "Picking index " << pickedIndex;
_internal->m_currentIndex = pickedIndex;
_internal->m_screenToMap->screenToLocation(_internal->m_pickingPoint.x(), _internal->m_pickingPoint.y());
if (pickedIndex < _internal->m_marker.size())
{
GraphicalObjectPictureMarker *&marker = _internal->m_marker[pickedIndex];
if (marker)
{
marker->setImage(markerSelectionImage());
marker->updateView();
}
}
return;
}
}
} // foreach pickedGraphic
} // foreach iResult
if ((!_isCircular) || (_internal->m_coordinates.size() < 2))
{
// add new coordinate and calculate map location
_internal->m_currentIndex = _internal->m_marker.size();
_internal->m_marker << nullptr;
_internal->m_coordinates << QPointF();
_internal->m_screenToMap->screenToLocation(_internal->m_pickingPoint.x(), _internal->m_pickingPoint.y());
}
});
return true; return true;
} }
return false; return false;
@@ -510,19 +467,45 @@ namespace SituationMap { namespace RB
MapImpl *mapImpl = static_cast<MapImpl*>(_baseInternal->_map.data()); MapImpl *mapImpl = static_cast<MapImpl*>(_baseInternal->_map.data());
_internal->m_selectionTask.cancel(); // cancel old task _internal->m_selectionTask.cancel(); // cancel old task
_internal->m_selectionTask = mapImpl->getEsriGeoView()->identifyGraphicsOverlays(x,y,EventMouseNavigator::pickTolerance(),false,std::numeric_limits<int>::max()); _internal->m_pickingPoint = QPoint(x,y);
if ((_internal->m_selectionIndex >= 0) && (_internal->m_selectionIndex < _internal->m_marker.size()))
{
GraphicalObjectPictureMarker *&marker = _internal->m_marker[_internal->m_selectionIndex];
if (marker)
{
marker->setImage(markerImage());
marker->updateView();
}
}
_internal->m_selectionIndex = -1; _internal->m_selectionIndex = -1;
_internal->m_selectionTask = mapImpl->getEsriGeoView()->identifyGraphicsOverlaysAsync(QPointF(x,y),EventMouseNavigator::pickTolerance(),false,std::numeric_limits<int>::max())
.then(this, [this](const QList<Esri::ArcGISRuntime::IdentifyGraphicsOverlayResult*> &identifyResults)
{
for (auto iResult : identifyResults)
{
const QList<Esri::ArcGISRuntime::Graphic*> &gResults = iResult->graphics();
for (auto pickedGraphic : gResults)
{
if (pickedGraphic->attributes())
{
bool ok = false;
int pickedIndex = pickedGraphic->attributes()->attributeValue(QStringLiteral("Rubberband3D-Item")).toInt(&ok);
if (ok)
{
qCritical() << "Picking index " << pickedIndex;
_internal->m_selectionIndex = pickedIndex;
_internal->m_screenToMap->screenToLocation(_internal->m_pickingPoint.x(), _internal->m_pickingPoint.y());
if (pickedIndex < _internal->m_marker.size())
{
GraphicalObjectPictureMarker *&marker = _internal->m_marker[pickedIndex];
if (marker)
{
marker->setImage(markerSelectionImage());
marker->updateView();
}
}
return;
}
}
} // foreach pickedGraphic
} // foreach iResult
});
} }
return false; return false;
} // bool RubberbandMultiPointFeature3D::moveAction(AbstractEventDispatcher*,int,int) } // bool RubberbandMultiPointFeature3D::moveAction(AbstractEventDispatcher*,int,int)
@@ -120,7 +120,6 @@ namespace SituationMap { namespace RB
protected slots: protected slots:
void onGetPickingResult(const QUuid &taskId, const QList<::Esri::ArcGISRuntime::IdentifyGraphicsOverlayResult*> &identifyResults);
void onMapPosition( const Point3D &mapCoordinate ); void onMapPosition( const Point3D &mapCoordinate );
}; /* RubberbandMultiPointFeature3D */ }; /* RubberbandMultiPointFeature3D */
@@ -36,6 +36,7 @@
#include <Map.h> #include <Map.h>
#include <MapGraphicsView.h> #include <MapGraphicsView.h>
#include <SpatialReference.h>
namespace SituationMap { namespace RB namespace SituationMap { namespace RB
@@ -35,6 +35,7 @@
#include <cmath> #include <cmath>
#include <Map.h> #include <Map.h>
#include <SpatialReference.h>
@@ -42,6 +42,7 @@
#include <Map.h> #include <Map.h>
#include <MapGraphicsView.h> #include <MapGraphicsView.h>
#include <SpatialReference.h>
#include <QtCore/QLine> #include <QtCore/QLine>
@@ -39,6 +39,7 @@
#include <Map.h> #include <Map.h>
#include <MapGraphicsView.h> #include <MapGraphicsView.h>
#include <SpatialReference.h>
#include <QtGui/QCursor> #include <QtGui/QCursor>
#include <QtWidgets/QPushButton> #include <QtWidgets/QPushButton>
@@ -125,9 +125,9 @@ namespace SituationMap { namespace RB
} }
} }
if (Qt::MidButton == mouseEvent->button()) if (Qt::MiddleButton == mouseEvent->button())
{ {
handled = (Qt::MidButton == mouseEvent->button()); handled = (Qt::MiddleButton == mouseEvent->button());
_mousePanningActive = true; _mousePanningActive = true;
setCursorToWidget( QCursor(Qt::CursorShape::ClosedHandCursor) ); setCursorToWidget( QCursor(Qt::CursorShape::ClosedHandCursor) );
@@ -161,9 +161,9 @@ namespace SituationMap { namespace RB
pickRequested( mouseEvent->pos() ); pickRequested( mouseEvent->pos() );
} }
if ((_mousePanningActive) || (Qt::MidButton == mouseEvent->button())) if ((_mousePanningActive) || (Qt::MiddleButton == mouseEvent->button()))
{ {
handled = (Qt::MidButton == mouseEvent->button()); handled = (Qt::MiddleButton == mouseEvent->button());
setCursorToWidget( _restoreMouseCursor ); setCursorToWidget( _restoreMouseCursor );
} }
@@ -192,7 +192,7 @@ namespace SituationMap { namespace RB
} }
} }
if ((_mousePanningActive) || mouseEvent->buttons().testFlag(Qt::MidButton)) if ((_mousePanningActive) || mouseEvent->buttons().testFlag(Qt::MiddleButton))
{ {
handled = true; handled = true;
EsriRuntimeQt::AnimationMode mode = _esriMap->animationMode(); EsriRuntimeQt::AnimationMode mode = _esriMap->animationMode();
@@ -50,21 +50,21 @@ namespace SituationMap { namespace RB {
case QEvent::TouchBegin: case QEvent::TouchBegin:
{ {
qDebug() << "ApplyGesture begin"; qDebug() << "ApplyGesture begin";
q->_position = ev->touchPoints().at(0).pos(); q->_position = ev->points().at(0).position();
q->setHotSpot(ev->touchPoints().at(0).screenPos()); q->setHotSpot(ev->points().at(0).globalPosition().toPoint());
q->_tripleTouch = (ev->touchPoints().size() == 3); q->_tripleTouch = (ev->points().size() == 3);
result = QGestureRecognizer::TriggerGesture; result = QGestureRecognizer::TriggerGesture;
} break; } break;
case QEvent::TouchUpdate: case QEvent::TouchUpdate:
case QEvent::TouchEnd: case QEvent::TouchEnd:
{ {
if (q->state() != Qt::NoGesture && ev->touchPoints().size() >= 1 && ev->touchPoints().size() <= 3) if (q->state() != Qt::NoGesture && ev->points().size() >= 1 && ev->points().size() <= 3)
{ {
if (ev->touchPoints().size() == 3) q->_tripleTouch = true; if (ev->points().size() == 3) q->_tripleTouch = true;
qDebug() << "ApplyGesture update _tripleTouch=" << q->_tripleTouch; qDebug() << "ApplyGesture update _tripleTouch=" << q->_tripleTouch;
QTouchEvent::TouchPoint p = ev->touchPoints().at(0); QEventPoint p = ev->points().at(0);
QPoint delta = p.pos().toPoint() - p.startPos().toPoint(); QPoint delta = p.position().toPoint() - p.pressPosition().toPoint();
enum { TapRadius = 40 }; enum { TapRadius = 40 };
if (delta.manhattanLength() <= TapRadius) if (delta.manhattanLength() <= TapRadius)
{ {
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff