1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2025-06-28 12:09:15 +02:00

Added support for GPI speed/red light cameras

This commit is contained in:
2019-11-10 16:46:31 +01:00
parent 6d6dc9f316
commit db7e60bdfb
8 changed files with 145 additions and 42 deletions

View File

@ -1,5 +1,5 @@
#include "common/rectc.h"
#include "units.h"
#include "common/garmin.h"
#include "lblfile.h"
#include "netfile.h"
#include "rgnfile.h"
@ -193,7 +193,7 @@ bool RGNFile::polyObjects(const RectC &rect, Handle &hdl, const SubDiv *subdiv,
QPoint pos(subdiv->lon() + ((qint32)lon<<(24-subdiv->bits())),
subdiv->lat() + ((qint32)lat<<(24-subdiv->bits())));
Coordinates c(toWGS84(pos.x()), toWGS84(pos.y()));
Coordinates c(toWGS24(pos.x()), toWGS24(pos.y()));
RectC br(c, c);
poly.points.append(QPointF(c.lon(), c.lat()));
@ -204,7 +204,7 @@ bool RGNFile::polyObjects(const RectC &rect, Handle &hdl, const SubDiv *subdiv,
pos.rx() += lonDelta<<(24-subdiv->bits());
pos.ry() += latDelta<<(24-subdiv->bits());
Coordinates c(toWGS84(pos.x()), toWGS84(pos.y()));
Coordinates c(toWGS24(pos.x()), toWGS24(pos.y()));
poly.points.append(QPointF(c.lon(), c.lat()));
br = br.united(c);
}
@ -259,7 +259,7 @@ bool RGNFile::extPolyObjects(const RectC &rect, Handle &hdl,
QPoint pos(subdiv->lon() + ((qint32)lon<<(24-subdiv->bits())),
subdiv->lat() + ((qint32)lat<<(24-subdiv->bits())));
Coordinates c(toWGS84(pos.x()), toWGS84(pos.y()));
Coordinates c(toWGS24(pos.x()), toWGS24(pos.y()));
RectC br(c, c);
poly.points.append(QPointF(c.lon(), c.lat()));
@ -269,7 +269,7 @@ bool RGNFile::extPolyObjects(const RectC &rect, Handle &hdl,
pos.rx() += lonDelta<<(24-subdiv->bits());
pos.ry() += latDelta<<(24-subdiv->bits());
Coordinates c(toWGS84(pos.x()), toWGS84(pos.y()));
Coordinates c(toWGS24(pos.x()), toWGS24(pos.y()));
poly.points.append(QPointF(c.lon(), c.lat()));
br = br.united(c);
}
@ -321,8 +321,8 @@ bool RGNFile::pointObjects(const RectC &rect, Handle &hdl, const SubDiv *subdiv,
qint16 lonOffset = lon<<(24-subdiv->bits());
qint16 latOffset = lat<<(24-subdiv->bits());
point.coordinates = Coordinates(toWGS84(subdiv->lon() + lonOffset),
toWGS84(subdiv->lat() + latOffset));
point.coordinates = Coordinates(toWGS24(subdiv->lon() + lonOffset),
toWGS24(subdiv->lat() + latOffset));
if (!rect.contains(point.coordinates))
continue;
@ -367,8 +367,8 @@ bool RGNFile::extPointObjects(const RectC &rect, Handle &hdl,
qint16 lonOffset = lon<<(24-subdiv->bits());
qint16 latOffset = lat<<(24-subdiv->bits());
point.coordinates = Coordinates(toWGS84(subdiv->lon() + lonOffset),
toWGS84(subdiv->lat() + latOffset));
point.coordinates = Coordinates(toWGS24(subdiv->lon() + lonOffset),
toWGS24(subdiv->lat() + latOffset));
if (subtype & 0x20) {
if (!readUInt24(hdl, labelPtr))

View File

@ -3,7 +3,7 @@
#include <QtGlobal>
#include "common/coordinates.h"
#include "units.h"
#include "common/garmin.h"
class SubDiv {
public:
@ -51,7 +51,7 @@ private:
#ifndef QT_NO_DEBUG
inline QDebug operator<<(QDebug dbg, const SubDiv &subdiv)
{
Coordinates c(toWGS84(subdiv.lon()), toWGS84(subdiv.lat()));
Coordinates c(toWGS24(subdiv.lon()), toWGS24(subdiv.lat()));
dbg.nospace() << "SubDiv(" << c << ", " << subdiv.offset()
<< ", " << subdiv.end() << ", " << subdiv.objects() << ")";
return dbg.space();

View File

@ -1,5 +1,5 @@
#include "common/garmin.h"
#include "subdiv.h"
#include "units.h"
#include "trefile.h"
@ -52,8 +52,8 @@ bool TREFile::init()
if (!(seek(hdl, _gmpOffset + 0x15) && readInt24(hdl, north)
&& readInt24(hdl, east) && readInt24(hdl, south) && readInt24(hdl, west)))
return false;
_bounds = RectC(Coordinates(toWGS84(west), toWGS84(north)),
Coordinates(toWGS84(east), toWGS84(south)));
_bounds = RectC(Coordinates(toWGS24(west), toWGS24(north)),
Coordinates(toWGS24(east), toWGS24(south)));
// Levels & subdivs info
quint32 levelsOffset, levelsSize, subdivSize;
@ -150,9 +150,9 @@ bool TREFile::load(int idx)
sl.append(s);
double min[2], max[2];
RectC bounds(Coordinates(toWGS84(lon - width),
toWGS84(lat + height + 1)), Coordinates(toWGS84(lon + width + 1),
toWGS84(lat - height)));
RectC bounds(Coordinates(toWGS24(lon - width),
toWGS24(lat + height + 1)), Coordinates(toWGS24(lon + width + 1),
toWGS24(lat - height)));
min[0] = bounds.left();
min[1] = bounds.bottom();

View File

@ -1,11 +0,0 @@
#ifndef UNITS_H
#define UNITS_H
inline double toWGS84(qint32 coord)
{
return (coord < 0x800000)
? (double)coord * 360.0 / (double)(1<<24)
: (double)(coord - 0x1000000) * 360.0 / (double)(1<<24);
}
#endif // UNITS_H