1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-28 05:34:47 +01:00

Remaining tool-tip related changes

Improved/fixed POI handling
This commit is contained in:
Martin Tůma 2016-08-02 20:46:22 +02:00
parent dafadbab60
commit ee2f471ca0
15 changed files with 263 additions and 164 deletions

View File

@ -163,17 +163,17 @@
<context> <context>
<name>GUI</name> <name>GUI</name>
<message> <message>
<location filename="../src/gui.cpp" line="440"/> <location filename="../src/gui.cpp" line="446"/>
<source>GPXSee is distributed under the terms of the GNU General Public License version 3. For more info about GPXSee visit the project homepage at </source> <source>GPXSee is distributed under the terms of the GNU General Public License version 3. For more info about GPXSee visit the project homepage at </source>
<translation>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 </translation> <translation>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 </translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="504"/> <location filename="../src/gui.cpp" line="510"/>
<source>Open file</source> <source>Open file</source>
<translation>Otevřít soubor</translation> <translation>Otevřít soubor</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="580"/> <location filename="../src/gui.cpp" line="586"/>
<source>Open POI file</source> <source>Open POI file</source>
<translation>Otevřít POI soubor</translation> <translation>Otevřít POI soubor</translation>
</message> </message>
@ -189,8 +189,8 @@
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="186"/> <location filename="../src/gui.cpp" line="186"/>
<location filename="../src/gui.cpp" line="456"/> <location filename="../src/gui.cpp" line="462"/>
<location filename="../src/gui.cpp" line="457"/> <location filename="../src/gui.cpp" line="463"/>
<source>Keyboard controls</source> <source>Keyboard controls</source>
<translation>Ovládací klávesy</translation> <translation>Ovládací klávesy</translation>
</message> </message>
@ -205,20 +205,20 @@
<translation>Znovu načíst</translation> <translation>Znovu načíst</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="372"/> <location filename="../src/gui.cpp" line="378"/>
<source>Show</source> <source>Show</source>
<translation>Zobrazit</translation> <translation>Zobrazit</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="313"/> <location filename="../src/gui.cpp" line="317"/>
<location filename="../src/gui.cpp" line="366"/> <location filename="../src/gui.cpp" line="372"/>
<source>File</source> <source>File</source>
<translation>Soubor</translation> <translation>Soubor</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="184"/> <location filename="../src/gui.cpp" line="184"/>
<location filename="../src/gui.cpp" line="479"/> <location filename="../src/gui.cpp" line="485"/>
<location filename="../src/gui.cpp" line="480"/> <location filename="../src/gui.cpp" line="486"/>
<source>Data sources</source> <source>Data sources</source>
<translation>Zdroje dat</translation> <translation>Zdroje dat</translation>
</message> </message>
@ -233,125 +233,130 @@
<translation>Zavřit POI soubory</translation> <translation>Zavřit POI soubory</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="230"/> <location filename="../src/gui.cpp" line="229"/>
<source>Overlap POIs</source>
<translation>Překrývat POI</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="234"/>
<source>Show POIs</source> <source>Show POIs</source>
<translation>Zobrazit POI</translation> <translation>Zobrazit POI</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="238"/> <location filename="../src/gui.cpp" line="242"/>
<source>Show map</source> <source>Show map</source>
<translation>Zobrazit mapu</translation> <translation>Zobrazit mapu</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="244"/> <location filename="../src/gui.cpp" line="248"/>
<source>Clear tile cache</source> <source>Clear tile cache</source>
<translation>Vymazat mezipaměť dlaždic</translation> <translation>Vymazat mezipaměť dlaždic</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="253"/>
<location filename="../src/gui.cpp" line="257"/> <location filename="../src/gui.cpp" line="257"/>
<location filename="../src/gui.cpp" line="466"/> <location filename="../src/gui.cpp" line="261"/>
<location filename="../src/gui.cpp" line="472"/>
<source>Next map</source> <source>Next map</source>
<translation>Následující mapa</translation> <translation>Následující mapa</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="264"/> <location filename="../src/gui.cpp" line="268"/>
<source>Show graphs</source> <source>Show graphs</source>
<translation>Zobrazovat grafy</translation> <translation>Zobrazovat grafy</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="270"/> <location filename="../src/gui.cpp" line="274"/>
<source>Show toolbars</source> <source>Show toolbars</source>
<translation>Zobrazovat nástrojové lišty</translation> <translation>Zobrazovat nástrojové lišty</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="276"/> <location filename="../src/gui.cpp" line="280"/>
<source>Metric</source> <source>Metric</source>
<translation>Metrické</translation> <translation>Metrické</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="281"/> <location filename="../src/gui.cpp" line="285"/>
<source>Imperial</source> <source>Imperial</source>
<translation>Imperiální</translation> <translation>Imperiální</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="287"/> <location filename="../src/gui.cpp" line="291"/>
<source>Fullscreen mode</source> <source>Fullscreen mode</source>
<translation>Celoobrazovkový režim</translation> <translation>Celoobrazovkový režim</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="295"/> <location filename="../src/gui.cpp" line="299"/>
<source>Next</source> <source>Next</source>
<translation>Následující</translation> <translation>Následující</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="298"/> <location filename="../src/gui.cpp" line="302"/>
<source>Previous</source> <source>Previous</source>
<translation>Předchozí</translation> <translation>Předchozí</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="302"/> <location filename="../src/gui.cpp" line="306"/>
<source>Last</source> <source>Last</source>
<translation>Poslední</translation> <translation>Poslední</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="305"/> <location filename="../src/gui.cpp" line="309"/>
<source>First</source> <source>First</source>
<translation>První</translation> <translation>První</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="327"/> <location filename="../src/gui.cpp" line="331"/>
<source>Map</source> <source>Map</source>
<translation>Mapa</translation> <translation>Mapa</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="334"/> <location filename="../src/gui.cpp" line="338"/>
<source>POI</source> <source>POI</source>
<translation>POI</translation> <translation>POI</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="335"/> <location filename="../src/gui.cpp" line="339"/>
<source>POI files</source> <source>POI files</source>
<translation>POI soubory</translation> <translation>POI soubory</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="343"/> <location filename="../src/gui.cpp" line="349"/>
<source>Settings</source> <source>Settings</source>
<translation>Nastavení</translation> <translation>Nastavení</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="344"/> <location filename="../src/gui.cpp" line="350"/>
<source>Units</source> <source>Units</source>
<translation>Jednotky</translation> <translation>Jednotky</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="353"/> <location filename="../src/gui.cpp" line="359"/>
<source>Help</source> <source>Help</source>
<translation>Nápověda</translation> <translation>Nápověda</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="468"/> <location filename="../src/gui.cpp" line="474"/>
<source>Previous map</source> <source>Previous map</source>
<translation>Předchozí mapa</translation> <translation>Předchozí mapa</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="665"/> <location filename="../src/gui.cpp" line="672"/>
<location filename="../src/gui.cpp" line="668"/> <location filename="../src/gui.cpp" line="675"/>
<source>Date</source> <source>Date</source>
<translation>Datum</translation> <translation>Datum</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="841"/> <location filename="../src/gui.cpp" line="853"/>
<source>No GPX files loaded</source> <source>No GPX files loaded</source>
<translation>Nejsou načteny žádné GPX soubory</translation> <translation>Nejsou načteny žádné GPX soubory</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="459"/> <location filename="../src/gui.cpp" line="465"/>
<source>Next file</source> <source>Next file</source>
<translation>Následující soubor</translation> <translation>Následující soubor</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="436"/> <location filename="../src/gui.cpp" line="442"/>
<source>Version </source> <source>Version </source>
<translation>Verze </translation> <translation>Verze </translation>
</message> </message>
@ -366,123 +371,123 @@
<translation>Exportovat do PDF...</translation> <translation>Exportovat do PDF...</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="460"/> <location filename="../src/gui.cpp" line="466"/>
<source>Previous file</source> <source>Previous file</source>
<translation>Předchozí soubor</translation> <translation>Předchozí soubor</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="462"/> <location filename="../src/gui.cpp" line="468"/>
<source>First file</source> <source>First file</source>
<translation>První soubor</translation> <translation>První soubor</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="463"/> <location filename="../src/gui.cpp" line="469"/>
<source>Last file</source> <source>Last file</source>
<translation>Poslední soubor</translation> <translation>Poslední soubor</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="464"/> <location filename="../src/gui.cpp" line="470"/>
<source>Append modifier</source> <source>Append modifier</source>
<translation>Modifikátor nahradit/přidat</translation> <translation>Modifikátor nahradit/přidat</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="483"/> <location filename="../src/gui.cpp" line="489"/>
<source>Map (tiles) source URLs are read on program startup from the following file:</source> <source>Map (tiles) source URLs are read on program startup from the following file:</source>
<translation>URL mapových zdrojů (dlaždic) jsou načteny při startu programu z následujícího souboru:</translation> <translation>URL mapových zdrojů (dlaždic) jsou načteny při startu programu z následujícího souboru:</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="486"/> <location filename="../src/gui.cpp" line="492"/>
<source>The file format is one map entry per line, consisting of the map name and tiles URL delimited by a TAB character. The tile X and Y coordinates are replaced with $x and $y in the URL and the zoom level is replaced with $z. An example map file could look like:</source> <source>The file format is one map entry per line, consisting of the map name and tiles URL delimited by a TAB character. The tile X and Y coordinates are replaced with $x and $y in the URL and the zoom level is replaced with $z. An example map file could look like:</source>
<translation>Formát souboru je jeden mapový záznam na řádku, kde mapový záznam sestává ze jména mapy a URL dlaždic navzájem oddělených tabulátorem. Souřadnice dlaždice jsou v URL nahrazeny řetězci $x a $y, úroven přiblížení (zoom) pak řetězcem $z. Příklad:</translation> <translation>Formát souboru je jeden mapový záznam na řádku, kde mapový záznam sestává ze jména mapy a URL dlaždic navzájem oddělených tabulátorem. Souřadnice dlaždice jsou v URL nahrazeny řetězci $x a $y, úroven přiblížení (zoom) pak řetězcem $z. Příklad:</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="494"/> <location filename="../src/gui.cpp" line="500"/>
<source>To make GPXSee load a POI file automatically on startup, add the file to the following directory:</source> <source>To make GPXSee load a POI file automatically on startup, add the file to the following directory:</source>
<translation>POI soubory, které se mají automaticky nahrát při startu programu jsou načítány z následujícího adresáře:</translation> <translation>POI soubory, které se mají automaticky nahrát při startu programu jsou načítány z následujícího adresáře:</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="505"/> <location filename="../src/gui.cpp" line="511"/>
<source>GPX files (*.gpx);;All files (*)</source> <source>GPX files (*.gpx);;All files (*)</source>
<translation>Soubory GPX (*.gpx);;Všechny soubory (*)</translation> <translation>Soubory GPX (*.gpx);;Všechny soubory (*)</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="571"/> <location filename="../src/gui.cpp" line="577"/>
<location filename="../src/gui.cpp" line="597"/> <location filename="../src/gui.cpp" line="603"/>
<source>Line: %1</source> <source>Line: %1</source>
<translation>Řádka: %1</translation> <translation>Řádka: %1</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="581"/> <location filename="../src/gui.cpp" line="587"/>
<source>GPX files (*.gpx);;CSV files (*.csv);;All files (*)</source> <source>GPX files (*.gpx);;CSV files (*.csv);;All files (*)</source>
<translation>Soubory GPX (*.gpx);;Soubory CSV (*.csv);;Všechny soubory (*)</translation> <translation>Soubory GPX (*.gpx);;Soubory CSV (*.csv);;Všechny soubory (*)</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="671"/> <location filename="../src/gui.cpp" line="678"/>
<source>Tracks</source> <source>Tracks</source>
<translation>Počet tras</translation> <translation>Počet tras</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="677"/> <location filename="../src/gui.cpp" line="684"/>
<source>mi</source> <source>mi</source>
<translation>mi</translation> <translation>mi</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="189"/> <location filename="../src/gui.cpp" line="189"/>
<location filename="../src/gui.cpp" line="434"/> <location filename="../src/gui.cpp" line="440"/>
<source>About GPXSee</source> <source>About GPXSee</source>
<translation>O aplikaci GPXSee</translation> <translation>O aplikaci GPXSee</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="376"/> <location filename="../src/gui.cpp" line="382"/>
<source>Navigation</source> <source>Navigation</source>
<translation>Navigace</translation> <translation>Navigace</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="482"/> <location filename="../src/gui.cpp" line="488"/>
<source>Map sources</source> <source>Map sources</source>
<translation>Mapové zdroje</translation> <translation>Mapové zdroje</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="493"/> <location filename="../src/gui.cpp" line="499"/>
<source>POIs</source> <source>POIs</source>
<translation>POI body</translation> <translation>POI body</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="676"/> <location filename="../src/gui.cpp" line="683"/>
<location filename="../src/gui.cpp" line="679"/> <location filename="../src/gui.cpp" line="686"/>
<source>Distance</source> <source>Distance</source>
<translation>Vzdálenost</translation> <translation>Vzdálenost</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="684"/> <location filename="../src/gui.cpp" line="691"/>
<source>Time</source> <source>Time</source>
<translation>Čas</translation> <translation>Čas</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="848"/> <location filename="../src/gui.cpp" line="860"/>
<source>%1 tracks</source> <source>%1 tracks</source>
<translation>Počet tras: %1</translation> <translation>Počet tras: %1</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="680"/> <location filename="../src/gui.cpp" line="687"/>
<source>km</source> <source>km</source>
<translation>km</translation> <translation>km</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="573"/> <location filename="../src/gui.cpp" line="579"/>
<location filename="../src/gui.cpp" line="598"/> <location filename="../src/gui.cpp" line="604"/>
<source>Error</source> <source>Error</source>
<translation>Chyba</translation> <translation>Chyba</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="568"/> <location filename="../src/gui.cpp" line="574"/>
<source>Error loading GPX file: <source>Error loading GPX file:
%1</source> %1</source>
<translation>Soubor GPX nelze otevřít: <translation>Soubor GPX nelze otevřít:
%1</translation> %1</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="594"/> <location filename="../src/gui.cpp" line="600"/>
<source>Error loading POI file: <source>Error loading POI file:
%1</source> %1</source>
<translation>Soubor POI nelze otevřít: <translation>Soubor POI nelze otevřít:
@ -538,30 +543,49 @@
<translation>mi</translation> <translation>mi</translation>
</message> </message>
</context> </context>
<context>
<name>Misc</name>
<message>
<location filename="../src/misc.cpp" line="55"/>
<location filename="../src/misc.cpp" line="76"/>
<source>ft</source>
<translation>ft</translation>
</message>
<message>
<location filename="../src/misc.cpp" line="58"/>
<source>mi</source>
<translation>mi</translation>
</message>
<message>
<location filename="../src/misc.cpp" line="62"/>
<location filename="../src/misc.cpp" line="73"/>
<source>m</source>
<translation>m</translation>
</message>
<message>
<location filename="../src/misc.cpp" line="65"/>
<source>km</source>
<translation>km</translation>
</message>
</context>
<context> <context>
<name>QObject</name> <name>QObject</name>
<message> <message>
<location filename="../src/misc.cpp" line="57"/>
<location filename="../src/scaleitem.cpp" line="81"/> <location filename="../src/scaleitem.cpp" line="81"/>
<source>mi</source> <source>mi</source>
<translation>mi</translation> <translation>mi</translation>
</message> </message>
<message> <message>
<location filename="../src/misc.cpp" line="54"/>
<location filename="../src/misc.cpp" line="74"/>
<location filename="../src/scaleitem.cpp" line="81"/> <location filename="../src/scaleitem.cpp" line="81"/>
<source>ft</source> <source>ft</source>
<translation>ft</translation> <translation>ft</translation>
</message> </message>
<message> <message>
<location filename="../src/misc.cpp" line="64"/>
<location filename="../src/scaleitem.cpp" line="83"/> <location filename="../src/scaleitem.cpp" line="83"/>
<source>km</source> <source>km</source>
<translation>km</translation> <translation>km</translation>
</message> </message>
<message> <message>
<location filename="../src/misc.cpp" line="61"/>
<location filename="../src/misc.cpp" line="71"/>
<location filename="../src/scaleitem.cpp" line="83"/> <location filename="../src/scaleitem.cpp" line="83"/>
<source>m</source> <source>m</source>
<translation>m</translation> <translation>m</translation>
@ -680,4 +704,45 @@
<translation>F</translation> <translation>F</translation>
</message> </message>
</context> </context>
<context>
<name>TrackItem</name>
<message>
<location filename="../src/trackitem.cpp" line="16"/>
<source>Distance</source>
<translation>Vzdálenost</translation>
</message>
<message>
<location filename="../src/trackitem.cpp" line="19"/>
<source>Time</source>
<translation>Čas</translation>
</message>
<message>
<location filename="../src/trackitem.cpp" line="21"/>
<source>Date</source>
<translation>Datum</translation>
</message>
</context>
<context>
<name>WaypointItem</name>
<message>
<location filename="../src/waypointitem.cpp" line="16"/>
<source>Coordinates</source>
<translation>Souřadnice</translation>
</message>
<message>
<location filename="../src/waypointitem.cpp" line="19"/>
<source>Elevation</source>
<translation>Výška</translation>
</message>
<message>
<location filename="../src/waypointitem.cpp" line="22"/>
<source>Date</source>
<translation>Datum</translation>
</message>
<message>
<location filename="../src/waypointitem.cpp" line="25"/>
<source>Description</source>
<translation>Popis</translation>
</message>
</context>
</TS> </TS>

View File

@ -226,6 +226,10 @@ void GUI::createActions()
_closePOIAction = new QAction(QIcon(QPixmap(CLOSE_FILE_ICON)), _closePOIAction = new QAction(QIcon(QPixmap(CLOSE_FILE_ICON)),
tr("Close POI files"), this); tr("Close POI files"), this);
connect(_closePOIAction, SIGNAL(triggered()), this, SLOT(closePOIFiles())); connect(_closePOIAction, SIGNAL(triggered()), this, SLOT(closePOIFiles()));
_overlapPOIAction = new QAction(tr("Overlap POIs"), this);
_overlapPOIAction->setCheckable(true);
connect(_overlapPOIAction, SIGNAL(triggered(bool)), this,
SLOT(overlapPOIs(bool)));
_showPOIAction = new QAction(QIcon(QPixmap(SHOW_POI_ICON)), _showPOIAction = new QAction(QIcon(QPixmap(SHOW_POI_ICON)),
tr("Show POIs"), this); tr("Show POIs"), this);
_showPOIAction->setCheckable(true); _showPOIAction->setCheckable(true);
@ -338,6 +342,8 @@ void GUI::createMenus()
_poiMenu->addAction(_openPOIAction); _poiMenu->addAction(_openPOIAction);
_poiMenu->addAction(_closePOIAction); _poiMenu->addAction(_closePOIAction);
_poiMenu->addSeparator(); _poiMenu->addSeparator();
_poiMenu->addAction(_overlapPOIAction);
_poiMenu->addSeparator();
_poiMenu->addAction(_showPOIAction); _poiMenu->addAction(_showPOIAction);
_settingsMenu = menuBar()->addMenu(tr("Settings")); _settingsMenu = menuBar()->addMenu(tr("Settings"));
@ -601,8 +607,9 @@ bool GUI::openPOIFile(const QString &fileName)
} else { } else {
_showPOIAction->setChecked(true); _showPOIAction->setChecked(true);
_track->loadPOI(_poi); _track->loadPOI(_poi);
_poiFilesMenu->addAction(createPOIFileAction( QAction *action = createPOIFileAction(_poi.files().indexOf(fileName));
_poi.files().indexOf(fileName))); action->setChecked(true);
_poiFilesMenu->addAction(action);
return true; return true;
} }
@ -764,6 +771,11 @@ void GUI::closeAll()
updateTrackView(); updateTrackView();
} }
void GUI::overlapPOIs(bool checked)
{
_track->setPOIOverlap(checked);
}
void GUI::showPOI(bool checked) void GUI::showPOI(bool checked)
{ {
if (checked) if (checked)
@ -1082,6 +1094,7 @@ void GUI::writeSettings()
settings.beginGroup(POI_SETTINGS_GROUP); settings.beginGroup(POI_SETTINGS_GROUP);
settings.setValue(SHOW_POI_SETTING, _showPOIAction->isChecked()); settings.setValue(SHOW_POI_SETTING, _showPOIAction->isChecked());
settings.setValue(OVERLAP_POI_SETTING, _overlapPOIAction->isChecked());
settings.remove(DISABLED_POI_FILE_SETTINGS_PREFIX); settings.remove(DISABLED_POI_FILE_SETTINGS_PREFIX);
settings.beginWriteArray(DISABLED_POI_FILE_SETTINGS_PREFIX); settings.beginWriteArray(DISABLED_POI_FILE_SETTINGS_PREFIX);
@ -1138,6 +1151,11 @@ void GUI::readSettings()
settings.endGroup(); settings.endGroup();
settings.beginGroup(POI_SETTINGS_GROUP); settings.beginGroup(POI_SETTINGS_GROUP);
if (settings.value(OVERLAP_POI_SETTING, true).toBool() == false) {
_track->setPOIOverlap(false);
_overlapPOIAction->setChecked(false);
} else
_overlapPOIAction->setChecked(true);
if (settings.value(SHOW_POI_SETTING, false).toBool() == true) if (settings.value(SHOW_POI_SETTING, false).toBool() == true)
_showPOIAction->setChecked(true); _showPOIAction->setChecked(true);
for (int i = 0; i < _poiFilesActions.count(); i++) for (int i = 0; i < _poiFilesActions.count(); i++)

View File

@ -43,6 +43,7 @@ private slots:
void reloadFile(); void reloadFile();
void openPOIFile(); void openPOIFile();
void closePOIFiles(); void closePOIFiles();
void overlapPOIs(bool checked);
void showPOI(bool checked); void showPOI(bool checked);
void showMap(bool checked); void showMap(bool checked);
void showGraphs(bool checked); void showGraphs(bool checked);
@ -128,6 +129,7 @@ private:
QAction *_openPOIAction; QAction *_openPOIAction;
QAction *_closePOIAction; QAction *_closePOIAction;
QAction *_showPOIAction; QAction *_showPOIAction;
QAction *_overlapPOIAction;
QAction *_showMapAction; QAction *_showMapAction;
QAction *_fullscreenAction; QAction *_fullscreenAction;
QAction *_clearMapCacheAction; QAction *_clearMapCacheAction;

View File

@ -35,6 +35,16 @@ QPointF ll2mercator(const QPointF &ll)
return m; return m;
} }
QPointF mercator2ll(const QPointF &m)
{
QPointF ll;
ll.setX(m.x());
ll.setY(rad2deg(2 * atan(exp(deg2rad(m.y()))) - M_PI/2));
return ll;
}
QPoint mercator2tile(const QPointF &m, int z) QPoint mercator2tile(const QPointF &m, int z)
{ {
QPoint tile; QPoint tile;

View File

@ -8,6 +8,7 @@
#define ZOOM_MIN 3 #define ZOOM_MIN 3
QPointF ll2mercator(const QPointF &ll); QPointF ll2mercator(const QPointF &ll);
QPointF mercator2ll(const QPointF &m);
qreal llDistance(const QPointF &p1, const QPointF &p2); qreal llDistance(const QPointF &p1, const QPointF &p2);
QPoint mercator2tile(const QPointF &m, int zoom); QPoint mercator2tile(const QPointF &m, int zoom);
QPointF tile2mercator(const QPoint &tile, int zoom); QPointF tile2mercator(const QPoint &tile, int zoom);

View File

@ -1,7 +1,8 @@
#include <cmath> #include <cmath>
#include <QObject> #include <QApplication>
#include "misc.h" #include "misc.h"
double niceNum(double x, int round) double niceNum(double x, int round)
{ {
int expv; int expv;
@ -50,28 +51,29 @@ QString distance(qreal value, Units units)
{ {
if (units == Imperial) { if (units == Imperial) {
if (value < MIINM) if (value < MIINM)
return QString::number(value * M2FT, 'f', 0) return QString::number(value * M2FT, 'f', 0) + UNIT_SPACE
+ UNIT_SPACE + QObject::tr("ft"); + qApp->translate("Misc", "ft");
else else
return QString::number(value * M2MI, 'f', 1) return QString::number(value * M2MI, 'f', 1) + UNIT_SPACE
+ UNIT_SPACE + QObject::tr("mi"); + qApp->translate("Misc", "mi");
} else { } else {
if (value < KMINM) if (value < KMINM)
return QString::number(value, 'f', 0) + UNIT_SPACE return QString::number(value, 'f', 0) + UNIT_SPACE
+ QObject::tr("m"); + qApp->translate("Misc", "m");
else else
return QString::number(value * M2KM, 'f', 1) return QString::number(value * M2KM, 'f', 1) + UNIT_SPACE
+ UNIT_SPACE + QObject::tr("km"); + qApp->translate("Misc", "km");
} }
} }
QString elevation(qreal value, Units units) QString elevation(qreal value, Units units)
{ {
if (units == Metric) if (units == Metric)
return QString::number(value, 'f', 0) + UNIT_SPACE + QObject::tr("m"); return QString::number(value, 'f', 0) + UNIT_SPACE
+ qApp->translate("Misc", "m");
else else
return QString::number(value * M2FT, 'f', 0) + UNIT_SPACE return QString::number(value * M2FT, 'f', 0) + UNIT_SPACE
+ QObject::tr("ft"); + qApp->translate("Misc", "ft");
} }
QString coordinates(const QPointF &value) QString coordinates(const QPointF &value)
@ -79,7 +81,6 @@ QString coordinates(const QPointF &value)
QChar yH = (value.y() < 0) ? 'S' : 'N'; QChar yH = (value.y() < 0) ? 'S' : 'N';
QChar xH = (value.x() < 0) ? 'W' : 'E'; QChar xH = (value.x() < 0) ? 'W' : 'E';
return QString::number(qAbs(value.y()), 'f', 5) + QChar(0x00B0) + " " + yH return QString::number(qAbs(value.y()), 'f', 5) + yH + "," + QChar(0x00A0)
+ ", " + QString::number(qAbs(value.x()), 'f', 5) + QChar(0x00B0) + " " + QString::number(qAbs(value.x()), 'f', 5) + xH;
+ xH ;
} }

View File

@ -52,10 +52,10 @@ bool POI::loadGPXFile(const QString &fileName)
index.end = _data.size() - 1; index.end = _data.size() - 1;
for (int i = index.start; i <= index.end; i++) { for (int i = index.start; i <= index.end; i++) {
QPointF p = ll2mercator(_data.at(i).coordinates()); const QPointF &p = _data.at(i).coordinates();
qreal c[2]; qreal c[2];
c[0] = p.x(); c[0] = p.x();
c[1] = -p.y(); c[1] = p.y();
_tree.Insert(c, c, i); _tree.Insert(c, c, i);
} }
@ -124,10 +124,10 @@ bool POI::loadCSVFile(const QString &fileName)
index.end = _data.size() - 1; index.end = _data.size() - 1;
for (int i = index.start; i <= index.end; i++) { for (int i = index.start; i <= index.end; i++) {
QPointF p = ll2mercator(_data.at(i).coordinates()); const QPointF &p = _data.at(i).coordinates();
qreal c[2]; qreal c[2];
c[0] = p.x(); c[0] = p.x();
c[1] = -p.y(); c[1] = p.y();
_tree.Insert(c, c, i); _tree.Insert(c, c, i);
} }
@ -152,11 +152,11 @@ QVector<Waypoint> POI::points(const QPainterPath &path, qreal radius) const
qreal min[2], max[2]; qreal min[2], max[2];
for (int i = 0; i < path.elementCount(); i++) { for (int i = 0; i < path.elementCount(); i++) {
const QPointF &p = path.elementAt(i); QPointF p = mercator2ll(path.elementAt(i));
min[0] = p.x() - radius; min[0] = p.x() - radius;
min[1] = p.y() - radius; min[1] = -p.y() - radius;
max[0] = p.x() + radius; max[0] = p.x() + radius;
max[1] = p.y() + radius; max[1] = -p.y() + radius;
_tree.Search(min, max, cb, &set); _tree.Search(min, max, cb, &set);
} }
@ -177,7 +177,7 @@ QVector<Waypoint> POI::points(const QList<WaypointItem*> &list, qreal radius)
qreal min[2], max[2]; qreal min[2], max[2];
for (int i = 0; i < list.count(); i++) { for (int i = 0; i < list.count(); i++) {
const QPointF &p = list.at(i)->coordinates(); const QPointF &p = list.at(i)->waypoint().coordinates();
min[0] = p.x() - radius; min[0] = p.x() - radius;
min[1] = p.y() - radius; min[1] = p.y() - radius;
max[0] = p.x() + radius; max[0] = p.x() + radius;

View File

@ -15,6 +15,7 @@
#define SHOW_MAP_SETTING "show" #define SHOW_MAP_SETTING "show"
#define POI_SETTINGS_GROUP "POI" #define POI_SETTINGS_GROUP "POI"
#define OVERLAP_POI_SETTING "overlap"
#define SHOW_POI_SETTING "show" #define SHOW_POI_SETTING "show"
#define DISABLED_POI_FILE_SETTINGS_PREFIX "disabled" #define DISABLED_POI_FILE_SETTINGS_PREFIX "disabled"
#define DISABLED_POI_FILE_SETTING "file" #define DISABLED_POI_FILE_SETTING "file"

View File

@ -1,26 +1,20 @@
#include "tooltip.h" #include "tooltip.h"
ToolTip::ToolTip()
{
}
void ToolTip::insert(const QString &key, const QString &value) void ToolTip::insert(const QString &key, const QString &value)
{ {
KV kv(key, value); QPair<QString, QString> entry(key, value);
int i; _list.append(entry);
if ((i = _list.indexOf(kv)) < 0)
_list.append(kv);
else
_list[i] = kv;
} }
QString ToolTip::toString() QString ToolTip::toString()
{ {
QString ret; QString ret = "<table>";
for (int i = 0; i < _list.count(); i++) for (int i = 0; i < _list.count(); i++)
ret += "<b>" + _list.at(i).key + ":</b> " + _list.at(i).value + "<br/>"; ret += "<tr><td align=\"right\"><b>" + _list.at(i).first
+ ":&nbsp;</b></td><td>" + _list.at(i).second + "</td></tr>";
ret += "</table>";
return ret; return ret;
} }

View File

@ -3,28 +3,16 @@
#include <QString> #include <QString>
#include <QList> #include <QList>
#include <QPair>
class ToolTip class ToolTip
{ {
public: public:
ToolTip();
void insert(const QString &key, const QString &value); void insert(const QString &key, const QString &value);
QString toString(); QString toString();
private: private:
class KV { QList<QPair<QString, QString> > _list;
public:
QString key;
QString value;
KV(const QString &k, const QString &v)
{key = k; value = v;}
bool operator==(const KV &other) const
{return this->key == other.key;}
};
QList<KV> _list;
}; };
#endif // TOOLTIP_H #endif // TOOLTIP_H

View File

@ -1,3 +1,4 @@
#include <QApplication>
#include <QCursor> #include <QCursor>
#include <QPen> #include <QPen>
#include "ll.h" #include "ll.h"
@ -12,11 +13,13 @@ QString TrackItem::toolTip()
{ {
ToolTip tt; ToolTip tt;
tt.insert("Distance", ::distance(_distance, _units)); tt.insert(qApp->translate("TrackItem", "Distance"),
::distance(_distance, _units));
if (_time > 0) if (_time > 0)
tt.insert("Time", ::timeSpan(_time)); tt.insert(qApp->translate("TrackItem", "Time"), ::timeSpan(_time));
if (!_date.isNull()) if (!_date.isNull())
tt.insert("Date", _date.toString(Qt::SystemLocaleShortDate)); tt.insert(qApp->translate("TrackItem", "Date"),
_date.toString(Qt::SystemLocaleShortDate));
return tt.toString(); return tt.toString();
} }

View File

@ -39,6 +39,7 @@ TrackView::TrackView(QWidget *parent)
_plot = false; _plot = false;
_units = Metric; _units = Metric;
_overlap = true;
} }
TrackView::~TrackView() TrackView::~TrackView()
@ -199,6 +200,19 @@ qreal TrackView::mapScale(int zoom) const
return ((360.0/(qreal)(1<<zoom))/(qreal)TILE_SIZE); return ((360.0/(qreal)(1<<zoom))/(qreal)TILE_SIZE);
} }
void TrackView::checkPOIOverlap()
{
QHash<Waypoint, WaypointItem*>::const_iterator it, jt;
for (it = _pois.constBegin(); it != _pois.constEnd(); it++) {
for (jt = _pois.constBegin(); jt != _pois.constEnd(); jt++) {
if (it != jt && it.value()->isVisible() && jt.value()->isVisible()
&& it.value()->collidesWithItem(jt.value()))
jt.value()->hide();
}
}
}
void TrackView::rescale(qreal scale) void TrackView::rescale(qreal scale)
{ {
for (int i = 0; i < _paths.size(); i++) { for (int i = 0; i < _paths.size(); i++) {
@ -209,19 +223,14 @@ void TrackView::rescale(qreal scale)
for (int i = 0; i < _waypoints.size(); i++) for (int i = 0; i < _waypoints.size(); i++)
_waypoints.at(i)->setScale(1.0/scale); _waypoints.at(i)->setScale(1.0/scale);
QHash<Waypoint, WaypointItem*>::const_iterator it, jt; QHash<Waypoint, WaypointItem*>::const_iterator it;
for (it = _pois.constBegin(); it != _pois.constEnd(); it++) { for (it = _pois.constBegin(); it != _pois.constEnd(); it++) {
it.value()->setScale(1.0/scale); it.value()->setScale(1.0/scale);
it.value()->show(); it.value()->show();
} }
for (it = _pois.constBegin(); it != _pois.constEnd(); it++) { if (!_overlap)
for (jt = _pois.constBegin(); jt != _pois.constEnd(); jt++) { checkPOIOverlap();
if (it != jt && it.value()->isVisible() && jt.value()->isVisible()
&& it.value()->collidesWithItem(jt.value()))
jt.value()->hide();
}
}
_scale = scale; _scale = scale;
} }
@ -245,8 +254,6 @@ void TrackView::addPOI(const QVector<Waypoint> &waypoints)
void TrackView::loadPOI(const POI &poi) void TrackView::loadPOI(const POI &poi)
{ {
QHash<Waypoint, WaypointItem*>::const_iterator it,jt;
if (!_paths.size() && !_waypoints.size()) if (!_paths.size() && !_waypoints.size())
return; return;
@ -254,13 +261,8 @@ void TrackView::loadPOI(const POI &poi)
addPOI(poi.points(_paths.at(i)->path())); addPOI(poi.points(_paths.at(i)->path()));
addPOI(poi.points(_waypoints)); addPOI(poi.points(_waypoints));
for (it = _pois.constBegin(); it != _pois.constEnd(); it++) { if (!_overlap)
for (jt = _pois.constBegin(); jt != _pois.constEnd(); jt++) { checkPOIOverlap();
if (it != jt && it.value()->isVisible() && jt.value()->isVisible()
&& it.value()->collidesWithItem(jt.value()))
jt.value()->hide();
}
}
} }
void TrackView::setMap(Map *map) void TrackView::setMap(Map *map)
@ -434,6 +436,18 @@ void TrackView::movePositionMarker(qreal val)
} }
} }
void TrackView::setPOIOverlap(bool overlap)
{
_overlap = overlap;
if (_overlap) {
QHash<Waypoint, WaypointItem*>::const_iterator it;
for (it = _pois.constBegin(); it != _pois.constEnd(); it++)
it.value()->show();
} else
checkPOIOverlap();
}
void TrackView::drawBackground(QPainter *painter, const QRectF &rect) void TrackView::drawBackground(QPainter *painter, const QRectF &rect)
{ {
if ((_paths.isEmpty() && _waypoints.isEmpty()) || !_map) { if ((_paths.isEmpty() && _waypoints.isEmpty()) || !_map) {

View File

@ -34,6 +34,7 @@ public:
void setMap(Map *map); void setMap(Map *map);
void setUnits(enum Units units); void setUnits(enum Units units);
void setPOIOverlap(bool overlap);
void plot(QPainter *painter, const QRectF &target); void plot(QPainter *painter, const QRectF &target);
@ -57,6 +58,7 @@ private:
void rescale(qreal scale); void rescale(qreal scale);
void rescale(); void rescale();
void zoom(int z, const QPointF &pos); void zoom(int z, const QPointF &pos);
void checkPOIOverlap();
void wheelEvent(QWheelEvent *event); void wheelEvent(QWheelEvent *event);
void keyPressEvent(QKeyEvent *event); void keyPressEvent(QKeyEvent *event);
@ -80,6 +82,7 @@ private:
int _zoom; int _zoom;
Units _units; Units _units;
bool _overlap;
bool _plot; bool _plot;
}; };

View File

@ -1,3 +1,4 @@
#include <QApplication>
#include <QPainter> #include <QPainter>
#include "config.h" #include "config.h"
#include "ll.h" #include "ll.h"
@ -12,13 +13,17 @@ QString WaypointItem::toolTip()
{ {
ToolTip tt; ToolTip tt;
tt.insert("Coordinates", ::coordinates(_coordinates)); tt.insert(qApp->translate("WaypointItem", "Coordinates"),
if (!std::isnan(_elevation)) ::coordinates(_waypoint.coordinates()));
tt.insert("Elevation", ::elevation(_elevation, _units)); if (!std::isnan(_waypoint.elevation()))
if (!_date.isNull()) tt.insert(qApp->translate("WaypointItem", "Elevation"),
tt.insert("Date", _date.toString(Qt::SystemLocaleShortDate)); ::elevation(_waypoint.elevation() - _waypoint.geoidHeight(), _units));
if (!_description.isNull()) if (!_waypoint.timestamp().isNull())
tt.insert("Description", _description); tt.insert(qApp->translate("WaypointItem", "Date"),
_waypoint.timestamp().toString(Qt::SystemLocaleShortDate));
if (!_waypoint.description().isNull())
tt.insert(qApp->translate("WaypointItem", "Description"),
_waypoint.description());
return tt.toString(); return tt.toString();
} }
@ -28,19 +33,15 @@ WaypointItem::WaypointItem(const Waypoint &waypoint, QGraphicsItem *parent)
{ {
_units = Metric; _units = Metric;
_label = waypoint.name(); _waypoint = waypoint;
_coordinates = ll2mercator(QPointF(waypoint.coordinates().x(), _coordinates = ll2mercator(QPointF(waypoint.coordinates().x(),
-waypoint.coordinates().y())); -waypoint.coordinates().y()));
_elevation = waypoint.elevation() - waypoint.geoidHeight();
_description = waypoint.description();
_date = waypoint.timestamp();
updateBoundingRect(); updateBoundingRect();
setPos(_coordinates);
setToolTip(toolTip()); setToolTip(toolTip());
setCursor(Qt::ArrowCursor); setCursor(Qt::ArrowCursor);
setPos(_coordinates);
} }
void WaypointItem::updateBoundingRect() void WaypointItem::updateBoundingRect()
@ -49,7 +50,7 @@ void WaypointItem::updateBoundingRect()
font.setPixelSize(FONT_SIZE); font.setPixelSize(FONT_SIZE);
font.setFamily(FONT_FAMILY); font.setFamily(FONT_FAMILY);
QFontMetrics fm(font); QFontMetrics fm(font);
QRect ts = fm.tightBoundingRect(_label); QRect ts = fm.tightBoundingRect(_waypoint.name());
_boundingRect = QRectF(-POINT_SIZE/2, -POINT_SIZE/2, ts.width() _boundingRect = QRectF(-POINT_SIZE/2, -POINT_SIZE/2, ts.width()
+ POINT_SIZE, ts.height() + fm.descent() + POINT_SIZE); + POINT_SIZE, ts.height() + fm.descent() + POINT_SIZE);
@ -64,11 +65,11 @@ void WaypointItem::paint(QPainter *painter,
font.setPixelSize(FONT_SIZE); font.setPixelSize(FONT_SIZE);
font.setFamily(FONT_FAMILY); font.setFamily(FONT_FAMILY);
QFontMetrics fm(font); QFontMetrics fm(font);
QRect ts = fm.tightBoundingRect(_label); QRect ts = fm.tightBoundingRect(_waypoint.name());
painter->setFont(font); painter->setFont(font);
painter->drawText(POINT_SIZE/2 - qMax(ts.x(), 0), POINT_SIZE/2 + ts.height(), painter->drawText(POINT_SIZE/2 - qMax(ts.x(), 0), POINT_SIZE/2 + ts.height(),
_label); _waypoint.name());
painter->setBrush(Qt::SolidPattern); painter->setBrush(Qt::SolidPattern);
painter->drawEllipse(-POINT_SIZE/2, -POINT_SIZE/2, POINT_SIZE, POINT_SIZE); painter->drawEllipse(-POINT_SIZE/2, -POINT_SIZE/2, POINT_SIZE, POINT_SIZE);

View File

@ -9,27 +9,25 @@ class WaypointItem : public QGraphicsItem
{ {
public: public:
WaypointItem(const Waypoint &waypoint, QGraphicsItem *parent = 0); WaypointItem(const Waypoint &waypoint, QGraphicsItem *parent = 0);
const QPointF &coordinates() {return _coordinates;}
const Waypoint &waypoint() const {return _waypoint;}
const QPointF &coordinates() const {return _coordinates;}
void setUnits(enum Units units);
void setScale(qreal scale);
QRectF boundingRect() const {return _boundingRect;} QRectF boundingRect() const {return _boundingRect;}
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
QWidget *widget); QWidget *widget);
void setUnits(enum Units units);
void setScale(qreal scale);
private: private:
void updateBoundingRect(); void updateBoundingRect();
QString toolTip(); QString toolTip();
QString _label;
QPointF _coordinates;
QRectF _boundingRect; QRectF _boundingRect;
QPointF _coordinates;
Waypoint _waypoint;
Units _units; Units _units;
QDateTime _date;
QString _description;
qreal _elevation;
}; };
#endif // WAYPOINTITEM_H #endif // WAYPOINTITEM_H