1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-28 05:34:47 +01:00

Compare commits

..

No commits in common. "6564c61b00e3fb7429fb58c6eda4b92a1bb41c57" and "5d6970c7eea6eed1a900a45c79109b7444398ff3" have entirely different histories.

4 changed files with 28 additions and 29 deletions

View File

@ -180,7 +180,7 @@ Label LBLFile::str2label(const QVector<quint8> &str, bool capitalize,
Shield(shieldType, _codec.toString(shieldLabel))); Shield(shieldType, _codec.toString(shieldLabel)));
} }
Label LBLFile::label6b(const SubFile *file, Handle &fileHdl, bool capitalize, Label LBLFile::label6b(const SubFile *file, Handle &hdl, bool capitalize,
bool convert) const bool convert) const
{ {
Shield::Type shieldType = Shield::None; Shield::Type shieldType = Shield::None;
@ -191,8 +191,8 @@ Label LBLFile::label6b(const SubFile *file, Handle &fileHdl, bool capitalize,
int split = -1; int split = -1;
while (true) { while (true) {
if (!(file->readByte(fileHdl, &b1) && file->readByte(fileHdl, &b2) if (!(file->readByte(hdl, &b1) && file->readByte(hdl, &b2)
&& file->readByte(fileHdl, &b3))) && file->readByte(hdl, &b3)))
return Label(); return Label();
int c[]= {b1>>2, (b1&0x3)<<4|b2>>4, (b2&0xF)<<2|b3>>6, b3&0x3F}; int c[]= {b1>>2, (b1&0x3)<<4|b2>>4, (b2&0xF)<<2|b3>>6, b3&0x3F};
@ -244,14 +244,14 @@ Label LBLFile::label6b(const SubFile *file, Handle &fileHdl, bool capitalize,
} }
} }
Label LBLFile::label8b(const SubFile *file, Handle &fileHdl, bool capitalize, Label LBLFile::label8b(const SubFile *file, Handle &hdl, bool capitalize,
bool convert) const bool convert) const
{ {
QVector<quint8> str; QVector<quint8> str;
quint8 c; quint8 c;
do { do {
if (!file->readByte(fileHdl, &c)) if (!file->readByte(hdl, &c))
return Label(); return Label();
str.append(c); str.append(c);
} while (c); } while (c);
@ -259,12 +259,13 @@ Label LBLFile::label8b(const SubFile *file, Handle &fileHdl, bool capitalize,
return str2label(str, capitalize, convert); return str2label(str, capitalize, convert);
} }
Label LBLFile::labelHuffman(Handle &hdl, const SubFile *file, Handle &fileHdl, Label LBLFile::labelHuffman(const SubFile *file, Handle &hdl, bool capitalize,
bool capitalize, bool convert) const bool convert) const
{ {
QVector<quint8> str; QVector<quint8> str;
quint32 end = _offset + _size;
if (!_huffmanText->decode(file, fileHdl, 0xFFFFFFFF, str)) if (!_huffmanText->decode(file, hdl, end - pos(hdl), str))
return Label(); return Label();
if (!_table) if (!_table)
return str2label(str, capitalize, convert); return str2label(str, capitalize, convert);
@ -283,7 +284,7 @@ Label LBLFile::labelHuffman(Handle &hdl, const SubFile *file, Handle &fileHdl,
else if (str2.size()) else if (str2.size())
str2.append(' '); str2.append(' ');
if (!_huffmanText->decode(this, hdl, _offset + _size - off, str2)) if (!_huffmanText->decode(file, hdl, end - off, str2))
return Label(); return Label();
} else { } else {
if (str.at(i) == 7) { if (str.at(i) == 7) {
@ -319,20 +320,20 @@ Label LBLFile::label(Handle &hdl, quint32 offset, bool poi, bool capitalize,
if (!seek(hdl, labelOffset)) if (!seek(hdl, labelOffset))
return Label(); return Label();
return label(hdl, this, hdl, capitalize, convert); return label(this, hdl, capitalize, convert);
} }
Label LBLFile::label(Handle &hdl, const SubFile *file, Handle &fileHdl, Label LBLFile::label(const SubFile *file, Handle &hdl, bool capitalize,
bool capitalize, bool convert) const bool convert) const
{ {
switch (_encoding) { switch (_encoding) {
case 6: case 6:
return label6b(file, fileHdl, capitalize, convert); return label6b(file, hdl, capitalize, convert);
case 9: case 9:
case 10: case 10:
return label8b(file, fileHdl, capitalize, convert); return label8b(file, hdl, capitalize, convert);
case 11: case 11:
return labelHuffman(hdl, file, fileHdl, capitalize, convert); return labelHuffman(file, hdl, capitalize, convert);
default: default:
return Label(); return Label();
} }

View File

@ -33,8 +33,8 @@ public:
Label label(Handle &hdl, quint32 offset, bool poi = false, Label label(Handle &hdl, quint32 offset, bool poi = false,
bool capitalize = true, bool convert = false) const; bool capitalize = true, bool convert = false) const;
Label label(Handle &hdl, const SubFile *file, Handle &fileHdl, Label label(const SubFile *file, Handle &hdl, bool capitalize = true,
bool capitalize = true, bool convert = false) const; bool convert = false) const;
quint8 imageIdSize() const {return _imgOffsetIdSize;} quint8 imageIdSize() const {return _imgOffsetIdSize;}
QPixmap image(Handle &hdl, quint32 id) const; QPixmap image(Handle &hdl, quint32 id) const;
@ -47,12 +47,12 @@ private:
Label str2label(const QVector<quint8> &str, bool capitalize, Label str2label(const QVector<quint8> &str, bool capitalize,
bool convert) const; bool convert) const;
Label label6b(const SubFile *file, Handle &fileHdl, bool capitalize, Label label6b(const SubFile *file, Handle &hdl, bool capitalize,
bool convert) const; bool convert) const;
Label label8b(const SubFile *file, Handle &fileHdl, bool capitalize, Label label8b(const SubFile *file, Handle &hdl, bool capitalize,
bool convert) const;
Label labelHuffman(const SubFile *file, Handle &hdl, bool capitalize,
bool convert) const; bool convert) const;
Label labelHuffman(Handle &hdl, const SubFile *file, Handle &fileHdl,
bool capitalize, bool convert) const;
bool loadRasterTable(Handle &hdl, quint32 offset, quint32 size, bool loadRasterTable(Handle &hdl, quint32 offset, quint32 size,
quint32 recordSize); quint32 recordSize);

View File

@ -33,7 +33,7 @@ RGNFile::~RGNFile()
} }
bool RGNFile::readClassFields(Handle &hdl, SegmentType segmentType, bool RGNFile::readClassFields(Handle &hdl, SegmentType segmentType,
void *object, const LBLFile *lbl, Handle &lblHdl) const void *object, const LBLFile *lbl) const
{ {
quint8 flags; quint8 flags;
quint32 rs; quint32 rs;
@ -83,11 +83,10 @@ bool RGNFile::readClassFields(Handle &hdl, SegmentType segmentType,
if (point && (flags & 1) && lbl) { if (point && (flags & 1) && lbl) {
quint32 p = pos(hdl); quint32 p = pos(hdl);
point->label = lbl->label(lblHdl, this, hdl); point->label = lbl->label(this, hdl);
point->classLabel = true; point->classLabel = true;
Q_ASSERT(pos(hdl) - p <= rs + 4); rs -= (pos(hdl) - p);
seek(hdl, p);
} }
return seek(hdl, pos(hdl) + rs); return seek(hdl, pos(hdl) + rs);
@ -357,8 +356,7 @@ bool RGNFile::extPolyObjects(Handle &hdl, const SubDiv *subdiv, quint32 shift,
if (subtype & 0x20 && !readUInt24(hdl, labelPtr)) if (subtype & 0x20 && !readUInt24(hdl, labelPtr))
return false; return false;
if (subtype & 0x80 && !readClassFields(hdl, segmentType, &poly, lbl, if (subtype & 0x80 && !readClassFields(hdl, segmentType, &poly, lbl))
lblHdl))
return false; return false;
if (subtype & 0x40 && !skipLclFields(hdl, segmentType == Line if (subtype & 0x40 && !skipLclFields(hdl, segmentType == Line
? _linesLclFlags : _polygonsLclFlags)) ? _linesLclFlags : _polygonsLclFlags))
@ -448,7 +446,7 @@ bool RGNFile::extPointObjects(Handle &hdl, const SubDiv *subdiv,
if (subtype & 0x20 && !readUInt24(hdl, labelPtr)) if (subtype & 0x20 && !readUInt24(hdl, labelPtr))
return false; return false;
if (subtype & 0x80 && !readClassFields(hdl, Point, &point, lbl, lblHdl)) if (subtype & 0x80 && !readClassFields(hdl, Point, &point, lbl))
return false; return false;
if (subtype & 0x40 && !skipLclFields(hdl, _pointsLclFlags)) if (subtype & 0x40 && !skipLclFields(hdl, _pointsLclFlags))
return false; return false;

View File

@ -63,7 +63,7 @@ public:
private: private:
bool segments(Handle &hdl, SubDiv *subdiv, SubDiv::Segment seg[5]) const; bool segments(Handle &hdl, SubDiv *subdiv, SubDiv::Segment seg[5]) const;
bool readClassFields(Handle &hdl, SegmentType segmentType, void *object, bool readClassFields(Handle &hdl, SegmentType segmentType, void *object,
const LBLFile *lbl, Handle &lblHdl) const; const LBLFile *lbl) const;
bool skipLclFields(Handle &hdl, const quint32 flags[3]) const; bool skipLclFields(Handle &hdl, const quint32 flags[3]) const;
bool skipGblFields(Handle &hdl, quint32 flags) const; bool skipGblFields(Handle &hdl, quint32 flags) const;