6 #ifndef MARBLEQUICKITEM_H
7 #define MARBLEQUICKITEM_H
9 #include "marble_declarative_export.h"
10 #include <QSharedPointer>
11 #include <QQuickPaintedItem>
12 #include "GeoDataAccuracy.h"
13 #include "GeoDataLineString.h"
14 #include "MarbleGlobal.h"
15 #include "PositionProviderPluginInterface.h"
17 #include "Placemark.h"
18 #include "Coordinate.h"
23 class GeoDataLatLonBox;
24 class GeoDataPlacemark;
26 class MarbleInputHandler;
27 class MarbleQuickItemPrivate;
36 Q_PROPERTY(
int mapWidth READ mapWidth WRITE setMapWidth NOTIFY mapWidthChanged)
37 Q_PROPERTY(
int mapHeight READ mapHeight WRITE setMapHeight NOTIFY mapHeightChanged)
38 Q_PROPERTY(
int zoom READ zoom WRITE setZoom NOTIFY zoomChanged)
39 Q_PROPERTY(
int minimumZoom READ minimumZoom NOTIFY minimumZoomChanged)
40 Q_PROPERTY(
int maximumZoom READ maximumZoom NOTIFY maximumZoomChanged)
41 Q_PROPERTY(
int radius READ radius WRITE setRadius NOTIFY radiusChanged)
42 Q_PROPERTY(qreal heading READ heading WRITE setHeading NOTIFY headingChanged)
44 Q_PROPERTY(
bool showFrameRate READ showFrameRate WRITE setShowFrameRate NOTIFY showFrameRateChanged)
47 Q_PROPERTY(Marble::MapTheme* mapTheme READ mapTheme NOTIFY mapThemeChanged)
48 Q_PROPERTY(
QString mapThemeId READ mapThemeId WRITE setMapThemeId NOTIFY mapThemeIdChanged)
49 Q_PROPERTY(
bool showAtmosphere READ showAtmosphere WRITE setShowAtmosphere NOTIFY showAtmosphereChanged)
50 Q_PROPERTY(
bool showCompass READ showCompass WRITE setShowCompass NOTIFY showCompassChanged)
51 Q_PROPERTY(
bool showClouds READ showClouds WRITE setShowClouds NOTIFY showCloudsChanged)
52 Q_PROPERTY(
bool showCrosshairs READ showCrosshairs WRITE setShowCrosshairs NOTIFY showCrosshairsChanged)
53 Q_PROPERTY(
bool showGrid READ showGrid WRITE setShowGrid NOTIFY showGridChanged)
54 Q_PROPERTY(
bool showOverviewMap READ showOverviewMap WRITE setShowOverviewMap NOTIFY showOverviewMapChanged)
55 Q_PROPERTY(
bool showOtherPlaces READ showOtherPlaces WRITE setShowOtherPlaces NOTIFY showOtherPlacesChanged)
56 Q_PROPERTY(
bool showScaleBar READ showScaleBar WRITE setShowScaleBar NOTIFY showScaleBarChanged)
57 Q_PROPERTY(
bool showBackground READ showBackground WRITE setShowBackground NOTIFY showBackgroundChanged)
58 Q_PROPERTY(
bool showPositionMarker READ showPositionMarker WRITE setShowPositionMarker NOTIFY showPositionMarkerChanged)
59 Q_PROPERTY(
bool showPublicTransport READ showPublicTransport WRITE setShowPublicTransport NOTIFY showPublicTransportChanged)
60 Q_PROPERTY(
bool showOutdoorActivities READ showOutdoorActivities WRITE setShowOutdoorActivities NOTIFY showOutdoorActivitiesChanged)
61 Q_PROPERTY(
QString positionProvider READ positionProvider WRITE setPositionProvider NOTIFY positionProviderChanged)
62 Q_PROPERTY(
bool positionAvailable READ positionAvailable NOTIFY positionAvailableChanged)
63 Q_PROPERTY(
bool positionVisible READ positionVisible NOTIFY positionVisibleChanged)
64 Q_PROPERTY(MarbleMap* marbleMap READ map NOTIFY marbleMapChanged)
65 Q_PROPERTY(Placemark* currentPosition READ currentPosition NOTIFY currentPositionChanged)
66 Q_PROPERTY(qreal speed READ speed NOTIFY speedChanged)
67 Q_PROPERTY(qreal angle READ angle NOTIFY angleChanged)
68 Q_PROPERTY(
bool inertialGlobeRotation READ inertialGlobeRotation WRITE setInertialGlobeRotation NOTIFY inertialGlobeRotationChanged)
69 Q_PROPERTY(
bool animationViewContext READ animationViewContext WRITE setAnimationViewContext NOTIFY animationViewContextChanged)
70 Q_PROPERTY(
bool animationsEnabled READ animationsEnabled WRITE setAnimationsEnabled NOTIFY animationsEnabledChanged)
71 Q_PROPERTY(
QQmlComponent* placemarkDelegate READ placemarkDelegate WRITE setPlacemarkDelegate NOTIFY placemarkDelegateChanged)
72 Q_PROPERTY(
bool hoverEnabled READ hoverEnabled WRITE setHoverEnabled NOTIFY hoverEnabledChanged)
73 Q_PROPERTY(
bool invertColorEnabled READ invertColorEnabled WRITE setInvertColorEnabled NOTIFY invertColorEnabledChanged)
74 Q_PROPERTY(
bool workOffline READ workOffline WRITE setWorkOffline NOTIFY workOfflineChanged)
77 explicit MarbleQuickItem(
QQuickItem *parent =
nullptr);
91 MarbleInputHandler *inputHandler();
98 Q_INVOKABLE
void setZoomToMaximumLevel();
99 void setRadius(
int radius);
100 void centerOn(
const GeoDataPlacemark& placemark,
bool animated =
false);
101 void centerOn(
const GeoDataLatLonBox& box,
bool animated =
false);
102 void centerOn(
const GeoDataCoordinates& coordinate);
103 void centerOn(qreal longitude, qreal latitude);
104 Q_INVOKABLE
void centerOnCoordinates(qreal longitude, qreal latitude);
105 Q_INVOKABLE
void centerOnCurrentPosition();
106 Q_INVOKABLE
void selectPlacemarkAt(
int x,
int y);
111 Q_INVOKABLE
void handlePinchStarted(
const QPointF &point);
112 Q_INVOKABLE
void handlePinchFinished(
const QPointF &point);
113 Q_INVOKABLE
void handlePinchUpdated(
const QPointF &point, qreal scale);
115 void setMapWidth(
int mapWidth);
116 void setMapHeight(
int mapHeight);
117 void setShowFrameRate(
bool showFrameRate);
119 void setMapThemeId(
const QString& mapThemeId);
120 void setShowAtmosphere(
bool showAtmosphere);
121 void setShowCompass(
bool showCompass);
122 void setShowClouds(
bool showClouds);
123 void setShowCrosshairs(
bool showCrosshairs);
124 void setShowGrid(
bool showGrid);
125 void setShowOverviewMap(
bool showOverviewMap);
126 void setShowOtherPlaces(
bool showOtherPlaces);
127 void setShowScaleBar(
bool showScaleBar);
128 void setShowBackground(
bool showBackground);
129 void setShowPositionMarker(
bool showPositionMarker);
130 void setShowPublicTransport(
bool showPublicTransport);
131 void setShowOutdoorActivities(
bool showOutdoorActivities);
132 void setPositionProvider(
const QString & positionProvider);
134 void setInertialGlobeRotation(
bool inertialGlobeRotation);
135 void setAnimationViewContext(
bool animationViewContext);
136 void setAnimationsEnabled(
bool animationsEnabled);
140 void setPropertyEnabled(
const QString &property,
bool enabled);
141 bool isPropertyEnabled(
const QString &property)
const;
143 void setWorkOffline(
bool enabled);
145 Q_INVOKABLE
void setInvertColorEnabled(
bool enabled,
const QString &blending =
QString(
"InvertColorBlending"));
147 Q_INVOKABLE
void setShowRuntimeTrace(
bool showRuntimeTrace);
148 Q_INVOKABLE
void setShowDebugPolygons(
bool showDebugPolygons);
149 Q_INVOKABLE
void setShowDebugPlacemarks(
bool showDebugPlacemarks);
150 Q_INVOKABLE
void setShowDebugBatches(
bool showDebugBatches);
154 Q_INVOKABLE
void loadSettings();
155 Q_INVOKABLE
void writeSettings();
157 Q_INVOKABLE
void reloadTiles();
158 Q_INVOKABLE
void highlightRouteRelation(qint64 osmId,
bool enabled);
159 Q_INVOKABLE
void setRelationTypeVisible(
const QString &relationType,
bool visible);
160 Q_INVOKABLE
bool isRelationTypeVisible(
const QString &relationType)
const;
162 void setHeading(qreal heading);
163 void setHoverEnabled(
bool hoverEnabled);
166 void paint(
QPainter *painter)
override;
170 void classBegin()
override;
171 void componentComplete()
override;
178 int mapWidth()
const;
179 int mapHeight()
const;
180 qreal heading()
const;
182 bool showFrameRate()
const;
185 Marble::MapTheme * mapTheme()
const;
186 bool showAtmosphere()
const;
187 bool showCompass()
const;
188 bool showClouds()
const;
189 bool showCrosshairs()
const;
190 bool showGrid()
const;
191 bool showOverviewMap()
const;
192 bool showOtherPlaces()
const;
193 bool showScaleBar()
const;
194 bool showBackground()
const;
195 bool showPositionMarker()
const;
196 bool showPublicTransport()
const;
197 bool showOutdoorActivities()
const;
198 QString positionProvider()
const;
199 bool positionAvailable()
const;
200 bool positionVisible()
const;
201 Q_INVOKABLE qreal distanceFromPointToCurrentLocation(
const QPoint & position)
const;
202 Q_INVOKABLE qreal angleFromPointToCurrentLocation(
const QPoint & position)
const;
203 Placemark* currentPosition()
const;
204 Q_INVOKABLE
QPointF screenCoordinatesFromCoordinate(
Coordinate * coordinate)
const;
205 Q_INVOKABLE
QPointF screenCoordinatesFromGeoDataCoordinates(
const GeoDataCoordinates & coordinates)
const;
206 Q_INVOKABLE
bool screenCoordinatesFromGeoDataLineString(
const GeoDataLineString &lineString,
QVector<QPolygonF*> &polygons )
const;
208 Q_INVOKABLE
bool screenCoordinatesToGeoDataCoordinates(
const QPoint & point, GeoDataCoordinates & coordinates);
209 Q_INVOKABLE
bool screenCoordinatesToCoordinate(
const QPoint & point,
Coordinate * coordinate);
213 MarbleModel* model();
214 const MarbleModel* model()
const;
217 const MarbleMap*
map()
const;
219 bool inertialGlobeRotation()
const;
220 bool animationViewContext()
const;
221 bool animationsEnabled()
const;
224 void reverseGeocoding(
const QPoint &point);
226 bool hoverEnabled()
const;
227 Q_INVOKABLE
bool invertColorEnabled();
231 Q_INVOKABLE
void moveUp();
232 Q_INVOKABLE
void moveDown();
233 Q_INVOKABLE
void moveLeft();
234 Q_INVOKABLE
void moveRight();
237 int minimumZoom()
const;
239 int maximumZoom()
const;
242 void mapWidthChanged(
int mapWidth);
243 void mapHeightChanged(
int mapHeight);
244 void showFrameRateChanged(
bool showFrameRate);
245 void projectionChanged(
Projection projection);
246 void mapThemeIdChanged(
const QString& mapThemeId);
247 void mapThemeChanged();
248 void showAtmosphereChanged(
bool showAtmosphere);
249 void showCompassChanged(
bool showCompass);
250 void showCloudsChanged(
bool showClouds);
251 void showCrosshairsChanged(
bool showCrosshairs);
252 void showGridChanged(
bool showGrid);
253 void showOverviewMapChanged(
bool showOverviewMap);
254 void showOtherPlacesChanged(
bool showOtherPlaces);
255 void showScaleBarChanged(
bool showScaleBar);
256 void showBackgroundChanged(
bool showBackground);
257 void showPositionMarkerChanged(
bool showPositionMarker);
258 void showPublicTransportChanged(
bool showPublicTransport);
259 void showOutdoorActivitiesChanged(
bool showOutdoorActivities);
260 void positionProviderChanged(
const QString & positionProvider);
261 void positionAvailableChanged(
bool positionAvailable);
262 void positionVisibleChanged(
bool positionVisible);
263 void marbleMapChanged();
264 void visibleLatLonAltBoxChanged();
265 void currentPositionChanged(Placemark* currentPosition);
268 void headingChanged(qreal heading);
270 void radiusChanged(
int radius);
271 void inertialGlobeRotationChanged(
bool inertialGlobeRotation);
272 void animationViewContextChanged(
bool animationViewContext);
273 void placemarkDelegateChanged(
QQmlComponent* placemarkDelegate);
275 void animationsEnabledChanged(
bool animationsEnabled);
277 void hoverEnabledChanged(
bool hoverEnabled);
279 void lmbMenuRequested(
const QPoint& point);
280 void rmbMenuRequested(
const QPoint& point);
281 void hoverPositionChanged(
const QPoint& point);
283 void minimumZoomChanged(
int minimumZoom);
284 void maximumZoomChanged(
int maximumZoom);
286 void invertColorEnabledChanged(
bool enabled);
287 void workOfflineChanged();
289 void geoItemUpdateRequested();
292 QObject *getEventFilter()
const;
297 void positionDataStatusChanged(PositionProviderStatus
status);
298 void positionChanged(
const GeoDataCoordinates &, GeoDataAccuracy);
299 void updatePositionVisibility();
300 void updateCurrentPosition(
const GeoDataCoordinates & coordinates);
301 void updatePlacemarks();
302 void handleReverseGeocoding(
const GeoDataCoordinates &coordinates,
const GeoDataPlacemark &placemark);
303 void handleVisibleLatLonAltBoxChanged(
const GeoDataLatLonAltBox& latLonAltBox);
307 MarbleQuickItemPrivatePtr d;
308 friend class MarbleQuickItemPrivate;
312 #endif // MARBLEQUICKITEM_H