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