1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2025-04-21 04:39:10 +02:00

Compare commits

...

2 Commits

9 changed files with 101 additions and 33 deletions

View File

@ -111,5 +111,6 @@
<mimetype>application/vnd.iho.s57-data</mimetype> <mimetype>application/vnd.iho.s57-data</mimetype>
<mimetype>application/vnd.iho.s57-catalogue</mimetype> <mimetype>application/vnd.iho.s57-catalogue</mimetype>
<mimetype>application/vnd.gpsdump.wpt</mimetype> <mimetype>application/vnd.gpsdump.wpt</mimetype>
<mimetype>application/vnd.gpstuner.gmi</mimetype>
</mimetypes> </mimetypes>
</component> </component>

View File

@ -16,4 +16,4 @@ Icon=gpxsee
Terminal=false Terminal=false
Type=Application Type=Application
Categories=Graphics;Viewer;Education;Geography;Maps;Sports;Qt 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

View File

@ -363,4 +363,14 @@
<glob pattern="*.031"/> <glob pattern="*.031"/>
</mime-type> </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> </mime-info>

View File

@ -417,6 +417,22 @@
<key>CFBundleTypeRole</key> <key>CFBundleTypeRole</key>
<string>Viewer</string> <string>Viewer</string>
</dict> </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> <dict>
<key>CFBundleTypeExtensions</key> <key>CFBundleTypeExtensions</key>
<array> <array>
@ -1252,6 +1268,29 @@
<string>application/vnd.oziexplorer.map</string> <string>application/vnd.oziexplorer.map</string>
</dict> </dict>
</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> <dict>
<key>UTTypeIdentifier</key> <key>UTTypeIdentifier</key>
<string>com.mapbox.mbtiles</string> <string>com.mapbox.mbtiles</string>

View File

@ -163,6 +163,7 @@ Section "GPXSee" SEC_APP
!insertmacro FILE_ASSOCIATION_ADD "kap" "BSB Nautical Chart" 10 !insertmacro FILE_ASSOCIATION_ADD "kap" "BSB Nautical Chart" 10
!insertmacro FILE_ASSOCIATION_ADD "gpx" "GPS Exchange Format" 11 !insertmacro FILE_ASSOCIATION_ADD "gpx" "GPS Exchange Format" 11
!insertmacro FILE_ASSOCIATION_ADD "map" "OziExplorer Map File" 12 !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 "mbtiles" "MBTiles Map File" 13
!insertmacro FILE_ASSOCIATION_ADD "rmap" "TwoNav Raster Map File" 14 !insertmacro FILE_ASSOCIATION_ADD "rmap" "TwoNav Raster Map File" 14
!insertmacro FILE_ASSOCIATION_ADD "tba" "TrekBuddy Atlas" 15 !insertmacro FILE_ASSOCIATION_ADD "tba" "TrekBuddy Atlas" 15
@ -218,6 +219,7 @@ Section "GPXSee" SEC_APP
WriteRegStr HKCR ".jnx\OpenWithList" "GPXSee.exe" "" WriteRegStr HKCR ".jnx\OpenWithList" "GPXSee.exe" ""
WriteRegStr HKCR ".kap\OpenWithList" "GPXSee.exe" "" WriteRegStr HKCR ".kap\OpenWithList" "GPXSee.exe" ""
WriteRegStr HKCR ".map\OpenWithList" "GPXSee.exe" "" WriteRegStr HKCR ".map\OpenWithList" "GPXSee.exe" ""
WriteRegStr HKCR ".gmi\OpenWithList" "GPXSee.exe" ""
WriteRegStr HKCR ".mbtiles\OpenWithList" "GPXSee.exe" "" WriteRegStr HKCR ".mbtiles\OpenWithList" "GPXSee.exe" ""
WriteRegStr HKCR ".rmap\OpenWithList" "GPXSee.exe" "" WriteRegStr HKCR ".rmap\OpenWithList" "GPXSee.exe" ""
WriteRegStr HKCR ".rtmap\OpenWithList" "GPXSee.exe" "" WriteRegStr HKCR ".rtmap\OpenWithList" "GPXSee.exe" ""
@ -384,6 +386,7 @@ Section "Uninstall"
!insertmacro FILE_ASSOCIATION_REMOVE "jnx" !insertmacro FILE_ASSOCIATION_REMOVE "jnx"
!insertmacro FILE_ASSOCIATION_REMOVE "kap" !insertmacro FILE_ASSOCIATION_REMOVE "kap"
!insertmacro FILE_ASSOCIATION_REMOVE "map" !insertmacro FILE_ASSOCIATION_REMOVE "map"
!insertmacro FILE_ASSOCIATION_REMOVE "gmi"
!insertmacro FILE_ASSOCIATION_REMOVE "mbtiles" !insertmacro FILE_ASSOCIATION_REMOVE "mbtiles"
!insertmacro FILE_ASSOCIATION_REMOVE "rmap" !insertmacro FILE_ASSOCIATION_REMOVE "rmap"
!insertmacro FILE_ASSOCIATION_REMOVE "tba" !insertmacro FILE_ASSOCIATION_REMOVE "tba"
@ -431,6 +434,7 @@ Section "Uninstall"
DeleteRegValue HKCR ".jnx\OpenWithList" "GPXSee.exe" DeleteRegValue HKCR ".jnx\OpenWithList" "GPXSee.exe"
DeleteRegValue HKCR ".kap\OpenWithList" "GPXSee.exe" DeleteRegValue HKCR ".kap\OpenWithList" "GPXSee.exe"
DeleteRegValue HKCR ".map\OpenWithList" "GPXSee.exe" DeleteRegValue HKCR ".map\OpenWithList" "GPXSee.exe"
DeleteRegValue HKCR ".gmi\OpenWithList" "GPXSee.exe"
DeleteRegValue HKCR ".mbtiles\OpenWithList" "GPXSee.exe" DeleteRegValue HKCR ".mbtiles\OpenWithList" "GPXSee.exe"
DeleteRegValue HKCR ".rmap\OpenWithList" "GPXSee.exe" DeleteRegValue HKCR ".rmap\OpenWithList" "GPXSee.exe"
DeleteRegValue HKCR ".rtmap\OpenWithList" "GPXSee.exe" DeleteRegValue HKCR ".rtmap\OpenWithList" "GPXSee.exe"

View File

@ -27,19 +27,25 @@ static bool yCmp(OziMap *m1, OziMap *m2)
return TL(m1).y() > TL(m2).y(); 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); QDir dir(path);
QFileInfoList files = dir.entryInfoList(QDir::Files); QFileInfoList files(dir.entryInfoList(QDir::Files));
for (int i = 0; i < files.size(); i++) { for (int i = 0; i < files.size(); i++) {
const QFileInfo &fi = files.at(i); const QFileInfo &fi = files.at(i);
QString suffix(fi.suffix().toLower()); QString suffix(fi.suffix().toLower());
if (suffix == "map" || suffix == "gmi") if (suffix == "map") {
type = OziMap::MAP;
return fi.absoluteFilePath(); return fi.absoluteFilePath();
} else if (suffix == "gmi") {
type = OziMap::GMI;
return fi.absoluteFilePath();
}
} }
type = OziMap::Unknown;
return QString(); return QString();
} }
@ -141,16 +147,19 @@ Atlas::Atlas(const QString &fileName, bool TAR, const Projection &proj,
QFileInfoList maps = zdir.entryInfoList(QDir::Dirs QFileInfoList maps = zdir.entryInfoList(QDir::Dirs
| QDir::NoDotAndDotDot); | QDir::NoDotAndDotDot);
for (int i = 0; i < maps.count(); i++) { for (int i = 0; i < maps.count(); i++) {
QString path(maps.at(i).absoluteFilePath());
OziMap *map; OziMap *map;
if (TAR) if (TAR)
map = new OziMap(maps.at(i).absoluteFilePath(), tar, proj, this); map = new OziMap(path, tar, proj, this);
else { else {
QString cf(calibrationFile(maps.at(i).absoluteFilePath())); OziMap::CalibrationType type;
QString cf(calibrationFile(path, type));
if (cf.isNull()) { if (cf.isNull()) {
_errorString = "No calibration file found"; qWarning("%s: no calibration file found", qPrintable(path));
return; continue;
} }
map = new OziMap(cf, proj, this); map = new OziMap(cf, type, proj, this);
} }
if (map->isValid()) if (map->isValid())

View File

@ -43,7 +43,7 @@ MapList::ParserMap MapList::parsers()
map.insert("rtmap", &RMap::create); map.insert("rtmap", &RMap::create);
map.insert("map", &MapsforgeMap::create); map.insert("map", &MapsforgeMap::create);
map.insert("map", &OziMap::createMAP); map.insert("map", &OziMap::createMAP);
map.insert("gmi", &OziMap::createMAP); map.insert("gmi", &OziMap::createGMI);
map.insert("kap", &BSBMap::create); map.insert("kap", &BSBMap::create);
map.insert("kmz", &KMZMap::create); map.insert("kmz", &KMZMap::create);
map.insert("aqm", &AQMMap::create); map.insert("aqm", &AQMMap::create);

View File

@ -54,16 +54,12 @@ QString OziMap::calibrationFile(const QStringList &files, const QString path,
return QString(); return QString();
} }
OziMap::OziMap(const QString &fileName, const Projection &proj, QObject *parent) OziMap::OziMap(const QString &fileName, CalibrationType type,
: Map(fileName, parent), _img(0), _tar(0), _ozf(0), _zoom(0), _mapRatio(1.0), const Projection &proj, QObject *parent) : Map(fileName, parent), _img(0),
_valid(false) _tar(0), _ozf(0), _zoom(0), _mapRatio(1.0), _valid(false)
{ {
QFileInfo fi(fileName); // TAR maps
QString suffix(fi.suffix().toLower()); if (type == Unknown) {
if (suffix == "tar") {
CalibrationType type;
_tar = new Tar(fileName); _tar = new Tar(fileName);
if (!_tar->open()) { if (!_tar->open()) {
_errorString = "Error reading tar file: " + _tar->errorString(); _errorString = "Error reading tar file: " + _tar->errorString();
@ -110,10 +106,12 @@ OziMap::OziMap(const QString &fileName, const Projection &proj, QObject *parent)
return; return;
_tar->close(); _tar->close();
// regular MAP or GMI maps
} else { } else {
QFile file(fileName); QFile file(fileName);
if (suffix == "map") { if (type == MAP) {
MapFile mf(file); MapFile mf(file);
if (!mf.isValid()) { if (!mf.isValid()) {
_errorString = mf.errorString(); _errorString = mf.errorString();
@ -125,7 +123,7 @@ OziMap::OziMap(const QString &fileName, const Projection &proj, QObject *parent)
_projection = mf.projection(); _projection = mf.projection();
_transform = mf.transform(); _transform = mf.transform();
} }
} else if (suffix == "gmi") { } else if (type == GMI) {
GmiFile gmi(file); GmiFile gmi(file);
if (!gmi.isValid()) { if (!gmi.isValid()) {
_errorString = gmi.errorString(); _errorString = gmi.errorString();
@ -138,11 +136,9 @@ OziMap::OziMap(const QString &fileName, const Projection &proj, QObject *parent)
_projection = proj; _projection = proj;
computeTransform(); computeTransform();
} }
} else {
_errorString = "Unknown file type";
return;
} }
QFileInfo fi(fileName);
QDir set(fi.absolutePath() + "/" + "set"); QDir set(fi.absolutePath() + "/" + "set");
if (set.exists()) { if (set.exists()) {
if (!setTileInfo(set.entryList(), set.absolutePath())) if (!setTileInfo(set.entryList(), set.absolutePath()))
@ -373,8 +369,7 @@ void OziMap::drawTiled(QPainter *painter, const QRectF &rect) const
pixmap = QPixmap(tileName); pixmap = QPixmap(tileName);
if (pixmap.isNull()) if (pixmap.isNull())
qWarning("%s: error loading tile image", qPrintable( qWarning("%s: error loading tile image", qPrintable(tileName));
_tile.path.arg(QString::number(x), QString::number(y))));
else { else {
pixmap.setDevicePixelRatio(_mapRatio); pixmap.setDevicePixelRatio(_mapRatio);
QPointF tp(tl.x() + i * ts.width(), tl.y() + j * ts.height()); QPointF tp(tl.x() + i * ts.width(), tl.y() + j * ts.height());
@ -512,7 +507,7 @@ Map *OziMap::createTAR(const QString &path, const Projection &proj, bool *isDir)
if (isDir) if (isDir)
*isDir = false; *isDir = false;
return new OziMap(path, proj); return new OziMap(path, Unknown, proj);
} }
Map *OziMap::createMAP(const QString &path, const Projection &proj, bool *isDir) Map *OziMap::createMAP(const QString &path, const Projection &proj, bool *isDir)
@ -520,5 +515,13 @@ Map *OziMap::createMAP(const QString &path, const Projection &proj, bool *isDir)
if (isDir) if (isDir)
*isDir = false; *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);
} }

View File

@ -15,7 +15,11 @@ class OziMap : public Map
Q_OBJECT Q_OBJECT
public: 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); QObject *parent = 0);
OziMap(const QString &dirName, Tar &tar, const Projection &proj, OziMap(const QString &dirName, Tar &tar, const Projection &proj,
QObject *parent = 0); QObject *parent = 0);
@ -54,12 +58,10 @@ public:
bool *isDir); bool *isDir);
static Map *createMAP(const QString &path, const Projection &proj, static Map *createMAP(const QString &path, const Projection &proj,
bool *isDir); bool *isDir);
static Map *createGMI(const QString &path, const Projection &proj,
bool *isDir);
private: private:
enum CalibrationType {
Unknown, MAP, GMI
};
struct ImageInfo { struct ImageInfo {
QSize size; QSize size;
QString path; QString path;