mirror of
https://github.com/tumic0/GPXSee.git
synced 2024-11-24 11:45:53 +01:00
Compare commits
No commits in common. "52b6ff697f4ec76a596e0cd5a1f24eeecaa4f394" and "69ebac9f5d9bd8d3c34938c7ce8b7964b1e574c2" have entirely different histories.
52b6ff697f
...
69ebac9f5d
@ -34,6 +34,20 @@
|
|||||||
#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)
|
||||||
{
|
{
|
||||||
@ -212,7 +226,6 @@ 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();
|
||||||
@ -253,7 +266,6 @@ 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();
|
||||||
@ -287,6 +299,9 @@ 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;
|
||||||
@ -304,6 +319,8 @@ void MapView::loadMaps(const QList<MapAction *> &maps)
|
|||||||
else
|
else
|
||||||
updatePOIVisibility();
|
updatePOIVisibility();
|
||||||
|
|
||||||
|
updateZValues(_areas);
|
||||||
|
|
||||||
centerOn(contentCenter());
|
centerOn(contentCenter());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -319,6 +336,8 @@ void MapView::loadDEMs(const QList<Area> &dems)
|
|||||||
else
|
else
|
||||||
updatePOIVisibility();
|
updatePOIVisibility();
|
||||||
|
|
||||||
|
updateZValues(_areas);
|
||||||
|
|
||||||
centerOn(contentCenter());
|
centerOn(contentCenter());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,7 +30,6 @@ 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,42 +429,41 @@ static quint32 readImageInfo(DataStream &stream, Waypoint &waypoint,
|
|||||||
return rs + rh.size;
|
return rs + rh.size;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int speed(quint16 flags)
|
static int speed(quint8 flags)
|
||||||
{
|
{
|
||||||
return (((flags >> 3) & 0x0F) * 10) + (((flags >> 2) & 1) * 5);
|
return (((flags >> 3) & 0x0F) * 10) + (((flags >> 2) & 1) * 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
static QString units(quint16 flags)
|
static bool portable(quint8 flags)
|
||||||
{
|
|
||||||
return (flags & (1<<8)) ? "km/h" : "mi/h";
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool portable(quint16 flags)
|
|
||||||
{
|
{
|
||||||
return (flags & 1);
|
return (flags & 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool redLight(quint16 flags)
|
static QString cameraDesc(quint8 type, quint8 flags)
|
||||||
{
|
{
|
||||||
return (flags & (1<<9));
|
switch (type) {
|
||||||
}
|
case 8:
|
||||||
|
return portable(flags)
|
||||||
static QString cameraDesc(quint16 flags)
|
? QString("<i>%1 mi/h</i>").arg(speed(flags))
|
||||||
{
|
: QString("%1 mi/h").arg(speed(flags));
|
||||||
if (redLight(flags))
|
case 9:
|
||||||
return "Red light camera";
|
return portable(flags)
|
||||||
else {
|
? QString("<i>%1 km/h</i>").arg(speed(flags))
|
||||||
QString desc(QString::number(speed(flags)) + " " + units(flags));
|
: QString("%1 km/h").arg(speed(flags));
|
||||||
return portable(flags) ? "<i>" + desc + "<i>" : desc;
|
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,
|
||||||
QList<Area> &polygons)
|
QList<Area> &polygons)
|
||||||
{
|
{
|
||||||
RecordHeader rh;
|
RecordHeader rh;
|
||||||
quint8 s7, rs;
|
quint8 flags, type, s7, rs;
|
||||||
quint16 flags;
|
|
||||||
qint32 top, right, bottom, left, lat, lon;
|
qint32 top, right, bottom, left, lat, lon;
|
||||||
quint32 ds = 15;
|
quint32 ds = 15;
|
||||||
|
|
||||||
@ -474,7 +473,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 >> s7;
|
stream >> flags >> type >> s7;
|
||||||
|
|
||||||
if (s7) {
|
if (s7) {
|
||||||
quint32 skip = s7 + 2 + s7/4;
|
quint32 skip = s7 + 2 + s7/4;
|
||||||
@ -495,7 +494,7 @@ static quint32 readCamera(DataStream &stream, QVector<Waypoint> &waypoints,
|
|||||||
|
|
||||||
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));
|
area.setDescription(cameraDesc(type, flags));
|
||||||
|
|
||||||
waypoints.append(Coordinates(toWGS24(lon), toWGS24(lat)));
|
waypoints.append(Coordinates(toWGS24(lon), toWGS24(lat)));
|
||||||
polygons.append(area);
|
polygons.append(area);
|
||||||
|
Loading…
Reference in New Issue
Block a user