2019-01-25 22:18:21 +01:00
|
|
|
#ifndef GEOJSONPARSER_H
|
|
|
|
#define GEOJSONPARSER_H
|
|
|
|
|
|
|
|
#include <QJsonObject>
|
|
|
|
#include "parser.h"
|
|
|
|
|
|
|
|
class QJsonObject;
|
|
|
|
class QJsonArray;
|
2024-03-09 17:51:43 +01:00
|
|
|
class Projection;
|
2019-01-25 22:18:21 +01:00
|
|
|
|
|
|
|
class GeoJSONParser : public Parser
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
bool parse(QFile *file, QList<TrackData> &tracks, QList<RouteData> &routes,
|
2019-01-31 01:46:53 +01:00
|
|
|
QList<Area> &areas, QVector<Waypoint> &waypoints);
|
2019-01-25 22:18:21 +01:00
|
|
|
QString errorString() const {return _errorString;}
|
|
|
|
int errorLine() const {return 0;}
|
|
|
|
|
|
|
|
private:
|
2019-01-31 01:46:53 +01:00
|
|
|
enum Type {
|
|
|
|
Unknown,
|
|
|
|
Point,
|
|
|
|
LineString,
|
|
|
|
MultiPoint,
|
|
|
|
Polygon,
|
|
|
|
MultiLineString,
|
|
|
|
MultiPolygon,
|
|
|
|
GeometryCollection,
|
|
|
|
Feature,
|
|
|
|
FeatureCollection
|
|
|
|
};
|
|
|
|
|
2024-03-11 23:09:38 +01:00
|
|
|
bool a2c(const QJsonArray &data, const Projection &proj, Coordinates &c);
|
2019-01-31 01:46:53 +01:00
|
|
|
Type type(const QJsonObject &json);
|
2024-03-09 17:51:43 +01:00
|
|
|
bool crs(const QJsonObject &object, Projection &proj);
|
|
|
|
bool point(const QJsonObject &object, const Projection &parent,
|
2024-03-10 07:46:50 +01:00
|
|
|
const QJsonValue &properties, QVector<Waypoint> &waypoints);
|
2024-03-09 17:51:43 +01:00
|
|
|
bool multiPoint(const QJsonObject &object, const Projection &parent,
|
|
|
|
const QJsonValue &properties, QVector<Waypoint> &waypoints);
|
2024-09-06 00:05:36 +02:00
|
|
|
bool lineString(const QJsonObject &coordinates, const QString &file,
|
|
|
|
const Projection &parent, const QJsonValue &properties,
|
|
|
|
QList<TrackData> &tracks);
|
|
|
|
bool multiLineString(const QJsonObject &object, const QString &file,
|
|
|
|
const Projection &proj, const QJsonValue &properties,
|
|
|
|
QList<TrackData> &tracks);
|
2024-03-09 17:51:43 +01:00
|
|
|
bool polygon(const QJsonObject &object, const Projection &parent,
|
2024-03-10 07:46:50 +01:00
|
|
|
const QJsonValue &properties, QList<Area> &areas);
|
2024-03-09 17:51:43 +01:00
|
|
|
bool multiPolygon(const QJsonObject &object, const Projection &proj,
|
2024-03-10 07:46:50 +01:00
|
|
|
const QJsonValue &properties, QList<Area> &areas);
|
2024-09-06 00:05:36 +02:00
|
|
|
bool geometryCollection(const QJsonObject &json, const QString &file,
|
|
|
|
const Projection &parent, const QJsonValue &properties,
|
2024-03-09 17:51:43 +01:00
|
|
|
QList<TrackData> &tracks, QList<Area> &areas, QVector<Waypoint> &waypoints);
|
2024-09-06 00:05:36 +02:00
|
|
|
bool feature(const QJsonObject &json, const QString &file,
|
|
|
|
const Projection &parent, QList<TrackData> &tracks, QList<Area> &areas,
|
|
|
|
QVector<Waypoint> &waypoints);
|
|
|
|
bool featureCollection(const QJsonObject &object, const QString &file,
|
|
|
|
const Projection &parent, QList<TrackData> &tracks, QList<Area> &areas,
|
|
|
|
QVector<Waypoint> &waypoints);
|
2019-01-25 22:18:21 +01:00
|
|
|
|
|
|
|
QString _errorString;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // GEOJSONPARSER_H
|