1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-24 03:35:53 +01:00

Some more camera info fixes/improvements

This commit is contained in:
Martin Tůma 2022-01-26 01:01:01 +01:00
parent 6b2bb96be7
commit 69ebac9f5d

View File

@ -431,7 +431,32 @@ static quint32 readImageInfo(DataStream &stream, Waypoint &waypoint,
static int speed(quint8 flags) static int speed(quint8 flags)
{ {
return ((flags >> 3) & 0x0F) * 10; return (((flags >> 3) & 0x0F) * 10) + (((flags >> 2) & 1) * 5);
}
static bool portable(quint8 flags)
{
return (flags & 1);
}
static QString cameraDesc(quint8 type, quint8 flags)
{
switch (type) {
case 8:
return portable(flags)
? QString("<i>%1&nbsp;mi/h</i>").arg(speed(flags))
: QString("%1&nbsp;mi/h").arg(speed(flags));
case 9:
return portable(flags)
? QString("<i>%1&nbsp;km/h</i>").arg(speed(flags))
: QString("%1&nbsp;km/h").arg(speed(flags));
break;
case 10:
case 11:
return "Red light camera";
}
return QString();
} }
static quint32 readCamera(DataStream &stream, QVector<Waypoint> &waypoints, static quint32 readCamera(DataStream &stream, QVector<Waypoint> &waypoints,
@ -467,26 +492,11 @@ static quint32 readCamera(DataStream &stream, QVector<Waypoint> &waypoints,
ds += skip + 16; ds += skip + 16;
} }
waypoints.append(Coordinates(toWGS24(lon), toWGS24(lat)));
Area area(RectC(Coordinates(toWGS24(left), toWGS24(top)), Area area(RectC(Coordinates(toWGS24(left), toWGS24(top)),
Coordinates(toWGS24(right), toWGS24(bottom)))); Coordinates(toWGS24(right), toWGS24(bottom))));
area.setDescription(cameraDesc(type, flags));
switch (type) { waypoints.append(Coordinates(toWGS24(lon), toWGS24(lat)));
case 8:
area.setDescription(QString("%1&nbsp;mi/h")
.arg(speed(flags)));
break;
case 9:
area.setDescription(QString("%1&nbsp;km/h")
.arg(speed(flags)));
break;
case 10:
case 11:
area.setDescription("Red light camera");
break;
}
polygons.append(area); polygons.append(area);
if (ds > rh.size) if (ds > rh.size)