mirror of
https://github.com/tumic0/GPXSee.git
synced 2024-11-24 19:55:53 +01:00
Code cleanup
This commit is contained in:
parent
0cd20a1e57
commit
d63c666997
@ -125,7 +125,7 @@ bool RGNFile::polyObjects(Handle &hdl, const SubDiv *subdiv,
|
|||||||
|
|
||||||
if (!segment.isValid())
|
if (!segment.isValid())
|
||||||
return true;
|
return true;
|
||||||
if (!seek(hdl, segment.start()))
|
if (!seek(hdl, segment.offset()))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
quint32 labelPtr;
|
quint32 labelPtr;
|
||||||
@ -203,7 +203,7 @@ bool RGNFile::extPolyObjects(Handle &hdl, const SubDiv *subdiv, quint32 shift,
|
|||||||
|
|
||||||
if (!segment.isValid())
|
if (!segment.isValid())
|
||||||
return true;
|
return true;
|
||||||
if (!seek(hdl, segment.start()))
|
if (!seek(hdl, segment.offset()))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
while (hdl.pos < (int)segment.end()) {
|
while (hdl.pos < (int)segment.end()) {
|
||||||
@ -302,7 +302,7 @@ bool RGNFile::pointObjects(Handle &hdl, const SubDiv *subdiv,
|
|||||||
|
|
||||||
if (!segment.isValid())
|
if (!segment.isValid())
|
||||||
return true;
|
return true;
|
||||||
if (!seek(hdl, segment.start()))
|
if (!seek(hdl, segment.offset()))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
while (hdl.pos < (int)segment.end()) {
|
while (hdl.pos < (int)segment.end()) {
|
||||||
@ -348,7 +348,7 @@ bool RGNFile::extPointObjects(Handle &hdl, const SubDiv *subdiv, LBLFile *lbl,
|
|||||||
|
|
||||||
if (!segment.isValid())
|
if (!segment.isValid())
|
||||||
return true;
|
return true;
|
||||||
if (!seek(hdl, segment.start()))
|
if (!seek(hdl, segment.offset()))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
while (hdl.pos < (int)segment.end()) {
|
while (hdl.pos < (int)segment.end()) {
|
||||||
@ -412,22 +412,19 @@ QMap<RGNFile::SegmentType, SubDiv::Segment> RGNFile::segments(Handle &hdl,
|
|||||||
quint32 start = offset + 2 * (no - 1);
|
quint32 start = offset + 2 * (no - 1);
|
||||||
quint32 ls = 0;
|
quint32 ls = 0;
|
||||||
SegmentType lt = (SegmentType)0;
|
SegmentType lt = (SegmentType)0;
|
||||||
quint16 po;
|
|
||||||
int cnt = 0;
|
|
||||||
|
|
||||||
for (quint16 mask = 0x1; mask <= 0x10; mask <<= 1) {
|
for (quint16 mask = 0x1; mask <= 0x10; mask <<= 1) {
|
||||||
if (subdiv->objects() & mask) {
|
if (subdiv->objects() & mask) {
|
||||||
if (cnt) {
|
if (ls) {
|
||||||
|
quint16 po;
|
||||||
if (!readUInt16(hdl, po) || !po)
|
if (!readUInt16(hdl, po) || !po)
|
||||||
return QMap<RGNFile::SegmentType, SubDiv::Segment>();
|
return QMap<RGNFile::SegmentType, SubDiv::Segment>();
|
||||||
start = offset + po;
|
start = offset + po;
|
||||||
}
|
|
||||||
if (ls)
|
|
||||||
ret.insert(lt, SubDiv::Segment(ls, start));
|
ret.insert(lt, SubDiv::Segment(ls, start));
|
||||||
|
}
|
||||||
|
|
||||||
lt = (SegmentType)mask;
|
lt = (SegmentType)mask;
|
||||||
ls = start;
|
ls = start;
|
||||||
cnt++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,16 +9,16 @@ class SubDiv {
|
|||||||
public:
|
public:
|
||||||
class Segment {
|
class Segment {
|
||||||
public:
|
public:
|
||||||
Segment() : _start(0), _end(0) {}
|
Segment() : _offset(0), _end(0) {}
|
||||||
Segment(quint32 start, quint32 end) : _start(start), _end(end) {}
|
Segment(quint32 ofset, quint32 end) : _offset(ofset), _end(end) {}
|
||||||
|
|
||||||
bool isValid() const {return (_end > _start);}
|
bool isValid() const {return (_end > _offset);}
|
||||||
|
|
||||||
quint32 start() const {return _start;}
|
quint32 offset() const {return _offset;}
|
||||||
quint32 end() const {return _end;}
|
quint32 end() const {return _end;}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
quint32 _start, _end;
|
quint32 _offset, _end;
|
||||||
};
|
};
|
||||||
|
|
||||||
SubDiv(quint32 offset, qint32 lon, qint32 lat, int bits, quint8 objects)
|
SubDiv(quint32 offset, qint32 lon, qint32 lat, int bits, quint8 objects)
|
||||||
@ -54,21 +54,21 @@ public:
|
|||||||
const Segment &roadReferences, const Segment &extPoints,
|
const Segment &roadReferences, const Segment &extPoints,
|
||||||
const Segment &extLines, const Segment &extPolygons)
|
const Segment &extLines, const Segment &extPolygons)
|
||||||
{
|
{
|
||||||
_rgn.pointsOffset = points.start();
|
_rgn.pointsOffset = points.offset();
|
||||||
_rgn.pointsEnd = points.end();
|
_rgn.pointsEnd = points.end();
|
||||||
_rgn.idxPointsOffset = idxPoints.start();
|
_rgn.idxPointsOffset = idxPoints.offset();
|
||||||
_rgn.idxPointsEnd = idxPoints.end();
|
_rgn.idxPointsEnd = idxPoints.end();
|
||||||
_rgn.linesOffset = lines.start();
|
_rgn.linesOffset = lines.offset();
|
||||||
_rgn.linesEnd = lines.end();
|
_rgn.linesEnd = lines.end();
|
||||||
_rgn.polygonsOffset = polygons.start();
|
_rgn.polygonsOffset = polygons.offset();
|
||||||
_rgn.polygonsEnd = polygons.end();
|
_rgn.polygonsEnd = polygons.end();
|
||||||
_rgn.roadReferencesOffset = roadReferences.start();
|
_rgn.roadReferencesOffset = roadReferences.offset();
|
||||||
_rgn.roadReferencesEnd = roadReferences.end();
|
_rgn.roadReferencesEnd = roadReferences.end();
|
||||||
_rgn.extPointsOffset = extPoints.start();
|
_rgn.extPointsOffset = extPoints.offset();
|
||||||
_rgn.extPointsEnd = extPoints.end();
|
_rgn.extPointsEnd = extPoints.end();
|
||||||
_rgn.extLinesOffset = extLines.start();
|
_rgn.extLinesOffset = extLines.offset();
|
||||||
_rgn.extLinesEnd = extLines.end();
|
_rgn.extLinesEnd = extLines.end();
|
||||||
_rgn.extPolygonsOffset = extPolygons.start();
|
_rgn.extPolygonsOffset = extPolygons.offset();
|
||||||
_rgn.extPolygonsEnd = extPolygons.end();
|
_rgn.extPolygonsEnd = extPolygons.end();
|
||||||
|
|
||||||
_init = true;
|
_init = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user