Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
86f9a219
Commit
86f9a219
authored
Apr 06, 2015
by
dogmaphobic
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding url factory from Open Pilot maps.
As this is no longer google specific, renamed everything google to qgc.
parent
3edd02a3
Changes
22
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
878 additions
and
162 deletions
+878
-162
QtLocationGoogle.pro
libs/QtLocationGoogle/QtLocationGoogle.pro
+0
-31
.qmake.conf
libs/QtLocationQGC/.qmake.conf
+0
-0
QtLocationQGC.pro
libs/QtLocationQGC/QtLocationQGC.pro
+32
-0
qgc_maps_plugin.json
libs/QtLocationQGC/qgc_maps_plugin.json
+3
-3
OpenPilotMaps.cc
libs/QtLocationQGC/src/OpenPilotMaps.cc
+490
-0
OpenPilotMaps.h
libs/QtLocationQGC/src/OpenPilotMaps.h
+156
-0
qgeocodereplyqgc.cpp
libs/QtLocationQGC/src/qgeocodereplyqgc.cpp
+7
-7
qgeocodereplyqgc.h
libs/QtLocationQGC/src/qgeocodereplyqgc.h
+4
-4
qgeocodingmanagerengineqgc.cpp
libs/QtLocationQGC/src/qgeocodingmanagerengineqgc.cpp
+12
-12
qgeocodingmanagerengineqgc.h
libs/QtLocationQGC/src/qgeocodingmanagerengineqgc.h
+4
-4
qgeomapreplyqgc.cpp
libs/QtLocationQGC/src/qgeomapreplyqgc.cpp
+29
-13
qgeomapreplyqgc.h
libs/QtLocationQGC/src/qgeomapreplyqgc.h
+4
-4
qgeoserviceproviderpluginqgc.cpp
libs/QtLocationQGC/src/qgeoserviceproviderpluginqgc.cpp
+10
-10
qgeoserviceproviderpluginqgc.h
libs/QtLocationQGC/src/qgeoserviceproviderpluginqgc.h
+3
-3
qgeotiledmappingmanagerengineqgc.cpp
libs/QtLocationQGC/src/qgeotiledmappingmanagerengineqgc.cpp
+18
-12
qgeotiledmappingmanagerengineqgc.h
libs/QtLocationQGC/src/qgeotiledmappingmanagerengineqgc.h
+4
-4
qgeotilefetcherqgc.cpp
libs/QtLocationQGC/src/qgeotilefetcherqgc.cpp
+78
-34
qgeotilefetcherqgc.h
libs/QtLocationQGC/src/qgeotilefetcherqgc.h
+8
-5
qgcsystem.pro
qgcsystem.pro
+12
-12
qgroundcontrol.pro
qgroundcontrol.pro
+2
-2
main.cc
src/main.cc
+1
-1
QGCMapBackground.qml
src/ui/flightdisplay/components/QGCMapBackground.qml
+1
-1
No files found.
libs/QtLocationGoogle/QtLocationGoogle.pro
deleted
100644 → 0
View file @
3edd02a3
TARGET
=
qtgeoservices_google
CONFIG
+=
static
QT
+=
location
-
private
positioning
-
private
network
PLUGIN_TYPE
=
geoservices
PLUGIN_CLASS_NAME
=
QGeoServiceProviderFactoryGoogle
load
(
qt_plugin
)
INCLUDEPATH
+=
$$
QT
.
location
.
includes
HEADERS
+=
\
$$
PWD
/
src
/
qgeoserviceproviderplugingoogle
.
h
\
$$
PWD
/
src
/
qgeotiledmappingmanagerenginegoogle
.
h
\
$$
PWD
/
src
/
qgeotilefetchergoogle
.
h
\
$$
PWD
/
src
/
qgeomapreplygoogle
.
h
\
$$
PWD
/
src
/
qgeocodingmanagerenginegoogle
.
h
\
$$
PWD
/
src
/
qgeocodereplygoogle
.
h
SOURCES
+=
\
$$
PWD
/
src
/
qgeoserviceproviderplugingoogle
.
cpp
\
$$
PWD
/
src
/
qgeotiledmappingmanagerenginegoogle
.
cpp
\
$$
PWD
/
src
/
qgeotilefetchergoogle
.
cpp
\
$$
PWD
/
src
/
qgeomapreplygoogle
.
cpp
\
$$
PWD
/
src
/
qgeocodingmanagerenginegoogle
.
cpp
\
$$
PWD
/
src
/
qgeocodereplygoogle
.
cpp
OTHER_FILES
+=
\
$$
PWD
/
google_maps_plugin
.
json
libs/QtLocation
Google
/.qmake.conf
→
libs/QtLocation
QGC
/.qmake.conf
View file @
86f9a219
File moved
libs/QtLocationQGC/QtLocationQGC.pro
0 → 100644
View file @
86f9a219
TARGET
=
qtgeoservices_qgc
CONFIG
+=
static
QT
+=
location
-
private
positioning
-
private
network
PLUGIN_TYPE
=
geoservices
PLUGIN_CLASS_NAME
=
QGeoServiceProviderFactoryQGC
load
(
qt_plugin
)
INCLUDEPATH
+=
$$
QT
.
location
.
includes
HEADERS
+=
\
$$
PWD
/
src
/
qgeoserviceproviderpluginqgc
.
h
\
$$
PWD
/
src
/
qgeotiledmappingmanagerengineqgc
.
h
\
$$
PWD
/
src
/
qgeotilefetcherqgc
.
h
\
$$
PWD
/
src
/
qgeomapreplyqgc
.
h
\
$$
PWD
/
src
/
qgeocodingmanagerengineqgc
.
h
\
$$
PWD
/
src
/
qgeocodereplyqgc
.
h
\
$$
PWD
/
src
/
OpenPilotMaps
.
h
SOURCES
+=
\
$$
PWD
/
src
/
qgeoserviceproviderpluginqgc
.
cpp
\
$$
PWD
/
src
/
qgeotiledmappingmanagerengineqgc
.
cpp
\
$$
PWD
/
src
/
qgeotilefetcherqgc
.
cpp
\
$$
PWD
/
src
/
qgeomapreplyqgc
.
cpp
\
$$
PWD
/
src
/
qgeocodingmanagerengineqgc
.
cpp
\
$$
PWD
/
src
/
qgeocodereplyqgc
.
cpp
\
$$
PWD
/
src
/
OpenPilotMaps
.
cc
OTHER_FILES
+=
\
$$
PWD
/
qgc_maps_plugin
.
json
libs/QtLocation
Google/google
_maps_plugin.json
→
libs/QtLocation
QGC/qgc
_maps_plugin.json
View file @
86f9a219
{
{
"Keys"
:
[
"
google
-maps"
],
"Keys"
:
[
"
qgc
-maps"
],
"Provider"
:
"
google
"
,
"Provider"
:
"
QGroundControl
"
,
"Version"
:
10
0
,
"Version"
:
10
1
,
"Experimental"
:
false
,
"Experimental"
:
false
,
"Features"
:
[
"Features"
:
[
"OnlineMappingFeature"
,
"OnlineMappingFeature"
,
...
...
libs/QtLocationQGC/src/OpenPilotMaps.cc
0 → 100644
View file @
86f9a219
This diff is collapsed.
Click to expand it.
libs/QtLocationQGC/src/OpenPilotMaps.h
0 → 100644
View file @
86f9a219
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009, 2015 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL 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 3 of the License, or
(at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
/**
* @file
* @brief QGC Open Pilot Mapping Tools
* @author Gus Grubba <mavlink@grubba.com>
* Original work: The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
*/
#ifndef OPENPILOTTOOLS_H
#define OPENPILOTTOOLS_H
#include <QString>
#include <Qpoint>
#include <QByteArray>
#include <QNetworkProxy>
namespace
OpenPilot
{
enum
MapType
{
GoogleMap
=
1
,
GoogleSatellite
=
4
,
GoogleLabels
=
8
,
GoogleTerrain
=
16
,
GoogleHybrid
=
20
,
GoogleMapChina
=
22
,
GoogleSatelliteChina
=
24
,
GoogleLabelsChina
=
26
,
GoogleTerrainChina
=
28
,
GoogleHybridChina
=
29
,
OpenStreetMap
=
32
,
OpenStreetOsm
=
33
,
OpenStreetMapSurfer
=
34
,
OpenStreetMapSurferTerrain
=
35
,
YahooMap
=
64
,
YahooSatellite
=
128
,
YahooLabels
=
256
,
YahooHybrid
=
333
,
BingMap
=
444
,
BingSatellite
=
555
,
BingHybrid
=
666
,
ArcGIS_Map
=
777
,
ArcGIS_Satellite
=
788
,
ArcGIS_ShadedRelief
=
799
,
ArcGIS_Terrain
=
811
,
ArcGIS_MapsLT_Map
=
1000
,
ArcGIS_MapsLT_OrtoFoto
=
1001
,
ArcGIS_MapsLT_Map_Labels
=
1002
,
ArcGIS_MapsLT_Map_Hybrid
=
1003
,
PergoTurkeyMap
=
2001
,
SigPacSpainMap
=
3001
,
GoogleMapKorea
=
4001
,
GoogleSatelliteKorea
=
4002
,
GoogleLabelsKorea
=
4003
,
GoogleHybridKorea
=
4005
,
YandexMapRu
=
5000
};
class
ProviderStrings
{
public:
ProviderStrings
();
static
const
QString
levelsForSigPacSpainMap
[];
QString
GoogleMapsAPIKey
;
// Google version strings
QString
VersionGoogleMap
;
QString
VersionGoogleSatellite
;
QString
VersionGoogleLabels
;
QString
VersionGoogleTerrain
;
QString
SecGoogleWord
;
// Google (China) version strings
QString
VersionGoogleMapChina
;
QString
VersionGoogleSatelliteChina
;
QString
VersionGoogleLabelsChina
;
QString
VersionGoogleTerrainChina
;
// Google (Korea) version strings
QString
VersionGoogleMapKorea
;
QString
VersionGoogleSatelliteKorea
;
QString
VersionGoogleLabelsKorea
;
/// <summary>
/// Google Maps API generated using http://greatmaps.codeplex.com/
/// from http://code.google.com/intl/en-us/apis/maps/signup.html
/// </summary>
// Yahoo version strings
QString
VersionYahooMap
;
QString
VersionYahooSatellite
;
QString
VersionYahooLabels
;
// BingMaps
QString
VersionBingMaps
;
// YandexMap
QString
VersionYandexMap
;
/// <summary>
/// Bing Maps Customer Identification, more info here
/// http://msdn.microsoft.com/en-us/library/bb924353.aspx
/// </summary>
QString
BingMapsClientToken
;
};
class
UrlFactory
:
public
QObject
,
public
ProviderStrings
{
Q_OBJECT
public:
QByteArray
UserAgent
;
QNetworkProxy
Proxy
;
UrlFactory
();
~
UrlFactory
();
QString
makeImageUrl
(
const
MapType
&
type
,
const
QPoint
&
pos
,
const
int
&
zoom
,
const
QString
&
language
);
private:
void
_getSecGoogleWords
(
const
QPoint
&
pos
,
QString
&
sec1
,
QString
&
sec2
);
int
_getServerNum
(
const
QPoint
&
pos
,
const
int
&
max
)
const
;
void
_tryCorrectGoogleVersions
();
QString
_tileXYToQuadKey
(
const
int
&
tileX
,
const
int
&
tileY
,
const
int
&
levelOfDetail
)
const
;
bool
_isCorrectedGoogleVersions
;
bool
_correctGoogleVersions
;
int
_timeout
;
QMutex
mutex
;
static
const
double
EarthRadiusKm
;
};
}
#endif // FOO_H
libs/QtLocation
Google/src/qgeocodereplygoogle
.cpp
→
libs/QtLocation
QGC/src/qgeocodereplyqgc
.cpp
View file @
86f9a219
...
@@ -38,7 +38,7 @@
...
@@ -38,7 +38,7 @@
** $QT_END_LICENSE$
** $QT_END_LICENSE$
**
**
** 2015.4.4
** 2015.4.4
** Adapted for
google maps with the intent of use for
QGroundControl
** Adapted for
use with
QGroundControl
**
**
** Gus Grubba <mavlink@grubba.com>
** Gus Grubba <mavlink@grubba.com>
**
**
...
@@ -53,7 +53,7 @@
...
@@ -53,7 +53,7 @@
#include <QtPositioning/QGeoRectangle>
#include <QtPositioning/QGeoRectangle>
#include <unordered_map>
#include <unordered_map>
#include "qgeocodereply
google
.h"
#include "qgeocodereply
qgc
.h"
QT_BEGIN_NAMESPACE
QT_BEGIN_NAMESPACE
...
@@ -156,7 +156,7 @@ QSet<int> JasonMonger::json2QGeoCodeTypeGoogle(const QJsonArray &types) {
...
@@ -156,7 +156,7 @@ QSet<int> JasonMonger::json2QGeoCodeTypeGoogle(const QJsonArray &types) {
JasonMonger
kMonger
;
JasonMonger
kMonger
;
QGeoCodeReply
Google
::
QGeoCodeReplyGoogle
(
QNetworkReply
*
reply
,
QObject
*
parent
)
QGeoCodeReply
QGC
::
QGeoCodeReplyQGC
(
QNetworkReply
*
reply
,
QObject
*
parent
)
:
QGeoCodeReply
(
parent
),
m_reply
(
reply
)
:
QGeoCodeReply
(
parent
),
m_reply
(
reply
)
{
{
connect
(
m_reply
,
SIGNAL
(
finished
()),
this
,
SLOT
(
networkReplyFinished
()));
connect
(
m_reply
,
SIGNAL
(
finished
()),
this
,
SLOT
(
networkReplyFinished
()));
...
@@ -167,13 +167,13 @@ QGeoCodeReplyGoogle::QGeoCodeReplyGoogle(QNetworkReply *reply, QObject *parent)
...
@@ -167,13 +167,13 @@ QGeoCodeReplyGoogle::QGeoCodeReplyGoogle(QNetworkReply *reply, QObject *parent)
setOffset
(
0
);
setOffset
(
0
);
}
}
QGeoCodeReply
Google
::~
QGeoCodeReplyGoogle
()
QGeoCodeReply
QGC
::~
QGeoCodeReplyQGC
()
{
{
if
(
m_reply
)
if
(
m_reply
)
m_reply
->
deleteLater
();
m_reply
->
deleteLater
();
}
}
void
QGeoCodeReply
Google
::
abort
()
void
QGeoCodeReply
QGC
::
abort
()
{
{
if
(
!
m_reply
)
if
(
!
m_reply
)
return
;
return
;
...
@@ -184,7 +184,7 @@ void QGeoCodeReplyGoogle::abort()
...
@@ -184,7 +184,7 @@ void QGeoCodeReplyGoogle::abort()
m_reply
=
0
;
m_reply
=
0
;
}
}
void
QGeoCodeReply
Google
::
networkReplyFinished
()
void
QGeoCodeReply
QGC
::
networkReplyFinished
()
{
{
if
(
!
m_reply
)
if
(
!
m_reply
)
return
;
return
;
...
@@ -288,7 +288,7 @@ void QGeoCodeReplyGoogle::networkReplyFinished()
...
@@ -288,7 +288,7 @@ void QGeoCodeReplyGoogle::networkReplyFinished()
m_reply
=
0
;
m_reply
=
0
;
}
}
void
QGeoCodeReply
Google
::
networkReplyError
(
QNetworkReply
::
NetworkError
error
)
void
QGeoCodeReply
QGC
::
networkReplyError
(
QNetworkReply
::
NetworkError
error
)
{
{
Q_UNUSED
(
error
)
Q_UNUSED
(
error
)
if
(
!
m_reply
)
if
(
!
m_reply
)
...
...
libs/QtLocation
Google/src/qgeocodereplygoogle
.h
→
libs/QtLocation
QGC/src/qgeocodereplyqgc
.h
View file @
86f9a219
...
@@ -38,7 +38,7 @@
...
@@ -38,7 +38,7 @@
** $QT_END_LICENSE$
** $QT_END_LICENSE$
**
**
** 2015.4.4
** 2015.4.4
** Adapted for
google maps with the intent of use for
QGroundControl
** Adapted for
use with
QGroundControl
**
**
** Gus Grubba <mavlink@grubba.com>
** Gus Grubba <mavlink@grubba.com>
**
**
...
@@ -52,13 +52,13 @@
...
@@ -52,13 +52,13 @@
QT_BEGIN_NAMESPACE
QT_BEGIN_NAMESPACE
class
QGeoCodeReply
Google
:
public
QGeoCodeReply
class
QGeoCodeReply
QGC
:
public
QGeoCodeReply
{
{
Q_OBJECT
Q_OBJECT
public:
public:
explicit
QGeoCodeReply
Google
(
QNetworkReply
*
reply
,
QObject
*
parent
=
0
);
explicit
QGeoCodeReply
QGC
(
QNetworkReply
*
reply
,
QObject
*
parent
=
0
);
~
QGeoCodeReply
Google
();
~
QGeoCodeReply
QGC
();
void
abort
();
void
abort
();
...
...
libs/QtLocation
Google/src/qgeocodingmanagerenginegoogle
.cpp
→
libs/QtLocation
QGC/src/qgeocodingmanagerengineqgc
.cpp
View file @
86f9a219
...
@@ -38,7 +38,7 @@
...
@@ -38,7 +38,7 @@
** $QT_END_LICENSE$
** $QT_END_LICENSE$
**
**
** 2015.4.4
** 2015.4.4
** Adapted for
google maps with the intent of use for
QGroundControl
** Adapted for
use with
QGroundControl
**
**
** Gus Grubba <mavlink@grubba.com>
** Gus Grubba <mavlink@grubba.com>
**
**
...
@@ -55,8 +55,8 @@
...
@@ -55,8 +55,8 @@
#include <QtPositioning/QGeoShape>
#include <QtPositioning/QGeoShape>
#include <QtPositioning/QGeoRectangle>
#include <QtPositioning/QGeoRectangle>
#include "qgeocodingmanagerengine
google
.h"
#include "qgeocodingmanagerengine
qgc
.h"
#include "qgeocodereply
google
.h"
#include "qgeocodereply
qgc
.h"
QT_BEGIN_NAMESPACE
QT_BEGIN_NAMESPACE
...
@@ -77,7 +77,7 @@ static QString boundingBoxToLtrb(const QGeoRectangle &rect)
...
@@ -77,7 +77,7 @@ static QString boundingBoxToLtrb(const QGeoRectangle &rect)
QString
::
number
(
rect
.
bottomRight
().
latitude
());
QString
::
number
(
rect
.
bottomRight
().
latitude
());
}
}
QGeoCodingManagerEngine
Google
::
QGeoCodingManagerEngineGoogle
(
QGeoCodingManagerEngine
QGC
::
QGeoCodingManagerEngineQGC
(
const
QVariantMap
&
parameters
,
const
QVariantMap
&
parameters
,
QGeoServiceProvider
::
Error
*
error
,
QGeoServiceProvider
::
Error
*
error
,
QString
*
errorString
)
QString
*
errorString
)
...
@@ -91,16 +91,16 @@ QGeoCodingManagerEngineGoogle::QGeoCodingManagerEngineGoogle(
...
@@ -91,16 +91,16 @@ QGeoCodingManagerEngineGoogle::QGeoCodingManagerEngineGoogle(
errorString
->
clear
();
errorString
->
clear
();
}
}
QGeoCodingManagerEngine
Google
::~
QGeoCodingManagerEngineGoogle
()
QGeoCodingManagerEngine
QGC
::~
QGeoCodingManagerEngineQGC
()
{
{
}
}
QGeoCodeReply
*
QGeoCodingManagerEngine
Google
::
geocode
(
const
QGeoAddress
&
address
,
const
QGeoShape
&
bounds
)
QGeoCodeReply
*
QGeoCodingManagerEngine
QGC
::
geocode
(
const
QGeoAddress
&
address
,
const
QGeoShape
&
bounds
)
{
{
return
geocode
(
addressToQuery
(
address
),
-
1
,
-
1
,
bounds
);
return
geocode
(
addressToQuery
(
address
),
-
1
,
-
1
,
bounds
);
}
}
QGeoCodeReply
*
QGeoCodingManagerEngine
Google
::
geocode
(
const
QString
&
address
,
int
limit
,
int
offset
,
const
QGeoShape
&
bounds
)
QGeoCodeReply
*
QGeoCodingManagerEngine
QGC
::
geocode
(
const
QString
&
address
,
int
limit
,
int
offset
,
const
QGeoShape
&
bounds
)
{
{
Q_UNUSED
(
limit
);
Q_UNUSED
(
limit
);
Q_UNUSED
(
offset
);
Q_UNUSED
(
offset
);
...
@@ -124,7 +124,7 @@ QGeoCodeReply *QGeoCodingManagerEngineGoogle::geocode(const QString &address, in
...
@@ -124,7 +124,7 @@ QGeoCodeReply *QGeoCodingManagerEngineGoogle::geocode(const QString &address, in
QNetworkReply
*
reply
=
m_networkManager
->
get
(
request
);
QNetworkReply
*
reply
=
m_networkManager
->
get
(
request
);
reply
->
setParent
(
0
);
reply
->
setParent
(
0
);
QGeoCodeReply
Google
*
geocodeReply
=
new
QGeoCodeReplyGoogle
(
reply
);
QGeoCodeReply
QGC
*
geocodeReply
=
new
QGeoCodeReplyQGC
(
reply
);
connect
(
geocodeReply
,
SIGNAL
(
finished
()),
this
,
SLOT
(
replyFinished
()));
connect
(
geocodeReply
,
SIGNAL
(
finished
()),
this
,
SLOT
(
replyFinished
()));
connect
(
geocodeReply
,
SIGNAL
(
error
(
QGeoCodeReply
::
Error
,
QString
)),
connect
(
geocodeReply
,
SIGNAL
(
error
(
QGeoCodeReply
::
Error
,
QString
)),
...
@@ -133,7 +133,7 @@ QGeoCodeReply *QGeoCodingManagerEngineGoogle::geocode(const QString &address, in
...
@@ -133,7 +133,7 @@ QGeoCodeReply *QGeoCodingManagerEngineGoogle::geocode(const QString &address, in
return
geocodeReply
;
return
geocodeReply
;
}
}
QGeoCodeReply
*
QGeoCodingManagerEngine
Google
::
reverseGeocode
(
const
QGeoCoordinate
&
coordinate
,
const
QGeoShape
&
bounds
)
QGeoCodeReply
*
QGeoCodingManagerEngine
QGC
::
reverseGeocode
(
const
QGeoCoordinate
&
coordinate
,
const
QGeoShape
&
bounds
)
{
{
Q_UNUSED
(
bounds
)
Q_UNUSED
(
bounds
)
...
@@ -155,7 +155,7 @@ QGeoCodeReply *QGeoCodingManagerEngineGoogle::reverseGeocode(const QGeoCoordinat
...
@@ -155,7 +155,7 @@ QGeoCodeReply *QGeoCodingManagerEngineGoogle::reverseGeocode(const QGeoCoordinat
QNetworkReply
*
reply
=
m_networkManager
->
get
(
request
);
QNetworkReply
*
reply
=
m_networkManager
->
get
(
request
);
reply
->
setParent
(
0
);
reply
->
setParent
(
0
);
QGeoCodeReply
Google
*
geocodeReply
=
new
QGeoCodeReplyGoogle
(
reply
);
QGeoCodeReply
QGC
*
geocodeReply
=
new
QGeoCodeReplyQGC
(
reply
);
connect
(
geocodeReply
,
SIGNAL
(
finished
()),
this
,
SLOT
(
replyFinished
()));
connect
(
geocodeReply
,
SIGNAL
(
finished
()),
this
,
SLOT
(
replyFinished
()));
connect
(
geocodeReply
,
SIGNAL
(
error
(
QGeoCodeReply
::
Error
,
QString
)),
connect
(
geocodeReply
,
SIGNAL
(
error
(
QGeoCodeReply
::
Error
,
QString
)),
...
@@ -164,14 +164,14 @@ QGeoCodeReply *QGeoCodingManagerEngineGoogle::reverseGeocode(const QGeoCoordinat
...
@@ -164,14 +164,14 @@ QGeoCodeReply *QGeoCodingManagerEngineGoogle::reverseGeocode(const QGeoCoordinat
return
geocodeReply
;
return
geocodeReply
;
}
}
void
QGeoCodingManagerEngine
Google
::
replyFinished
()
void
QGeoCodingManagerEngine
QGC
::
replyFinished
()
{
{
QGeoCodeReply
*
reply
=
qobject_cast
<
QGeoCodeReply
*>
(
sender
());
QGeoCodeReply
*
reply
=
qobject_cast
<
QGeoCodeReply
*>
(
sender
());
if
(
reply
)
if
(
reply
)
emit
finished
(
reply
);
emit
finished
(
reply
);
}
}
void
QGeoCodingManagerEngine
Google
::
replyError
(
QGeoCodeReply
::
Error
errorCode
,
const
QString
&
errorString
)
void
QGeoCodingManagerEngine
QGC
::
replyError
(
QGeoCodeReply
::
Error
errorCode
,
const
QString
&
errorString
)
{
{
QGeoCodeReply
*
reply
=
qobject_cast
<
QGeoCodeReply
*>
(
sender
());
QGeoCodeReply
*
reply
=
qobject_cast
<
QGeoCodeReply
*>
(
sender
());
if
(
reply
)
if
(
reply
)
...
...
libs/QtLocation
Google/src/qgeocodingmanagerenginegoogle
.h
→
libs/QtLocation
QGC/src/qgeocodingmanagerengineqgc
.h
View file @
86f9a219
...
@@ -38,7 +38,7 @@
...
@@ -38,7 +38,7 @@
** $QT_END_LICENSE$
** $QT_END_LICENSE$
**
**
** 2015.4.4
** 2015.4.4
** Adapted for
google maps with the intent of use for
QGroundControl
** Adapted for
use with
QGroundControl
**
**
** Gus Grubba <mavlink@grubba.com>
** Gus Grubba <mavlink@grubba.com>
**
**
...
@@ -55,13 +55,13 @@ QT_BEGIN_NAMESPACE
...
@@ -55,13 +55,13 @@ QT_BEGIN_NAMESPACE
class
QNetworkAccessManager
;
class
QNetworkAccessManager
;
class
QGeoCodingManagerEngine
Google
:
public
QGeoCodingManagerEngine
class
QGeoCodingManagerEngine
QGC
:
public
QGeoCodingManagerEngine
{
{
Q_OBJECT
Q_OBJECT
public:
public:
QGeoCodingManagerEngine
Google
(
const
QVariantMap
&
parameters
,
QGeoServiceProvider
::
Error
*
error
,
QString
*
errorString
);
QGeoCodingManagerEngine
QGC
(
const
QVariantMap
&
parameters
,
QGeoServiceProvider
::
Error
*
error
,
QString
*
errorString
);
~
QGeoCodingManagerEngine
Google
();
~
QGeoCodingManagerEngine
QGC
();
QGeoCodeReply
*
geocode
(
const
QGeoAddress
&
address
,
const
QGeoShape
&
bounds
)
Q_DECL_OVERRIDE
;
QGeoCodeReply
*
geocode
(
const
QGeoAddress
&
address
,
const
QGeoShape
&
bounds
)
Q_DECL_OVERRIDE
;
QGeoCodeReply
*
geocode
(
const
QString
&
address
,
int
limit
,
int
offset
,
const
QGeoShape
&
bounds
)
Q_DECL_OVERRIDE
;
QGeoCodeReply
*
geocode
(
const
QString
&
address
,
int
limit
,
int
offset
,
const
QGeoShape
&
bounds
)
Q_DECL_OVERRIDE
;
...
...
libs/QtLocation
Google/src/qgeomapreplygoogle
.cpp
→
libs/QtLocation
QGC/src/qgeomapreplyqgc
.cpp
View file @
86f9a219
...
@@ -38,7 +38,7 @@
...
@@ -38,7 +38,7 @@
** $QT_END_LICENSE$
** $QT_END_LICENSE$
**
**
** 2015.4.4
** 2015.4.4
** Adapted for
google maps with the intent of use for
QGroundControl
** Adapted for
use with
QGroundControl
**
**
** Gus Grubba <mavlink@grubba.com>
** Gus Grubba <mavlink@grubba.com>
**
**
...
@@ -46,9 +46,10 @@
...
@@ -46,9 +46,10 @@
#include <QtLocation/private/qgeotilespec_p.h>
#include <QtLocation/private/qgeotilespec_p.h>
#include "qgeomapreplygoogle.h"
#include "qgeomapreplyqgc.h"
#include "OpenPilotMaps.h"
QGeoMapReply
Google
::
QGeoMapReplyGoogle
(
QNetworkReply
*
reply
,
const
QGeoTileSpec
&
spec
,
QObject
*
parent
)
QGeoMapReply
QGC
::
QGeoMapReplyQGC
(
QNetworkReply
*
reply
,
const
QGeoTileSpec
&
spec
,
QObject
*
parent
)
:
QGeoTiledMapReply
(
spec
,
parent
)
:
QGeoTiledMapReply
(
spec
,
parent
)
,
m_reply
(
reply
)
,
m_reply
(
reply
)
{
{
...
@@ -57,7 +58,7 @@ QGeoMapReplyGoogle::QGeoMapReplyGoogle(QNetworkReply *reply, const QGeoTileSpec
...
@@ -57,7 +58,7 @@ QGeoMapReplyGoogle::QGeoMapReplyGoogle(QNetworkReply *reply, const QGeoTileSpec
connect
(
m_reply
,
SIGNAL
(
destroyed
()),
this
,
SLOT
(
replyDestroyed
()));
connect
(
m_reply
,
SIGNAL
(
destroyed
()),
this
,
SLOT
(
replyDestroyed
()));
}
}
QGeoMapReply
Google
::~
QGeoMapReplyGoogle
()
QGeoMapReply
QGC
::~
QGeoMapReplyQGC
()
{
{
if
(
m_reply
)
{
if
(
m_reply
)
{
m_reply
->
deleteLater
();
m_reply
->
deleteLater
();
...
@@ -65,24 +66,24 @@ QGeoMapReplyGoogle::~QGeoMapReplyGoogle()
...
@@ -65,24 +66,24 @@ QGeoMapReplyGoogle::~QGeoMapReplyGoogle()
}
}
}
}
void
QGeoMapReply
Google
::
abort
()
void
QGeoMapReply
QGC
::
abort
()
{
{
if
(
!
m_reply
)
if
(
!
m_reply
)
return
;
return
;
m_reply
->
abort
();
m_reply
->
abort
();
}
}
QNetworkReply
*
QGeoMapReply
Google
::
networkReply
()
const
QNetworkReply
*
QGeoMapReply
QGC
::
networkReply
()
const
{
{
return
m_reply
;
return
m_reply
;
}
}
void
QGeoMapReply
Google
::
replyDestroyed
()
void
QGeoMapReply
QGC
::
replyDestroyed
()
{
{
m_reply
=
0
;
m_reply
=
0
;
}
}
void
QGeoMapReply
Google
::
networkReplyFinished
()
void
QGeoMapReply
QGC
::
networkReplyFinished
()
{
{
if
(
!
m_reply
)
if
(
!
m_reply
)
return
;
return
;
...
@@ -90,24 +91,39 @@ void QGeoMapReplyGoogle::networkReplyFinished()
...
@@ -90,24 +91,39 @@ void QGeoMapReplyGoogle::networkReplyFinished()
if
(
m_reply
->
error
()
!=
QNetworkReply
::
NoError
)
if
(
m_reply
->
error
()
!=
QNetworkReply
::
NoError
)
return
;
return
;
// qDebug() << "Map OK: " << m_reply->url().toString();
QByteArray
a
=
m_reply
->
readAll
();
QByteArray
a
=
m_reply
->
readAll
();
setMapImageData
(
a
);
setMapImageData
(
a
);
if
(
tileSpec
().
mapId
()
>
0
&&
tileSpec
().
mapId
()
<
5
)
switch
((
OpenPilot
::
MapType
)
tileSpec
().
mapId
())
{
case
OpenPilot
:
:
GoogleMap
:
case
OpenPilot
:
:
GoogleSatellite
:
case
OpenPilot
:
:
GoogleLabels
:
case
OpenPilot
:
:
GoogleTerrain
:
case
OpenPilot
:
:
GoogleHybrid
:
case
OpenPilot
:
:
BingMap
:
setMapImageFormat
(
"png"
);
setMapImageFormat
(
"png"
);
else
break
;
case
OpenPilot
:
:
BingSatellite
:
setMapImageFormat
(
"jpeg"
);
break
;
default:
qWarning
(
"Unknown map id %d"
,
tileSpec
().
mapId
());
qWarning
(
"Unknown map id %d"
,
tileSpec
().
mapId
());
break
;
}
setFinished
(
true
);
setFinished
(
true
);
m_reply
->
deleteLater
();
m_reply
->
deleteLater
();
m_reply
=
0
;
m_reply
=
0
;
}
}
void
QGeoMapReply
Google
::
networkReplyError
(
QNetworkReply
::
NetworkError
error
)
void
QGeoMapReply
QGC
::
networkReplyError
(
QNetworkReply
::
NetworkError
error
)
{
{
if
(
!
m_reply
)
if
(
!
m_reply
)
return
;
return
;
// qDebug() << "Map error: " << m_reply->url().toString();
if
(
error
!=
QNetworkReply
::
OperationCanceledError
)
if
(
error
!=
QNetworkReply
::
OperationCanceledError
)
setError
(
QGeoTiledMapReply
::
CommunicationError
,
m_reply
->
errorString
());
setError
(
QGeoTiledMapReply
::
CommunicationError
,
m_reply
->
errorString
());
...
...
libs/QtLocation
Google/src/qgeomapreplygoogle
.h
→
libs/QtLocation
QGC/src/qgeomapreplyqgc
.h
View file @
86f9a219
...
@@ -38,7 +38,7 @@
...
@@ -38,7 +38,7 @@
** $QT_END_LICENSE$
** $QT_END_LICENSE$
**
**
** 2015.4.4
** 2015.4.4
** Adapted for
google maps with the intent of use for
QGroundControl
** Adapted for
use with
QGroundControl
**
**
** Gus Grubba <mavlink@grubba.com>
** Gus Grubba <mavlink@grubba.com>
**
**
...
@@ -52,13 +52,13 @@
...
@@ -52,13 +52,13 @@
QT_BEGIN_NAMESPACE
QT_BEGIN_NAMESPACE
class
QGeoMapReply
Google
:
public
QGeoTiledMapReply
class
QGeoMapReply
QGC
:
public
QGeoTiledMapReply
{
{
Q_OBJECT
Q_OBJECT
public:
public:
explicit
QGeoMapReply
Google
(
QNetworkReply
*
reply
,
const
QGeoTileSpec
&
spec
,
QObject
*
parent
=
0
);
explicit
QGeoMapReply
QGC
(
QNetworkReply
*
reply
,
const
QGeoTileSpec
&
spec
,
QObject
*
parent
=
0
);