1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2025-07-01 13:29:16 +02:00

Compare commits

...

11 Commits
10.2 ... 10.3

7 changed files with 53 additions and 76 deletions

View File

@ -1,4 +1,4 @@
version: 10.2.{build}
version: 10.3.{build}
configuration:
- Release

View File

@ -3,7 +3,7 @@ unix:!macx {
} else {
TARGET = GPXSee
}
VERSION = 10.2
VERSION = 10.3
QT += core \
gui \

View File

@ -37,7 +37,7 @@ Unicode true
; The name of the installer
Name "GPXSee"
; Program version
!define VERSION "10.2"
!define VERSION "10.3"
; The file to write
OutFile "GPXSee-${VERSION}_x64.exe"

View File

@ -34,20 +34,6 @@
#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,
QWidget *parent) : QGraphicsView(parent)
{
@ -226,6 +212,7 @@ void MapView::addArea(const Area &area)
ai->setOpacity(_areaOpacity);
ai->setDigitalZoom(_digitalZoom);
ai->setVisible(_showAreas);
ai->setZValue(-area.boundingRect().area());
_scene->addItem(ai);
_ar |= ai->bounds();
@ -266,6 +253,7 @@ MapItem *MapView::addMap(MapAction *map)
mi->setOpacity(_areaOpacity);
mi->setDigitalZoom(_digitalZoom);
mi->setVisible(_showAreas);
mi->setZValue(-mi->bounds().area());
_scene->addItem(mi);
_ar |= mi->bounds();
@ -299,9 +287,6 @@ QList<PathItem *> MapView::loadData(const Data &data)
else
updatePOIVisibility();
if (!data.areas().isEmpty())
updateZValues(_areas);
centerOn(contentCenter());
return paths;
@ -319,8 +304,6 @@ void MapView::loadMaps(const QList<MapAction *> &maps)
else
updatePOIVisibility();
updateZValues(_areas);
centerOn(contentCenter());
}
@ -336,8 +319,6 @@ void MapView::loadDEMs(const QList<Area> &dems)
else
updatePOIVisibility();
updateZValues(_areas);
centerOn(contentCenter());
}
@ -549,6 +530,7 @@ void MapView::setUnits(Units units)
_mapScale->setUnits(units);
_cursorCoordinates->setUnits(units);
_positionCoordinates->setUnits(units);
_motionInfo->setUnits(units);
}
void MapView::setCoordinatesFormat(CoordinatesFormat format)

View File

@ -83,29 +83,29 @@ void MotionInfoItem::setDigitalZoom(qreal zoom)
QString MotionInfoItem::speed(const QLocale &l) const
{
if (_units == Nautical)
return l.toString(MS2KN * _speed) + UNIT_SPACE
return l.toString(MS2KN * _speed, 'f', 1) + UNIT_SPACE
+ qApp->translate("MotionInfoItem", "kn");
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");
else
return l.toString(MS2KMH * _speed) + UNIT_SPACE
return l.toString(MS2KMH * _speed, 'f', 1) + UNIT_SPACE
+ qApp->translate("MotionInfoItem", "km/h");
}
QString MotionInfoItem::verticalSpeed(const QLocale &l) const
{
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");
else
return l.toString(MS2MMIN * _verticalSpeed) + UNIT_SPACE
return l.toString(MS2MMIN * _verticalSpeed, 'f', 0) + UNIT_SPACE
+ qApp->translate("MotionInfoItem", "m/min");
}
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

View File

@ -30,6 +30,7 @@ public:
return (left() > right()) ? 360.0 - res : res;
}
double height() const {return (top() - bottom());}
double area() const {return qAbs(width()) * qAbs(height());}
double top() const {return _tl.lat();}
double bottom() const {return _br.lat();}

View File

@ -429,27 +429,33 @@ static quint32 readImageInfo(DataStream &stream, Waypoint &waypoint,
return rs + rh.size;
}
static int speed(quint8 flags)
static int speed(quint16 flags)
{
switch (flags >> 4) {
case 0x8:
return 40;
case 0x9:
return 30;
case 0xA:
return 50;
case 0xB:
return 70;
case 0xC:
return 80;
case 0xD:
return 90;
case 0xE:
return 100;
case 0xF:
return 120;
default:
return 0;
return (((flags >> 3) & 0x0F) * 10) + (((flags >> 2) & 1) * 5);
}
static QString units(quint16 flags)
{
return (flags & (1<<8)) ? "km/h" : "mi/h";
}
static bool portable(quint16 flags)
{
return (flags & 1);
}
static bool redLight(quint16 flags)
{
return (flags & (1<<9));
}
static QString cameraDesc(quint16 flags)
{
if (redLight(flags))
return "Red light camera";
else {
QString desc(QString::number(speed(flags)) + "&nbsp;" + units(flags));
return portable(flags) ? "<i>" + desc + "<i>" : desc;
}
}
@ -457,7 +463,8 @@ static quint32 readCamera(DataStream &stream, QVector<Waypoint> &waypoints,
QList<Area> &polygons)
{
RecordHeader rh;
quint8 flags, type, s7, rs;
quint8 s7, rs;
quint16 flags;
qint32 top, right, bottom, left, lat, lon;
quint32 ds = 15;
@ -467,7 +474,7 @@ static quint32 readCamera(DataStream &stream, QVector<Waypoint> &waypoints,
right = stream.readInt24();
bottom = stream.readInt24();
left = stream.readInt24();
stream >> flags >> type >> s7;
stream >> flags >> s7;
if (s7) {
quint32 skip = s7 + 2 + s7/4;
@ -486,26 +493,11 @@ static quint32 readCamera(DataStream &stream, QVector<Waypoint> &waypoints,
ds += skip + 16;
}
waypoints.append(Coordinates(toWGS24(lon), toWGS24(lat)));
Area area(RectC(Coordinates(toWGS24(left), toWGS24(top)),
Coordinates(toWGS24(right), toWGS24(bottom))));
area.setDescription(cameraDesc(flags));
switch (type) {
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;
}
waypoints.append(Coordinates(toWGS24(lon), toWGS24(lat)));
polygons.append(area);
if (ds > rh.size)
@ -654,13 +646,15 @@ static quint32 readSymbol(DataStream &stream, QPixmap &pixmap)
ds += paletteSize * 4;
}
if (paletteSize) {
img = QImage((uchar*)data.data(), width, height, lineSize,
QImage::Format_Indexed8);
img.setColorTable(palette);
} else
img = QImage((uchar*)data.data(), width, height, lineSize,
QImage::Format_RGBX8888).rgbSwapped();
if (data.size() >= lineSize * height) {
if (paletteSize) {
img = QImage((uchar*)data.data(), width, height, lineSize,
QImage::Format_Indexed8);
img.setColorTable(palette);
} else
img = QImage((uchar*)data.data(), width, height, lineSize,
QImage::Format_RGBX8888).rgbSwapped();
}
pixmap = QPixmap::fromImage(img);
/* There should be no more data left in the record, but broken GPI files