mirror of
https://github.com/tumic0/GPXSee.git
synced 2025-02-20 17:50:49 +01:00
Compare commits
10 Commits
8d4236c898
...
9d60d1c9fc
Author | SHA1 | Date | |
---|---|---|---|
9d60d1c9fc | |||
213ab73ceb | |||
db2d81042b | |||
e27bc437fa | |||
3dd21ade19 | |||
46ea3dd257 | |||
0ed630dd20 | |||
9cd82319e9 | |||
335df85fae | |||
f1b52c7005 |
@ -1,4 +1,4 @@
|
||||
version: 13.34.{build}
|
||||
version: 13.35.{build}
|
||||
|
||||
configuration:
|
||||
- Release
|
||||
|
@ -3,7 +3,7 @@ unix:!macx:!android {
|
||||
} else {
|
||||
TARGET = GPXSee
|
||||
}
|
||||
VERSION = 13.34
|
||||
VERSION = 13.35
|
||||
|
||||
|
||||
QT += core \
|
||||
|
@ -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;application/vnd.gpstuner.gmi
|
||||
MimeType=x-scheme-handler/geo;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
|
||||
|
@ -738,6 +738,20 @@
|
||||
</dict>
|
||||
</array>
|
||||
|
||||
<key>CFBundleURLTypes</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>CFBundleURLSchemes</key>
|
||||
<array>
|
||||
<string>geo</string>
|
||||
</array>
|
||||
<key>CFBundleURLName</key>
|
||||
<string>org.geouri.geo</string>
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>Viewer</string>
|
||||
</dict>
|
||||
</array>
|
||||
|
||||
<key>UTImportedTypeDeclarations</key>
|
||||
<array>
|
||||
<dict>
|
||||
|
@ -18,6 +18,18 @@
|
||||
DeleteRegKey HKCR ".${EXT}"
|
||||
!macroend
|
||||
|
||||
; URI association
|
||||
!macro URI_ASSOCIATION_ADD PROTO
|
||||
WriteRegStr HKCR "${PROTO}" "" "URL:${PROTO}"
|
||||
WriteRegStr HKCR "${PROTO}" "URL Protocol" ""
|
||||
WriteRegStr HKCR "${PROTO}\DefaultIcon" "" "$INSTDIR\GPXSee.exe,0"
|
||||
WriteRegStr HKCR "${PROTO}\shell\open\command" "" "$\"$INSTDIR\GPXSee.exe$\" $\"%1$\""
|
||||
!macroend
|
||||
|
||||
!macro URI_ASSOCIATION_REMOVE PROTO
|
||||
DeleteRegKey HKCR "${PROTO}"
|
||||
!macroend
|
||||
|
||||
; Translations
|
||||
!macro LOCALIZATION LANG CODE
|
||||
Section "${LANG}"
|
||||
@ -37,7 +49,7 @@ Unicode true
|
||||
; The name of the installer
|
||||
Name "GPXSee"
|
||||
; Program version
|
||||
!define VERSION "13.34"
|
||||
!define VERSION "13.35"
|
||||
|
||||
; The file to write
|
||||
OutFile "GPXSee-${VERSION}_x64.exe"
|
||||
@ -200,6 +212,8 @@ Section "GPXSee" SEC_APP
|
||||
!insertmacro FILE_ASSOCIATION_ADD "plt" "OziExplorer Track File" 33
|
||||
!insertmacro FILE_ASSOCIATION_ADD "rte" "OziExplorer Route File" 34
|
||||
|
||||
!insertmacro URI_ASSOCIATION_ADD "geo"
|
||||
|
||||
WriteRegStr HKCR "Applications\GPXSee.exe\shell\open\command" "" "$\"$INSTDIR\GPXSee.exe$\" $\"%1$\""
|
||||
WriteRegStr HKCR ".gpx\OpenWithList" "GPXSee.exe" ""
|
||||
WriteRegStr HKCR ".tcx\OpenWithList" "GPXSee.exe" ""
|
||||
@ -426,6 +440,8 @@ Section "Uninstall"
|
||||
!insertmacro FILE_ASSOCIATION_REMOVE "000"
|
||||
!insertmacro FILE_ASSOCIATION_REMOVE "031"
|
||||
|
||||
!insertmacro URI_ASSOCIATION_REMOVE "geo"
|
||||
|
||||
DeleteRegValue HKCR ".gpx\OpenWithList" "GPXSee.exe"
|
||||
DeleteRegValue HKCR ".tcx\OpenWithList" "GPXSee.exe"
|
||||
DeleteRegValue HKCR ".kml\OpenWithList" "GPXSee.exe"
|
||||
|
@ -1069,6 +1069,16 @@ void GUI::openDir()
|
||||
|
||||
bool GUI::openFile(const QString &fileName, bool tryUnknown, int &showError)
|
||||
{
|
||||
QUrl url(fileName);
|
||||
if (url.scheme() == "geo") {
|
||||
if (loadURL(url, showError)) {
|
||||
_fileActionGroup->setEnabled(true);
|
||||
_reloadFileAction->setEnabled(false);
|
||||
return true;
|
||||
} else if (showError)
|
||||
return false;
|
||||
}
|
||||
|
||||
QFileInfo fi(fileName);
|
||||
QString canonicalFileName(fi.canonicalFilePath());
|
||||
|
||||
@ -1099,6 +1109,36 @@ bool GUI::openFile(const QString &fileName, bool tryUnknown, int &showError)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GUI::loadURL(const QUrl &url, int &showError)
|
||||
{
|
||||
Data data(url);
|
||||
|
||||
if (data.isValid()) {
|
||||
loadData(data);
|
||||
return true;
|
||||
} else {
|
||||
if (showError) {
|
||||
QString error = tr("Error loading geo URI:") + "\n" + url.toString()
|
||||
+ ": " + data.errorString();
|
||||
|
||||
if (showError > 1) {
|
||||
QMessageBox message(QMessageBox::Critical, APP_NAME, error,
|
||||
QMessageBox::Ok, this);
|
||||
QCheckBox checkBox(tr("Don't show again"));
|
||||
message.setCheckBox(&checkBox);
|
||||
message.exec();
|
||||
if (checkBox.isChecked())
|
||||
showError = 0;
|
||||
} else
|
||||
QMessageBox::critical(this, APP_NAME, error);
|
||||
} else
|
||||
qWarning("%s: %s", qUtf8Printable(url.toString()),
|
||||
qUtf8Printable(data.errorString()));
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool GUI::loadFile(const QString &fileName, bool tryUnknown, int &showError)
|
||||
{
|
||||
Data data(fileName, tryUnknown);
|
||||
|
@ -158,6 +158,7 @@ private:
|
||||
#endif // Q_OS_ANDROID
|
||||
bool openPOIFile(const QString &fileName);
|
||||
bool loadFile(const QString &fileName, bool tryUnknown, int &showError);
|
||||
bool loadURL(const QUrl &url, int &showError);
|
||||
void loadData(const Data &data);
|
||||
bool loadMapNode(const TreeNode<Map*> &node, MapAction *&action,
|
||||
const QList<QAction*> &existingActions, int &showError);
|
||||
|
@ -2,6 +2,7 @@
|
||||
#include <QFile>
|
||||
#include <QFileInfo>
|
||||
#include "common/util.h"
|
||||
#include "map/crs.h"
|
||||
#include "gpxparser.h"
|
||||
#include "tcxparser.h"
|
||||
#include "csvparser.h"
|
||||
@ -154,6 +155,70 @@ Data::Data(const QString &fileName, bool tryUnknown)
|
||||
}
|
||||
}
|
||||
|
||||
Data::Data(const QUrl &url)
|
||||
{
|
||||
bool caOk, cbOk, ccOk;
|
||||
Projection proj(GCS::WGS84());
|
||||
|
||||
_valid = false;
|
||||
|
||||
QStringList parts(url.path().split(';'));
|
||||
if (parts.size() < 1) {
|
||||
_errorString = "Syntax error";
|
||||
return;
|
||||
}
|
||||
QStringList coords(parts.at(0).split(','));
|
||||
if (coords.size() < 2 || coords.size() > 3) {
|
||||
_errorString = "Syntax error";
|
||||
return;
|
||||
}
|
||||
double ca = coords.at(0).toDouble(&caOk);
|
||||
double cb = coords.at(1).toDouble(&cbOk);
|
||||
double cc = NAN;
|
||||
if (!(caOk && cbOk)) {
|
||||
_errorString = "Invalid coordinates";
|
||||
return;
|
||||
}
|
||||
if (coords.size() > 2) {
|
||||
cc = coords.at(2).toDouble(&ccOk);
|
||||
if (!ccOk) {
|
||||
_errorString = "Invalid elevation";
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (parts.size() > 1) {
|
||||
QStringList crsp(parts.at(1).split('='));
|
||||
if (crsp.size() != 2) {
|
||||
_errorString = "Syntax error";
|
||||
return;
|
||||
}
|
||||
if (!crsp.at(0).compare("crs", Qt::CaseInsensitive)) {
|
||||
if (crsp.at(1).compare("wgs84", Qt::CaseInsensitive)) {
|
||||
proj = CRS::projection(crsp.at(1));
|
||||
if (!proj.isValid()) {
|
||||
_errorString = "Unknown CRS";
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CoordinateSystem::AxisOrder ao = proj.coordinateSystem().axisOrder();
|
||||
PointD p(ao == CoordinateSystem::XY ? PointD(ca, cb) : PointD(cb, ca));
|
||||
Coordinates c(proj.xy2ll(p));
|
||||
if (!c.isValid()) {
|
||||
_errorString = "Invalid coordinates";
|
||||
return;
|
||||
}
|
||||
|
||||
Waypoint w(c);
|
||||
w.setElevation(cc);
|
||||
_waypoints.append(w);
|
||||
|
||||
_valid = true;
|
||||
}
|
||||
|
||||
QString Data::formats()
|
||||
{
|
||||
return
|
||||
|
@ -14,6 +14,7 @@ class Data
|
||||
{
|
||||
public:
|
||||
Data(const QString &fileName, bool tryUnknown = true);
|
||||
Data(const QUrl &url);
|
||||
|
||||
bool isValid() const {return _valid;}
|
||||
const QString &errorString() const {return _errorString;}
|
||||
|
@ -111,3 +111,13 @@ double DEMTree::elevation(const Coordinates &c) const
|
||||
|
||||
return ele;
|
||||
}
|
||||
|
||||
MatrixD DEMTree::elevation(const MatrixC &m) const
|
||||
{
|
||||
MatrixD ret(m.h(), m.w());
|
||||
|
||||
for (int i = 0; i < m.size(); i++)
|
||||
ret.at(i) = elevation(m.at(i));
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
#define IMG_DEMTREE_H
|
||||
|
||||
#include "common/rtree.h"
|
||||
#include "map/matrix.h"
|
||||
#include "mapdata.h"
|
||||
|
||||
namespace IMG {
|
||||
@ -11,6 +12,7 @@ public:
|
||||
DEMTree(const QList<MapData::Elevation> &tiles);
|
||||
|
||||
double elevation(const Coordinates &c) const;
|
||||
MatrixD elevation(const MatrixC &m) const;
|
||||
|
||||
private:
|
||||
typedef RTree<const MapData::Elevation*, double, 2> Tree;
|
||||
|
@ -483,22 +483,18 @@ MatrixD RasterTile::elevation(int extend) const
|
||||
|
||||
if (_data->hasDEM()) {
|
||||
RectC rect;
|
||||
QList<MapData::Elevation> tiles;
|
||||
|
||||
for (int i = 0; i < ll.size(); i++)
|
||||
rect = rect.united(ll.at(i));
|
||||
// Extra margin for always including the next DEM tile on the map tile
|
||||
// edges (the DEM tile resolution is usally 0.5-15% of the map tile)
|
||||
/* Extra margin for always including the next DEM tile on the map tile
|
||||
edges (the DEM tile resolution is usally 0.5-15% of the map tile) */
|
||||
double factor = 6 - (_zoom - 24) * 1.7;
|
||||
_data->elevations(_file, rect.adjusted(0, 0, rect.width() / factor,
|
||||
-rect.height() / factor), _zoom, &tiles);
|
||||
RectC br(rect.adjusted(0, 0, rect.width() / factor, -rect.height()
|
||||
/ factor));
|
||||
|
||||
DEMTree tree(tiles);
|
||||
MatrixD m(ll.h(), ll.w());
|
||||
for (int i = 0; i < ll.size(); i++)
|
||||
m.at(i) = tree.elevation(ll.at(i));
|
||||
QList<MapData::Elevation> tiles;
|
||||
_data->elevations(_file, br, _zoom, &tiles);
|
||||
|
||||
return m;
|
||||
return DEMTree(tiles).elevation(ll);
|
||||
} else
|
||||
return DEM::elevation(ll);
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ MapList::ParserMap MapList::parsers()
|
||||
return map;
|
||||
}
|
||||
|
||||
MapList::ParserMap MapList::_parsers = parsers();
|
||||
MapList::ParserMap MapList::_parsers = MapList::parsers();
|
||||
|
||||
Map *MapList::loadFile(const QString &path, const Projection &proj, bool *isDir)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user