Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
af9a72e
commit 612af1f
Showing
13 changed files
with
450 additions
and
158 deletions.
There are no files selected for viewing
87 changes: 87 additions & 0 deletions
87
python/core/auto_generated/gps/qgsbabelformatregistry.sip.in
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/core/gps/qgsbabelformatregistry.h * | ||
* * | ||
* Do not edit manually ! Edit header and run scripts/sipify.pl again * | ||
************************************************************************/ | ||
|
||
|
||
|
||
|
||
class QgsBabelFormatRegistry | ||
{ | ||
%Docstring(signature="appended") | ||
A registry for :py:class:`QgsAbstractBabelFormat` GPSBabel formats. | ||
|
||
:py:class:`QgsBabelFormatRegistry` is not usually directly created, but rather accessed through | ||
:py:func:`QgsApplication.gpsBabelFormatRegistry()`. | ||
|
||
.. versionadded:: 3.22 | ||
%End | ||
|
||
%TypeHeaderCode | ||
#include "qgsbabelformatregistry.h" | ||
%End | ||
public: | ||
|
||
QgsBabelFormatRegistry(); | ||
%Docstring | ||
Constructor for QgsBabelFormatRegistry. | ||
|
||
The registry will automatically be populated with standard formats, and with | ||
devices previously configured and stored in QSettings. | ||
%End | ||
~QgsBabelFormatRegistry(); | ||
|
||
|
||
QStringList importFormatNames() const; | ||
%Docstring | ||
Returns a list of the names of all registered import formats. | ||
%End | ||
|
||
QgsAbstractBabelFormat *importFormat( const QString &name ); | ||
%Docstring | ||
Returns a registered import format by ``name``. | ||
|
||
.. seealso:: :py:func:`importFormatNames` | ||
%End | ||
|
||
QStringList deviceNames() const; | ||
%Docstring | ||
Returns a list of the names of all registered devices. | ||
%End | ||
|
||
QgsBabelGpsDeviceFormat *deviceFormat( const QString &name ); | ||
%Docstring | ||
Returns a registered device format by ``name``. | ||
|
||
.. seealso:: :py:func:`deviceNames` | ||
%End | ||
|
||
QMap< QString, QgsBabelGpsDeviceFormat * > devices() const; | ||
%Docstring | ||
Returns a map of device name to device format. | ||
|
||
.. seealso:: :py:func:`deviceFormat` | ||
|
||
.. seealso:: :py:func:`deviceNames` | ||
%End | ||
|
||
void reloadFromSettings(); | ||
%Docstring | ||
Reloads the registry's members from the currently stored configuration. | ||
%End | ||
|
||
private: | ||
QgsBabelFormatRegistry( const QgsBabelFormatRegistry &rh ); | ||
}; | ||
|
||
|
||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/core/gps/qgsbabelformatregistry.h * | ||
* * | ||
* Do not edit manually ! Edit header and run scripts/sipify.pl again * | ||
************************************************************************/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,154 @@ | ||
/*************************************************************************** | ||
qgsbabelformatregistry.cpp | ||
------------------- | ||
begin : July 2021 | ||
copyright : (C) 2021 by Nyall Dawson | ||
email : nyall dot dawson at gmail dot com | ||
***************************************************************************/ | ||
|
||
/*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
#include "qgsbabelformatregistry.h" | ||
#include "qgsbabelformat.h" | ||
#include "qgsbabelgpsdevice.h" | ||
#include "qgssettings.h" | ||
#include <QString> | ||
|
||
QgsBabelFormatRegistry::QgsBabelFormatRegistry() | ||
{ | ||
mImporters[QStringLiteral( "Shapefile" )] = | ||
new QgsBabelSimpleImportFormat( QStringLiteral( "shape" ), Qgis::BabelFormatCapability::Waypoints | Qgis::BabelFormatCapability::Routes | Qgis::BabelFormatCapability::Tracks ); | ||
mImporters[QStringLiteral( "Geocaching.com .loc" )] = | ||
new QgsBabelSimpleImportFormat( QStringLiteral( "geo" ), Qgis::BabelFormatCapability::Waypoints ); | ||
mImporters[QStringLiteral( "Magellan Mapsend" )] = | ||
new QgsBabelSimpleImportFormat( QStringLiteral( "mapsend" ), Qgis::BabelFormatCapability::Waypoints | Qgis::BabelFormatCapability::Routes | Qgis::BabelFormatCapability::Tracks ); | ||
mImporters[QStringLiteral( "Garmin PCX5" )] = | ||
new QgsBabelSimpleImportFormat( QStringLiteral( "pcx" ), Qgis::BabelFormatCapability::Waypoints | Qgis::BabelFormatCapability::Tracks ); | ||
mImporters[QStringLiteral( "Garmin Mapsource" )] = | ||
new QgsBabelSimpleImportFormat( QStringLiteral( "mapsource" ), Qgis::BabelFormatCapability::Waypoints | Qgis::BabelFormatCapability::Routes | Qgis::BabelFormatCapability::Tracks ); | ||
mImporters[QStringLiteral( "GPSUtil" )] = | ||
new QgsBabelSimpleImportFormat( QStringLiteral( "gpsutil" ), Qgis::BabelFormatCapability::Waypoints ); | ||
mImporters[QStringLiteral( "PocketStreets 2002/2003 Pushpin" )] = | ||
new QgsBabelSimpleImportFormat( QStringLiteral( "psp" ), Qgis::BabelFormatCapability::Waypoints ); | ||
mImporters[QStringLiteral( "CoPilot Flight Planner" )] = | ||
new QgsBabelSimpleImportFormat( QStringLiteral( "copilot" ), Qgis::BabelFormatCapability::Waypoints ); | ||
mImporters[QStringLiteral( "Magellan Navigator Companion" )] = | ||
new QgsBabelSimpleImportFormat( QStringLiteral( "magnav" ), Qgis::BabelFormatCapability::Waypoints ); | ||
mImporters[QStringLiteral( "Holux" )] = | ||
new QgsBabelSimpleImportFormat( QStringLiteral( "holux" ), Qgis::BabelFormatCapability::Waypoints ); | ||
mImporters[QStringLiteral( "Topo by National Geographic" )] = | ||
new QgsBabelSimpleImportFormat( QStringLiteral( "tpg" ), Qgis::BabelFormatCapability::Waypoints ); | ||
mImporters[QStringLiteral( "TopoMapPro" )] = | ||
new QgsBabelSimpleImportFormat( QStringLiteral( "tmpro" ), Qgis::BabelFormatCapability::Waypoints ); | ||
mImporters[QStringLiteral( "GeocachingDB" )] = | ||
new QgsBabelSimpleImportFormat( QStringLiteral( "gcdb" ), Qgis::BabelFormatCapability::Waypoints ); | ||
mImporters[QStringLiteral( "Tiger" )] = | ||
new QgsBabelSimpleImportFormat( QStringLiteral( "tiger" ), Qgis::BabelFormatCapability::Waypoints ); | ||
mImporters[QStringLiteral( "EasyGPS Binary Format" )] = | ||
new QgsBabelSimpleImportFormat( QStringLiteral( "easygps" ), Qgis::BabelFormatCapability::Waypoints ); | ||
mImporters[QStringLiteral( "Delorme Routes" )] = | ||
new QgsBabelSimpleImportFormat( QStringLiteral( "saroute" ), Qgis::BabelFormatCapability::Tracks ); | ||
mImporters[QStringLiteral( "Navicache" )] = | ||
new QgsBabelSimpleImportFormat( QStringLiteral( "navicache" ), Qgis::BabelFormatCapability::Waypoints ); | ||
mImporters[QStringLiteral( "PSITrex" )] = | ||
new QgsBabelSimpleImportFormat( QStringLiteral( "psitrex" ), Qgis::BabelFormatCapability::Waypoints | Qgis::BabelFormatCapability::Routes | Qgis::BabelFormatCapability::Tracks ); | ||
mImporters[QStringLiteral( "Delorme GPS Log" )] = | ||
new QgsBabelSimpleImportFormat( QStringLiteral( "gpl" ), Qgis::BabelFormatCapability::Tracks ); | ||
mImporters[QStringLiteral( "OziExplorer" )] = | ||
new QgsBabelSimpleImportFormat( QStringLiteral( "ozi" ), Qgis::BabelFormatCapability::Waypoints ); | ||
mImporters[QStringLiteral( "NMEA Sentences" )] = | ||
new QgsBabelSimpleImportFormat( QStringLiteral( "nmea" ), Qgis::BabelFormatCapability::Waypoints | Qgis::BabelFormatCapability::Tracks ); | ||
mImporters[QStringLiteral( "Delorme Street Atlas 2004 Plus" )] = | ||
new QgsBabelSimpleImportFormat( QStringLiteral( "saplus" ), Qgis::BabelFormatCapability::Waypoints ); | ||
mImporters[QStringLiteral( "Microsoft Streets and Trips" )] = | ||
new QgsBabelSimpleImportFormat( QStringLiteral( "s_and_t" ), Qgis::BabelFormatCapability::Waypoints ); | ||
mImporters[QStringLiteral( "NIMA/GNIS Geographic Names" )] = | ||
new QgsBabelSimpleImportFormat( QStringLiteral( "nima" ), Qgis::BabelFormatCapability::Waypoints ); | ||
mImporters[QStringLiteral( "Maptech" )] = | ||
new QgsBabelSimpleImportFormat( QStringLiteral( "mxf" ), Qgis::BabelFormatCapability::Waypoints ); | ||
mImporters[QStringLiteral( "Mapopolis.com Mapconverter Application" )] = | ||
new QgsBabelSimpleImportFormat( QStringLiteral( "mapconverter" ), Qgis::BabelFormatCapability::Waypoints ); | ||
mImporters[QStringLiteral( "GPSman" )] = | ||
new QgsBabelSimpleImportFormat( QStringLiteral( "gpsman" ), Qgis::BabelFormatCapability::Waypoints ); | ||
mImporters[QStringLiteral( "GPSDrive" )] = | ||
new QgsBabelSimpleImportFormat( QStringLiteral( "gpsdrive" ), Qgis::BabelFormatCapability::Waypoints ); | ||
mImporters[QStringLiteral( "Fugawi" )] = | ||
new QgsBabelSimpleImportFormat( QStringLiteral( "fugawi" ), Qgis::BabelFormatCapability::Waypoints ); | ||
mImporters[QStringLiteral( "DNA" )] = | ||
new QgsBabelSimpleImportFormat( QStringLiteral( "dna" ), Qgis::BabelFormatCapability::Waypoints ); | ||
|
||
reloadFromSettings(); | ||
} | ||
|
||
QgsBabelFormatRegistry::~QgsBabelFormatRegistry() | ||
{ | ||
qDeleteAll( mImporters ); | ||
qDeleteAll( mDevices ); | ||
} | ||
|
||
QStringList QgsBabelFormatRegistry::importFormatNames() const | ||
{ | ||
return mImporters.keys(); | ||
} | ||
|
||
QgsAbstractBabelFormat *QgsBabelFormatRegistry::importFormat( const QString &name ) | ||
{ | ||
return mImporters.value( name ); | ||
} | ||
|
||
QStringList QgsBabelFormatRegistry::deviceNames() const | ||
{ | ||
return mDevices.keys(); | ||
} | ||
|
||
QgsBabelGpsDeviceFormat *QgsBabelFormatRegistry::deviceFormat( const QString &name ) | ||
{ | ||
return mDevices.value( name ); | ||
} | ||
|
||
QMap<QString, QgsBabelGpsDeviceFormat *> QgsBabelFormatRegistry::devices() const | ||
{ | ||
return mDevices; | ||
} | ||
|
||
void QgsBabelFormatRegistry::reloadFromSettings() | ||
{ | ||
qDeleteAll( mDevices ); | ||
mDevices.clear(); | ||
|
||
mDevices[QStringLiteral( "Garmin serial" )] = | ||
new QgsBabelGpsDeviceFormat( QStringLiteral( "%babel -w -i garmin -o gpx %in %out" ), | ||
QStringLiteral( "%babel -w -i gpx -o garmin %in %out" ), | ||
QStringLiteral( "%babel -r -i garmin -o gpx %in %out" ), | ||
QStringLiteral( "%babel -r -i gpx -o garmin %in %out" ), | ||
QStringLiteral( "%babel -t -i garmin -o gpx %in %out" ), | ||
QStringLiteral( "%babel -t -i gpx -o garmin %in %out" ) ); | ||
|
||
QgsSettings settings; | ||
const QStringList deviceNames = settings.value( QStringLiteral( "Plugin-GPS/devicelist" ) ).toStringList(); | ||
for ( const QString &device : deviceNames ) | ||
{ | ||
const QString baseKey = QStringLiteral( "/Plugin-GPS/devices/%1" ).arg( device ); | ||
const QString wptDownload = settings.value( QStringLiteral( "%1/wptdownload" ).arg( baseKey ) ).toString(); | ||
const QString wptUpload = settings.value( QStringLiteral( "%1/wptupload" ).arg( baseKey ) ).toString(); | ||
const QString rteDownload = settings.value( QStringLiteral( "%1/rtedownload" ).arg( baseKey ) ).toString(); | ||
const QString rteUpload = settings.value( QStringLiteral( "%1/rteupload" ).arg( baseKey ) ).toString(); | ||
const QString trkDownload = settings.value( QStringLiteral( "%1/trkdownload" ).arg( baseKey ) ).toString(); | ||
const QString trkUpload = settings.value( QStringLiteral( "%1/trkupload" ).arg( baseKey ) ).toString(); | ||
|
||
mDevices[device] = new QgsBabelGpsDeviceFormat( wptDownload, | ||
wptUpload, | ||
rteDownload, | ||
rteUpload, | ||
trkDownload, | ||
trkUpload ); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
/*************************************************************************** | ||
qgsbabelformatregistry.h | ||
------------------- | ||
begin : July 2021 | ||
copyright : (C) 2021 by Nyall Dawson | ||
email : nyall dot dawson at gmail dot com | ||
*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
#ifndef QGSBABELFORMATREGISTRY_H | ||
#define QGSBABELFORMATREGISTRY_H | ||
|
||
#include "qgis_core.h" | ||
#include "qgis.h" | ||
|
||
class QgsAbstractBabelFormat; | ||
class QgsBabelGpsDeviceFormat; | ||
|
||
/** | ||
* \ingroup core | ||
* \class QgsBabelFormatRegistry | ||
* \brief A registry for QgsAbstractBabelFormat GPSBabel formats. | ||
* | ||
* QgsBabelFormatRegistry is not usually directly created, but rather accessed through | ||
* QgsApplication::gpsBabelFormatRegistry(). | ||
* | ||
* \since QGIS 3.22 | ||
*/ | ||
class CORE_EXPORT QgsBabelFormatRegistry | ||
{ | ||
public: | ||
|
||
/** | ||
* Constructor for QgsBabelFormatRegistry. | ||
* | ||
* The registry will automatically be populated with standard formats, and with | ||
* devices previously configured and stored in QSettings. | ||
*/ | ||
QgsBabelFormatRegistry(); | ||
~QgsBabelFormatRegistry(); | ||
|
||
//! QgsBabelFormatRegistry cannot be copied. | ||
QgsBabelFormatRegistry( const QgsBabelFormatRegistry &rh ) = delete; | ||
//! QgsBabelFormatRegistry cannot be copied. | ||
QgsBabelFormatRegistry &operator=( const QgsBabelFormatRegistry &rh ) = delete; | ||
|
||
/** | ||
* Returns a list of the names of all registered import formats. | ||
*/ | ||
QStringList importFormatNames() const; | ||
|
||
/** | ||
* Returns a registered import format by \a name. | ||
* | ||
* \see importFormatNames(). | ||
*/ | ||
QgsAbstractBabelFormat *importFormat( const QString &name ); | ||
|
||
/** | ||
* Returns a list of the names of all registered devices. | ||
*/ | ||
QStringList deviceNames() const; | ||
|
||
/** | ||
* Returns a registered device format by \a name. | ||
* | ||
* \see deviceNames(). | ||
*/ | ||
QgsBabelGpsDeviceFormat *deviceFormat( const QString &name ); | ||
|
||
/** | ||
* Returns a map of device name to device format. | ||
* | ||
* \see deviceFormat() | ||
* \see deviceNames() | ||
*/ | ||
QMap< QString, QgsBabelGpsDeviceFormat * > devices() const; | ||
|
||
/** | ||
* Reloads the registry's members from the currently stored configuration. | ||
*/ | ||
void reloadFromSettings(); | ||
|
||
private: | ||
#ifdef SIP_RUN | ||
QgsBabelFormatRegistry( const QgsBabelFormatRegistry &rh ); | ||
#endif | ||
|
||
//! Importers for external GPS data file formats | ||
QMap< QString, QgsAbstractBabelFormat *> mImporters; | ||
//! Upload/downloaders for GPS devices | ||
QMap< QString, QgsBabelGpsDeviceFormat *> mDevices; | ||
}; | ||
|
||
|
||
#endif // QGSBABELFORMATREGISTRY_H |
Oops, something went wrong.