diff --git a/lang/gpxsee_cs.ts b/lang/gpxsee_cs.ts
index 573a38fb..458ab026 100644
--- a/lang/gpxsee_cs.ts
+++ b/lang/gpxsee_cs.ts
@@ -34,12 +34,12 @@
Klesání
-
+
Minimum
Minimum
-
+
Maximum
Maximum
@@ -47,118 +47,123 @@
GUI
-
+
About Qt
O Qt
-
+
GPXSee is distributed under the terms of the GNU General Public License version 3. For more info about GPXSee visit the project homepage at
Program GPXSee je distribuován pod podmínkami licence GNU General Public License verze 3. Pro více informací navštivte stránky programu na adrese
-
+
Open file
Otevřít soubor
-
+
Save as
Uložit jako
-
+
Open POI file
Otevřít POI soubor
-
+
Open
Otevřít
-
+
Quit
Ukončit
-
+
Save
Uložit
-
+
Close
Zavřít
-
+
Load file
Nahrát soubor
-
+
Show
Zobrazit
-
-
+
+
File
Soubor
-
-
+
+
POI
POI
-
+
Help
Nápověda
-
+
Elevation
Výška
-
+
Speed
Rychlost
-
-
+
+
About GPXSee
O aplikaci GPXSee
-
+
GPX viewer and analyzer
Prohlížeč a analyzátor GPX
-
+
%1 tracks
Počet tras: %1
-
-
+
+ km
+ km
+
+
+
+
Error
Chyba
-
+
Error loading GPX file:
%1
Soubor GPX nelze otevřít:
%1
-
+
Error loading POI file:
%1
Soubor POI nelze otevřít:
diff --git a/src/gpx.cpp b/src/gpx.cpp
index 05a35ec6..6e8d5aeb 100644
--- a/src/gpx.cpp
+++ b/src/gpx.cpp
@@ -29,16 +29,15 @@ bool GPX::loadFile(const QString &fileName)
void GPX::elevationGraph(QVector &graph) const
{
- qreal dist = 0, ds, dh, acc;
+ qreal dist = 0, dh, acc;
if (!_data.size())
return;
graph.append(QPointF(0, _data.at(0).elevation));
for (int i = 1; i < _data.size(); i++) {
- ds = llDistance(_data.at(i).coordinates, _data.at(i-1).coordinates);
+ dist += llDistance(_data.at(i).coordinates, _data.at(i-1).coordinates);
dh = _data.at(i).elevation;
- dist += ds;
acc = (i == 1) ? dh : (ALPHA_E * dh) + (1.0 - ALPHA_E) * acc;
graph.append(QPointF(dist, acc));
}
@@ -73,3 +72,22 @@ void GPX::track(QVector &track) const
track.append(p);
}
}
+
+qreal GPX::distance()
+{
+ qreal dist = 0;
+
+ for (int i = 1; i < _data.size(); i++)
+ dist += llDistance(_data.at(i).coordinates, _data.at(i-1).coordinates);
+
+ return dist;
+}
+
+qreal GPX::time()
+{
+ if (_data.size() < 2)
+ return 0;
+
+ return (_data.at(0).timestamp.msecsTo(_data.at(_data.size() - 1).timestamp)
+ / 1000.0);
+}
diff --git a/src/gpx.h b/src/gpx.h
index fff54d3e..2e062d72 100644
--- a/src/gpx.h
+++ b/src/gpx.h
@@ -15,6 +15,8 @@ public:
void elevationGraph(QVector &graph) const;
void speedGraph(QVector &graph) const;
void track(QVector &track) const;
+ qreal distance();
+ qreal time();
private:
Parser _parser;
diff --git a/src/gui.cpp b/src/gui.cpp
index 288c5b40..3072f918 100644
--- a/src/gui.cpp
+++ b/src/gui.cpp
@@ -20,6 +20,18 @@
#include
+static QString timeSpan(qreal time)
+{
+ unsigned h, m, s;
+
+ h = time / 3600;
+ m = (time - (h * 3600)) / 60;
+ s = time - (h * 3600) - (m * 60);
+
+ return QString("%1:%2:%3").arg(h).arg(m, 2, 10, QChar('0'))
+ .arg(s,2, 10, QChar('0'));
+}
+
GUI::GUI()
{
createActions();
@@ -47,6 +59,8 @@ GUI::GUI()
_dirIndex = -1;
_files = 0;
+ _distance = 0;
+ _time = 0;
resize(600, 800);
}
@@ -164,12 +178,15 @@ void GUI::createTrackGraphs()
void GUI::createStatusBar()
{
- _fileName = new QLabel();
- _zoom = new QLabel();
- _zoom->setAlignment(Qt::AlignHCenter);
+ _fileNameLabel = new QLabel();
+ _distanceLabel = new QLabel();
+ _timeLabel = new QLabel();
+ _distanceLabel->setAlignment(Qt::AlignHCenter);
+ _timeLabel->setAlignment(Qt::AlignHCenter);
- statusBar()->addPermanentWidget(_fileName, 9);
- statusBar()->addPermanentWidget(_zoom, 1);
+ statusBar()->addPermanentWidget(_fileNameLabel, 8);
+ statusBar()->addPermanentWidget(_distanceLabel, 1);
+ statusBar()->addPermanentWidget(_timeLabel, 1);
statusBar()->setSizeGripEnabled(false);
}
@@ -220,9 +237,14 @@ bool GUI::openFile(const QString &fileName)
_fileActionGroup->setEnabled(true);
if (++_files > 1)
- _fileName->setText(tr("%1 tracks").arg(_files));
+ _fileNameLabel->setText(tr("%1 tracks").arg(_files));
else
- _fileName->setText(fileName);
+ _fileNameLabel->setText(fileName);
+ _distance += gpx.distance();
+ _distanceLabel->setText(QString::number(_distance / 1000, 'f', 1)
+ + " " + tr("km"));
+ _time += gpx.time();
+ _timeLabel->setText(timeSpan(_time));
return true;
} else {
@@ -289,11 +311,15 @@ void GUI::saveFile(const QString &fileName)
void GUI::closeFile()
{
_files = 0;
+ _distance = 0;
+ _time = 0;
_elevationGraph->clear();
_speedGraph->clear();
_track->clear();
- _fileName->clear();
+ _fileNameLabel->clear();
+ _distanceLabel->clear();
+ _timeLabel->clear();
_fileActionGroup->setEnabled(false);
}
diff --git a/src/gui.h b/src/gui.h
index 740491c2..8d28b5fa 100644
--- a/src/gui.h
+++ b/src/gui.h
@@ -68,8 +68,9 @@ private:
QAction *_openPOIAction;
QAction *_showPOIAction;
- QLabel *_fileName;
- QLabel *_zoom;
+ QLabel *_fileNameLabel;
+ QLabel *_distanceLabel;
+ QLabel *_timeLabel;
ElevationGraph *_elevationGraph;
SpeedGraph *_speedGraph;
@@ -82,6 +83,9 @@ private:
QString _saveFileName;
unsigned _files;
+
+ qreal _distance;
+ qreal _time;
};
#endif // GUI_H