mirror of
https://github.com/tumic0/GPXSee.git
synced 2025-03-17 12:07:47 +01:00
Compare commits
3 Commits
d8f7089450
...
f7a81cafd5
Author | SHA1 | Date | |
---|---|---|---|
f7a81cafd5 | |||
108e68c7c9 | |||
f1fd4f8bc9 |
22
gpxsee.pro
22
gpxsee.pro
@ -24,9 +24,6 @@ greaterThan(QT_MAJOR_VERSION, 5) {
|
|||||||
CONFIG += object_parallel_to_source
|
CONFIG += object_parallel_to_source
|
||||||
INCLUDEPATH += ./src
|
INCLUDEPATH += ./src
|
||||||
HEADERS += src/common/config.h \
|
HEADERS += src/common/config.h \
|
||||||
src/GUI/crosshairitem.h \
|
|
||||||
src/GUI/motioninfoitem.h \
|
|
||||||
src/GUI/pluginparameters.h \
|
|
||||||
src/common/garmin.h \
|
src/common/garmin.h \
|
||||||
src/common/coordinates.h \
|
src/common/coordinates.h \
|
||||||
src/common/hash.h \
|
src/common/hash.h \
|
||||||
@ -46,6 +43,10 @@ HEADERS += src/common/config.h \
|
|||||||
src/common/polygon.h \
|
src/common/polygon.h \
|
||||||
src/common/color.h \
|
src/common/color.h \
|
||||||
src/common/csv.h \
|
src/common/csv.h \
|
||||||
|
src/common/dem.h \
|
||||||
|
src/GUI/crosshairitem.h \
|
||||||
|
src/GUI/motioninfoitem.h \
|
||||||
|
src/GUI/pluginparameters.h \
|
||||||
src/GUI/authenticationwidget.h \
|
src/GUI/authenticationwidget.h \
|
||||||
src/GUI/axislabelitem.h \
|
src/GUI/axislabelitem.h \
|
||||||
src/GUI/dirselectwidget.h \
|
src/GUI/dirselectwidget.h \
|
||||||
@ -256,7 +257,6 @@ HEADERS += src/common/config.h \
|
|||||||
src/data/oziparsers.h \
|
src/data/oziparsers.h \
|
||||||
src/data/locparser.h \
|
src/data/locparser.h \
|
||||||
src/data/slfparser.h \
|
src/data/slfparser.h \
|
||||||
src/data/dem.h \
|
|
||||||
src/data/demloader.h \
|
src/data/demloader.h \
|
||||||
src/data/area.h \
|
src/data/area.h \
|
||||||
src/data/exifparser.h \
|
src/data/exifparser.h \
|
||||||
@ -267,10 +267,6 @@ HEADERS += src/common/config.h \
|
|||||||
src/data/geojsonparser.h
|
src/data/geojsonparser.h
|
||||||
|
|
||||||
SOURCES += src/main.cpp \
|
SOURCES += src/main.cpp \
|
||||||
src/GUI/crosshairitem.cpp \
|
|
||||||
src/GUI/motioninfoitem.cpp \
|
|
||||||
src/GUI/pluginparameters.cpp \
|
|
||||||
src/GUI/settings.cpp \
|
|
||||||
src/common/coordinates.cpp \
|
src/common/coordinates.cpp \
|
||||||
src/common/rectc.cpp \
|
src/common/rectc.cpp \
|
||||||
src/common/range.cpp \
|
src/common/range.cpp \
|
||||||
@ -281,6 +277,11 @@ SOURCES += src/main.cpp \
|
|||||||
src/common/tifffile.cpp \
|
src/common/tifffile.cpp \
|
||||||
src/common/downloader.cpp \
|
src/common/downloader.cpp \
|
||||||
src/common/csv.cpp \
|
src/common/csv.cpp \
|
||||||
|
src/common/dem.cpp \
|
||||||
|
src/GUI/crosshairitem.cpp \
|
||||||
|
src/GUI/motioninfoitem.cpp \
|
||||||
|
src/GUI/pluginparameters.cpp \
|
||||||
|
src/GUI/settings.cpp \
|
||||||
src/GUI/authenticationwidget.cpp \
|
src/GUI/authenticationwidget.cpp \
|
||||||
src/GUI/axislabelitem.cpp \
|
src/GUI/axislabelitem.cpp \
|
||||||
src/GUI/dirselectwidget.cpp \
|
src/GUI/dirselectwidget.cpp \
|
||||||
@ -339,8 +340,6 @@ SOURCES += src/main.cpp \
|
|||||||
src/GUI/pngexportdialog.cpp \
|
src/GUI/pngexportdialog.cpp \
|
||||||
src/GUI/projectioncombobox.cpp \
|
src/GUI/projectioncombobox.cpp \
|
||||||
src/GUI/passwordedit.cpp \
|
src/GUI/passwordedit.cpp \
|
||||||
src/data/gpsdumpparser.cpp \
|
|
||||||
src/data/twonavparser.cpp \
|
|
||||||
src/map/ENC/atlasdata.cpp \
|
src/map/ENC/atlasdata.cpp \
|
||||||
src/map/ENC/mapdata.cpp \
|
src/map/ENC/mapdata.cpp \
|
||||||
src/map/ENC/rastertile.cpp \
|
src/map/ENC/rastertile.cpp \
|
||||||
@ -437,6 +436,8 @@ SOURCES += src/main.cpp \
|
|||||||
src/map/mapsforgemap.cpp \
|
src/map/mapsforgemap.cpp \
|
||||||
src/map/worldfilemap.cpp \
|
src/map/worldfilemap.cpp \
|
||||||
src/map/hillshading.cpp \
|
src/map/hillshading.cpp \
|
||||||
|
src/data/gpsdumpparser.cpp \
|
||||||
|
src/data/twonavparser.cpp \
|
||||||
src/data/address.cpp \
|
src/data/address.cpp \
|
||||||
src/data/itnparser.cpp \
|
src/data/itnparser.cpp \
|
||||||
src/data/onmoveparsers.cpp \
|
src/data/onmoveparsers.cpp \
|
||||||
@ -457,7 +458,6 @@ SOURCES += src/main.cpp \
|
|||||||
src/data/oziparsers.cpp \
|
src/data/oziparsers.cpp \
|
||||||
src/data/locparser.cpp \
|
src/data/locparser.cpp \
|
||||||
src/data/slfparser.cpp \
|
src/data/slfparser.cpp \
|
||||||
src/data/dem.cpp \
|
|
||||||
src/data/demloader.cpp \
|
src/data/demloader.cpp \
|
||||||
src/data/exifparser.cpp \
|
src/data/exifparser.cpp \
|
||||||
src/data/cupparser.cpp \
|
src/data/cupparser.cpp \
|
||||||
|
@ -14,11 +14,11 @@
|
|||||||
#include "common/programpaths.h"
|
#include "common/programpaths.h"
|
||||||
#include "common/config.h"
|
#include "common/config.h"
|
||||||
#include "common/downloader.h"
|
#include "common/downloader.h"
|
||||||
|
#include "common/dem.h"
|
||||||
#include "map/ellipsoid.h"
|
#include "map/ellipsoid.h"
|
||||||
#include "map/gcs.h"
|
#include "map/gcs.h"
|
||||||
#include "map/conversion.h"
|
#include "map/conversion.h"
|
||||||
#include "map/pcs.h"
|
#include "map/pcs.h"
|
||||||
#include "data/dem.h"
|
|
||||||
#include "data/waypoint.h"
|
#include "data/waypoint.h"
|
||||||
#include "gui.h"
|
#include "gui.h"
|
||||||
#include "mapaction.h"
|
#include "mapaction.h"
|
||||||
|
@ -7,9 +7,9 @@
|
|||||||
#include <QClipboard>
|
#include <QClipboard>
|
||||||
#include <QOpenGLWidget>
|
#include <QOpenGLWidget>
|
||||||
#include <QGeoPositionInfoSource>
|
#include <QGeoPositionInfoSource>
|
||||||
|
#include "common/dem.h"
|
||||||
#include "data/poi.h"
|
#include "data/poi.h"
|
||||||
#include "data/data.h"
|
#include "data/data.h"
|
||||||
#include "data/dem.h"
|
|
||||||
#include "map/map.h"
|
#include "map/map.h"
|
||||||
#include "map/pcs.h"
|
#include "map/pcs.h"
|
||||||
#include "trackitem.h"
|
#include "trackitem.h"
|
||||||
|
@ -91,11 +91,6 @@ QString DEM::Tile::baseName() const
|
|||||||
QString DEM::_dir;
|
QString DEM::_dir;
|
||||||
DEM::TileCache DEM::_data;
|
DEM::TileCache DEM::_data;
|
||||||
|
|
||||||
QString DEM::fileName(const QString &baseName)
|
|
||||||
{
|
|
||||||
return QDir(_dir).absoluteFilePath(baseName);
|
|
||||||
}
|
|
||||||
|
|
||||||
void DEM::setCacheSize(int size)
|
void DEM::setCacheSize(int size)
|
||||||
{
|
{
|
||||||
_data.setMaxCost(size * 1024);
|
_data.setMaxCost(size * 1024);
|
||||||
@ -111,41 +106,43 @@ void DEM::clearCache()
|
|||||||
_data.clear();
|
_data.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QByteArray *DEM::loadTile(const Tile &tile)
|
||||||
|
{
|
||||||
|
QString bn(tile.baseName());
|
||||||
|
QString fn(QDir(_dir).absoluteFilePath(bn));
|
||||||
|
QString zn(fn + ".zip");
|
||||||
|
|
||||||
|
if (QFileInfo::exists(zn)) {
|
||||||
|
QZipReader zip(zn, QIODevice::ReadOnly);
|
||||||
|
return new QByteArray(zip.fileData(bn));
|
||||||
|
} else {
|
||||||
|
QFile file(fn);
|
||||||
|
if (!file.open(QIODevice::ReadOnly)) {
|
||||||
|
qWarning("%s: %s", qPrintable(file.fileName()),
|
||||||
|
qPrintable(file.errorString()));
|
||||||
|
return new QByteArray();
|
||||||
|
} else
|
||||||
|
return new QByteArray(file.readAll());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
double DEM::elevation(const Coordinates &c)
|
double DEM::elevation(const Coordinates &c)
|
||||||
{
|
{
|
||||||
if (_dir.isEmpty())
|
if (_dir.isEmpty())
|
||||||
return NAN;
|
return NAN;
|
||||||
|
|
||||||
Tile tile(qFloor(c.lon()), qFloor(c.lat()));
|
Tile tile(qFloor(c.lon()), qFloor(c.lat()));
|
||||||
|
QByteArray *ba = _data.object(tile);
|
||||||
|
double ele;
|
||||||
|
|
||||||
QByteArray *ba = _data[tile];
|
|
||||||
if (!ba) {
|
if (!ba) {
|
||||||
QString bn(tile.baseName());
|
ba = loadTile(tile);
|
||||||
QString fn(fileName(bn));
|
ele = height(c, ba);
|
||||||
QString zn(fn + ".zip");
|
_data.insert(tile, ba, ba->size());
|
||||||
|
|
||||||
if (QFileInfo::exists(zn)) {
|
|
||||||
QZipReader zip(zn, QIODevice::ReadOnly);
|
|
||||||
ba = new QByteArray(zip.fileData(bn));
|
|
||||||
double ele = height(c, ba);
|
|
||||||
_data.insert(tile, ba, ba->size());
|
|
||||||
return ele;
|
|
||||||
} else {
|
|
||||||
QFile file(fn);
|
|
||||||
if (!file.open(QIODevice::ReadOnly)) {
|
|
||||||
qWarning("%s: %s", qPrintable(file.fileName()),
|
|
||||||
qPrintable(file.errorString()));
|
|
||||||
_data.insert(tile, new QByteArray());
|
|
||||||
return NAN;
|
|
||||||
} else {
|
|
||||||
ba = new QByteArray(file.readAll());
|
|
||||||
double ele = height(c, ba);
|
|
||||||
_data.insert(tile, ba, ba->size());
|
|
||||||
return ele;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else
|
} else
|
||||||
return height(c, ba);
|
ele = height(c, ba);
|
||||||
|
|
||||||
|
return ele;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<Area> DEM::tiles()
|
QList<Area> DEM::tiles()
|
@ -6,7 +6,7 @@
|
|||||||
#include <QByteArray>
|
#include <QByteArray>
|
||||||
#include <QMutex>
|
#include <QMutex>
|
||||||
#include "common/hash.h"
|
#include "common/hash.h"
|
||||||
#include "area.h"
|
#include "data/area.h"
|
||||||
|
|
||||||
class Coordinates;
|
class Coordinates;
|
||||||
|
|
||||||
@ -46,7 +46,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
typedef QCache<DEM::Tile, QByteArray> TileCache;
|
typedef QCache<DEM::Tile, QByteArray> TileCache;
|
||||||
|
|
||||||
static QString fileName(const QString &baseName);
|
static QByteArray *loadTile(const Tile &tile);
|
||||||
|
|
||||||
static QString _dir;
|
static QString _dir;
|
||||||
static TileCache _data;
|
static TileCache _data;
|
@ -4,7 +4,7 @@
|
|||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include "common/downloader.h"
|
#include "common/downloader.h"
|
||||||
#include "dem.h"
|
#include "common/dem.h"
|
||||||
|
|
||||||
class RectC;
|
class RectC;
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#include "dem.h"
|
#include "common/dem.h"
|
||||||
#include "route.h"
|
#include "route.h"
|
||||||
|
|
||||||
bool Route::_useDEM = false;
|
bool Route::_useDEM = false;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#include "dem.h"
|
#include "common/dem.h"
|
||||||
#include "track.h"
|
#include "track.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
#include "dem.h"
|
#include "common/dem.h"
|
||||||
#include "waypoint.h"
|
#include "waypoint.h"
|
||||||
|
|
||||||
bool Waypoint::_useDEM = false;
|
bool Waypoint::_useDEM = false;
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
#include <QFont>
|
#include <QFont>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <QCache>
|
#include <QCache>
|
||||||
|
#include "common/dem.h"
|
||||||
#include "map/textpathitem.h"
|
#include "map/textpathitem.h"
|
||||||
#include "map/textpointitem.h"
|
#include "map/textpointitem.h"
|
||||||
#include "map/bitmapline.h"
|
#include "map/bitmapline.h"
|
||||||
#include "map/rectd.h"
|
#include "map/rectd.h"
|
||||||
#include "map/hillshading.h"
|
#include "map/hillshading.h"
|
||||||
#include "data/dem.h"
|
|
||||||
#include "style.h"
|
#include "style.h"
|
||||||
#include "lblfile.h"
|
#include "lblfile.h"
|
||||||
#include "rastertile.h"
|
#include "rastertile.h"
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
using namespace ENC;
|
using namespace ENC;
|
||||||
|
|
||||||
|
#define EPSILON 1e-6
|
||||||
#define TILE_SIZE 512
|
#define TILE_SIZE 512
|
||||||
|
|
||||||
Range ENCAtlas::zooms(IntendedUsage usage)
|
Range ENCAtlas::zooms(IntendedUsage usage)
|
||||||
@ -204,7 +205,8 @@ int ENCAtlas::zoomFit(const QSize &size, const RectC &rect)
|
|||||||
Transform t(transform(i));
|
Transform t(transform(i));
|
||||||
QRectF r(t.proj2img(pr.topLeft()), t.proj2img(pr.bottomRight()));
|
QRectF r(t.proj2img(pr.topLeft()), t.proj2img(pr.bottomRight()));
|
||||||
|
|
||||||
if (size.width() < r.width() || size.height() < r.height()) {
|
if (size.width() + EPSILON < r.width()
|
||||||
|
|| size.height() + EPSILON < r.height()) {
|
||||||
updateTransform();
|
updateTransform();
|
||||||
return _zoom;
|
return _zoom;
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
using namespace ENC;
|
using namespace ENC;
|
||||||
|
|
||||||
|
#define EPSILON 1e-6
|
||||||
#define TILE_SIZE 512
|
#define TILE_SIZE 512
|
||||||
|
|
||||||
static Range zooms(const RectC &bounds)
|
static Range zooms(const RectC &bounds)
|
||||||
@ -204,7 +205,8 @@ int ENCMap::zoomFit(const QSize &size, const RectC &rect)
|
|||||||
for (int i = _zooms.min() + 1; i <= _zooms.max(); i++) {
|
for (int i = _zooms.min() + 1; i <= _zooms.max(); i++) {
|
||||||
Transform t(transform(i));
|
Transform t(transform(i));
|
||||||
QRectF r(t.proj2img(pr.topLeft()), t.proj2img(pr.bottomRight()));
|
QRectF r(t.proj2img(pr.topLeft()), t.proj2img(pr.bottomRight()));
|
||||||
if (size.width() < r.width() || size.height() < r.height())
|
if (size.width() + EPSILON < r.width()
|
||||||
|
|| size.height() + EPSILON < r.height())
|
||||||
break;
|
break;
|
||||||
_zoom = i;
|
_zoom = i;
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
using namespace IMG;
|
using namespace IMG;
|
||||||
|
|
||||||
|
#define EPSILON 1e-6
|
||||||
#define TILE_SIZE 384
|
#define TILE_SIZE 384
|
||||||
|
|
||||||
static RectC limitBounds(const RectC &bounds, const Projection &proj)
|
static RectC limitBounds(const RectC &bounds, const Projection &proj)
|
||||||
@ -112,7 +113,8 @@ int IMGMap::zoomFit(const QSize &size, const RectC &rect)
|
|||||||
for (int i = zooms.min() + 1; i <= zooms.max(); i++) {
|
for (int i = zooms.min() + 1; i <= zooms.max(); i++) {
|
||||||
Transform t(transform(i));
|
Transform t(transform(i));
|
||||||
QRectF r(t.proj2img(pr.topLeft()), t.proj2img(pr.bottomRight()));
|
QRectF r(t.proj2img(pr.topLeft()), t.proj2img(pr.bottomRight()));
|
||||||
if (size.width() < r.width() || size.height() < r.height())
|
if (size.width() + EPSILON < r.width()
|
||||||
|
|| size.height() + EPSILON < r.height())
|
||||||
break;
|
break;
|
||||||
_zoom = i;
|
_zoom = i;
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <QCache>
|
#include <QCache>
|
||||||
#include "data/dem.h"
|
#include "common/dem.h"
|
||||||
#include "map/rectd.h"
|
#include "map/rectd.h"
|
||||||
#include "map/hillshading.h"
|
#include "map/hillshading.h"
|
||||||
#include "rastertile.h"
|
#include "rastertile.h"
|
||||||
|
@ -9,6 +9,8 @@
|
|||||||
|
|
||||||
using namespace Mapsforge;
|
using namespace Mapsforge;
|
||||||
|
|
||||||
|
#define EPSILON 1e-6
|
||||||
|
|
||||||
MapsforgeMap::MapsforgeMap(const QString &fileName, QObject *parent)
|
MapsforgeMap::MapsforgeMap(const QString &fileName, QObject *parent)
|
||||||
: Map(fileName, parent), _data(fileName), _zoom(0),
|
: Map(fileName, parent), _data(fileName), _zoom(0),
|
||||||
_projection(PCS::pcs(3857)), _tileRatio(1.0)
|
_projection(PCS::pcs(3857)), _tileRatio(1.0)
|
||||||
@ -51,7 +53,8 @@ int MapsforgeMap::zoomFit(const QSize &size, const RectC &rect)
|
|||||||
for (int i = _data.zooms().min() + 1; i <= _data.zooms().max(); i++) {
|
for (int i = _data.zooms().min() + 1; i <= _data.zooms().max(); i++) {
|
||||||
Transform t(transform(i));
|
Transform t(transform(i));
|
||||||
QRectF r(t.proj2img(pr.topLeft()), t.proj2img(pr.bottomRight()));
|
QRectF r(t.proj2img(pr.topLeft()), t.proj2img(pr.bottomRight()));
|
||||||
if (size.width() < r.width() || size.height() < r.height())
|
if (size.width() + EPSILON < r.width()
|
||||||
|
|| size.height() + EPSILON < r.height())
|
||||||
break;
|
break;
|
||||||
_zoom = i;
|
_zoom = i;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user