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

@@ -424,6 +424,7 @@ NGL_TARGET_LINK_LIBRARIES(situationMap
Qt6::Concurrent
Qt6::Network
Qt6::PrintSupport
Qt6::OpenGLWidgets
LtsCoordTrans
ArcGISQt5Hack
PUBLIC
@@ -85,12 +85,12 @@ void ViewshedLocation::connectSignals()
connect(m_sceneView, &SceneGraphicsView::mouseClicked, this, [this](QMouseEvent& event)
{
if (!m_locationViewshed[0])
createViewshed(event.x(), event.y());
createViewshed(event.position().x(), event.position().y());
else
{
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);
}
}
@@ -99,7 +99,7 @@ void ViewshedLocation::connectSignals()
connect(m_sceneView, &SceneGraphicsView::mousePressedAndHeld, this, [this](QMouseEvent& event)
{
if (!m_locationViewshed[0])
createViewshed(event.x(), event.y());
createViewshed(event.position().x(), event.position().y());
m_calculating = true;
});
@@ -110,7 +110,7 @@ void ViewshedLocation::connectSignals()
{
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);
}
}
@@ -18,6 +18,7 @@
#include <SpatialReference.h>
#include <Geometry.h>
#include <Polygon.h>
#include <AttributeListModel.h>
// Qt
@@ -18,6 +18,7 @@
#include <Graphic.h>
#include <SpatialReference.h>
#include <Point.h>
#include <AttributeListModel.h>
// Qt
@@ -22,8 +22,8 @@
#endif // ACRGIS_VERSION
#ifdef HAS_LOCATION_DISPLAY
# include <arcgis/LocationDisplay.h>
# include <arcgis/SimulatedLocationDataSource.h>
# include <LocationDisplay.h>
# include <SimulatedLocationDataSource.h>
#endif // HAS_LOCATION_DISPLAY
// Qt
@@ -669,8 +669,8 @@ bool BasicPathObjectImpl::updateArrowHead(BasicPathObjectImpl::ArrowHead &arrowH
Esri::ArcGISRuntime::GeodeticDistanceResult distRes = Esri::ArcGISRuntime::GeometryEngine::distanceGeodetic(esriEnd3D,
camPoint,
Esri::ArcGISRuntime::LinearUnitId::Meters,
Esri::ArcGISRuntime::AngularUnitId::Degrees,
Esri::ArcGISRuntime::LinearUnit(Esri::ArcGISRuntime::LinearUnitId::Meters),
Esri::ArcGISRuntime::AngularUnit(Esri::ArcGISRuntime::AngularUnitId::Degrees),
Esri::ArcGISRuntime::GeodeticCurveType::Geodesic);
realEnable = distRes.distance() < 20000;
}
@@ -45,6 +45,10 @@
#include <PolylineBuilder.h>
#include <Polygon.h>
#include <PolygonBuilder.h>
#include <Point.h>
#include <ImmutablePartCollection.h>
#include <ImmutablePart.h>
#include <LinearUnit.h>
#include <QPointF>
#include <QVector>
@@ -378,9 +382,10 @@ QVector<Point3D> GeometryEngine::buffer(AbstractMapObject *mapObj, double distan
// Esri::ArcGISRuntime::GeometryEngine::buffer -> works for 2D
// 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,
distance,
Esri::ArcGISRuntime::LinearUnitId::Meters,
linearUnit,
1,
Esri::ArcGISRuntime::GeodeticCurveType::Geodesic);
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, QList<QPointF> & vertexList) { exeRasterize( tMin, tMax, vertexList ); }
template <class List> void PathRasterer::exeRasterize( qreal tMin, qreal tMax, List & vertexList )
@@ -13,6 +13,7 @@
#include "rubberband_drawable.h"
#include <Map.h>
#include <SpatialReference.h>
namespace SituationMap { namespace RB
@@ -155,16 +155,16 @@ bool EventDispatcher::eventFilterGesture( QGestureEvent * gestureEvent )
{
case Qt::GestureStarted:
{
handled = onPress( hotSpot.x(), hotSpot.y(), nullptr );
handled = onPress( hotSpot.x(), hotSpot.y(), Qt::NoModifier );
if (handled) gestureEvent -> accept( panGesture );
} break;
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;
case Qt::GestureFinished:
// 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;
case Qt::GestureCanceled:
getEventActions()->resetAction( this, 0, 0 );
@@ -183,7 +183,7 @@ bool EventDispatcher::eventFilterGesture( QGestureEvent * gestureEvent )
case Qt::GestureFinished :
{
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)
{
gestureEvent -> accept( applyGesture );
@@ -211,11 +211,11 @@ bool EventDispatcher::eventFilterWheel( QWheelEvent * e )
const int WHEEL_DELTA = 120; // natural mouse driver constant
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();
_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;
} /* EventDispatcher::eventFilterWheel */
@@ -266,21 +266,21 @@ bool EventDispatcher::eventFilter( QObject * watched, QEvent * e )
QMouseEvent *mouseEvent = static_cast<QMouseEvent*>(e);
if (Qt::RightButton == mouseEvent->button())
{
handled = onMenuPress( mouseEvent->x()
, mouseEvent->y()
handled = onMenuPress( mouseEvent->position().x()
, mouseEvent->position().y()
, mouseEvent->modifiers() );
}
if (Qt::LeftButton == mouseEvent->button())
{
if (!(mouseEvent->modifiers().testFlag(Qt::KeyboardModifier::ControlModifier)))
{
handled = onPress( mouseEvent->x()
, mouseEvent->y()
handled = onPress( mouseEvent->position().x()
, mouseEvent->position().y()
, mouseEvent->modifiers() );
if (handled) _leftPressHandled = true;
}
}
if (Qt::MidButton == mouseEvent->button())
if (Qt::MiddleButton == mouseEvent->button())
{
handled = mouseEvent->modifiers().testFlag(Qt::KeyboardModifier::ControlModifier);
}
@@ -294,12 +294,12 @@ bool EventDispatcher::eventFilter( QObject * watched, QEvent * 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()
, tp.pos().y()
handled = onPress( tp.position().x()
, tp.position().y()
, mouseEvent->modifiers() );
if (handled) _leftPressHandled = true;
}
@@ -316,8 +316,8 @@ bool EventDispatcher::eventFilter( QObject * watched, QEvent * e )
{
if (!(mouseEvent->modifiers().testFlag(Qt::KeyboardModifier::ControlModifier)))
{
onDoubleClick( mouseEvent->x()
, mouseEvent->y()
onDoubleClick( mouseEvent->position().x()
, mouseEvent->position().y()
, mouseEvent->modifiers() );
_doubleClickHandled = handled = true;
@@ -334,8 +334,8 @@ bool EventDispatcher::eventFilter( QObject * watched, QEvent * e )
QMouseEvent *mouseEvent = static_cast<QMouseEvent*>(e);
if (Qt::RightButton == mouseEvent->button())
{
handled = onMenuClick( mouseEvent->x()
, mouseEvent->y()
handled = onMenuClick( mouseEvent->position().x()
, mouseEvent->position().y()
, mouseEvent->modifiers() );
}
if (Qt::LeftButton == mouseEvent->button())
@@ -346,14 +346,14 @@ bool EventDispatcher::eventFilter( QObject * watched, QEvent * e )
if (_leftPressHandled)
{
_leftPressHandled = false;
handled = onClick( mouseEvent->x()
, mouseEvent->y()
handled = onClick( mouseEvent->position().x()
, mouseEvent->position().y()
, 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);
}
@@ -369,20 +369,20 @@ bool EventDispatcher::eventFilter( QObject * watched, QEvent * e )
QTouchEvent *mouseEvent = static_cast<QTouchEvent*>(e);
// 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)
{
_leftPressHandled = false;
handled = onClick( tp.pos().x()
, tp.pos().y()
handled = onClick( tp.position().x()
, tp.position().y()
, mouseEvent->modifiers() );
}
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);
if (mouseEvent->buttons() != Qt::MidButton)
if (mouseEvent->buttons() != Qt::MiddleButton)
{
if (!(mouseEvent->modifiers().testFlag(Qt::KeyboardModifier::ControlModifier)))
{
@@ -417,8 +417,8 @@ bool EventDispatcher::eventFilter( QObject * watched, QEvent * e )
}
}
handled = onMove( mouseEvent->x()
, mouseEvent->y()
handled = onMove( mouseEvent->position().x()
, mouseEvent->position().y()
, mouseEvent->buttons()
, mouseEvent->modifiers());
@@ -441,12 +441,12 @@ bool EventDispatcher::eventFilter( QObject * watched, QEvent * e )
_doubleClickHandled = false;
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()
, tp.pos().y()
handled = onMove( tp.position().x()
, tp.position().y()
, Qt::LeftButton
, mouseEvent->modifiers());
}
@@ -48,6 +48,10 @@
#include <Graphic.h>
#include <MapGraphicsView.h>
#include <SceneGraphicsView.h>
#include <Point.h>
#include <Viewpoint.h>
#include <AttributeListModel.h>
#include <IdentifyGraphicsOverlayResult.h>
namespace SituationMap { namespace RB
@@ -70,25 +74,7 @@ EventMouseNavigator::EventMouseNavigator(QWidget * getEventsFrom, SituationMap::
#endif
, _pressedMouseButton(Qt::NoButton)
{
// prepare identify:
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;
}
// prepare identify: (Qt6/ArcGIS SDK v300 uses async QFuture pattern instead of signals)
} // EventMouseNavigator::EventMouseNavigator
@@ -135,7 +121,7 @@ bool EventMouseNavigator::eventFilter(QObject * watched, QEvent * e)
_restoreMouseCursor = getCursorFromWidget();
if (Qt::MidButton == mouseEvent->button())
if (Qt::MiddleButton == mouseEvent->button())
{
handled = true;
@@ -154,11 +140,11 @@ bool EventMouseNavigator::eventFilter(QObject * watched, QEvent * e)
_pressedMouseButton = Qt::MouseButton::LeftButton;
_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();
}
} break;
@@ -187,7 +173,7 @@ bool EventMouseNavigator::eventFilter(QObject * watched, QEvent * e)
if (Rubberband::activeRubberbands(_sitMap).isEmpty())
{
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.
}
}
@@ -198,10 +184,10 @@ bool EventMouseNavigator::eventFilter(QObject * watched, QEvent * e)
if (Qt::RightButton == mouseEvent->button())
{
handled = true;
pickRequested( mouseEvent->localPos() );
pickRequested( mouseEvent->position() );
}
if ((Qt::MidButton == mouseEvent->button()))
if ((Qt::MiddleButton == mouseEvent->button()))
{
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 );
}
_mousePanningActive = false;
@@ -239,9 +225,9 @@ bool EventMouseNavigator::eventFilter(QObject * watched, QEvent * e)
debugString = QLatin1String("Touch button release event");
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)
{
@@ -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.
* 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())
{
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.
}
}
@@ -285,7 +271,7 @@ bool EventMouseNavigator::eventFilter(QObject * watched, QEvent * e)
{
handled = true;
if (mouseEvent->buttons().testFlag(Qt::MidButton))
if (mouseEvent->buttons().testFlag(Qt::MiddleButton))
{
_mousePanningActiveForCenterMapMidButton = true;
@@ -328,13 +314,13 @@ bool EventMouseNavigator::eventFilter(QObject * watched, QEvent * e)
debugString = QLatin1String("touch button move event");
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)))
{
emit mouseMovedEvent(tp.pos().x(), tp.pos().y());
emit mouseMovedEvent(tp.position().x(), tp.position().y());
}
if (_mousePanningActive)
@@ -546,58 +532,43 @@ void EventMouseNavigator::pickRequested( const QPointF &pos )
void EventMouseNavigator::requestPicking(const QPointF &pos)
{
_pickingTask.cancel(); // cancel old task
// 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())
// Cancel any existing picking task
if (_pickingTask.isRunning())
{
_pendingRequest = RequestType::None;
qWarning() << LOGFUNCTION << " _identfyGraphicsOverlayTask invalid";
_pickingTask.cancel();
}
// 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
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<SituationMap::UniqueMapId> idList;
@@ -145,8 +145,6 @@ namespace SituationMap { namespace RB
protected slots:
void onGetPickingResult(const QUuid &taskId, const QList<::Esri::ArcGISRuntime::IdentifyGraphicsOverlayResult *> &identifyResults );
protected:
@@ -195,7 +193,7 @@ namespace SituationMap { namespace RB
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.
@@ -50,10 +50,10 @@ QGestureRecognizer::Result ApplyGestureRecognizer::recognize( QGesture * stateGe
{
const QTouchEvent * ev = static_cast<const QTouchEvent*>(event);
// qDebug() << "ApplyGesture begin";
q->_position = ev->touchPoints().at(0).pos();
q->setHotSpot(ev->touchPoints().at(0).screenPos());
q->_tripleTouch = (ev->touchPoints().size() == 3);
if (ev->touchPoints().size() == 1 )
q->_position = ev->points().at(0).position();
q->setHotSpot(ev->points().at(0).globalPosition().toPoint());
q->_tripleTouch = (ev->points().size() == 3);
if (ev->points().size() == 1 )
result = QGestureRecognizer::Ignore;
else
result = QGestureRecognizer::TriggerGesture;
@@ -63,12 +63,12 @@ QGestureRecognizer::Result ApplyGestureRecognizer::recognize( QGesture * stateGe
case QEvent::TouchEnd:
{
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;
QTouchEvent::TouchPoint p = ev->touchPoints().at(0);
QPoint delta = p.pos().toPoint() - p.startPos().toPoint();
QEventPoint p = ev->points().at(0);
QPoint delta = p.position().toPoint() - p.pressPosition().toPoint();
enum { TapRadius = 40 };
if (delta.manhattanLength() <= TapRadius)
{
@@ -43,6 +43,7 @@
#include <Map.h>
#include <MapGraphicsView.h>
#include <SpatialReference.h>
namespace SituationMap { namespace RB
@@ -30,20 +30,18 @@
#include <QtCore/QObject>
#include <QtCore/QPointer>
#include <QtGui/QColor>
#include <QtWidgets/QGraphicsScene>
#include <MapGraphicsView.h>
#include <Point.h>
#include <Common/referenced.h>
#include <Common/situation_map_logging.h>
class QGraphicsScene;
namespace Esri { namespace ArcGISRuntime { class MapGraphicsView; } }
namespace SituationMap { namespace RB
{
@@ -32,6 +32,7 @@
#include <MapGraphicsView.h>
#include <Map.h>
#include <SpatialReference.h>
#include <QtWidgets/QGraphicsScene>
#include <QtWidgets/QGraphicsEllipseItem>
@@ -33,6 +33,7 @@
#include <Map.h>
#include <MapGraphicsView.h>
#include <SpatialReference.h>
#include <QtWidgets/QGraphicsScene>
@@ -49,6 +49,8 @@
#include <QtGui/QGuiApplication>
#include <IdentifyGraphicsOverlayResult.h>
#include <AttributeListModel.h>
#include <Graphic.h>
namespace SituationMap { namespace RB
{
@@ -64,8 +66,8 @@ namespace SituationMap { namespace RB
int m_currentIndex;
int m_selectionIndex;
QFuture<void> m_pickingTask;
QFuture<void> m_selectionTask;
QFuture<void> m_pickingTask;
QFuture<void> m_selectionTask;
QPoint m_pickingPoint;
QPointF * m_startMove;
ScreenToLocationHelper * m_screenToMap;
@@ -106,19 +108,18 @@ namespace SituationMap { namespace RB
RubberbandMultiPointFeature3D::RubberbandMultiPointFeature3D( SituationMap::Map * map, QObject * parent, bool isActive )
: Rubberband3D(map,parent,isActive)
, _internal( new RubberbandMultiPointFeature3D::InternalData() )
, _isClosed(false)
, _isCircular(false)
{
MapImpl *mapImpl = static_cast<MapImpl*>(_baseInternal->_map.data());
Esri::ArcGISRuntime::SceneGraphicsView *view = mapImpl->getEsriSceneGraphicsView();
: Rubberband3D(map,parent,isActive)
, _internal( new RubberbandMultiPointFeature3D::InternalData() )
, _isClosed(false)
, _isCircular(false)
{
MapImpl *mapImpl = static_cast<MapImpl*>(_baseInternal->_map.data());
Esri::ArcGISRuntime::SceneGraphicsView *view = mapImpl->getEsriSceneGraphicsView();
connect( view, &Esri::ArcGISRuntime::SceneGraphicsView::identifyGraphicsOverlaysCompleted, this, &RubberbandMultiPointFeature3D::onGetPickingResult );
_internal->m_screenToMap = new ScreenToLocationHelper(view);
connect( _internal->m_screenToMap, &ScreenToLocationHelper::mouseScenePositionChanged, this, &RubberbandMultiPointFeature3D::onMapPosition ); // ToDO
_internal->m_screenToMap = new ScreenToLocationHelper(view);
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()
@@ -348,96 +349,6 @@ namespace SituationMap { namespace RB
} // 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)
{
delete _internal->m_startMove;
@@ -451,9 +362,55 @@ namespace SituationMap { namespace RB
_internal->m_pickingTask.cancel(); // cancel old task
_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_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 false;
@@ -510,19 +467,45 @@ namespace SituationMap { namespace RB
MapImpl *mapImpl = static_cast<MapImpl*>(_baseInternal->_map.data());
_internal->m_selectionTask.cancel(); // cancel old task
_internal->m_selectionTask = mapImpl->getEsriGeoView()->identifyGraphicsOverlays(x,y,EventMouseNavigator::pickTolerance(),false,std::numeric_limits<int>::max());
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_pickingPoint = QPoint(x,y);
_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;
} // bool RubberbandMultiPointFeature3D::moveAction(AbstractEventDispatcher*,int,int)
@@ -120,7 +120,6 @@ namespace SituationMap { namespace RB
protected slots:
void onGetPickingResult(const QUuid &taskId, const QList<::Esri::ArcGISRuntime::IdentifyGraphicsOverlayResult*> &identifyResults);
void onMapPosition( const Point3D &mapCoordinate );
}; /* RubberbandMultiPointFeature3D */
@@ -36,6 +36,7 @@
#include <Map.h>
#include <MapGraphicsView.h>
#include <SpatialReference.h>
namespace SituationMap { namespace RB
@@ -35,6 +35,7 @@
#include <cmath>
#include <Map.h>
#include <SpatialReference.h>
@@ -42,6 +42,7 @@
#include <Map.h>
#include <MapGraphicsView.h>
#include <SpatialReference.h>
#include <QtCore/QLine>
@@ -39,6 +39,7 @@
#include <Map.h>
#include <MapGraphicsView.h>
#include <SpatialReference.h>
#include <QtGui/QCursor>
#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;
setCursorToWidget( QCursor(Qt::CursorShape::ClosedHandCursor) );
@@ -161,9 +161,9 @@ namespace SituationMap { namespace RB
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 );
}
@@ -192,7 +192,7 @@ namespace SituationMap { namespace RB
}
}
if ((_mousePanningActive) || mouseEvent->buttons().testFlag(Qt::MidButton))
if ((_mousePanningActive) || mouseEvent->buttons().testFlag(Qt::MiddleButton))
{
handled = true;
EsriRuntimeQt::AnimationMode mode = _esriMap->animationMode();
@@ -50,21 +50,21 @@ namespace SituationMap { namespace RB {
case QEvent::TouchBegin:
{
qDebug() << "ApplyGesture begin";
q->_position = ev->touchPoints().at(0).pos();
q->setHotSpot(ev->touchPoints().at(0).screenPos());
q->_tripleTouch = (ev->touchPoints().size() == 3);
q->_position = ev->points().at(0).position();
q->setHotSpot(ev->points().at(0).globalPosition().toPoint());
q->_tripleTouch = (ev->points().size() == 3);
result = QGestureRecognizer::TriggerGesture;
} break;
case QEvent::TouchUpdate:
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;
QTouchEvent::TouchPoint p = ev->touchPoints().at(0);
QPoint delta = p.pos().toPoint() - p.startPos().toPoint();
QEventPoint p = ev->points().at(0);
QPoint delta = p.position().toPoint() - p.pressPosition().toPoint();
enum { TapRadius = 40 };
if (delta.manhattanLength() <= TapRadius)
{