1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2025-07-22 14:54:24 +02:00

Compare commits

..

4 Commits

Author SHA1 Message Date
9b3c11cc68 Version++ 2023-05-07 21:19:55 +02:00
e6fdd0f53d Fixed crash on empty routes 2023-05-07 21:15:44 +02:00
d9c0770b51 Code cleanup 2023-05-06 21:53:40 +02:00
ca6c7247c0 Added missing cache insert 2023-05-06 16:14:49 +02:00
8 changed files with 28 additions and 29 deletions

View File

@ -1,4 +1,4 @@
version: 13.1.{build}
version: 13.2.{build}
configuration:
- Release

View File

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

View File

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

View File

@ -33,13 +33,16 @@ Path Route::path() const
Graph Route::gpsElevation() const
{
Graph graph;
graph.append(GraphSegment(QDateTime()));
GraphSegment &gs = graph.last();
QDateTime date;
GraphSegment gs(date);
for (int i = 0; i < _data.size(); i++)
if (_data.at(i).hasElevation())
gs.append(GraphPoint(_distance.at(i), NAN, _data.at(i).elevation()));
if (gs.size() >= 2)
graph.append(gs);
if (_data.style().color().isValid())
graph.setColor(_data.style().color());
@ -49,8 +52,8 @@ Graph Route::gpsElevation() const
Graph Route::demElevation() const
{
Graph graph;
graph.append(GraphSegment(QDateTime()));
GraphSegment &gs = graph.last();
QDateTime date;
GraphSegment gs(date);
for (int i = 0; i < _data.size(); i++) {
qreal dem = DEM::elevation(_data.at(i).coordinates());
@ -58,6 +61,9 @@ Graph Route::demElevation() const
gs.append(GraphPoint(_distance.at(i), NAN, dem));
}
if (gs.size() >= 2)
graph.append(gs);
if (_data.style().color().isValid())
graph.setColor(_data.style().color());

View File

@ -5,34 +5,26 @@
#define SAMPLES 100
void Map::growLeft(const QPointF &p, RectC &rect)
static void growLeft(const Coordinates &c, RectC &rect)
{
Coordinates c(xy2ll(p));
if (c.lon() < rect.left())
rect.setLeft(c.lon());
}
void Map::growRight(const QPointF &p, RectC &rect)
static void growRight(const Coordinates &c, RectC &rect)
{
Coordinates c(xy2ll(p));
if (c.lon() > rect.right())
rect.setRight(c.lon());
}
void Map::growTop(const QPointF &p, RectC &rect)
static void growTop(const Coordinates &c, RectC &rect)
{
Coordinates c(xy2ll(p));
if (c.lat() > rect.top())
rect.setTop(c.lat());
}
void Map::growBottom(const QPointF &p, RectC &rect)
static void growBottom(const Coordinates &c, RectC &rect)
{
Coordinates c(xy2ll(p));
if (c.lat() < rect.bottom())
rect.setBottom(c.lat());
}
@ -53,14 +45,14 @@ RectC Map::llBounds(const Projection &proj)
for (int i = 0; i <= SAMPLES; i++) {
double x = b.left() + i * dx;
growBottom(QPointF(x, b.bottom()), rect);
growTop(QPointF(x, b.top()), rect);
growBottom(xy2ll(QPointF(x, b.bottom())), rect);
growTop(xy2ll(QPointF(x, b.top())), rect);
}
for (int i = 0; i <= SAMPLES; i++) {
double y = b.top() + i * dy;
growLeft(QPointF(b.left(), y), rect);
growRight(QPointF(b.right(), y), rect);
growLeft(xy2ll(QPointF(b.left(), y)), rect);
growRight(xy2ll(QPointF(b.right(), y)), rect);
}
return rect;

View File

@ -62,11 +62,6 @@ signals:
void mapLoaded();
private:
void growLeft(const QPointF &p, RectC &rect);
void growRight(const QPointF &p, RectC &rect);
void growTop(const QPointF &p, RectC &rect);
void growBottom(const QPointF &p, RectC &rect);
QString _path;
};

View File

@ -17,7 +17,7 @@ public:
const QVariant &zoom() const {return _zoom;}
const QPoint &xy() const {return _xy;}
const RectD &bbox() const {return _bbox;}
QPixmap& pixmap() {return _pixmap;}
QPixmap &pixmap() {return _pixmap;}
private:
QPoint _xy;

View File

@ -61,6 +61,7 @@ TileLoader::TileLoader(const QString &dir, QObject *parent)
connect(_downloader, &Downloader::finished, this, &TileLoader::finished);
}
void TileLoader::loadTilesAsync(QVector<FetchTile> &list)
{
QList<Download> dl;
@ -142,6 +143,11 @@ void TileLoader::loadTilesSync(QVector<FetchTile> &list)
QFuture<void> future = QtConcurrent::map(imgs, &TileImage::load);
future.waitForFinished();
for (int i = 0; i < imgs.size(); i++) {
TileImage &ti = imgs[i];
QPixmapCache::insert(ti.file(), ti.tile()->pixmap());
}
}
void TileLoader::clearCache()