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
qdeclarativegeojsondata_p.h
Go to the documentation of this file.
1// Copyright (C) 2019 Julian Sherollari <jdotsh@gmail.com>
2// Copyright (C) 2023 The Qt Company Ltd.
3// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
4// Qt-Security score:significant reason:default
5
6#ifndef QDECLARATIVEGEOJSONFILE_H
7#define QDECLARATIVEGEOJSONFILE_H
8
9//
10// W A R N I N G
11// -------------
12//
13// This file is not part of the Qt API. It exists purely as an
14// implementation detail. This header file may change from version to
15// version without notice, or even be removed.
16//
17// We mean it.
18//
19
20#include <QObject>
21#include <QJsonDocument>
22#include <QJsonObject>
23#include <QJsonArray>
24
25#include <QtLocation/private/qdeclarativegeomapitemview_p.h>
26#include <QtLocation/private/qdeclarativegeomapquickitem_p.h>
27#include <QtLocation/private/qdeclarativecirclemapitem_p.h>
28#include <QtLocation/private/qdeclarativepolylinemapitem_p.h>
29#include <QtLocation/private/qdeclarativepolygonmapitem_p.h>
30#include <QtLocation/private/qdeclarativerectanglemapitem_p.h>
31
32#include <QtQml/qqml.h>
33#include <QtQml/QQmlParserStatus>
34
36
37
39{
40 Q_OBJECT
41 QML_ADDED_IN_VERSION(6, 7)
42 QML_NAMED_ELEMENT(GeoJsonData)
43 Q_PROPERTY(QVariant model READ model WRITE setModel NOTIFY modelChanged)
44 Q_PROPERTY(QUrl sourceUrl READ sourceUrl WRITE openUrl NOTIFY sourceUrlChanged)
45
46public:
47 explicit QDeclarativeGeoJsonData(QObject *parent = nullptr);
48 virtual ~QDeclarativeGeoJsonData();
49
50 QVariant model() const;
51 void setModel(const QVariant &model);
52
53 QUrl sourceUrl() const;
54
55 Q_INVOKABLE void clear();
56 Q_INVOKABLE void addItem(QQuickItem *item);
57 Q_INVOKABLE bool open();
58 Q_INVOKABLE bool openUrl(const QUrl &url);
59 Q_INVOKABLE bool save();
60 Q_INVOKABLE bool saveAs(const QUrl &url);
61 Q_INVOKABLE void setModelToMapContents(QDeclarativeGeoMap *map);
62
63signals:
64 void modelChanged();
65 void sourceUrlChanged();
66
67private:
68 static QVariantList toVariant(QDeclarativeGeoMap *mapItemView);
69 static bool dumpGeoJSON(const QVariantList &geoJson, const QUrl &url);
70 static bool writeDebug(const QVariantList &geoJson, const QUrl &url);
71 static QString toString(const QVariantList &geoJson);
72
73 QVariant m_content;
74 QUrl m_url;
75};
76
77QT_END_NAMESPACE
78
79QML_DECLARE_TYPE(QDeclarativeGeoJsonData)
80
81#endif /* QDECLARATIVEGEOJSONFILE_H */
static QVariant toVariant(QObject *mapItem)
static bool hasProperties(QQuickItem *item)