mirror of
https://github.com/tumic0/GPXSee.git
synced 2025-04-20 12:19:11 +02:00
Compare commits
13 Commits
59523f46ef
...
8ae8c3b0a3
Author | SHA1 | Date | |
---|---|---|---|
8ae8c3b0a3 | |||
733b018350 | |||
810e999068 | |||
|
6de21ff702 | ||
b13bac3af9 | |||
|
294490bb12 | ||
e1d1842fa6 | |||
|
ae4405ca9d | ||
f138323f5a | |||
|
18618aadb9 | ||
|
a7c698fc27 | ||
|
ddb072e1df | ||
091393ad5f |
@ -9,9 +9,9 @@ GPS log file formats.
|
|||||||
* User-definable online maps (OpenStreetMap/Google tiles, WMTS, WMS, TMS,
|
* User-definable online maps (OpenStreetMap/Google tiles, WMTS, WMS, TMS,
|
||||||
QuadTiles).
|
QuadTiles).
|
||||||
* Offline maps (MBTiles, OziExplorer maps, TrekBuddy maps/atlases,
|
* Offline maps (MBTiles, OziExplorer maps, TrekBuddy maps/atlases,
|
||||||
Garmin IMG/GMAP & JNX maps, TwoNav RMaps, GeoTIFF images, BSB charts, KMZ maps,
|
Garmin IMG/GMAP & JNX maps, TwoNav RMaps, GeoTIFF images, BSB charts,
|
||||||
AlpineQuest maps, Locus/OsmAnd/RMaps SQLite maps, Mapsforge vector maps,
|
ENC charts KMZ maps, AlpineQuest maps, Locus/OsmAnd/RMaps SQLite maps,
|
||||||
QCT maps, GEMF maps, Osmdroid SQLite maps, Orux maps,
|
Mapsforge vector maps, QCT maps, GEMF maps, Osmdroid SQLite maps, Orux maps,
|
||||||
ESRI World-File georeferenced images).
|
ESRI World-File georeferenced images).
|
||||||
* Elevation, speed, heart rate, cadence, power, temperature and gear ratio/shifts
|
* Elevation, speed, heart rate, cadence, power, temperature and gear ratio/shifts
|
||||||
graphs.
|
graphs.
|
||||||
@ -29,7 +29,7 @@ GPS log file formats.
|
|||||||
## Build
|
## Build
|
||||||
Build requirements:
|
Build requirements:
|
||||||
* Qt5 >= 5.11 or Qt6 >= 6.2 (Android builds require Qt6)
|
* Qt5 >= 5.11 or Qt6 >= 6.2 (Android builds require Qt6)
|
||||||
* C++11 or newer compiler (tested: msvc2017, gcc 7.5.0, clang/Apple LLVM version
|
* C++11 or newer compiler (tested: msvc2019, gcc 7.5.0, clang/Apple LLVM version
|
||||||
10.0.0)
|
10.0.0)
|
||||||
|
|
||||||
Build steps:
|
Build steps:
|
||||||
|
@ -1247,7 +1247,7 @@
|
|||||||
<message>
|
<message>
|
||||||
<location filename="../src/map/maplist.cpp" line="158"/>
|
<location filename="../src/map/maplist.cpp" line="158"/>
|
||||||
<source>Electronic Navigational Charts</source>
|
<source>Electronic Navigational Charts</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation>ENC námořní mapy</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/map/maplist.cpp" line="165"/>
|
<location filename="../src/map/maplist.cpp" line="165"/>
|
||||||
|
@ -1246,7 +1246,7 @@
|
|||||||
<message>
|
<message>
|
||||||
<location filename="../src/map/maplist.cpp" line="158"/>
|
<location filename="../src/map/maplist.cpp" line="158"/>
|
||||||
<source>Electronic Navigational Charts</source>
|
<source>Electronic Navigational Charts</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation>ENC-Seekarten</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/map/maplist.cpp" line="165"/>
|
<location filename="../src/map/maplist.cpp" line="165"/>
|
||||||
|
@ -1240,7 +1240,7 @@
|
|||||||
<message>
|
<message>
|
||||||
<location filename="../src/map/maplist.cpp" line="158"/>
|
<location filename="../src/map/maplist.cpp" line="158"/>
|
||||||
<source>Electronic Navigational Charts</source>
|
<source>Electronic Navigational Charts</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation>Elektronikus navigációs térképek</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/map/maplist.cpp" line="165"/>
|
<location filename="../src/map/maplist.cpp" line="165"/>
|
||||||
|
@ -1246,7 +1246,7 @@
|
|||||||
<message>
|
<message>
|
||||||
<location filename="../src/map/maplist.cpp" line="158"/>
|
<location filename="../src/map/maplist.cpp" line="158"/>
|
||||||
<source>Electronic Navigational Charts</source>
|
<source>Electronic Navigational Charts</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation>Elektroniska sjökort</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/map/maplist.cpp" line="165"/>
|
<location filename="../src/map/maplist.cpp" line="165"/>
|
||||||
|
@ -1245,7 +1245,7 @@
|
|||||||
<message>
|
<message>
|
||||||
<location filename="../src/map/maplist.cpp" line="158"/>
|
<location filename="../src/map/maplist.cpp" line="158"/>
|
||||||
<source>Electronic Navigational Charts</source>
|
<source>Electronic Navigational Charts</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation>Elektronik Seyir Haritaları</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/map/maplist.cpp" line="165"/>
|
<location filename="../src/map/maplist.cpp" line="165"/>
|
||||||
|
@ -181,13 +181,14 @@ Section "GPXSee" SEC_APP
|
|||||||
!insertmacro FILE_ASSOCIATION_ADD "qct" "QuickChart Map File" 24
|
!insertmacro FILE_ASSOCIATION_ADD "qct" "QuickChart Map File" 24
|
||||||
!insertmacro FILE_ASSOCIATION_ADD "trk" "TwoNav Track File" 25
|
!insertmacro FILE_ASSOCIATION_ADD "trk" "TwoNav Track File" 25
|
||||||
!insertmacro FILE_ASSOCIATION_ADD "gemf" "GEMF Map File" 26
|
!insertmacro FILE_ASSOCIATION_ADD "gemf" "GEMF Map File" 26
|
||||||
!insertmacro FILE_ASSOCIATION_ADD "kml" "Keyhole Markup Language" 27
|
!insertmacro FILE_ASSOCIATION_ADD "000" "IHO S-57 Electronic Navigation Chart" 27
|
||||||
!insertmacro FILE_ASSOCIATION_ADD "kmz" "KML geographic compressed data" 27
|
!insertmacro FILE_ASSOCIATION_ADD "kml" "Keyhole Markup Language" 28
|
||||||
!insertmacro FILE_ASSOCIATION_ADD "fit" "Flexible and Interoperable Data Transfer" 28
|
!insertmacro FILE_ASSOCIATION_ADD "kmz" "KML geographic compressed data" 28
|
||||||
!insertmacro FILE_ASSOCIATION_ADD "igc" "Flight Recorder Data Format" 29
|
!insertmacro FILE_ASSOCIATION_ADD "fit" "Flexible and Interoperable Data Transfer" 29
|
||||||
!insertmacro FILE_ASSOCIATION_ADD "nmea" "NMEA 0183 Data" 30
|
!insertmacro FILE_ASSOCIATION_ADD "igc" "Flight Recorder Data Format" 30
|
||||||
!insertmacro FILE_ASSOCIATION_ADD "plt" "OziExplorer Track File" 31
|
!insertmacro FILE_ASSOCIATION_ADD "nmea" "NMEA 0183 Data" 31
|
||||||
!insertmacro FILE_ASSOCIATION_ADD "rte" "OziExplorer Route File" 32
|
!insertmacro FILE_ASSOCIATION_ADD "plt" "OziExplorer Track File" 32
|
||||||
|
!insertmacro FILE_ASSOCIATION_ADD "rte" "OziExplorer Route File" 33
|
||||||
|
|
||||||
WriteRegStr HKCR "Applications\GPXSee.exe\shell\open\command" "" "$\"$INSTDIR\GPXSee.exe$\" $\"%1$\""
|
WriteRegStr HKCR "Applications\GPXSee.exe\shell\open\command" "" "$\"$INSTDIR\GPXSee.exe$\" $\"%1$\""
|
||||||
WriteRegStr HKCR ".gpx\OpenWithList" "GPXSee.exe" ""
|
WriteRegStr HKCR ".gpx\OpenWithList" "GPXSee.exe" ""
|
||||||
@ -237,6 +238,7 @@ Section "GPXSee" SEC_APP
|
|||||||
WriteRegStr HKCR ".qct\OpenWithList" "GPXSee.exe" ""
|
WriteRegStr HKCR ".qct\OpenWithList" "GPXSee.exe" ""
|
||||||
WriteRegStr HKCR ".trk\OpenWithList" "GPXSee.exe" ""
|
WriteRegStr HKCR ".trk\OpenWithList" "GPXSee.exe" ""
|
||||||
WriteRegStr HKCR ".gemf\OpenWithList" "GPXSee.exe" ""
|
WriteRegStr HKCR ".gemf\OpenWithList" "GPXSee.exe" ""
|
||||||
|
WriteRegStr HKCR ".000\OpenWithList" "GPXSee.exe" ""
|
||||||
|
|
||||||
System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v (0x08000000, 0, 0, 0)'
|
System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v (0x08000000, 0, 0, 0)'
|
||||||
|
|
||||||
@ -392,6 +394,7 @@ Section "Uninstall"
|
|||||||
!insertmacro FILE_ASSOCIATION_REMOVE "qct"
|
!insertmacro FILE_ASSOCIATION_REMOVE "qct"
|
||||||
!insertmacro FILE_ASSOCIATION_REMOVE "trk"
|
!insertmacro FILE_ASSOCIATION_REMOVE "trk"
|
||||||
!insertmacro FILE_ASSOCIATION_REMOVE "gemf"
|
!insertmacro FILE_ASSOCIATION_REMOVE "gemf"
|
||||||
|
!insertmacro FILE_ASSOCIATION_REMOVE "000"
|
||||||
|
|
||||||
DeleteRegValue HKCR ".gpx\OpenWithList" "GPXSee.exe"
|
DeleteRegValue HKCR ".gpx\OpenWithList" "GPXSee.exe"
|
||||||
DeleteRegValue HKCR ".tcx\OpenWithList" "GPXSee.exe"
|
DeleteRegValue HKCR ".tcx\OpenWithList" "GPXSee.exe"
|
||||||
@ -440,6 +443,7 @@ Section "Uninstall"
|
|||||||
DeleteRegValue HKCR ".qct\OpenWithList" "GPXSee.exe"
|
DeleteRegValue HKCR ".qct\OpenWithList" "GPXSee.exe"
|
||||||
DeleteRegValue HKCR ".trk\OpenWithList" "GPXSee.exe"
|
DeleteRegValue HKCR ".trk\OpenWithList" "GPXSee.exe"
|
||||||
DeleteRegValue HKCR ".gemf\OpenWithList" "GPXSee.exe"
|
DeleteRegValue HKCR ".gemf\OpenWithList" "GPXSee.exe"
|
||||||
|
DeleteRegValue HKCR ".000\OpenWithList" "GPXSee.exe"
|
||||||
DeleteRegKey HKCR "Applications\GPXSee.exe"
|
DeleteRegKey HKCR "Applications\GPXSee.exe"
|
||||||
|
|
||||||
System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v (0x08000000, 0, 0, 0)'
|
System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v (0x08000000, 0, 0, 0)'
|
||||||
|
@ -319,10 +319,5 @@ bool ISO8211::readRecord(QFile &file, Record &record)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (file.pos() != pos + len) {
|
|
||||||
_errorString = "Record format error";
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -463,6 +463,9 @@ MapData::Poly *MapData::polyObject(const ISO8211::Record &r,
|
|||||||
bool MapData::processRecord(const ISO8211::Record &record,
|
bool MapData::processRecord(const ISO8211::Record &record,
|
||||||
QVector<ISO8211::Record> &rv, uint &COMF, QString &name)
|
QVector<ISO8211::Record> &rv, uint &COMF, QString &name)
|
||||||
{
|
{
|
||||||
|
if (record.size() < 2)
|
||||||
|
return false;
|
||||||
|
|
||||||
const ISO8211::Field &f = record.at(1);
|
const ISO8211::Field &f = record.at(1);
|
||||||
const QByteArray &ba = f.tag();
|
const QByteArray &ba = f.tag();
|
||||||
|
|
||||||
@ -485,6 +488,9 @@ bool MapData::processRecord(const ISO8211::Record &record,
|
|||||||
QVector<ISO8211::Record> &fe, RecordMap &vi, RecordMap &vc, RecordMap &ve,
|
QVector<ISO8211::Record> &fe, RecordMap &vi, RecordMap &vc, RecordMap &ve,
|
||||||
RecordMap &vf, uint &COMF, uint &SOMF)
|
RecordMap &vf, uint &COMF, uint &SOMF)
|
||||||
{
|
{
|
||||||
|
if (record.size() < 2)
|
||||||
|
return false;
|
||||||
|
|
||||||
const ISO8211::Field &f = record.at(1);
|
const ISO8211::Field &f = record.at(1);
|
||||||
const QByteArray &ba = f.tag();
|
const QByteArray &ba = f.tag();
|
||||||
|
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
#define ENC_MAPDATA_H
|
#define ENC_MAPDATA_H
|
||||||
|
|
||||||
#include <climits>
|
#include <climits>
|
||||||
#include <QPainterPath>
|
|
||||||
#include "common/rectc.h"
|
#include "common/rectc.h"
|
||||||
#include "common/rtree.h"
|
#include "common/rtree.h"
|
||||||
#include "common/polygon.h"
|
#include "common/polygon.h"
|
||||||
|
@ -200,4 +200,6 @@ void RasterTile::render()
|
|||||||
//painter.setPen(Qt::red);
|
//painter.setPen(Qt::red);
|
||||||
//painter.setBrush(Qt::NoBrush);
|
//painter.setBrush(Qt::NoBrush);
|
||||||
//painter.drawRect(QRect(_rect.topLeft(), _pixmap.size()));
|
//painter.drawRect(QRect(_rect.topLeft(), _pixmap.size()));
|
||||||
|
|
||||||
|
_valid = true;
|
||||||
}
|
}
|
||||||
|
@ -18,11 +18,12 @@ public:
|
|||||||
const QList<MapData::Poly*> &polygons, const QList<MapData::Point*> &points)
|
const QList<MapData::Poly*> &polygons, const QList<MapData::Point*> &points)
|
||||||
: _proj(proj), _transform(transform), _zoom(zoom), _rect(rect),
|
: _proj(proj), _transform(transform), _zoom(zoom), _rect(rect),
|
||||||
_ratio(ratio), _pixmap(rect.width() * ratio, rect.height() * ratio),
|
_ratio(ratio), _pixmap(rect.width() * ratio, rect.height() * ratio),
|
||||||
_lines(lines), _polygons(polygons), _points(points) {}
|
_lines(lines), _polygons(polygons), _points(points), _valid(false) {}
|
||||||
|
|
||||||
int zoom() const {return _zoom;}
|
int zoom() const {return _zoom;}
|
||||||
QPoint xy() const {return _rect.topLeft();}
|
QPoint xy() const {return _rect.topLeft();}
|
||||||
const QPixmap &pixmap() const {return _pixmap;}
|
const QPixmap &pixmap() const {return _pixmap;}
|
||||||
|
bool isValid() const {return _valid;}
|
||||||
|
|
||||||
void render();
|
void render();
|
||||||
|
|
||||||
@ -48,6 +49,7 @@ private:
|
|||||||
QList<MapData::Line*> _lines;
|
QList<MapData::Line*> _lines;
|
||||||
QList<MapData::Poly*> _polygons;
|
QList<MapData::Poly*> _polygons;
|
||||||
QList<MapData::Point*> _points;
|
QList<MapData::Point*> _points;
|
||||||
|
bool _valid;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <QPixmapCache>
|
#include <QPixmapCache>
|
||||||
#include <QtConcurrent>
|
|
||||||
#include "common/range.h"
|
#include "common/range.h"
|
||||||
#include "common/wgs84.h"
|
#include "common/wgs84.h"
|
||||||
#include "ENC/rastertile.h"
|
|
||||||
#include "rectd.h"
|
#include "rectd.h"
|
||||||
#include "pcs.h"
|
#include "pcs.h"
|
||||||
#include "encmap.h"
|
#include "encmap.h"
|
||||||
@ -58,6 +56,8 @@ int ENCMap::zoomFit(const QSize &size, const RectC &rect)
|
|||||||
|
|
||||||
int ENCMap::zoomIn()
|
int ENCMap::zoomIn()
|
||||||
{
|
{
|
||||||
|
cancelJobs();
|
||||||
|
|
||||||
_zoom = qMin(_zoom + 1, ZOOMS.max());
|
_zoom = qMin(_zoom + 1, ZOOMS.max());
|
||||||
updateTransform();
|
updateTransform();
|
||||||
return _zoom;
|
return _zoom;
|
||||||
@ -65,6 +65,8 @@ int ENCMap::zoomIn()
|
|||||||
|
|
||||||
int ENCMap::zoomOut()
|
int ENCMap::zoomOut()
|
||||||
{
|
{
|
||||||
|
cancelJobs();
|
||||||
|
|
||||||
_zoom = qMax(_zoom - 1, ZOOMS.min());
|
_zoom = qMax(_zoom - 1, ZOOMS.min());
|
||||||
updateTransform();
|
updateTransform();
|
||||||
return _zoom;
|
return _zoom;
|
||||||
@ -96,6 +98,55 @@ void ENCMap::updateTransform()
|
|||||||
_transform.proj2img(prect.bottomRight()));
|
_transform.proj2img(prect.bottomRight()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ENCMap::isRunning(int zoom, const QPoint &xy) const
|
||||||
|
{
|
||||||
|
for (int i = 0; i < _jobs.size(); i++) {
|
||||||
|
const QList<ENC::RasterTile> &tiles = _jobs.at(i)->tiles();
|
||||||
|
for (int j = 0; j < tiles.size(); j++) {
|
||||||
|
const ENC::RasterTile &mt = tiles.at(j);
|
||||||
|
if (mt.zoom() == zoom && mt.xy() == xy)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ENCMap::runJob(ENCMapJob *job)
|
||||||
|
{
|
||||||
|
_jobs.append(job);
|
||||||
|
|
||||||
|
connect(job, &ENCMapJob::finished, this, &ENCMap::jobFinished);
|
||||||
|
job->run();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ENCMap::removeJob(ENCMapJob *job)
|
||||||
|
{
|
||||||
|
_jobs.removeOne(job);
|
||||||
|
job->deleteLater();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ENCMap::jobFinished(ENCMapJob *job)
|
||||||
|
{
|
||||||
|
const QList<ENC::RasterTile> &tiles = job->tiles();
|
||||||
|
|
||||||
|
for (int i = 0; i < tiles.size(); i++) {
|
||||||
|
const ENC::RasterTile &mt = tiles.at(i);
|
||||||
|
if (mt.isValid())
|
||||||
|
QPixmapCache::insert(key(mt.zoom(), mt.xy()), mt.pixmap());
|
||||||
|
}
|
||||||
|
|
||||||
|
removeJob(job);
|
||||||
|
|
||||||
|
emit tilesLoaded();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ENCMap::cancelJobs()
|
||||||
|
{
|
||||||
|
for (int i = 0; i < _jobs.size(); i++)
|
||||||
|
_jobs.at(i)->cancel();
|
||||||
|
}
|
||||||
|
|
||||||
QString ENCMap::key(int zoom, const QPoint &xy) const
|
QString ENCMap::key(int zoom, const QPoint &xy) const
|
||||||
{
|
{
|
||||||
return path() + "-" + QString::number(zoom) + "_"
|
return path() + "-" + QString::number(zoom) + "_"
|
||||||
@ -116,6 +167,8 @@ void ENCMap::draw(QPainter *painter, const QRectF &rect, Flags flags)
|
|||||||
for (int i = 0; i < width; i++) {
|
for (int i = 0; i < width; i++) {
|
||||||
for (int j = 0; j < height; j++) {
|
for (int j = 0; j < height; j++) {
|
||||||
QPoint ttl(tl.x() + i * TILE_SIZE, tl.y() + j * TILE_SIZE);
|
QPoint ttl(tl.x() + i * TILE_SIZE, tl.y() + j * TILE_SIZE);
|
||||||
|
if (isRunning(_zoom, ttl))
|
||||||
|
continue;
|
||||||
|
|
||||||
QPixmap pm;
|
QPixmap pm;
|
||||||
if (QPixmapCache::find(key(_zoom, ttl), &pm))
|
if (QPixmapCache::find(key(_zoom, ttl), &pm))
|
||||||
@ -149,14 +202,19 @@ void ENCMap::draw(QPainter *painter, const QRectF &rect, Flags flags)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QFuture<void> future = QtConcurrent::map(tiles, &RasterTile::render);
|
if (!tiles.isEmpty()) {
|
||||||
future.waitForFinished();
|
if (flags & Map::Block) {
|
||||||
|
QFuture<void> future = QtConcurrent::map(tiles, &RasterTile::render);
|
||||||
|
future.waitForFinished();
|
||||||
|
|
||||||
for (int i = 0; i < tiles.size(); i++) {
|
for (int i = 0; i < tiles.size(); i++) {
|
||||||
const RasterTile &mt = tiles.at(i);
|
const RasterTile &mt = tiles.at(i);
|
||||||
const QPixmap &pm = mt.pixmap();
|
const QPixmap &pm = mt.pixmap();
|
||||||
painter->drawPixmap(mt.xy(), pm);
|
painter->drawPixmap(mt.xy(), pm);
|
||||||
QPixmapCache::insert(key(mt.zoom(), mt.xy()), pm);
|
QPixmapCache::insert(key(mt.zoom(), mt.xy()), pm);
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
runJob(new ENCMapJob(tiles));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,12 +1,42 @@
|
|||||||
#ifndef ENCMAP_H
|
#ifndef ENCMAP_H
|
||||||
#define ENCMAP_H
|
#define ENCMAP_H
|
||||||
|
|
||||||
|
#include <QtConcurrent>
|
||||||
#include "map.h"
|
#include "map.h"
|
||||||
#include "projection.h"
|
#include "projection.h"
|
||||||
#include "transform.h"
|
#include "transform.h"
|
||||||
#include "ENC/mapdata.h"
|
#include "ENC/mapdata.h"
|
||||||
|
#include "ENC/rastertile.h"
|
||||||
|
|
||||||
class QFile;
|
class ENCMapJob : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
ENCMapJob(const QList<ENC::RasterTile> &tiles)
|
||||||
|
: _tiles(tiles) {}
|
||||||
|
|
||||||
|
void run()
|
||||||
|
{
|
||||||
|
connect(&_watcher, &QFutureWatcher<void>::finished, this,
|
||||||
|
&ENCMapJob::handleFinished);
|
||||||
|
_future = QtConcurrent::map(_tiles, &ENC::RasterTile::render);
|
||||||
|
_watcher.setFuture(_future);
|
||||||
|
}
|
||||||
|
void cancel() {_future.cancel();}
|
||||||
|
const QList<ENC::RasterTile> &tiles() const {return _tiles;}
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void finished(ENCMapJob *job);
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void handleFinished() {emit finished(this);}
|
||||||
|
|
||||||
|
private:
|
||||||
|
QFutureWatcher<void> _watcher;
|
||||||
|
QFuture<void> _future;
|
||||||
|
QList<ENC::RasterTile> _tiles;
|
||||||
|
};
|
||||||
|
|
||||||
class ENCMap : public Map
|
class ENCMap : public Map
|
||||||
{
|
{
|
||||||
@ -43,9 +73,16 @@ public:
|
|||||||
|
|
||||||
static Map *create(const QString &path, const Projection &, bool *isMap);
|
static Map *create(const QString &path, const Projection &, bool *isMap);
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void jobFinished(ENCMapJob *job);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Transform transform(int zoom) const;
|
Transform transform(int zoom) const;
|
||||||
void updateTransform();
|
void updateTransform();
|
||||||
|
bool isRunning(int zoom, const QPoint &xy) const;
|
||||||
|
void runJob(ENCMapJob *job);
|
||||||
|
void removeJob(ENCMapJob *job);
|
||||||
|
void cancelJobs();
|
||||||
QString key(int zoom, const QPoint &xy) const;
|
QString key(int zoom, const QPoint &xy) const;
|
||||||
|
|
||||||
ENC::MapData _data;
|
ENC::MapData _data;
|
||||||
@ -56,6 +93,8 @@ private:
|
|||||||
QRectF _bounds;
|
QRectF _bounds;
|
||||||
int _zoom;
|
int _zoom;
|
||||||
|
|
||||||
|
QList<ENCMapJob*> _jobs;
|
||||||
|
|
||||||
bool _valid;
|
bool _valid;
|
||||||
QString _errorString;
|
QString _errorString;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user