12#include <QtCore/QLoggingCategory>
13#include <QtCore/QObject>
14#include <QtCore/QPointF>
15#include <QtCore/QRectF>
16#include <QtCore/QTimer>
17#include <QtCore/QVariantList>
18#include <QtPositioning/QGeoCoordinate>
19#include <QtQmlIntegration/QtQmlIntegration>
21Q_DECLARE_LOGGING_CATEGORY(MapPositionTrackerLog)
59 bool active()
const {
return _active; }
61 void setActive(
bool active);
65 void setGcsPosition(
const QGeoCoordinate& position);
69 void setVehicleCoordinate(
const QGeoCoordinate& coordinate);
73 void setAllowGCSLocationCenter(
bool allow);
77 void setAllowVehicleLocationCenter(
bool allow);
84 void setCenterGCSWhenVehicleValid(
bool center);
88 void setKeepVehicleCentered(
bool keep);
92 void setUserInteracting(
bool interacting);
97 void setAnimating(
bool animating);
103 void setFirstVehiclePositionReceived(
bool received);
110 Q_INVOKABLE
void evaluateOccluderFollow(
const QPointF& vehicleScreenPoint,
const QRectF& viewportRect,
111 const QVariantList& occluderRects);
113#ifdef QGC_UNITTEST_BUILD
114 void setResumeDelayMsForTest(
int ms) { _resumeTimer.setInterval(ms); }
120 void centerMap(
const QGeoCoordinate& coordinate,
bool firstPosition);
136 bool _paused()
const {
return _userInteracting || _resumeTimer.isActive(); }
139 bool _evaluateVehicleOneShot();
140 void _evaluateGCSOneShot();
141 void _resumeFollowing();
144 QGeoCoordinate _gcsPosition;
145 QGeoCoordinate _vehicleCoordinate;
146 bool _allowGCSLocationCenter =
false;
147 bool _allowVehicleLocationCenter =
false;
148 bool _centerGCSWhenVehicleValid =
false;
149 bool _keepVehicleCentered =
false;
150 bool _userInteracting =
false;
151 bool _animating =
false;
152 bool _firstVehiclePositionReceived =
false;
153 bool _firstGCSPositionReceived =
false;
bool firstVehiclePositionReceived() const
void setFirstVehiclePositionReceived(bool received)
void setAllowVehicleLocationCenter(bool allow)
bool centerGCSWhenVehicleValid() const
static constexpr int kResumeDelayMs
Following resumes this long after the user stops interacting.
QGeoCoordinate vehicleCoordinate() const
bool animating() const
Consumer's recenter animation is running: occluder evaluation is skipped.
void setVehicleCoordinate(const QGeoCoordinate &coordinate)
void setActive(bool active)
void gcsPositionChanged()
void setUserInteracting(bool interacting)
void keepVehicleCenteredChanged()
bool keepVehicleCentered() const
MapPositionTracker(QObject *parent=nullptr)
QGeoCoordinate gcsPosition() const
void userInteractingChanged()
void setCenterGCSWhenVehicleValid(bool center)
void setAllowGCSLocationCenter(bool allow)
void recenterVehicleTo(const QPointF &screenPoint)
Consumer moves the map (animated) so the vehicle lands at screenPoint.
void setGcsPosition(const QGeoCoordinate &position)
bool userInteracting() const
void firstVehiclePositionReceivedChanged()
void allowVehicleLocationCenterChanged()
void setKeepVehicleCentered(bool keep)
void setAnimating(bool animating)
bool allowGCSLocationCenter() const
bool allowVehicleLocationCenter() const
void vehicleCoordinateChanged()
void centerMap(const QGeoCoordinate &coordinate, bool firstPosition)
void centerGCSWhenVehicleValidChanged()
void allowGCSLocationCenterChanged()