Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qgeomap_p.h
Go to the documentation of this file.
1// Copyright (C) 2015 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3// Qt-Security score:significant reason:default
4#ifndef QGEOMAP_P_H
5#define QGEOMAP_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtLocation/private/qlocationglobal_p.h>
19#include <QtLocation/private/qgeomaptype_p.h>
20#include <QtCore/QObject>
21#include <QTransform>
22
23QT_BEGIN_NAMESPACE
24
25class QGeoMappingManagerEngine;
26class QGeoMapPrivate;
27class QGeoMapController;
28class QGeoCameraCapabilities;
29class QGeoCameraData;
30class QGeoCoordinate;
31class QGeoProjection;
32class QGeoShape;
33class QGeoRectangle;
34class QSGNode;
35class QQuickWindow;
36class QDeclarativeGeoMapItemBase;
37class QDeclarativeGeoMap;
38
39class Q_LOCATION_EXPORT QGeoMap : public QObject
40{
41 Q_OBJECT
42 Q_DECLARE_PRIVATE(QGeoMap)
43
44public:
45 enum ItemType {
46 NoItem = 0x0000,
47 MapRectangle = 0x0001,
48 MapCircle = 0x0002,
49 MapPolyline = 0x0004,
50 MapPolygon = 0x0008,
51 MapQuickItem = 0x0010,
52 CustomMapItem = 0x8000
53 };
54
55 Q_DECLARE_FLAGS(ItemTypes, ItemType)
56
57 enum Capability {
58 SupportsNothing = 0x0000,
59 SupportsVisibleRegion = 0x0001,
60 SupportsSetBearing = 0x0002,
61 SupportsAnchoringCoordinate = 0x0004,
62 SupportsFittingViewportToGeoRectangle = 0x0008,
63 SupportsVisibleArea = 0x0010,
64 };
65
66 Q_ENUM(Capability)
67 Q_DECLARE_FLAGS(Capabilities, Capability)
68 Q_FLAG(Capabilities)
69
70 virtual ~QGeoMap();
71
72 // Sets the display size
73 void setViewportSize(const QSize& viewportSize);
74 QSize viewportSize() const;
75 int viewportWidth() const;
76 int viewportHeight() const;
77
78
79 const QGeoCameraData &cameraData() const;
80 QGeoCameraCapabilities cameraCapabilities() const;
81 virtual Capabilities capabilities() const;
82
83 void setActiveMapType(const QGeoMapType &mapType);
84 QGeoMapType activeMapType() const;
85
86 // returns the minimum zoom at the current viewport size
87 double minimumZoom() const;
88 double maximumCenterLatitudeAtZoom(const QGeoCameraData &cameraData) const;
89 double minimumCenterLatitudeAtZoom(const QGeoCameraData &cameraData) const;
90
91 // returns the size of the underlying map, at the current zoom level. Unrelated to width()/height()/size().
92 double mapWidth() const;
93 double mapHeight() const;
94
95 const QGeoProjection &geoProjection() const;
96
97 virtual void prefetchData();
98 virtual void clearData();
99
100 ItemTypes supportedMapItemTypes() const;
101
102 void addMapItem(QDeclarativeGeoMapItemBase *item);
103 void removeMapItem(QDeclarativeGeoMapItemBase *item);
104 void clearMapItems();
105
106 virtual QString copyrightsStyleSheet() const;
107 virtual void setAcceptedGestures(bool pan, bool flick, bool pinch, bool rotate, bool tilt);
108 virtual bool handleEvent(QEvent *event);
109
110 virtual bool setBearing(qreal bearing, const QGeoCoordinate &coordinate);
111 virtual QGeoShape visibleRegion() const;
112 virtual bool anchorCoordinateToPoint(const QGeoCoordinate &coordinate, const QPointF &anchorPoint);
113 virtual bool fitViewportToGeoRectangle(const QGeoRectangle &rectangle, const QMargins &borders);
114
115 virtual void setCopyrightVisible(bool visible);
116 virtual void setItemToWindowTransform(const QTransform &itemToWindowTransform);
117
118 void setVisibleArea(const QRectF &visibleArea);
119 QRectF visibleArea() const;
120
121protected:
122 QGeoMap(QGeoMapPrivate &dd, QObject *parent = nullptr);
123 void setCameraData(const QGeoCameraData &cameraData);
124 void setCameraCapabilities(const QGeoCameraCapabilities &cameraCapabilities);
125 virtual QSGNode *updateSceneGraph(QSGNode *node, QQuickWindow *window) = 0;
126
127Q_SIGNALS:
128 void cameraDataChanged(const QGeoCameraData &cameraData);
129 void sgNodeChanged();
130 void activeMapTypeChanged();
131 void cameraCapabilitiesChanged(const QGeoCameraCapabilities &oldCameraCapabilities);
132 void copyrightsImageChanged(const QImage &copyrightsImage);
133 void copyrightsChanged(const QString &copyrightsHtml);
134 void copyrightsStyleSheetChanged(const QString &styleSheet);
135 void visibleAreaChanged();
136
137private:
138 Q_DISABLE_COPY(QGeoMap)
139 friend class QDeclarativeGeoMap; //updateSceneGraph
140};
141
142Q_DECLARE_OPERATORS_FOR_FLAGS(QGeoMap::ItemTypes)
143
144QT_END_NAMESPACE
145
146#endif // QGEOMAP_P_H
Combined button and popup list for selecting options.