mirror of
https://github.com/tumic0/GPXSee.git
synced 2025-07-23 23:24:24 +02:00
Compare commits
27 Commits
829d85a70a
...
13.14
Author | SHA1 | Date | |
---|---|---|---|
a1e10c395a | |||
c97561add4 | |||
d994fae4ce | |||
789606cf86 | |||
542b3e920e | |||
0248ecb254 | |||
acc9d07a22 | |||
7860ce8acc | |||
2541797e7d | |||
e13d6dfc4b | |||
9e1e960c93 | |||
d18537733f | |||
c6a37594ae | |||
bcfd51276f | |||
aed09a0e6a | |||
867b70d159 | |||
0b05079a49 | |||
ca71eb9d93 | |||
4a82055867 | |||
f9b4cd991f | |||
14dc2af877 | |||
9380f31022 | |||
5f76427ba4 | |||
d4b731aeaf | |||
3d27b4ea00 | |||
502a7b4129 | |||
6f32c73684 |
@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<map xmlns="http://www.gpxsee.org/map/1.4">
|
||||
<name>4UMaps</name>
|
||||
<url>https://tileserver.4umaps.com/$z/$x/$y.png</url>
|
||||
<zoom min="2" max="15"/>
|
||||
<bounds bottom="-65"/>
|
||||
<copyright>Map data: © OpenStreetMap contributors (ODbL) | Rendering: © 4UMaps.eu</copyright>
|
||||
</map>
|
6
data/maps/mtbmap-cz.xml
Normal file
6
data/maps/mtbmap-cz.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<map xmlns="http://www.gpxsee.org/map/1.4">
|
||||
<name>mtbmap.cz</name>
|
||||
<url>https://tile.mtbmap.cz/mtbmap_tiles/$z/$x/$y.png</url>
|
||||
<copyright>Map data: OpenStreetMap, USGS | Rendering: Martin Tesař</copyright>
|
||||
</map>
|
@ -134,7 +134,6 @@ HEADERS += src/common/config.h \
|
||||
src/map/encjob.h \
|
||||
src/map/encmap.h \
|
||||
src/map/ENC/iso8211.h \
|
||||
src/map/encstyle.h \
|
||||
src/map/gemfmap.h \
|
||||
src/map/gmifile.h \
|
||||
src/map/oruxmap.h \
|
||||
@ -350,7 +349,6 @@ SOURCES += src/main.cpp \
|
||||
src/map/encatlas.cpp \
|
||||
src/map/encmap.cpp \
|
||||
src/map/ENC/iso8211.cpp \
|
||||
src/map/encstyle.cpp \
|
||||
src/map/gemfmap.cpp \
|
||||
src/map/gmifile.cpp \
|
||||
src/map/oruxmap.cpp \
|
||||
|
@ -111,5 +111,6 @@
|
||||
<mimetype>application/vnd.iho.s57-data</mimetype>
|
||||
<mimetype>application/vnd.iho.s57-catalogue</mimetype>
|
||||
<mimetype>application/vnd.gpsdump.wpt</mimetype>
|
||||
<mimetype>application/vnd.gpstuner.gmi</mimetype>
|
||||
</mimetypes>
|
||||
</component>
|
||||
|
@ -16,4 +16,4 @@ Icon=gpxsee
|
||||
Terminal=false
|
||||
Type=Application
|
||||
Categories=Graphics;Viewer;Education;Geography;Maps;Sports;Qt
|
||||
MimeType=application/gpx+xml;application/vnd.garmin.tcx+xml;application/vnd.ant.fit;application/vnd.google-earth.kml+xml;application/vnd.fai.igc;application/vnd.nmea.nmea;application/vnd.oziexplorer.plt;application/vnd.oziexplorer.rte;application/vnd.oziexplorer.wpt;application/vnd.groundspeak.loc+xml;application/vnd.sigma.slf+xml;application/geo+json;application/vnd.naviter.seeyou.cup;application/vnd.garmin.gpi;application/vnd.suunto.sml+xml;image/jpeg;text/csv;application/vnd.garmin.img;application/vnd.garmin.jnx;application/vnd.garmin.gmap+xml;image/vnd.maptech.kap;application/vnd.oziexplorer.map;application/vnd.mapbox.mbtiles;application/vnd.twonav.rmap;application/vnd.trekbuddy.tba;application/vnd.gpxsee.map+xml;application/x-tar;image/tiff;application/vnd.google-earth.kmz;application/vnd.alpinequest.aqm;application/vnd.cgtk.gemf;application/vnd.rmaps.sqlite;application/vnd.osmdroid.sqlite;application/vnd.mapsforge.map;application/vnd.tomtom.ov2;application/vnd.tomtom.itn;application/vnd.esri.wld;application/vnd.onmove.omd;application/vnd.onmove.ghp;application/vnd.memory-map.qct;application/vnd.twonav.trk;application/vnd.twonav.rte;application/vnd.twonav.wpt;application/vnd.orux.map+xml;application/vnd.iho.s57-data;application/vnd.iho.s57-catalogue;application/vnd.gpsdump.wpt
|
||||
MimeType=application/gpx+xml;application/vnd.garmin.tcx+xml;application/vnd.ant.fit;application/vnd.google-earth.kml+xml;application/vnd.fai.igc;application/vnd.nmea.nmea;application/vnd.oziexplorer.plt;application/vnd.oziexplorer.rte;application/vnd.oziexplorer.wpt;application/vnd.groundspeak.loc+xml;application/vnd.sigma.slf+xml;application/geo+json;application/vnd.naviter.seeyou.cup;application/vnd.garmin.gpi;application/vnd.suunto.sml+xml;image/jpeg;text/csv;application/vnd.garmin.img;application/vnd.garmin.jnx;application/vnd.garmin.gmap+xml;image/vnd.maptech.kap;application/vnd.oziexplorer.map;application/vnd.mapbox.mbtiles;application/vnd.twonav.rmap;application/vnd.trekbuddy.tba;application/vnd.gpxsee.map+xml;application/x-tar;image/tiff;application/vnd.google-earth.kmz;application/vnd.alpinequest.aqm;application/vnd.cgtk.gemf;application/vnd.rmaps.sqlite;application/vnd.osmdroid.sqlite;application/vnd.mapsforge.map;application/vnd.tomtom.ov2;application/vnd.tomtom.itn;application/vnd.esri.wld;application/vnd.onmove.omd;application/vnd.onmove.ghp;application/vnd.memory-map.qct;application/vnd.twonav.trk;application/vnd.twonav.rte;application/vnd.twonav.wpt;application/vnd.orux.map+xml;application/vnd.iho.s57-data;application/vnd.iho.s57-catalogue;application/vnd.gpsdump.wpt;application/vnd.gpstuner.gmi
|
||||
|
@ -363,4 +363,14 @@
|
||||
<glob pattern="*.031"/>
|
||||
</mime-type>
|
||||
|
||||
<mime-type type="application/vnd.gpstuner.gmi">
|
||||
<comment>GPS Tuner Map Calibration File</comment>
|
||||
<sub-class-of type="text/plain"/>
|
||||
<generic-icon name="text/plain"/>
|
||||
<magic>
|
||||
<match type="string" offset="0" value="Map Calibration data file"/>
|
||||
</magic>
|
||||
<glob pattern="*.gmi"/>
|
||||
</mime-type>
|
||||
|
||||
</mime-info>
|
||||
|
@ -417,6 +417,22 @@
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>Viewer</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>CFBundleTypeExtensions</key>
|
||||
<array>
|
||||
<string>gmi</string>
|
||||
</array>
|
||||
<key>CFBundleTypeMIMETypes</key>
|
||||
<array>
|
||||
<string>application/vnd.gpstuner.gmi</string>
|
||||
</array>
|
||||
<key>CFBundleTypeIconFile</key>
|
||||
<string>icons/map.icns</string>
|
||||
<key>CFBundleTypeName</key>
|
||||
<string>GPS Tuner Map Calibration File</string>
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>Viewer</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>CFBundleTypeExtensions</key>
|
||||
<array>
|
||||
@ -1252,6 +1268,29 @@
|
||||
<string>application/vnd.oziexplorer.map</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>UTTypeIdentifier</key>
|
||||
<string>com.gpstuner.gmi</string>
|
||||
<key>UTTypeReferenceURL</key>
|
||||
<string>https://github.com/tumic0/GPXSee/blob/master/src/map/gmifile.cpp</string>
|
||||
<key>UTTypeDescription</key>
|
||||
<string>GPS Tuner Map Calibration File</string>
|
||||
<key>UTTypeIconFile</key>
|
||||
<string>icons/map.icns</string>
|
||||
<key>UTTypeConformsTo</key>
|
||||
<array>
|
||||
<string>public.data</string>
|
||||
</array>
|
||||
<key>UTTypeTagSpecification</key>
|
||||
<dict>
|
||||
<key>public.filename-extension</key>
|
||||
<array>
|
||||
<string>gmi</string>
|
||||
</array>
|
||||
<key>public.mime-type</key>
|
||||
<string>application/vnd.gpstuner.gmi</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>UTTypeIdentifier</key>
|
||||
<string>com.mapbox.mbtiles</string>
|
||||
|
@ -163,6 +163,7 @@ Section "GPXSee" SEC_APP
|
||||
!insertmacro FILE_ASSOCIATION_ADD "kap" "BSB Nautical Chart" 10
|
||||
!insertmacro FILE_ASSOCIATION_ADD "gpx" "GPS Exchange Format" 11
|
||||
!insertmacro FILE_ASSOCIATION_ADD "map" "OziExplorer Map File" 12
|
||||
!insertmacro FILE_ASSOCIATION_ADD "gmi" "GPS Tuner Map Calibration File" 12
|
||||
!insertmacro FILE_ASSOCIATION_ADD "mbtiles" "MBTiles Map File" 13
|
||||
!insertmacro FILE_ASSOCIATION_ADD "rmap" "TwoNav Raster Map File" 14
|
||||
!insertmacro FILE_ASSOCIATION_ADD "tba" "TrekBuddy Atlas" 15
|
||||
@ -218,6 +219,7 @@ Section "GPXSee" SEC_APP
|
||||
WriteRegStr HKCR ".jnx\OpenWithList" "GPXSee.exe" ""
|
||||
WriteRegStr HKCR ".kap\OpenWithList" "GPXSee.exe" ""
|
||||
WriteRegStr HKCR ".map\OpenWithList" "GPXSee.exe" ""
|
||||
WriteRegStr HKCR ".gmi\OpenWithList" "GPXSee.exe" ""
|
||||
WriteRegStr HKCR ".mbtiles\OpenWithList" "GPXSee.exe" ""
|
||||
WriteRegStr HKCR ".rmap\OpenWithList" "GPXSee.exe" ""
|
||||
WriteRegStr HKCR ".rtmap\OpenWithList" "GPXSee.exe" ""
|
||||
@ -384,6 +386,7 @@ Section "Uninstall"
|
||||
!insertmacro FILE_ASSOCIATION_REMOVE "jnx"
|
||||
!insertmacro FILE_ASSOCIATION_REMOVE "kap"
|
||||
!insertmacro FILE_ASSOCIATION_REMOVE "map"
|
||||
!insertmacro FILE_ASSOCIATION_REMOVE "gmi"
|
||||
!insertmacro FILE_ASSOCIATION_REMOVE "mbtiles"
|
||||
!insertmacro FILE_ASSOCIATION_REMOVE "rmap"
|
||||
!insertmacro FILE_ASSOCIATION_REMOVE "tba"
|
||||
@ -431,6 +434,7 @@ Section "Uninstall"
|
||||
DeleteRegValue HKCR ".jnx\OpenWithList" "GPXSee.exe"
|
||||
DeleteRegValue HKCR ".kap\OpenWithList" "GPXSee.exe"
|
||||
DeleteRegValue HKCR ".map\OpenWithList" "GPXSee.exe"
|
||||
DeleteRegValue HKCR ".gmi\OpenWithList" "GPXSee.exe"
|
||||
DeleteRegValue HKCR ".mbtiles\OpenWithList" "GPXSee.exe"
|
||||
DeleteRegValue HKCR ".rmap\OpenWithList" "GPXSee.exe"
|
||||
DeleteRegValue HKCR ".rtmap\OpenWithList" "GPXSee.exe"
|
||||
|
@ -1,7 +1,6 @@
|
||||
#include <cmath>
|
||||
#include <QLocale>
|
||||
#include "data/data.h"
|
||||
#include "tooltip.h"
|
||||
#include "elevationgraphitem.h"
|
||||
#include "elevationgraph.h"
|
||||
|
||||
|
@ -5,8 +5,10 @@
|
||||
#include <QFileInfo>
|
||||
#include <QApplication>
|
||||
#include <QFontMetrics>
|
||||
#include "common/util.h"
|
||||
#include "fileselectwidget.h"
|
||||
#ifdef Q_OS_ANDROID
|
||||
#include "common/util.h"
|
||||
#endif // Q_OS_ANDROID
|
||||
|
||||
|
||||
FileSelectWidget::FileSelectWidget(QWidget *parent) : QWidget(parent)
|
||||
|
@ -16,7 +16,6 @@
|
||||
#include "infoitem.h"
|
||||
#include "griditem.h"
|
||||
#include "graphitem.h"
|
||||
#include "pathitem.h"
|
||||
#include "format.h"
|
||||
#include "graphicsscene.h"
|
||||
#include "graphview.h"
|
||||
|
@ -52,11 +52,13 @@
|
||||
#include "graphtab.h"
|
||||
#include "graphitem.h"
|
||||
#include "pathitem.h"
|
||||
#include "mapitem.h"
|
||||
#include "mapaction.h"
|
||||
#include "poiaction.h"
|
||||
#include "navigationwidget.h"
|
||||
#include "gui.h"
|
||||
#ifdef Q_OS_ANDROID
|
||||
#include "common/util.h"
|
||||
#include "navigationwidget.h"
|
||||
#endif // Q_OS_ANDROID
|
||||
|
||||
|
||||
#define MAX_RECENT_FILES 10
|
||||
|
@ -4,9 +4,11 @@
|
||||
#include <QGraphicsSceneMouseEvent>
|
||||
#include "map/map.h"
|
||||
#include "mapaction.h"
|
||||
#include "popup.h"
|
||||
#include "tooltip.h"
|
||||
#include "mapitem.h"
|
||||
#ifdef Q_OS_ANDROID
|
||||
#include "popup.h"
|
||||
#endif // Q_OS_ANDROID
|
||||
|
||||
|
||||
static void growLeft(Map *map, const Coordinates &c, QRectF &rect)
|
||||
|
@ -2,12 +2,6 @@
|
||||
#include <QLineEdit>
|
||||
#include "pluginparameters.h"
|
||||
|
||||
static const QMap<QString, QStringList> pluginParams = {
|
||||
{"nmea", {"nmea.source", "nmea.baudrate"}},
|
||||
{"serialnmea", {"serialnmea.serial_port"}},
|
||||
{"geoclue2", {"desktopId"}}
|
||||
};
|
||||
|
||||
static void deleteLayout(QLayout *layout)
|
||||
{
|
||||
if (!layout)
|
||||
@ -32,6 +26,12 @@ PluginParameters::PluginParameters(const QString &plugin,
|
||||
|
||||
void PluginParameters::setPlugin(const QString &plugin)
|
||||
{
|
||||
static const QMap<QString, QStringList> pluginParams = {
|
||||
{"nmea", {"nmea.source", "nmea.baudrate"}},
|
||||
{"serialnmea", {"serialnmea.serial_port"}},
|
||||
{"geoclue2", {"desktopId"}}
|
||||
};
|
||||
|
||||
saveParameters();
|
||||
|
||||
QStringList params = pluginParams.value(plugin);
|
||||
|
@ -4,7 +4,6 @@
|
||||
#include <QPageSize>
|
||||
#include <QGeoPositionInfoSource>
|
||||
#include "common/config.h"
|
||||
#include "common/util.h"
|
||||
#include "data/graph.h"
|
||||
#include "format.h"
|
||||
#include "units.h"
|
||||
|
@ -1,6 +1,5 @@
|
||||
#include <QLocale>
|
||||
#include "data/data.h"
|
||||
#include "tooltip.h"
|
||||
#include "format.h"
|
||||
#include "speedgraphitem.h"
|
||||
#include "speedgraph.h"
|
||||
|
@ -1,5 +1,4 @@
|
||||
#include <QFile>
|
||||
#include <QFileInfo>
|
||||
#include <QNetworkRequest>
|
||||
#include <QDir>
|
||||
#include <QTimerEvent>
|
||||
@ -56,6 +55,7 @@ Authorization::Authorization(const QString &username, const QString &password)
|
||||
_header = HTTPHeader("Authorization", "Basic " + data);
|
||||
}
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
|
||||
NetworkTimeout::NetworkTimeout(int timeout, QNetworkReply *reply)
|
||||
: QObject(reply), _timeout(timeout)
|
||||
{
|
||||
@ -77,6 +77,7 @@ void NetworkTimeout::timerEvent(QTimerEvent *ev)
|
||||
reply->abort();
|
||||
_timer.stop();
|
||||
}
|
||||
#endif // QT 5.15
|
||||
|
||||
|
||||
QNetworkAccessManager *Downloader::_manager = 0;
|
||||
@ -104,11 +105,15 @@ bool Downloader::doDownload(const Download &dl, const QList<HTTPHeader> &headers
|
||||
request.setAttribute(ATTR_REDIRECT_POLICY,
|
||||
QNetworkRequest::NoLessSafeRedirectPolicy);
|
||||
request.setAttribute(ATTR_HTTP2_ALLOWED, QVariant(_http2));
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
|
||||
request.setTransferTimeout(_timeout * 1000);
|
||||
#endif // QT 5.15
|
||||
|
||||
for (int i = 0; i < headers.size(); i++) {
|
||||
const HTTPHeader &hdr = headers.at(i);
|
||||
request.setRawHeader(hdr.key(), hdr.value());
|
||||
if (hdr.key() == "User-Agent")
|
||||
// QByteArray::compare() not available in Qt < 5.12
|
||||
if (!QString(hdr.key()).compare("User-Agent", Qt::CaseInsensitive))
|
||||
userAgent = true;
|
||||
}
|
||||
if (!userAgent)
|
||||
@ -128,9 +133,9 @@ bool Downloader::doDownload(const Download &dl, const QList<HTTPHeader> &headers
|
||||
_currentDownloads.insert(url, file);
|
||||
|
||||
if (reply->isRunning()) {
|
||||
/* Starting with Qt 5.15 this can be replaced by
|
||||
QNetworkRequest::setTransferTimeout() */
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
|
||||
new NetworkTimeout(_timeout, reply);
|
||||
#endif // QT 5.15
|
||||
connect(reply, &QIODevice::readyRead, this, &Downloader::emitReadReady);
|
||||
connect(reply, &QNetworkReply::finished, this, &Downloader::emitFinished);
|
||||
} else {
|
||||
|
@ -3,7 +3,9 @@
|
||||
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QNetworkReply>
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
|
||||
#include <QBasicTimer>
|
||||
#endif // QT 5.15
|
||||
#include <QUrl>
|
||||
#include <QList>
|
||||
#include <QHash>
|
||||
@ -39,6 +41,7 @@ private:
|
||||
HTTPHeader _header;
|
||||
};
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
|
||||
class NetworkTimeout : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -55,6 +58,7 @@ private:
|
||||
QBasicTimer _timer;
|
||||
int _timeout;
|
||||
};
|
||||
#endif // QT 5.15
|
||||
|
||||
class Downloader : public QObject
|
||||
{
|
||||
@ -79,8 +83,6 @@ private slots:
|
||||
void emitReadReady();
|
||||
|
||||
private:
|
||||
class ReplyTimeout;
|
||||
|
||||
void insertError(const QUrl &url, QNetworkReply::NetworkError error);
|
||||
bool doDownload(const Download &dl, const QList<HTTPHeader> &headers);
|
||||
void downloadFinished(QNetworkReply *reply);
|
||||
|
@ -1,48 +1,67 @@
|
||||
#include <QTextCodec>
|
||||
#include "textcodec.h"
|
||||
|
||||
/* When Qt is compiled with ICU support, QTextCodec::codecForName() is very
|
||||
slow due to broken codec name caching (the function does dozens of
|
||||
comparisons and only then asks the cache...), so we use our own map. */
|
||||
static QMap<int, QTextCodec *> initCodecs()
|
||||
static QTextCodec *codec(int mib)
|
||||
{
|
||||
QMap<int, QTextCodec *> map;
|
||||
QTextCodec *c = QTextCodec::codecForMib(mib);
|
||||
if (!c)
|
||||
qWarning("MIB-%d: No such QTextCodec, using UTF-8", mib);
|
||||
|
||||
map.insert(65001, 0);
|
||||
map.insert(874, QTextCodec::codecForName("Windows-874"));
|
||||
map.insert(932, QTextCodec::codecForName("Shift-JIS"));
|
||||
map.insert(936, QTextCodec::codecForName("GB18030"));
|
||||
map.insert(949, QTextCodec::codecForName("EUC-KR"));
|
||||
map.insert(950, QTextCodec::codecForName("Big5"));
|
||||
map.insert(1250, QTextCodec::codecForName("Windows-1250"));
|
||||
map.insert(1251, QTextCodec::codecForName("Windows-1251"));
|
||||
map.insert(1252, QTextCodec::codecForName("Windows-1252"));
|
||||
map.insert(1253, QTextCodec::codecForName("Windows-1253"));
|
||||
map.insert(1254, QTextCodec::codecForName("Windows-1254"));
|
||||
map.insert(1255, QTextCodec::codecForName("Windows-1255"));
|
||||
map.insert(1256, QTextCodec::codecForName("Windows-1256"));
|
||||
map.insert(1257, QTextCodec::codecForName("Windows-1257"));
|
||||
map.insert(1258, QTextCodec::codecForName("Windows-1258"));
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
const QMap<int, QTextCodec *> &TextCodec::codecs()
|
||||
{
|
||||
static QMap<int, QTextCodec *> map = initCodecs();
|
||||
return map;
|
||||
return c;
|
||||
}
|
||||
|
||||
TextCodec::TextCodec(int codepage)
|
||||
{
|
||||
const QMap<int, QTextCodec *> &map = codecs();
|
||||
|
||||
QMap<int, QTextCodec *>::const_iterator it(map.find(codepage));
|
||||
if (it == map.cend()) {
|
||||
qWarning("%d: Unsupported codepage, using UTF-8", codepage);
|
||||
_codec = 0;
|
||||
} else
|
||||
_codec = *it;
|
||||
switch (codepage) {
|
||||
case 874:
|
||||
_codec = codec(2109);
|
||||
break;
|
||||
case 932:
|
||||
_codec = codec(17);
|
||||
break;
|
||||
case 936:
|
||||
_codec = codec(114);
|
||||
break;
|
||||
case 949:
|
||||
_codec = codec(38);
|
||||
break;
|
||||
case 950:
|
||||
_codec = codec(2026);
|
||||
break;
|
||||
case 1250:
|
||||
_codec = codec(2250);
|
||||
break;
|
||||
case 1251:
|
||||
_codec = codec(2251);
|
||||
break;
|
||||
case 1252:
|
||||
_codec = codec(2252);
|
||||
break;
|
||||
case 1253:
|
||||
_codec = codec(2253);
|
||||
break;
|
||||
case 1254:
|
||||
_codec = codec(2254);
|
||||
break;
|
||||
case 1255:
|
||||
_codec = codec(2255);
|
||||
break;
|
||||
case 1256:
|
||||
_codec = codec(2256);
|
||||
break;
|
||||
case 1257:
|
||||
_codec = codec(2257);
|
||||
break;
|
||||
case 1258:
|
||||
_codec = codec(2258);
|
||||
break;
|
||||
case 65001:
|
||||
_codec = 0;
|
||||
break;
|
||||
default:
|
||||
qWarning("%d: Unknown codepage, using UTF-8", codepage);
|
||||
_codec = 0;
|
||||
}
|
||||
}
|
||||
|
||||
QString TextCodec::toString(const QByteArray &ba) const
|
||||
|
@ -16,8 +16,6 @@ public:
|
||||
|
||||
private:
|
||||
QTextCodec *_codec;
|
||||
|
||||
static const QMap<int, QTextCodec *> &codecs();
|
||||
};
|
||||
|
||||
#endif // TEXTCODEC_H
|
||||
|
@ -148,9 +148,9 @@ qreal DEM::elevation(const Coordinates &c)
|
||||
|
||||
QList<Area> DEM::tiles()
|
||||
{
|
||||
static const QRegularExpression re("([NS])([0-9]{2})([EW])([0-9]{3})");
|
||||
QDir dir(_dir);
|
||||
QFileInfoList files(dir.entryInfoList(QDir::Files | QDir::Readable));
|
||||
QRegularExpression re("([NS])([0-9]{2})([EW])([0-9]{3})");
|
||||
QLocale l(QLocale::system());
|
||||
QList<Area> list;
|
||||
|
||||
|
@ -88,6 +88,7 @@ static Coordinates parseUTM(const QString &zone, const QString &easting,
|
||||
bool GPSDumpParser::parse(QFile *file, QList<TrackData> &tracks,
|
||||
QList<RouteData> &routes, QList<Area> &polygons, QVector<Waypoint> &waypoints)
|
||||
{
|
||||
static const QRegularExpression dm("[ ]{2,}");
|
||||
Q_UNUSED(tracks);
|
||||
Q_UNUSED(routes);
|
||||
Q_UNUSED(polygons);
|
||||
@ -95,7 +96,6 @@ bool GPSDumpParser::parse(QFile *file, QList<TrackData> &tracks,
|
||||
_errorLine = 1;
|
||||
_errorString.clear();
|
||||
Type type = Unknown;
|
||||
QRegularExpression dm("[ ]{2,}");
|
||||
|
||||
while (!file->atEnd()) {
|
||||
QByteArray ba(file->readLine(4096).trimmed());
|
||||
|
@ -2,11 +2,9 @@
|
||||
#include <QDir>
|
||||
#include "common/rectc.h"
|
||||
#include "common/greatcircle.h"
|
||||
#include "data.h"
|
||||
#include "dem.h"
|
||||
#include "path.h"
|
||||
#include "area.h"
|
||||
#include "common/wgs84.h"
|
||||
#include "data.h"
|
||||
#include "path.h"
|
||||
#include "poi.h"
|
||||
|
||||
|
||||
|
@ -13,7 +13,7 @@ QDebug operator<<(QDebug dbg, const SMLParser::Sensors &sensors)
|
||||
#endif // QT_NO_DEBUG
|
||||
|
||||
|
||||
void SMLParser::sample(SegmentData &segment, QMap<QDateTime, Sensors> &map)
|
||||
void SMLParser::sample(SegmentData &segment, SensorsMap &map)
|
||||
{
|
||||
QDateTime timestamp;
|
||||
Sensors sensors;
|
||||
@ -97,19 +97,20 @@ void SMLParser::sample(SegmentData &segment, QMap<QDateTime, Sensors> &map)
|
||||
|
||||
void SMLParser::samples(SegmentData &segment)
|
||||
{
|
||||
QMap<QDateTime, Sensors> sensors;
|
||||
QMap<QDateTime, Sensors>::const_iterator it;
|
||||
SensorsMap map;
|
||||
|
||||
while (_reader.readNextStartElement()) {
|
||||
if (_reader.name() == QLatin1String("Sample")) {
|
||||
sample(segment, sensors);
|
||||
sample(segment, map);
|
||||
} else
|
||||
_reader.skipCurrentElement();
|
||||
}
|
||||
|
||||
for (int i = 0; i < segment.size(); i++) {
|
||||
Trackpoint &t = segment[i];
|
||||
if ((it = sensors.lowerBound(t.timestamp())) != sensors.constEnd()) {
|
||||
SensorsMap::const_iterator it(map.lowerBound(t.timestamp()));
|
||||
|
||||
if (it != map.constEnd()) {
|
||||
t.setCadence(it->cadence * 60);
|
||||
t.setTemperature(it->temperature - 273.15);
|
||||
t.setHeartRate(it->hr * 60);
|
||||
|
@ -23,10 +23,12 @@ private:
|
||||
qreal cadence, temperature, hr, power, speed;
|
||||
};
|
||||
|
||||
typedef QMap<QDateTime, Sensors> SensorsMap;
|
||||
|
||||
void sml(QList<TrackData> &tracks);
|
||||
void deviceLog(TrackData &track);
|
||||
void samples(SegmentData &segment);
|
||||
void sample(SegmentData &segment, QMap<QDateTime, Sensors> &map);
|
||||
void sample(SegmentData &segment, SensorsMap &map);
|
||||
|
||||
#ifndef QT_NO_DEBUG
|
||||
friend QDebug operator<<(QDebug dbg, const Sensors &sensors);
|
||||
|
@ -323,7 +323,7 @@ bool ISO8211::readRecord(Record &record)
|
||||
const FieldDefinition &def = fields.at(i);
|
||||
Data data;
|
||||
|
||||
FieldsMap::const_iterator it = _map.find(def.tag);
|
||||
FieldsMap::const_iterator it(_map.find(def.tag));
|
||||
if (it == _map.constEnd()) {
|
||||
_errorString = QString("%1: unknown record").arg(QString(def.tag));
|
||||
return false;
|
||||
|
@ -86,7 +86,7 @@ static QMap<uint,uint> orderMap = orderMapInit();
|
||||
static uint order(uint type)
|
||||
{
|
||||
uint st = ((type>>16) == BUAARE) ? type : (type & 0xFFFF0000);
|
||||
QMap<uint, uint>::const_iterator it = orderMap.find(st);
|
||||
QMap<uint, uint>::const_iterator it(orderMap.find(st));
|
||||
return (it == orderMap.constEnd()) ? (type>>16) + 512 : it.value();
|
||||
}
|
||||
|
||||
|
@ -15,7 +15,14 @@ using namespace ENC;
|
||||
typedef QSet<Coordinates> PointSet;
|
||||
|
||||
static const float C1 = 0.866025f; /* sqrt(3)/2 */
|
||||
static const QColor haloColor(Qt::white);
|
||||
static const QColor tsslptPen = QColor("#eb49eb");
|
||||
static const QColor tsslptBrush = QColor("#80eb49eb");
|
||||
|
||||
static const Style *style()
|
||||
{
|
||||
static ENC::Style s;
|
||||
return &s;
|
||||
}
|
||||
|
||||
static double area(const QVector<Coordinates> &polygon)
|
||||
{
|
||||
@ -168,8 +175,8 @@ void RasterTile::drawArrows(QPainter *painter,
|
||||
QPolygonF polygon(tsslptArrow(centroid(poly.path().first()),
|
||||
deg2rad(180 - poly.param().toDouble())));
|
||||
|
||||
painter->setPen(QPen(QColor("#eb49eb"), 1));
|
||||
painter->setBrush(QBrush("#80eb49eb"));
|
||||
painter->setPen(QPen(tsslptPen, 1));
|
||||
painter->setBrush(QBrush(tsslptBrush));
|
||||
painter->drawPolygon(polygon);
|
||||
}
|
||||
}
|
||||
@ -397,3 +404,23 @@ void RasterTile::render()
|
||||
|
||||
_valid = true;
|
||||
}
|
||||
|
||||
RasterTile::RasterTile(const Projection &proj, const Transform &transform,
|
||||
const MapData *data, int zoom, const Range &zoomRange, const QRect &rect,
|
||||
qreal ratio) :
|
||||
_proj(proj), _transform(transform), _map(data), _atlas(0), _zoom(zoom),
|
||||
_zoomRange(zoomRange), _rect(rect), _ratio(ratio),
|
||||
_pixmap(rect.width() * ratio, rect.height() * ratio), _valid(false)
|
||||
{
|
||||
_style = style();
|
||||
}
|
||||
|
||||
RasterTile::RasterTile(const Projection &proj, const Transform &transform,
|
||||
AtlasData *data, int zoom, const Range &zoomRange, const QRect &rect,
|
||||
qreal ratio) :
|
||||
_proj(proj), _transform(transform), _map(0), _atlas(data), _zoom(zoom),
|
||||
_zoomRange(zoomRange), _rect(rect), _ratio(ratio),
|
||||
_pixmap(rect.width() * ratio, rect.height() * ratio), _valid(false)
|
||||
{
|
||||
_style = style();
|
||||
}
|
||||
|
@ -18,17 +18,11 @@ class RasterTile
|
||||
{
|
||||
public:
|
||||
RasterTile(const Projection &proj, const Transform &transform,
|
||||
const Style *style, const MapData *data, int zoom, const Range &zoomRange,
|
||||
const QRect &rect, qreal ratio) : _proj(proj), _transform(transform),
|
||||
_style(style), _map(data), _atlas(0), _zoom(zoom), _zoomRange(zoomRange),
|
||||
_rect(rect), _ratio(ratio), _pixmap(rect.width() * ratio, rect.height()
|
||||
* ratio), _valid(false) {}
|
||||
const MapData *data, int zoom, const Range &zoomRange, const QRect &rect,
|
||||
qreal ratio);
|
||||
RasterTile(const Projection &proj, const Transform &transform,
|
||||
const Style *style, AtlasData *data, int zoom, const Range &zoomRange,
|
||||
const QRect &rect, qreal ratio) : _proj(proj), _transform(transform),
|
||||
_style(style), _map(0), _atlas(data), _zoom(zoom), _zoomRange(zoomRange),
|
||||
_rect(rect), _ratio(ratio), _pixmap(rect.width() * ratio, rect.height()
|
||||
* ratio), _valid(false) {}
|
||||
AtlasData *data, int zoom, const Range &zoomRange, const QRect &rect,
|
||||
qreal ratio);
|
||||
|
||||
int zoom() const {return _zoom;}
|
||||
QPoint xy() const {return _rect.topLeft();}
|
||||
|
@ -344,7 +344,7 @@ const Style::Line &Style::line(uint type) const
|
||||
{
|
||||
static Line null;
|
||||
|
||||
QMap<uint, Line>::const_iterator it = _lines.find(type);
|
||||
QMap<uint, Line>::const_iterator it(_lines.find(type));
|
||||
return (it == _lines.constEnd()) ? null : *it;
|
||||
}
|
||||
|
||||
@ -352,7 +352,7 @@ const Style::Polygon &Style::polygon(uint type) const
|
||||
{
|
||||
static Polygon null;
|
||||
|
||||
QMap<uint, Polygon>::const_iterator it = _polygons.find(type);
|
||||
QMap<uint, Polygon>::const_iterator it(_polygons.find(type));
|
||||
return (it == _polygons.constEnd()) ? null : *it;
|
||||
}
|
||||
|
||||
@ -360,7 +360,7 @@ const Style::Point &Style::point(uint type) const
|
||||
{
|
||||
static Point null;
|
||||
|
||||
QMap<uint, Point>::const_iterator it = _points.find(type);
|
||||
QMap<uint, Point>::const_iterator it(_points.find(type));
|
||||
return (it == _points.constEnd()) ? null : *it;
|
||||
}
|
||||
|
||||
|
@ -111,6 +111,7 @@ private:
|
||||
QMap<uint, Point> _points;
|
||||
QVector<uint> _drawOrder;
|
||||
|
||||
/* Fonts and images must be initialized after QGuiApplication! */
|
||||
QFont _small, _normal, _large;
|
||||
QImage _light, _signal;
|
||||
};
|
||||
|
@ -52,8 +52,10 @@ bool GMAPData::readXML(const QString &path, QString &dataDir, QString &typFile)
|
||||
{
|
||||
QFile file(path);
|
||||
|
||||
if (!file.open(QFile::ReadOnly | QFile::Text))
|
||||
if (!file.open(QFile::ReadOnly | QFile::Text)) {
|
||||
_errorString = file.errorString();
|
||||
return false;
|
||||
}
|
||||
|
||||
QXmlStreamReader reader(&file);
|
||||
if (reader.readNextStartElement()) {
|
||||
|
@ -105,7 +105,7 @@ bool IMGData::readFAT(QFile &file, TileMap &tileMap)
|
||||
QByteArray fn(name, sizeof(name));
|
||||
if (VectorTile::isTileFile(tt)) {
|
||||
VectorTile *tile;
|
||||
TileMap::const_iterator it = tileMap.find(fn);
|
||||
TileMap::const_iterator it(tileMap.find(fn));
|
||||
if (it == tileMap.constEnd()) {
|
||||
tile = new VectorTile();
|
||||
tileMap.insert(fn, tile);
|
||||
|
@ -16,14 +16,14 @@ class LBLFile : public SubFile
|
||||
{
|
||||
public:
|
||||
LBLFile(const IMGData *img)
|
||||
: SubFile(img), _huffmanText(0), _table(0), _rasters(0), _codec(1252),
|
||||
_imgIdSize(0), _poiShift(0), _shift(0), _encoding(0) {}
|
||||
: SubFile(img), _huffmanText(0), _table(0), _rasters(0), _imgIdSize(0),
|
||||
_poiShift(0), _shift(0), _encoding(0) {}
|
||||
LBLFile(const QString *path)
|
||||
: SubFile(path), _huffmanText(0), _table(0), _rasters(0), _codec(1252),
|
||||
_imgIdSize(0), _poiShift(0), _shift(0), _encoding(0) {}
|
||||
: SubFile(path), _huffmanText(0), _table(0), _rasters(0), _imgIdSize(0),
|
||||
_poiShift(0), _shift(0), _encoding(0) {}
|
||||
LBLFile(const SubFile *gmp, quint32 offset)
|
||||
: SubFile(gmp, offset), _huffmanText(0), _table(0), _rasters(0),
|
||||
_codec(1252), _imgIdSize(0), _poiShift(0), _shift(0), _encoding(0) {}
|
||||
_imgIdSize(0), _poiShift(0), _shift(0), _encoding(0) {}
|
||||
~LBLFile();
|
||||
|
||||
bool load(Handle &hdl, const RGNFile *rgn, Handle &rgnHdl);
|
||||
|
@ -1,7 +1,6 @@
|
||||
#include <QFont>
|
||||
#include <QPainter>
|
||||
#include <QCache>
|
||||
#include "map/imgmap.h"
|
||||
#include "map/textpathitem.h"
|
||||
#include "map/textpointitem.h"
|
||||
#include "map/bitmapline.h"
|
||||
|
@ -1250,7 +1250,7 @@ const Style::Line &Style::line(quint32 type) const
|
||||
{
|
||||
static Line null;
|
||||
|
||||
QMap<quint32, Line>::const_iterator it = _lines.find(type);
|
||||
QMap<quint32, Line>::const_iterator it(_lines.find(type));
|
||||
return (it == _lines.constEnd()) ? null : *it;
|
||||
}
|
||||
|
||||
@ -1258,7 +1258,7 @@ const Style::Polygon &Style::polygon(quint32 type) const
|
||||
{
|
||||
static Polygon null;
|
||||
|
||||
QMap<quint32, Polygon>::const_iterator it = _polygons.find(type);
|
||||
QMap<quint32, Polygon>::const_iterator it(_polygons.find(type));
|
||||
return (it == _polygons.constEnd()) ? null : *it;
|
||||
}
|
||||
|
||||
@ -1266,12 +1266,14 @@ const Style::Point &Style::point(quint32 type) const
|
||||
{
|
||||
static Point null;
|
||||
|
||||
QMap<quint32, Point>::const_iterator it = _points.find(type);
|
||||
QMap<quint32, Point>::const_iterator it(_points.find(type));
|
||||
return (it == _points.constEnd()) ? null : *it;
|
||||
}
|
||||
|
||||
const QFont *Style::font(Style::FontSize size, Style::FontSize defaultSize) const
|
||||
{
|
||||
Q_ASSERT(defaultSize != Style::NotSet);
|
||||
|
||||
switch (size) {
|
||||
case Style::None:
|
||||
return 0;
|
||||
|
@ -176,6 +176,7 @@ private:
|
||||
QMap<quint32, Point> _points;
|
||||
QList<quint32> _drawOrder;
|
||||
|
||||
/* Fonts and images must be initialized after QGuiApplication! */
|
||||
QFont _large, _normal, _small, _extraSmall;
|
||||
};
|
||||
|
||||
|
@ -4,7 +4,6 @@
|
||||
#include <QImageReader>
|
||||
#include <QBuffer>
|
||||
#include <QtConcurrent>
|
||||
#include "common/hash.h"
|
||||
#include "osm.h"
|
||||
#include "tile.h"
|
||||
#include "aqmmap.h"
|
||||
|
@ -27,19 +27,25 @@ static bool yCmp(OziMap *m1, OziMap *m2)
|
||||
return TL(m1).y() > TL(m2).y();
|
||||
}
|
||||
|
||||
static QString calibrationFile(const QString &path)
|
||||
static QString calibrationFile(const QString &path, OziMap::CalibrationType &type)
|
||||
{
|
||||
QDir dir(path);
|
||||
QFileInfoList files = dir.entryInfoList(QDir::Files);
|
||||
QFileInfoList files(dir.entryInfoList(QDir::Files));
|
||||
|
||||
for (int i = 0; i < files.size(); i++) {
|
||||
const QFileInfo &fi = files.at(i);
|
||||
QString suffix(fi.suffix().toLower());
|
||||
|
||||
if (suffix == "map" || suffix == "gmi")
|
||||
if (suffix == "map") {
|
||||
type = OziMap::MAP;
|
||||
return fi.absoluteFilePath();
|
||||
} else if (suffix == "gmi") {
|
||||
type = OziMap::GMI;
|
||||
return fi.absoluteFilePath();
|
||||
}
|
||||
}
|
||||
|
||||
type = OziMap::Unknown;
|
||||
return QString();
|
||||
}
|
||||
|
||||
@ -141,16 +147,19 @@ Atlas::Atlas(const QString &fileName, bool TAR, const Projection &proj,
|
||||
QFileInfoList maps = zdir.entryInfoList(QDir::Dirs
|
||||
| QDir::NoDotAndDotDot);
|
||||
for (int i = 0; i < maps.count(); i++) {
|
||||
QString path(maps.at(i).absoluteFilePath());
|
||||
OziMap *map;
|
||||
|
||||
if (TAR)
|
||||
map = new OziMap(maps.at(i).absoluteFilePath(), tar, proj, this);
|
||||
map = new OziMap(path, tar, proj, this);
|
||||
else {
|
||||
QString cf(calibrationFile(maps.at(i).absoluteFilePath()));
|
||||
OziMap::CalibrationType type;
|
||||
QString cf(calibrationFile(path, type));
|
||||
if (cf.isNull()) {
|
||||
_errorString = "No calibration file found";
|
||||
return;
|
||||
qWarning("%s: no calibration file found", qPrintable(path));
|
||||
continue;
|
||||
}
|
||||
map = new OziMap(cf, proj, this);
|
||||
map = new OziMap(cf, type, proj, this);
|
||||
}
|
||||
|
||||
if (map->isValid())
|
||||
|
@ -395,7 +395,7 @@ BSBMap::BSBMap(const QString &fileName, QObject *parent)
|
||||
QFile file(fileName);
|
||||
|
||||
if (!file.open(QIODevice::ReadOnly)) {
|
||||
_errorString = fileName + ": " + file.errorString();
|
||||
_errorString = file.errorString();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -99,7 +99,7 @@ QMap<int, Conversion::Entry> Conversion::defaults()
|
||||
|
||||
Conversion Conversion::conversion(int id)
|
||||
{
|
||||
QMap<int, Entry>::const_iterator it = _conversions.find(id);
|
||||
QMap<int, Entry>::const_iterator it(_conversions.find(id));
|
||||
|
||||
if (it == _conversions.constEnd())
|
||||
return Conversion();
|
||||
@ -189,7 +189,7 @@ QList<KV<int, QString> > Conversion::list()
|
||||
QList<KV<int, QString> > list;
|
||||
|
||||
for (QMap<int, Entry>::const_iterator it = _conversions.constBegin();
|
||||
it != _conversions.constEnd(); ++it)
|
||||
it != _conversions.constEnd(); ++it)
|
||||
list.append(KV<int, QString>(it.key(), it.value().name()));
|
||||
|
||||
return list;
|
||||
|
@ -5,7 +5,6 @@
|
||||
#include "rectd.h"
|
||||
#include "pcs.h"
|
||||
#include "encjob.h"
|
||||
#include "encstyle.h"
|
||||
#include "encatlas.h"
|
||||
|
||||
using namespace ENC;
|
||||
@ -358,7 +357,7 @@ void ENCAtlas::draw(QPainter *painter, const QRectF &rect, Flags flags)
|
||||
painter->drawPixmap(ttl, pm);
|
||||
else
|
||||
tiles.append(RasterTile(_projection, _transform,
|
||||
ENCStyle::style(), _data.value(_usage), _zoom, zooms(_usage),
|
||||
_data.value(_usage), _zoom, zooms(_usage),
|
||||
QRect(ttl, QSize(TILE_SIZE, TILE_SIZE)), _tileRatio));
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,6 @@
|
||||
#include "rectd.h"
|
||||
#include "pcs.h"
|
||||
#include "encjob.h"
|
||||
#include "encstyle.h"
|
||||
#include "encmap.h"
|
||||
|
||||
|
||||
@ -324,9 +323,8 @@ void ENCMap::draw(QPainter *painter, const QRectF &rect, Flags flags)
|
||||
if (QPixmapCache::find(key(_zoom, ttl), &pm))
|
||||
painter->drawPixmap(ttl, pm);
|
||||
else
|
||||
tiles.append(RasterTile(_projection, _transform,
|
||||
ENCStyle::style(), _data, _zoom, _zooms,
|
||||
QRect(ttl, QSize(TILE_SIZE, TILE_SIZE)), _tileRatio));
|
||||
tiles.append(RasterTile(_projection, _transform, _data, _zoom,
|
||||
_zooms, QRect(ttl, QSize(TILE_SIZE, TILE_SIZE)), _tileRatio));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,7 +0,0 @@
|
||||
#include "encstyle.h"
|
||||
|
||||
const ENC::Style *ENCStyle::style()
|
||||
{
|
||||
static ENC::Style s;
|
||||
return &s;
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
#ifndef ENCSTYLE_H
|
||||
#define ENCSTYLE_H
|
||||
|
||||
#include "ENC/style.h"
|
||||
|
||||
class ENCStyle
|
||||
{
|
||||
public:
|
||||
static const ENC::Style *style();
|
||||
};
|
||||
|
||||
#endif // ENCSTYLE_H
|
@ -1,5 +1,4 @@
|
||||
#include <QFile>
|
||||
#include "common/wgs84.h"
|
||||
#include "common/csv.h"
|
||||
#include "gcs.h"
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
#include <QPainter>
|
||||
#include <QImageReader>
|
||||
#include "common/util.h"
|
||||
#include "geotiff.h"
|
||||
#include "image.h"
|
||||
#include "geotiffmap.h"
|
||||
|
@ -41,13 +41,13 @@ bool GmiFile::parse(QIODevice &device)
|
||||
_image = line.trimmed();
|
||||
else if (ln == 3) {
|
||||
width = line.toInt(&ok);
|
||||
if (!ok || ok <= 0) {
|
||||
if (!ok || width <= 0) {
|
||||
_errorString = "Invalid image width";
|
||||
return false;
|
||||
}
|
||||
} else if (ln == 4) {
|
||||
height = line.toInt(&ok);
|
||||
if (!ok || ok <= 0) {
|
||||
if (!ok || height <= 0) {
|
||||
_errorString = "Invalid image height";
|
||||
return false;
|
||||
}
|
||||
|
@ -2,10 +2,7 @@
|
||||
#include <QPainter>
|
||||
#include <QFileInfo>
|
||||
#include <QPixmapCache>
|
||||
#include "common/util.h"
|
||||
#include "rectd.h"
|
||||
#include "gcs.h"
|
||||
#include "pcs.h"
|
||||
#include "jnxmap.h"
|
||||
|
||||
|
||||
|
@ -18,7 +18,6 @@
|
||||
#include <QPainter>
|
||||
#include <QPixmapCache>
|
||||
#include <private/qzipreader_p.h>
|
||||
#include "common/util.h"
|
||||
#include "kmzmap.h"
|
||||
|
||||
|
||||
|
@ -4,7 +4,6 @@
|
||||
#include <QImage>
|
||||
#include "projection.h"
|
||||
#include "transform.h"
|
||||
#include "rectd.h"
|
||||
#include "map.h"
|
||||
|
||||
class QXmlStreamReader;
|
||||
|
@ -43,7 +43,7 @@ MapList::ParserMap MapList::parsers()
|
||||
map.insert("rtmap", &RMap::create);
|
||||
map.insert("map", &MapsforgeMap::create);
|
||||
map.insert("map", &OziMap::createMAP);
|
||||
map.insert("gmi", &OziMap::createMAP);
|
||||
map.insert("gmi", &OziMap::createGMI);
|
||||
map.insert("kap", &BSBMap::create);
|
||||
map.insert("kmz", &KMZMap::create);
|
||||
map.insert("aqm", &AQMMap::create);
|
||||
|
@ -3,7 +3,6 @@
|
||||
#include <QFile>
|
||||
#include <QDataStream>
|
||||
#include <QColor>
|
||||
#include "common/hash.h"
|
||||
#include "map/osm.h"
|
||||
#include "subfile.h"
|
||||
#include "mapdata.h"
|
||||
|
@ -382,12 +382,19 @@ void MBTilesMap::cancelJobs(bool wait)
|
||||
_jobs.at(i)->cancel(wait);
|
||||
}
|
||||
|
||||
QPointF MBTilesMap::tilePos(const QPointF &tl, const QPoint &tc,
|
||||
const QPoint &tile, unsigned overzoom) const
|
||||
{
|
||||
return QPointF(tl.x() + ((tc.x() - tile.x()) << overzoom) * tileSize(),
|
||||
tl.y() + ((tc.y() - tile.y()) << overzoom) * tileSize());
|
||||
}
|
||||
|
||||
void MBTilesMap::draw(QPainter *painter, const QRectF &rect, Flags flags)
|
||||
{
|
||||
const Zoom &zoom = _zooms.at(_zi);
|
||||
unsigned overzoom = zoom.z - zoom.base;
|
||||
unsigned f = 1U<<overzoom;
|
||||
qreal scale = OSM::zoom2scale(zoom.base, _tileSize * f);
|
||||
qreal scale = OSM::zoom2scale(zoom.base, _tileSize << overzoom);
|
||||
QPoint tile = OSM::mercator2tile(QPointF(rect.topLeft().x() * scale,
|
||||
-rect.topLeft().y() * scale) * coordinatesRatio(), zoom.base);
|
||||
Coordinates ctl(OSM::tile2ll(tile, zoom.base));
|
||||
@ -409,8 +416,7 @@ void MBTilesMap::draw(QPainter *painter, const QRectF &rect, Flags flags)
|
||||
continue;
|
||||
|
||||
if (QPixmapCache::find(key, &pm)) {
|
||||
QPointF tp(tl.x() + (t.x() - tile.x()) * tileSize() * f,
|
||||
tl.y() + (t.y() - tile.y()) * tileSize() * f);
|
||||
QPointF tp(tilePos(tl, t, tile, overzoom));
|
||||
drawTile(painter, pm, tp);
|
||||
} else
|
||||
tiles.append(MBTile(zoom.z, overzoom, _scaledSize, t,
|
||||
@ -431,8 +437,7 @@ void MBTilesMap::draw(QPainter *painter, const QRectF &rect, Flags flags)
|
||||
|
||||
QPixmapCache::insert(mt.key(), pm);
|
||||
|
||||
QPointF tp(tl.x() + (mt.xy().x() - tile.x()) * tileSize() * f,
|
||||
tl.y() + (mt.xy().y() - tile.y()) * tileSize() * f);
|
||||
QPointF tp(tilePos(tl, mt.xy(), tile, overzoom));
|
||||
drawTile(painter, pm, tp);
|
||||
}
|
||||
} else
|
||||
|
@ -139,6 +139,8 @@ private:
|
||||
void runJob(MBTilesMapJob *job);
|
||||
void removeJob(MBTilesMapJob *job);
|
||||
void cancelJobs(bool wait);
|
||||
QPointF tilePos(const QPointF &tl, const QPoint &tc, const QPoint &tile,
|
||||
unsigned overzoom) const;
|
||||
|
||||
friend QDebug operator<<(QDebug dbg, const Zoom &zoom);
|
||||
|
||||
|
@ -118,11 +118,18 @@ qreal OnlineMap::tileSize() const
|
||||
return (_tileSize / coordinatesRatio());
|
||||
}
|
||||
|
||||
QPoint OnlineMap::tileCoordinates(int x, int y, int zoom)
|
||||
QPoint OnlineMap::tileCoordinates(int x, int y, int zoom) const
|
||||
{
|
||||
return QPoint(x, _invertY ? (1<<zoom) - y - 1 : y);
|
||||
}
|
||||
|
||||
QPointF OnlineMap::tilePos(const QPointF &tl, const QPoint &tc,
|
||||
const QPoint &tile, unsigned overzoom) const
|
||||
{
|
||||
return QPointF(tl.x() + ((tc.x() - tile.x()) << overzoom) * tileSize(),
|
||||
tl.y() + ((tc.y() - tile.y()) << overzoom) * tileSize());
|
||||
}
|
||||
|
||||
bool OnlineMap::isRunning(const QString &key) const
|
||||
{
|
||||
for (int i = 0; i < _jobs.size(); i++) {
|
||||
@ -174,14 +181,14 @@ void OnlineMap::draw(QPainter *painter, const QRectF &rect, Flags flags)
|
||||
{
|
||||
int baseZoom = qMin(_baseZoom, _zoom);
|
||||
unsigned overzoom = _zoom - baseZoom;
|
||||
unsigned f = 1U<<overzoom;
|
||||
|
||||
qreal scale = OSM::zoom2scale(baseZoom, _tileSize * f);
|
||||
qreal scale = OSM::zoom2scale(baseZoom, _tileSize << overzoom);
|
||||
QPoint tile = OSM::mercator2tile(QPointF(rect.topLeft().x() * scale,
|
||||
-rect.topLeft().y() * scale) * coordinatesRatio(), baseZoom);
|
||||
Coordinates ctl(OSM::tile2ll(tile, baseZoom));
|
||||
QPointF tl(ll2xy(Coordinates(ctl.lon(), -ctl.lat())));
|
||||
QSizeF s(rect.right() - tl.x(), rect.bottom() - tl.y());
|
||||
unsigned f = 1U<<overzoom;
|
||||
int width = ceil(s.width() / (tileSize() * f));
|
||||
int height = ceil(s.height() / (tileSize() * f));
|
||||
|
||||
@ -213,8 +220,7 @@ void OnlineMap::draw(QPainter *painter, const QRectF &rect, Flags flags)
|
||||
QPixmap pm;
|
||||
if (QPixmapCache::find(key, &pm)) {
|
||||
QPoint tc(tileCoordinates(t.xy().x(), t.xy().y(), baseZoom));
|
||||
QPointF tp(tl.x() + (tc.x() - tile.x()) * tileSize() * f,
|
||||
tl.y() + (tc.y() - tile.y()) * tileSize() * f);
|
||||
QPointF tp(tilePos(tl, tc, tile, overzoom));
|
||||
drawTile(painter, pm, tp);
|
||||
} else
|
||||
renderTiles.append(OnlineMapTile(t.xy(), t.file(), _zoom, overzoom,
|
||||
@ -236,8 +242,7 @@ void OnlineMap::draw(QPainter *painter, const QRectF &rect, Flags flags)
|
||||
QPixmapCache::insert(mt.key(), pm);
|
||||
|
||||
QPoint tc(tileCoordinates(mt.xy().x(), mt.xy().y(), baseZoom));
|
||||
QPointF tp(tl.x() + (tc.x() - tile.x()) * tileSize() * f,
|
||||
tl.y() + (tc.y() - tile.y()) * tileSize() * f);
|
||||
QPointF tp(tilePos(tl, tc, tile, overzoom));
|
||||
drawTile(painter, pm, tp);
|
||||
}
|
||||
} else
|
||||
|
@ -115,7 +115,9 @@ private:
|
||||
qreal tileSize() const;
|
||||
qreal coordinatesRatio() const;
|
||||
qreal imageRatio() const;
|
||||
QPoint tileCoordinates(int x, int y, int zoom);
|
||||
QPoint tileCoordinates(int x, int y, int zoom) const;
|
||||
QPointF tilePos(const QPointF &tl, const QPoint &tc, const QPoint &tile,
|
||||
unsigned overzoom) const;
|
||||
void drawTile(QPainter *painter, QPixmap &pixmap, QPointF &tp);
|
||||
bool isRunning(const QString &key) const;
|
||||
void runJob(OnlineMapJob *job);
|
||||
|
@ -366,8 +366,10 @@ bool OruxMap::readXML(const QString &path, const QString &dir)
|
||||
{
|
||||
QFile file(path);
|
||||
|
||||
if (!file.open(QFile::ReadOnly | QFile::Text))
|
||||
if (!file.open(QFile::ReadOnly | QFile::Text)) {
|
||||
_errorString = file.errorString();
|
||||
return false;
|
||||
}
|
||||
|
||||
QXmlStreamReader reader(&file);
|
||||
if (reader.readNextStartElement()) {
|
||||
|
@ -54,19 +54,15 @@ QString OziMap::calibrationFile(const QStringList &files, const QString path,
|
||||
return QString();
|
||||
}
|
||||
|
||||
OziMap::OziMap(const QString &fileName, const Projection &proj, QObject *parent)
|
||||
: Map(fileName, parent), _img(0), _tar(0), _ozf(0), _zoom(0), _mapRatio(1.0),
|
||||
_valid(false)
|
||||
OziMap::OziMap(const QString &fileName, CalibrationType type,
|
||||
const Projection &proj, QObject *parent) : Map(fileName, parent), _img(0),
|
||||
_tar(0), _ozf(0), _zoom(0), _mapRatio(1.0), _valid(false)
|
||||
{
|
||||
QFileInfo fi(fileName);
|
||||
QString suffix(fi.suffix().toLower());
|
||||
|
||||
if (suffix == "tar") {
|
||||
CalibrationType type;
|
||||
|
||||
// TAR maps
|
||||
if (type == Unknown) {
|
||||
_tar = new Tar(fileName);
|
||||
if (!_tar->open()) {
|
||||
_errorString = "Error reading tar file: " + _tar->errorString();
|
||||
_errorString = _tar->errorString();
|
||||
return;
|
||||
}
|
||||
QStringList files(_tar->files());
|
||||
@ -110,10 +106,12 @@ OziMap::OziMap(const QString &fileName, const Projection &proj, QObject *parent)
|
||||
return;
|
||||
|
||||
_tar->close();
|
||||
|
||||
// regular MAP or GMI maps
|
||||
} else {
|
||||
QFile file(fileName);
|
||||
|
||||
if (suffix == "map") {
|
||||
if (type == MAP) {
|
||||
MapFile mf(file);
|
||||
if (!mf.isValid()) {
|
||||
_errorString = mf.errorString();
|
||||
@ -125,7 +123,7 @@ OziMap::OziMap(const QString &fileName, const Projection &proj, QObject *parent)
|
||||
_projection = mf.projection();
|
||||
_transform = mf.transform();
|
||||
}
|
||||
} else if (suffix == "gmi") {
|
||||
} else if (type == GMI) {
|
||||
GmiFile gmi(file);
|
||||
if (!gmi.isValid()) {
|
||||
_errorString = gmi.errorString();
|
||||
@ -138,11 +136,9 @@ OziMap::OziMap(const QString &fileName, const Projection &proj, QObject *parent)
|
||||
_projection = proj;
|
||||
computeTransform();
|
||||
}
|
||||
} else {
|
||||
_errorString = "Unknown file type";
|
||||
return;
|
||||
}
|
||||
|
||||
QFileInfo fi(fileName);
|
||||
QDir set(fi.absolutePath() + "/" + "set");
|
||||
if (set.exists()) {
|
||||
if (!setTileInfo(set.entryList(), set.absolutePath()))
|
||||
@ -266,32 +262,33 @@ bool OziMap::setImageInfo(const QString &path)
|
||||
|
||||
bool OziMap::setTileInfo(const QStringList &tiles, const QString &path)
|
||||
{
|
||||
static const QRegularExpression rx("_[0-9]+_[0-9]+\\.");
|
||||
|
||||
if (!_map.size.isValid()) {
|
||||
_errorString = "Missing total image size (IWH)";
|
||||
return false;
|
||||
}
|
||||
|
||||
QRegularExpression rx("_[0-9]+_[0-9]+\\.");
|
||||
for (int i = 0; i < tiles.size(); i++) {
|
||||
if (tiles.at(i).contains(rx)) {
|
||||
_tile.path = QString(tiles.at(i)).replace(rx, "_%1_%2.");
|
||||
const QString &tile = tiles.at(i);
|
||||
|
||||
if (tile.contains(rx)) {
|
||||
QString pattern(QString(tile).replace(rx, "_%1_%2."));
|
||||
|
||||
if (_tar) {
|
||||
QByteArray ba = _tar->file(tiles.at(i));
|
||||
QByteArray ba(_tar->file(tile));
|
||||
QBuffer buffer(&ba);
|
||||
_tile.path = pattern;
|
||||
_tile.size = QImageReader(&buffer).size();
|
||||
} else {
|
||||
_tile.path = path + "/" + _tile.path;
|
||||
_tile.size = QImageReader(path + "/" + tiles.at(i)).size();
|
||||
}
|
||||
if (!_tile.size.isValid()) {
|
||||
_errorString = QString("Error retrieving tile size: "
|
||||
"%1: Invalid image").arg(QFileInfo(tiles.at(i)).fileName());
|
||||
return false;
|
||||
_tile.path = path + "/" + pattern;
|
||||
_tile.size = QImageReader(path + "/" + tile).size();
|
||||
}
|
||||
|
||||
_map.path = QString();
|
||||
return true;
|
||||
if (_tile.size.isValid())
|
||||
return true;
|
||||
else
|
||||
qWarning("%s: error reading tile image", qPrintable(tile));
|
||||
}
|
||||
}
|
||||
|
||||
@ -373,8 +370,7 @@ void OziMap::drawTiled(QPainter *painter, const QRectF &rect) const
|
||||
pixmap = QPixmap(tileName);
|
||||
|
||||
if (pixmap.isNull())
|
||||
qWarning("%s: error loading tile image", qPrintable(
|
||||
_tile.path.arg(QString::number(x), QString::number(y))));
|
||||
qWarning("%s: error loading tile image", qPrintable(tileName));
|
||||
else {
|
||||
pixmap.setDevicePixelRatio(_mapRatio);
|
||||
QPointF tp(tl.x() + i * ts.width(), tl.y() + j * ts.height());
|
||||
@ -398,8 +394,9 @@ void OziMap::drawOZF(QPainter *painter, const QRectF &rect) const
|
||||
int y = round(tl.y() * _mapRatio + j * _ozf->tileSize().height());
|
||||
|
||||
QPixmap pixmap;
|
||||
QString key = _ozf->fileName() + "/" + QString::number(_zoom) + "_"
|
||||
+ QString::number(x) + "_" + QString::number(y);
|
||||
QString key(_ozf->fileName() + "/" + QString::number(_zoom) + "_"
|
||||
+ QString::number(x) + "_" + QString::number(y));
|
||||
|
||||
if (!QPixmapCache::find(key, &pixmap)) {
|
||||
pixmap = _ozf->tile(_zoom, x, y);
|
||||
if (!pixmap.isNull())
|
||||
@ -512,7 +509,7 @@ Map *OziMap::createTAR(const QString &path, const Projection &proj, bool *isDir)
|
||||
if (isDir)
|
||||
*isDir = false;
|
||||
|
||||
return new OziMap(path, proj);
|
||||
return new OziMap(path, Unknown, proj);
|
||||
}
|
||||
|
||||
Map *OziMap::createMAP(const QString &path, const Projection &proj, bool *isDir)
|
||||
@ -520,5 +517,13 @@ Map *OziMap::createMAP(const QString &path, const Projection &proj, bool *isDir)
|
||||
if (isDir)
|
||||
*isDir = false;
|
||||
|
||||
return new OziMap(path, proj);
|
||||
return new OziMap(path, MAP, proj);
|
||||
}
|
||||
|
||||
Map *OziMap::createGMI(const QString &path, const Projection &proj, bool *isDir)
|
||||
{
|
||||
if (isDir)
|
||||
*isDir = false;
|
||||
|
||||
return new OziMap(path, GMI, proj);
|
||||
}
|
||||
|
@ -15,7 +15,11 @@ class OziMap : public Map
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
OziMap(const QString &fileName, const Projection &proj,
|
||||
enum CalibrationType {
|
||||
Unknown, MAP, GMI
|
||||
};
|
||||
|
||||
OziMap(const QString &fileName, CalibrationType type, const Projection &proj,
|
||||
QObject *parent = 0);
|
||||
OziMap(const QString &dirName, Tar &tar, const Projection &proj,
|
||||
QObject *parent = 0);
|
||||
@ -54,12 +58,10 @@ public:
|
||||
bool *isDir);
|
||||
static Map *createMAP(const QString &path, const Projection &proj,
|
||||
bool *isDir);
|
||||
static Map *createGMI(const QString &path, const Projection &proj,
|
||||
bool *isDir);
|
||||
|
||||
private:
|
||||
enum CalibrationType {
|
||||
Unknown, MAP, GMI
|
||||
};
|
||||
|
||||
struct ImageInfo {
|
||||
QSize size;
|
||||
QString path;
|
||||
|
@ -1,6 +1,5 @@
|
||||
#include <QFile>
|
||||
#include "common/csv.h"
|
||||
#include "angularunits.h"
|
||||
#include "pcs.h"
|
||||
|
||||
QMap<int, PCS::Entry> PCS::_pcss = defaults();
|
||||
@ -14,7 +13,7 @@ QMap<int, PCS::Entry> PCS::defaults()
|
||||
|
||||
PCS PCS::pcs(int id)
|
||||
{
|
||||
QMap<int, Entry>::const_iterator it = _pcss.find(id);
|
||||
QMap<int, Entry>::const_iterator it(_pcss.find(id));
|
||||
|
||||
if (it == _pcss.constEnd())
|
||||
return PCS();
|
||||
|
@ -5,8 +5,6 @@
|
||||
#include <QMap>
|
||||
#include "common/kv.h"
|
||||
#include "gcs.h"
|
||||
#include "linearunits.h"
|
||||
#include "coordinatesystem.h"
|
||||
#include "conversion.h"
|
||||
|
||||
class PCS
|
||||
|
@ -327,7 +327,7 @@ QCTMap::QCTMap(const QString &fileName, QObject *parent)
|
||||
_mapRatio(1.0), _valid(false)
|
||||
{
|
||||
if (!_file.open(QIODevice::ReadOnly)) {
|
||||
_errorString = fileName + ": " + _file.errorString();
|
||||
_errorString = _file.errorString();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,6 @@
|
||||
#include <QRegularExpression>
|
||||
#include <QtEndian>
|
||||
#include "common/rectc.h"
|
||||
#include "common/wgs84.h"
|
||||
#include "common/color.h"
|
||||
#include "calibrationpoint.h"
|
||||
#include "utm.h"
|
||||
@ -98,10 +97,10 @@ static Projection parseProjection(const QString &str, const GCS &gcs)
|
||||
|
||||
bool RMap::parseIMP(const QByteArray &data)
|
||||
{
|
||||
QStringList lines = QString(data).split("\r\n");
|
||||
static const QRegularExpression re("^P[0-9]+=");
|
||||
QStringList lines(QString(data).split("\r\n"));
|
||||
QVector<CalibrationPoint> calibrationPoints;
|
||||
QString projection, datum;
|
||||
QRegularExpression re("^P[0-9]+=");
|
||||
|
||||
for (int i = 0; i < lines.count(); i++) {
|
||||
const QString &line = lines.at(i);
|
||||
|
@ -70,11 +70,11 @@ bool Tar::loadTar()
|
||||
quint64 size;
|
||||
qint64 ret;
|
||||
|
||||
while ((ret = _file.read(buffer, BLOCKSIZE)) > 0) {
|
||||
while ((ret = _file.read(buffer, BLOCKSIZE))) {
|
||||
if (ret < BLOCKSIZE) {
|
||||
_file.close();
|
||||
_index.clear();
|
||||
_errorString = "Error reading header block";
|
||||
_errorString = "Error reading TAR header block";
|
||||
return false;
|
||||
}
|
||||
size = number(hdr->size, sizeof(hdr->size));
|
||||
@ -100,7 +100,7 @@ bool Tar::loadTmi(const QString &path)
|
||||
return false;
|
||||
|
||||
while (!file.atEnd()) {
|
||||
QByteArray line = file.readLine(4096);
|
||||
QByteArray line(file.readLine(4096));
|
||||
int pos = line.indexOf(':');
|
||||
if (line.size() < 10 || pos < 7 || !line.startsWith("block")) {
|
||||
qWarning("%s:%d: syntax error", qPrintable(path), ln);
|
||||
|
@ -1,6 +1,7 @@
|
||||
#ifndef TEXTPOINTITEM_H
|
||||
#define TEXTPOINTITEM_H
|
||||
|
||||
#include <cmath>
|
||||
#include "textitem.h"
|
||||
|
||||
class QFont;
|
||||
|
@ -110,8 +110,8 @@ void TileLoader::loadTilesSync(QVector<Tile> &list)
|
||||
|
||||
for (int i = 0; i < tl.size(); i++) {
|
||||
Tile *t = tl[i];
|
||||
QString file = tileFile(*t);
|
||||
if (QFileInfo(file).exists())
|
||||
QString file(tileFile(*t));
|
||||
if (QFileInfo::exists(file))
|
||||
t->setFile(file);
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,3 @@
|
||||
#include "projection.h"
|
||||
#include "matrix.h"
|
||||
#include "transform.h"
|
||||
|
||||
|
@ -321,7 +321,7 @@ bool WMS::parseCapabilities()
|
||||
|
||||
void WMS::capabilitiesReady()
|
||||
{
|
||||
if (!QFileInfo(_path).exists()) {
|
||||
if (!QFileInfo::exists(_path)) {
|
||||
_errorString = "Error downloading capabilities XML file";
|
||||
_valid = false;
|
||||
} else {
|
||||
@ -338,7 +338,7 @@ WMS::WMS(const QString &file, const WMS::Setup &setup, QObject *parent)
|
||||
QString url = QString("%1%2service=WMS&request=GetCapabilities")
|
||||
.arg(setup.url(), setup.url().contains('?') ? "&" : "?");
|
||||
|
||||
if (!QFileInfo(file).exists()) {
|
||||
if (!QFileInfo::exists(file)) {
|
||||
Downloader *downloader = new Downloader(this);
|
||||
connect(downloader, &Downloader::finished, this,
|
||||
&WMS::capabilitiesReady);
|
||||
|
@ -6,7 +6,6 @@
|
||||
#include <QStringList>
|
||||
#include <QtAlgorithms>
|
||||
#include <QXmlStreamReader>
|
||||
#include "pcs.h"
|
||||
#include "crs.h"
|
||||
#include "wmts.h"
|
||||
|
||||
@ -301,7 +300,7 @@ bool WMTS::parseCapabilities(CTX &ctx)
|
||||
|
||||
void WMTS::capabilitiesReady()
|
||||
{
|
||||
if (!QFileInfo(_path).exists()) {
|
||||
if (!QFileInfo::exists(_path)) {
|
||||
_errorString = "Error downloading capabilities XML file";
|
||||
_valid = false;
|
||||
} else {
|
||||
@ -354,7 +353,7 @@ WMTS::WMTS(const QString &file, const WMTS::Setup &setup, QObject *parent)
|
||||
|
||||
_path = url.isLocalFile() ? url.toLocalFile() : file;
|
||||
|
||||
if (!url.isLocalFile() && !QFileInfo(file).exists()) {
|
||||
if (!url.isLocalFile() && !QFileInfo::exists(file)) {
|
||||
Downloader *downloader = new Downloader(this);
|
||||
connect(downloader, &Downloader::finished, this,
|
||||
&WMTS::capabilitiesReady);
|
||||
|
@ -3,7 +3,6 @@
|
||||
#include <QPainter>
|
||||
#include <QImageReader>
|
||||
#include "image.h"
|
||||
#include "gcs.h"
|
||||
#include "prjfile.h"
|
||||
#include "wldfile.h"
|
||||
#include "worldfilemap.h"
|
||||
|
Reference in New Issue
Block a user