mirror of
https://github.com/tumic0/GPXSee.git
synced 2025-07-09 16:54:28 +02:00
Compare commits
7 Commits
Author | SHA1 | Date | |
---|---|---|---|
1a66ed0a36 | |||
273a127069 | |||
1c0a0fd0b3 | |||
713e331b2a | |||
96f406aad7 | |||
0aedec66c4 | |||
b500031713 |
@ -1,5 +1,5 @@
|
||||
TARGET = GPXSee
|
||||
VERSION = 4.5
|
||||
VERSION = 4.6
|
||||
QT += core \
|
||||
gui \
|
||||
network
|
||||
|
@ -5,7 +5,7 @@
|
||||
; The name of the installer
|
||||
Name "GPXSee"
|
||||
; Program version
|
||||
!define VERSION "4.5"
|
||||
!define VERSION "4.6"
|
||||
|
||||
; The file to write
|
||||
OutFile "GPXSee-${VERSION}.exe"
|
||||
|
@ -5,7 +5,7 @@
|
||||
; The name of the installer
|
||||
Name "GPXSee"
|
||||
; Program version
|
||||
!define VERSION "4.5"
|
||||
!define VERSION "4.6"
|
||||
|
||||
; The file to write
|
||||
OutFile "GPXSee-${VERSION}_x64.exe"
|
||||
|
@ -1,3 +1,4 @@
|
||||
Open Topo Map https://a.tile.opentopomap.org/$z/$x/$y.png
|
||||
Thunderforest http://tile.thunderforest.com/outdoors/$z/$x/$y.png
|
||||
Open Street Map http://tile.openstreetmap.org/$z/$x/$y.png
|
||||
USGS Topo https://navigator.er.usgs.gov/tiles/tcr.cgi/$z/$x/$y.png
|
||||
USGS Imagery https://navigator.er.usgs.gov/tiles/aerial_Imagery.cgi/$z/$x/$y
|
||||
|
@ -118,6 +118,7 @@ Atlas::Atlas(const QString &fileName, QObject *parent) : Map(parent)
|
||||
_valid = false;
|
||||
_zoom = 0;
|
||||
_name = fi.dir().dirName();
|
||||
_ci = -1; _cz = -1;
|
||||
|
||||
if (!isAtlas(tar, fileName))
|
||||
return;
|
||||
@ -201,6 +202,11 @@ qreal Atlas::zoomFit(const QSize &size, const QRectF &br)
|
||||
{
|
||||
_zoom = 0;
|
||||
|
||||
if (br.isNull()) {
|
||||
_zoom = _zooms.size() - 1;
|
||||
return _zoom;
|
||||
}
|
||||
|
||||
for (int z = 0; z < _zooms.count(); z++) {
|
||||
for (int i = _zooms.at(z).first; i <= _zooms.at(z).second; i++) {
|
||||
if (!_bounds.at(i).first.contains(_maps.at(i)->ll2pp(br.center())))
|
||||
@ -233,22 +239,33 @@ qreal Atlas::zoomOut()
|
||||
return _zoom;
|
||||
}
|
||||
|
||||
QPointF Atlas::ll2xy(const Coordinates &c) const
|
||||
QPointF Atlas::ll2xy(const Coordinates &c)
|
||||
{
|
||||
int idx = _zooms.at(_zoom).first;
|
||||
QPointF pp;
|
||||
|
||||
for (int i = _zooms.at(_zoom).first; i <= _zooms.at(_zoom).second; i++) {
|
||||
if (_bounds.at(i).first.contains(_maps.at(i)->ll2pp(c))) {
|
||||
idx = i;
|
||||
break;
|
||||
if (_cz != _zoom) {
|
||||
_ci = -1;
|
||||
_cz = _zoom;
|
||||
}
|
||||
|
||||
if (_ci >= 0)
|
||||
pp = _maps.at(_ci)->ll2pp(c);
|
||||
if (_ci < 0 || !_bounds.at(_ci).first.contains(pp)) {
|
||||
_ci = _zooms.at(_zoom).first;
|
||||
for (int i = _zooms.at(_zoom).first; i <= _zooms.at(_zoom).second; i++) {
|
||||
pp = _maps.at(i)->ll2pp(c);
|
||||
if (_bounds.at(i).first.contains(pp)) {
|
||||
_ci = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QPointF p = _maps.at(idx)->ll2xy(c);
|
||||
return p + _bounds.at(idx).second.topLeft();
|
||||
QPointF p = _maps.at(_ci)->pp2xy(pp);
|
||||
return p + _bounds.at(_ci).second.topLeft();
|
||||
}
|
||||
|
||||
Coordinates Atlas::xy2ll(const QPointF &p) const
|
||||
Coordinates Atlas::xy2ll(const QPointF &p)
|
||||
{
|
||||
int idx = _zooms.at(_zoom).first;
|
||||
|
||||
|
@ -24,8 +24,8 @@ public:
|
||||
qreal zoomIn();
|
||||
qreal zoomOut();
|
||||
|
||||
QPointF ll2xy(const Coordinates &c) const;
|
||||
Coordinates xy2ll(const QPointF &p) const;
|
||||
QPointF ll2xy(const Coordinates &c);
|
||||
Coordinates xy2ll(const QPointF &p);
|
||||
|
||||
void draw(QPainter *painter, const QRectF &rect);
|
||||
|
||||
@ -48,6 +48,8 @@ private:
|
||||
QVector<QPair<int, int> > _zooms;
|
||||
QVector<QPair<QRectF, QRectF> > _bounds;
|
||||
int _zoom;
|
||||
|
||||
int _ci, _cz;
|
||||
};
|
||||
|
||||
#endif // ATLAS_H
|
||||
|
@ -64,13 +64,13 @@ void EmptyMap::draw(QPainter *painter, const QRectF &rect)
|
||||
painter->fillRect(rect, Qt::white);
|
||||
}
|
||||
|
||||
QPointF EmptyMap::ll2xy(const Coordinates &c) const
|
||||
QPointF EmptyMap::ll2xy(const Coordinates &c)
|
||||
{
|
||||
QPointF m = Mercator().ll2xy(c);
|
||||
return QPointF(m.x() / _scale, m.y() / -_scale);
|
||||
}
|
||||
|
||||
Coordinates EmptyMap::xy2ll(const QPointF &p) const
|
||||
Coordinates EmptyMap::xy2ll(const QPointF &p)
|
||||
{
|
||||
QPointF m(p.x() * _scale, -p.y() * _scale);
|
||||
return Mercator().xy2ll(m);
|
||||
|
@ -20,8 +20,8 @@ public:
|
||||
qreal zoomIn();
|
||||
qreal zoomOut();
|
||||
|
||||
QPointF ll2xy(const Coordinates &c) const;
|
||||
Coordinates xy2ll(const QPointF &p) const;
|
||||
QPointF ll2xy(const Coordinates &c);
|
||||
Coordinates xy2ll(const QPointF &p);
|
||||
|
||||
void draw(QPainter *painter, const QRectF &rect);
|
||||
|
||||
|
@ -25,8 +25,8 @@ public:
|
||||
virtual qreal zoomIn() = 0;
|
||||
virtual qreal zoomOut() = 0;
|
||||
|
||||
virtual QPointF ll2xy(const Coordinates &c) const = 0;
|
||||
virtual Coordinates xy2ll(const QPointF &p) const = 0;
|
||||
virtual QPointF ll2xy(const Coordinates &c) = 0;
|
||||
virtual Coordinates xy2ll(const QPointF &p) = 0;
|
||||
|
||||
virtual void draw(QPainter *painter, const QRectF &rect) = 0;
|
||||
|
||||
|
@ -348,11 +348,12 @@ bool OfflineMap::getImageInfo(const QString &path)
|
||||
}
|
||||
|
||||
QString suffix = ii.suffix().toLower();
|
||||
if (suffix == "ozf3" || suffix == "ozf4") {
|
||||
if (suffix == "ozf3" || suffix == "ozfx3" || suffix == "ozf4"
|
||||
|| suffix == "ozfx4") {
|
||||
_errorString = QString("%1: Obfuscated image files not supported")
|
||||
.arg(QFileInfo(_imgPath).fileName());
|
||||
return false;
|
||||
} else if (suffix == "ozf2") {
|
||||
} else if (suffix == "ozf2" || suffix == "ozfx2") {
|
||||
_ozf.load(_imgPath);
|
||||
_size = _ozf.size();
|
||||
} else {
|
||||
|
@ -31,9 +31,9 @@ public:
|
||||
qreal zoomIn() {return 1.0;}
|
||||
qreal zoomOut() {return 1.0;}
|
||||
|
||||
QPointF ll2xy(const Coordinates &c) const
|
||||
QPointF ll2xy(const Coordinates &c)
|
||||
{return _transform.map(_projection->ll2xy(c));}
|
||||
Coordinates xy2ll(const QPointF &p) const
|
||||
Coordinates xy2ll(const QPointF &p)
|
||||
{return _projection->xy2ll(_inverted.map(p));}
|
||||
|
||||
void draw(QPainter *painter, const QRectF &rect);
|
||||
|
@ -232,13 +232,13 @@ void OnlineMap::draw(QPainter *painter, const QRectF &rect)
|
||||
}
|
||||
}
|
||||
|
||||
QPointF OnlineMap::ll2xy(const Coordinates &c) const
|
||||
QPointF OnlineMap::ll2xy(const Coordinates &c)
|
||||
{
|
||||
QPointF m = Mercator().ll2xy(c);
|
||||
return QPointF(m.x() / _scale, m.y() / -_scale);
|
||||
}
|
||||
|
||||
Coordinates OnlineMap::xy2ll(const QPointF &p) const
|
||||
Coordinates OnlineMap::xy2ll(const QPointF &p)
|
||||
{
|
||||
QPointF m(p.x() * _scale, -p.y() * _scale);
|
||||
return Mercator().xy2ll(m);
|
||||
|
@ -23,8 +23,8 @@ public:
|
||||
qreal zoomIn();
|
||||
qreal zoomOut();
|
||||
|
||||
QPointF ll2xy(const Coordinates &c) const;
|
||||
Coordinates xy2ll(const QPointF &p) const;
|
||||
QPointF ll2xy(const Coordinates &c);
|
||||
Coordinates xy2ll(const QPointF &p);
|
||||
|
||||
void draw(QPainter *painter, const QRectF &rect);
|
||||
|
||||
|
@ -12,20 +12,21 @@ PathItem::PathItem(const Path &path, Map *map, QGraphicsItem *parent)
|
||||
: QGraphicsObject(parent)
|
||||
{
|
||||
Q_ASSERT(path.count() >= 2);
|
||||
|
||||
_path = path;
|
||||
_map = map;
|
||||
|
||||
updatePainterPath(map);
|
||||
updateShape();
|
||||
_digitalZoom = 0;
|
||||
|
||||
_width = 3;
|
||||
QBrush brush(Qt::SolidPattern);
|
||||
_pen = QPen(brush, _width);
|
||||
|
||||
updatePainterPath(map);
|
||||
updateShape();
|
||||
|
||||
_marker = new MarkerItem(this);
|
||||
_marker->setPos(position(_path.at(0).distance()));
|
||||
_marker->setFlag(QGraphicsItem::ItemIgnoresTransformations);
|
||||
_md = _path.at(0).distance();
|
||||
_markerDistance = _path.at(0).distance();
|
||||
|
||||
setCursor(Qt::ArrowCursor);
|
||||
setAcceptHoverEvents(true);
|
||||
@ -34,7 +35,7 @@ PathItem::PathItem(const Path &path, Map *map, QGraphicsItem *parent)
|
||||
void PathItem::updateShape()
|
||||
{
|
||||
QPainterPathStroker s;
|
||||
s.setWidth((_width + 1) * 1.0/scale());
|
||||
s.setWidth((_width + 1) * pow(2, -_digitalZoom));
|
||||
_shape = s.createStroke(_painterPath);
|
||||
}
|
||||
|
||||
@ -71,7 +72,7 @@ void PathItem::setMap(Map *map)
|
||||
updatePainterPath(map);
|
||||
updateShape();
|
||||
|
||||
_marker->setPos(position(_md));
|
||||
_marker->setPos(position(_markerDistance));
|
||||
}
|
||||
|
||||
void PathItem::setColor(const QColor &color)
|
||||
@ -85,7 +86,7 @@ void PathItem::setWidth(qreal width)
|
||||
prepareGeometryChange();
|
||||
|
||||
_width = width;
|
||||
_pen.setWidthF(_width * 1.0/scale());
|
||||
_pen.setWidthF(_width * pow(2, -_digitalZoom));
|
||||
|
||||
updateShape();
|
||||
}
|
||||
@ -96,6 +97,17 @@ void PathItem::setStyle(Qt::PenStyle style)
|
||||
update();
|
||||
}
|
||||
|
||||
void PathItem::setDigitalZoom(int zoom)
|
||||
{
|
||||
prepareGeometryChange();
|
||||
|
||||
_digitalZoom = zoom;
|
||||
_pen.setWidthF(_width * pow(2, -_digitalZoom));
|
||||
_marker->setScale(pow(2, -_digitalZoom));
|
||||
|
||||
updateShape();
|
||||
}
|
||||
|
||||
QPointF PathItem::position(qreal x) const
|
||||
{
|
||||
int low = 0;
|
||||
@ -137,7 +149,7 @@ void PathItem::moveMarker(qreal distance)
|
||||
&& distance <= _path.last().distance()) {
|
||||
_marker->setVisible(true);
|
||||
_marker->setPos(position(distance));
|
||||
_md = distance;
|
||||
_markerDistance = distance;
|
||||
} else
|
||||
_marker->setVisible(false);
|
||||
}
|
||||
@ -146,7 +158,7 @@ void PathItem::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
|
||||
_pen.setWidthF((_width + 1) * 1.0/scale());
|
||||
_pen.setWidthF((_width + 1) * pow(2, -_digitalZoom));
|
||||
setZValue(zValue() + 1.0);
|
||||
update();
|
||||
|
||||
@ -157,7 +169,7 @@ void PathItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
|
||||
_pen.setWidthF(_width * 1.0/scale());
|
||||
_pen.setWidthF(_width * pow(2, -_digitalZoom));
|
||||
setZValue(zValue() - 1.0);
|
||||
update();
|
||||
|
||||
|
@ -28,8 +28,7 @@ public:
|
||||
void setColor(const QColor &color);
|
||||
void setWidth(qreal width);
|
||||
void setStyle(Qt::PenStyle style);
|
||||
|
||||
void showMarker(bool show) {_marker->setVisible(show);}
|
||||
void setDigitalZoom(int zoom);
|
||||
|
||||
public slots:
|
||||
void moveMarker(qreal distance);
|
||||
@ -50,7 +49,8 @@ private:
|
||||
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
|
||||
|
||||
Map *_map;
|
||||
qreal _md;
|
||||
qreal _markerDistance;
|
||||
int _digitalZoom;
|
||||
|
||||
qreal _width;
|
||||
QPen _pen;
|
||||
|
@ -50,7 +50,6 @@ PathView::PathView(Map *map, POI *poi, QWidget *parent)
|
||||
|
||||
_mapScale = new ScaleItem();
|
||||
_mapScale->setZValue(2.0);
|
||||
_mapScale->setFlag(QGraphicsItem::ItemIgnoresTransformations);
|
||||
|
||||
_map = map;
|
||||
_poi = poi;
|
||||
@ -97,9 +96,10 @@ PathItem *PathView::addTrack(const Track &track)
|
||||
_tracks.append(ti);
|
||||
_tr |= ti->path().boundingRect();
|
||||
ti->setColor(_palette.nextColor());
|
||||
ti->setWidth(_trackWidth * pow(2, -_digitalZoom));
|
||||
ti->setWidth(_trackWidth);
|
||||
ti->setStyle(_trackStyle);
|
||||
ti->setVisible(_showTracks);
|
||||
ti->setDigitalZoom(_digitalZoom);
|
||||
_scene->addItem(ti);
|
||||
|
||||
addPOI(_poi->points(ti->path()));
|
||||
@ -118,11 +118,12 @@ PathItem *PathView::addRoute(const Route &route)
|
||||
_routes.append(ri);
|
||||
_rr |= ri->path().boundingRect();
|
||||
ri->setColor(_palette.nextColor());
|
||||
ri->setWidth(_routeWidth * pow(2, -_digitalZoom));
|
||||
ri->setWidth(_routeWidth);
|
||||
ri->setStyle(_routeStyle);
|
||||
ri->setVisible(_showRoutes);
|
||||
ri->showWaypoints(_showRouteWaypoints);
|
||||
ri->showWaypointLabels(_showWaypointLabels);
|
||||
ri->setDigitalZoom(_digitalZoom);
|
||||
_scene->addItem(ri);
|
||||
|
||||
addPOI(_poi->points(ri->path()));
|
||||
@ -142,7 +143,7 @@ void PathView::addWaypoints(const QList<Waypoint> &waypoints)
|
||||
wi->setZValue(1);
|
||||
wi->showLabel(_showWaypointLabels);
|
||||
wi->setVisible(_showWaypoints);
|
||||
wi->setFlag(QGraphicsItem::ItemIgnoresTransformations);
|
||||
wi->setDigitalZoom(_digitalZoom);
|
||||
_scene->addItem(wi);
|
||||
}
|
||||
|
||||
@ -340,7 +341,7 @@ void PathView::addPOI(const QVector<Waypoint> &waypoints)
|
||||
pi->setZValue(1);
|
||||
pi->showLabel(_showPOILabels);
|
||||
pi->setVisible(_showPOI);
|
||||
pi->setFlag(QGraphicsItem::ItemIgnoresTransformations);
|
||||
pi->setDigitalZoom(_digitalZoom);
|
||||
_scene->addItem(pi);
|
||||
|
||||
_pois.insert(w, pi);
|
||||
@ -372,23 +373,40 @@ void PathView::redraw()
|
||||
|
||||
void PathView::resetDigitalZoom()
|
||||
{
|
||||
_digitalZoom = 0;
|
||||
QHash<Waypoint, WaypointItem*>::const_iterator it;
|
||||
|
||||
_digitalZoom = 0;
|
||||
resetTransform();
|
||||
|
||||
setTrackWidth(_trackWidth);
|
||||
setRouteWidth(_routeWidth);
|
||||
for (int i = 0; i < _tracks.size(); i++)
|
||||
_tracks.at(i)->setDigitalZoom(0);
|
||||
for (int i = 0; i < _routes.size(); i++)
|
||||
_routes.at(i)->setDigitalZoom(0);
|
||||
for (int i = 0; i < _waypoints.size(); i++)
|
||||
_waypoints.at(i)->setDigitalZoom(0);
|
||||
for (it = _pois.constBegin(); it != _pois.constEnd(); it++)
|
||||
it.value()->setDigitalZoom(0);
|
||||
|
||||
_mapScale->setDigitalZoom(0);
|
||||
}
|
||||
|
||||
void PathView::digitalZoom(int zoom)
|
||||
{
|
||||
QHash<Waypoint, WaypointItem*>::const_iterator it;
|
||||
|
||||
_digitalZoom += zoom;
|
||||
scale(pow(2, zoom), pow(2, zoom));
|
||||
|
||||
setTrackWidth(_trackWidth);
|
||||
setRouteWidth(_routeWidth);
|
||||
for (int i = 0; i < _tracks.size(); i++)
|
||||
_tracks.at(i)->setDigitalZoom(_digitalZoom);
|
||||
for (int i = 0; i < _routes.size(); i++)
|
||||
_routes.at(i)->setDigitalZoom(_digitalZoom);
|
||||
for (int i = 0; i < _waypoints.size(); i++)
|
||||
_waypoints.at(i)->setDigitalZoom(_digitalZoom);
|
||||
for (it = _pois.constBegin(); it != _pois.constEnd(); it++)
|
||||
it.value()->setDigitalZoom(_digitalZoom);
|
||||
|
||||
_mapScale->setResolution(_res * pow(2, -_digitalZoom));
|
||||
_mapScale->setDigitalZoom(_digitalZoom);
|
||||
}
|
||||
|
||||
void PathView::zoom(int zoom, const QPoint &pos, const Coordinates &c)
|
||||
@ -519,9 +537,7 @@ void PathView::clear()
|
||||
_tr = QRectF(); _rr = QRectF(); _wr = QRectF();
|
||||
_wp = QPointF();
|
||||
|
||||
_digitalZoom = 0;
|
||||
resetTransform();
|
||||
|
||||
resetDigitalZoom();
|
||||
resetCachedContent();
|
||||
}
|
||||
|
||||
@ -608,7 +624,7 @@ void PathView::setTrackWidth(int width)
|
||||
_trackWidth = width;
|
||||
|
||||
for (int i = 0; i < _tracks.count(); i++)
|
||||
_tracks.at(i)->setWidth(width * pow(2, -_digitalZoom));
|
||||
_tracks.at(i)->setWidth(width);
|
||||
}
|
||||
|
||||
void PathView::setRouteWidth(int width)
|
||||
@ -616,7 +632,7 @@ void PathView::setRouteWidth(int width)
|
||||
_routeWidth = width;
|
||||
|
||||
for (int i = 0; i < _routes.count(); i++)
|
||||
_routes.at(i)->setWidth(width * pow(2, -_digitalZoom));
|
||||
_routes.at(i)->setWidth(width);
|
||||
}
|
||||
|
||||
void PathView::setTrackStyle(Qt::PenStyle style)
|
||||
|
@ -1,3 +1,4 @@
|
||||
#include <cmath>
|
||||
#include <QPainter>
|
||||
#include "config.h"
|
||||
#include "misc.h"
|
||||
@ -15,6 +16,7 @@ ScaleItem::ScaleItem(QGraphicsItem *parent) : QGraphicsItem(parent)
|
||||
{
|
||||
_units = Metric;
|
||||
_res = 1.0;
|
||||
_digitalZoom = 0;
|
||||
|
||||
#ifndef Q_OS_MAC
|
||||
setCacheMode(QGraphicsItem::DeviceCoordinateCache);
|
||||
@ -87,24 +89,26 @@ QString ScaleItem::units() const
|
||||
|
||||
void ScaleItem::computeScale()
|
||||
{
|
||||
qreal res = _res * pow(2, -_digitalZoom);
|
||||
|
||||
if (_units == Imperial) {
|
||||
_length = niceNum((_res * M2FT * SCALE_WIDTH) / SEGMENTS, 1);
|
||||
_length = niceNum((res * M2FT * SCALE_WIDTH) / SEGMENTS, 1);
|
||||
if (_length >= MIINFT) {
|
||||
_length = niceNum((_res * M2FT * FT2MI * SCALE_WIDTH) / SEGMENTS, 1);
|
||||
_width = (_length / (_res * M2FT * FT2MI));
|
||||
_length = niceNum((res * M2FT * FT2MI * SCALE_WIDTH) / SEGMENTS, 1);
|
||||
_width = (_length / (res * M2FT * FT2MI));
|
||||
_scale = true;
|
||||
} else {
|
||||
_width = (_length / (_res * M2FT));
|
||||
_width = (_length / (res * M2FT));
|
||||
_scale = false;
|
||||
}
|
||||
} else {
|
||||
_length = niceNum((_res * SCALE_WIDTH) / SEGMENTS, 1);
|
||||
_length = niceNum((res * SCALE_WIDTH) / SEGMENTS, 1);
|
||||
if (_length >= KMINM) {
|
||||
_length *= M2KM;
|
||||
_width = (_length / (_res * M2KM));
|
||||
_width = (_length / (res * M2KM));
|
||||
_scale = true;
|
||||
} else {
|
||||
_width = (_length / _res);
|
||||
_width = (_length / res);
|
||||
_scale = false;
|
||||
}
|
||||
}
|
||||
@ -127,3 +131,14 @@ void ScaleItem::setUnits(enum Units units)
|
||||
updateBoundingRect();
|
||||
update();
|
||||
}
|
||||
|
||||
void ScaleItem::setDigitalZoom(int zoom)
|
||||
{
|
||||
prepareGeometryChange();
|
||||
_digitalZoom = zoom;
|
||||
computeScale();
|
||||
updateBoundingRect();
|
||||
update();
|
||||
|
||||
setScale(pow(2, -_digitalZoom));
|
||||
}
|
||||
|
@ -15,6 +15,7 @@ public:
|
||||
|
||||
void setResolution(qreal res);
|
||||
void setUnits(enum Units units);
|
||||
void setDigitalZoom(int zoom);
|
||||
|
||||
private:
|
||||
void updateBoundingRect();
|
||||
@ -27,6 +28,8 @@ private:
|
||||
Units _units;
|
||||
bool _scale;
|
||||
|
||||
int _digitalZoom;
|
||||
|
||||
QRectF _boundingRect;
|
||||
};
|
||||
|
||||
|
@ -3,7 +3,6 @@
|
||||
#include "config.h"
|
||||
#include "format.h"
|
||||
#include "tooltip.h"
|
||||
#include "map.h"
|
||||
#include "waypointitem.h"
|
||||
|
||||
|
||||
@ -46,11 +45,6 @@ WaypointItem::WaypointItem(const Waypoint &waypoint, Map *map,
|
||||
setAcceptHoverEvents(true);
|
||||
}
|
||||
|
||||
void WaypointItem::setMap(Map *map)
|
||||
{
|
||||
setPos(map->ll2xy(_waypoint.coordinates()));
|
||||
}
|
||||
|
||||
void WaypointItem::updateShape()
|
||||
{
|
||||
QPainterPath p;
|
||||
@ -106,14 +100,6 @@ void WaypointItem::paint(QPainter *painter,
|
||||
*/
|
||||
}
|
||||
|
||||
/*
|
||||
void WaypointItem::setScale(qreal scale)
|
||||
{
|
||||
QPointF p = _map->ll2xy(_waypoint.coordinates());
|
||||
setPos(QPointF(p.x(), -p.y()) * scale);
|
||||
}
|
||||
*/
|
||||
|
||||
void WaypointItem::setUnits(enum Units units)
|
||||
{
|
||||
setToolTip(toolTip(units));
|
||||
|
@ -1,11 +1,11 @@
|
||||
#ifndef WAYPOINTITEM_H
|
||||
#define WAYPOINTITEM_H
|
||||
|
||||
#include <cmath>
|
||||
#include <QGraphicsItem>
|
||||
#include "waypoint.h"
|
||||
#include "units.h"
|
||||
|
||||
class Map;
|
||||
#include "map.h"
|
||||
|
||||
class WaypointItem : public QGraphicsItem
|
||||
{
|
||||
@ -14,9 +14,10 @@ public:
|
||||
|
||||
const Waypoint &waypoint() const {return _waypoint;}
|
||||
|
||||
void setMap(Map *map);
|
||||
void setMap(Map *map) {setPos(map->ll2xy(_waypoint.coordinates()));}
|
||||
void setUnits(Units units);
|
||||
void showLabel(bool show);
|
||||
void setDigitalZoom(int zoom) {setScale(pow(2, -zoom));}
|
||||
|
||||
QPainterPath shape() const {return _shape;}
|
||||
QRectF boundingRect() const {return _shape.boundingRect();}
|
||||
|
Reference in New Issue
Block a user