mirror of
https://github.com/tumic0/GPXSee.git
synced 2025-07-06 23:52:51 +02:00
Compare commits
11 Commits
Author | SHA1 | Date | |
---|---|---|---|
28bd3e49d1 | |||
606269fcc1 | |||
65c2e25bc6 | |||
3d502eb41a | |||
52b6ff697f | |||
0b3e54abf2 | |||
1f0bd76f67 | |||
69ebac9f5d | |||
6b2bb96be7 | |||
a815bc762f | |||
2c770d3756 |
@ -1,4 +1,4 @@
|
|||||||
version: 10.2.{build}
|
version: 10.3.{build}
|
||||||
|
|
||||||
configuration:
|
configuration:
|
||||||
- Release
|
- Release
|
||||||
|
@ -3,7 +3,7 @@ unix:!macx {
|
|||||||
} else {
|
} else {
|
||||||
TARGET = GPXSee
|
TARGET = GPXSee
|
||||||
}
|
}
|
||||||
VERSION = 10.2
|
VERSION = 10.3
|
||||||
|
|
||||||
QT += core \
|
QT += core \
|
||||||
gui \
|
gui \
|
||||||
|
@ -37,7 +37,7 @@ Unicode true
|
|||||||
; The name of the installer
|
; The name of the installer
|
||||||
Name "GPXSee"
|
Name "GPXSee"
|
||||||
; Program version
|
; Program version
|
||||||
!define VERSION "10.2"
|
!define VERSION "10.3"
|
||||||
|
|
||||||
; The file to write
|
; The file to write
|
||||||
OutFile "GPXSee-${VERSION}_x64.exe"
|
OutFile "GPXSee-${VERSION}_x64.exe"
|
||||||
|
@ -34,20 +34,6 @@
|
|||||||
#define COORDINATES_OFFSET SCALE_OFFSET
|
#define COORDINATES_OFFSET SCALE_OFFSET
|
||||||
|
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
static void updateZValues(T &items)
|
|
||||||
{
|
|
||||||
for (int i = 0; i < items.size(); i++) {
|
|
||||||
const QGraphicsItem *ai = items.at(i);
|
|
||||||
for (int j = 0; j < items.size(); j++) {
|
|
||||||
QGraphicsItem *aj = items[j];
|
|
||||||
if (aj->boundingRect().contains(ai->boundingRect()))
|
|
||||||
aj->setZValue(qMin(ai->zValue() - 1, aj->zValue()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
MapView::MapView(Map *map, POI *poi, QGeoPositionInfoSource *source,
|
MapView::MapView(Map *map, POI *poi, QGeoPositionInfoSource *source,
|
||||||
QWidget *parent) : QGraphicsView(parent)
|
QWidget *parent) : QGraphicsView(parent)
|
||||||
{
|
{
|
||||||
@ -226,6 +212,7 @@ void MapView::addArea(const Area &area)
|
|||||||
ai->setOpacity(_areaOpacity);
|
ai->setOpacity(_areaOpacity);
|
||||||
ai->setDigitalZoom(_digitalZoom);
|
ai->setDigitalZoom(_digitalZoom);
|
||||||
ai->setVisible(_showAreas);
|
ai->setVisible(_showAreas);
|
||||||
|
ai->setZValue(-area.boundingRect().area());
|
||||||
|
|
||||||
_scene->addItem(ai);
|
_scene->addItem(ai);
|
||||||
_ar |= ai->bounds();
|
_ar |= ai->bounds();
|
||||||
@ -266,6 +253,7 @@ MapItem *MapView::addMap(MapAction *map)
|
|||||||
mi->setOpacity(_areaOpacity);
|
mi->setOpacity(_areaOpacity);
|
||||||
mi->setDigitalZoom(_digitalZoom);
|
mi->setDigitalZoom(_digitalZoom);
|
||||||
mi->setVisible(_showAreas);
|
mi->setVisible(_showAreas);
|
||||||
|
mi->setZValue(-mi->bounds().area());
|
||||||
|
|
||||||
_scene->addItem(mi);
|
_scene->addItem(mi);
|
||||||
_ar |= mi->bounds();
|
_ar |= mi->bounds();
|
||||||
@ -299,9 +287,6 @@ QList<PathItem *> MapView::loadData(const Data &data)
|
|||||||
else
|
else
|
||||||
updatePOIVisibility();
|
updatePOIVisibility();
|
||||||
|
|
||||||
if (!data.areas().isEmpty())
|
|
||||||
updateZValues(_areas);
|
|
||||||
|
|
||||||
centerOn(contentCenter());
|
centerOn(contentCenter());
|
||||||
|
|
||||||
return paths;
|
return paths;
|
||||||
@ -319,8 +304,6 @@ void MapView::loadMaps(const QList<MapAction *> &maps)
|
|||||||
else
|
else
|
||||||
updatePOIVisibility();
|
updatePOIVisibility();
|
||||||
|
|
||||||
updateZValues(_areas);
|
|
||||||
|
|
||||||
centerOn(contentCenter());
|
centerOn(contentCenter());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -336,8 +319,6 @@ void MapView::loadDEMs(const QList<Area> &dems)
|
|||||||
else
|
else
|
||||||
updatePOIVisibility();
|
updatePOIVisibility();
|
||||||
|
|
||||||
updateZValues(_areas);
|
|
||||||
|
|
||||||
centerOn(contentCenter());
|
centerOn(contentCenter());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -549,6 +530,7 @@ void MapView::setUnits(Units units)
|
|||||||
_mapScale->setUnits(units);
|
_mapScale->setUnits(units);
|
||||||
_cursorCoordinates->setUnits(units);
|
_cursorCoordinates->setUnits(units);
|
||||||
_positionCoordinates->setUnits(units);
|
_positionCoordinates->setUnits(units);
|
||||||
|
_motionInfo->setUnits(units);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MapView::setCoordinatesFormat(CoordinatesFormat format)
|
void MapView::setCoordinatesFormat(CoordinatesFormat format)
|
||||||
|
@ -83,29 +83,29 @@ void MotionInfoItem::setDigitalZoom(qreal zoom)
|
|||||||
QString MotionInfoItem::speed(const QLocale &l) const
|
QString MotionInfoItem::speed(const QLocale &l) const
|
||||||
{
|
{
|
||||||
if (_units == Nautical)
|
if (_units == Nautical)
|
||||||
return l.toString(MS2KN * _speed) + UNIT_SPACE
|
return l.toString(MS2KN * _speed, 'f', 1) + UNIT_SPACE
|
||||||
+ qApp->translate("MotionInfoItem", "kn");
|
+ qApp->translate("MotionInfoItem", "kn");
|
||||||
else if (_units == Imperial)
|
else if (_units == Imperial)
|
||||||
return l.toString(MS2MIH * _speed) + UNIT_SPACE
|
return l.toString(MS2MIH * _speed, 'f', 1) + UNIT_SPACE
|
||||||
+ qApp->translate("MotionInfoItem", "mi/h");
|
+ qApp->translate("MotionInfoItem", "mi/h");
|
||||||
else
|
else
|
||||||
return l.toString(MS2KMH * _speed) + UNIT_SPACE
|
return l.toString(MS2KMH * _speed, 'f', 1) + UNIT_SPACE
|
||||||
+ qApp->translate("MotionInfoItem", "km/h");
|
+ qApp->translate("MotionInfoItem", "km/h");
|
||||||
}
|
}
|
||||||
|
|
||||||
QString MotionInfoItem::verticalSpeed(const QLocale &l) const
|
QString MotionInfoItem::verticalSpeed(const QLocale &l) const
|
||||||
{
|
{
|
||||||
if (_units == Nautical || _units == Imperial)
|
if (_units == Nautical || _units == Imperial)
|
||||||
return l.toString(MS2FTMIN * _verticalSpeed) + UNIT_SPACE
|
return l.toString(MS2FTMIN * _verticalSpeed, 'f', 0) + UNIT_SPACE
|
||||||
+ qApp->translate("MotionInfoItem", "ft/min");
|
+ qApp->translate("MotionInfoItem", "ft/min");
|
||||||
else
|
else
|
||||||
return l.toString(MS2MMIN * _verticalSpeed) + UNIT_SPACE
|
return l.toString(MS2MMIN * _verticalSpeed, 'f', 0) + UNIT_SPACE
|
||||||
+ qApp->translate("MotionInfoItem", "m/min");
|
+ qApp->translate("MotionInfoItem", "m/min");
|
||||||
}
|
}
|
||||||
|
|
||||||
static QString bearing(qreal val, const QLocale &l)
|
static QString bearing(qreal val, const QLocale &l)
|
||||||
{
|
{
|
||||||
return l.toString(val) + DEGREE_UNIT;
|
return l.toString(val, 'f', 0) + DEGREE_UNIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString MotionInfoItem::text() const
|
QString MotionInfoItem::text() const
|
||||||
|
@ -30,6 +30,7 @@ public:
|
|||||||
return (left() > right()) ? 360.0 - res : res;
|
return (left() > right()) ? 360.0 - res : res;
|
||||||
}
|
}
|
||||||
double height() const {return (top() - bottom());}
|
double height() const {return (top() - bottom());}
|
||||||
|
double area() const {return qAbs(width()) * qAbs(height());}
|
||||||
|
|
||||||
double top() const {return _tl.lat();}
|
double top() const {return _tl.lat();}
|
||||||
double bottom() const {return _br.lat();}
|
double bottom() const {return _br.lat();}
|
||||||
|
@ -429,27 +429,33 @@ static quint32 readImageInfo(DataStream &stream, Waypoint &waypoint,
|
|||||||
return rs + rh.size;
|
return rs + rh.size;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int speed(quint8 flags)
|
static int speed(quint16 flags)
|
||||||
{
|
{
|
||||||
switch (flags >> 4) {
|
return (((flags >> 3) & 0x0F) * 10) + (((flags >> 2) & 1) * 5);
|
||||||
case 0x8:
|
}
|
||||||
return 40;
|
|
||||||
case 0x9:
|
static QString units(quint16 flags)
|
||||||
return 30;
|
{
|
||||||
case 0xA:
|
return (flags & (1<<8)) ? "km/h" : "mi/h";
|
||||||
return 50;
|
}
|
||||||
case 0xB:
|
|
||||||
return 70;
|
static bool portable(quint16 flags)
|
||||||
case 0xC:
|
{
|
||||||
return 80;
|
return (flags & 1);
|
||||||
case 0xD:
|
}
|
||||||
return 90;
|
|
||||||
case 0xE:
|
static bool redLight(quint16 flags)
|
||||||
return 100;
|
{
|
||||||
case 0xF:
|
return (flags & (1<<9));
|
||||||
return 120;
|
}
|
||||||
default:
|
|
||||||
return 0;
|
static QString cameraDesc(quint16 flags)
|
||||||
|
{
|
||||||
|
if (redLight(flags))
|
||||||
|
return "Red light camera";
|
||||||
|
else {
|
||||||
|
QString desc(QString::number(speed(flags)) + " " + units(flags));
|
||||||
|
return portable(flags) ? "<i>" + desc + "<i>" : desc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -457,7 +463,8 @@ static quint32 readCamera(DataStream &stream, QVector<Waypoint> &waypoints,
|
|||||||
QList<Area> &polygons)
|
QList<Area> &polygons)
|
||||||
{
|
{
|
||||||
RecordHeader rh;
|
RecordHeader rh;
|
||||||
quint8 flags, type, s7, rs;
|
quint8 s7, rs;
|
||||||
|
quint16 flags;
|
||||||
qint32 top, right, bottom, left, lat, lon;
|
qint32 top, right, bottom, left, lat, lon;
|
||||||
quint32 ds = 15;
|
quint32 ds = 15;
|
||||||
|
|
||||||
@ -467,7 +474,7 @@ static quint32 readCamera(DataStream &stream, QVector<Waypoint> &waypoints,
|
|||||||
right = stream.readInt24();
|
right = stream.readInt24();
|
||||||
bottom = stream.readInt24();
|
bottom = stream.readInt24();
|
||||||
left = stream.readInt24();
|
left = stream.readInt24();
|
||||||
stream >> flags >> type >> s7;
|
stream >> flags >> s7;
|
||||||
|
|
||||||
if (s7) {
|
if (s7) {
|
||||||
quint32 skip = s7 + 2 + s7/4;
|
quint32 skip = s7 + 2 + s7/4;
|
||||||
@ -486,26 +493,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(flags));
|
||||||
|
|
||||||
switch (type) {
|
waypoints.append(Coordinates(toWGS24(lon), toWGS24(lat)));
|
||||||
case 8:
|
|
||||||
area.setDescription(QString("%1 mi/h")
|
|
||||||
.arg(speed(flags)));
|
|
||||||
break;
|
|
||||||
case 9:
|
|
||||||
area.setDescription(QString("%1 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)
|
||||||
@ -654,13 +646,15 @@ static quint32 readSymbol(DataStream &stream, QPixmap &pixmap)
|
|||||||
ds += paletteSize * 4;
|
ds += paletteSize * 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (paletteSize) {
|
if (data.size() >= lineSize * height) {
|
||||||
img = QImage((uchar*)data.data(), width, height, lineSize,
|
if (paletteSize) {
|
||||||
QImage::Format_Indexed8);
|
img = QImage((uchar*)data.data(), width, height, lineSize,
|
||||||
img.setColorTable(palette);
|
QImage::Format_Indexed8);
|
||||||
} else
|
img.setColorTable(palette);
|
||||||
img = QImage((uchar*)data.data(), width, height, lineSize,
|
} else
|
||||||
QImage::Format_RGBX8888).rgbSwapped();
|
img = QImage((uchar*)data.data(), width, height, lineSize,
|
||||||
|
QImage::Format_RGBX8888).rgbSwapped();
|
||||||
|
}
|
||||||
pixmap = QPixmap::fromImage(img);
|
pixmap = QPixmap::fromImage(img);
|
||||||
|
|
||||||
/* There should be no more data left in the record, but broken GPI files
|
/* There should be no more data left in the record, but broken GPI files
|
||||||
|
Reference in New Issue
Block a user