1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-30 22:51:16 +01:00
GPXSee/src/data/geojsonparser.h

59 lines
1.9 KiB
C
Raw Normal View History

2019-01-25 22:18:21 +01:00
#ifndef GEOJSONPARSER_H
#define GEOJSONPARSER_H
#include <QJsonObject>
#include "parser.h"
class QJsonObject;
class QJsonArray;
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
};
Type type(const QJsonObject &json);
2019-01-25 22:18:21 +01:00
bool point(const QJsonArray &coordinates, Waypoint &waypoint,
const QJsonValue &properties = QJsonValue());
2019-01-25 22:18:21 +01:00
bool multiPoint(const QJsonArray &coordinates,
QVector<Waypoint> &waypoints, const QJsonValue &properties = QJsonValue());
2019-02-11 23:28:08 +01:00
bool lineString(const QJsonArray &coordinates, SegmentData &segment);
2019-01-25 22:18:21 +01:00
bool lineString(const QJsonArray &coordinates, TrackData &track,
const QJsonValue &properties = QJsonValue());
2019-01-25 22:18:21 +01:00
bool multiLineString(const QJsonArray &coordinates,
TrackData &track, const QJsonValue &properties = QJsonValue());
2019-01-31 01:46:53 +01:00
bool polygon(const QJsonArray &coordinates, ::Polygon &pg);
bool polygon(const QJsonArray &coordinates, Area &area,
const QJsonValue &properties = QJsonValue());
2019-01-31 01:46:53 +01:00
bool multiPolygon(const QJsonArray &coordinates, Area &area,
const QJsonValue &properties = QJsonValue());
2019-01-25 22:18:21 +01:00
bool geometryCollection(const QJsonObject &json, QList<TrackData> &tracks,
2019-01-31 01:46:53 +01:00
QList<Area> &areas, QVector<Waypoint> &waypoints,
const QJsonValue &properties = QJsonValue());
2019-01-25 22:18:21 +01:00
bool feature(const QJsonObject &json, QList<TrackData> &tracks,
2019-01-31 01:46:53 +01:00
QList<Area> &areas, QVector<Waypoint> &waypoints);
2019-01-25 22:18:21 +01:00
bool featureCollection(const QJsonObject &json, QList<TrackData> &tracks,
2019-01-31 01:46:53 +01:00
QList<Area> &areas, QVector<Waypoint> &waypoints);
2019-01-25 22:18:21 +01:00
QString _errorString;
};
#endif // GEOJSONPARSER_H