├── .gitignore ├── CHANGELOG.md ├── GPXLab.doxyfile ├── GPXLab.pro ├── GPXLab ├── GPXLab.pro ├── commands │ ├── appendtrackcommand.cpp │ ├── appendtrackcommand.h │ ├── combinetrackcommand.cpp │ ├── combinetrackcommand.h │ ├── editfilepropertiescommand.cpp │ ├── editfilepropertiescommand.h │ ├── edittrackpropertiescommand.cpp │ ├── edittrackpropertiescommand.h │ ├── movetrackdowncommand.cpp │ ├── movetrackdowncommand.h │ ├── movetrackupcommand.cpp │ ├── movetrackupcommand.h │ ├── pointdeletecommand.cpp │ ├── pointdeletecommand.h │ ├── pointeditcommand.cpp │ ├── pointeditcommand.h │ ├── pointinsertcommand.cpp │ ├── pointinsertcommand.h │ ├── removetrackcommand.cpp │ ├── removetrackcommand.h │ ├── selectcommand.cpp │ ├── selectcommand.h │ ├── setaltitudecommand.cpp │ ├── setaltitudecommand.h │ ├── splittrackcommand.cpp │ ├── splittrackcommand.h │ ├── tracktimeshiftcommand.cpp │ └── tracktimeshiftcommand.h ├── dialogs │ ├── dialog_about.cpp │ ├── dialog_about.h │ ├── dialog_about.ui │ ├── dialog_checkupdate.cpp │ ├── dialog_checkupdate.h │ ├── dialog_checkupdate.ui │ ├── dialog_datetime.cpp │ ├── dialog_datetime.h │ ├── dialog_datetime.ui │ ├── dialog_modelproperties.cpp │ ├── dialog_modelproperties.h │ ├── dialog_modelproperties.ui │ ├── dialog_settings.cpp │ ├── dialog_settings.h │ ├── dialog_settings.ui │ ├── dialog_srtm.cpp │ ├── dialog_srtm.h │ ├── dialog_srtm.ui │ ├── dialog_trackproperties.cpp │ ├── dialog_trackproperties.h │ └── dialog_trackproperties.ui ├── functions │ ├── srtm.cpp │ └── srtm.h ├── gpx_model │ ├── actfile.cpp │ ├── actfile.h │ ├── gpx_model.cpp │ ├── gpx_model.h │ ├── gpxfile.cpp │ ├── gpxfile.h │ ├── nmeafile.cpp │ ├── nmeafile.h │ ├── utils.c │ ├── utils.h │ ├── uxmlpars.c │ └── uxmlpars.h ├── gpx_wrapper.cpp ├── gpx_wrapper.h ├── gpxlab.cpp ├── gpxlab.h ├── gpxlab.ico ├── gpxlab.ui ├── gpxlab_actions.cpp ├── images │ ├── about.png │ ├── app_exit.png │ ├── arror_down.png │ ├── arror_up.png │ ├── close_file.png │ ├── cog.png │ ├── down.png │ ├── fileappend.png │ ├── fileopen.png │ ├── filesave.png │ ├── filesaveas.png │ ├── fit_point.png │ ├── fit_track.png │ ├── fit_view.png │ ├── flag_blue.png │ ├── flag_finish.png │ ├── flag_green.png │ ├── flag_red.png │ ├── follow.png │ ├── gpxlab.png │ ├── link.png │ ├── link_break.png │ ├── log.png │ ├── map_edit.png │ ├── minus.png │ ├── plus.png │ ├── point_delete.png │ ├── point_insert.png │ ├── redo.png │ ├── timeline.png │ ├── track_only.png │ ├── undo.png │ ├── up.png │ ├── world_edit.png │ └── zoom.png ├── locale │ ├── gpxlab_fi.ts │ └── gpxlab_ru.ts ├── main.cpp ├── qutils.cpp ├── qutils.h ├── resources.qrc ├── settings.cpp ├── settings.h └── widgets │ ├── qcalendarwidgetext.cpp │ ├── qcalendarwidgetext.h │ ├── qcustomplot.cpp │ ├── qcustomplot.h │ ├── qcustomplotext.cpp │ ├── qcustomplotext.h │ ├── qdiagramwidget.cpp │ ├── qdiagramwidget.h │ ├── qmaptrack.cpp │ ├── qmaptrack.h │ ├── qmapwidget.cpp │ ├── qmapwidget.h │ ├── qpixmapext.cpp │ ├── qpixmapext.h │ ├── qtablewidgetpoints.cpp │ ├── qtablewidgetpoints.h │ ├── qtreewidgettracks.cpp │ └── qtreewidgettracks.h ├── LICENSE ├── QMapControl ├── QMapControl.pro ├── arrowpoint.cpp ├── arrowpoint.h ├── bingapimapadapter.cpp ├── bingapimapadapter.h ├── circlepoint.cpp ├── circlepoint.h ├── curve.cpp ├── curve.h ├── emptymapadapter.cpp ├── emptymapadapter.h ├── fixedimageoverlay.cpp ├── fixedimageoverlay.h ├── geometry.cpp ├── geometry.h ├── geometrylayer.cpp ├── geometrylayer.h ├── googleapimapadapter.cpp ├── googleapimapadapter.h ├── googlemapadapter.cpp ├── googlemapadapter.h ├── gps_position.cpp ├── gps_position.h ├── imagemanager.cpp ├── imagemanager.h ├── imagepoint.cpp ├── imagepoint.h ├── invisiblepoint.cpp ├── invisiblepoint.h ├── layer.cpp ├── layer.h ├── layermanager.cpp ├── layermanager.h ├── linestring.cpp ├── linestring.h ├── mapadapter.cpp ├── mapadapter.h ├── mapcontrol.cpp ├── mapcontrol.h ├── maplayer.cpp ├── maplayer.h ├── mapnetwork.cpp ├── mapnetwork.h ├── openaerialmapadapter.cpp ├── openaerialmapadapter.h ├── osmmapadapter.cpp ├── osmmapadapter.h ├── point.cpp ├── point.h ├── qmapcontrol_global.h ├── tilemapadapter.cpp ├── tilemapadapter.h ├── wmsmapadapter.cpp └── wmsmapadapter.h ├── README.md ├── doc ├── Demo.gpx ├── demo.png └── gpxlab.png └── pkg ├── Info.plist ├── appdata.xml ├── gpxlab.desktop ├── gpxlab.icns └── gpxlab.xml /.gitignore: -------------------------------------------------------------------------------- 1 | # C++ objects and libs 2 | *.o 3 | *.a 4 | 5 | # Qt-es 6 | .qmake.cache 7 | .qmake.stash 8 | *.pro.user 9 | *.pro.user.* 10 | moc_*.cpp 11 | moc_*.h 12 | qrc_*.cpp 13 | ui_*.h 14 | Makefile* 15 | *build-* 16 | *.qm 17 | 18 | # Binaries 19 | GPXLab 20 | !GPXLab/ 21 | gpxlab 22 | !gpxlab/ 23 | 24 | # macOS 25 | .DS_Store 26 | 27 | # Doxygen 28 | doc/html 29 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## v0.8.0 (in development) 4 | - [fix] Incorrect speed calculation 5 | 6 | ## v0.7.0 7 | - [new] Use SRTM version 3.0 global 1 arc second data 8 | - [new] SRTM files must now be located in the QStandardPaths::AppDataLocation directory 9 | - [new] Settings to automatically reload the last opened file on startup 10 | - [new] Support arbitrary map provider (thanks to sikmir). Tested with: 11 | - default: `http://tile.openstreetmap.org/%1/%2/%3.png` 12 | - with query: `http://a.tile.thunderforest.com/cycle/%1/%2/%3.png?apikey=` 13 | - with https: `https://a.tile.opentopomap.org/%1/%2/%3.png` 14 | - with explicit port: `https://a.tile.opentopomap.org:443/%1/%2/%3.png` 15 | - [new] Standard shortcuts for ZoomIn/ZoomOut added 16 | 17 | ## v0.6.0 18 | - [new] Height files must now be placed in configuration direcotry 19 | - [new] Increased OSM max zoom to 19 (thanks to sikmir) 20 | - [new] Set precision of generated lat/lon to 6 and of elevation to 2 (thanks to sikmir) 21 | - [new] Added waypoints parsing (thanks to sikmir) 22 | 23 | ## v0.5.0 24 | - [new] Standard shortcuts and menu accelerators added (thanks to sikmir) 25 | - [new] Finnish & Russian translations (thanks to sikmir) 26 | - [fix] Parsing with Locale different than English 27 | - [fix] Case-sensitivity while parsing removed 28 | 29 | ## v0.4.2.1 30 | - [fix] Increased gpx buffer size to 4096. 31 | - [fix] Const in Settings::setValue(const QString &key, const QVariant &value) 32 | 33 | ## v0.4.2 34 | - [new] Show latitude and longitude in the status bar. 35 | - [new] Show speed also in min/km. 36 | - [new] "Follow item" and "show only selected item" are store in the settings. 37 | - [fix] Following selected item failed. 38 | 39 | ## v0.4.1 40 | - [fix] Compilation with Linux should work now. 41 | - [fix] Combination of atof() and locale. 42 | 43 | ## v0.4.0 44 | - [update] Updated to Qt 5.7. 45 | - [update] Updated QMapControl to version 0.9.7.9. 46 | - [update] Updated QCustomPlot to version 1.3.2. 47 | - [new] The diagram's x axis now show elapsed time instead of absoulte time. 48 | - [fix] Corrected timezone problem in NMEA and GPX parser. 49 | 50 | ## v0.3.0 51 | - [update] Updated QMapControl to version 0.9.7.8. 52 | - [update] Updated QCustomPlot to version 1.3.0. 53 | - [update] Updated copyright to "2014 - 2015". 54 | - [new] Track on the map is highlighted when the mouse cursor is moved over it. 55 | - [new] Show some point properties when the mouse cursor is over the point. 56 | - [new] Added functionality to insert/delete track points. 57 | - [new] Added functionality to set the start time of a track. 58 | - [new] Added functionality to move a single track point using SHIFT + mouse click. 59 | - [new] Added a calendar to select a track by date. 60 | - [new] Diagram curves can be changed to show other properties. 61 | - [new] Support SpoQ files (.act and .xml). 62 | - [new] Support Garmin's TrackPointExtension heart rate extension. 63 | - [fix] Ignore upper/lower case to detect file type. 64 | - [fix] Draw tracks with 0 or only 1 point correctly. 65 | - [fix] Changed way of iteration in GPX_wrapper. 66 | - [fix] Fixed bug in NMEA sentence parser. 67 | 68 | ## v0.2.0 Beta 69 | - [update] Updated QMapControl to version 0.9.7.6. 70 | - [update] Changed some icons. 71 | - [update] Some minor GUI changes. 72 | - [new] Double clicking an item in the track selection opens the track properties dialogue. 73 | - [new] Added undo/redo functionality. 74 | - [new] Added functionality to split and combine a track. 75 | - [new] Window state and position is stored on application closing and restored on restart. 76 | - [new] Header state of point list is stored on application closing and restored on restart. 77 | - [new] Added control to change the map zoom. 78 | - [new] Added option to configure the map caching. 79 | - [fix] Docks don't disappear any more when tabbed. 80 | 81 | ## v0.1.0 Beta 82 | - [new] Initial beta release. 83 | -------------------------------------------------------------------------------- /GPXLab.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = subdirs 2 | SUBDIRS += QMapControl \ 3 | GPXLab 4 | CONFIG += ordered 5 | -------------------------------------------------------------------------------- /GPXLab/commands/appendtrackcommand.cpp: -------------------------------------------------------------------------------- 1 | #include "appendtrackcommand.h" 2 | 3 | AppendTrackCommand::AppendTrackCommand(GPX_wrapper *gpxmw, const QString &fileName, GPX_model::fileType_e fileType, QUndoCommand *parent) : 4 | QUndoCommand(parent), 5 | gpxmw(gpxmw), 6 | fileName(fileName), 7 | fileType(fileType) 8 | { 9 | } 10 | 11 | void AppendTrackCommand::undo() 12 | { 13 | // remove tracks 14 | for (int i = gpxmw->getNumTracks() - 1; i >= numTracksBeforeAppend; --i) 15 | gpxmw->removeTrack(i); 16 | } 17 | 18 | void AppendTrackCommand::redo() 19 | { 20 | // save number of tracks before appending 21 | numTracksBeforeAppend = gpxmw->getNumTracks(); 22 | 23 | // append tracks 24 | gpxmw->load(fileName, fileType, false); 25 | } 26 | -------------------------------------------------------------------------------- /GPXLab/commands/appendtrackcommand.h: -------------------------------------------------------------------------------- 1 | #ifndef APPENDTRACKCOMMAND_H 2 | #define APPENDTRACKCOMMAND_H 3 | 4 | #include 5 | #include "gpx_wrapper.h" 6 | 7 | /** 8 | * @addtogroup Commands Commands 9 | * @brief Command functions implementing QUndoCommand 10 | * @{ 11 | */ 12 | 13 | /** 14 | * @class AppendTrackCommand 15 | * 16 | * @brief Append track command 17 | */ 18 | class AppendTrackCommand : public QUndoCommand 19 | { 20 | public: 21 | 22 | /** 23 | * @brief Constructor 24 | * @param gpxmw GPX_model wrapper 25 | * @param fileName File containing tracks to append 26 | * @param fileType File type, GPXM_FILE_AUTOMATIC for automatic detection 27 | * @param parent Parent 28 | */ 29 | AppendTrackCommand(GPX_wrapper *gpxmw, const QString &fileName, GPX_model::fileType_e fileType, QUndoCommand *parent = nullptr); 30 | 31 | /** 32 | * @brief Undo the command 33 | */ 34 | void undo(); 35 | 36 | /** 37 | * @brief Redo the command 38 | */ 39 | void redo(); 40 | 41 | private: 42 | 43 | GPX_wrapper *gpxmw; 44 | const QString fileName; 45 | int numTracksBeforeAppend; 46 | GPX_model::fileType_e fileType; 47 | }; 48 | 49 | /** @} Commands */ 50 | 51 | #endif // APPENDTRACKCOMMAND_H 52 | -------------------------------------------------------------------------------- /GPXLab/commands/combinetrackcommand.cpp: -------------------------------------------------------------------------------- 1 | #include "combinetrackcommand.h" 2 | 3 | CombineTrackCommand::CombineTrackCommand(GPX_wrapper *gpxmw, int trackNumber, int trackSegmentNumber, int pointNumber, QUndoCommand *parent) : 4 | QUndoCommand(parent), 5 | gpxmw(gpxmw), 6 | trackNumber(trackNumber), 7 | trackSegmentNumber(trackSegmentNumber), 8 | pointNumber(pointNumber) 9 | { 10 | } 11 | 12 | void CombineTrackCommand::undo() 13 | { 14 | // split track segments 15 | gpxmw->splitTrack(trackNumber, trackSegmentNumber, pointNumber); 16 | } 17 | 18 | void CombineTrackCommand::redo() 19 | { 20 | // combine track segments 21 | gpxmw->combineTrack(trackNumber, trackSegmentNumber, pointNumber); 22 | } 23 | -------------------------------------------------------------------------------- /GPXLab/commands/combinetrackcommand.h: -------------------------------------------------------------------------------- 1 | #ifndef COMBINETRACKCOMMAND_H 2 | #define COMBINETRACKCOMMAND_H 3 | 4 | #include 5 | #include "gpx_wrapper.h" 6 | 7 | /** 8 | * @addtogroup Commands Commands 9 | * @brief Command functions implementing QUndoCommand 10 | * @{ 11 | */ 12 | 13 | /** 14 | * @class CombineTrackCommand 15 | * 16 | * @brief Combine track command 17 | */ 18 | class CombineTrackCommand : public QUndoCommand 19 | { 20 | public: 21 | 22 | /** 23 | * @brief Constructor 24 | * @param gpxmw GPX_model wrapper 25 | * @param trackNumber Track number 26 | * @param trackSegmentNumber Track segment number, if -1 for whole track 27 | * @param pointNumber Point number at which the track is combined 28 | * @param parent Parent 29 | */ 30 | CombineTrackCommand(GPX_wrapper *gpxmw, int trackNumber, int trackSegmentNumber, int pointNumber, QUndoCommand *parent = nullptr); 31 | 32 | /** 33 | * @brief Undo the command 34 | */ 35 | void undo(); 36 | 37 | /** 38 | * @brief Redo the command 39 | */ 40 | void redo(); 41 | 42 | private: 43 | 44 | GPX_wrapper *gpxmw; 45 | int trackNumber; 46 | int trackSegmentNumber; 47 | int pointNumber; 48 | }; 49 | 50 | /** @} Commands */ 51 | 52 | #endif // COMBINETRACKCOMMAND_H 53 | -------------------------------------------------------------------------------- /GPXLab/commands/editfilepropertiescommand.cpp: -------------------------------------------------------------------------------- 1 | #include "editfilepropertiescommand.h" 2 | 3 | EditFilePropertiesCommand::EditFilePropertiesCommand(GPX_wrapper *gpxmw, GPX_metadataType &metadata, QUndoCommand *parent) : 4 | QUndoCommand(parent), 5 | gpxmw(gpxmw), 6 | metadata(metadata) 7 | { 8 | } 9 | 10 | void EditFilePropertiesCommand::undo() 11 | { 12 | redo(); 13 | } 14 | 15 | void EditFilePropertiesCommand::redo() 16 | { 17 | // temporary copy old values 18 | GPX_metadataType tmpMetadata = *gpxmw->getModelMetadata(); 19 | 20 | // set new values 21 | gpxmw->setModelMetadata(metadata); 22 | 23 | // store old values 24 | metadata = tmpMetadata; 25 | } 26 | -------------------------------------------------------------------------------- /GPXLab/commands/editfilepropertiescommand.h: -------------------------------------------------------------------------------- 1 | #ifndef EDITFILEPROPERTIESCOMMAND_H 2 | #define EDITFILEPROPERTIESCOMMAND_H 3 | 4 | #include 5 | #include "gpx_wrapper.h" 6 | 7 | /** 8 | * @addtogroup Commands Commands 9 | * @brief Command functions implementing QUndoCommand 10 | * @{ 11 | */ 12 | 13 | /** 14 | * @class EditFilePropertiesCommand 15 | * 16 | * @brief Edit file properties command 17 | */ 18 | class EditFilePropertiesCommand : public QUndoCommand 19 | { 20 | public: 21 | 22 | /** 23 | * @brief Constructor 24 | * @param gpxmw GPX_model wrapper 25 | * @param metadata Metadata of file 26 | * @param parent Parent 27 | */ 28 | EditFilePropertiesCommand(GPX_wrapper *gpxmw, GPX_metadataType &metadata, QUndoCommand *parent = nullptr); 29 | 30 | /** 31 | * @brief Undo the command 32 | */ 33 | void undo(); 34 | 35 | /** 36 | * @brief Redo the command 37 | */ 38 | void redo(); 39 | 40 | private: 41 | 42 | GPX_wrapper *gpxmw; 43 | GPX_metadataType metadata; 44 | }; 45 | 46 | /** @} Commands */ 47 | 48 | #endif // EDITFILEPROPERTIESCOMMAND_H 49 | -------------------------------------------------------------------------------- /GPXLab/commands/edittrackpropertiescommand.cpp: -------------------------------------------------------------------------------- 1 | #include "edittrackpropertiescommand.h" 2 | 3 | EditTrackPropertiesCommand::EditTrackPropertiesCommand(GPX_wrapper *gpxmw, int trackNumber, GPX_trkMetadataType &metadata, QUndoCommand *parent) : 4 | QUndoCommand(parent), 5 | gpxmw(gpxmw), 6 | trackNumber(trackNumber), 7 | metadata(metadata) 8 | { 9 | } 10 | 11 | void EditTrackPropertiesCommand::undo() 12 | { 13 | redo(); 14 | } 15 | 16 | void EditTrackPropertiesCommand::redo() 17 | { 18 | // temporary copy old values 19 | GPX_trkMetadataType tmpMetadata = *gpxmw->getTrackMetadata(trackNumber); 20 | 21 | // set new values 22 | gpxmw->setTrackMetadata(trackNumber, metadata); 23 | 24 | // store old values 25 | metadata = tmpMetadata; 26 | } 27 | -------------------------------------------------------------------------------- /GPXLab/commands/edittrackpropertiescommand.h: -------------------------------------------------------------------------------- 1 | #ifndef EDITTRACKPROPERTIESCOMMAND_H 2 | #define EDITTRACKPROPERTIESCOMMAND_H 3 | 4 | #include 5 | #include "gpx_wrapper.h" 6 | 7 | /** 8 | * @addtogroup Commands Commands 9 | * @brief Command functions implementing QUndoCommand 10 | * @{ 11 | */ 12 | 13 | /** 14 | * @class EditTrackPropertiesCommand 15 | * 16 | * @brief Edit track properties command 17 | */ 18 | class EditTrackPropertiesCommand : public QUndoCommand 19 | { 20 | public: 21 | 22 | /** 23 | * @brief Constructor 24 | * @param gpxmw GPX_model wrapper 25 | * @param trackNumber Track number 26 | * @param metadata Metadata of track 27 | * @param parent Parent 28 | */ 29 | EditTrackPropertiesCommand(GPX_wrapper *gpxmw, int trackNumber, GPX_trkMetadataType &metadata, QUndoCommand *parent = nullptr); 30 | 31 | /** 32 | * @brief Undo the command 33 | */ 34 | void undo(); 35 | 36 | /** 37 | * @brief Redo the command 38 | */ 39 | void redo(); 40 | 41 | private: 42 | 43 | GPX_wrapper *gpxmw; 44 | int trackNumber; 45 | GPX_trkMetadataType metadata; 46 | }; 47 | 48 | /** @} Commands */ 49 | 50 | #endif // EDITTRACKPROPERTIESCOMMAND_H 51 | -------------------------------------------------------------------------------- /GPXLab/commands/movetrackdowncommand.cpp: -------------------------------------------------------------------------------- 1 | #include "movetrackdowncommand.h" 2 | 3 | MoveTrackDownCommand::MoveTrackDownCommand(GPX_wrapper *gpxmw, int trackNumber, QUndoCommand *parent) : 4 | QUndoCommand(parent), 5 | gpxmw(gpxmw), 6 | trackNumber(trackNumber) 7 | { 8 | } 9 | 10 | void MoveTrackDownCommand::undo() 11 | { 12 | // move track up 13 | gpxmw->moveTrackUp(trackNumber); 14 | } 15 | 16 | void MoveTrackDownCommand::redo() 17 | { 18 | // move track down 19 | gpxmw->moveTrackDown(trackNumber); 20 | } 21 | -------------------------------------------------------------------------------- /GPXLab/commands/movetrackdowncommand.h: -------------------------------------------------------------------------------- 1 | #ifndef MOVETRACKDOWNCOMMAND_H 2 | #define MOVETRACKDOWNCOMMAND_H 3 | 4 | #include 5 | #include "gpx_wrapper.h" 6 | 7 | /** 8 | * @addtogroup Commands Commands 9 | * @brief Command functions implementing QUndoCommand 10 | * @{ 11 | */ 12 | 13 | /** 14 | * @class MoveTrackDownCommand 15 | * 16 | * @brief Move track down command 17 | */ 18 | class MoveTrackDownCommand : public QUndoCommand 19 | { 20 | public: 21 | 22 | /** 23 | * @brief Constructor 24 | * @param gpxmw GPX_model wrapper 25 | * @param trackNumber Track number to move down 26 | * @param parent Parent 27 | */ 28 | MoveTrackDownCommand(GPX_wrapper *gpxmw, int trackNumber, QUndoCommand *parent = nullptr); 29 | 30 | /** 31 | * @brief Undo the command 32 | */ 33 | void undo(); 34 | 35 | /** 36 | * @brief Redo the command 37 | */ 38 | void redo(); 39 | 40 | private: 41 | 42 | GPX_wrapper *gpxmw; 43 | int trackNumber; 44 | }; 45 | 46 | /** @} Commands */ 47 | 48 | #endif // MOVETRACKDOWNCOMMAND_H 49 | -------------------------------------------------------------------------------- /GPXLab/commands/movetrackupcommand.cpp: -------------------------------------------------------------------------------- 1 | #include "movetrackupcommand.h" 2 | 3 | MoveTrackUpCommand::MoveTrackUpCommand(GPX_wrapper *gpxmw, int trackNumber, QUndoCommand *parent) : 4 | QUndoCommand(parent), 5 | gpxmw(gpxmw), 6 | trackNumber(trackNumber) 7 | { 8 | } 9 | 10 | void MoveTrackUpCommand::undo() 11 | { 12 | // move track down 13 | gpxmw->moveTrackDown(trackNumber); 14 | } 15 | 16 | void MoveTrackUpCommand::redo() 17 | { 18 | // move track up 19 | gpxmw->moveTrackUp(trackNumber); 20 | } 21 | -------------------------------------------------------------------------------- /GPXLab/commands/movetrackupcommand.h: -------------------------------------------------------------------------------- 1 | #ifndef MOVETRACKUPCOMMAND_H 2 | #define MOVETRACKUPCOMMAND_H 3 | 4 | #include 5 | #include "gpx_wrapper.h" 6 | 7 | /** 8 | * @addtogroup Commands Commands 9 | * @brief Command functions implementing QUndoCommand 10 | * @{ 11 | */ 12 | 13 | /** 14 | * @class MoveTrackUpCommand 15 | * 16 | * @brief Move track up command 17 | */ 18 | class MoveTrackUpCommand : public QUndoCommand 19 | { 20 | public: 21 | 22 | /** 23 | * @brief Constructor 24 | * @param gpxmw GPX_model wrapper 25 | * @param trackNumber Track number to move up 26 | * @param parent Parent 27 | */ 28 | MoveTrackUpCommand(GPX_wrapper *gpxmw, int trackNumber, QUndoCommand *parent = nullptr); 29 | 30 | /** 31 | * @brief Undo the command 32 | */ 33 | void undo(); 34 | 35 | /** 36 | * @brief Redo the command 37 | */ 38 | void redo(); 39 | 40 | private: 41 | 42 | GPX_wrapper *gpxmw; 43 | int trackNumber; 44 | }; 45 | 46 | /** @} Commands */ 47 | 48 | #endif // MOVETRACKUPCOMMAND_H 49 | -------------------------------------------------------------------------------- /GPXLab/commands/pointdeletecommand.cpp: -------------------------------------------------------------------------------- 1 | #include "pointdeletecommand.h" 2 | 3 | PointDeleteCommand::PointDeleteCommand(GPX_wrapper *gpxmw, int trackNumber, int trackSegmentNumber, int pointNumber, QUndoCommand *parent) : 4 | QUndoCommand(parent), 5 | gpxmw(gpxmw), 6 | trackNumber(trackNumber), 7 | trackSegmentNumber(trackSegmentNumber), 8 | pointNumber(pointNumber) 9 | { 10 | const GPX_wptType *ptr = gpxmw->getPoint(trackNumber, trackSegmentNumber, pointNumber); 11 | if (ptr) 12 | wpt = *ptr; 13 | } 14 | 15 | void PointDeleteCommand::undo() 16 | { 17 | // insert point 18 | gpxmw->insertPoint(trackNumber, trackSegmentNumber, pointNumber, wpt); 19 | } 20 | 21 | void PointDeleteCommand::redo() 22 | { 23 | // delete point 24 | gpxmw->deletePoint(trackNumber, trackSegmentNumber, pointNumber); 25 | } 26 | -------------------------------------------------------------------------------- /GPXLab/commands/pointdeletecommand.h: -------------------------------------------------------------------------------- 1 | #ifndef POINTDELETECOMMAND_H 2 | #define POINTDELETECOMMAND_H 3 | 4 | #include 5 | #include "gpx_wrapper.h" 6 | 7 | /** 8 | * @addtogroup Commands Commands 9 | * @brief Command functions implementing QUndoCommand 10 | * @{ 11 | */ 12 | 13 | /** 14 | * @class PointDeleteCommand 15 | * 16 | * @brief Delete point command 17 | */ 18 | class PointDeleteCommand : public QUndoCommand 19 | { 20 | public: 21 | 22 | /** 23 | * @brief Constructor 24 | * @param gpxmw GPX_model wrapper 25 | * @param trackNumber Track number 26 | * @param trackSegmentNumber Track segment number 27 | * @param pointNumber Point number 28 | * @param parent Parent 29 | */ 30 | PointDeleteCommand(GPX_wrapper *gpxmw, int trackNumber, int trackSegmentNumber, int pointNumber, QUndoCommand *parent = nullptr); 31 | 32 | /** 33 | * @brief Undo the command 34 | */ 35 | void undo(); 36 | 37 | /** 38 | * @brief Redo the command 39 | */ 40 | void redo(); 41 | 42 | private: 43 | 44 | GPX_wrapper *gpxmw; 45 | int trackNumber; 46 | int trackSegmentNumber; 47 | int pointNumber; 48 | GPX_wptType wpt; 49 | }; 50 | 51 | /** @} Commands */ 52 | 53 | #endif // POINTDELETECOMMAND_H 54 | -------------------------------------------------------------------------------- /GPXLab/commands/pointeditcommand.cpp: -------------------------------------------------------------------------------- 1 | #include "pointeditcommand.h" 2 | 3 | PointEditCommand::PointEditCommand(GPX_wrapper *gpxmw, int trackNumber, int trackSegmentNumber, int pointNumber, size_t numProperties, GPX_wrapper::TrackPointProperty property[], QString value[], QUndoCommand *parent) : 4 | QUndoCommand(parent), 5 | gpxmw(gpxmw), 6 | trackNumber(trackNumber), 7 | trackSegmentNumber(trackSegmentNumber), 8 | pointNumber(pointNumber), 9 | numProperties(numProperties), 10 | dValue(nullptr) 11 | { 12 | size_t i; 13 | this->property = new GPX_wrapper::TrackPointProperty[numProperties]; 14 | sValue = new QString[numProperties]; 15 | for (i = 0; i < numProperties; ++i) 16 | { 17 | this->property[i] = property[i]; 18 | sValue[i] = value[i]; 19 | } 20 | } 21 | 22 | PointEditCommand::PointEditCommand(GPX_wrapper *gpxmw, int trackNumber, int trackSegmentNumber, int pointNumber, size_t numProperties, GPX_wrapper::TrackPointProperty property[], double value[], QUndoCommand *parent) : 23 | QUndoCommand(parent), 24 | gpxmw(gpxmw), 25 | trackNumber(trackNumber), 26 | trackSegmentNumber(trackSegmentNumber), 27 | pointNumber(pointNumber), 28 | numProperties(numProperties), 29 | sValue(nullptr) 30 | { 31 | size_t i; 32 | this->property = new GPX_wrapper::TrackPointProperty[numProperties]; 33 | dValue = new double[numProperties]; 34 | for (i = 0; i < numProperties; ++i) 35 | { 36 | this->property[i] = property[i]; 37 | dValue[i] = value[i]; 38 | } 39 | } 40 | 41 | PointEditCommand::~PointEditCommand() 42 | { 43 | if (sValue) 44 | for (size_t i = 0; i < numProperties; ++i) 45 | delete &sValue[i]; 46 | delete[] property; 47 | delete[] sValue; 48 | delete[] dValue; 49 | } 50 | 51 | void PointEditCommand::undo() 52 | { 53 | redo(); 54 | } 55 | 56 | void PointEditCommand::redo() 57 | { 58 | const GPX_wptType *trkpt = gpxmw->getPoint(trackNumber, trackSegmentNumber, pointNumber); 59 | if (trkpt) 60 | { 61 | size_t i; 62 | if (dValue) 63 | { 64 | // temporary copy old values 65 | double *tmpValue = new double[numProperties]; 66 | for (i = 0; i < numProperties; ++i) 67 | tmpValue[i] = gpxmw->getTrackPointPropertyAsDouble(trkpt, property[i]); 68 | 69 | // set new values 70 | gpxmw->setTrackPointProperty(trackNumber, trackSegmentNumber, pointNumber, numProperties, property, dValue); 71 | 72 | // store old values 73 | for (i = 0; i < numProperties; ++i) 74 | dValue[i] = tmpValue[i]; 75 | 76 | delete[] tmpValue; 77 | } 78 | else 79 | { 80 | // temporary copy old values 81 | QString *tmpValue = new QString[numProperties]; 82 | for (i = 0; i < numProperties; ++i) 83 | tmpValue[i] = gpxmw->getTrackPointPropertyAsString(trkpt, property[i]); 84 | 85 | // set new values 86 | gpxmw->setTrackPointProperty(trackNumber, trackSegmentNumber, pointNumber, numProperties, property, sValue); 87 | 88 | // store old values 89 | for (i = 0; i < numProperties; ++i) 90 | sValue[i] = tmpValue[i]; 91 | 92 | delete[] tmpValue; 93 | } 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /GPXLab/commands/pointeditcommand.h: -------------------------------------------------------------------------------- 1 | #ifndef POINTEDITCOMMAND_H 2 | #define POINTEDITCOMMAND_H 3 | 4 | #include 5 | #include "gpx_wrapper.h" 6 | 7 | /** 8 | * @addtogroup Commands Commands 9 | * @brief Command functions implementing QUndoCommand 10 | * @{ 11 | */ 12 | 13 | /** 14 | * @class PointEditCommand 15 | * 16 | * @brief Edit point property command 17 | */ 18 | class PointEditCommand : public QUndoCommand 19 | { 20 | public: 21 | 22 | /** 23 | * @brief Constructor 24 | * @param gpxmw GPX_model wrapper 25 | * @param trackNumber Track number 26 | * @param trackSegmentNumber Track segment number 27 | * @param pointNumber Point number 28 | * @param numProperties Number of properties 29 | * @param property Property to edit 30 | * @param value Value 31 | * @param parent Parent 32 | */ 33 | PointEditCommand(GPX_wrapper *gpxmw, int trackNumber, int trackSegmentNumber, int pointNumber, size_t numProperties, GPX_wrapper::TrackPointProperty property[], QString value[], QUndoCommand *parent = nullptr); 34 | 35 | /** 36 | * @brief Constructor 37 | * @param gpxmw GPX_model wrapper 38 | * @param trackNumber Track number 39 | * @param trackSegmentNumber Track segment number 40 | * @param pointNumber Point number 41 | * @param numProperties Number of properties 42 | * @param property Property to edit 43 | * @param value Value 44 | * @param parent Parent 45 | */ 46 | PointEditCommand(GPX_wrapper *gpxmw, int trackNumber, int trackSegmentNumber, int pointNumber, size_t numProperties, GPX_wrapper::TrackPointProperty property[], double value[], QUndoCommand *parent = 0); 47 | 48 | ~PointEditCommand(); 49 | 50 | /** 51 | * @brief Undo the command 52 | */ 53 | void undo(); 54 | 55 | /** 56 | * @brief Redo the command 57 | */ 58 | void redo(); 59 | 60 | private: 61 | 62 | GPX_wrapper *gpxmw; 63 | int trackNumber; 64 | int trackSegmentNumber; 65 | int pointNumber; 66 | size_t numProperties; 67 | GPX_wrapper::TrackPointProperty *property; 68 | QString *sValue; 69 | double *dValue; 70 | }; 71 | 72 | /** @} Commands */ 73 | 74 | #endif // POINTEDITCOMMAND_H 75 | -------------------------------------------------------------------------------- /GPXLab/commands/pointinsertcommand.cpp: -------------------------------------------------------------------------------- 1 | #include "pointinsertcommand.h" 2 | 3 | PointInsertCommand::PointInsertCommand(GPX_wrapper *gpxmw, int trackNumber, int trackSegmentNumber, int pointNumber, GPX_wptType &wpt, QUndoCommand *parent) : 4 | QUndoCommand(parent), 5 | gpxmw(gpxmw), 6 | trackNumber(trackNumber), 7 | trackSegmentNumber(trackSegmentNumber), 8 | pointNumber(pointNumber), 9 | wpt(wpt) 10 | { 11 | } 12 | 13 | void PointInsertCommand::undo() 14 | { 15 | // delete point 16 | gpxmw->deletePoint(trackNumber, trackSegmentNumber, pointNumber); 17 | } 18 | 19 | void PointInsertCommand::redo() 20 | { 21 | // insert point 22 | gpxmw->insertPoint(trackNumber, trackSegmentNumber, pointNumber, wpt); 23 | } 24 | -------------------------------------------------------------------------------- /GPXLab/commands/pointinsertcommand.h: -------------------------------------------------------------------------------- 1 | #ifndef POINTINSERTCOMMAND_H 2 | #define POINTINSERTCOMMAND_H 3 | 4 | #include 5 | #include "gpx_wrapper.h" 6 | 7 | /** 8 | * @addtogroup Commands Commands 9 | * @brief Command functions implementing QUndoCommand 10 | * @{ 11 | */ 12 | 13 | /** 14 | * @class PointInsertCommand 15 | * 16 | * @brief Insert point command 17 | */ 18 | class PointInsertCommand : public QUndoCommand 19 | { 20 | public: 21 | 22 | /** 23 | * @brief Constructor 24 | * @param gpxmw GPX_model wrapper 25 | * @param trackNumber Track number 26 | * @param trackSegmentNumber Track segment number 27 | * @param pointNumber Point number 28 | * @param wpt Point 29 | * @param parent Parent 30 | */ 31 | PointInsertCommand(GPX_wrapper *gpxmw, int trackNumber, int trackSegmentNumber, int pointNumber, GPX_wptType &wpt, QUndoCommand *parent = nullptr); 32 | 33 | /** 34 | * @brief Undo the command 35 | */ 36 | void undo(); 37 | 38 | /** 39 | * @brief Redo the command 40 | */ 41 | void redo(); 42 | 43 | private: 44 | 45 | GPX_wrapper *gpxmw; 46 | int trackNumber; 47 | int trackSegmentNumber; 48 | int pointNumber; 49 | GPX_wptType wpt; 50 | }; 51 | 52 | /** @} Commands */ 53 | 54 | #endif // POINTINSERTCOMMAND_H 55 | -------------------------------------------------------------------------------- /GPXLab/commands/removetrackcommand.cpp: -------------------------------------------------------------------------------- 1 | #include "removetrackcommand.h" 2 | 3 | RemoveTrackCommand::RemoveTrackCommand(GPX_wrapper *gpxmw, int trackNumber, QUndoCommand *parent) : 4 | QUndoCommand(parent), 5 | gpxmw(gpxmw), 6 | trackNumber(trackNumber), 7 | trk(trackNumber) 8 | { 9 | const GPX_trkType *ptr = gpxmw->getTrack(trackNumber); 10 | if (ptr) 11 | trk = *ptr; 12 | } 13 | 14 | void RemoveTrackCommand::undo() 15 | { 16 | // insert track 17 | gpxmw->insertTrack(trackNumber, trk); 18 | } 19 | 20 | void RemoveTrackCommand::redo() 21 | { 22 | // remove track 23 | gpxmw->removeTrack(trackNumber); 24 | } 25 | -------------------------------------------------------------------------------- /GPXLab/commands/removetrackcommand.h: -------------------------------------------------------------------------------- 1 | #ifndef REMOVETRACKCOMMAND_H 2 | #define REMOVETRACKCOMMAND_H 3 | 4 | #include 5 | #include "gpx_wrapper.h" 6 | 7 | /** 8 | * @addtogroup Commands Commands 9 | * @brief Command functions implementing QUndoCommand 10 | * @{ 11 | */ 12 | 13 | /** 14 | * @class RemoveTrackCommand 15 | * 16 | * @brief Remove track command 17 | */ 18 | class RemoveTrackCommand : public QUndoCommand 19 | { 20 | public: 21 | 22 | /** 23 | * @brief Constructor 24 | * @param gpxmw GPX_model wrapper 25 | * @param trackNumber Track number to remove 26 | * @param parent Parent 27 | */ 28 | RemoveTrackCommand(GPX_wrapper *gpxmw, int trackNumber, QUndoCommand *parent = nullptr); 29 | 30 | /** 31 | * @brief Undo the command 32 | */ 33 | void undo(); 34 | 35 | /** 36 | * @brief Redo the command 37 | */ 38 | void redo(); 39 | 40 | private: 41 | 42 | GPX_wrapper *gpxmw; 43 | size_t trackNumber; 44 | GPX_trkType trk; 45 | }; 46 | 47 | /** @} Commands */ 48 | 49 | #endif // REMOVETRACKCOMMAND_H 50 | -------------------------------------------------------------------------------- /GPXLab/commands/selectcommand.cpp: -------------------------------------------------------------------------------- 1 | #include "selectcommand.h" 2 | 3 | SelectCommand::SelectCommand(GPX_wrapper *gpxmw, int trackNumber, int trackSegmentNumber, int pointNumber, QUndoCommand *parent) : 4 | QUndoCommand(parent), 5 | gpxmw(gpxmw), 6 | trackNumber(trackNumber), 7 | trackSegmentNumber(trackSegmentNumber), 8 | pointNumber(pointNumber), 9 | lat(0.0), 10 | lon(0.0), 11 | timestamp(0) 12 | { 13 | } 14 | 15 | SelectCommand::SelectCommand(GPX_wrapper *gpxmw, int trackNumber, int trackSegmentNumber, double lat, double lon, QUndoCommand *parent) : 16 | QUndoCommand(parent), 17 | gpxmw(gpxmw), 18 | trackNumber(trackNumber), 19 | trackSegmentNumber(trackSegmentNumber), 20 | pointNumber(-2), 21 | lat(lat), 22 | lon(lon), 23 | timestamp(0) 24 | { 25 | } 26 | 27 | SelectCommand::SelectCommand(GPX_wrapper *gpxmw, int trackNumber, int trackSegmentNumber, time_t timestamp, QUndoCommand *parent) : 28 | QUndoCommand(parent), 29 | gpxmw(gpxmw), 30 | trackNumber(trackNumber), 31 | trackSegmentNumber(trackSegmentNumber), 32 | pointNumber(-2), 33 | lat(0.0), 34 | lon(0.0), 35 | timestamp(timestamp) 36 | { 37 | } 38 | 39 | void SelectCommand::undo() 40 | { 41 | redo(); 42 | } 43 | 44 | void SelectCommand::redo() 45 | { 46 | // temporary copy old values 47 | int tmpTrackNumber = gpxmw->getSelectedTrackNumber(); 48 | int tmpTrackSegmentNumber = gpxmw->getSelectedTrackSegmentNumber(); 49 | int tmpPointNumber = gpxmw->getSelectedPointNumber(); 50 | 51 | // set new values 52 | if (pointNumber != -2) 53 | gpxmw->select(trackNumber, trackSegmentNumber, pointNumber); 54 | else if (timestamp != 0) 55 | gpxmw->select(trackNumber, trackSegmentNumber, timestamp); 56 | else 57 | gpxmw->select(trackNumber, trackSegmentNumber, lat, lon); 58 | 59 | // store old values 60 | trackNumber = tmpTrackNumber; 61 | trackSegmentNumber = tmpTrackSegmentNumber; 62 | pointNumber = tmpPointNumber; 63 | } 64 | -------------------------------------------------------------------------------- /GPXLab/commands/selectcommand.h: -------------------------------------------------------------------------------- 1 | #ifndef SELECTCOMMAND_H 2 | #define SELECTCOMMAND_H 3 | 4 | #include 5 | #include "gpx_wrapper.h" 6 | 7 | /** 8 | * @addtogroup Commands Commands 9 | * @brief Command functions implementing QUndoCommand 10 | * @{ 11 | */ 12 | 13 | /** 14 | * @class SelectCommand 15 | * 16 | * @brief Command to select a track, track segment and/or track point 17 | */ 18 | class SelectCommand : public QUndoCommand 19 | { 20 | public: 21 | 22 | /** 23 | * @brief Constructor 24 | * @param gpxmw GPX_model wrapper 25 | * @param trackNumber Track number 26 | * @param trackSegmentNumber Track segment number, if -1 whole track 27 | * @param pointNumber Point number, if -1 no point will be selected 28 | * @param parent Parent 29 | */ 30 | SelectCommand(GPX_wrapper *gpxmw, int trackNumber, int trackSegmentNumber = -1, int pointNumber = -1, QUndoCommand *parent = nullptr); 31 | 32 | /** 33 | * @brief Constructor 34 | * @param gpxmw GPX_model wrapper 35 | * @param trackNumber Track number 36 | * @param trackSegmentNumber Track segment number, if -1 whole track 37 | * @param lat Latitude coordinate of the point to select 38 | * @param lon Longitude coordinate of the point to select 39 | * @param parent Parent 40 | */ 41 | SelectCommand(GPX_wrapper *gpxmw, int trackNumber, int trackSegmentNumber, double lat, double lon, QUndoCommand *parent = nullptr); 42 | 43 | /** 44 | * @brief Constructor 45 | * @param gpxmw GPX_model wrapper 46 | * @param trackNumber Track number 47 | * @param trackSegmentNumber Track segment number, if -1 whole track 48 | * @param timestamp Timestamp of the point to select 49 | * @param parent Parent 50 | */ 51 | SelectCommand(GPX_wrapper *gpxmw, int trackNumber, int trackSegmentNumber, time_t timestamp, QUndoCommand *parent = nullptr); 52 | 53 | /** 54 | * @brief Undo the command 55 | */ 56 | void undo(); 57 | 58 | /** 59 | * @brief Redo the command 60 | */ 61 | void redo(); 62 | 63 | private: 64 | 65 | GPX_wrapper *gpxmw; 66 | int trackNumber; 67 | int trackSegmentNumber; 68 | int pointNumber; 69 | double lat; 70 | double lon; 71 | time_t timestamp; 72 | }; 73 | 74 | /** @} Commands */ 75 | 76 | #endif // SELECTCOMMAND_H 77 | -------------------------------------------------------------------------------- /GPXLab/commands/setaltitudecommand.cpp: -------------------------------------------------------------------------------- 1 | #include "setaltitudecommand.h" 2 | 3 | SetAltitudeCommand::SetAltitudeCommand(GPX_wrapper *gpxmw, int trackNumber, const QVector &values, QUndoCommand *parent) : 4 | QUndoCommand(parent), 5 | gpxmw(gpxmw), 6 | trackNumber(trackNumber), 7 | values(values) 8 | { 9 | } 10 | 11 | void SetAltitudeCommand::undo() 12 | { 13 | redo(); 14 | } 15 | 16 | void SetAltitudeCommand::redo() 17 | { 18 | // generate values 19 | gpxmw->generateDiagramValues(trackNumber, -1, GPX_wrapper::altitude, GPX_wrapper::none); 20 | 21 | // temporary copy old values 22 | QVector tmpValues = gpxmw->getAltitudeValues(); 23 | 24 | // set new values 25 | gpxmw->setAltitudeValues(values, trackNumber); 26 | 27 | // store old values 28 | values = tmpValues; 29 | } 30 | -------------------------------------------------------------------------------- /GPXLab/commands/setaltitudecommand.h: -------------------------------------------------------------------------------- 1 | #ifndef SETALTITUDECOMMAND_H 2 | #define SETALTITUDECOMMAND_H 3 | 4 | #include 5 | #include "gpx_wrapper.h" 6 | 7 | /** 8 | * @addtogroup Commands Commands 9 | * @brief Command functions implementing QUndoCommand 10 | * @{ 11 | */ 12 | 13 | /** 14 | * @class SetAltitudeCommand 15 | * 16 | * @brief Set altitude values command 17 | */ 18 | class SetAltitudeCommand : public QUndoCommand 19 | { 20 | public: 21 | 22 | /** 23 | * @brief Constructor 24 | * @param gpxmw GPX_model wrapper 25 | * @param trackNumber Set altitude values to this track number 26 | * @param values Altitude values 27 | * @param parent Parent 28 | */ 29 | SetAltitudeCommand(GPX_wrapper *gpxmw, int trackNumber, const QVector &values, QUndoCommand *parent = nullptr); 30 | 31 | /** 32 | * @brief Undo the command 33 | */ 34 | void undo(); 35 | 36 | /** 37 | * @brief Redo the command 38 | */ 39 | void redo(); 40 | 41 | private: 42 | 43 | GPX_wrapper *gpxmw; 44 | int trackNumber; 45 | QVector values; 46 | }; 47 | 48 | /** @} Commands */ 49 | 50 | #endif // SETALTITUDECOMMAND_H 51 | -------------------------------------------------------------------------------- /GPXLab/commands/splittrackcommand.cpp: -------------------------------------------------------------------------------- 1 | #include "splittrackcommand.h" 2 | 3 | SplitTrackCommand::SplitTrackCommand(GPX_wrapper *gpxmw, int trackNumber, int trackSegmentNumber, int pointNumber, QUndoCommand *parent) : 4 | QUndoCommand(parent), 5 | gpxmw(gpxmw), 6 | trackNumber(trackNumber), 7 | trackSegmentNumber(trackSegmentNumber), 8 | pointNumber(pointNumber) 9 | { 10 | } 11 | 12 | void SplitTrackCommand::undo() 13 | { 14 | // combine track segments 15 | gpxmw->combineTrack(trackNumber, trackSegmentNumber, pointNumber); 16 | } 17 | 18 | void SplitTrackCommand::redo() 19 | { 20 | // split track segments 21 | gpxmw->splitTrack(trackNumber, trackSegmentNumber, pointNumber); 22 | } 23 | -------------------------------------------------------------------------------- /GPXLab/commands/splittrackcommand.h: -------------------------------------------------------------------------------- 1 | #ifndef SPLITTRACKCOMMAND_H 2 | #define SPLITTRACKCOMMAND_H 3 | 4 | #include 5 | #include "gpx_wrapper.h" 6 | 7 | /** 8 | * @addtogroup Commands Commands 9 | * @brief Command functions implementing QUndoCommand 10 | * @{ 11 | */ 12 | 13 | /** 14 | * @class SplitTrackCommand 15 | * 16 | * @brief Split track command 17 | */ 18 | class SplitTrackCommand : public QUndoCommand 19 | { 20 | public: 21 | 22 | /** 23 | * @brief Constructor 24 | * @param gpxmw GPX_model wrapper 25 | * @param trackNumber Track number 26 | * @param trackSegmentNumber Track segment number, if -1 for whole track 27 | * @param pointNumber Point number at which the track is combined 28 | * @param parent Parent 29 | */ 30 | SplitTrackCommand(GPX_wrapper *gpxmw, int trackNumber, int trackSegmentNumber, int pointNumber, QUndoCommand *parent = nullptr); 31 | 32 | /** 33 | * @brief Undo the command 34 | */ 35 | void undo(); 36 | 37 | /** 38 | * @brief Redo the command 39 | */ 40 | void redo(); 41 | 42 | private: 43 | 44 | GPX_wrapper *gpxmw; 45 | int trackNumber; 46 | int trackSegmentNumber; 47 | int pointNumber; 48 | }; 49 | 50 | /** @} Commands */ 51 | 52 | #endif // SPLITTRACKCOMMAND_H 53 | -------------------------------------------------------------------------------- /GPXLab/commands/tracktimeshiftcommand.cpp: -------------------------------------------------------------------------------- 1 | #include "tracktimeshiftcommand.h" 2 | 3 | TrackTimeShiftCommand::TrackTimeShiftCommand(GPX_wrapper *gpxmw, int trackNumber, long seconds, QUndoCommand *parent) : 4 | QUndoCommand(parent), 5 | gpxmw(gpxmw), 6 | trackNumber(trackNumber), 7 | seconds(seconds) 8 | { 9 | } 10 | 11 | void TrackTimeShiftCommand::undo() 12 | { 13 | // time shift back 14 | gpxmw->timeShiftTrack(trackNumber, -seconds); 15 | } 16 | 17 | void TrackTimeShiftCommand::redo() 18 | { 19 | // time shift 20 | gpxmw->timeShiftTrack(trackNumber, seconds); 21 | } 22 | -------------------------------------------------------------------------------- /GPXLab/commands/tracktimeshiftcommand.h: -------------------------------------------------------------------------------- 1 | #ifndef TRACKTIMESHIFTCOMMAND_H 2 | #define TRACKTIMESHIFTCOMMAND_H 3 | 4 | #include 5 | #include "gpx_wrapper.h" 6 | 7 | /** 8 | * @addtogroup Commands Commands 9 | * @brief Command functions implementing QUndoCommand 10 | * @{ 11 | */ 12 | 13 | /** 14 | * @class TrackTimeShiftCommand 15 | * 16 | * @brief Time shift track command 17 | */ 18 | class TrackTimeShiftCommand : public QUndoCommand 19 | { 20 | public: 21 | 22 | /** 23 | * @brief Constructor 24 | * @param gpxmw GPX_model wrapper 25 | * @param trackNumber Track number 26 | * @param seconds Amount of seconds to shift 27 | * @param parent Parent 28 | */ 29 | TrackTimeShiftCommand(GPX_wrapper *gpxmw, int trackNumber, long seconds, QUndoCommand *parent = nullptr); 30 | 31 | /** 32 | * @brief Undo the command 33 | */ 34 | void undo(); 35 | 36 | /** 37 | * @brief Redo the command 38 | */ 39 | void redo(); 40 | 41 | private: 42 | 43 | GPX_wrapper *gpxmw; 44 | int trackNumber; 45 | long seconds; 46 | }; 47 | 48 | /** @} Commands */ 49 | 50 | #endif // TRACKTIMESHIFTCOMMAND_H 51 | -------------------------------------------------------------------------------- /GPXLab/dialogs/dialog_about.cpp: -------------------------------------------------------------------------------- 1 | #include "dialog_about.h" 2 | #include "ui_dialog_about.h" 3 | #include "gpxlab.h" 4 | 5 | Dialog_about::Dialog_about(QWidget *parent) : 6 | QDialog(parent), 7 | ui(new Ui::Dialog_about) 8 | { 9 | ui->setupUi(this); 10 | 11 | ui->labelMain->setText(GPXLab::appName + " v" + GPXLab::appVersion); 12 | ui->labelCopyright->setText("© 2014 - 2019 " + GPXLab::organisationName); 13 | ui->labelQtVersion->setText("Qt " + QString(QT_VERSION_STR)); 14 | } 15 | 16 | Dialog_about::~Dialog_about() 17 | { 18 | delete ui; 19 | } 20 | -------------------------------------------------------------------------------- /GPXLab/dialogs/dialog_about.h: -------------------------------------------------------------------------------- 1 | #ifndef DIALOG_ABOUT_H 2 | #define DIALOG_ABOUT_H 3 | 4 | #include 5 | 6 | /** 7 | * @addtogroup Dialogs Dialogs 8 | * @brief Dialogues 9 | * @{ 10 | */ 11 | 12 | namespace Ui { 13 | class Dialog_about; 14 | } 15 | 16 | /** 17 | * @class Dialog_about 18 | * 19 | * @brief About dialogue 20 | */ 21 | class Dialog_about : public QDialog 22 | { 23 | Q_OBJECT 24 | 25 | public: 26 | 27 | /** 28 | * @brief Constructs the dialogue 29 | * @param parent Parent 30 | */ 31 | explicit Dialog_about(QWidget *parent = nullptr); 32 | ~Dialog_about(); 33 | 34 | private: 35 | 36 | Ui::Dialog_about *ui; 37 | }; 38 | 39 | /** @} Dialogs */ 40 | 41 | #endif // DIALOG_ABOUT_H 42 | -------------------------------------------------------------------------------- /GPXLab/dialogs/dialog_checkupdate.cpp: -------------------------------------------------------------------------------- 1 | #include "dialog_checkupdate.h" 2 | #include "ui_dialog_checkupdate.h" 3 | #include 4 | #include 5 | 6 | Dialog_CheckUpdate::Dialog_CheckUpdate(const QString &url, const QDate& since, QWidget *parent) : 7 | QDialog(parent), 8 | ui(new Ui::Dialog_CheckUpdate), 9 | url(url), 10 | mHasUpdate(false), 11 | mDateSince(since) 12 | { 13 | ui->setupUi(this); 14 | adjustSize(); 15 | } 16 | 17 | Dialog_CheckUpdate::~Dialog_CheckUpdate() 18 | { 19 | delete ui; 20 | } 21 | 22 | void Dialog_CheckUpdate::checkForUpdate() 23 | { 24 | mHasUpdate = false; 25 | reply = qnam.get(QNetworkRequest(url)); 26 | connect(reply, SIGNAL(finished()), this, SLOT(httpFinished())); 27 | } 28 | 29 | bool Dialog_CheckUpdate::hasUpdate() const 30 | { 31 | return mHasUpdate; 32 | } 33 | 34 | bool Dialog_CheckUpdate::ignoreUpdate() const 35 | { 36 | return ui->checkBox_ignor->isChecked(); 37 | } 38 | 39 | bool Dialog_CheckUpdate::doCheckUpdate() const 40 | { 41 | return ui->cbCheckForUpdates->isChecked(); 42 | } 43 | 44 | void Dialog_CheckUpdate::httpFinished() 45 | { 46 | if (reply->error() == QNetworkReply::NoError) 47 | { 48 | QByteArray byteArray = reply->readAll(); 49 | if (url.host() == "api.github.com") 50 | mHasUpdate = parseReplyGithub(byteArray); 51 | else 52 | qWarning() << "Dialog_CheckUpdate: Unknown host:" << url.host(); 53 | } 54 | else 55 | { 56 | qWarning() << "Dialog_CheckUpdate: Network error:" << reply->error(); 57 | } 58 | emit finished(); 59 | } 60 | 61 | bool Dialog_CheckUpdate::parseReplyGithub(const QByteArray& str) 62 | { 63 | QJsonParseError jsonError; 64 | QJsonDocument reply = QJsonDocument::fromJson(str, &jsonError); 65 | if (jsonError.error != QJsonParseError::ParseError::NoError) 66 | { 67 | qWarning("Dialog_CheckUpdate: Failed to parse JSON"); 68 | return false; 69 | } 70 | 71 | QDate dtPublished = QDate::fromString(reply.object().value("published_at").toString(), Qt::ISODate); 72 | 73 | if (dtPublished > mDateSince) 74 | { 75 | QLocale locale = QLocale(); 76 | ui->lblName->setText(reply.object().value("name").toString()); 77 | ui->lblDate->setText(locale.toString(dtPublished, QLocale::ShortFormat)); 78 | ui->textEdit->setText(reply.object().value("body").toString()); 79 | ui->lblUrl->setText("Download"); 80 | return true; 81 | } 82 | 83 | return false; 84 | } 85 | -------------------------------------------------------------------------------- /GPXLab/dialogs/dialog_checkupdate.h: -------------------------------------------------------------------------------- 1 | #ifndef DIALOG_CHECKUPDATE_H 2 | #define DIALOG_CHECKUPDATE_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | namespace Ui { 10 | class Dialog_CheckUpdate; 11 | } 12 | 13 | class Dialog_CheckUpdate : public QDialog 14 | { 15 | Q_OBJECT 16 | 17 | public: 18 | explicit Dialog_CheckUpdate(const QString &url, const QDate& since, QWidget *parent = nullptr); 19 | ~Dialog_CheckUpdate(); 20 | void checkForUpdate(); 21 | bool hasUpdate() const; 22 | bool ignoreUpdate() const; 23 | bool doCheckUpdate() const; 24 | 25 | signals: 26 | void finished(); 27 | 28 | private slots: 29 | void httpFinished(); 30 | 31 | private: 32 | bool parseReplyGithub(const QByteArray &str); 33 | 34 | private: 35 | Ui::Dialog_CheckUpdate *ui; 36 | QUrl url; 37 | QNetworkAccessManager qnam; 38 | QNetworkReply *reply; 39 | bool mHasUpdate; 40 | QDate mDateSince; 41 | }; 42 | 43 | #endif // DIALOG_CHECKUPDATE_H 44 | -------------------------------------------------------------------------------- /GPXLab/dialogs/dialog_checkupdate.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | Dialog_CheckUpdate 4 | 5 | 6 | 7 | 0 8 | 0 9 | 500 10 | 400 11 | 12 | 13 | 14 | 15 | 500 16 | 400 17 | 18 | 19 | 20 | Update available 21 | 22 | 23 | true 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 0 33 | 0 34 | 35 | 36 | 37 | 38 | 75 39 | true 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | true 53 | 54 | 55 | 56 | 57 | 58 | 59 | true 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | Don't remind me of this version 69 | 70 | 71 | true 72 | 73 | 74 | 75 | 76 | 77 | 78 | Check for updates 79 | 80 | 81 | true 82 | 83 | 84 | 85 | 86 | 87 | 88 | Qt::Horizontal 89 | 90 | 91 | QDialogButtonBox::Close 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | buttonBox 103 | accepted() 104 | Dialog_CheckUpdate 105 | accept() 106 | 107 | 108 | 248 109 | 254 110 | 111 | 112 | 157 113 | 274 114 | 115 | 116 | 117 | 118 | buttonBox 119 | rejected() 120 | Dialog_CheckUpdate 121 | reject() 122 | 123 | 124 | 316 125 | 260 126 | 127 | 128 | 286 129 | 274 130 | 131 | 132 | 133 | 134 | 135 | -------------------------------------------------------------------------------- /GPXLab/dialogs/dialog_datetime.cpp: -------------------------------------------------------------------------------- 1 | #include "dialog_datetime.h" 2 | #include "ui_dialog_datetime.h" 3 | 4 | Dialog_DateTime::Dialog_DateTime(const QString title, const time_t timestamp, QWidget *parent) : 5 | QDialog(parent), 6 | ui(new Ui::Dialog_DateTime) 7 | { 8 | ui->setupUi(this); 9 | setWindowTitle(title); 10 | QDateTime dt; 11 | dt.setTime_t(timestamp); 12 | ui->dateTimeEdit->setDateTime(dt); 13 | } 14 | 15 | Dialog_DateTime::~Dialog_DateTime() 16 | { 17 | delete ui; 18 | } 19 | 20 | QDateTime Dialog_DateTime::getDateTime() const 21 | { 22 | return ui->dateTimeEdit->dateTime(); 23 | } 24 | 25 | time_t Dialog_DateTime::getTimestamp() const 26 | { 27 | QDateTime dt = ui->dateTimeEdit->dateTime(); 28 | return dt.toTime_t(); 29 | } 30 | -------------------------------------------------------------------------------- /GPXLab/dialogs/dialog_datetime.h: -------------------------------------------------------------------------------- 1 | #ifndef DIALOG_DATETIME_H 2 | #define DIALOG_DATETIME_H 3 | 4 | #include 5 | 6 | /** 7 | * @addtogroup Dialogs Dialogs 8 | * @brief Dialogues 9 | * @{ 10 | */ 11 | 12 | namespace Ui { 13 | class Dialog_DateTime; 14 | } 15 | 16 | /** 17 | * @class Dialog_DateTime 18 | * 19 | * @brief Dialogue to select a date and time 20 | */ 21 | class Dialog_DateTime : public QDialog 22 | { 23 | Q_OBJECT 24 | 25 | public: 26 | 27 | /** 28 | * @brief Constructs the dialogue 29 | * @param title Window title 30 | * @param timestamp Initial timestamp 31 | * @param parent Parent 32 | */ 33 | explicit Dialog_DateTime(const QString title, const time_t timestamp, QWidget *parent = nullptr); 34 | ~Dialog_DateTime(); 35 | 36 | /** 37 | * @brief Gets the date and time 38 | * @return Date and time 39 | */ 40 | QDateTime getDateTime() const; 41 | 42 | /** 43 | * @brief Gets the date and time as timestamp value 44 | * @return Timestamp 45 | */ 46 | time_t getTimestamp() const; 47 | 48 | private: 49 | 50 | Ui::Dialog_DateTime *ui; 51 | }; 52 | 53 | /** @} Dialogs */ 54 | 55 | #endif // DIALOG_DATETIME_H 56 | -------------------------------------------------------------------------------- /GPXLab/dialogs/dialog_datetime.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | Dialog_DateTime 4 | 5 | 6 | 7 | 0 8 | 0 9 | 220 10 | 90 11 | 12 | 13 | 14 | DateTime 15 | 16 | 17 | 18 | :/images/gpxlab.png:/images/gpxlab.png 19 | 20 | 21 | 22 | 23 | 10 24 | 50 25 | 200 26 | 30 27 | 28 | 29 | 30 | Qt::Horizontal 31 | 32 | 33 | QDialogButtonBox::Cancel|QDialogButtonBox::Ok 34 | 35 | 36 | true 37 | 38 | 39 | 40 | 41 | 42 | 10 43 | 10 44 | 200 45 | 30 46 | 47 | 48 | 49 | 50 | 10 51 | 52 | 53 | 54 | dd.MM.yyyy HH:mm:ss 55 | 56 | 57 | true 58 | 59 | 60 | Qt::LocalTime 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | buttonBox 70 | accepted() 71 | Dialog_DateTime 72 | accept() 73 | 74 | 75 | 248 76 | 254 77 | 78 | 79 | 157 80 | 274 81 | 82 | 83 | 84 | 85 | buttonBox 86 | rejected() 87 | Dialog_DateTime 88 | reject() 89 | 90 | 91 | 316 92 | 260 93 | 94 | 95 | 286 96 | 274 97 | 98 | 99 | 100 | 101 | 102 | -------------------------------------------------------------------------------- /GPXLab/dialogs/dialog_modelproperties.h: -------------------------------------------------------------------------------- 1 | #ifndef DIALOG_MODELPROPERTIES_H 2 | #define DIALOG_MODELPROPERTIES_H 3 | 4 | #include 5 | #include "gpx_model.h" 6 | 7 | /** 8 | * @addtogroup Dialogs Dialogs 9 | * @brief Dialogues 10 | * @{ 11 | */ 12 | 13 | namespace Ui { 14 | class Dialog_modelProperties; 15 | } 16 | 17 | /** 18 | * @class Dialog_modelProperties 19 | * 20 | * @brief Dialog subclass to edit the model properties (metadata) 21 | * 22 | * The dialogue can be used to see and modify the model properties (metadata). 23 | * Also it shows statistic information about the model. 24 | * 25 | * @see GPX_model 26 | */ 27 | class Dialog_modelProperties : public QDialog 28 | { 29 | Q_OBJECT 30 | 31 | public: 32 | 33 | /** 34 | * @brief Constructs the dialogue 35 | * @param metadata Model properties (metadata) to modify 36 | * @param stats Statistic information about the model 37 | * @param parent Parent 38 | */ 39 | explicit Dialog_modelProperties(GPX_metadataType &metadata, const GPX_statsType &stats, QWidget *parent = nullptr); 40 | ~Dialog_modelProperties(); 41 | 42 | private slots: 43 | 44 | void on_Dialog_modelProperties_accepted(); 45 | void on_pushButtonTableAdd_clicked(); 46 | void on_pushButtonTableDelete_clicked(); 47 | void on_pushButtonUndoName_clicked(); 48 | void on_pushButtonUndoDesc_clicked(); 49 | void on_pushButtonUndoKeywords_clicked(); 50 | void on_pushButtonUndoAuthorName_clicked(); 51 | void on_pushButtonUndoAuthorEmail_clicked(); 52 | void on_pushButtonUndoAuthorLinkURL_clicked(); 53 | void on_pushButtonUndoAuthorLinkText_clicked(); 54 | void on_pushButtonUndoAuthorLinkType_clicked(); 55 | void on_pushButtonUndoCopyrightAuthor_clicked(); 56 | void on_pushButtonUndoCopyrightYear_clicked(); 57 | void on_pushButtonUndoCopyrightLicense_clicked(); 58 | void on_lineEditName_editingFinished(); 59 | void on_lineEditDesc_editingFinished(); 60 | void on_textEditKeywords_textChanged(); 61 | void on_lineEditAuthorName_editingFinished(); 62 | void on_lineEditAuthorEmail_editingFinished(); 63 | void on_lineEditAuthorLinkURL_editingFinished(); 64 | void on_lineEditAuthorLinkText_editingFinished(); 65 | void on_lineEditAuthorLinkType_editingFinished(); 66 | void on_lineEditCopyrightAuthor_editingFinished(); 67 | void on_lineEditCopyrightYear_editingFinished(); 68 | void on_lineEditCopyrightLicense_editingFinished(); 69 | 70 | private: 71 | 72 | void setModified(bool modified); 73 | 74 | private: 75 | 76 | Ui::Dialog_modelProperties *ui; 77 | bool modified; 78 | GPX_metadataType &metadata; 79 | }; 80 | 81 | /** @} Dialogs */ 82 | 83 | #endif // DIALOG_MODELPROPERTIES_H 84 | -------------------------------------------------------------------------------- /GPXLab/dialogs/dialog_settings.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "dialog_settings.h" 3 | #include "ui_dialog_settings.h" 4 | 5 | Dialog_settings::Dialog_settings(Settings *settings, QWidget *parent) : 6 | QDialog(parent), 7 | ui(new Ui::Dialog_settings), 8 | settings(settings) 9 | { 10 | ui->setupUi(this); 11 | 12 | ui->checkBoxMapPersistentCache->setChecked(settings->doPersistentCaching); 13 | ui->lineEditMapCachePath->setText(settings->cachePath); 14 | ui->lineEditTilesURL->setText(settings->tilesURL); 15 | ui->pushButtonMapClearCache->setEnabled(settings->doPersistentCaching); 16 | ui->lineEditMapCachePath->setEnabled(settings->doPersistentCaching); 17 | ui->pushButtonMapCacheLocationSelect->setEnabled(settings->doPersistentCaching); 18 | ui->pushButtonMapCacheLocationDefault->setEnabled(settings->doPersistentCaching); 19 | ui->checkBoxAutoload->setChecked(settings->autoLoadLastFile); 20 | ui->checkBoxCheckUpdates->setChecked(settings->checkUpdate); 21 | } 22 | 23 | Dialog_settings::~Dialog_settings() 24 | { 25 | delete ui; 26 | } 27 | 28 | void Dialog_settings::on_Dialog_settings_accepted() 29 | { 30 | settings->doPersistentCaching = ui->checkBoxMapPersistentCache->isChecked(); 31 | settings->cachePath = ui->lineEditMapCachePath->text(); 32 | settings->autoLoadLastFile = ui->checkBoxAutoload->isChecked(); 33 | settings->checkUpdate = ui->checkBoxCheckUpdates->isChecked(); 34 | settings->tilesURL = ui->lineEditTilesURL->text(); 35 | 36 | settings->save(); 37 | } 38 | 39 | void Dialog_settings::on_checkBoxMapPersistentCache_toggled(bool checked) 40 | { 41 | ui->pushButtonMapClearCache->setEnabled(checked); 42 | ui->lineEditMapCachePath->setEnabled(checked); 43 | ui->pushButtonMapCacheLocationSelect->setEnabled(checked); 44 | ui->pushButtonMapCacheLocationDefault->setEnabled(checked); 45 | } 46 | 47 | void Dialog_settings::on_pushButtonMapClearCache_clicked() 48 | { 49 | settings->clearCache(); 50 | } 51 | 52 | void Dialog_settings::on_pushButtonMapCacheLocationSelect_clicked() 53 | { 54 | QString path = QFileDialog::getExistingDirectory(this, tr("Cache Location"), settings->cachePath); 55 | if (!path.isEmpty()) 56 | { 57 | ui->lineEditMapCachePath->setText(path); 58 | } 59 | } 60 | 61 | void Dialog_settings::on_pushButtonMapCacheLocationDefault_clicked() 62 | { 63 | ui->lineEditMapCachePath->setText(settings->defaultCachePath()); 64 | } 65 | 66 | void Dialog_settings::on_pushButtonTilesURLDefault_clicked() 67 | { 68 | ui->lineEditTilesURL->setText(settings->defaultTilesURL()); 69 | } 70 | -------------------------------------------------------------------------------- /GPXLab/dialogs/dialog_settings.h: -------------------------------------------------------------------------------- 1 | #ifndef DIALOG_SETTINGS_H 2 | #define DIALOG_SETTINGS_H 3 | 4 | #include 5 | #include "settings.h" 6 | 7 | /** 8 | * @addtogroup Dialogs Dialogs 9 | * @brief Dialogues 10 | * @{ 11 | */ 12 | 13 | namespace Ui { 14 | class Dialog_settings; 15 | } 16 | 17 | /** 18 | * @class Dialog_settings 19 | * 20 | * @brief Settings dialogue 21 | */ 22 | class Dialog_settings : public QDialog 23 | { 24 | Q_OBJECT 25 | 26 | public: 27 | 28 | /** 29 | * @brief Constructs the dialogue 30 | * @param settings Settings 31 | * @param parent Parent 32 | */ 33 | explicit Dialog_settings(Settings *settings, QWidget *parent = nullptr); 34 | ~Dialog_settings(); 35 | 36 | private slots: 37 | 38 | void on_Dialog_settings_accepted(); 39 | void on_checkBoxMapPersistentCache_toggled(bool checked); 40 | void on_pushButtonMapCacheLocationSelect_clicked(); 41 | void on_pushButtonMapClearCache_clicked(); 42 | void on_pushButtonMapCacheLocationDefault_clicked(); 43 | void on_pushButtonTilesURLDefault_clicked(); 44 | 45 | private: 46 | 47 | Ui::Dialog_settings *ui; 48 | Settings *settings; 49 | }; 50 | 51 | /** @} Dialogs */ 52 | 53 | #endif // DIALOG_SETTINGS_H 54 | -------------------------------------------------------------------------------- /GPXLab/dialogs/dialog_srtm.h: -------------------------------------------------------------------------------- 1 | #ifndef DIALOG_SRTM_H 2 | #define DIALOG_SRTM_H 3 | 4 | #include 5 | #include "srtm.h" 6 | #include "gpx_wrapper.h" 7 | 8 | /** 9 | * @addtogroup Dialogs Dialogs 10 | * @brief Dialogues 11 | * @{ 12 | */ 13 | 14 | namespace Ui { 15 | class Dialog_srtm; 16 | } 17 | 18 | /** 19 | * @class Dialog_srtm 20 | * 21 | * @brief Dialog subclass to get altitude values from SRTM 22 | * 23 | * The dialogue can be used to get altitude values from SRTM. 24 | * 25 | * @see GPX_model and SRTM 26 | */ 27 | class Dialog_srtm : public QDialog 28 | { 29 | Q_OBJECT 30 | 31 | public: 32 | 33 | /** 34 | * @brief Constructs the dialogue 35 | * @param gpxmw GPX_model wrapper 36 | * @param parent Parent 37 | */ 38 | explicit Dialog_srtm(const GPX_wrapper *gpxmw, QWidget *parent = nullptr); 39 | ~Dialog_srtm(); 40 | 41 | /** 42 | * @brief Get altitude values 43 | * @return values 44 | */ 45 | const QVector &getValues() const; 46 | 47 | private slots: 48 | 49 | void on_Dialog_srtm_accepted(); 50 | void on_pushButtonFetchData_clicked(); 51 | void on_horizontalSliderKernelSize_valueChanged(int value); 52 | 53 | private: 54 | 55 | void setModified(bool modified); 56 | bool generateSRTMAltitudeValues(int option); 57 | 58 | private: 59 | 60 | Ui::Dialog_srtm *ui; 61 | bool modified; 62 | SRTM *srtm; 63 | const GPX_wrapper *gpxmw; 64 | QVector values; 65 | }; 66 | 67 | /** @} Dialogs */ 68 | 69 | #endif // DIALOG_SRTM_H 70 | -------------------------------------------------------------------------------- /GPXLab/dialogs/dialog_trackproperties.h: -------------------------------------------------------------------------------- 1 | #ifndef DIALOG_TRACKPROPERTIES_H 2 | #define DIALOG_TRACKPROPERTIES_H 3 | 4 | #include 5 | #include "gpx_model.h" 6 | 7 | /** 8 | * @addtogroup Dialogs Dialogs 9 | * @brief Dialogues 10 | * @{ 11 | */ 12 | 13 | namespace Ui { 14 | class Dialog_trackProperties; 15 | } 16 | 17 | /** 18 | * @class Dialog_trackProperties 19 | * 20 | * @brief Dialog subclass to edit track properties (metadata) 21 | * 22 | * The dialogue can be used to see and modify track properties (metadata). 23 | * Also it shows statistic information about the track. 24 | * 25 | * @see GPX_model 26 | */ 27 | class Dialog_trackProperties : public QDialog 28 | { 29 | Q_OBJECT 30 | 31 | public: 32 | 33 | /** 34 | * @brief Constructs the dialogue 35 | * @param metadata Track properties (metadata) to modify 36 | * @param stats Statistic information about the track 37 | * @param parent Parent 38 | */ 39 | explicit Dialog_trackProperties(GPX_trkMetadataType &metadata, const GPX_statsType &stats, QWidget *parent = nullptr); 40 | ~Dialog_trackProperties(); 41 | 42 | private slots: 43 | 44 | void on_Dialog_trackProperties_accepted(); 45 | void on_pushButtonTableAdd_clicked(); 46 | void on_pushButtonTableDelete_clicked(); 47 | void on_pushButtonUndoName_clicked(); 48 | void on_pushButtonUndoCmt_clicked(); 49 | void on_pushButtonUndoDesc_clicked(); 50 | void on_pushButtonUndoSrc_clicked(); 51 | void on_pushButtonUndoType_clicked(); 52 | void on_lineEditName_editingFinished(); 53 | void on_lineEditCmt_editingFinished(); 54 | void on_lineEditDesc_editingFinished(); 55 | void on_lineEditSrc_editingFinished(); 56 | void on_lineEditType_editingFinished(); 57 | 58 | private: 59 | 60 | void setModified(bool modified); 61 | 62 | private: 63 | 64 | Ui::Dialog_trackProperties *ui; 65 | bool modified; 66 | GPX_trkMetadataType &metadata; 67 | }; 68 | 69 | /** @} Dialogs */ 70 | 71 | #endif // DIALOG_TRACKPROPERTIES_H 72 | -------------------------------------------------------------------------------- /GPXLab/functions/srtm.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include "srtm.h" 6 | 7 | SRTM::SRTM(SRTMModel model) : 8 | directory(), 9 | tileSize((int)model), 10 | iLatitude(-1), 11 | iLongitude(-1), 12 | failed(false) 13 | { 14 | lookup = new short[tileSize * tileSize]; 15 | } 16 | 17 | SRTM::~SRTM() 18 | { 19 | delete lookup; 20 | } 21 | 22 | string SRTM::getDirectory() const 23 | { 24 | return directory; 25 | } 26 | 27 | void SRTM::setDirectory(const string& directory) 28 | { 29 | this->directory = directory; 30 | } 31 | 32 | string SRTM::getFileName() const 33 | { 34 | stringstream ss; 35 | ss << setfill('0') 36 | << (iLatitude >= 0 ? 'N' : 'S') 37 | << setw(2) << abs(iLatitude) << setw(0) 38 | << (iLongitude >= 0 ? 'E' : 'W') 39 | << setw(3) << abs(iLongitude) << setw(0) 40 | << ".hgt"; 41 | return ss.str(); 42 | } 43 | 44 | bool SRTM::isLittleEndian() 45 | { 46 | int num = 1; 47 | if (*(char *)&num == 1) 48 | return true; 49 | else 50 | return false; 51 | } 52 | 53 | bool SRTM::parseHGT() 54 | { 55 | ifstream file; 56 | 57 | // open HGT file 58 | file.open(directory + "/" + getFileName().c_str()); 59 | if (!file) 60 | { 61 | failed = true; 62 | return false; 63 | } 64 | 65 | // read lookup table from file 66 | file.read((char*)lookup, tileSize * tileSize * sizeof(short)); 67 | 68 | // close file 69 | file.close(); 70 | 71 | // check endianness 72 | if (isLittleEndian()) 73 | { 74 | unsigned long i, max = tileSize * tileSize; 75 | short *pHeight = lookup; 76 | for (i = 0; i < max; i++) 77 | { 78 | *pHeight = (((*pHeight & 0xFF) << 8) | ((*pHeight & 0xFF00) >> 8)); 79 | ++pHeight; 80 | } 81 | } 82 | 83 | failed = false; 84 | return true; 85 | } 86 | 87 | short SRTM::bilinearInterpolate(short *inAltitudes, double inX, double inY) 88 | { 89 | double alpha = inX - (int)inX; 90 | double beta = 1 - (inY - (int)inY); 91 | double alt = (1 - alpha)*(1 - beta)*inAltitudes[0] + alpha*(1 - beta)*inAltitudes[1] 92 | + (1 - alpha)*beta*inAltitudes[2] + alpha*beta*inAltitudes[3]; 93 | return (short)alt; 94 | } 95 | 96 | short SRTM::averageNonVoid(short *inAltitudes) 97 | { 98 | double totalAltitude = 0.0; 99 | int numAlts = 0; 100 | for (int i = 0; i < 4; i++) 101 | { 102 | if (inAltitudes[i] != SRTM::INVALID_DATA) 103 | { 104 | totalAltitude += inAltitudes[i]; 105 | numAlts++; 106 | } 107 | } 108 | if (numAlts < 1) 109 | return SRTM::INVALID_DATA; 110 | return (short)(totalAltitude / numAlts); 111 | } 112 | 113 | short* SRTM::fixVoid(short *inAltitudes) 114 | { 115 | for (int i = 0; i < 4; i++) 116 | { 117 | if (inAltitudes[i] == SRTM::INVALID_DATA) 118 | inAltitudes[i] = (int)round(averageNonVoid(inAltitudes)); 119 | } 120 | return inAltitudes; 121 | } 122 | 123 | bool SRTM::getAltitude(double latitude, double longitude, short &altitude) 124 | { 125 | int _iLatitude = (int)floor(latitude); 126 | int _iLongitude = (int)floor(longitude); 127 | 128 | // check if need to parse new map file 129 | if (_iLatitude != iLatitude || _iLongitude != iLongitude || failed) 130 | { 131 | iLatitude = _iLatitude; 132 | iLongitude = _iLongitude; 133 | if (parseHGT() == false) 134 | return false; 135 | } 136 | 137 | // get only fraction part 138 | latitude -= iLatitude; 139 | longitude -= iLongitude; 140 | 141 | // get index of first point 142 | double x = longitude * tileSize - 1; 143 | double y = tileSize - latitude * tileSize - 1; 144 | int idx = ((int)y) * tileSize + (int)x; 145 | 146 | // get four point from the lookup table 147 | short fouralts[4] = {lookup[idx], 148 | lookup[idx + 1], 149 | lookup[idx - tileSize], 150 | lookup[idx - tileSize -1]}; 151 | 152 | // number of invalid values 153 | int numVoids = (fouralts[0] == SRTM::INVALID_DATA ? 1 : 0) 154 | + (fouralts[1] == SRTM::INVALID_DATA ? 1 : 0) 155 | + (fouralts[2] == SRTM::INVALID_DATA ? 1 : 0) 156 | + (fouralts[3] == SRTM::INVALID_DATA ? 1 : 0); 157 | 158 | // choose interpolation/average strategy depending on number of invalid values 159 | switch (numVoids) 160 | { 161 | case 0: 162 | altitude = bilinearInterpolate(fouralts, x, y); 163 | break; 164 | case 1: 165 | altitude = bilinearInterpolate(fixVoid(fouralts), x, y); 166 | break; 167 | case 2: 168 | case 3: 169 | altitude = averageNonVoid(fouralts); 170 | break; 171 | default: 172 | altitude = INVALID_DATA; 173 | break; 174 | } 175 | return true; 176 | } 177 | -------------------------------------------------------------------------------- /GPXLab/gpx_model/actfile.h: -------------------------------------------------------------------------------- 1 | #ifndef ACTFILE_H 2 | #define ACTFILE_H 3 | 4 | #include 5 | #include "gpx_model.h" 6 | 7 | using namespace std; 8 | 9 | /** 10 | * @ingroup GPX_model 11 | * @{ 12 | */ 13 | 14 | /** 15 | * @namespace ACTFile 16 | * 17 | * @brief Functions to load and save ACT files. 18 | * 19 | * This file provides one function to read a ACT file. 20 | * While reading the ACT file a GPX_model structure is filled. 21 | * 22 | * @see http://www.a-rival.de 23 | */ 24 | namespace ACTFile 25 | { 26 | /** 27 | * @brief Parses a ACT file and fills the GPX model 28 | * @param fp File handler to the opened GPX file 29 | * @param gpxm GPX_model 30 | * @return Return code, GPXM_OK on success 31 | */ 32 | GPX_model::retCode_e load(ifstream* fp, GPX_model* gpxm); 33 | } 34 | 35 | /** @} GPX_model */ 36 | 37 | #endif // ACTFILE_H 38 | -------------------------------------------------------------------------------- /GPXLab/gpx_model/gpxfile.h: -------------------------------------------------------------------------------- 1 | #ifndef GPXFILE_H 2 | #define GPXFILE_H 3 | 4 | #include 5 | #include "gpx_model.h" 6 | 7 | using namespace std; 8 | 9 | /** 10 | * @ingroup GPX_model 11 | * @{ 12 | */ 13 | 14 | /** 15 | * @namespace GPXFile 16 | * 17 | * @brief Functions to load and save GPX files. 18 | * 19 | * This file provides two functions to read and write a GPX file. 20 | * While reading the GPX file a GPX_model structure is filled. 21 | * In the other way a GPX file is written from a GPX_model structure. 22 | * 23 | * @see http://www.topografix.com/gpx.asp 24 | */ 25 | namespace GPXFile 26 | { 27 | /** 28 | * @brief Parses a GPX file and fills the GPX model 29 | * @param fp File handler to the opened GPX file 30 | * @param gpxm GPX_model 31 | * @param overwriteMetadata If true the metadata of GPX_model is overwritten 32 | * @return Return code, GPXM_OK on success 33 | */ 34 | GPX_model::retCode_e load(ifstream* fp, GPX_model* gpxm, bool overwriteMetadata = false); 35 | 36 | /** 37 | * @brief Saves a GPX file representing the GPX model 38 | * @param fp File handler to the opened GPX file 39 | * @param gpxm GPX model to write 40 | * @return Return code, GPXM_OK on success 41 | */ 42 | GPX_model::retCode_e save(ofstream* fp, const GPX_model* gpxm); 43 | } 44 | 45 | /** @} GPX_model */ 46 | 47 | #endif // GPXFILE_H 48 | -------------------------------------------------------------------------------- /GPXLab/gpx_model/nmeafile.h: -------------------------------------------------------------------------------- 1 | #ifndef NMEAFILE_H 2 | #define NMEAFILE_H 3 | 4 | #include 5 | #include 6 | #include "gpx_model.h" 7 | 8 | using namespace std; 9 | 10 | /** 11 | * @ingroup GPX_model 12 | * @{ 13 | */ 14 | 15 | /** 16 | * @namespace NMEAFile 17 | * 18 | * @brief Functions to load NMEA files. 19 | * 20 | * This file provides a function to read a NMEA file. 21 | * While reading the NMEA file a GPX_model structure is filled. 22 | * 23 | * @see http://www.gpsinformation.org/dale/nmea.htm 24 | */ 25 | namespace NMEAFile 26 | { 27 | /** 28 | * @brief Parses a NMEA file and fills the GPX model structure 29 | * @param fp File handler to the opened ACT file 30 | * @param gpxm GPX_model 31 | * @param name Name of the NMEA file without extension 32 | * @return Return code, GPXM_OK on success 33 | */ 34 | GPX_model::retCode_e load(ifstream* fp, GPX_model* gpxm, const string& name = ""); 35 | } 36 | 37 | /** @} GPX_model */ 38 | 39 | #endif // NMEAFILE_H 40 | -------------------------------------------------------------------------------- /GPXLab/gpx_model/utils.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include "utils.h" 5 | 6 | void UTILS_setenv(const char *name, const char *value) 7 | { 8 | #ifdef WIN32 9 | char str[128]; 10 | sprintf_s(str, 128, "%s=%s", name, value); 11 | _putenv(str); 12 | #else 13 | setenv(name, value, 1); 14 | #endif 15 | setlocale(LC_ALL, "C"); 16 | } 17 | 18 | void UTILS_unsetenv(const char *name) 19 | { 20 | #ifdef WIN32 21 | char str[128]; 22 | sprintf_s(str, 128, "%s=", name); 23 | _putenv(str); 24 | #else 25 | unsetenv(name); 26 | #endif 27 | setlocale(LC_ALL, ""); 28 | } 29 | -------------------------------------------------------------------------------- /GPXLab/gpx_model/utils.h: -------------------------------------------------------------------------------- 1 | #ifndef UTILS_H 2 | #define UTILS_H 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | /** 9 | * @brief Changes an environment variable 10 | * @param name Variable 11 | * @param value Value 12 | */ 13 | void UTILS_setenv(const char *name, const char *value); 14 | 15 | /** 16 | * @brief Seletes the variable name from the environment 17 | * @param name Variable 18 | */ 19 | void UTILS_unsetenv(const char *name); 20 | 21 | #ifdef __cplusplus 22 | } 23 | #endif 24 | 25 | #endif // UTILS_H 26 | -------------------------------------------------------------------------------- /GPXLab/gpx_model/uxmlpars.h: -------------------------------------------------------------------------------- 1 | #ifndef UXMLPARS_H 2 | #define UXMLPARS_H 3 | 4 | /** 5 | * @file uxmlpars.h 6 | * 7 | * @brief XML parser (SAX) 8 | * 9 | * Generic XML parser. 10 | * 11 | * The user must specify callback functions and a buffer (pContent) which 12 | * will contain the tag content and the size of the buffer (maxContent). 13 | * 14 | * Callback functions: 15 | * - \b UXML_GetChar Called to get the next character from a stream (file or buffer) 16 | * - \b UXML_OpenTag Called when a new tag was found (<...>) 17 | * - \b UXML_CloseTAG Called when a tag was closed () 18 | * - \b UXML_SetContent Called when a tag content was found 19 | * - \b UXML_setAttribute Called when a tag attribute was found 20 | */ 21 | 22 | #ifdef __cplusplus 23 | extern "C" { 24 | #endif 25 | 26 | /** Maximal length of a tag */ 27 | #define UXML_TAG_SIZE 256 28 | 29 | /** Function pointer for UXML_GetChar */ 30 | typedef int (*UXML_GetChar)(void* pXml); 31 | 32 | /** Function pointer for UXML_OpenTag */ 33 | typedef void (*UXML_OpenTag)(void* pXml, char* pTagName); 34 | 35 | /** Function pointer for UXML_CloseTAG */ 36 | typedef void (*UXML_CloseTAG)(void* pXml, char* pTagName); 37 | 38 | /** Function pointer for UXML_SetContent */ 39 | typedef void (*UXML_SetContent)(void* pXml, char* pTagName, char* pTagContent); 40 | 41 | /** Function pointer for UXML_setAttribute */ 42 | typedef void (*UXML_setAttribute)(void* pXml, char* pTagName, char* pAttribute, char *value); 43 | 44 | /** Parsing structure. Set here the callback functions and the tag content buffer */ 45 | typedef struct t_uXml 46 | { 47 | void* fp; /**< Input stream handler (file or buffer) */ 48 | int state; /**< User defined state for a state machine */ 49 | int eof; /**< end of file flag (0/1) or negative error code */ 50 | int encoding; /**< File encoding */ 51 | int unget_c; /**< "Ungeted" character (intern use) */ 52 | int recursionDepth; /**< Recursion depth */ 53 | int maxContent; /**< Maximal size of buffer *pContent */ 54 | char pTag[UXML_TAG_SIZE]; /**< Begin and end tag name in lower case */ 55 | char pAttribute[UXML_TAG_SIZE]; /**< Attribute name in lower case */ 56 | char* pContent; /**< Tag content buffer */ 57 | void* pObject; /**< User defined object */ 58 | UXML_GetChar getChar; /**< Called to get the next character from a stream (file or buffer) */ 59 | UXML_OpenTag openTag; /**< Called when a new tag was found (<...>) */ 60 | UXML_CloseTAG closeTag; /**< Called when a tag was closed () */ 61 | UXML_SetContent setContent; /**< Called when a tag content was found */ 62 | UXML_setAttribute setAttribute; /**< Called when a tag attribute was found */ 63 | } T_uXml; 64 | 65 | /** 66 | * @brief Initializes T_uXml structure 67 | * @param pXML Pointer to a T_uXml structure 68 | */ 69 | void UXML_init(T_uXml* pXML); 70 | 71 | /** 72 | * @brief Parses XML file 73 | * @param pXML Pointer to a T_uXml structure 74 | * @return 0 on success 75 | */ 76 | int UXML_parseFile(T_uXml* pXML); 77 | 78 | #ifdef __cplusplus 79 | } 80 | #endif 81 | 82 | #endif //UXMLPARS_H 83 | -------------------------------------------------------------------------------- /GPXLab/gpxlab.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BourgeoisLab/GPXLab/0a2e13756ed1c39f4278b0b3d6cef7f8ac9f6fe7/GPXLab/gpxlab.ico -------------------------------------------------------------------------------- /GPXLab/images/about.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BourgeoisLab/GPXLab/0a2e13756ed1c39f4278b0b3d6cef7f8ac9f6fe7/GPXLab/images/about.png -------------------------------------------------------------------------------- /GPXLab/images/app_exit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BourgeoisLab/GPXLab/0a2e13756ed1c39f4278b0b3d6cef7f8ac9f6fe7/GPXLab/images/app_exit.png -------------------------------------------------------------------------------- /GPXLab/images/arror_down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BourgeoisLab/GPXLab/0a2e13756ed1c39f4278b0b3d6cef7f8ac9f6fe7/GPXLab/images/arror_down.png -------------------------------------------------------------------------------- /GPXLab/images/arror_up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BourgeoisLab/GPXLab/0a2e13756ed1c39f4278b0b3d6cef7f8ac9f6fe7/GPXLab/images/arror_up.png -------------------------------------------------------------------------------- /GPXLab/images/close_file.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BourgeoisLab/GPXLab/0a2e13756ed1c39f4278b0b3d6cef7f8ac9f6fe7/GPXLab/images/close_file.png -------------------------------------------------------------------------------- /GPXLab/images/cog.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BourgeoisLab/GPXLab/0a2e13756ed1c39f4278b0b3d6cef7f8ac9f6fe7/GPXLab/images/cog.png -------------------------------------------------------------------------------- /GPXLab/images/down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BourgeoisLab/GPXLab/0a2e13756ed1c39f4278b0b3d6cef7f8ac9f6fe7/GPXLab/images/down.png -------------------------------------------------------------------------------- /GPXLab/images/fileappend.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BourgeoisLab/GPXLab/0a2e13756ed1c39f4278b0b3d6cef7f8ac9f6fe7/GPXLab/images/fileappend.png -------------------------------------------------------------------------------- /GPXLab/images/fileopen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BourgeoisLab/GPXLab/0a2e13756ed1c39f4278b0b3d6cef7f8ac9f6fe7/GPXLab/images/fileopen.png -------------------------------------------------------------------------------- /GPXLab/images/filesave.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BourgeoisLab/GPXLab/0a2e13756ed1c39f4278b0b3d6cef7f8ac9f6fe7/GPXLab/images/filesave.png -------------------------------------------------------------------------------- /GPXLab/images/filesaveas.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BourgeoisLab/GPXLab/0a2e13756ed1c39f4278b0b3d6cef7f8ac9f6fe7/GPXLab/images/filesaveas.png -------------------------------------------------------------------------------- /GPXLab/images/fit_point.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BourgeoisLab/GPXLab/0a2e13756ed1c39f4278b0b3d6cef7f8ac9f6fe7/GPXLab/images/fit_point.png -------------------------------------------------------------------------------- /GPXLab/images/fit_track.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BourgeoisLab/GPXLab/0a2e13756ed1c39f4278b0b3d6cef7f8ac9f6fe7/GPXLab/images/fit_track.png -------------------------------------------------------------------------------- /GPXLab/images/fit_view.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BourgeoisLab/GPXLab/0a2e13756ed1c39f4278b0b3d6cef7f8ac9f6fe7/GPXLab/images/fit_view.png -------------------------------------------------------------------------------- /GPXLab/images/flag_blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BourgeoisLab/GPXLab/0a2e13756ed1c39f4278b0b3d6cef7f8ac9f6fe7/GPXLab/images/flag_blue.png -------------------------------------------------------------------------------- /GPXLab/images/flag_finish.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BourgeoisLab/GPXLab/0a2e13756ed1c39f4278b0b3d6cef7f8ac9f6fe7/GPXLab/images/flag_finish.png -------------------------------------------------------------------------------- /GPXLab/images/flag_green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BourgeoisLab/GPXLab/0a2e13756ed1c39f4278b0b3d6cef7f8ac9f6fe7/GPXLab/images/flag_green.png -------------------------------------------------------------------------------- /GPXLab/images/flag_red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BourgeoisLab/GPXLab/0a2e13756ed1c39f4278b0b3d6cef7f8ac9f6fe7/GPXLab/images/flag_red.png -------------------------------------------------------------------------------- /GPXLab/images/follow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BourgeoisLab/GPXLab/0a2e13756ed1c39f4278b0b3d6cef7f8ac9f6fe7/GPXLab/images/follow.png -------------------------------------------------------------------------------- /GPXLab/images/gpxlab.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BourgeoisLab/GPXLab/0a2e13756ed1c39f4278b0b3d6cef7f8ac9f6fe7/GPXLab/images/gpxlab.png -------------------------------------------------------------------------------- /GPXLab/images/link.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BourgeoisLab/GPXLab/0a2e13756ed1c39f4278b0b3d6cef7f8ac9f6fe7/GPXLab/images/link.png -------------------------------------------------------------------------------- /GPXLab/images/link_break.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BourgeoisLab/GPXLab/0a2e13756ed1c39f4278b0b3d6cef7f8ac9f6fe7/GPXLab/images/link_break.png -------------------------------------------------------------------------------- /GPXLab/images/log.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BourgeoisLab/GPXLab/0a2e13756ed1c39f4278b0b3d6cef7f8ac9f6fe7/GPXLab/images/log.png -------------------------------------------------------------------------------- /GPXLab/images/map_edit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BourgeoisLab/GPXLab/0a2e13756ed1c39f4278b0b3d6cef7f8ac9f6fe7/GPXLab/images/map_edit.png -------------------------------------------------------------------------------- /GPXLab/images/minus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BourgeoisLab/GPXLab/0a2e13756ed1c39f4278b0b3d6cef7f8ac9f6fe7/GPXLab/images/minus.png -------------------------------------------------------------------------------- /GPXLab/images/plus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BourgeoisLab/GPXLab/0a2e13756ed1c39f4278b0b3d6cef7f8ac9f6fe7/GPXLab/images/plus.png -------------------------------------------------------------------------------- /GPXLab/images/point_delete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BourgeoisLab/GPXLab/0a2e13756ed1c39f4278b0b3d6cef7f8ac9f6fe7/GPXLab/images/point_delete.png -------------------------------------------------------------------------------- /GPXLab/images/point_insert.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BourgeoisLab/GPXLab/0a2e13756ed1c39f4278b0b3d6cef7f8ac9f6fe7/GPXLab/images/point_insert.png -------------------------------------------------------------------------------- /GPXLab/images/redo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BourgeoisLab/GPXLab/0a2e13756ed1c39f4278b0b3d6cef7f8ac9f6fe7/GPXLab/images/redo.png -------------------------------------------------------------------------------- /GPXLab/images/timeline.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BourgeoisLab/GPXLab/0a2e13756ed1c39f4278b0b3d6cef7f8ac9f6fe7/GPXLab/images/timeline.png -------------------------------------------------------------------------------- /GPXLab/images/track_only.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BourgeoisLab/GPXLab/0a2e13756ed1c39f4278b0b3d6cef7f8ac9f6fe7/GPXLab/images/track_only.png -------------------------------------------------------------------------------- /GPXLab/images/undo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BourgeoisLab/GPXLab/0a2e13756ed1c39f4278b0b3d6cef7f8ac9f6fe7/GPXLab/images/undo.png -------------------------------------------------------------------------------- /GPXLab/images/up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BourgeoisLab/GPXLab/0a2e13756ed1c39f4278b0b3d6cef7f8ac9f6fe7/GPXLab/images/up.png -------------------------------------------------------------------------------- /GPXLab/images/world_edit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BourgeoisLab/GPXLab/0a2e13756ed1c39f4278b0b3d6cef7f8ac9f6fe7/GPXLab/images/world_edit.png -------------------------------------------------------------------------------- /GPXLab/images/zoom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BourgeoisLab/GPXLab/0a2e13756ed1c39f4278b0b3d6cef7f8ac9f6fe7/GPXLab/images/zoom.png -------------------------------------------------------------------------------- /GPXLab/main.cpp: -------------------------------------------------------------------------------- 1 | #include "gpxlab.h" 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | #define TRANSLATIONS_DIR QStandardPaths::locate(QStandardPaths::AppDataLocation, "translations", QStandardPaths::LocateDirectory) 8 | 9 | int main(int argc, char *argv[]) 10 | { 11 | GPXLab *gxplab; 12 | QApplication app(argc, argv); 13 | app.setOrganizationName(GPXLab::organisationName); 14 | app.setApplicationName(GPXLab::appName); 15 | app.setApplicationVersion(GPXLab::appVersion); 16 | 17 | QTranslator gpxlab; 18 | gpxlab.load(QLocale::system(), "gpxlab", "_", TRANSLATIONS_DIR); 19 | app.installTranslator(&gpxlab); 20 | 21 | QTranslator qt; 22 | #if defined(Q_OS_WIN32) || defined(Q_OS_MAC) 23 | qt.load(QLocale::system(), "qt", "_", TRANSLATIONS_DIR); 24 | #else 25 | qt.load(QLocale::system(), "qt", "_", QLibraryInfo::location(QLibraryInfo::TranslationsPath)); 26 | #endif 27 | app.installTranslator(&qt); 28 | 29 | if (argc > 1) 30 | gxplab = new GPXLab(QString(argv[1])); 31 | else 32 | gxplab = new GPXLab(); 33 | gxplab->show(); 34 | return app.exec(); 35 | } 36 | -------------------------------------------------------------------------------- /GPXLab/qutils.cpp: -------------------------------------------------------------------------------- 1 | #include "qutils.h" 2 | 3 | QString QUtils::seconds_to_DHMS(unsigned int seconds, unsigned int milliseconds) 4 | { 5 | QString str; 6 | int sec = seconds % 60; 7 | seconds /= 60; 8 | int min = seconds % 60; 9 | seconds /= 60; 10 | int hours = seconds % 24; 11 | int days = seconds / 24; 12 | if(hours == 0 && days == 0) 13 | str.sprintf("%02d:%02d", min, sec); 14 | else if (days == 0) 15 | str.sprintf("%02d:%02d:%02d", hours, min, sec); 16 | else 17 | str.sprintf("%dd%02d:%02d:%02d", days, hours, min, sec); 18 | if (milliseconds > 0) 19 | str += "." + QString("%1").arg(milliseconds, 3, 10, QChar('0')); 20 | return str; 21 | } 22 | 23 | QVector QUtils::movingAverage(const QVector &values, int window_size) 24 | { 25 | if (window_size <= 1) 26 | return values; 27 | 28 | QVector result(values.size()); 29 | int idx = 0; 30 | double* ptr = &result[idx]; 31 | 32 | int n_left, n_right; 33 | if (window_size % 2 == 0) // even window size 34 | { 35 | n_left = window_size / 2; 36 | n_right = window_size / 2 - 1; 37 | } 38 | else // odd window size 39 | { 40 | n_left = (window_size - 1) / 2; 41 | n_right = (window_size - 1) / 2; 42 | } 43 | 44 | // begin part 45 | int window_size_trunc = n_right + 1; 46 | for (; idx < n_left; idx++) 47 | { 48 | double sum = 0.0; 49 | for (int i = 0; i < window_size_trunc; i++) 50 | sum += values[i]; 51 | *ptr++ = sum / window_size_trunc; 52 | window_size_trunc++; 53 | } 54 | 55 | // middle part 56 | for (; idx < values.size() - n_right; idx++) 57 | { 58 | double sum = 0.0; 59 | for (int i = idx - n_left; i <= idx + n_right; i++) 60 | sum += values[i]; 61 | *ptr++ = sum / window_size; 62 | } 63 | 64 | // end part 65 | window_size_trunc = window_size - 1; 66 | for (; idx < values.size(); idx++) 67 | { 68 | double sum = 0.0; 69 | for (int i = idx - n_left; i < values.size(); i++) 70 | sum += values[i]; 71 | *ptr++ = sum / window_size_trunc; 72 | window_size_trunc--; 73 | } 74 | return result; 75 | } 76 | -------------------------------------------------------------------------------- /GPXLab/qutils.h: -------------------------------------------------------------------------------- 1 | #ifndef QUTILS_H 2 | #define QUTILS_H 3 | 4 | #include 5 | #include 6 | 7 | /** 8 | * @ingroup GPXLab 9 | * @{ 10 | */ 11 | 12 | /** 13 | * @namespace QUtils 14 | * 15 | * @brief Utility functions. 16 | * 17 | * Utility functions. 18 | * These functions may use Qt stuff. 19 | */ 20 | namespace QUtils 21 | { 22 | /** 23 | * @brief Converts an amount of seconds in a human readable string. 24 | * @param seconds Amount of seconds 25 | * @param milliseconds Amount of milliseconds, default 0 26 | * @return String in format "m:s[.mmm]", "h:m:s[.mmm]" or "ddh:m:s[.mmm]" 27 | */ 28 | QString seconds_to_DHMS(unsigned int seconds, unsigned int milliseconds = 0); 29 | 30 | 31 | /** 32 | * @brief Averages the values with a moving average algorithm 33 | * @param values Values to average 34 | * @param window_size Window size of moving average 35 | * @return Averaged values 36 | */ 37 | QVector movingAverage(const QVector &values, int window_size); 38 | } 39 | 40 | /** @} GPXLab */ 41 | 42 | #endif // QUTILS_H 43 | -------------------------------------------------------------------------------- /GPXLab/resources.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | images/gpxlab.png 4 | images/fileopen.png 5 | images/fileappend.png 6 | images/filesave.png 7 | images/filesaveas.png 8 | images/up.png 9 | images/down.png 10 | images/world_edit.png 11 | images/map_edit.png 12 | images/undo.png 13 | images/redo.png 14 | images/plus.png 15 | images/minus.png 16 | images/log.png 17 | images/fit_view.png 18 | images/fit_track.png 19 | images/fit_point.png 20 | images/follow.png 21 | images/track_only.png 22 | images/arror_down.png 23 | images/arror_up.png 24 | images/flag_finish.png 25 | images/flag_green.png 26 | images/flag_blue.png 27 | images/flag_red.png 28 | images/zoom.png 29 | images/link.png 30 | images/link_break.png 31 | images/cog.png 32 | images/point_delete.png 33 | images/point_insert.png 34 | images/timeline.png 35 | images/app_exit.png 36 | images/close_file.png 37 | images/about.png 38 | 39 | 40 | -------------------------------------------------------------------------------- /GPXLab/settings.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include "settings.h" 5 | 6 | Settings::Settings(QMainWindow *parent) : 7 | undoLimit(50), 8 | maxRecentFiles(5), 9 | parent(parent) 10 | { 11 | // save default window layout 12 | defaultState = parent->saveState(); 13 | defaultGeometry = parent->saveGeometry(); 14 | } 15 | 16 | void Settings::load() 17 | { 18 | QSettings qsettings; 19 | parent->restoreGeometry(qsettings.value("geometry").toByteArray()); 20 | parent->restoreState(qsettings.value("windowState").toByteArray()); 21 | recentFiles = qsettings.value("recentFileList").toStringList(); 22 | doPersistentCaching = qsettings.value("doPersistentCaching", true).toBool(); 23 | cachePath = qsettings.value("cachePath", "").toString(); 24 | tilesURL = qsettings.value("tilesURL", "").toString(); 25 | lastOpenedPath = qsettings.value("lastOpenedFilePath", "").toString(); 26 | if (cachePath.isEmpty()) 27 | cachePath = defaultCachePath(); 28 | autoLoadLastFile = qsettings.value("autoLoadLastFile", true).toBool(); 29 | checkUpdate = qsettings.value("checkUpdate", true).toBool(); 30 | checkUpdateUrl = qsettings.value("checkUpdateUrl", "https://api.github.com/repos/bourgeoislab/gpxlab/releases/latest").toString(); 31 | checkUpdateLastDate = qsettings.value("checkUpdateLastDate", QDate()).toDate(); 32 | if (tilesURL.isEmpty()) 33 | tilesURL = defaultTilesURL(); 34 | emit settingsChanged(true); 35 | } 36 | 37 | void Settings::save() 38 | { 39 | QSettings qsettings; 40 | qsettings.setValue("geometry", parent->saveGeometry()); 41 | qsettings.setValue("windowState", parent->saveState()); 42 | qsettings.setValue("recentFileList", recentFiles); 43 | qsettings.setValue("doPersistentCaching", doPersistentCaching); 44 | qsettings.setValue("cachePath", cachePath); 45 | qsettings.setValue("autoLoadLastFile", autoLoadLastFile); 46 | qsettings.setValue("checkUpdate", checkUpdate); 47 | qsettings.setValue("checkUpdateLastDate", checkUpdateLastDate); 48 | qsettings.setValue("tilesURL", tilesURL); 49 | qsettings.setValue("lastOpenedPath", lastOpenedPath); 50 | emit settingsChanged(false); 51 | } 52 | 53 | void Settings::restoreLayout() 54 | { 55 | // restore default window layout 56 | parent->restoreGeometry(defaultGeometry); 57 | parent->restoreState(defaultState); 58 | } 59 | 60 | void Settings::setValue(const QString &key, const QVariant &value) 61 | { 62 | QSettings qsettings; 63 | qsettings.setValue(key, value); 64 | emit settingsChanged(true); 65 | } 66 | 67 | QVariant Settings::getValue(const QString &key) 68 | { 69 | QSettings qsettings; 70 | return qsettings.value(key); 71 | } 72 | 73 | ////////////////////////////////////////////////////////////////////////////// 74 | 75 | void Settings::addToRecentFile(const QString &fileName) 76 | { 77 | recentFiles.removeAll(fileName); 78 | recentFiles.prepend(fileName); 79 | while (recentFiles.size() > maxRecentFiles) 80 | recentFiles.removeLast(); 81 | } 82 | 83 | void Settings::removeFromRecentFile(const QString &fileName) 84 | { 85 | recentFiles.removeAll(fileName); 86 | } 87 | 88 | ////////////////////////////////////////////////////////////////////////////// 89 | 90 | void Settings::clearCache() 91 | { 92 | QDir cache(cachePath); 93 | 94 | cache.setFilter( QDir::NoDotAndDotDot | QDir::Files ); 95 | foreach(QString dirItem, cache.entryList()) 96 | cache.remove(dirItem); 97 | 98 | cache.setFilter( QDir::NoDotAndDotDot | QDir::Dirs ); 99 | foreach( QString dirItem, cache.entryList()) 100 | { 101 | QDir subDir( cache.absoluteFilePath( dirItem ) ); 102 | subDir.removeRecursively(); 103 | } 104 | } 105 | 106 | QString Settings::defaultCachePath() 107 | { 108 | return QStandardPaths::writableLocation(QStandardPaths::CacheLocation); 109 | } 110 | 111 | QString Settings::defaultTilesURL() 112 | { 113 | return QString("http://tile.openstreetmap.org/%1/%2/%3.png"); 114 | } 115 | -------------------------------------------------------------------------------- /GPXLab/settings.h: -------------------------------------------------------------------------------- 1 | #ifndef SETTINGS_H 2 | #define SETTINGS_H 3 | 4 | /** 5 | * @ingroup GPXLab 6 | * @{ 7 | */ 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | /** 15 | * @class Settings 16 | * 17 | * @brief Manage the settings 18 | */ 19 | class Settings : public QObject 20 | { 21 | Q_OBJECT 22 | 23 | public: 24 | 25 | /** 26 | * @brief Constructor 27 | */ 28 | Settings(QMainWindow *parent); 29 | 30 | /** 31 | * @brief Saves the settings 32 | */ 33 | void save(); 34 | 35 | /** 36 | * @brief Saves the settings 37 | */ 38 | void load(); 39 | 40 | /** 41 | * @brief Restores the window layout 42 | */ 43 | void restoreLayout(); 44 | 45 | /** 46 | * @brief Sets a settings 47 | * @param key Key 48 | * @param value Value 49 | */ 50 | void setValue(const QString &key, const QVariant &value); 51 | 52 | /** 53 | * @brief Gets a settings 54 | * @param key Key 55 | * @return Value 56 | */ 57 | QVariant getValue(const QString &key); 58 | 59 | /** 60 | * @brief Adds a file to the recent file list 61 | * @param fileName File name 62 | */ 63 | void addToRecentFile(const QString &fileName); 64 | 65 | /** 66 | * @brief Removes a file from the recent file list 67 | * @param fileName File name 68 | */ 69 | void removeFromRecentFile(const QString &fileName); 70 | 71 | /** 72 | * @brief Clears the cache 73 | */ 74 | void clearCache(); 75 | 76 | /** 77 | * @brief Returns the default cache path 78 | * @return Default cache path 79 | */ 80 | QString defaultCachePath(); 81 | 82 | /** 83 | * @brief Returns the default tiles URL 84 | * @return Default tiles URL 85 | */ 86 | QString defaultTilesURL(); 87 | 88 | /** 89 | * @brief Maximal number of undo commands stored 90 | */ 91 | const int undoLimit; 92 | 93 | /** 94 | * @brief Maximal number of recent files shown in the file menu 95 | */ 96 | const int maxRecentFiles; 97 | 98 | /** 99 | * @brief List of the recent files shown in the file menu 100 | */ 101 | QStringList recentFiles; 102 | 103 | /** 104 | * @brief Do persistent caching of map tiles 105 | */ 106 | bool doPersistentCaching; 107 | 108 | /** 109 | * @brief Path to the tiles cache directory 110 | */ 111 | QString cachePath; 112 | 113 | /** 114 | * @brief Loads the last opened file on startup 115 | */ 116 | bool autoLoadLastFile; 117 | 118 | /** 119 | * @brief Checks for update at the start of the program 120 | */ 121 | bool checkUpdate; 122 | 123 | /** 124 | * @brief URL to check for updates 125 | */ 126 | QString checkUpdateUrl; 127 | 128 | /** 129 | * @brief Last date of the update check 130 | */ 131 | QDate checkUpdateLastDate; 132 | 133 | /** 134 | * @brief Tiles URL 135 | */ 136 | QString tilesURL; 137 | 138 | /** 139 | * @brief Last opened file path 140 | */ 141 | QString lastOpenedPath; 142 | 143 | signals: 144 | 145 | /** 146 | * @brief Signal when settings are loaded or saved 147 | */ 148 | void settingsChanged(bool loaded); 149 | 150 | private: 151 | 152 | QMainWindow *parent; 153 | QByteArray defaultState; 154 | QByteArray defaultGeometry; 155 | }; 156 | 157 | /** @} GPXLab */ 158 | 159 | #endif // SETTINGS_H 160 | -------------------------------------------------------------------------------- /GPXLab/widgets/qcalendarwidgetext.cpp: -------------------------------------------------------------------------------- 1 | #include "qcalendarwidgetext.h" 2 | 3 | QCalendarWidgetExt::QCalendarWidgetExt(QWidget *parent) : 4 | QCalendarWidget(parent), 5 | selecting(false) 6 | { 7 | connect(this, SIGNAL(selectionChanged()), this, SLOT(selectionChangedExt())); 8 | format.setBackground(QBrush(QColor(200,200,200))); 9 | } 10 | 11 | QCalendarWidgetExt::~QCalendarWidgetExt() 12 | { 13 | 14 | } 15 | 16 | void QCalendarWidgetExt::init(const GPX_wrapper *gpxmw) 17 | { 18 | this->gpxmw = gpxmw; 19 | } 20 | 21 | void QCalendarWidgetExt::build() 22 | { 23 | clear(); 24 | 25 | if (gpxmw->initTrkIteration() > 0) 26 | { 27 | const GPX_trkType* trk; 28 | while ((trk = gpxmw->getNextTrk())) 29 | { 30 | QDateTime dt = QDateTime::fromTime_t(trk->stats.startTime); 31 | setDateTextFormat(dt.date(), format); 32 | } 33 | } 34 | } 35 | 36 | void QCalendarWidgetExt::clear() 37 | { 38 | setDateTextFormat(QDate(), QTextCharFormat()); 39 | } 40 | 41 | void QCalendarWidgetExt::selectionChangedExt() 42 | { 43 | if (selecting) 44 | return; 45 | if (gpxmw->initTrkIteration() > 0) 46 | { 47 | int trackNumber = 0; 48 | const GPX_trkType* trk; 49 | while ((trk = gpxmw->getNextTrk())) 50 | { 51 | QDateTime dt = QDateTime::fromTime_t(trk->stats.startTime); 52 | if (selectedDate() == dt.date()) 53 | { 54 | emit(selectionChanged(trackNumber)); 55 | return; 56 | } 57 | ++trackNumber; 58 | } 59 | } 60 | } 61 | 62 | void QCalendarWidgetExt::select(int trackNumber) 63 | { 64 | const GPX_trkType* trk = gpxmw->getTrack(trackNumber); 65 | if (trk) 66 | { 67 | QDateTime dt = QDateTime::fromTime_t(trk->stats.startTime); 68 | selecting = true; 69 | setSelectedDate(dt.date()); 70 | selecting = false; 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /GPXLab/widgets/qcalendarwidgetext.h: -------------------------------------------------------------------------------- 1 | #ifndef QCALENDARWIDGETEXT_H 2 | #define QCALENDARWIDGETEXT_H 3 | 4 | #include 5 | #include 6 | #include "gpx_wrapper.h" 7 | 8 | /** 9 | * @addtogroup Widgets Widgets 10 | * @brief Widgets related functions 11 | * @{ 12 | */ 13 | 14 | /** 15 | * @class QCalendarWidgetExt 16 | * 17 | * @brief QCalendarWidget subclass 18 | * 19 | * Extends the QCalendarWidget class. 20 | * 21 | * @see QCalendarWidget 22 | */ 23 | class QCalendarWidgetExt : public QCalendarWidget 24 | { 25 | Q_OBJECT 26 | 27 | public: 28 | 29 | /** 30 | * @brief Constructor 31 | * @param parent Parent 32 | */ 33 | QCalendarWidgetExt(QWidget *parent = nullptr); 34 | ~QCalendarWidgetExt(); 35 | 36 | /** 37 | * @brief Initializes the widget 38 | * @note Call this function prior to any other function 39 | * @param gpxmw GPX_model wrapper 40 | */ 41 | void init(const GPX_wrapper *gpxmw); 42 | 43 | /** 44 | * @brief Builds the widget 45 | */ 46 | void build(); 47 | 48 | /** 49 | * @brief Clears the widget 50 | */ 51 | void clear(); 52 | 53 | /** 54 | * @brief Selects a date corresponding to the track 55 | * @param trackNumber Track number 56 | */ 57 | void select(int trackNumber); 58 | 59 | signals: 60 | 61 | /** 62 | * @brief Signal when a new date was selected with a track on this day 63 | * @see selectionChangedExt() 64 | * @param trackNumber Track number 65 | */ 66 | void selectionChanged(int trackNumber); 67 | 68 | private slots: 69 | 70 | void selectionChangedExt(); 71 | 72 | private: 73 | 74 | const GPX_wrapper *gpxmw; 75 | QTextCharFormat format; 76 | bool selecting; 77 | }; 78 | 79 | /** @} Widgets */ 80 | 81 | #endif // QCALENDARWIDGETEXT_H 82 | -------------------------------------------------------------------------------- /GPXLab/widgets/qcustomplotext.cpp: -------------------------------------------------------------------------------- 1 | #include "qcustomplotext.h" 2 | 3 | QCustomPlotExt::QCustomPlotExt(QWidget *parent) : 4 | QCustomPlot(parent), 5 | marker(nullptr) 6 | { 7 | clearExt(); 8 | setInteractions(QCP::iRangeDrag | QCP::iRangeZoom); 9 | axisRect()->setRangeDrag(Qt::Horizontal | Qt::Vertical); 10 | axisRect()->setRangeZoom(Qt::Horizontal | Qt::Vertical); 11 | connect(this, SIGNAL(mouseWheel(QWheelEvent*)), this, SLOT(mouseWheel(QWheelEvent*))); 12 | connect(xAxis, SIGNAL(rangeChanged(QCPRange)), this, SLOT(xAxisRangeChanged(QCPRange))); 13 | connect(yAxis, SIGNAL(rangeChanged(QCPRange)), this, SLOT(yAxisRangeChanged(QCPRange))); 14 | } 15 | 16 | void QCustomPlotExt::addMarker() 17 | { 18 | QPen pen; 19 | pen.setColor(Qt::darkRed); 20 | pen.setStyle(Qt::DashLine); 21 | addMarker(pen); 22 | } 23 | 24 | void QCustomPlotExt::addMarker(const QPen &pen) 25 | { 26 | const QVector markerValues = QVector() << 0 << 0; 27 | marker = new QCPCurve(xAxis, yAxis); 28 | marker->setPen(pen); 29 | marker->setData(markerValues, markerValues); 30 | addPlottable(marker); 31 | connect(this, SIGNAL(mousePress(QMouseEvent*)), this, SLOT(mousePress(QMouseEvent*))); 32 | markerValue = 0.0; 33 | } 34 | 35 | void QCustomPlotExt::updateMarker() 36 | { 37 | if (marker) 38 | { 39 | QCPCurveDataMap *dataMap = marker->data(); 40 | QMap::iterator i = dataMap->begin(); 41 | i.value().key = markerValue; 42 | i.value().value = yAxis->range().lower; 43 | ++i; 44 | i.value().key = markerValue; 45 | i.value().value = yAxis->range().upper; 46 | } 47 | } 48 | 49 | void QCustomPlotExt::setMarkerValue(double value) 50 | { 51 | if (marker) 52 | { 53 | markerValue = value; 54 | updateMarker(); 55 | replot(); 56 | } 57 | } 58 | 59 | double QCustomPlotExt::getMarkerValue() const 60 | { 61 | return markerValue; 62 | } 63 | 64 | void QCustomPlotExt::clearExt() 65 | { 66 | xAxisRangeOrg.lower = QCPRange::minRange; 67 | xAxisRangeOrg.upper = QCPRange::maxRange; 68 | plotYOffset = 0.0; 69 | plotYGain = 1.0; 70 | markerValue = 0.0; 71 | } 72 | 73 | void QCustomPlotExt::updateExt() 74 | { 75 | xAxisRangeOrg = xAxis->range(); 76 | 77 | // set gain and offset to adapt yAxis2 range to yAxis range keeping ratio 78 | plotYOffset = yAxis->range().lower - yAxis2->range().lower; 79 | plotYGain = (yAxis2->range().upper - yAxis2->range().lower) / (yAxis->range().upper - yAxis->range().lower); 80 | } 81 | 82 | void QCustomPlotExt::mouseWheel(QWheelEvent *event) 83 | { 84 | if (event->modifiers()& Qt::ShiftModifier) 85 | { 86 | axisRect()->setRangeZoom(Qt::Vertical); 87 | } 88 | else if (event->delta() < 0 && xAxisRangeOrg == xAxis->range()) 89 | { 90 | axisRect()->setRangeZoom(0); 91 | } 92 | else 93 | { 94 | if (event->modifiers()& Qt::ControlModifier) 95 | axisRect()->setRangeZoom(Qt::Horizontal); 96 | else 97 | axisRect()->setRangeZoom(Qt::Horizontal | Qt::Vertical); 98 | } 99 | } 100 | 101 | void QCustomPlotExt::mousePress(QMouseEvent* event) 102 | { 103 | if (event->button() == Qt::LeftButton) 104 | { 105 | if (marker) 106 | { 107 | if(axisRect()->rect().contains(event->pos())) 108 | setMarkerValue(xAxis->pixelToCoord(event->x())); 109 | } 110 | } 111 | } 112 | 113 | void QCustomPlotExt::yAxisRangeChanged(const QCPRange& range) 114 | { 115 | yAxis2->setRange((range - plotYOffset) * plotYGain); 116 | updateMarker(); 117 | } 118 | 119 | void QCustomPlotExt::xAxisRangeChanged(const QCPRange& range) 120 | { 121 | double delta = range.upper - range.lower; 122 | if (range.lower < xAxisRangeOrg.lower) 123 | { 124 | if (xAxisRangeOrg.lower + delta < xAxisRangeOrg.upper) 125 | xAxis->setRange(QCPRange(xAxisRangeOrg.lower, xAxisRangeOrg.lower + delta)); 126 | else 127 | xAxis->setRange(xAxisRangeOrg); 128 | } 129 | else if (range.upper > xAxisRangeOrg.upper) 130 | { 131 | if (xAxisRangeOrg.upper - delta > xAxisRangeOrg.lower) 132 | xAxis->setRange(QCPRange(xAxisRangeOrg.upper - delta, xAxisRangeOrg.upper)); 133 | else 134 | xAxis->setRange(xAxisRangeOrg); 135 | } 136 | updateMarker(); 137 | } 138 | 139 | void QCustomPlotExt::getMinMax(const QVector& vec, double& min, double& max) 140 | { 141 | min = std::numeric_limits::max(); 142 | max = std::numeric_limits::min(); 143 | foreach (double val, vec) 144 | { 145 | min = qMin(min, val); 146 | max = qMax(max, val); 147 | } 148 | } 149 | -------------------------------------------------------------------------------- /GPXLab/widgets/qcustomplotext.h: -------------------------------------------------------------------------------- 1 | #ifndef QCUSTOMPLOTEXT_H 2 | #define QCUSTOMPLOTEXT_H 3 | 4 | #include "qcustomplot.h" 5 | 6 | /** 7 | * @addtogroup Widgets Widgets 8 | * @brief Widgets related functions 9 | * @{ 10 | */ 11 | 12 | /** 13 | * @class QCustomPlotExt 14 | * 15 | * @brief QCustomPlot subclass 16 | * 17 | * Extends the QCustomPlot class by adding a marker and defines the 18 | * behaviour of panning and zooming. 19 | * 20 | * The marker shows a location on the plot. The marker can be moved by 21 | * clicking inside the plot or using the function setMarkerValue(). 22 | * 23 | * Zooming behaviour: 24 | * - Mouse wheel: zoom both x and y axis 25 | * - SHIFT + mouse wheel: zoom y axis only 26 | * - CTRL + mouse wheel: zoom x axis only 27 | * 28 | * Both yAxis and yAxis2 are zoomed and panned. The aspect ratio between 29 | * both are kept. 30 | * 31 | * @see QCustomPlot 32 | */ 33 | class QCustomPlotExt : public QCustomPlot 34 | { 35 | Q_OBJECT 36 | 37 | public: 38 | 39 | /** 40 | * @brief Gets the minimal and maximal value from a vector 41 | * @param vec Vector 42 | * @param min Minimal value 43 | * @param max Maximal value 44 | */ 45 | static void getMinMax(const QVector& vec, double &min, double &max); 46 | 47 | /** 48 | * @brief Constructor 49 | * @param parent Parent 50 | */ 51 | explicit QCustomPlotExt(QWidget *parent = nullptr); 52 | 53 | /** 54 | * @brief Adds a marker with the default QPen 55 | */ 56 | void addMarker(); 57 | 58 | /** 59 | * @brief Adds a marker 60 | * @param pen QPen to draw the marker 61 | */ 62 | void addMarker(const QPen &pen); 63 | 64 | /** 65 | * @brief Gets the marker value 66 | * @return Marker value on the x axis 67 | */ 68 | double getMarkerValue() const; 69 | 70 | /** 71 | * @brief Sets the marker value 72 | * @param value Value on the x axis 73 | */ 74 | void setMarkerValue(double value); 75 | 76 | /** 77 | * @brief Clear extensions 78 | * @note Call this function before calling any setRange() 79 | */ 80 | void clearExt(); 81 | 82 | /** 83 | * @brief Updates extensions 84 | * @note Call this function after calling any setData() 85 | */ 86 | void updateExt(); 87 | 88 | private slots: 89 | 90 | void yAxisRangeChanged(const QCPRange& range); 91 | void xAxisRangeChanged(const QCPRange& range); 92 | void mouseWheel(QWheelEvent *event); 93 | void mousePress(QMouseEvent* event); 94 | 95 | private: 96 | 97 | QCPCurve *marker; 98 | QCPRange xAxisRangeOrg; 99 | double plotYOffset; 100 | double plotYGain; 101 | double markerValue; 102 | void updateMarker(); 103 | }; 104 | 105 | /** @} Widgets */ 106 | 107 | #endif // QCUSTOMPLOTEXT_H 108 | -------------------------------------------------------------------------------- /GPXLab/widgets/qdiagramwidget.h: -------------------------------------------------------------------------------- 1 | #ifndef QDIAGRAMWIDGET_H 2 | #define QDIAGRAMWIDGET_H 3 | 4 | #include "qcustomplotext.h" 5 | #include "gpx_wrapper.h" 6 | 7 | /** 8 | * @addtogroup Widgets Widgets 9 | * @brief Widgets related functions 10 | * @{ 11 | */ 12 | 13 | /** 14 | * @class QDiagramWidget 15 | * 16 | * @brief QCustomPlotExt subclass 17 | * 18 | * Extends the QCustomPlotExt class by adding a setData() function. 19 | * 20 | * @see QCustomPlotExt 21 | */ 22 | class QDiagramWidget : public QCustomPlotExt 23 | { 24 | Q_OBJECT 25 | 26 | public: 27 | 28 | /** 29 | * @brief Constructor 30 | * @param parent Parent 31 | */ 32 | explicit QDiagramWidget(QWidget *parent = nullptr); 33 | 34 | /** 35 | * @brief init 36 | * @param gpxmw GPX_model wrapper 37 | */ 38 | void init(const GPX_wrapper *gpxmw); 39 | 40 | /** 41 | * @brief Sets new diagram values 42 | */ 43 | void build(); 44 | 45 | /** 46 | * @brief Clears the diagram 47 | */ 48 | void clear(); 49 | 50 | /** 51 | * @brief Selects a new value 52 | * @param timestamp New timestamp 53 | */ 54 | void select(time_t timestamp); 55 | 56 | /** 57 | * @brief Gets the property of the main curve 58 | * @return Property 59 | */ 60 | GPX_wrapper::TrackPointProperty getCurveMain() const; 61 | 62 | /** 63 | * @brief Gets the property of the secondary curve 64 | * @return Property 65 | */ 66 | GPX_wrapper::TrackPointProperty getCurveSecondary() const; 67 | 68 | signals: 69 | 70 | /** 71 | * @brief Signal when the selection changed 72 | * @param timestamp New timestamp 73 | */ 74 | void selectionChanged(time_t timestamp); 75 | 76 | private slots: 77 | 78 | void newSelection(QMouseEvent* event); 79 | void on_actionCurveMain_triggered(); 80 | void on_actionCurveSecondary_triggered(); 81 | 82 | private: 83 | 84 | const GPX_wrapper *gpxmw; 85 | time_t startTimestamp; 86 | GPX_wrapper::TrackPointProperty curveMain; 87 | GPX_wrapper::TrackPointProperty curveSecondary; 88 | }; 89 | 90 | /** @} Widgets */ 91 | 92 | #endif // QDIAGRAMWIDGET_H 93 | -------------------------------------------------------------------------------- /GPXLab/widgets/qmaptrack.h: -------------------------------------------------------------------------------- 1 | #ifndef QMAPTRACK_H 2 | #define QMAPTRACK_H 3 | 4 | #include "point.h" 5 | #include "curve.h" 6 | #include "gpx_wrapper.h" 7 | #include "qpixmapext.h" 8 | 9 | using namespace qmapcontrol; 10 | 11 | /** 12 | * @addtogroup Widgets Widgets 13 | * @brief Widgets related functions 14 | * @{ 15 | */ 16 | 17 | /** 18 | * @class QMapTrack 19 | * 20 | * @brief Curve subclass 21 | * 22 | * Extends the Curve class. 23 | * 24 | * @see Curve 25 | */ 26 | class QMapTrack : public Curve 27 | { 28 | Q_OBJECT 29 | 30 | public: 31 | 32 | /** 33 | * @brief Creates a new QMapTrack 34 | * @param gpxmw GPX_model wrapper 35 | * @param trackNumber Track number of the new track 36 | * @param track Track 37 | */ 38 | QMapTrack(const GPX_wrapper *gpxmw, int trackNumber, const GPX_trkType *track); 39 | ~QMapTrack(); 40 | 41 | /** 42 | * @brief Returns the bounding box of the track 43 | * @return Bounding box 44 | */ 45 | QRectF boundingBox(); 46 | 47 | /** 48 | * @brief Gets the track number 49 | * @return Track number 50 | */ 51 | int getTrackNumber() const; 52 | 53 | /** 54 | * @brief Sets the track number 55 | * @param number Track number 56 | */ 57 | void setTrackNumber(int number); 58 | 59 | /** 60 | * @brief Gets the track segment touched by a mouse click 61 | * @return Track segment 62 | */ 63 | int getTouchedSegmentNumber() const; 64 | 65 | /** 66 | * @brief Gets the point touched by a mouse click 67 | * @return Touched point 68 | */ 69 | const GPX_wptType *getTouchedPoint() const; 70 | 71 | /** 72 | * @brief Sets if the mouse is currently above the track 73 | * @param over True if mouse over the track 74 | */ 75 | void setMouseOver(bool over); 76 | 77 | private: 78 | 79 | /** 80 | * @brief Draws a arrow pixmap 81 | * @param sideLength Side length of arrow 82 | * @param heading Heading of arrow 83 | * @param pen Pen 84 | * @return Pixmap 85 | */ 86 | static QPixmapExt drawArrow(int sideLength, qreal heading, QPen* pen = 0); 87 | 88 | /** 89 | * @brief Computes the euclid distance between two points 90 | * @param A Point A 91 | * @param B Point B 92 | * @return Distance 93 | */ 94 | static int distance(QPoint &A, QPoint &B); 95 | 96 | /** 97 | * @brief Point in the curve 98 | * @return Point list 99 | */ 100 | QList points(); 101 | 102 | /** 103 | * @brief Draws the track 104 | * @param painter Painter 105 | * @param mapadapter Map adapter 106 | * @param screensize Screen size 107 | * @param offset Offet 108 | */ 109 | void draw(QPainter* painter, const MapAdapter* mapadapter, const QRect &screensize, const QPoint offset); 110 | 111 | /** 112 | * @brief Touches 113 | * @param geom 114 | * @param mapadapter 115 | * @return 116 | */ 117 | bool Touches(Point* geom, const MapAdapter* mapadapter); 118 | 119 | 120 | /** 121 | * @brief Draws a point 122 | * @param painter Painter 123 | * @param mapadapter Map adapter 124 | * @param viewport View port 125 | * @param pixmap Pixmap of point 126 | * @param latitude Latitude of point 127 | * @param longitude Longitude of point 128 | */ 129 | void drawPoint(QPainter* painter, const MapAdapter* mapadapter, const QRect &viewport, const QPixmapExt *pixmap, double latitude, double longitude); 130 | 131 | private: 132 | 133 | const QPixmapExt pointPixmapFirst; 134 | const QPixmapExt pointPixmapFirstMiddle; 135 | const QPixmapExt pointPixmapLastMiddle; 136 | const QPixmapExt pointPixmapLast; 137 | 138 | const GPX_wrapper *gpxmw; 139 | const GPX_trkType *track; 140 | int trackNumber; 141 | 142 | int touchedSegmentNumber; 143 | const GPX_wptType *touchedPoint; 144 | bool mouseOver; 145 | 146 | QPen* linePen; 147 | QPen* linePenSelected; 148 | QPen* linePenSameTrack; 149 | QPen* linePenOver; 150 | QPen* pointPenSelected; 151 | QPen* pointsMiddle; 152 | 153 | QPointF clickedCoord; 154 | }; 155 | 156 | /** @} Widgets */ 157 | 158 | #endif // QMAPTRACK_H 159 | -------------------------------------------------------------------------------- /GPXLab/widgets/qpixmapext.cpp: -------------------------------------------------------------------------------- 1 | #include "qpixmapext.h" 2 | 3 | ///////////////////////////////////////////////////////////////////////////// 4 | 5 | QPixmapExt::QPixmapExt() : 6 | QPixmap(), 7 | dx(0), 8 | dy(0), 9 | isFromImg(false) 10 | { 11 | } 12 | 13 | QPixmapExt::QPixmapExt(int width, int height, Point::Alignment alignment) : 14 | QPixmap(width, height), 15 | isFromImg(false) 16 | { 17 | alignToTopLeft(alignment); 18 | } 19 | 20 | QPixmapExt::QPixmapExt(const QString &fileName, Point::Alignment alignment) : 21 | QPixmap(fileName), 22 | isFromImg(true) 23 | { 24 | alignToTopLeft(alignment); 25 | } 26 | 27 | int QPixmapExt::getAlignmentX() const 28 | { 29 | return dx; 30 | } 31 | 32 | int QPixmapExt::getAlignmentY() const 33 | { 34 | return dy; 35 | } 36 | 37 | void QPixmapExt::alignToTopLeft(Point::Alignment alignment) 38 | { 39 | switch (alignment) 40 | { 41 | case Point::Middle: 42 | dx = -width()/2; 43 | dy = -height()/2; 44 | break; 45 | 46 | case Point::TopLeft: 47 | dx = 0; 48 | dy = 0; 49 | break; 50 | 51 | case Point::TopRight: 52 | dx = -width(); 53 | dy = 0; 54 | break; 55 | 56 | case Point::BottomLeft: 57 | dx = 0; 58 | dy = -height(); 59 | break; 60 | 61 | case Point::BottomRight: 62 | dx = -width(); 63 | dy = -height(); 64 | break; 65 | 66 | case Point::BottomMiddle: 67 | dx = -width()/2; 68 | dy = -height(); 69 | break; 70 | 71 | case Point::TopMiddle: 72 | dx = -width()/2; 73 | dy = 0; 74 | break; 75 | } 76 | } 77 | 78 | bool QPixmapExt::isFromImage() const 79 | { 80 | return isFromImg; 81 | } 82 | -------------------------------------------------------------------------------- /GPXLab/widgets/qpixmapext.h: -------------------------------------------------------------------------------- 1 | #ifndef QPIXMAPEXT_H 2 | #define QPIXMAPEXT_H 3 | 4 | #include 5 | #include "point.h" 6 | 7 | using namespace qmapcontrol; 8 | 9 | /** 10 | * @addtogroup Widgets Widgets 11 | * @brief Widgets related functions 12 | * @{ 13 | */ 14 | 15 | /** 16 | * @class QPixmapExt 17 | * 18 | * @brief QPixmap subclass 19 | * 20 | * Extends the QPixmap class by adding two values to algn the pixmap. 21 | * 22 | * @see QPixmap 23 | */ 24 | class QPixmapExt : public QPixmap 25 | { 26 | public: 27 | 28 | /** 29 | * @brief Creates an empty QPixmapExt 30 | */ 31 | QPixmapExt(); 32 | 33 | /** 34 | * @brief Creates a QPixmapExt with the given size and alingment 35 | * @param width Width 36 | * @param height Height 37 | * @param alignment Alignment 38 | */ 39 | QPixmapExt(int width, int height, Point::Alignment alignment = Point::Middle); 40 | 41 | /** 42 | * @brief Creates a QPixmapExt from a image file 43 | * @param fileName Image file name 44 | * @param alignment Alignment 45 | */ 46 | QPixmapExt(const QString & fileName, Point::Alignment alignment = Point::Middle); 47 | 48 | /** 49 | * @brief Gets the alignment offset for the x coordinate 50 | * @return Alignment offset 51 | */ 52 | int getAlignmentX() const; 53 | 54 | /** 55 | * @brief Gets the alignment offset for the y coordinate 56 | * @return Alignment offset 57 | */ 58 | int getAlignmentY() const; 59 | 60 | /** 61 | * @brief Checks if pixmap is from an image 62 | * @return True if pixmap is from an image 63 | */ 64 | bool isFromImage() const; 65 | 66 | private: 67 | 68 | /** 69 | * @brief Calculates the offsets 70 | * @param alignment Alignment 71 | */ 72 | void alignToTopLeft(Point::Alignment alignment); 73 | 74 | /** @brief Offset for the x coordinate */ 75 | int dx; 76 | 77 | /** @brief Offset for the y coordinate */ 78 | int dy; 79 | 80 | /** @brief True if pixmap is from an image */ 81 | bool isFromImg; 82 | }; 83 | 84 | /** @} Widgets */ 85 | 86 | #endif // QPIXMAPEXT_H 87 | -------------------------------------------------------------------------------- /GPXLab/widgets/qtreewidgettracks.h: -------------------------------------------------------------------------------- 1 | #ifndef QTREEWIDGETTRACKS_H 2 | #define QTREEWIDGETTRACKS_H 3 | 4 | #include 5 | #include "gpx_wrapper.h" 6 | 7 | /** 8 | * @addtogroup Widgets Widgets 9 | * @brief Widgets related functions 10 | * @{ 11 | */ 12 | 13 | /** 14 | * @class QTreeWidgetTracks 15 | * 16 | * @brief QTreeWidget subclass 17 | * 18 | * Extends the QTreeWidget class. 19 | * 20 | * @see QTreeWidget 21 | */ 22 | class QTreeWidgetTracks : public QTreeWidget 23 | { 24 | Q_OBJECT 25 | 26 | public: 27 | 28 | /** 29 | * @brief Constructor 30 | * @param parent Parent 31 | */ 32 | explicit QTreeWidgetTracks(QWidget *parent = nullptr); 33 | 34 | /** 35 | * @brief Generates the tree 36 | * @param gpxmw GPX_model wrapper 37 | */ 38 | void build(const GPX_wrapper *gpxmw); 39 | 40 | /** 41 | * @brief Selects the track or track segment 42 | * @param trackNumber Track number 43 | * @param trackSegmentNumber Track segment number, if -1 select track 44 | */ 45 | void select(int trackNumber, int trackSegmentNumber = -1); 46 | 47 | /** 48 | * @brief Sets the text of an item 49 | * @param name New text 50 | * @param trackNumber Track number 51 | * @param trackSegmentNumber Track segment number, -1 for track 52 | */ 53 | void setItemName(const QString& name, int trackNumber, int trackSegmentNumber = -1); 54 | }; 55 | 56 | /** @} Widgets */ 57 | 58 | #endif // QTREEWIDGETTRACKS_H 59 | -------------------------------------------------------------------------------- /QMapControl/QMapControl.pro: -------------------------------------------------------------------------------- 1 | TARGET = qmapcontrol 2 | TEMPLATE = lib 3 | QT += network 4 | QT += gui 5 | greaterThan(QT_MAJOR_VERSION, 4): QT += widgets 6 | greaterThan(QT_MAJOR_VERSION, 4): cache() 7 | 8 | VERSION = 0.9.7.9 9 | TARGET = qmapcontrol 10 | TEMPLATE = lib 11 | !win32: CONFIG += staticlib 12 | win32: CONFIG += skip_target_version_ext 13 | 14 | DEFINES += QMAPCONTROL_LIBRARY 15 | 16 | HEADERS += curve.h \ 17 | geometry.h \ 18 | imagemanager.h \ 19 | layer.h \ 20 | layermanager.h \ 21 | linestring.h \ 22 | mapadapter.h \ 23 | mapcontrol.h \ 24 | mapnetwork.h \ 25 | point.h \ 26 | tilemapadapter.h \ 27 | wmsmapadapter.h \ 28 | circlepoint.h \ 29 | imagepoint.h \ 30 | gps_position.h \ 31 | osmmapadapter.h \ 32 | maplayer.h \ 33 | geometrylayer.h \ 34 | googlemapadapter.h \ 35 | openaerialmapadapter.h \ 36 | fixedimageoverlay.h \ 37 | emptymapadapter.h \ 38 | arrowpoint.h \ 39 | invisiblepoint.h \ 40 | qmapcontrol_global.h \ 41 | bingapimapadapter.h \ 42 | googleapimapadapter.h 43 | 44 | SOURCES += curve.cpp \ 45 | geometry.cpp \ 46 | imagemanager.cpp \ 47 | layer.cpp \ 48 | layermanager.cpp \ 49 | linestring.cpp \ 50 | mapadapter.cpp \ 51 | mapcontrol.cpp \ 52 | mapnetwork.cpp \ 53 | point.cpp \ 54 | tilemapadapter.cpp \ 55 | wmsmapadapter.cpp \ 56 | circlepoint.cpp \ 57 | imagepoint.cpp \ 58 | gps_position.cpp \ 59 | osmmapadapter.cpp \ 60 | maplayer.cpp \ 61 | geometrylayer.cpp \ 62 | googlemapadapter.cpp \ 63 | openaerialmapadapter.cpp \ 64 | fixedimageoverlay.cpp \ 65 | arrowpoint.cpp \ 66 | invisiblepoint.cpp \ 67 | emptymapadapter.cpp \ 68 | bingapimapadapter.cpp \ 69 | googleapimapadapter.cpp 70 | -------------------------------------------------------------------------------- /QMapControl/arrowpoint.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * This file is part of QMapControl, 4 | * an open-source cross-platform map widget 5 | * 6 | * Copyright (C) 2010 Jeffery MacEachern 7 | * Based on CirclePoint code by Kai Winter 8 | * 9 | * This program is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU Lesser General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will `be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU Lesser General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU Lesser General Public License 20 | * along with QMapControl. If not, see . 21 | * 22 | * Contact e-mail: kaiwinter@gmx.de 23 | * Program URL : http://qmapcontrol.sourceforge.net/ 24 | * 25 | */ 26 | 27 | #include "arrowpoint.h" 28 | namespace qmapcontrol 29 | { 30 | ArrowPoint::ArrowPoint(qreal x, qreal y, int sideLength, qreal heading, QString name, qmapcontrol::Point::Alignment alignment, QPen* pen) 31 | : Point(x, y, name, alignment) 32 | { 33 | size = QSize(sideLength, sideLength); 34 | h = heading; 35 | mypen = pen; 36 | mypixmap = QPixmap(sideLength, sideLength); 37 | drawArrow(); 38 | } 39 | 40 | ArrowPoint::~ArrowPoint() 41 | { 42 | } 43 | 44 | void ArrowPoint::setHeading(qreal heading) 45 | { 46 | h = heading; 47 | drawArrow(); 48 | } 49 | 50 | qreal ArrowPoint::getHeading() const 51 | { 52 | return h; 53 | } 54 | 55 | void ArrowPoint::setPen(QPen* pen) 56 | { 57 | mypen = pen; 58 | drawArrow(); 59 | } 60 | 61 | void ArrowPoint::drawArrow() 62 | { 63 | mypixmap = QPixmap(size); 64 | mypixmap.fill(Qt::transparent); 65 | QPainter painter(&mypixmap); 66 | //#if !defined Q_WS_MAEMO_5 //FIXME Maemo has a bug - it will antialias our point out of existence 67 | painter.setRenderHints(QPainter::Antialiasing|QPainter::HighQualityAntialiasing); 68 | //#endif 69 | 70 | if(mypen) 71 | { 72 | painter.setPen(*mypen); 73 | painter.setBrush(QBrush(mypen->color())); 74 | } 75 | else 76 | { 77 | painter.setBrush(QBrush(painter.pen().color())); 78 | } 79 | 80 | painter.setWindow(-(size.width() / 2), -(size.height() / 2), size.width(), size.height()); 81 | QTransform transform; 82 | transform.rotate(-h); 83 | transform.scale(0.4, 0.75); 84 | painter.setWorldTransform(transform); 85 | 86 | QPolygon arrow; 87 | arrow << QPoint(0, -(size.height() / 2)); 88 | arrow << QPoint(-(size.width() / 2), +(size.height() / 2)); 89 | arrow << QPoint(0, 0); 90 | arrow << QPoint(+(size.width() / 2), +(size.height() / 2)); 91 | 92 | painter.drawPolygon(arrow); 93 | } 94 | 95 | } 96 | -------------------------------------------------------------------------------- /QMapControl/arrowpoint.h: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * This file is part of QMapControl, 4 | * an open-source cross-platform map widget 5 | * 6 | * Copyright (C) 2010 Jeffery MacEachern 7 | * Based on CirclePoint code by Kai Winter 8 | * 9 | * This program is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU Lesser General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU Lesser General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU Lesser General Public License 20 | * along with QMapControl. If not, see . 21 | * 22 | * Contact e-mail: kaiwinter@gmx.de 23 | * Program URL : http://qmapcontrol.sourceforge.net/ 24 | * 25 | */ 26 | 27 | #ifndef ARROWPOINT_H 28 | #define ARROWPOINT_H 29 | 30 | #include 31 | 32 | #include "qmapcontrol_global.h" 33 | #include "math.h" 34 | #include "point.h" 35 | 36 | namespace qmapcontrol 37 | { 38 | //! Draws a directed arrow (showing orientation) into the map 39 | /*! This is a convenience class for Point. 40 | * It configures the pixmap of a Point to draw an arrow in a specific direction. 41 | * A QPen could be used to change the color or line-width of the arrow 42 | * 43 | * @author Jeffery MacEachern 44 | */ 45 | class QMAPCONTROL_EXPORT ArrowPoint : public Point 46 | { 47 | public: 48 | //! 49 | /*! 50 | * 51 | * @param x longitude 52 | * @param y latitude 53 | * @param sideLength side length of the arrow's bounding box (square) 54 | * @param heading compass heading determining direction that arrow faces, measured in degrees clockwise from North 55 | * @param name name of the arrow point 56 | * @param alignment alignment (Middle or TopLeft) 57 | * @param pen QPen for drawing 58 | */ 59 | ArrowPoint(qreal x, qreal y, int sideLength, qreal heading, QString name = QString(), Alignment alignment = Middle, QPen* pen=0); 60 | virtual ~ArrowPoint(); 61 | 62 | //! sets the QPen which is used for drawing the arrow 63 | /*! 64 | * A QPen can be used to modify the look of the drawn arrow 65 | * @param pen the QPen which should be used for drawing 66 | * @see http://doc.trolltech.com/4.3/qpen.html 67 | */ 68 | virtual void setPen(QPen* pen); 69 | 70 | //! sets the heading of the arrow and redraws it in the new orientation 71 | /*! 72 | * @param heading new heading 73 | */ 74 | void setHeading(qreal heading); 75 | 76 | //! gets the current heading of the arrow 77 | qreal getHeading() const; 78 | private: 79 | void drawArrow(); 80 | 81 | // Heading 82 | qreal h; 83 | 84 | // Brush to fill the arrow with - solid colour, same as pen 85 | QBrush mybrush; 86 | }; 87 | } 88 | #endif 89 | -------------------------------------------------------------------------------- /QMapControl/bingapimapadapter.h: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * This file is part of QMapControl, 4 | * an open-source cross-platform map widget 5 | * 6 | * Copyright (C) 2007 - 2008 Kai Winter 7 | * Copyright (C) 2014 Mattes Jaehne 8 | * 9 | * This program is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU Lesser General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU Lesser General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU Lesser General Public License 20 | * along with QMapControl. If not, see . 21 | * 22 | * original software by Kai Winter 23 | * Contact e-mail: kaiwinter@gmx.de 24 | * Program URL : http://qmapcontrol.sourceforge.net/ 25 | * 26 | * modified to use Bing Maps by 27 | * Mattes Jaehne 28 | * for 29 | * NGOS - The Next Generation multicopter OS 30 | * http://ng.uavp.ch 31 | * 32 | */ 33 | 34 | 35 | #ifndef BINGAPIMAPADAPTER_H 36 | #define BINGAPIMAPADAPTER_H 37 | 38 | #include "qmapcontrol_global.h" 39 | #include "tilemapadapter.h" 40 | 41 | namespace qmapcontrol 42 | { 43 | class QMAPCONTROL_EXPORT bingApiMapadapter : public TileMapAdapter 44 | { 45 | Q_OBJECT 46 | public: 47 | bingApiMapadapter(QString mapType = "Road", QString apiKey = ""); 48 | virtual ~bingApiMapadapter(); 49 | 50 | virtual QPoint coordinateToDisplay(const QPointF&) const; 51 | virtual QPointF displayToCoordinate(const QPoint&) const; 52 | 53 | void setKey(QString apiKey); 54 | void setMapType(QString mapType); /* Aerial, AerialWithLabels, Road */ 55 | 56 | protected: 57 | virtual void zoom_in(); 58 | virtual void zoom_out(); 59 | 60 | private: 61 | virtual QString getQ(qreal longitude, qreal latitude, int zoom) const; 62 | qreal getMercatorLatitude(qreal YCoord) const; 63 | qreal getMercatorYCoord(qreal lati) const; 64 | 65 | qreal coord_per_x_tile; 66 | qreal coord_per_y_tile; 67 | int srvNum; 68 | QString myKey; 69 | QString myMapType; 70 | }; 71 | } 72 | 73 | #endif // BINGAPIMAPADAPTER_H 74 | -------------------------------------------------------------------------------- /QMapControl/circlepoint.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * This file is part of QMapControl, 4 | * an open-source cross-platform map widget 5 | * 6 | * Copyright (C) 2007 - 2008 Kai Winter 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU Lesser General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with QMapControl. If not, see . 20 | * 21 | * Contact e-mail: kaiwinter@gmx.de 22 | * Program URL : http://qmapcontrol.sourceforge.net/ 23 | * 24 | */ 25 | 26 | #include "circlepoint.h" 27 | namespace qmapcontrol 28 | { 29 | CirclePoint::CirclePoint(qreal x, qreal y, int radius, QString name, Alignment alignment, QPen* pen) 30 | : Point(x, y, name, alignment) 31 | { 32 | size = QSize(radius, radius); 33 | mypen = pen; 34 | mypixmap = QPixmap(radius+1, radius+1); 35 | drawCircle(); 36 | } 37 | 38 | CirclePoint::CirclePoint(qreal x, qreal y, QString name, Alignment alignment, QPen* pen) 39 | : Point(x, y, name, alignment) 40 | { 41 | int radius = 10; 42 | size = QSize(radius, radius); 43 | mypen = pen; 44 | mypixmap = QPixmap(radius+1, radius+1); 45 | drawCircle(); 46 | } 47 | 48 | CirclePoint::~CirclePoint() 49 | { 50 | } 51 | 52 | void CirclePoint::setPen(QPen* pen) 53 | { 54 | mypen = pen; 55 | drawCircle(); 56 | } 57 | 58 | void CirclePoint::drawCircle() 59 | { 60 | mypixmap.fill(Qt::transparent); 61 | QPainter painter(&mypixmap); 62 | //#if !defined Q_WS_MAEMO_5 //FIXME Maemo has a bug - it will antialias our point out of existence 63 | painter.setRenderHints(QPainter::Antialiasing|QPainter::HighQualityAntialiasing); 64 | //#endif 65 | if (mypen != 0) 66 | { 67 | painter.setPen(*mypen); 68 | } 69 | painter.drawEllipse(0,0, size.width(), size.height()); 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /QMapControl/circlepoint.h: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * This file is part of QMapControl, 4 | * an open-source cross-platform map widget 5 | * 6 | * Copyright (C) 2007 - 2008 Kai Winter 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU Lesser General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with QMapControl. If not, see . 20 | * 21 | * Contact e-mail: kaiwinter@gmx.de 22 | * Program URL : http://qmapcontrol.sourceforge.net/ 23 | * 24 | */ 25 | 26 | #ifndef CIRCLEPOINT_H 27 | #define CIRCLEPOINT_H 28 | 29 | #include "qmapcontrol_global.h" 30 | #include "point.h" 31 | 32 | namespace qmapcontrol 33 | { 34 | //! Draws a circle into the map 35 | /*! This is a conveniece class for Point. 36 | * It configures the pixmap of a Point to draw a circle. 37 | * A QPen could be used to change the color or line-width of the circle 38 | * 39 | * @author Kai Winter 40 | */ 41 | class QMAPCONTROL_EXPORT CirclePoint : public Point 42 | { 43 | public: 44 | //! 45 | /*! 46 | * 47 | * @param x longitude 48 | * @param y latitude 49 | * @param name name of the circle point 50 | * @param alignment alignment (Middle or TopLeft) 51 | * @param pen QPen for drawing 52 | */ 53 | CirclePoint(qreal x, qreal y, QString name = QString(), Alignment alignment = Middle, QPen* pen=0); 54 | 55 | //! 56 | /*! 57 | * 58 | * @param x longitude 59 | * @param y latitude 60 | * @param radius the radius of the circle 61 | * @param name name of the circle point 62 | * @param alignment alignment (Middle or TopLeft) 63 | * @param pen QPen for drawing 64 | */ 65 | CirclePoint(qreal x, qreal y, int radius = 10, QString name = QString(), Alignment alignment = Middle, QPen* pen=0); 66 | virtual ~CirclePoint(); 67 | 68 | //! sets the QPen which is used for drawing the circle 69 | /*! 70 | * A QPen can be used to modify the look of the drawn circle 71 | * @param pen the QPen which should be used for drawing 72 | * @see http://doc.trolltech.com/4.3/qpen.html 73 | */ 74 | virtual void setPen(QPen* pen); 75 | 76 | private: 77 | void drawCircle(); 78 | }; 79 | } 80 | #endif 81 | -------------------------------------------------------------------------------- /QMapControl/curve.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * This file is part of QMapControl, 4 | * an open-source cross-platform map widget 5 | * 6 | * Copyright (C) 2007 - 2008 Kai Winter 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU Lesser General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with QMapControl. If not, see . 20 | * 21 | * Contact e-mail: kaiwinter@gmx.de 22 | * Program URL : http://qmapcontrol.sourceforge.net/ 23 | * 24 | */ 25 | 26 | #include "curve.h" 27 | namespace qmapcontrol 28 | { 29 | Curve::Curve(QString name) 30 | : Geometry(name) 31 | { 32 | } 33 | 34 | 35 | Curve::~Curve() 36 | { 37 | } 38 | } 39 | // Geometry Curve::Clone(){} 40 | 41 | // QRectF Curve::GetBoundingBox(){} 42 | -------------------------------------------------------------------------------- /QMapControl/curve.h: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * This file is part of QMapControl, 4 | * an open-source cross-platform map widget 5 | * 6 | * Copyright (C) 2007 - 2008 Kai Winter 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU Lesser General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with QMapControl. If not, see . 20 | * 21 | * Contact e-mail: kaiwinter@gmx.de 22 | * Program URL : http://qmapcontrol.sourceforge.net/ 23 | * 24 | */ 25 | 26 | #ifndef CURVE_H 27 | #define CURVE_H 28 | 29 | #include "qmapcontrol_global.h" 30 | #include "geometry.h" 31 | #include "point.h" 32 | 33 | namespace qmapcontrol 34 | { 35 | //! A Curve Geometry, implemented to fullfil OGC Spec 36 | /*! 37 | * The Curve class is used by LineString as parent class. 38 | * This class could not be used directly. 39 | * 40 | * From the OGC Candidate Implementation Specification: 41 | * "A Curve is a 1-dimensional geometric object usually stored as a sequence of Points, with the subtype of Curve 42 | * specifying the form of the interpolation between Points. This specification defines only one subclass of Curve, 43 | * LineString, which uses a linear interpolation between Points." 44 | * @author Kai Winter 45 | */ 46 | class QMAPCONTROL_EXPORT Curve : public Geometry 47 | { 48 | Q_OBJECT 49 | public: 50 | virtual ~Curve(); 51 | 52 | double Length; 53 | 54 | // virtual Geometry Clone(); 55 | // virtual QRectF GetBoundingBox(); 56 | 57 | // virtual Point EndPoint() = 0; 58 | // virtual Point StartPoint() = 0; 59 | // virtual Point Value() = 0; 60 | 61 | protected: 62 | Curve(QString name = QString()); 63 | virtual void draw(QPainter* painter, const MapAdapter* mapadapter, const QRect &screensize, const QPoint offset) = 0; 64 | }; 65 | } 66 | #endif 67 | -------------------------------------------------------------------------------- /QMapControl/emptymapadapter.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * This file is part of QMapControl, 4 | * an open-source cross-platform map widget 5 | * 6 | * Copyright (C) 2007 - 2008 Kai Winter 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU Lesser General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with QMapControl. If not, see . 20 | * 21 | * Contact e-mail: kaiwinter@gmx.de 22 | * Program URL : http://qmapcontrol.sourceforge.net/ 23 | * 24 | */ 25 | 26 | #include "emptymapadapter.h" 27 | namespace qmapcontrol 28 | { 29 | EmptyMapAdapter::EmptyMapAdapter(int tileSize, int minZoom, int maxZoom) 30 | :MapAdapter("", "", 256, minZoom, maxZoom) 31 | { 32 | Q_UNUSED(tileSize) 33 | PI = acos(-1.0); 34 | 35 | mNumberOfTiles = tilesonzoomlevel(minZoom); 36 | } 37 | 38 | EmptyMapAdapter::~EmptyMapAdapter() 39 | { 40 | } 41 | 42 | void EmptyMapAdapter::zoom_in() 43 | { 44 | if (mCurrent_zoom < mMax_zoom) 45 | { 46 | mCurrent_zoom = mCurrent_zoom + 1; 47 | } 48 | mNumberOfTiles = tilesonzoomlevel(mCurrent_zoom); 49 | } 50 | 51 | void EmptyMapAdapter::zoom_out() 52 | { 53 | if (mCurrent_zoom > mMin_zoom) 54 | { 55 | mCurrent_zoom = mCurrent_zoom - 1; 56 | } 57 | mNumberOfTiles = tilesonzoomlevel(mCurrent_zoom); 58 | } 59 | 60 | qreal EmptyMapAdapter::deg_rad(qreal x) const 61 | { 62 | return x * (PI/180.0); 63 | } 64 | 65 | qreal EmptyMapAdapter::rad_deg(qreal x) const 66 | { 67 | return x * (180/PI); 68 | } 69 | 70 | QString EmptyMapAdapter::query(int x, int y, int z) const 71 | { 72 | Q_UNUSED(x) 73 | Q_UNUSED(y) 74 | Q_UNUSED(z) 75 | return QString(); 76 | } 77 | 78 | QPoint EmptyMapAdapter::coordinateToDisplay(const QPointF& coordinate) const 79 | { 80 | qreal x = (coordinate.x()+180) * (mNumberOfTiles*mTileSize)/360.; // coord to pixel! 81 | qreal y = (1-(log(tan(PI/4+deg_rad(coordinate.y())/2)) /PI)) /2 * (mNumberOfTiles*mTileSize); 82 | 83 | return QPoint(int(x), int(y)); 84 | } 85 | 86 | QPointF EmptyMapAdapter::displayToCoordinate(const QPoint& point) const 87 | { 88 | qreal longitude = (point.x()*(360/(mNumberOfTiles*mTileSize)))-180; 89 | qreal latitude = rad_deg(atan(sinh((1-point.y()*(2/(mNumberOfTiles*mTileSize)))*PI))); 90 | 91 | return QPointF(longitude, latitude); 92 | 93 | } 94 | 95 | bool EmptyMapAdapter::isTileValid(int x, int y, int z) const 96 | { 97 | if (mMax_zoom < mMin_zoom) 98 | { 99 | z= mMin_zoom - z; 100 | } 101 | 102 | bool result = true; 103 | if (x<0 || x>pow(2.0,z)-1 || 104 | y<0 || y>pow(2.0,z)-1) 105 | { 106 | result = false; 107 | } 108 | return result; 109 | } 110 | 111 | int EmptyMapAdapter::tilesonzoomlevel(int zoomlevel) const 112 | { 113 | return int(pow(2.0, zoomlevel)); 114 | } 115 | 116 | int EmptyMapAdapter::xoffset(int x) const 117 | { 118 | return x; 119 | } 120 | 121 | int EmptyMapAdapter::yoffset(int y) const 122 | { 123 | return y; 124 | } 125 | } 126 | -------------------------------------------------------------------------------- /QMapControl/emptymapadapter.h: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * This file is part of QMapControl, 4 | * an open-source cross-platform map widget 5 | * 6 | * Copyright (C) 2007 - 2008 Kai Winter 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU Lesser General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with QMapControl. If not, see . 20 | * 21 | * Contact e-mail: kaiwinter@gmx.de 22 | * Program URL : http://qmapcontrol.sourceforge.net/ 23 | * 24 | */ 25 | 26 | #ifndef EMPTYMAPADAPTER_H 27 | #define EMPTYMAPADAPTER_H 28 | 29 | #include "qmapcontrol_global.h" 30 | #include "mapadapter.h" 31 | 32 | namespace qmapcontrol 33 | { 34 | //! MapAdapter which do not load map tiles. 35 | /*! 36 | * The EmptyMapAdapter can be used if QMapControl should not load any map tiles. This is useful if you 37 | * only want to display an image through a FixedImageOverlay e.g. 38 | * @author Kai Winter 39 | */ 40 | class QMAPCONTROL_EXPORT EmptyMapAdapter : public MapAdapter 41 | { 42 | Q_OBJECT 43 | public: 44 | //! Constructor. 45 | /*! 46 | * @param tileSize This parameter seems unnecessary for this type of MapAdaper on first sight. But since 47 | * this parameter defines the size of the offscreen image it could be used for a little performance 48 | * tuning (larger offscreen-images have to be redrawed less times). 49 | * @param minZoom the minimum zoom level 50 | * @param maxZoom the maximum zoom level 51 | */ 52 | EmptyMapAdapter(int tileSize = 256, int minZoom = 0, int maxZoom = 17); 53 | 54 | virtual ~EmptyMapAdapter(); 55 | 56 | virtual QPoint coordinateToDisplay(const QPointF&) const; 57 | virtual QPointF displayToCoordinate(const QPoint&) const; 58 | 59 | qreal PI; 60 | 61 | protected: 62 | qreal rad_deg(qreal) const; 63 | qreal deg_rad(qreal) const; 64 | 65 | virtual bool isTileValid(int x, int y, int z) const; 66 | virtual void zoom_in(); 67 | virtual void zoom_out(); 68 | virtual QString query(int x, int y, int z) const; 69 | virtual int tilesonzoomlevel(int zoomlevel) const; 70 | virtual int xoffset(int x) const; 71 | virtual int yoffset(int y) const; 72 | }; 73 | } 74 | #endif 75 | -------------------------------------------------------------------------------- /QMapControl/fixedimageoverlay.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * This file is part of QMapControl, 4 | * an open-source cross-platform map widget 5 | * 6 | * Copyright (C) 2007 - 2009 Kai Winter 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU Lesser General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with QMapControl. If not, see . 20 | * 21 | * Contact e-mail: kaiwinter@gmx.de 22 | * Program URL : http://qmapcontrol.sourceforge.net/ 23 | * 24 | */ 25 | 26 | #include "fixedimageoverlay.h" 27 | namespace qmapcontrol 28 | { 29 | FixedImageOverlay::FixedImageOverlay(qreal x_upperleft, qreal y_upperleft, qreal x_lowerright, qreal y_lowerright, QString filename, QString name) 30 | : ImagePoint(x_upperleft, y_upperleft, filename, name, TopLeft), 31 | x_lowerright(x_lowerright), y_lowerright(y_lowerright) 32 | { 33 | //qDebug() << "loading image: " << filename; 34 | mypixmap = QPixmap(filename); 35 | size = mypixmap.size(); 36 | //qDebug() << "image size: " << size; 37 | } 38 | 39 | FixedImageOverlay::FixedImageOverlay(qreal x_upperleft, qreal y_upperleft, qreal x_lowerright, qreal y_lowerright, QPixmap pixmap, QString name) 40 | : ImagePoint(x_upperleft, y_upperleft, pixmap, name, TopLeft), 41 | x_lowerright(x_lowerright), y_lowerright(y_lowerright) 42 | { 43 | mypixmap = pixmap; 44 | size = mypixmap.size(); 45 | } 46 | 47 | void FixedImageOverlay::draw(QPainter* painter, const MapAdapter* mapadapter, const QRect &, const QPoint) 48 | { 49 | if (!visible) 50 | { 51 | return; 52 | } 53 | 54 | const QPointF c = QPointF(X, Y); 55 | QPoint topleft = mapadapter->coordinateToDisplay(c); 56 | 57 | const QPointF c2 = QPointF(x_lowerright, y_lowerright); 58 | QPoint lowerright = mapadapter->coordinateToDisplay(c2); 59 | 60 | painter->drawPixmap(topleft.x(), topleft.y(), lowerright.x()-topleft.x(), lowerright.y()-topleft.y(), mypixmap); 61 | } 62 | 63 | FixedImageOverlay::~FixedImageOverlay() 64 | { 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /QMapControl/fixedimageoverlay.h: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * This file is part of QMapControl, 4 | * an open-source cross-platform map widget 5 | * 6 | * Copyright (C) 2007 - 2009 Kai Winter 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU Lesser General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with QMapControl. If not, see . 20 | * 21 | * Contact e-mail: kaiwinter@gmx.de 22 | * Program URL : http://qmapcontrol.sourceforge.net/ 23 | * 24 | */ 25 | 26 | #ifndef FIXEDIMAGEOVERLAY_H 27 | #define FIXEDIMAGEOVERLAY_H 28 | 29 | #include "qmapcontrol_global.h" 30 | #include "imagepoint.h" 31 | 32 | namespace qmapcontrol 33 | { 34 | 35 | //! Draws a fixed image into the map. 36 | /*! 37 | * This class draws a image overlay onto a map, whose upper left and lower 38 | * right corners lay always on the given coordinates. The methods 39 | * setBaselevel, setMaxsize and setMinsize have no effect for this class. 40 | * 41 | * @author Kai Winter 42 | */ 43 | class QMAPCONTROL_EXPORT FixedImageOverlay : public ImagePoint 44 | { 45 | public: 46 | //! Creates an image overlay which loads and displays the given image file 47 | /*! 48 | * Use this contructor to load the given image file and let the point 49 | * display it. 50 | * When you want multiple points to display the same image, use the 51 | * other contructor and pass a pointer to that image. 52 | * @param x_upperleft the coordinate of the upper left corner where the image should be aligned 53 | * @param y_upperleft the coordinate of the upper left corner where the image should be aligned 54 | * @param x_lowerright the coordinate of the lower right corner where the image should be aligned 55 | * @param y_lowerright the coordinate of the lower right corner where the image should be aligned 56 | * @param filename the file which should be loaded and displayed 57 | * @param name the name of the image point 58 | */ 59 | FixedImageOverlay(qreal x_upperleft, qreal y_upperleft, qreal x_lowerright, qreal y_lowerright, QString filename, QString name = QString()); 60 | 61 | //! Creates an image overlay which displays the given image 62 | /*! 63 | * Use this contructor to display the given image. 64 | * @param x_upperleft the coordinate of the upper left corner where the image should be aligned 65 | * @param y_upperleft the coordinate of the upper left corner where the image should be aligned 66 | * @param x_lowerright the coordinate of the lower right corner where the image should be aligned 67 | * @param y_lowerright the coordinate of the lower right corner where the image should be aligned 68 | * @param pixmap pointer to the image pixmap 69 | * @param name the name of the image point 70 | */ 71 | FixedImageOverlay(qreal x_upperleft, qreal y_upperleft, qreal x_lowerright, qreal y_lowerright, QPixmap pixmap, QString name = QString()); 72 | 73 | virtual void draw(QPainter* painter, const MapAdapter* mapadapter, const QRect &viewport, const QPoint offset); 74 | virtual ~FixedImageOverlay(); 75 | 76 | private: 77 | qreal x_lowerright; 78 | qreal y_lowerright; 79 | }; 80 | } 81 | #endif 82 | -------------------------------------------------------------------------------- /QMapControl/geometry.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * This file is part of QMapControl, 4 | * an open-source cross-platform map widget 5 | * 6 | * Copyright (C) 2007 - 2008 Kai Winter 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU Lesser General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with QMapControl. If not, see . 20 | * 21 | * Contact e-mail: kaiwinter@gmx.de 22 | * Program URL : http://qmapcontrol.sourceforge.net/ 23 | * 24 | */ 25 | 26 | #include "geometry.h" 27 | namespace qmapcontrol 28 | { 29 | Geometry::Geometry(QString name) 30 | : GeometryType("Geometry"), myparentGeometry(0), mypen(0), visible(true), myname(name) 31 | { 32 | } 33 | 34 | Geometry::~Geometry() 35 | { 36 | } 37 | 38 | QString Geometry::name() const 39 | { 40 | return myname; 41 | } 42 | Geometry* Geometry::parentGeometry() const 43 | { 44 | return myparentGeometry; 45 | } 46 | void Geometry::setParentGeometry(Geometry* geom) 47 | { 48 | myparentGeometry = geom; 49 | } 50 | bool Geometry::hasPoints() const 51 | { 52 | return false; 53 | } 54 | bool Geometry::hasClickedPoints() const 55 | { 56 | return false; 57 | } 58 | 59 | QList& Geometry::clickedPoints() 60 | { 61 | return touchedPoints; 62 | } 63 | 64 | bool Geometry::isVisible() const 65 | { 66 | return visible; 67 | } 68 | void Geometry::setVisible(bool visible) 69 | { 70 | this->visible = visible; 71 | emit(updateRequest(boundingBox())); 72 | } 73 | 74 | void Geometry::setName(QString name) 75 | { 76 | myname = name; 77 | } 78 | 79 | void Geometry::setPen(QPen* pen) 80 | { 81 | mypen = pen; 82 | } 83 | QPen* Geometry::pen() const 84 | { 85 | return mypen; 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /QMapControl/geometrylayer.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * This file is part of QMapControl, 4 | * an open-source cross-platform map widget 5 | * 6 | * Copyright (C) 2007 - 2008 Kai Winter 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU Lesser General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with QMapControl. If not, see . 20 | * 21 | * Contact e-mail: kaiwinter@gmx.de 22 | * Program URL : http://qmapcontrol.sourceforge.net/ 23 | * 24 | */ 25 | 26 | #include "geometrylayer.h" 27 | namespace qmapcontrol 28 | { 29 | GeometryLayer::GeometryLayer(QString layername, MapAdapter* mapadapter, bool takeevents) 30 | : Layer(layername, mapadapter, Layer::GeometryLayer, takeevents) 31 | { 32 | } 33 | 34 | 35 | GeometryLayer::~GeometryLayer() 36 | { 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /QMapControl/geometrylayer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * This file is part of QMapControl, 4 | * an open-source cross-platform map widget 5 | * 6 | * Copyright (C) 2007 - 2008 Kai Winter 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU Lesser General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with QMapControl. If not, see . 20 | * 21 | * Contact e-mail: kaiwinter@gmx.de 22 | * Program URL : http://qmapcontrol.sourceforge.net/ 23 | * 24 | */ 25 | 26 | #ifndef GEOMETRYLAYER_H 27 | #define GEOMETRYLAYER_H 28 | 29 | #include "qmapcontrol_global.h" 30 | #include "layer.h" 31 | 32 | namespace qmapcontrol 33 | { 34 | //! GeometryLayer class 35 | /*! 36 | * There are two different layer types: 37 | * - MapLayer: Displays Maps, but also Geometries. The configuration for displaying maps have to be done in the MapAdapter 38 | * - GeometryLayer: Only displays Geometry objects. 39 | * 40 | * MapLayers also can display Geometry objects. The difference to the GeometryLayer is the repainting. Objects that are 41 | * added to a MapLayer are "baken" on the map. This means, when you change it´s position for example the changes are 42 | * not visible until a new offscreen image has been drawn. If you have "static" Geometries which won´t change their 43 | * position this is fine. But if you want to change the objects position or pen you should use a GeometryLayer. Those 44 | * are repainted immediately on changes. 45 | * 46 | * @author Kai Winter 47 | */ 48 | class QMAPCONTROL_EXPORT GeometryLayer : public Layer 49 | { 50 | Q_OBJECT 51 | 52 | public: 53 | //! GeometryLayer constructor 54 | /*! 55 | * This is used to construct a map layer. 56 | * 57 | * @param layername The name of the Layer 58 | * @param mapadapter The MapAdapter which does coordinate translation and Query-String-Forming 59 | * @param takeevents Should the Layer receive MouseEvents? This is set to true by default. Setting it to false could 60 | * be something like a "speed up hint" 61 | */ 62 | GeometryLayer(QString layername, MapAdapter* mapadapter, bool takeevents=true); 63 | virtual ~GeometryLayer(); 64 | }; 65 | } 66 | #endif 67 | -------------------------------------------------------------------------------- /QMapControl/googleapimapadapter.h: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * This file is part of QMapControl, 4 | * an open-source cross-platform map widget 5 | * 6 | * Copyright (C) 2007 - 2008 Kai Winter 7 | * Copyright (C) 2014 Mattes Jaehne 8 | * 9 | * This program is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU Lesser General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU Lesser General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU Lesser General Public License 20 | * along with QMapControl. If not, see . 21 | * 22 | * original software by Kai Winter 23 | * Contact e-mail: kaiwinter@gmx.de 24 | * Program URL : http://qmapcontrol.sourceforge.net/ 25 | * 26 | * modified to use Google Static Maps API V2 by 27 | * Mattes Jaehne 28 | * for 29 | * NGOS - The Next Generation multicopter OS 30 | * http://ng.uavp.ch 31 | * 32 | */ 33 | 34 | 35 | #ifndef GOOGLEAPIMAPADAPTER_H 36 | #define GOOGLEAPIMAPADAPTER_H 37 | 38 | #include "qmapcontrol_global.h" 39 | #include "tilemapadapter.h" 40 | 41 | namespace qmapcontrol 42 | { 43 | class QMAPCONTROL_EXPORT googleApiMapadapter : public TileMapAdapter 44 | { 45 | Q_OBJECT 46 | public: 47 | 48 | enum layerType 49 | { 50 | layerType_ROADMAP = 0, //displays the default road map view. This is the default map type. 51 | layerType_SATELLITE , //displays Google Earth satellite images 52 | layerType_HYBRID , //displays a mixture of normal and satellite views 53 | layerType_TERRAIN //displays a physical map based on terrain information 54 | }; 55 | 56 | enum apiType 57 | { 58 | GoogleMapsAPI = 0, 59 | GoogleMapsForBusinessesAPI 60 | }; 61 | 62 | googleApiMapadapter(layerType qMapType = layerType_ROADMAP, apiType qApiType = GoogleMapsAPI, QString qApiKey = "", QString qApiClientID = "", QString qServerAddress = "maps.googleapis.com"); 63 | virtual ~googleApiMapadapter(); 64 | 65 | virtual QPoint coordinateToDisplay(const QPointF&) const; 66 | virtual QPointF displayToCoordinate(const QPoint&) const; 67 | 68 | QString getHost() const; 69 | void setKey(QString apiKey); 70 | void setMapLayerType(layerType qMapType = layerType_ROADMAP); 71 | 72 | protected: 73 | virtual void zoom_in(); 74 | virtual void zoom_out(); 75 | virtual QString query(int x, int y, int z) const; 76 | virtual bool isValid(int x, int y, int z) const; 77 | 78 | virtual QString signURL( const QString& qURL, const QString& qCryptoKey ) const; 79 | 80 | private: 81 | QString typeToString( layerType qLayerType ); 82 | virtual QString getQ(qreal longitude, qreal latitude, int zoom) const; 83 | qreal getMercatorLatitude(qreal YCoord) const; 84 | qreal getMercatorYCoord(qreal lati) const; 85 | 86 | qreal mCoord_per_x_tile; 87 | qreal mCoord_per_y_tile; 88 | 89 | QString mApiKey; 90 | QString mApiClientID; 91 | apiType mApiType; 92 | QString mMapLayerType; 93 | }; 94 | } 95 | 96 | #endif // GOOGLEAPIMAPADAPTER_H 97 | -------------------------------------------------------------------------------- /QMapControl/googlemapadapter.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * This file is part of QMapControl, 4 | * an open-source cross-platform map widget 5 | * 6 | * Copyright (C) 2007 - 2008 Kai Winter 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU Lesser General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with QMapControl. If not, see . 20 | * 21 | * Contact e-mail: kaiwinter@gmx.de 22 | * Program URL : http://qmapcontrol.sourceforge.net/ 23 | * 24 | */ 25 | 26 | #include "googlemapadapter.h" 27 | namespace qmapcontrol 28 | { 29 | GoogleMapAdapter::GoogleMapAdapter( googleLayerType qLayerType ) 30 | : TileMapAdapter("http://mt1.google.com", "/vt/v=ap.106&hl=en&x=%2&y=%3&zoom=%1&lyrs=" + typeToString(qLayerType), 256, 17, 0) 31 | //: TileMapAdapter("tile.openstreetmap.org", "/%1/%2/%3.png", 256, 0, 17) 32 | { 33 | QString layerType = typeToString( qLayerType ); 34 | } 35 | 36 | GoogleMapAdapter::~GoogleMapAdapter() 37 | { 38 | } 39 | 40 | QString GoogleMapAdapter::typeToString( googleLayerType qLayerType ) 41 | { 42 | switch (qLayerType) 43 | { 44 | case satellite: return "s"; 45 | case terrain: return "t"; 46 | case hybrid: return "h"; 47 | case roadmap: 48 | default: 49 | return "m"; 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /QMapControl/googlemapadapter.h: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * This file is part of QMapControl, 4 | * an open-source cross-platform map widget 5 | * 6 | * Copyright (C) 2007 - 2008 Kai Winter 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU Lesser General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with QMapControl. If not, see . 20 | * 21 | * Contact e-mail: kaiwinter@gmx.de 22 | * Program URL : http://qmapcontrol.sourceforge.net/ 23 | * 24 | */ 25 | 26 | #ifndef GOOGLEMAPADAPTER_H 27 | #define GOOGLEMAPADAPTER_H 28 | 29 | #include "qmapcontrol_global.h" 30 | #include "tilemapadapter.h" 31 | 32 | namespace qmapcontrol 33 | { 34 | //! MapAdapter for Google 35 | /*! 36 | * This is a conveniece class, which extends and configures a TileMapAdapter 37 | * @author Kai Winter 38 | */ 39 | class QMAPCONTROL_EXPORT GoogleMapAdapter : public TileMapAdapter 40 | { 41 | Q_OBJECT 42 | 43 | public: 44 | enum googleLayerType 45 | { 46 | roadmap = 0, 47 | satellite, 48 | terrain, 49 | hybrid 50 | }; 51 | //! constructor 52 | /*! 53 | * This construct a Google Adapter 54 | */ 55 | GoogleMapAdapter( googleLayerType qLayerType = roadmap ); 56 | virtual ~GoogleMapAdapter(); 57 | private: 58 | QString typeToString( googleLayerType qLayerType ); 59 | }; 60 | } 61 | #endif 62 | -------------------------------------------------------------------------------- /QMapControl/gps_position.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * This file is part of QMapControl, 4 | * an open-source cross-platform map widget 5 | * 6 | * Copyright (C) 2007 - 2008 Kai Winter 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU Lesser General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with QMapControl. If not, see . 20 | * 21 | * Contact e-mail: kaiwinter@gmx.de 22 | * Program URL : http://qmapcontrol.sourceforge.net/ 23 | * 24 | */ 25 | 26 | #include "gps_position.h" 27 | namespace qmapcontrol 28 | { 29 | GPS_Position::GPS_Position(float time, float longitude, QString longitude_dir, float latitude, QString latitude_dir) 30 | :time(time), longitude(longitude), latitude(latitude), longitude_dir(longitude_dir), latitude_dir(latitude_dir) 31 | { 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /QMapControl/gps_position.h: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * This file is part of QMapControl, 4 | * an open-source cross-platform map widget 5 | * 6 | * Copyright (C) 2007 - 2008 Kai Winter 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU Lesser General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with QMapControl. If not, see . 20 | * 21 | * Contact e-mail: kaiwinter@gmx.de 22 | * Program URL : http://qmapcontrol.sourceforge.net/ 23 | * 24 | */ 25 | 26 | #ifndef GPS_POSITION_H 27 | #define GPS_POSITION_H 28 | 29 | #include "qmapcontrol_global.h" 30 | #include 31 | 32 | namespace qmapcontrol 33 | { 34 | //! Represents a coordinate from a GPS receiver 35 | /*! 36 | * This class is used to represent a coordinate which has been parsed from a NMEA string. 37 | * This is not fully integrated in the API. An example which uses this data type can be found under Samples. 38 | * @author Kai Winter 39 | */ 40 | class QMAPCONTROL_EXPORT GPS_Position 41 | { 42 | public: 43 | GPS_Position(float time, float longitude, QString longitude_dir, float latitude, QString latitude_dir); 44 | float time; /*!< time of the string*/ 45 | float longitude; /*!< longitude coordinate*/ 46 | float latitude; /*!< latitude coordinate*/ 47 | 48 | private: 49 | QString longitude_dir; 50 | QString latitude_dir; 51 | }; 52 | } 53 | #endif 54 | -------------------------------------------------------------------------------- /QMapControl/imagemanager.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BourgeoisLab/GPXLab/0a2e13756ed1c39f4278b0b3d6cef7f8ac9f6fe7/QMapControl/imagemanager.h -------------------------------------------------------------------------------- /QMapControl/imagepoint.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * This file is part of QMapControl, 4 | * an open-source cross-platform map widget 5 | * 6 | * Copyright (C) 2007 - 2008 Kai Winter 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU Lesser General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with QMapControl. If not, see . 20 | * 21 | * Contact e-mail: kaiwinter@gmx.de 22 | * Program URL : http://qmapcontrol.sourceforge.net/ 23 | * 24 | */ 25 | 26 | #include "imagepoint.h" 27 | namespace qmapcontrol 28 | { 29 | ImagePoint::ImagePoint(qreal x, qreal y, QString filename, QString name, Alignment alignment) 30 | : Point(x, y, name, alignment) 31 | { 32 | //qDebug() << "loading image: " << filename; 33 | mypixmap = QPixmap(filename); 34 | size = mypixmap.size(); 35 | //qDebug() << "image size: " << size; 36 | } 37 | 38 | ImagePoint::ImagePoint(qreal x, qreal y, QPixmap pixmap, QString name, Alignment alignment) 39 | : Point(x, y, name, alignment) 40 | { 41 | mypixmap = pixmap; 42 | size = mypixmap.size(); 43 | } 44 | 45 | 46 | ImagePoint::~ImagePoint() 47 | { 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /QMapControl/imagepoint.h: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * This file is part of QMapControl, 4 | * an open-source cross-platform map widget 5 | * 6 | * Copyright (C) 2007 - 2008 Kai Winter 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU Lesser General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with QMapControl. If not, see . 20 | * 21 | * Contact e-mail: kaiwinter@gmx.de 22 | * Program URL : http://qmapcontrol.sourceforge.net/ 23 | * 24 | */ 25 | 26 | #ifndef IMAGEPOINT_H 27 | #define IMAGEPOINT_H 28 | 29 | #include "qmapcontrol_global.h" 30 | #include "point.h" 31 | 32 | namespace qmapcontrol 33 | { 34 | 35 | //! Draws an image into the map 36 | /*! This is a convenience class for Point. 37 | * It configures the pixmap of a Point to draw the given image. 38 | * The image will be loaded from the given path and written in the points pixmap. 39 | * 40 | * @author Kai Winter 41 | */ 42 | class QMAPCONTROL_EXPORT ImagePoint : public Point 43 | { 44 | public: 45 | //! Creates a point which loads and displays the given image file 46 | /*! 47 | * Use this contructor to load the given image file and let the point display it. 48 | * When you want multiple points to display the same image, use the other contructor and pass a pointer to that image. 49 | * @param x longitude 50 | * @param y latitude 51 | * @param filename the file which should be loaded and displayed 52 | * @param name the name of the image point 53 | * @param alignment alignment (Middle or TopLeft) 54 | */ 55 | ImagePoint(qreal x, qreal y, QString filename, QString name = QString(), Alignment alignment = Middle); 56 | 57 | //! Creates a point which displays the given image 58 | /*! 59 | * Use this contructor to display the given image. 60 | * You have to load that image yourself, but can use it for multiple points. 61 | * @param x longitude 62 | * @param y latitude 63 | * @param pixmap pointer to the image pixmap 64 | * @param name the name of the image point 65 | * @param alignment alignment (Middle or TopLeft) 66 | */ 67 | ImagePoint(qreal x, qreal y, QPixmap pixmap, QString name = QString(), Alignment alignment = Middle); 68 | virtual ~ImagePoint(); 69 | }; 70 | } 71 | #endif 72 | -------------------------------------------------------------------------------- /QMapControl/invisiblepoint.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * This file is part of QMapControl, 4 | * an open-source cross-platform map widget 5 | * 6 | * Copyright (C) 2014 Frederic Bourgeois 7 | * Based on CirclePoint code by Kai Winter 8 | * 9 | * This program is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU Lesser General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU Lesser General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU Lesser General Public License 20 | * along with QMapControl. If not, see . 21 | * 22 | * Contact e-mail: kaiwinter@gmx.de 23 | * Program URL : http://qmapcontrol.sourceforge.net/ 24 | * 25 | */ 26 | 27 | #include "invisiblepoint.h" 28 | namespace qmapcontrol 29 | { 30 | InvisiblePoint::InvisiblePoint(qreal x, qreal y, int sideLength, QString name) 31 | : Point(x, y, name, Point::Middle) 32 | { 33 | size = QSize(sideLength, sideLength); 34 | } 35 | 36 | InvisiblePoint::InvisiblePoint(qreal x, qreal y, int width, int height, QString name) 37 | : Point(x, y, name, Point::Middle) 38 | { 39 | size = QSize(width, height); 40 | } 41 | 42 | InvisiblePoint::InvisiblePoint(qreal x, qreal y, QString name) 43 | : Point(x, y, name, Point::Middle) 44 | { 45 | int sideLength = 10; 46 | size = QSize(sideLength, sideLength); 47 | } 48 | 49 | InvisiblePoint::~InvisiblePoint() 50 | { 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /QMapControl/invisiblepoint.h: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * This file is part of QMapControl, 4 | * an open-source cross-platform map widget 5 | * 6 | * Copyright (C) 2014 Frederic Bourgeois 7 | * Based on CirclePoint code by Kai Winter 8 | * 9 | * This program is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU Lesser General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU Lesser General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU Lesser General Public License 20 | * along with QMapControl. If not, see . 21 | * 22 | * Contact e-mail: kaiwinter@gmx.de 23 | * Program URL : http://qmapcontrol.sourceforge.net/ 24 | * 25 | */ 26 | 27 | #ifndef INVISIBLEPOINT_H 28 | #define INVISIBLEPOINT_H 29 | 30 | #include "qmapcontrol_global.h" 31 | #include "point.h" 32 | 33 | namespace qmapcontrol 34 | { 35 | //! Draws an invisible point into the map 36 | /*! This is a convenience class for point. 37 | * It configures the pixmap of a point to draw nothing, 38 | * still being a clickable point. 39 | * 40 | * @author Frederic Bourgeois 41 | */ 42 | class QMAPCONTROL_EXPORT InvisiblePoint : public Point 43 | { 44 | public: 45 | //! 46 | /*! 47 | * 48 | * @param x longitude 49 | * @param y latitude 50 | * @param name name of the invisible point 51 | */ 52 | InvisiblePoint(qreal x, qreal y, QString name = QString()); 53 | 54 | //! 55 | /*! 56 | * 57 | * @param x longitude 58 | * @param y latitude 59 | * @param width width 60 | * @param height height 61 | * @param name name of the invisible point 62 | */ 63 | InvisiblePoint(qreal x, qreal y, int width = 10, int height = 10, QString name = QString()); 64 | 65 | //! 66 | /*! 67 | * 68 | * @param x longitude 69 | * @param y latitude 70 | * @param sideLength side length of the bounding box (square) 71 | * @param name name of the invisible point 72 | */ 73 | InvisiblePoint(qreal x, qreal y, int sideLength = 10, QString name = QString()); 74 | virtual ~InvisiblePoint(); 75 | }; 76 | } 77 | #endif 78 | -------------------------------------------------------------------------------- /QMapControl/linestring.h: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * This file is part of QMapControl, 4 | * an open-source cross-platform map widget 5 | * 6 | * Copyright (C) 2007 - 2008 Kai Winter 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU Lesser General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with QMapControl. If not, see . 20 | * 21 | * Contact e-mail: kaiwinter@gmx.de 22 | * Program URL : http://qmapcontrol.sourceforge.net/ 23 | * 24 | */ 25 | 26 | #ifndef LINESTRING_H 27 | #define LINESTRING_H 28 | 29 | #include "qmapcontrol_global.h" 30 | #include "curve.h" 31 | 32 | namespace qmapcontrol 33 | { 34 | //! A collection of Point objects to describe a line 35 | /*! 36 | * A LineString is a Curve with linear interpolation between Points. Each consecutive pair of Points defines a Line segment. 37 | * @author Kai Winter 38 | */ 39 | class QMAPCONTROL_EXPORT LineString : public Curve 40 | { 41 | Q_OBJECT 42 | 43 | public: 44 | LineString(); 45 | //! constructor 46 | /*! 47 | * The constructor of a LineString takes a list of Points to form a line. 48 | * @param points a list of points 49 | * @param name the name of the LineString 50 | * @param pen a QPen can be used to modify the look of the line. 51 | * @see http://doc.trolltech.com/4.3/qpen.html 52 | */ 53 | LineString ( QList const points, QString name = QString(), QPen* pen = 0 ); 54 | virtual ~LineString(); 55 | 56 | //! returns the points of the LineString 57 | /*! 58 | * @return a list with the points of the LineString 59 | */ 60 | QList points(); 61 | 62 | //! adds a point at the end of the LineString 63 | /*! 64 | * @param point the point which should be added to the LineString 65 | */ 66 | void addPoint ( Point* point ); 67 | 68 | //! sets the given list as points of the LineString 69 | //! NOTE: these points will get reparented and cleaned up automatically 70 | /*! 71 | * @param points the points which should be set for the LineString 72 | */ 73 | void setPoints ( QList points); 74 | 75 | //! returns the number of Points the LineString consists of 76 | /*! 77 | * @return the number of the LineString´s Points 78 | */ 79 | int numberOfPoints() const; 80 | 81 | //! returns the bounding box (rect) that contains all points 82 | /*! 83 | * @return the rect that contains all points 84 | */ 85 | virtual QRectF boundingBox(); 86 | 87 | //! returns true if the LineString has Childs 88 | /*! 89 | * This is equal to: numberOfPoints() > 0 90 | * @return true it the LineString has Childs (=Points) 91 | * @see clickedPoints() 92 | */ 93 | virtual bool hasPoints() const; 94 | 95 | //! returns true if the LineString has clicked Points 96 | /*! 97 | * @return true if childs of a LineString were clicked 98 | * @see clickedPoints() 99 | */ 100 | virtual bool hasClickedPoints() const; 101 | 102 | //! returns the clicked Points 103 | /*! 104 | * If a LineString was clicked it could be neccessary to figure out which of its points where clicked. 105 | * Do do so the methods hasPoints() and clickedPoints() can be used. 106 | * When a point is added to a LineString the Point becomes its child. 107 | * It is possible (depending on the zoomfactor) to click more than one Point of a LineString, so this method returns a list. 108 | * @return the clicked Points of the LineString 109 | */ 110 | virtual QList & clickedPoints(); 111 | 112 | protected: 113 | virtual bool Touches ( Geometry* geom, const MapAdapter* mapadapter ); 114 | virtual bool Touches ( Point* geom, const MapAdapter* mapadapter ); 115 | virtual void draw ( QPainter* painter, const MapAdapter* mapadapter, const QRect &screensize, const QPoint offset ); 116 | 117 | private: 118 | //! removes cleans up memory of child points that were reparented with setPoints() 119 | /*! 120 | * @see setPoints() 121 | */ 122 | void removePoints(); 123 | 124 | QList childPoints; 125 | }; 126 | } 127 | #endif 128 | -------------------------------------------------------------------------------- /QMapControl/mapadapter.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * This file is part of QMapControl, 4 | * an open-source cross-platform map widget 5 | * 6 | * Copyright (C) 2007 - 2008 Kai Winter 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU Lesser General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with QMapControl. If not, see . 20 | * 21 | * Contact e-mail: kaiwinter@gmx.de 22 | * Program URL : http://qmapcontrol.sourceforge.net/ 23 | * 24 | */ 25 | 26 | #include "mapadapter.h" 27 | namespace qmapcontrol 28 | { 29 | MapAdapter::MapAdapter(const QString& qHost, const QString& qServerPath, int qTilesize, int qMinZoom, int qMaxZoom) 30 | :mTileSize(qTilesize), mMin_zoom(qMinZoom), mMax_zoom(qMaxZoom) 31 | { 32 | mCurrent_zoom = qMinZoom; 33 | changeHostAddress( qHost, qServerPath ); 34 | } 35 | 36 | MapAdapter::~MapAdapter() 37 | { 38 | } 39 | 40 | void MapAdapter::changeHostAddress( const QString qHost, const QString qServerPath ) 41 | { 42 | mServerHost = qHost; 43 | mServerPath = qServerPath; 44 | } 45 | 46 | QString MapAdapter::host() const 47 | { 48 | return mServerHost; 49 | } 50 | 51 | QString MapAdapter::serverPath() const 52 | { 53 | return mServerPath; 54 | } 55 | 56 | int MapAdapter::tilesize() const 57 | { 58 | return mTileSize; 59 | } 60 | 61 | int MapAdapter::minZoom() const 62 | { 63 | return mMin_zoom; 64 | } 65 | 66 | int MapAdapter::maxZoom() const 67 | { 68 | return mMax_zoom; 69 | } 70 | 71 | int MapAdapter::currentZoom() const 72 | { 73 | return mCurrent_zoom; 74 | } 75 | 76 | int MapAdapter::adaptedZoom() const 77 | { 78 | return mMax_zoom < mMin_zoom ? mMin_zoom - mCurrent_zoom : mCurrent_zoom; 79 | } 80 | 81 | void MapAdapter::setBoundingBox(qreal qMinX, qreal qMinY, qreal qMaxX, qreal qMaxY ) 82 | { 83 | mBoundingBox = QRectF( QPointF( qMinX, qMinY ), QPointF(qMaxX, qMaxY ) ); 84 | } 85 | 86 | int MapAdapter::tileSize() 87 | { 88 | return mTileSize; 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /QMapControl/maplayer.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * This file is part of QMapControl, 4 | * an open-source cross-platform map widget 5 | * 6 | * Copyright (C) 2007 - 2008 Kai Winter 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU Lesser General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with QMapControl. If not, see . 20 | * 21 | * Contact e-mail: kaiwinter@gmx.de 22 | * Program URL : http://qmapcontrol.sourceforge.net/ 23 | * 24 | */ 25 | 26 | #include "maplayer.h" 27 | namespace qmapcontrol 28 | { 29 | MapLayer::MapLayer(QString layername, MapAdapter* mapadapter, bool takeevents) 30 | : Layer(layername, mapadapter, Layer::MapLayer, takeevents) 31 | { 32 | } 33 | 34 | 35 | MapLayer::~MapLayer() 36 | { 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /QMapControl/maplayer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * This file is part of QMapControl, 4 | * an open-source cross-platform map widget 5 | * 6 | * Copyright (C) 2007 - 2008 Kai Winter 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU Lesser General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with QMapControl. If not, see . 20 | * 21 | * Contact e-mail: kaiwinter@gmx.de 22 | * Program URL : http://qmapcontrol.sourceforge.net/ 23 | * 24 | */ 25 | 26 | #ifndef MAPLAYER_H 27 | #define MAPLAYER_H 28 | 29 | #include "qmapcontrol_global.h" 30 | #include "layer.h" 31 | 32 | namespace qmapcontrol 33 | { 34 | //! MapLayer class 35 | /*! 36 | * There are two different layer types: 37 | * - MapLayer: Displays Maps, but also Geometries. The configuration for displaying maps have to be done in the MapAdapter 38 | * - GeometryLayer: Only displays Geometry objects. 39 | * 40 | * MapLayers also can display Geometry objects. The difference to the GeometryLayer is the repainting. Objects that are 41 | * added to a MapLayer are "baken" on the map. This means, when you change it´s position for example the changes are 42 | * not visible until a new offscreen image has been drawn. If you have "static" Geometries which won´t change their 43 | * position this is fine. But if you want to change the objects position or pen you should use a GeometryLayer. Those 44 | * are repainted immediately on changes. 45 | * 46 | * @author Kai Winter 47 | */ 48 | class QMAPCONTROL_EXPORT MapLayer : public Layer 49 | { 50 | Q_OBJECT 51 | 52 | public: 53 | //! MapLayer constructor 54 | /*! 55 | * This is used to construct a map layer. 56 | * 57 | * @param layername The name of the Layer 58 | * @param mapadapter The MapAdapter which does coordinate translation and Query-String-Forming 59 | * @param takeevents Should the Layer receive MouseEvents? This is set to true by default. Setting it to false could 60 | * be something like a "speed up hint" 61 | */ 62 | MapLayer(QString layername, MapAdapter* mapadapter, bool takeevents=true); 63 | virtual ~MapLayer(); 64 | }; 65 | } 66 | #endif 67 | -------------------------------------------------------------------------------- /QMapControl/mapnetwork.h: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * This file is part of QMapControl, 4 | * an open-source cross-platform map widget 5 | * 6 | * Copyright (C) 2007 - 2008 Kai Winter 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU Lesser General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with QMapControl. If not, see . 20 | * 21 | * Contact e-mail: kaiwinter@gmx.de 22 | * Program URL : http://qmapcontrol.sourceforge.net/ 23 | * 24 | */ 25 | 26 | #ifndef MAPNETWORK_H 27 | #define MAPNETWORK_H 28 | 29 | #include "qmapcontrol_global.h" 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include "imagemanager.h" 40 | 41 | /** 42 | @author Kai Winter 43 | */ 44 | namespace qmapcontrol 45 | { 46 | class ImageManager; 47 | class QMAPCONTROL_EXPORT MapNetwork : QObject 48 | { 49 | Q_OBJECT 50 | 51 | public: 52 | MapNetwork(ImageManager* parent); 53 | ~MapNetwork(); 54 | 55 | void loadImage(const QString& host, const QString& url); 56 | 57 | /*! 58 | * checks if the given url is already loading 59 | * @param url the url of the image 60 | * @return boolean, if the image is already loading 61 | */ 62 | bool imageIsLoading(QString url); 63 | 64 | /*! 65 | * Aborts all current loading threads. 66 | * This is useful when changing the zoom-factor, though newly needed images loads faster 67 | */ 68 | void abortLoading(); 69 | void setProxy(QString host, int port, const QString username = QString(), const QString password = QString()); 70 | 71 | /*! 72 | * 73 | * @return number of elements in the load queue 74 | */ 75 | int loadQueueSize() const; 76 | 77 | /*! 78 | * 79 | * @return next free http downloader thread 80 | */ 81 | QNetworkAccessManager* nextFreeHttp(); 82 | 83 | /*! 84 | * sets the disk cache for each network manager 85 | * @param qCache the disk cache object to set 86 | */ 87 | void setDiskCache( QNetworkDiskCache* qCache ); 88 | 89 | private: 90 | Q_DISABLE_COPY (MapNetwork) 91 | 92 | ImageManager* parent; 93 | QNetworkAccessManager* http; 94 | QList replyList; 95 | QMap loadingMap; 96 | qreal loaded; 97 | mutable QMutex vectorMutex; 98 | bool networkActive; 99 | bool cacheEnabled; 100 | 101 | private slots: 102 | void requestFinished(QNetworkReply *reply); 103 | }; 104 | } 105 | #endif 106 | -------------------------------------------------------------------------------- /QMapControl/openaerialmapadapter.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * This file is part of QMapControl, 4 | * an open-source cross-platform map widget 5 | * 6 | * Copyright (C) 2007 - 2009 Kai Winter 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU Lesser General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with QMapControl. If not, see . 20 | * 21 | * Contact e-mail: kaiwinter@gmx.de 22 | * Program URL : http://qmapcontrol.sourceforge.net/ 23 | * 24 | */ 25 | 26 | #include "openaerialmapadapter.h" 27 | namespace qmapcontrol 28 | { 29 | OpenAerialMapAdapter::OpenAerialMapAdapter() 30 | : TileMapAdapter("http://tile.openaerialmap.org", "/tiles/1.0.0/openaerialmap-900913/%1/%2/%3.png", 256, 0, 17) 31 | { 32 | } 33 | 34 | OpenAerialMapAdapter::~OpenAerialMapAdapter() 35 | { 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /QMapControl/openaerialmapadapter.h: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * This file is part of QMapControl, 4 | * an open-source cross-platform map widget 5 | * 6 | * Copyright (C) 2007 - 2009 Kai Winter 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU Lesser General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with QMapControl. If not, see . 20 | * 21 | * Contact e-mail: kaiwinter@gmx.de 22 | * Program URL : http://qmapcontrol.sourceforge.net/ 23 | * 24 | */ 25 | 26 | #ifndef OPENAERIALMAPADAPTER_H 27 | #define OPENAERIALMAPADAPTER_H 28 | 29 | #include "qmapcontrol_global.h" 30 | #include "tilemapadapter.h" 31 | namespace qmapcontrol 32 | { 33 | //! MapAdapter for OpenStreetMap 34 | /*! 35 | * This is a conveniece class, which extends and configures a TileMapAdapter. Source of maps is http://www.openaerialmap.org/ 36 | * @author Kai Winter 37 | */ 38 | class QMAPCONTROL_EXPORT OpenAerialMapAdapter : public TileMapAdapter 39 | { 40 | Q_OBJECT 41 | public: 42 | //! constructor 43 | /*! 44 | * This construct a OpenAerialMap Adapter 45 | */ 46 | OpenAerialMapAdapter(); 47 | virtual ~OpenAerialMapAdapter(); 48 | }; 49 | } 50 | #endif 51 | -------------------------------------------------------------------------------- /QMapControl/osmmapadapter.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * This file is part of QMapControl, 4 | * an open-source cross-platform map widget 5 | * 6 | * Copyright (C) 2007 - 2008 Kai Winter 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU Lesser General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with QMapControl. If not, see . 20 | * 21 | * Contact e-mail: kaiwinter@gmx.de 22 | * Program URL : http://qmapcontrol.sourceforge.net/ 23 | * 24 | */ 25 | 26 | #include "osmmapadapter.h" 27 | namespace qmapcontrol 28 | { 29 | OSMMapAdapter::OSMMapAdapter() 30 | : TileMapAdapter("http://tile.openstreetmap.org", "/%1/%2/%3.png", 256, 0, 19) 31 | { 32 | } 33 | 34 | OSMMapAdapter::~OSMMapAdapter() 35 | { 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /QMapControl/osmmapadapter.h: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * This file is part of QMapControl, 4 | * an open-source cross-platform map widget 5 | * 6 | * Copyright (C) 2007 - 2008 Kai Winter 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU Lesser General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with QMapControl. If not, see . 20 | * 21 | * Contact e-mail: kaiwinter@gmx.de 22 | * Program URL : http://qmapcontrol.sourceforge.net/ 23 | * 24 | */ 25 | 26 | #ifndef OSMMAPADAPTER_H 27 | #define OSMMAPADAPTER_H 28 | 29 | #include "qmapcontrol_global.h" 30 | #include "tilemapadapter.h" 31 | namespace qmapcontrol 32 | { 33 | //! MapAdapter for OpenStreetMap 34 | /*! 35 | * This is a conveniece class, which extends and configures a TileMapAdapter 36 | * @author Kai Winter 37 | */ 38 | class QMAPCONTROL_EXPORT OSMMapAdapter : public TileMapAdapter 39 | { 40 | Q_OBJECT 41 | public: 42 | //! constructor 43 | /*! 44 | * This construct a OpenStreetmap Adapter 45 | */ 46 | OSMMapAdapter(); 47 | virtual ~OSMMapAdapter(); 48 | }; 49 | } 50 | #endif 51 | -------------------------------------------------------------------------------- /QMapControl/qmapcontrol_global.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #ifdef QMAPCONTROL_LIBRARY 4 | # define QMAPCONTROL_EXPORT Q_DECL_EXPORT 5 | #else 6 | # define QMAPCONTROL_EXPORT Q_DECL_IMPORT 7 | #endif 8 | -------------------------------------------------------------------------------- /QMapControl/tilemapadapter.h: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * This file is part of QMapControl, 4 | * an open-source cross-platform map widget 5 | * 6 | * Copyright (C) 2007 - 2008 Kai Winter 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU Lesser General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with QMapControl. If not, see . 20 | * 21 | * Contact e-mail: kaiwinter@gmx.de 22 | * Program URL : http://qmapcontrol.sourceforge.net/ 23 | * 24 | */ 25 | 26 | #ifndef TILEMAPADAPTER_H 27 | #define TILEMAPADAPTER_H 28 | 29 | #include "qmapcontrol_global.h" 30 | #include "mapadapter.h" 31 | 32 | namespace qmapcontrol 33 | { 34 | //! MapAdapter for servers with image tiles 35 | /*! 36 | * Use this derived MapAdapter to display maps from OpenStreetMap 37 | * @author Kai Winter 38 | */ 39 | class QMAPCONTROL_EXPORT TileMapAdapter : public MapAdapter 40 | { 41 | Q_OBJECT 42 | public: 43 | //! constructor 44 | /*! 45 | * Sample of a correct initialization of a MapAdapter:
46 | * TileMapAdapter* ta = new TileMapAdapter("192.168.8.1", "/img/img_cache.php/%1/%2/%3.png", 256, 0,17);
47 | * The placeholders %1, %2, %3 stands for x, y, z
48 | * The minZoom is 0 (means the whole world is visible). The maxZoom is 17 (means it is zoomed in to the max) 49 | * @param host The servers URL 50 | * @param serverPath The path to the tiles with placeholders 51 | * @param tilesize the size of the tiles 52 | * @param minZoom the minimum zoom level 53 | * @param maxZoom the maximum zoom level 54 | */ 55 | TileMapAdapter(const QString& host, const QString& serverPath, int tilesize, int minZoom = 0, int maxZoom = 17); 56 | 57 | virtual ~TileMapAdapter(); 58 | 59 | virtual QPoint coordinateToDisplay(const QPointF&) const; 60 | virtual QPointF displayToCoordinate(const QPoint&) const; 61 | 62 | virtual void changeHostAddress(const QString qHost, const QString qServerPath = QString()); 63 | 64 | qreal PI; 65 | 66 | protected: 67 | qreal rad_deg(qreal) const; 68 | qreal deg_rad(qreal) const; 69 | 70 | void parseParams(const QString& serverPath); 71 | 72 | virtual bool isTileValid(int x, int y, int z) const; 73 | virtual void zoom_in(); 74 | virtual void zoom_out(); 75 | virtual QString query(int x, int y, int z) const; 76 | virtual int tilesonzoomlevel(int zoomlevel) const; 77 | virtual int xoffset(int x) const; 78 | virtual int yoffset(int y) const; 79 | }; 80 | } 81 | #endif 82 | -------------------------------------------------------------------------------- /QMapControl/wmsmapadapter.h: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * This file is part of QMapControl, 4 | * an open-source cross-platform map widget 5 | * 6 | * Copyright (C) 2007 - 2008 Kai Winter 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU Lesser General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with QMapControl. If not, see . 20 | * 21 | * Contact e-mail: kaiwinter@gmx.de 22 | * Program URL : http://qmapcontrol.sourceforge.net/ 23 | * 24 | */ 25 | 26 | #ifndef WMSMAPADAPTER_H 27 | #define WMSMAPADAPTER_H 28 | 29 | #include "qmapcontrol_global.h" 30 | #include "mapadapter.h" 31 | 32 | namespace qmapcontrol 33 | { 34 | //! MapAdapter for WMS servers 35 | /*! 36 | * Use this derived MapAdapter to display maps from WMS servers 37 | * @author Kai Winter 38 | */ 39 | class QMAPCONTROL_EXPORT WMSMapAdapter : public MapAdapter 40 | { 41 | public: 42 | //! constructor 43 | /*! 44 | * Sample of a correct initialization of a MapAdapter:
45 | * MapAdapter* mapadapter = new WMSMapAdapter("www2.demis.nl", "/wms/wms.asp?wms=WorldMap[...]&BBOX=%1,%2,%3,%4&WIDTH=%5&HEIGHT=%5&TRANSPARENT=TRUE", 256);
46 | * The placeholders %1, %2, %3, %4 creates the bounding box, %5 is for the tilesize 47 | * The minZoom is 0 (means the whole world is visible). The maxZoom is 17 (means it is zoomed in to the max) 48 | * @param host The servers URL 49 | * @param serverPath The path to the tiles with placeholders 50 | * @param tilesize the size of the tiles 51 | */ 52 | WMSMapAdapter(QString host, QString serverPath, int tilesize = 256); 53 | virtual ~WMSMapAdapter(); 54 | 55 | virtual QString serverPath() const; 56 | virtual QPoint coordinateToDisplay(const QPointF&) const; 57 | virtual QPointF displayToCoordinate(const QPoint&) const; 58 | virtual void changeHostAddress( const QString qHost, const QString qServerPath = QString() ); 59 | 60 | protected: 61 | virtual void zoom_in(); 62 | virtual void zoom_out(); 63 | virtual QString query(int x, int y, int z) const; 64 | virtual bool isTileValid(int x, int y, int z) const; 65 | 66 | private: 67 | virtual QString getQ(qreal ux, qreal uy, qreal ox, qreal oy) const; 68 | 69 | qreal coord_per_x_tile; 70 | qreal coord_per_y_tile; 71 | 72 | QHash mServerOptions; 73 | QHash mResolutions; 74 | }; 75 | } 76 | #endif 77 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | GPXLab 2 | ====== 3 | [![Packaging status](https://repology.org/badge/tiny-repos/gpxlab.svg)](https://repology.org/metapackage/gpxlab/versions) 4 | 5 | ![GPXLab](doc/gpxlab.png?raw=true) 6 | 7 | What is GPXLab? 8 | --------------- 9 | GPXLab is an application to display and manage GPS tracks previously recorded with a GPS tracker. 10 | 11 | The idea is to give the user the possibility to combine several tracks into one single file and have statistic information about the summarized tracks or about a single track. Furthermore the user can see all tracks on a map and select there a track and/or a single track point. An altitude and a speed diagram and also a list of the track points offers visual information about the selected item. 12 | 13 | ![Demo](doc/demo.png?raw=true) 14 | 15 | The view is divided into seven different parts: 16 | - Statistic information about all tracks 17 | - Calendar for track selection 18 | - Track tree for track selection 19 | - Statistic information about the selected track or track segment 20 | - Map showing all tracks 21 | - Diagram of the selected track or track segment 22 | - List of the track points of the selected track or track segment 23 | 24 | Except the map all other parts can be hid to maximize the map view. 25 | 26 | Features & Functions 27 | -------------------- 28 | - Support opening GPX (v1.0 or v1.1), NMEA and SpoQ files 29 | - Combine several tracks into one single GPX file 30 | - Rearrange the tracks (move/add/delete) 31 | - Modify the meta data of the GPX file and of any tracks inside the file 32 | - Get altitude data from the SRTM database 33 | - Show statistic information about the summarized tracks and about a single track 34 | - Show a map of all tracks 35 | - Show an altitude and a speed diagram 36 | - Show a list of the track points 37 | 38 | Supported File Formats 39 | ---------------------- 40 | Currently GPX, NMEA and SpoQ files are supported. If you have a file in another format you may use GPSBabel (http://www.gpsbabel.org) to convert it into a GPX file. 41 | 42 | License 43 | ------- 44 | This software is free software and licensed under GPL version 3. 45 | 46 | Development 47 | ----------- 48 | The project is separated in two sub-projects GPXLab and QMapControl. QMapControl is a widget to display a map. Since I had to made some modifications to the original code I added the modified version here. QMapControl is compiled as a library and linked to the main sub-project GPXLab. 49 | 50 | Get latest source from master branch using: 51 | 52 | ```bash 53 | $ git clone https://github.com/BourgeoisLab/GPXLab/ 54 | ``` 55 | 56 | Compile source using: 57 | 58 | ```bash 59 | $ cd GPXLab 60 | $ lrelease GPXLab/GPXLab.pro 61 | $ qmake 62 | $ make 63 | ``` 64 | 65 | Credits 66 | ------- 67 | - **QCustomPlot Qt Widget:** http://www.qcustomplot.com 68 | - **QMapControl Qt Widget:** https://sourceforge.net/projects/qmapcontrol/ 69 | - **Nuvola Icons:** https://www.iconfinder.com/iconsets/nuvola2 70 | - **FatCow Icons:** http://www.fatcow.com/free-icons 71 | 72 | Release Notes 73 | ------------- 74 | 75 | See [Changelog](CHANGELOG.md). 76 | 77 | Information 78 | ----------- 79 | **Author:** Frédéric Bourgeois 80 | 81 | **Latest release:** http://github.com/bourgeoislab/gpxlab/releases 82 | 83 | **Latest sources:** http://github.com/bourgeoislab/gpxlab 84 | -------------------------------------------------------------------------------- /doc/demo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BourgeoisLab/GPXLab/0a2e13756ed1c39f4278b0b3d6cef7f8ac9f6fe7/doc/demo.png -------------------------------------------------------------------------------- /doc/gpxlab.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BourgeoisLab/GPXLab/0a2e13756ed1c39f4278b0b3d6cef7f8ac9f6fe7/doc/gpxlab.png -------------------------------------------------------------------------------- /pkg/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleExecutable 6 | @EXECUTABLE@ 7 | CFBundleShortVersionString 8 | @SHORT_VERSION@ 9 | CFBundleIconFile 10 | @ICON@ 11 | CFBundleIdentifier 12 | com.bourgeoislab.GPXLab 13 | CFBundlePackageType 14 | APPL 15 | CFBundleSignature 16 | ???? 17 | NSPrincipalClass 18 | NSApplication 19 | 20 | 21 | -------------------------------------------------------------------------------- /pkg/appdata.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | gpxlab.desktop 4 | MIT 5 | GPL-3.0 6 | 7 | GPXLab 8 | Program to show and manipulate GPS tracks 9 | 10 |

GPXLab is an application to display and manage GPS tracks previously recorded with a GPS tracker.

11 | 12 |

Features:

13 |
    14 |
  • Support opening GPX (v1.0 or v1.1), NMEA and SpoQ files.
  • 15 |
  • Combine several tracks into one single GPX file.
  • 16 |
  • Rearrange the tracks (move/add/delete).
  • 17 |
  • Modify the meta data of the GPX file and of any tracks inside the file.
  • 18 |
  • Get altitude data from the SRTM database.
  • 19 |
  • Show statistic information about the summarized tracks and about a single track.
  • 20 |
  • Show a map of all tracks.
  • 21 |
  • Show an altitude and a speed diagram.
  • 22 |
  • Show a list of the track points.
  • 23 |
24 |
25 | 26 | 27 | 28 | https://raw.githubusercontent.com/BourgeoisLab/GPXLab/master/doc/demo.png 29 | 30 | 31 | 32 | 33 | Graphics 34 | Viewer 35 | 36 | 37 | https://github.com/BourgeoisLab/GPXLab 38 | 39 | gpxlab.desktop 40 | 41 | 42 | gpxlab 43 | 44 | 45 | 46 | application/gpx+xml 47 | application/vnd.nmea.nmea 48 | 49 |
50 | -------------------------------------------------------------------------------- /pkg/gpxlab.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Name=GPXLab 3 | Comment=Program to show and manipulate GPS tracks 4 | Comment[fi]=Ohjelma GPS-jälkien katseluun ja käsittelyyn 5 | Comment[ru]=Программа для просмотра и обработки GPS треков 6 | Exec=gpxlab %F 7 | Icon=gpxlab 8 | Terminal=false 9 | Type=Application 10 | Categories=Graphics;Viewer;Maps;Qt; 11 | MimeType=application/gpx+xml;application/vnd.nmea.nmea; 12 | -------------------------------------------------------------------------------- /pkg/gpxlab.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BourgeoisLab/GPXLab/0a2e13756ed1c39f4278b0b3d6cef7f8ac9f6fe7/pkg/gpxlab.icns -------------------------------------------------------------------------------- /pkg/gpxlab.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | GPS Exchange Format 5 | 6 | 7 | 8 | 9 | 10 | NMEA 0183 data 11 | 12 | 13 | 14 | 15 | 16 | --------------------------------------------------------------------------------