1#ifndef IVS3D_MAPHANDLER_H
2#define IVS3D_MAPHANDLER_H
4#include <QGeoCoordinate>
14#include <QVariantList>
20#ifndef GEOMAP_ENABLE_PARTIAL_SELECTION
21#define GEOMAP_ENABLE_PARTIAL_SELECTION 1
24using GpsDataList = QList<QPair<QPointF, bool>>;
25Q_DECLARE_METATYPE(GpsDataList)
33using GpsPointStateList = QList<GpsPointState>;
34Q_DECLARE_METATYPE(GpsPointStateList)
54 explicit MapHandler(QObject* parent =
nullptr);
59 void addPoints(
const GpsDataList& m_gpsData);
61 void updatePoints(
const GpsPointStateList& changedPoints);
63 void setPolygon(
const QPolygonF& poly);
65 void replaceData(
const GpsDataList& gpsData,
const QPolygonF& polygon);
66 void updatePointsAndPolygon(
const GpsPointStateList& changedPoints,
67 const QPolygonF& polygon);
76 bool used, qreal ratio)
78 Q_EMIT circleSignal(coordinate, name, used, ratio);
86 Q_EMIT adjustMap(coordinate);
94 Q_EMIT createPolyline(coordinate);
102 Q_EMIT setTracePath(coordinates);
110 Q_EMIT setMapSelect(path);
112 void emitSetMapSelectCoordinates(
const QVariantList& coordinates)
114 Q_EMIT setMapSelectCoordinates(coordinates);
123 Q_EMIT setPoint(index, used);
126 void emitSetPointState(
const int index,
bool used, qreal ratio)
128 Q_EMIT setPointState(index, used, ratio);
131 void emitSetPartialSelectionEnabled(
bool enabled)
133 Q_EMIT setPartialSelectionEnabled(enabled);
140 Q_EMIT getMapItems();
144 void drawGpsDataOnMap();
153 void circleSignal(
const QGeoCoordinate& coordinate, QString name,
bool used,
177 void setMapSelectCoordinates(
const QVariantList& coordinates);
184 void setPointState(
const int index,
bool used, qreal ratio);
185 void setPartialSelectionEnabled(
bool enabled);
186 void setPointHighlight(
const int index,
bool highlighted);
209 void onQmlGpsClicked(
const QString& text);
211 void onQmlMapClicked(
const QString& text);
213 void onQmlMapItems(
const QVariant& variant);
215 void onQmlDeleteSelection();
217 void onQmlSelectionBack();
219 void onQmlSelectionForward();
221 void setCurrentIndex(uint index);
222 void setPartialSelectionMode(
bool enabled);
230 QPolygonF geoPolyToPolyF();
234 QList<QLineF> geoPolyToLineList();
237 QPointF pointAtGeo(
int index);
241 QPointF minDistance(QPointF A, QPointF B, QPointF newPoint);
242 void applyCurrentIndexHighlight();
266 QList<QGeoPolygon> mPolyStack;
268 int mCurrentStackPos = -1;
269 int mCurrentSourceIndex = -1;
270 int mCurrentMapItemIndex = -1;
271 bool mPartialSelectionEnabled = GEOMAP_ENABLE_PARTIAL_SELECTION != 0;
The MapHandler is used to handel the qml map.
Definition maphandler.h:48
void emitCreatePolyline(const QGeoCoordinate &coordinate)
emitCreatePolyline method to emit the corresponding signal
Definition maphandler.h:92
void emitSetMapSelect(const QGeoPath &path)
emitSetMapSelect Method to emit the corresponding signal
Definition maphandler.h:108
QList< QPointF > mOrderedGpsList
List of GPS data in the order of acquisition.
Definition maphandler.h:253
QSet< QPointF > mChangedPoints
Save points that have been change with a new polygon.
Definition maphandler.h:261
QMap< QPointF, bool > mGpsMap
GPS points used or not.
Definition maphandler.h:248
void emitSetTracePath(const QVariantList &coordinates)
emitSetTracePath Sends the full ordered GPS trace path to the QML map in one shot.
Definition maphandler.h:100
void getMapItems()
getMapItems Used to signal that the map needs to return the current map items
void gpsClicked(QPointF gpsPoint, bool used)
gpsClicked Signal emitted when a gps points has been clicked
void gpsSelected(QPolygonF polyF)
gpsSelected Signal emitted when a new polygon has been selected
QMap< QPointF, int > mMapItems
Used to save the item list from the qml map.
Definition maphandler.h:264
QGeoPolygon mPolygon
The current polygon.
Definition maphandler.h:258
void createPolyline(const QGeoCoordinate &coordinate)
emitCreatePolyline Used to add points to the static polyline on the map (And will set the polyline vi...
void setPoint(const int index, bool used)
emitSetPoint Used to update a points oppacity
void adjustMap(const QGeoCoordinate &coordinate)
adjustMap Used to center the map at the given coordinate
void emitAdjustMapCenter(const QGeoCoordinate &coordinate)
emitAdjustMapCenter Method to emit the corresponding signal
Definition maphandler.h:84
void emitSetPoint(const int index, bool used)
emitSetPoint Method to emit the corresponding signal
Definition maphandler.h:121
QMap< QPointF, qreal > mPointSelectionRatio
Ratio of selected images for each unique GPS point.
Definition maphandler.h:250
void setTracePath(const QVariantList &coordinates)
setTracePath Replaces the entire GPS trace path on the map in one call. Coordinates are ordered by im...
QList< QPointF > mSourceIndexToPoint
Maps source frame index to GPS point (keeps duplicates).
Definition maphandler.h:255
void setMapSelect(const QGeoPath &path)
emitSetMapSelect Used to updated the current user selected polygon on the map
void emitGetMapItems()
emitGetMapItems Method to emit the corresponding signal
Definition maphandler.h:138
void circleSignal(const QGeoCoordinate &coordinate, QString name, bool used, qreal ratio)
circleSignal Used to create points on the map at the given coordinate
void emitCircleSignal(const QGeoCoordinate &coordinate, QString name, bool used, qreal ratio)
emitCircleSignal Method to emit the corresponding signal
Definition maphandler.h:75
Definition maphandler.h:27