1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-24 11:45:53 +01:00

Compare commits

..

No commits in common. "937c71f16c6d55410f5fcb73a0cbaf29585e9392" and "e33c74bdd76e2637cc77039f922c28ba4ff09b18" have entirely different histories.

32 changed files with 4050 additions and 4538 deletions

View File

@ -1,4 +1,4 @@
version: 13.25.{build} version: 13.24.{build}
configuration: configuration:
- Release - Release

View File

@ -3,7 +3,7 @@ unix:!macx:!android {
} else { } else {
TARGET = GPXSee TARGET = GPXSee
} }
VERSION = 13.25 VERSION = 13.24
QT += core \ QT += core \

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -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 "13.25" !define VERSION "13.24"
; The file to write ; The file to write
OutFile "GPXSee-${VERSION}_x64.exe" OutFile "GPXSee-${VERSION}_x64.exe"

View File

@ -364,21 +364,6 @@ void GUI::createActions()
_showCoordinatesAction->setCheckable(true); _showCoordinatesAction->setCheckable(true);
connect(_showCoordinatesAction, &QAction::triggered, _mapView, connect(_showCoordinatesAction, &QAction::triggered, _mapView,
&MapView::showCursorCoordinates); &MapView::showCursorCoordinates);
QActionGroup *mapLayersGroup = new QActionGroup(this);
connect(mapLayersGroup, &QActionGroup::triggered, this,
&GUI::selectMapLayers);
_drawAllAction = new QAction(tr("All"), this);
_drawAllAction->setMenuRole(QAction::NoRole);
_drawAllAction->setCheckable(true);
_drawAllAction->setActionGroup(mapLayersGroup);
_drawRastersAction = new QAction(tr("Raster only"), this);
_drawRastersAction->setMenuRole(QAction::NoRole);
_drawRastersAction->setCheckable(true);
_drawRastersAction->setActionGroup(mapLayersGroup);
_drawVectorsAction = new QAction(tr("Vector only"), this);
_drawVectorsAction->setMenuRole(QAction::NoRole);
_drawVectorsAction->setCheckable(true);
_drawVectorsAction->setActionGroup(mapLayersGroup);
// Position // Position
_showPositionAction = new QAction(QIcon::fromTheme(SHOW_POS_NAME, _showPositionAction = new QAction(QIcon::fromTheme(SHOW_POS_NAME,
@ -692,11 +677,6 @@ void GUI::createMenus()
_mapMenu->addAction(_loadMapDirAction); _mapMenu->addAction(_loadMapDirAction);
_mapMenu->addAction(_clearMapCacheAction); _mapMenu->addAction(_clearMapCacheAction);
_mapMenu->addSeparator(); _mapMenu->addSeparator();
QMenu *layersMenu = _mapMenu->addMenu(tr("Layers"));
layersMenu->menuAction()->setMenuRole(QAction::NoRole);
layersMenu->addAction(_drawAllAction);
layersMenu->addAction(_drawRastersAction);
layersMenu->addAction(_drawVectorsAction);
_mapMenu->addAction(_showCoordinatesAction); _mapMenu->addAction(_showCoordinatesAction);
_mapMenu->addSeparator(); _mapMenu->addSeparator();
_mapMenu->addAction(_showMapAction); _mapMenu->addAction(_showMapAction);
@ -1482,7 +1462,7 @@ void GUI::plotMainPage(QPainter *painter, const QRectF &rect, qreal ratio,
sc = 1; sc = 1;
} }
MapView::Flags flags; MapView::PlotFlags flags;
if (_options.hiresPrint) if (_options.hiresPrint)
flags |= MapView::HiRes; flags |= MapView::HiRes;
if (expand) if (expand)
@ -1738,16 +1718,6 @@ void GUI::showPathMarkerInfo(QAction *action)
} }
} }
void GUI::selectMapLayers(QAction *action)
{
if (action == _drawVectorsAction)
_mapView->selectLayers(MapView::Layer::Vector);
else if (action == _drawRastersAction)
_mapView->selectLayers(MapView::Layer::Raster);
else
_mapView->selectLayers(MapView::Layer::Raster | MapView::Layer::Vector);
}
void GUI::loadMap() void GUI::loadMap()
{ {
#ifdef Q_OS_ANDROID #ifdef Q_OS_ANDROID
@ -2508,19 +2478,10 @@ void GUI::writeSettings()
#endif // Q_OS_ANDROID #endif // Q_OS_ANDROID
/* Map */ /* Map */
MapView::Layers ml;
if (_drawRastersAction->isChecked())
ml = MapView::Layer::Raster;
else if (_drawVectorsAction->isChecked())
ml = MapView::Layer::Vector;
else
ml = MapView::Layer::Raster | MapView::Layer::Vector;
settings.beginGroup(SETTINGS_MAP); settings.beginGroup(SETTINGS_MAP);
WRITE(activeMap, _map->name()); WRITE(activeMap, _map->name());
WRITE(showMap, _showMapAction->isChecked()); WRITE(showMap, _showMapAction->isChecked());
WRITE(cursorCoordinates, _showCoordinatesAction->isChecked()); WRITE(cursorCoordinates, _showCoordinatesAction->isChecked());
WRITE(layers, (int)ml);
settings.endGroup(); settings.endGroup();
/* Graph */ /* Graph */
@ -2755,15 +2716,6 @@ void GUI::readSettings(QString &activeMap, QStringList &disabledPOIs,
_showCoordinatesAction->setChecked(true); _showCoordinatesAction->setChecked(true);
_mapView->showCursorCoordinates(true); _mapView->showCursorCoordinates(true);
} }
int layers = READ(layers).toInt();
if (layers == MapView::Layer::Raster) {
_drawRastersAction->setChecked(true);
_mapView->selectLayers(MapView::Layer::Raster);
} else if (layers == MapView::Layer::Vector) {
_drawVectorsAction->setChecked(true);
_mapView->selectLayers(MapView::Layer::Vector);
} else
_drawAllAction->setChecked(true);
activeMap = READ(activeMap).toString(); activeMap = READ(activeMap).toString();
settings.endGroup(); settings.endGroup();
@ -2879,10 +2831,10 @@ void GUI::readSettings(QString &activeMap, QStringList &disabledPOIs,
/* DEM */ /* DEM */
settings.beginGroup(SETTINGS_DEM); settings.beginGroup(SETTINGS_DEM);
if (READ(drawHillShading).toBool()) if (READ(drawHillShading).toBool()) {
_drawHillShadingAction->setChecked(true); _drawHillShadingAction->setChecked(true);
else _mapView->drawHillShading(true);
_mapView->drawHillShading(false); }
settings.endGroup(); settings.endGroup();
/* Position */ /* Position */

View File

@ -68,7 +68,6 @@ private slots:
void showGraphGrids(bool show); void showGraphGrids(bool show);
void showGraphSliderInfo(bool show); void showGraphSliderInfo(bool show);
void showPathMarkerInfo(QAction *action); void showPathMarkerInfo(QAction *action);
void selectMapLayers(QAction *action);
#ifdef Q_OS_ANDROID #ifdef Q_OS_ANDROID
void showGraphTabs(bool show); void showGraphTabs(bool show);
#else // Q_OS_ANDROID #else // Q_OS_ANDROID
@ -299,9 +298,6 @@ private:
QAction *_downloadMapDEMAction; QAction *_downloadMapDEMAction;
QAction *_showDEMTilesAction; QAction *_showDEMTilesAction;
QAction *_drawHillShadingAction; QAction *_drawHillShadingAction;
QAction *_drawRastersAction;
QAction *_drawVectorsAction;
QAction *_drawAllAction;
QAction *_mapsEnd; QAction *_mapsEnd;
QAction *_poisEnd; QAction *_poisEnd;
#ifndef Q_OS_ANDROID #ifndef Q_OS_ANDROID

View File

@ -62,8 +62,7 @@ MapView::MapView(Map *map, POI *poi, QWidget *parent) : QGraphicsView(parent)
_outputProjection = PCS::pcs(3857); _outputProjection = PCS::pcs(3857);
_inputProjection = GCS::gcs(4326); _inputProjection = GCS::gcs(4326);
_hidpi = true; _hidpi = true;
_hillShading = true; _hillShading = false;
_layers = Layer::Raster | Layer::Vector;
_map = map; _map = map;
_map->load(_inputProjection, _outputProjection, _deviceRatio, _hidpi); _map->load(_inputProjection, _outputProjection, _deviceRatio, _hidpi);
connect(_map, &Map::tilesLoaded, this, &MapView::reloadMap); connect(_map, &Map::tilesLoaded, this, &MapView::reloadMap);
@ -684,7 +683,7 @@ void MapView::keyReleaseEvent(QKeyEvent *event)
} }
void MapView::plot(QPainter *painter, const QRectF &target, qreal scale, void MapView::plot(QPainter *painter, const QRectF &target, qreal scale,
Flags flags) PlotFlags flags)
{ {
QRect orig, adj; QRect orig, adj;
qreal ratio, diff, q, p; qreal ratio, diff, q, p;
@ -1116,10 +1115,6 @@ void MapView::drawBackground(QPainter *painter, const QRectF &rect)
flags = Map::OpenGL; flags = Map::OpenGL;
if (_hillShading) if (_hillShading)
flags |= Map::HillShading; flags |= Map::HillShading;
if (_layers & Layer::Raster)
flags |= Map::Rasters;
if (_layers & Layer::Vector)
flags |= Map::Vectors;
_map->draw(painter, ir, flags); _map->draw(painter, ir, flags);
} }
@ -1257,13 +1252,6 @@ void MapView::drawHillShading(bool draw)
setMap(_map); setMap(_map);
} }
void MapView::selectLayers(Layers layers)
{
_layers = layers;
setMap(_map);
}
void MapView::useStyles(bool use) void MapView::useStyles(bool use)
{ {
GraphicsItem::useStyle(use); GraphicsItem::useStyle(use);

View File

@ -51,14 +51,7 @@ public:
HiRes = 1, HiRes = 1,
Expand = 2 Expand = 2
}; };
Q_DECLARE_FLAGS(Flags, Flag) Q_DECLARE_FLAGS(PlotFlags, Flag)
enum Layer {
NoLayers = 0,
Raster = 1,
Vector = 2
};
Q_DECLARE_FLAGS(Layers, Layer)
MapView(Map *map, POI *poi, QWidget *parent = 0); MapView(Map *map, POI *poi, QWidget *parent = 0);
@ -73,7 +66,8 @@ public:
void setGraph(int index); void setGraph(int index);
void showExtendedInfo(bool show) {_scene->showExtendedInfo(show);} void showExtendedInfo(bool show) {_scene->showExtendedInfo(show);}
void plot(QPainter *painter, const QRectF &target, qreal scale, Flags flags); void plot(QPainter *painter, const QRectF &target, qreal scale,
PlotFlags flags);
void clear(); void clear();
@ -136,7 +130,6 @@ public slots:
void showMotionInfo(bool show); void showMotionInfo(bool show);
void useStyles(bool use); void useStyles(bool use);
void drawHillShading(bool draw); void drawHillShading(bool draw);
void selectLayers(Layers layers);
private slots: private slots:
void updatePOI(); void updatePOI();
@ -216,7 +209,6 @@ private:
bool _infoBackground; bool _infoBackground;
bool _hillShading; bool _hillShading;
Layers _layers;
int _digitalZoom; int _digitalZoom;
bool _plot; bool _plot;
@ -230,6 +222,4 @@ private:
int _wheelDelta; int _wheelDelta;
}; };
Q_DECLARE_OPERATORS_FOR_FLAGS(MapView::Layers)
#endif // MAPVIEW_H #endif // MAPVIEW_H

View File

@ -5,7 +5,6 @@
#include <QGeoPositionInfoSource> #include <QGeoPositionInfoSource>
#include "common/config.h" #include "common/config.h"
#include "data/graph.h" #include "data/graph.h"
#include "GUI/mapview.h"
#include "format.h" #include "format.h"
#include "units.h" #include "units.h"
#include "timetype.h" #include "timetype.h"
@ -32,8 +31,6 @@
? QPageSize::PageSizeId::Letter \ ? QPageSize::PageSizeId::Letter \
: QPageSize::PageSizeId::A4) : QPageSize::PageSizeId::A4)
#define ALL_LAYERS (int)(MapView::Layer::Raster | MapView::Layer::Vector)
#ifdef Q_OS_ANDROID #ifdef Q_OS_ANDROID
#define PIXMAP_CACHE 384 #define PIXMAP_CACHE 384
#define DEM_CACHE 128 #define DEM_CACHE 128
@ -147,7 +144,6 @@ SETTING(showToolbars, "toolbar", true );
SETTING(activeMap, "map", "Open Street Map" ); SETTING(activeMap, "map", "Open Street Map" );
SETTING(showMap, "show", true ); SETTING(showMap, "show", true );
SETTING(cursorCoordinates, "coordinates", false ); SETTING(cursorCoordinates, "coordinates", false );
SETTING(layers, "layers", ALL_LAYERS );
/* Graph */ /* Graph */
SETTING(showGraphs, "show", true ); SETTING(showGraphs, "show", true );

View File

@ -95,7 +95,6 @@ public:
static const Setting activeMap; static const Setting activeMap;
static const Setting showMap; static const Setting showMap;
static const Setting cursorCoordinates; static const Setting cursorCoordinates;
static const Setting layers;
/* Graph */ /* Graph */
static const Setting showGraphs; static const Setting showGraphs;

View File

@ -114,11 +114,8 @@ const QFont *RasterTile::poiFont(Style::FontSize size, int zoom,
} }
} }
void RasterTile::ll2xy(QList<MapData::Poly> &polys, bool polygons) const void RasterTile::ll2xy(QList<MapData::Poly> &polys) const
{ {
if (!_vectors && !polygons)
return;
for (int i = 0; i < polys.size(); i++) { for (int i = 0; i < polys.size(); i++) {
MapData::Poly &poly = polys[i]; MapData::Poly &poly = polys[i];
for (int j = 0; j < poly.points.size(); j++) { for (int j = 0; j < poly.points.size(); j++) {
@ -130,9 +127,6 @@ void RasterTile::ll2xy(QList<MapData::Poly> &polys, bool polygons) const
void RasterTile::ll2xy(QList<MapData::Point> &points) const void RasterTile::ll2xy(QList<MapData::Point> &points) const
{ {
if (!_vectors)
return;
for (int i = 0; i < points.size(); i++) { for (int i = 0; i < points.size(); i++) {
QPointF p(ll2xy(points.at(i).coordinates)); QPointF p(ll2xy(points.at(i).coordinates));
points[i].coordinates = Coordinates(p.x(), p.y()); points[i].coordinates = Coordinates(p.x(), p.y());
@ -151,9 +145,6 @@ void RasterTile::drawPolygons(QPainter *painter,
continue; continue;
if (poly.raster.isValid()) { if (poly.raster.isValid()) {
if (!_rasters)
continue;
RectC r(poly.raster.rect()); RectC r(poly.raster.rect());
QPointF tl(ll2xy(r.topLeft())); QPointF tl(ll2xy(r.topLeft()));
QPointF br(ll2xy(r.bottomRight())); QPointF br(ll2xy(r.bottomRight()));
@ -182,9 +173,6 @@ void RasterTile::drawPolygons(QPainter *painter,
//painter->drawRect(QRectF(tl, br)); //painter->drawRect(QRectF(tl, br));
//painter->setRenderHint(QPainter::Antialiasing); //painter->setRenderHint(QPainter::Antialiasing);
} else { } else {
if (!_vectors)
continue;
const Style::Polygon &style = _data->style()->polygon(poly.type); const Style::Polygon &style = _data->style()->polygon(poly.type);
painter->setPen(style.pen()); painter->setPen(style.pen());
@ -198,9 +186,6 @@ void RasterTile::drawPolygons(QPainter *painter,
void RasterTile::drawLines(QPainter *painter, void RasterTile::drawLines(QPainter *painter,
const QList<MapData::Poly> &lines) const const QList<MapData::Poly> &lines) const
{ {
if (!_vectors)
return;
painter->setBrush(Qt::NoBrush); painter->setBrush(Qt::NoBrush);
for (int i = 0; i < lines.size(); i++) { for (int i = 0; i < lines.size(); i++) {
@ -253,9 +238,6 @@ void RasterTile::processPolygons(const QList<MapData::Poly> &polygons,
QSet<QString> set; QSet<QString> set;
QList<TextItem *> labels; QList<TextItem *> labels;
if (!_vectors)
return;
for (int i = 0; i < polygons.size(); i++) { for (int i = 0; i < polygons.size(); i++) {
const MapData::Poly &poly = polygons.at(i); const MapData::Poly &poly = polygons.at(i);
bool exists = set.contains(poly.label.text()); bool exists = set.contains(poly.label.text());
@ -290,9 +272,6 @@ void RasterTile::processPolygons(const QList<MapData::Poly> &polygons,
void RasterTile::processLines(QList<MapData::Poly> &lines, void RasterTile::processLines(QList<MapData::Poly> &lines,
QList<TextItem*> &textItems, const QImage (&arrows)[2]) QList<TextItem*> &textItems, const QImage (&arrows)[2])
{ {
if (!_vectors)
return;
std::stable_sort(lines.begin(), lines.end()); std::stable_sort(lines.begin(), lines.end());
if (_zoom >= 22) if (_zoom >= 22)
@ -411,9 +390,6 @@ void RasterTile::processShields(const QList<MapData::Poly> &lines,
void RasterTile::processPoints(QList<MapData::Point> &points, void RasterTile::processPoints(QList<MapData::Point> &points,
QList<TextItem*> &textItems) QList<TextItem*> &textItems)
{ {
if (!_vectors)
return;
std::sort(points.begin(), points.end()); std::sort(points.begin(), points.end());
for (int i = 0; i < points.size(); i++) { for (int i = 0; i < points.size(); i++) {
@ -535,8 +511,8 @@ void RasterTile::render()
arrows[WATER] = HIDPI_IMG(":/map", "water-arrow", _ratio); arrows[WATER] = HIDPI_IMG(":/map", "water-arrow", _ratio);
fetchData(polygons, lines, points); fetchData(polygons, lines, points);
ll2xy(polygons, true); ll2xy(polygons);
ll2xy(lines, false); ll2xy(lines);
ll2xy(points); ll2xy(points);
processPoints(points, textItems); processPoints(points, textItems);

View File

@ -19,10 +19,9 @@ class RasterTile
public: public:
RasterTile(const Projection &proj, const Transform &transform, MapData *data, RasterTile(const Projection &proj, const Transform &transform, MapData *data,
int zoom, const QRect &rect, qreal ratio, const QString &key, int zoom, const QRect &rect, qreal ratio, const QString &key,
bool hillShading, bool rasters, bool vectors) bool hillShading)
: _proj(proj), _transform(transform), _data(data), _zoom(zoom), : _proj(proj), _transform(transform), _data(data), _zoom(zoom),
_rect(rect), _ratio(ratio), _key(key), _hillShading(hillShading), _rect(rect), _ratio(ratio), _key(key), _hillShading(hillShading) {}
_rasters(rasters), _vectors(vectors) {}
const QString &key() const {return _key;} const QString &key() const {return _key;}
QPoint xy() const {return _rect.topLeft();} QPoint xy() const {return _rect.topLeft();}
@ -54,7 +53,7 @@ private:
{return _transform.proj2img(_proj.ll2xy(c));} {return _transform.proj2img(_proj.ll2xy(c));}
Coordinates xy2ll(const QPointF &p) const Coordinates xy2ll(const QPointF &p) const
{return _proj.xy2ll(_transform.img2proj(p));} {return _proj.xy2ll(_transform.img2proj(p));}
void ll2xy(QList<MapData::Poly> &polys, bool polygons) const; void ll2xy(QList<MapData::Poly> &polys) const;
void ll2xy(QList<MapData::Point> &points) const; void ll2xy(QList<MapData::Point> &points) const;
void drawPolygons(QPainter *painter, const QList<MapData::Poly> &polygons) const; void drawPolygons(QPainter *painter, const QList<MapData::Poly> &polygons) const;
@ -87,7 +86,6 @@ private:
QString _key; QString _key;
QPixmap _pixmap; QPixmap _pixmap;
bool _hillShading; bool _hillShading;
bool _rasters, _vectors;
}; };
} }

View File

@ -246,8 +246,7 @@ void IMGMap::draw(QPainter *painter, const QRectF &rect, Flags flags)
else { else {
tiles.append(RasterTile(_projection, _transform, _data.at(n), tiles.append(RasterTile(_projection, _transform, _data.at(n),
_zoom, QRect(ttl, QSize(TILE_SIZE, TILE_SIZE)), _tileRatio, _zoom, QRect(ttl, QSize(TILE_SIZE, TILE_SIZE)), _tileRatio,
key, !n && flags & Map::HillShading, flags & Map::Rasters, key, !n && flags & Map::HillShading));
flags & Map::Vectors));
} }
} }
} }

View File

@ -21,9 +21,7 @@ public:
NoFlags = 0, NoFlags = 0,
Block = 1, Block = 1,
OpenGL = 2, OpenGL = 2,
HillShading = 4, HillShading = 4
Rasters = 8,
Vectors = 16
}; };
Q_DECLARE_FLAGS(Flags, Flag) Q_DECLARE_FLAGS(Flags, Flag)