51 QML_NAMED_ELEMENT(GeoMapItemBase)
52 QML_ADDED_IN_VERSION(5, 0)
53 QML_UNCREATABLE(
"GeoMapItemBase is not intended instantiable by developer.")
55 Q_PROPERTY(QGeoShape geoShape READ geoShape WRITE setGeoShape STORED
false )
56 Q_PROPERTY(
bool autoFadeIn READ autoFadeIn WRITE setAutoFadeIn REVISION(5, 14))
57 Q_PROPERTY(QLocation::ReferenceSurface referenceSurface READ referenceSurface WRITE setReferenceSurface NOTIFY referenceSurfaceChanged REVISION(6, 6))
58 Q_PROPERTY(
int lodThreshold READ lodThreshold WRITE setLodThreshold NOTIFY lodThresholdChanged REVISION(5, 15))
61 explicit QDeclarativeGeoMapItemBase(QQuickItem *parent =
nullptr);
62 virtual ~QDeclarativeGeoMapItemBase();
65 virtual void setMap(QDeclarativeGeoMap *quickMap, QGeoMap *map);
66 virtual void setPositionOnMap(
const QGeoCoordinate &coordinate,
const QPointF &offset);
68 QDeclarativeGeoMap *quickMap()
const {
return quickMap_; }
69 QGeoMap *map()
const {
return map_; }
70 virtual const QGeoShape &geoShape()
const = 0;
71 virtual void setGeoShape(
const QGeoShape &shape) = 0;
73 bool autoFadeIn()
const;
74 void setAutoFadeIn(
bool fadeIn);
76 QLocation::ReferenceSurface referenceSurface()
const;
77 void setReferenceSurface(QLocation::ReferenceSurface referenceSurface);
79 int lodThreshold()
const;
80 void setLodThreshold(
int lt);
81 unsigned int zoomForLOD(
int zoom)
const;
83 QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *) override;
84 virtual QSGNode *updateMapItemPaintNode(QSGNode *, UpdatePaintNodeData *);
86 inline QGeoMap::ItemType itemType()
const {
return m_itemType; }
87 qreal mapItemOpacity()
const;
89 void setParentGroup(QDeclarativeGeoMapItemGroup &parentGroup);
91 template <
typename T = QObject>
92 QList<T*> quickChildren()
const
95 QObjectList kids = children();
96 const QList<QQuickItem *> quickKids = childItems();
97 for (
const auto &quickKid : quickKids)
98 kids.append(quickKid);
99 for (
auto *kid : std::as_const(kids)) {
100 if (
auto *val = qobject_cast<T*>(kid))
106 void setShapeTriangulationScale(QQuickShape *shape, qreal maxCoord)
const;
109 void mapItemOpacityChanged();
110 Q_REVISION(5, 12)
void addTransitionFinished();
111 Q_REVISION(5, 12)
void removeTransitionFinished();
112 void referenceSurfaceChanged();
113 void lodThresholdChanged();
116 virtual void afterChildrenChanged();
117 virtual void afterViewportChanged(
const QGeoMapViewportChangeEvent &event) = 0;
118 void polishAndUpdate();
121 float zoomLevelOpacity()
const;
122 bool isPolishScheduled()
const;
124 QGeoMap::ItemType m_itemType = QGeoMap::NoItem;
127 void baseCameraDataChanged(
const QGeoCameraData &camera);
128 void visibleAreaChanged();
131 QPointer<QGeoMap> map_;
132 QDeclarativeGeoMap *quickMap_ =
nullptr;
135 QGeoCameraData lastCameraData_;
137 QDeclarativeGeoMapItemGroup *parentGroup_ =
nullptr;
139 std::unique_ptr<QDeclarativeGeoMapItemTransitionManager> m_transitionManager;
140 bool m_autoFadeIn =
true;
141 QLocation::ReferenceSurface m_referenceSurface = QLocation::ReferenceSurface::Map;
142 int m_lodThreshold = 0;
144 friend class QDeclarativeGeoMap;
145 friend class QDeclarativeGeoMapItemView;
146 friend class QDeclarativeGeoMapItemTransitionManager;