#ifndef GEOJSONPARSER_H #define GEOJSONPARSER_H #include #include "parser.h" class QJsonObject; class QJsonArray; class Projection; class GeoJSONParser : public Parser { public: bool parse(QFile *file, QList &tracks, QList &routes, QList &areas, QVector &waypoints); QString errorString() const {return _errorString;} int errorLine() const {return 0;} private: enum Type { Unknown, Point, LineString, MultiPoint, Polygon, MultiLineString, MultiPolygon, GeometryCollection, Feature, FeatureCollection }; bool a2c(const QJsonArray &data, const Projection &proj, Coordinates &c); Type type(const QJsonObject &json); bool crs(const QJsonObject &object, Projection &proj); bool point(const QJsonObject &object, const Projection &parent, const QJsonValue &properties, QVector &waypoints); bool multiPoint(const QJsonObject &object, const Projection &parent, const QJsonValue &properties, QVector &waypoints); bool lineString(const QJsonObject &coordinates, const QString &file, const Projection &parent, const QJsonValue &properties, QList &tracks); bool multiLineString(const QJsonObject &object, const QString &file, const Projection &proj, const QJsonValue &properties, QList &tracks); bool polygon(const QJsonObject &object, const Projection &parent, const QJsonValue &properties, QList &areas); bool multiPolygon(const QJsonObject &object, const Projection &proj, const QJsonValue &properties, QList &areas); bool geometryCollection(const QJsonObject &json, const QString &file, const Projection &parent, const QJsonValue &properties, QList &tracks, QList &areas, QVector &waypoints); bool feature(const QJsonObject &json, const QString &file, const Projection &parent, QList &tracks, QList &areas, QVector &waypoints); bool featureCollection(const QJsonObject &object, const QString &file, const Projection &parent, QList &tracks, QList &areas, QVector &waypoints); QString _errorString; }; #endif // GEOJSONPARSER_H