1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2025-06-07 18:53:02 +02:00

Compare commits

...

4 Commits

8 changed files with 37 additions and 99 deletions

View File

@ -1,4 +1,4 @@
version: 13.39.{build} version: 13.40.{build}
configuration: configuration:
- Release - Release

View File

@ -3,7 +3,7 @@ unix:!macx:!android {
} else { } else {
TARGET = GPXSee TARGET = GPXSee
} }
VERSION = 13.39 VERSION = 13.40
QT += core \ QT += core \
gui \ gui \

View File

@ -49,7 +49,7 @@ Unicode true
; The name of the installer ; The name of the installer
Name "GPXSee" Name "GPXSee"
; Program version ; Program version
!define VERSION "13.39" !define VERSION "13.40"
; The file to write ; The file to write
OutFile "GPXSee-${VERSION}_x64.exe" OutFile "GPXSee-${VERSION}_x64.exe"

View File

@ -22,52 +22,6 @@ struct DR {
char FieldTagSize; char FieldTagSize;
}; };
const QVariant *ISO8211::Field::data(quint32 name, int idx) const
{
const QVector<QVariant> &v = _data.at(idx);
for (int i = 0; i < _subFields->size(); i++)
if (_subFields->at(i) == name)
return &v.at(i);
return 0;
}
bool ISO8211::Field::subfield(quint32 name, int *val, int idx) const
{
bool ok;
const QVariant *v = data(name, idx);
if (!v)
return false;
*val = v->toInt(&ok);
return ok;
}
bool ISO8211::Field::subfield(quint32 name, uint *val, int idx) const
{
bool ok;
const QVariant *v = data(name, idx);
if (!v)
return false;
*val = v->toUInt(&ok);
return ok;
}
bool ISO8211::Field::subfield(quint32 name, QByteArray *val, int idx) const
{
const QVariant *v = data(name, idx);
if (!v)
return false;
*val = v->toByteArray();
return true;
}
ISO8211::SubFieldDefinition ISO8211::fieldType(const QString &str, int cnt) ISO8211::SubFieldDefinition ISO8211::fieldType(const QString &str, int cnt)
{ {
if (str == "A" || str == "I" || str == "R") if (str == "A" || str == "I" || str == "R")
@ -338,7 +292,7 @@ bool ISO8211::readRecord(Record &record)
return false; return false;
} }
record[i] = Field(def.tag, it->tags(), data); record[i] = Field(def.tag, data);
} }
return true; return true;

View File

@ -15,22 +15,14 @@ public:
class Field class Field
{ {
public: public:
Field() : _subFields(0) {} Field() : _tag(0) {}
Field(quint32 tag, const QVector<quint32> &subFields, const Data &data) Field(quint32 tag, const Data &data) : _tag(tag), _data(data) {}
: _tag(tag), _subFields(&subFields), _data(data) {}
quint32 tag() const {return _tag;} quint32 tag() const {return _tag;}
const Data &data() const {return _data;} const Data &data() const {return _data;}
bool subfield(quint32 name, int *val, int idx = 0) const;
bool subfield(quint32 name, uint *val, int idx = 0) const;
bool subfield(quint32 name, QByteArray *val, int idx = 0) const;
private: private:
const QVariant *data(quint32 name, int idx = 0) const;
quint32 _tag; quint32 _tag;
const QVector<quint32> *_subFields;
Data _data; Data _data;
}; };
@ -39,7 +31,6 @@ public:
ISO8211(const QString &path) : _file(path) {} ISO8211(const QString &path) : _file(path) {}
bool readDDR(); bool readDDR();
bool readRecord(Record &record); bool readRecord(Record &record);
const QString &errorString() const {return _errorString;} const QString &errorString() const {return _errorString;}
static const Field *field(const Record &record, quint32 name); static const Field *field(const Record &record, quint32 name);

View File

@ -15,7 +15,6 @@ using namespace ENC;
#define PRIM_L 2 #define PRIM_L 2
#define PRIM_A 3 #define PRIM_A 3
constexpr quint32 RCID = ISO8211::NAME("RCID");
constexpr quint32 SG2D = ISO8211::NAME("SG2D"); constexpr quint32 SG2D = ISO8211::NAME("SG2D");
constexpr quint32 SG3D = ISO8211::NAME("SG3D"); constexpr quint32 SG3D = ISO8211::NAME("SG3D");
constexpr quint32 FSPT = ISO8211::NAME("FSPT"); constexpr quint32 FSPT = ISO8211::NAME("FSPT");
@ -24,9 +23,6 @@ constexpr quint32 ATTF = ISO8211::NAME("ATTF");
constexpr quint32 VRID = ISO8211::NAME("VRID"); constexpr quint32 VRID = ISO8211::NAME("VRID");
constexpr quint32 FRID = ISO8211::NAME("FRID"); constexpr quint32 FRID = ISO8211::NAME("FRID");
constexpr quint32 DSPM = ISO8211::NAME("DSPM"); constexpr quint32 DSPM = ISO8211::NAME("DSPM");
constexpr quint32 COMF = ISO8211::NAME("COMF");
constexpr quint32 SOMF = ISO8211::NAME("SOMF");
constexpr quint32 HUNI = ISO8211::NAME("HUNI");
static QMap<uint,uint> orderMapInit() static QMap<uint,uint> orderMapInit()
{ {
@ -106,8 +102,7 @@ static uint order(uint type)
static void warning(const ISO8211::Field &frid, uint prim) static void warning(const ISO8211::Field &frid, uint prim)
{ {
uint rcid = 0xFFFFFFFF; uint rcid = frid.data().at(0).at(1).toUInt();
frid.subfield(RCID, &rcid);
switch (prim) { switch (prim) {
case PRIM_P: case PRIM_P:
@ -771,10 +766,14 @@ bool MapData::processRecord(const ISO8211::Record &record,
quint32 tag = f.tag(); quint32 tag = f.tag();
if (tag == VRID) { if (tag == VRID) {
bool nmok, idok;
if (f.data().at(0).size() < 2) if (f.data().at(0).size() < 2)
return false; return false;
int rcnm = f.data().at(0).at(0).toInt(); int rcnm = f.data().at(0).at(0).toInt(&nmok);
uint rcid = f.data().at(0).at(1).toUInt(); uint rcid = f.data().at(0).at(1).toUInt(&idok);
if (!(nmok && idok))
return false;
switch (rcnm) { switch (rcnm) {
case RCNM_VI: case RCNM_VI:
@ -795,10 +794,15 @@ bool MapData::processRecord(const ISO8211::Record &record,
} else if (tag == FRID) { } else if (tag == FRID) {
fe.append(record); fe.append(record);
} else if (tag == DSPM) { } else if (tag == DSPM) {
if (!(f.subfield(COMF, &comf) && f.subfield(SOMF, &somf))) bool cok, sok, hok;
return false;
if (!f.subfield(HUNI, &huni)) if (f.data().at(0).size() < 12)
return false; return false;
comf = f.data().at(0).at(10).toUInt(&cok);
somf = f.data().at(0).at(11).toUInt(&sok);
huni = f.data().at(0).at(7).toUInt(&hok);
return (cok && sok && hok);
} }
return true; return true;

View File

@ -13,12 +13,6 @@ using namespace ENC;
#define TILE_SIZE 512 #define TILE_SIZE 512
constexpr quint32 CATD = ISO8211::NAME("CATD"); constexpr quint32 CATD = ISO8211::NAME("CATD");
constexpr quint32 IMPL = ISO8211::NAME("IMPL");
constexpr quint32 F1LE = ISO8211::NAME("FILE");
constexpr quint32 SLAT = ISO8211::NAME("SLAT");
constexpr quint32 WLON = ISO8211::NAME("WLON");
constexpr quint32 NLAT = ISO8211::NAME("NLAT");
constexpr quint32 ELON = ISO8211::NAME("ELON");
Range ENCAtlas::zooms(IntendedUsage usage) Range ENCAtlas::zooms(IntendedUsage usage)
{ {
@ -67,27 +61,19 @@ bool ENCAtlas::processRecord(const ISO8211::Record &record, QByteArray &file,
if (record.size() < 2) if (record.size() < 2)
return false; return false;
const ENC::ISO8211::Field &f = record.at(1); const ENC::ISO8211::Field &field = record.at(1);
if (f.tag() == CATD) { if (field.tag() == CATD) {
QByteArray impl; if (field.data().at(0).size() < 10)
if (!f.subfield(IMPL, &impl))
return false;
if (!f.subfield(F1LE, &file))
return false; return false;
QByteArray impl = field.data().at(0).at(5).toByteArray();
file = field.data().at(0).at(2).toByteArray();
if (impl == "BIN" && file.endsWith("000")) { if (impl == "BIN" && file.endsWith("000")) {
QByteArray slat, wlon, nlat, elon; QByteArray slat = field.data().at(0).at(6).toByteArray();
QByteArray wlon = field.data().at(0).at(7).toByteArray();
if (!f.subfield(SLAT, &slat)) QByteArray nlat = field.data().at(0).at(8).toByteArray();
return false; QByteArray elon = field.data().at(0).at(9).toByteArray();
if (!f.subfield(WLON, &wlon))
return false;
if (!f.subfield(NLAT, &nlat))
return false;
if (!f.subfield(ELON, &elon))
return false;
bool ok1, ok2, ok3, ok4; bool ok1, ok2, ok3, ok4;
bounds = RectC(Coordinates(wlon.toDouble(&ok1), nlat.toDouble(&ok2)), bounds = RectC(Coordinates(wlon.toDouble(&ok1), nlat.toDouble(&ok2)),

View File

@ -19,9 +19,7 @@ constexpr quint32 SG2D = ISO8211::NAME("SG2D");
constexpr quint32 SG3D = ISO8211::NAME("SG3D"); constexpr quint32 SG3D = ISO8211::NAME("SG3D");
constexpr quint32 VRID = ISO8211::NAME("VRID"); constexpr quint32 VRID = ISO8211::NAME("VRID");
constexpr quint32 DSID = ISO8211::NAME("DSID"); constexpr quint32 DSID = ISO8211::NAME("DSID");
constexpr quint32 DSNM = ISO8211::NAME("DSNM");
constexpr quint32 DSPM = ISO8211::NAME("DSPM"); constexpr quint32 DSPM = ISO8211::NAME("DSPM");
constexpr quint32 COMF = ISO8211::NAME("COMF");
static Range zooms(const RectC &bounds) static Range zooms(const RectC &bounds)
{ {
@ -116,10 +114,15 @@ bool ENCMap::processRecord(const ISO8211::Record &record,
if (tag == VRID) { if (tag == VRID) {
rv.append(record); rv.append(record);
} else if (tag == DSID) { } else if (tag == DSID) {
if (!f.subfield(DSNM, &dsnm)) if (f.data().at(0).size() < 5)
return false; return false;
dsnm = f.data().at(0).at(4).toByteArray();
} else if (tag == DSPM) { } else if (tag == DSPM) {
if (!f.subfield(COMF, &comf)) bool ok;
if (f.data().at(0).size() < 11)
return false;
comf = f.data().at(0).at(10).toUInt(&ok);
if (!ok)
return false; return false;
} }