51 QML_NAMED_ELEMENT(GeoMapItemBase)
52 QML_ADDED_IN_VERSION(5, 0)
53 QML_UNCREATABLE(
"GeoMapItemBase is not intended instantiable by developer.")
54 Q_ENUMS(ReferenceSurface)
56 Q_PROPERTY(QGeoShape geoShape READ geoShape WRITE setGeoShape STORED
false )
57 Q_PROPERTY(
bool autoFadeIn READ autoFadeIn WRITE setAutoFadeIn REVISION(5, 14))
58 Q_PROPERTY(QLocation::ReferenceSurface referenceSurface READ referenceSurface WRITE setReferenceSurface NOTIFY referenceSurfaceChanged REVISION(6, 6))
59 Q_PROPERTY(
int lodThreshold READ lodThreshold WRITE setLodThreshold NOTIFY lodThresholdChanged REVISION(5, 15))
62 explicit QDeclarativeGeoMapItemBase(QQuickItem *parent =
nullptr);
63 virtual ~QDeclarativeGeoMapItemBase();
66 virtual void setMap(QDeclarativeGeoMap *quickMap, QGeoMap *map);
67 virtual void setPositionOnMap(
const QGeoCoordinate &coordinate,
const QPointF &offset);
69 QDeclarativeGeoMap *quickMap()
const {
return quickMap_; }
70 QGeoMap *map()
const {
return map_; }
71 virtual const QGeoShape &geoShape()
const = 0;
72 virtual void setGeoShape(
const QGeoShape &shape) = 0;
74 bool autoFadeIn()
const;
75 void setAutoFadeIn(
bool fadeIn);
77 QLocation::ReferenceSurface referenceSurface()
const;
78 void setReferenceSurface(QLocation::ReferenceSurface referenceSurface);
80 int lodThreshold()
const;
81 void setLodThreshold(
int lt);
82 unsigned int zoomForLOD(
int zoom)
const;
84 QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *) override;
85 virtual QSGNode *updateMapItemPaintNode(QSGNode *, UpdatePaintNodeData *);
87 inline QGeoMap::ItemType itemType()
const {
return m_itemType; }
88 qreal mapItemOpacity()
const;
90 void setParentGroup(QDeclarativeGeoMapItemGroup &parentGroup);
92 template <
typename T = QObject>
93 QList<T*> quickChildren()
const
96 QObjectList kids = children();
97 const QList<QQuickItem *> quickKids = childItems();
98 for (
const auto &quickKid : quickKids)
99 kids.append(quickKid);
100 for (
auto *kid : std::as_const(kids)) {
101 if (
auto *val = qobject_cast<T*>(kid))
107 void setShapeTriangulationScale(QQuickShape *shape, qreal maxCoord)
const;
110 void mapItemOpacityChanged();
111 Q_REVISION(5, 12)
void addTransitionFinished();
112 Q_REVISION(5, 12)
void removeTransitionFinished();
113 void referenceSurfaceChanged();
114 void lodThresholdChanged();
117 virtual void afterChildrenChanged();
118 virtual void afterViewportChanged(
const QGeoMapViewportChangeEvent &event) = 0;
119 void polishAndUpdate();
122 float zoomLevelOpacity()
const;
123 bool isPolishScheduled()
const;
125 QGeoMap::ItemType m_itemType = QGeoMap::NoItem;
128 void baseCameraDataChanged(
const QGeoCameraData &camera);
129 void visibleAreaChanged();
132 QPointer<QGeoMap> map_;
133 QDeclarativeGeoMap *quickMap_ =
nullptr;
136 QGeoCameraData lastCameraData_;
138 QDeclarativeGeoMapItemGroup *parentGroup_ =
nullptr;
140 std::unique_ptr<QDeclarativeGeoMapItemTransitionManager> m_transitionManager;
141 bool m_autoFadeIn =
true;
142 QLocation::ReferenceSurface m_referenceSurface = QLocation::ReferenceSurface::Map;
143 int m_lodThreshold = 0;
145 friend class QDeclarativeGeoMap;
146 friend class QDeclarativeGeoMapItemView;
147 friend class QDeclarativeGeoMapItemTransitionManager;