1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-24 19:55:53 +01:00
GPXSee/src/map/prjfile.h

93 lines
2.5 KiB
C
Raw Normal View History

2021-06-17 21:58:25 +02:00
#ifndef PRJFILE_H
#define PRJFILE_H
#include <QFile>
#include "projection.h"
class Datum;
class Ellipsoid;
class PrimeMeridian;
class PRJFile
{
public:
PRJFile(const QString &fileName);
2021-06-22 07:42:48 +02:00
const Projection &projection() const {return _projection;}
const QString &errorString() const {return _errorString;}
2021-06-17 21:58:25 +02:00
private:
enum Token {
START, /* Initial value */
EOI, /* End of File */
ERROR, /* Parse error */
NUMBER, /* Real number */
STRING, /* String */
LBRK, /* '[' */
RBRK, /* ']' */
2021-06-22 07:42:48 +02:00
COMMA, /* ',' */
2021-06-17 21:58:25 +02:00
/* Keywords */
2021-06-21 23:35:31 +02:00
COMPD_CS, PROJCS, PROJECTION, GEOGCS, DATUM, SPHEROID, PRIMEM, UNIT,
AUTHORITY, AXIS, TOWGS84, PARAMETER, NORTH, SOUTH, EAST, WEST, UP, DOWN,
OTHER, VERT_CS, VERT_DATUM, GEOCCS, FITTED_CS, LOCAL_CS
2021-06-17 21:58:25 +02:00
};
struct CTX {
2021-06-27 16:00:08 +02:00
CTX(const QString &fileName) : file(fileName), token(START), line(1) {}
2021-06-17 21:58:25 +02:00
QFile file;
Token token;
QString string;
double number;
2021-06-27 16:00:08 +02:00
int line;
2021-06-17 21:58:25 +02:00
};
Token keyword(CTX &ctx);
int getChar(CTX &ctx);
void error(CTX &ctx);
void nextToken(CTX &ctx);
void compare(CTX &ctx, Token token);
2021-06-21 23:35:31 +02:00
void CS(CTX &ctx);
2021-06-17 21:58:25 +02:00
void horizontalCS(CTX &ctx);
2021-06-21 23:35:31 +02:00
void verticalCS(CTX &ctx);
2021-06-17 21:58:25 +02:00
void geographicCS(CTX &ctx, GCS *gcs);
void projectedCS(CTX &ctx, PCS *pcs);
2021-06-21 23:35:31 +02:00
void compdCS(CTX &ctx);
2021-06-17 21:58:25 +02:00
void projection(CTX &ctx, Projection::Method *method);
void parameter(CTX &ctx, Projection::Setup *setup);
void datum(CTX &ctx, Datum *dtm, int *epsg);
2021-06-21 23:35:31 +02:00
void verticalDatum(CTX &ctx);
2021-06-17 21:58:25 +02:00
void unit(CTX &ctx, double *val, int *epsg);
void angularUnit(CTX &ctx, AngularUnits *au, int *epsg);
void primeMeridian(CTX &ctx, PrimeMeridian *pm, int *epsg);
void linearUnit(CTX &ctx, LinearUnits *lu);
void spheroid(CTX &ctx, Ellipsoid *el);
void authority(CTX &ctx, int *epsg);
void toWGS84(CTX &ctx, double *dx, double *dy, double *dz, double *rx,
double *ry, double *rz, double *ds);
void twinAxis(CTX &ctx);
void axis(CTX &ctx);
void axisType(CTX &ctx);
void optAuthority(CTX &ctx, int *epsg);
void optDatum(CTX &ctx, double *dx, double *dy, double *dz, double *rx,
double *ry, double *rz, double *ds, int *epsg);
void optDatum2(CTX &ctx, double *dx, double *dy, double *dz, double *rx,
double *ry, double *rz, double *ds, int *epsg);
void optGeographicCS(CTX &ctx, int *epsg);
void optGeographicCS2(CTX &ctx, int *epsg);
void optProjectedCS(CTX &ctx, int *epsg);
void optProjectedCS2(CTX &ctx, int *epsg);
2021-06-21 23:35:31 +02:00
void optCS(CTX &ctx, int *epsg);
void optVerticalCS(CTX &ctx, int *epsg);
void optVerticalCS2(CTX &ctx, int *epsg);
2021-06-17 21:58:25 +02:00
Projection _projection;
QString _errorString;
};
#endif // PRJFILE_H