#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 }; Type type(const QJsonObject &json); bool crs(const QJsonObject &object, Projection &proj); bool point(const QJsonObject &object, const Projection &parent, const QJsonValue &properties, Waypoint &waypoint); bool multiPoint(const QJsonObject &object, const Projection &parent, const QJsonValue &properties, QVector &waypoints); bool lineString(const QJsonObject &coordinates, const Projection &parent, const QJsonValue &properties, TrackData &track); bool multiLineString(const QJsonObject &object, const Projection &proj, const QJsonValue &properties, TrackData &track); bool polygon(const QJsonObject &object, const Projection &parent, const QJsonValue &properties, Area &area); bool multiPolygon(const QJsonObject &object, const Projection &proj, const QJsonValue &properties, Area &area); bool geometryCollection(const QJsonObject &json, const Projection &parent, const QJsonValue &properties, QList &tracks, QList &areas, QVector &waypoints); bool feature(const QJsonObject &json, const Projection &parent, QList &tracks, QList &areas, QVector &waypoints); bool featureCollection(const QJsonObject &object, const Projection &parent, QList &tracks, QList &areas, QVector &waypoints); QString _errorString; }; #endif // GEOJSONPARSER_H