1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2025-07-03 14:29:16 +02:00

Compare commits

...

13 Commits
5.1 ... 5.2

52 changed files with 248 additions and 85 deletions

View File

@ -1,4 +1,4 @@
version: 5.1.{build}
version: 5.2.{build}
configuration: Release
platform: Any CPU
environment:

View File

@ -1,5 +1,5 @@
TARGET = GPXSee
VERSION = 5.1
VERSION = 5.2
QT += core \
gui \
network

View File

@ -284,7 +284,7 @@
<message>
<location filename="../src/GUI/format.cpp" line="62"/>
<source>nmi</source>
<translation type="unfinished"></translation>
<translation>mpk</translation>
</message>
<message>
<location filename="../src/GUI/format.cpp" line="66"/>
@ -461,32 +461,32 @@
<message>
<location filename="../src/GUI/gui.cpp" line="365"/>
<source>Metric</source>
<translation>Metrijärjestelmä</translation>
<translation>Metriset</translation>
</message>
<message>
<location filename="../src/GUI/gui.cpp" line="370"/>
<source>Imperial</source>
<translation>Brittiläinen järjestelmä</translation>
<translation>Brittiläiset</translation>
</message>
<message>
<location filename="../src/GUI/gui.cpp" line="375"/>
<source>Nautical</source>
<translation type="unfinished"></translation>
<translation>Merelliset</translation>
</message>
<message>
<location filename="../src/GUI/gui.cpp" line="382"/>
<source>Decimal degrees (DD)</source>
<translation type="unfinished"></translation>
<translation>Desimaaliasteet (DD)</translation>
</message>
<message>
<location filename="../src/GUI/gui.cpp" line="387"/>
<source>Degrees and decimal minutes (DMM)</source>
<translation type="unfinished"></translation>
<translation>Asteet, desimaaliminuutit (DMM)</translation>
</message>
<message>
<location filename="../src/GUI/gui.cpp" line="393"/>
<source>Degrees, minutes, seconds (DMS)</source>
<translation type="unfinished"></translation>
<translation>Asteet, minuutit, sekunnit (DMS)</translation>
</message>
<message>
<location filename="../src/GUI/gui.cpp" line="398"/>
@ -556,12 +556,12 @@
<message>
<location filename="../src/GUI/gui.cpp" line="484"/>
<source>Units</source>
<translation>Mittayksiköt</translation>
<translation>Yksiköt</translation>
</message>
<message>
<location filename="../src/GUI/gui.cpp" line="488"/>
<source>Coordinates format</source>
<translation type="unfinished"></translation>
<translation>Koordinaattien muoto</translation>
</message>
<message>
<location filename="../src/GUI/gui.cpp" line="498"/>
@ -799,7 +799,7 @@
<message>
<location filename="../src/GUI/graphview.cpp" line="120"/>
<source>nmi</source>
<translation type="unfinished"></translation>
<translation>mpk</translation>
</message>
<message>
<location filename="../src/GUI/graphview.cpp" line="134"/>
@ -1121,7 +1121,7 @@
<message>
<location filename="../src/GUI/optionsdialog.cpp" line="296"/>
<source>kn</source>
<translation type="unfinished"></translation>
<translation>kn</translation>
</message>
<message>
<location filename="../src/GUI/optionsdialog.cpp" line="299"/>
@ -1161,7 +1161,7 @@
<message>
<location filename="../src/GUI/optionsdialog.cpp" line="331"/>
<source>nmi</source>
<translation type="unfinished"></translation>
<translation>mpk</translation>
</message>
<message>
<location filename="../src/GUI/optionsdialog.cpp" line="334"/>
@ -1363,7 +1363,7 @@
<message>
<location filename="../src/GUI/scaleitem.cpp" line="86"/>
<source>nmi</source>
<translation type="unfinished"></translation>
<translation>mpk</translation>
</message>
<message>
<location filename="../src/GUI/scaleitem.cpp" line="89"/>
@ -1402,7 +1402,7 @@
<message>
<location filename="../src/GUI/speedgraph.cpp" line="83"/>
<source>kn</source>
<translation type="unfinished"></translation>
<translation>kn</translation>
</message>
<message>
<location filename="../src/GUI/speedgraph.cpp" line="86"/>
@ -1425,7 +1425,7 @@
<message>
<location filename="../src/GUI/speedgraphitem.cpp" line="22"/>
<source>kn</source>
<translation type="unfinished"></translation>
<translation>kn</translation>
</message>
<message>
<location filename="../src/GUI/speedgraphitem.cpp" line="24"/>

View File

@ -123,7 +123,7 @@
<message>
<location filename="../src/GUI/elevationgraph.cpp" line="125"/>
<source>ft</source>
<translation>ft</translation>
<translation>фт</translation>
</message>
<message>
<location filename="../src/GUI/elevationgraph.cpp" line="61"/>
@ -141,7 +141,7 @@
<message>
<location filename="../src/GUI/elevationgraphitem.cpp" line="26"/>
<source>ft</source>
<translation>ft</translation>
<translation>фт</translation>
</message>
<message>
<location filename="../src/GUI/elevationgraphitem.cpp" line="28"/>
@ -274,17 +274,17 @@
<location filename="../src/GUI/format.cpp" line="59"/>
<location filename="../src/GUI/format.cpp" line="80"/>
<source>ft</source>
<translation>ft</translation>
<translation>фт</translation>
</message>
<message>
<location filename="../src/GUI/format.cpp" line="55"/>
<source>mi</source>
<translation>mi</translation>
<translation>мл</translation>
</message>
<message>
<location filename="../src/GUI/format.cpp" line="62"/>
<source>nmi</source>
<translation type="unfinished"></translation>
<translation>мор. мл</translation>
</message>
<message>
<location filename="../src/GUI/format.cpp" line="66"/>
@ -471,22 +471,22 @@
<message>
<location filename="../src/GUI/gui.cpp" line="375"/>
<source>Nautical</source>
<translation type="unfinished"></translation>
<translation>Морские</translation>
</message>
<message>
<location filename="../src/GUI/gui.cpp" line="382"/>
<source>Decimal degrees (DD)</source>
<translation type="unfinished"></translation>
<translation>Десятичные градусы (DD)</translation>
</message>
<message>
<location filename="../src/GUI/gui.cpp" line="387"/>
<source>Degrees and decimal minutes (DMM)</source>
<translation type="unfinished"></translation>
<translation>Градусы, десятичные минуты (DMM)</translation>
</message>
<message>
<location filename="../src/GUI/gui.cpp" line="393"/>
<source>Degrees, minutes, seconds (DMS)</source>
<translation type="unfinished"></translation>
<translation>Градусы, минуты, секунды (DMS)</translation>
</message>
<message>
<location filename="../src/GUI/gui.cpp" line="398"/>
@ -561,7 +561,7 @@
<message>
<location filename="../src/GUI/gui.cpp" line="488"/>
<source>Coordinates format</source>
<translation type="unfinished"></translation>
<translation>Формат координат</translation>
</message>
<message>
<location filename="../src/GUI/gui.cpp" line="498"/>
@ -790,17 +790,17 @@
<location filename="../src/GUI/graphview.cpp" line="109"/>
<location filename="../src/GUI/graphview.cpp" line="117"/>
<source>ft</source>
<translation>фут</translation>
<translation>фт</translation>
</message>
<message>
<location filename="../src/GUI/graphview.cpp" line="112"/>
<source>mi</source>
<translation>миля</translation>
<translation>мл</translation>
</message>
<message>
<location filename="../src/GUI/graphview.cpp" line="120"/>
<source>nmi</source>
<translation type="unfinished"></translation>
<translation>мор. мл</translation>
</message>
<message>
<location filename="../src/GUI/graphview.cpp" line="134"/>
@ -1117,12 +1117,12 @@
<message>
<location filename="../src/GUI/optionsdialog.cpp" line="293"/>
<source>mi/h</source>
<translation>mph</translation>
<translation>мл/ч</translation>
</message>
<message>
<location filename="../src/GUI/optionsdialog.cpp" line="296"/>
<source>kn</source>
<translation type="unfinished"></translation>
<translation>уз</translation>
</message>
<message>
<location filename="../src/GUI/optionsdialog.cpp" line="299"/>
@ -1157,12 +1157,12 @@
<message>
<location filename="../src/GUI/optionsdialog.cpp" line="328"/>
<source>mi</source>
<translation>миля</translation>
<translation>мл</translation>
</message>
<message>
<location filename="../src/GUI/optionsdialog.cpp" line="331"/>
<source>nmi</source>
<translation type="unfinished"></translation>
<translation>мор. мл</translation>
</message>
<message>
<location filename="../src/GUI/optionsdialog.cpp" line="334"/>
@ -1353,18 +1353,18 @@
<message>
<location filename="../src/GUI/scaleitem.cpp" line="83"/>
<source>mi</source>
<translation>миля</translation>
<translation>мл</translation>
</message>
<message>
<location filename="../src/GUI/scaleitem.cpp" line="84"/>
<location filename="../src/GUI/scaleitem.cpp" line="87"/>
<source>ft</source>
<translation>фут</translation>
<translation>фт</translation>
</message>
<message>
<location filename="../src/GUI/scaleitem.cpp" line="86"/>
<source>nmi</source>
<translation type="unfinished"></translation>
<translation>мор. мл</translation>
</message>
<message>
<location filename="../src/GUI/scaleitem.cpp" line="89"/>
@ -1403,12 +1403,12 @@
<message>
<location filename="../src/GUI/speedgraph.cpp" line="83"/>
<source>kn</source>
<translation type="unfinished"></translation>
<translation>уз</translation>
</message>
<message>
<location filename="../src/GUI/speedgraph.cpp" line="86"/>
<source>mi/h</source>
<translation>mph</translation>
<translation>мл/ч</translation>
</message>
</context>
<context>
@ -1421,12 +1421,12 @@
<message>
<location filename="../src/GUI/speedgraphitem.cpp" line="21"/>
<source>mi/h</source>
<translation>mph</translation>
<translation>мл/ч</translation>
</message>
<message>
<location filename="../src/GUI/speedgraphitem.cpp" line="22"/>
<source>kn</source>
<translation type="unfinished"></translation>
<translation>уз</translation>
</message>
<message>
<location filename="../src/GUI/speedgraphitem.cpp" line="24"/>

58
pkg/appdata.xml Normal file
View File

@ -0,0 +1,58 @@
<?xml version="1.0" encoding="UTF-8"?>
<component type="desktop">
<id>gpxsee.desktop</id>
<metadata_license>MIT</metadata_license>
<project_license>GPL-3.0</project_license>
<name>GPXSee</name>
<summary>GPS log file viewer and analyzer</summary>
<description>
<p>GPXSee is a GPS log file viewer and analyzer that supports GPX, TCX,
KML, FIT, IGC and NMEA files.</p>
<p>Features:</p>
<ul>
<li>User-definable online maps.</li>
<li>Offline maps (OziExplorer maps, TrekBuddy maps/atlases, GeoTIFF
images).</li>
<li>Elevation, speed, heart rate, cadence, power and temperature
graphs.</li>
<li>Support for multiple tracks in one view.</li>
<li>Support for POI files.</li>
<li>Print/export to PDF.</li>
<li>Full-screen mode.</li>
<li>Opens GPX, TCX, FIT, KML, IGC, NMEA and Garmin CSV files.</li>
</ul>
</description>
<screenshots>
<screenshot type="default">
<image>http://www.gpxsee.org/gallery/lin1.png</image>
</screenshot>
<screenshot>
<image>http://www.gpxsee.org/gallery/lin2.png</image>
</screenshot>
</screenshots>
<categories>
<category>Graphics</category>
<category>Viewer</category>
</categories>
<url type="homepage">http://www.gpxsee.org</url>
<launchable type="desktop-id">gpxsee.desktop</launchable>
<provides>
<binary>gpxsee</binary>
</provides>
<mimetypes>
<mimetype>application/gpx+xml</mimetype>
<mimetype>application/tcx+xml</mimetype>
<mimetype>application/vnd.ant.fit</mimetype>
<mimetype>application/vnd.google-earth.kml+xml</mimetype>
<mimetype>application/vnd.fai.igc</mimetype>
<mimetype>application/vnd.nmea.nmea</mimetype>
</mimetypes>
</component>

View File

@ -5,7 +5,7 @@
; The name of the installer
Name "GPXSee"
; Program version
!define VERSION "5.1"
!define VERSION "5.2"
; The file to write
OutFile "GPXSee-${VERSION}.exe"

View File

@ -5,7 +5,7 @@
; The name of the installer
Name "GPXSee"
; Program version
!define VERSION "5.1"
!define VERSION "5.2"
; The file to write
OutFile "GPXSee-${VERSION}_x64.exe"

View File

@ -4,4 +4,5 @@
<url>http://4umaps.eu/$z/$x/$y.png</url>
<zoom min="2" max="15"/>
<bounds bottom="-65"/>
<copyright>Map data: © OpenStreetMap contributors (ODbL) | Rendering: © 4UMaps.eu</copyright>
</map>

View File

@ -2,4 +2,5 @@
<map>
<name>Open Street Map</name>
<url>http://tile.openstreetmap.org/$z/$x/$y.png</url>
<copyright>Map data: © OpenStreetMap contributors (ODbL) | Rendering: © OpenStreetMap (CC-BY-SA)</copyright>
</map>

View File

@ -3,4 +3,5 @@
<name>Open Topo Map</name>
<url>https://a.tile.opentopomap.org/$z/$x/$y.png</url>
<zoom max="17"/>
<copyright>Map data: © OpenStreetMap contributors (ODbL), SRTM | Rendering: © OpenTopoMap (CC-BY-SA)</copyright>
</map>

View File

@ -4,4 +4,5 @@
<url>https://navigator.er.usgs.gov/tiles/aerial_Imagery.cgi/$z/$x/$y</url>
<zoom min="2" max="15"/>
<bounds bottom="0" top="74"/>
<copyright>Map services and data available from U.S. Geological Survey, National Geospatial Program.</copyright>
</map>

View File

@ -3,4 +3,5 @@
<name>USGS Topo</name>
<url>https://navigator.er.usgs.gov/tiles/tcr.cgi/$z/$x/$y.png</url>
<zoom min="2" max="15"/>
<copyright>Map services and data available from U.S. Geological Survey, National Geospatial Program.</copyright>
</map>

View File

@ -1147,7 +1147,7 @@ bool GUI::loadMap(const QString &fileName)
_mapMenu->insertAction(_mapsEnd, a);
_showMapAction->setEnabled(true);
_clearMapCacheAction->setEnabled(true);
_mapActions.last()->activate(QAction::Trigger);
_mapActions.last()->trigger();
return true;
} else {
@ -1394,15 +1394,15 @@ void GUI::keyPressEvent(QKeyEvent *event)
case TOGGLE_GRAPH_TYPE_KEY:
if (_timeGraphAction->isChecked())
_distanceGraphAction->activate(QAction::Trigger);
_distanceGraphAction->trigger();
else
_timeGraphAction->activate(QAction::Trigger);
_timeGraphAction->trigger();
break;
case TOGGLE_TIME_TYPE_KEY:
if (_movingTimeAction->isChecked())
_totalTimeAction->activate(QAction::Trigger);
_totalTimeAction->trigger();
else
_movingTimeAction->activate(QAction::Trigger);
_movingTimeAction->trigger();
break;
case Qt::Key_Escape:
@ -1647,25 +1647,25 @@ void GUI::readSettings()
settings.beginGroup(SETTINGS_SETTINGS_GROUP);
if (settings.value(TIME_TYPE_SETTING, TIME_TYPE_DEFAULT).toInt()
== Moving)
_movingTimeAction->activate(QAction::Trigger);
_movingTimeAction->trigger();
else
_totalTimeAction->activate(QAction::Trigger);
_totalTimeAction->trigger();
value = settings.value(UNITS_SETTING, UNITS_DEFAULT).toInt();
if (value == Imperial)
_imperialUnitsAction->activate(QAction::Trigger);
_imperialUnitsAction->trigger();
else if (value == Nautical)
_nauticalUnitsAction->activate(QAction::Trigger);
_nauticalUnitsAction->trigger();
else
_metricUnitsAction->activate(QAction::Trigger);
_metricUnitsAction->trigger();
value = settings.value(COORDINATES_SETTING, COORDINATES_DEFAULT).toInt();
if (value == DMS)
_DMSAction->activate(QAction::Trigger);
_DMSAction->trigger();
else if (value == DegreesMinutes)
_degreesMinutesAction->activate(QAction::Trigger);
_degreesMinutesAction->trigger();
else
_decimalDegreesAction->activate(QAction::Trigger);
_decimalDegreesAction->trigger();
if (!settings.value(SHOW_TOOLBARS_SETTING, SHOW_TOOLBARS_DEFAULT).toBool())
showToolbars(false);
@ -1676,6 +1676,8 @@ void GUI::readSettings()
settings.beginGroup(MAP_SETTINGS_GROUP);
if (settings.value(SHOW_MAP_SETTING, SHOW_MAP_DEFAULT).toBool())
_showMapAction->setChecked(true);
else
_mapView->showMap(false);
if (_ml->maps().count()) {
int index = mapIndex(settings.value(CURRENT_MAP_SETTING).toString());
_mapActions.at(index)->trigger();

View File

@ -25,11 +25,13 @@ private:
qreal _left, _top, _right, _bottom;
};
#ifndef QT_NO_DEBUG
inline QDebug operator<<(QDebug dbg, const MarginsF &margins)
{
dbg.nospace() << "MarginsF(" << margins.left() << ", " << margins.top()
<< ", " << margins.right() << margins.bottom() << ")";
return dbg.space();
}
#endif // QT_NO_DEBUG
#endif // MARGINS_H

View File

@ -37,9 +37,11 @@ void Palette::reset()
_state = _h;
}
#ifndef QT_NO_DEBUG
QDebug operator<<(QDebug dbg, const Palette &palette)
{
dbg.nospace() << "Palette(" << palette.color() << ", " << palette.shift()
<< ")";
return dbg.space();
}
#endif // QT_NO_DEBUG

View File

@ -28,6 +28,8 @@ private:
qreal _state;
};
#ifndef QT_NO_DEBUG
QDebug operator<<(QDebug dbg, const Palette &palette);
#endif // QT_NO_DEBUG
#endif // PALLETE_H

View File

@ -16,12 +16,6 @@ qreal Coordinates::distanceTo(const Coordinates &c) const
return (WGS84_RADIUS * (2.0 * atan2(sqrt(a), sqrt(1.0 - a))));
}
QDebug operator<<(QDebug dbg, const Coordinates &c)
{
dbg.nospace() << "Coordinates(" << c.lon() << ", " << c.lat() << ")";
return dbg.space();
}
QPair<Coordinates, Coordinates> Coordinates::boundingRect(qreal distance) const
{
qreal radDist = distance / WGS84_RADIUS;
@ -50,3 +44,11 @@ QPair<Coordinates, Coordinates> Coordinates::boundingRect(qreal distance) const
maxLon)), rad2deg(qMin(minLat, maxLat))), Coordinates(rad2deg(qMax(minLon,
maxLon)), rad2deg(qMax(minLat, maxLat))));
}
#ifndef QT_NO_DEBUG
QDebug operator<<(QDebug dbg, const Coordinates &c)
{
dbg.nospace() << "Coordinates(" << c.lon() << ", " << c.lat() << ")";
return dbg.space();
}
#endif // QT_NO_DEBUG

View File

@ -43,6 +43,8 @@ inline bool operator==(const Coordinates &c1, const Coordinates &c2)
inline bool operator!=(const Coordinates &c1, const Coordinates &c2)
{return !(c1 == c2);}
#ifndef QT_NO_DEBUG
QDebug operator<<(QDebug dbg, const Coordinates &c);
#endif // QT_NO_DEBUG
#endif // COORDINATES_H

View File

@ -8,6 +8,7 @@ void RangeF::resize(qreal size)
_max += adj;
}
#ifndef QT_NO_DEBUG
QDebug operator<<(QDebug dbg, const Range &range)
{
dbg.nospace() << "Range(" << range.min() << ", " << range.max() << ")";
@ -19,3 +20,4 @@ QDebug operator<<(QDebug dbg, const RangeF &range)
dbg.nospace() << "RangeF(" << range.min() << ", " << range.max() << ")";
return dbg.space();
}
#endif // QT_NO_DEBUG

View File

@ -34,7 +34,9 @@ private:
qreal _min, _max;
};
#ifndef QT_NO_DEBUG
QDebug operator<<(QDebug dbg, const Range &range);
QDebug operator<<(QDebug dbg, const RangeF &range);
#endif // QT_NO_DEBUG
#endif // RANGE_H

View File

@ -61,8 +61,10 @@ void RectC::unite(const Coordinates &c)
}
}
#ifndef QT_NO_DEBUG
QDebug operator<<(QDebug dbg, const RectC &rect)
{
dbg.nospace() << "RectC(" << rect.topLeft() << ", " << rect.size() << ")";
return dbg.space();
}
#endif // QT_NO_DEBUG

View File

@ -37,6 +37,8 @@ private:
Coordinates _tl, _br;
};
#ifndef QT_NO_DEBUG
QDebug operator<<(QDebug dbg, const RectC &rect);
#endif // QT_NO_DEBUG
#endif // RECTC_H

View File

@ -30,12 +30,14 @@ private:
Q_DECLARE_TYPEINFO(GraphPoint, Q_PRIMITIVE_TYPE);
#ifndef QT_NO_DEBUG
inline QDebug operator<<(QDebug dbg, const GraphPoint &point)
{
dbg.nospace() << "GraphPoint(" << point.s() << ", " << point.t() << ", "
<< point.y() << ")";
return dbg.space();
}
#endif // QT_NO_DEBUG
typedef QVector<GraphPoint> Graph;

View File

@ -13,9 +13,11 @@ RectC Path::boundingRect() const
return ret;
}
#ifndef QT_NO_DEBUG
QDebug operator<<(QDebug dbg, const PathPoint &point)
{
dbg.nospace() << "PathPoint(" << point.distance() << ", "
<< point.coordinates() << ")";
return dbg.space();
}
#endif // QT_NO_DEBUG

View File

@ -23,7 +23,9 @@ private:
};
Q_DECLARE_TYPEINFO(PathPoint, Q_PRIMITIVE_TYPE);
#ifndef QT_NO_DEBUG
QDebug operator<<(QDebug dbg, const PathPoint &point);
#endif // QT_NO_DEBUG
class Path : public QVector<PathPoint>

View File

@ -49,9 +49,7 @@ static QSet<int> eliminate(const QVector<qreal> &v, int window)
static Graph filter(const Graph &g, int window)
{
if (g.size() < window)
return Graph();
if (window < 2)
if (g.size() < window || window < 2)
return Graph(g);
qreal acc = 0;
@ -77,27 +75,32 @@ static Graph filter(const Graph &g, int window)
Track::Track(const TrackData &data) : _data(data)
{
qreal dt, ds, total;
int last;
_time.append(0);
_distance.append(0);
_speed.append(0);
for (int i = 1; i < data.count(); i++) {
ds = data.at(i).coordinates().distanceTo(data.at(i-1).coordinates());
last = 0;
for (int i = 1; i < _data.count(); i++) {
ds = _data.at(i).coordinates().distanceTo(_data.at(i-1).coordinates());
_distance.append(ds);
if (data.first().hasTimestamp() && data.at(i).hasTimestamp())
if (_data.first().hasTimestamp() && _data.at(i).hasTimestamp()
&& _data.at(i).timestamp() > _data.at(last).timestamp()) {
_time.append(_data.first().timestamp().msecsTo(
_data.at(i).timestamp()) / 1000.0);
else
last = i;
} else
_time.append(NAN);
if (std::isnan(_time.at(i)) || std::isnan(_time.at(i-1)))
_speed.append(NAN);
else {
dt = _time.at(i) - _time.at(i-1);
if (!dt) {
if (dt < 1e-3) {
_speed.append(_speed.at(i-1));
continue;
}
@ -106,7 +109,7 @@ Track::Track(const TrackData &data) : _data(data)
}
_pause = 0;
for (int i = 1; i < data.count(); i++) {
for (int i = 1; i < _data.count(); i++) {
if (_time.at(i) > _time.at(i-1) + _pauseInterval
&& _speed.at(i) < _pauseSpeed) {
_pause += _time.at(i) - _time.at(i-1);

View File

@ -57,6 +57,7 @@ private:
Q_DECLARE_TYPEINFO(Trackpoint, Q_MOVABLE_TYPE);
#ifndef QT_NO_DEBUG
inline QDebug operator<<(QDebug dbg, const Trackpoint &trackpoint)
{
dbg.nospace() << "Trackpoint(" << trackpoint.coordinates() << ", "
@ -65,5 +66,6 @@ inline QDebug operator<<(QDebug dbg, const Trackpoint &trackpoint)
<< trackpoint.temperature() << ")";
return dbg.space();
}
#endif // QT_NO_DEBUG
#endif // TRACKPOINT_H

View File

@ -48,12 +48,14 @@ inline uint qHash(const Waypoint &key)
return ::qHash(key.name());
}
#ifndef QT_NO_DEBUG
inline QDebug operator<<(QDebug dbg, const Waypoint &waypoint)
{
dbg.nospace() << "Waypoint(" << waypoint.coordinates() << ", "
<< waypoint.name() << ", " << waypoint.description() << ")";
return dbg.space();
}
#endif // QT_NO_DEBUG
Q_DECLARE_TYPEINFO(Waypoint, Q_MOVABLE_TYPE);

View File

@ -83,8 +83,10 @@ double AngularUnits::fromDegrees(double val) const
return (_code == 9110) ? deg2sDMS(val) : val / _f;
}
#ifndef QT_NO_DEBUG
QDebug operator<<(QDebug dbg, const AngularUnits &au)
{
dbg.nospace() << "AngularUnits(" << deg2rad(au._f) << ")";
return dbg.space();
}
#endif // QT_NO_DEBUG

View File

@ -17,8 +17,9 @@ public:
double fromDegrees(double val) const;
friend bool operator==(const AngularUnits &au1, const AngularUnits &au2);
#ifndef QT_NO_DEBUG
friend QDebug operator<<(QDebug dbg, const AngularUnits &au);
#endif // QT_NO_DEBUG
private:
int _code;
double _f;
@ -27,6 +28,8 @@ private:
inline bool operator==(const AngularUnits &au1, const AngularUnits &au2)
{return (au1._f == au2._f);}
#ifndef QT_NO_DEBUG
QDebug operator<<(QDebug dbg, const AngularUnits &au);
#endif // QT_NO_DEBUG
#endif // ANGULARUNITS_H

View File

@ -61,9 +61,11 @@ Coordinates Datum::fromWGS84(const Coordinates &c) const
return _WGS84 ? c : molodensky(c, WGS84, *this);
}
#ifndef QT_NO_DEBUG
QDebug operator<<(QDebug dbg, const Datum &datum)
{
dbg.nospace() << "Datum(" << *datum.ellipsoid() << ", " << datum.dx()
<< ", " << datum.dy() << ", " << datum.dz() << ")";
return dbg.space();
}
#endif // QT_NO_DEBUG

View File

@ -39,6 +39,8 @@ inline bool operator==(const Datum &d1, const Datum &d2)
{return (d1.ellipsoid() == d2.ellipsoid() && d1.dx() == d2.dx()
&& d1.dy() == d2.dy() && d1.dz() == d2.dz());}
#ifndef QT_NO_DEBUG
QDebug operator<<(QDebug dbg, const Datum &datum);
#endif // QT_NO_DEBUG
#endif // DATUM_H

View File

@ -66,9 +66,11 @@ void Ellipsoid::loadList(const QString &path)
}
}
#ifndef QT_NO_DEBUG
QDebug operator<<(QDebug dbg, const Ellipsoid &ellipsoid)
{
dbg.nospace() << "Ellipsoid(" << ellipsoid.radius() << ", "
<< 1.0 / ellipsoid.flattening() << ")";
return dbg.space();
}
#endif // QT_NO_DEBUG

View File

@ -35,6 +35,8 @@ private:
inline bool operator==(const Ellipsoid &e1, const Ellipsoid &e2)
{return (e1.radius() == e2.radius() && e1.flattening() == e2.flattening());}
#ifndef QT_NO_DEBUG
QDebug operator<<(QDebug dbg, const Ellipsoid &ellipsoid);
#endif // QT_NO_DEBUG
#endif // ELLIPSOID_H

View File

@ -3,13 +3,23 @@
#include "common/coordinates.h"
#include "common/rectc.h"
#include "common/wgs84.h"
#include "mercator.h"
#include "emptymap.h"
#define SCALE_MIN 0.5
#define SCALE_MAX 1.0E-6
static QPointF ll2m(const Coordinates &c)
{
return QPointF(c.lon(), rad2deg(log(tan(M_PI/4.0 + deg2rad(c.lat())/2.0))));
}
static Coordinates m2ll(const QPointF &p)
{
return Coordinates(p.x(), rad2deg(2 * atan(exp(deg2rad(p.y()))) - M_PI/2));
}
EmptyMap::EmptyMap(QObject *parent) : Map(parent)
{
_scale = SCALE_MAX;
@ -25,8 +35,7 @@ qreal EmptyMap::zoomFit(const QSize &size, const RectC &br)
if (!br.isValid())
_scale = SCALE_MAX;
else {
QRectF tbr(Mercator().ll2xy(br.topLeft()),
Mercator().ll2xy(br.bottomRight()));
QRectF tbr(ll2m(br.topLeft()), ll2m(br.bottomRight()));
QPointF sc(tbr.width() / size.width(), tbr.height() / size.height());
_scale = qMax(sc.x(), sc.y());
}
@ -73,12 +82,12 @@ void EmptyMap::draw(QPainter *painter, const QRectF &rect)
QPointF EmptyMap::ll2xy(const Coordinates &c) const
{
QPointF m = Mercator().ll2xy(c);
QPointF m = ll2m(c);
return QPointF(m.x() / _scale, m.y() / -_scale);
}
Coordinates EmptyMap::xy2ll(const QPointF &p) const
{
QPointF m(p.x() * _scale, -p.y() * _scale);
return Mercator().xy2ll(m);
return m2ll(QPointF(p.x() * _scale, -p.y() * _scale));
}

View File

@ -183,9 +183,11 @@ Coordinates GCS::fromWGS84(const Coordinates &c) const
return Coordinates(_primeMeridian.fromGreenwich(ds.lon()), ds.lat());
}
#ifndef QT_NO_DEBUG
QDebug operator<<(QDebug dbg, const GCS &gcs)
{
dbg.nospace() << "GCS(" << gcs.datum() << ", " << gcs.primeMeridian()
<< ", " << gcs.angularUnits() << ")";
return dbg.space();
}
#endif // QT_NO_DEBUG

View File

@ -50,6 +50,8 @@ inline bool operator==(const GCS &gcs1, const GCS &gcs2)
&& gcs1.primeMeridian() == gcs2.primeMeridian()
&& gcs1.angularUnits() == gcs2.angularUnits());}
#ifndef QT_NO_DEBUG
QDebug operator<<(QDebug dbg, const GCS &gcs);
#endif // QT_NO_DEBUG
#endif // GCS_H

View File

@ -20,8 +20,10 @@ LinearUnits::LinearUnits(int code)
}
}
#ifndef QT_NO_DEBUG
QDebug operator<<(QDebug dbg, const LinearUnits &lu)
{
dbg.nospace() << "LinearUnits(" << lu._f << ")";
return dbg.space();
}
#endif // QT_NO_DEBUG

View File

@ -22,7 +22,9 @@ public:
{return QPointF(p.x() / _f, p.y() /_f);}
friend bool operator==(const LinearUnits &lu1, const LinearUnits &lu2);
#ifndef QT_NO_DEBUG
friend QDebug operator<<(QDebug dbg, const LinearUnits &lu);
#endif // QT_NO_DEBUG
private:
double _f;
@ -31,6 +33,8 @@ private:
inline bool operator==(const LinearUnits &lu1, const LinearUnits &lu2)
{return (lu1._f == lu2._f);}
#ifndef QT_NO_DEBUG
QDebug operator<<(QDebug dbg, const LinearUnits &lu);
#endif // QT_NO_DEBUG
#endif // LINEARUNITS_H

View File

@ -116,6 +116,7 @@ void Matrix::zeroize()
_m[i] = 0;
}
#ifndef QT_NO_DEBUG
QDebug operator<<(QDebug dbg, const Matrix &matrix)
{
dbg.nospace() << "Matrix(" << endl;
@ -128,3 +129,4 @@ QDebug operator<<(QDebug dbg, const Matrix &matrix)
return dbg.space();
}
#endif // QT_NO_DEBUG

View File

@ -31,6 +31,8 @@ private:
size_t _w;
};
#ifndef QT_NO_DEBUG
QDebug operator<<(QDebug dbg, const Matrix &matrix);
#endif // QT_NO_DEBUG
#endif // MATRIX_H

View File

@ -1,12 +1,16 @@
#include <cmath>
#include "common/coordinates.h"
#include "common/wgs84.h"
#include "mercator.h"
QPointF Mercator::ll2xy(const Coordinates &c) const
{
return QPointF(c.lon(), rad2deg(log(tan(M_PI/4.0 + deg2rad(c.lat())/2.0))));
return QPointF(deg2rad(c.lon()) * WGS84_RADIUS,
log(tan(M_PI/4.0 + deg2rad(c.lat())/2.0)) * WGS84_RADIUS);
}
Coordinates Mercator::xy2ll(const QPointF &p) const
{
return Coordinates(p.x(), rad2deg(2 * atan(exp(deg2rad(p.y()))) - M_PI/2));
return Coordinates(rad2deg(p.x() / WGS84_RADIUS),
rad2deg(2 * atan(exp(p.y() / WGS84_RADIUS)) - M_PI/2));
}

View File

@ -4,7 +4,6 @@
#include "common/coordinates.h"
#include "common/rectc.h"
#include "common/wgs84.h"
#include "mercator.h"
#include "downloader.h"
#include "config.h"
#include "onlinemap.h"
@ -12,6 +11,16 @@
#define TILE_SIZE 256
static QPointF ll2m(const Coordinates &c)
{
return QPointF(c.lon(), rad2deg(log(tan(M_PI/4.0 + deg2rad(c.lat())/2.0))));
}
static Coordinates m2ll(const QPointF &p)
{
return Coordinates(p.x(), rad2deg(2 * atan(exp(deg2rad(p.y()))) - M_PI/2));
}
static QPoint mercator2tile(const QPointF &m, int z)
{
QPoint tile;
@ -183,8 +192,7 @@ qreal OnlineMap::zoomFit(const QSize &size, const RectC &br)
if (!br.isValid())
_zoom = _zooms.max();
else {
QRectF tbr(Mercator().ll2xy(br.topLeft()),
Mercator().ll2xy(br.bottomRight()));
QRectF tbr(ll2m(br.topLeft()), ll2m(br.bottomRight()));
QPointF sc(tbr.width() / size.width(), tbr.height() / size.height());
_zoom = limitZoom(scale2zoom(qMax(sc.x(), sc.y())));
@ -252,13 +260,12 @@ void OnlineMap::draw(QPainter *painter, const QRectF &rect)
QPointF OnlineMap::ll2xy(const Coordinates &c) const
{
qreal scale = zoom2scale(_zoom);
QPointF m = Mercator().ll2xy(c);
QPointF m = ll2m(c);
return QPointF(m.x() / scale, m.y() / -scale);
}
Coordinates OnlineMap::xy2ll(const QPointF &p) const
{
qreal scale = zoom2scale(_zoom);
QPointF m(p.x() * scale, -p.y() * scale);
return Mercator().xy2ll(m);
return m2ll(QPointF(p.x() * scale, -p.y() * scale));
}

View File

@ -187,9 +187,11 @@ void PCS::loadList(const QString &path)
}
}
#ifndef QT_NO_DEBUG
QDebug operator<<(QDebug dbg, const PCS &pcs)
{
dbg.nospace() << "PCS(" << *pcs.gcs() << ", " << pcs.method() << ", "
<< pcs.units() << ", " << pcs.setup() << ")";
return dbg.space();
}
#endif // QT_NO_DEBUG

View File

@ -43,6 +43,8 @@ private:
static GCS _nullGCS;
};
#ifndef QT_NO_DEBUG
QDebug operator<<(QDebug dbg, const PCS &pcs);
#endif // QT_NO_DEBUG
#endif // PCS_H

View File

@ -66,8 +66,10 @@ double PrimeMeridian::fromGreenwich(double val) const
return shift(val, -_pm);
}
#ifndef QT_NO_DEBUG
QDebug operator<<(QDebug dbg, const PrimeMeridian &pm)
{
dbg.nospace() << "PrimeMeridian(" << pm._pm << ")";
return dbg.space();
}
#endif // QT_NO_DEBUG

View File

@ -17,7 +17,9 @@ public:
double fromGreenwich(double val) const;
friend bool operator==(const PrimeMeridian &pm1, const PrimeMeridian &pm2);
#ifndef QT_NO_DEBUG
friend QDebug operator<<(QDebug dbg, const PrimeMeridian &pm);
#endif // QT_NO_DEBUG
private:
double _pm;
@ -26,6 +28,8 @@ private:
inline bool operator==(const PrimeMeridian &pm1, const PrimeMeridian &pm2)
{return (pm1._pm == pm2._pm);}
#ifndef QT_NO_DEBUG
QDebug operator<<(QDebug dbg, const PrimeMeridian &pm);
#endif // QT_NO_DEBUG
#endif // PRIMEMERIDIAN_H

View File

@ -105,6 +105,7 @@ Coordinates Projection::xy2ll(const QPointF &p) const
return _gcs->toWGS84(_ct->xy2ll(_units.toMeters(p)));
}
#ifndef QT_NO_DEBUG
QDebug operator<<(QDebug dbg, const Projection::Setup &setup)
{
dbg.nospace() << "Setup(" << setup.latitudeOrigin() << ", "
@ -119,3 +120,4 @@ QDebug operator<<(QDebug dbg, const Projection::Method &method)
dbg.nospace() << "Method(" << method.id() << ")";
return dbg.space();
}
#endif // QT_NO_DEBUG

View File

@ -86,7 +86,9 @@ private:
LinearUnits _units;
};
#ifndef QT_NO_DEBUG
QDebug operator<<(QDebug dbg, const Projection::Setup &setup);
QDebug operator<<(QDebug dbg, const Projection::Method &method);
#endif // QT_NO_DEBUG
#endif // PROJECTION_H

View File

@ -21,10 +21,12 @@ private:
QPixmap _pixmap;
};
#ifndef QT_NO_DEBUG
inline QDebug operator<<(QDebug dbg, const Tile &tile)
{
dbg.nospace() << "Tile(" << tile.zoom() << ", " << tile.xy() << ")";
return dbg.space();
}
#endif // QT_NO_DEBUG
#endif // TILE_H

View File

@ -73,8 +73,10 @@ Transform::Transform(const QList<ReferencePoint> &points)
affine(points);
}
#ifndef QT_NO_DEBUG
QDebug operator<<(QDebug dbg, const ReferencePoint &p)
{
dbg.nospace() << "ReferencePoint(" << p.xy << ", " << p.pp << ")";
return dbg.space();
}
#endif // QT_NO_DEBUG

View File

@ -27,6 +27,8 @@ private:
QString _errorString;
};
#ifndef QT_NO_DEBUG
QDebug operator<<(QDebug dbg, const ReferencePoint &p);
#endif // QT_NO_DEBUG
#endif // TRANSFORM_H