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
9da70e37
Commit
9da70e37
authored
Sep 13, 2019
by
Pierre TILAK
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Hash Table
parent
65c30db0
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
80 additions
and
83 deletions
+80
-83
GoogleMapProvider.cpp
src/QtLocationPlugin/GoogleMapProvider.cpp
+54
-78
GoogleMapProvider.h
src/QtLocationPlugin/GoogleMapProvider.h
+18
-0
QGCMapUrlEngine.cpp
src/QtLocationPlugin/QGCMapUrlEngine.cpp
+5
-4
QGCMapUrlEngine.h
src/QtLocationPlugin/QGCMapUrlEngine.h
+3
-1
No files found.
src/QtLocationPlugin/GoogleMapProvider.cpp
View file @
9da70e37
...
...
@@ -5,7 +5,7 @@
#endif
#include "QGCMapEngine.h"
#define AVERAGE_GOOGLE_STREET_MAP
4913
#define AVERAGE_GOOGLE_STREET_MAP 4913
GoogleMapProvider
::
GoogleMapProvider
(
QObject
*
parent
)
:
MapProvider
(
QString
(
"https://www.google.com/maps/preview"
),
...
...
@@ -18,10 +18,9 @@ GoogleMapProvider::GoogleMapProvider(QObject* parent)
_versionGoogleLabels
=
"h@336"
;
_versionGoogleTerrain
=
"t@354,r@354000000"
;
_secGoogleWord
=
"Galileo"
;
}
quint32
GoogleMapProvider
::
getAverageSize
(){
quint32
GoogleMapProvider
::
getAverageSize
()
{
return
quint32
(
AVERAGE_GOOGLE_STREET_MAP
);
}
...
...
@@ -32,7 +31,7 @@ GoogleMapProvider::~GoogleMapProvider() {
//-----------------------------------------------------------------------------
void
GoogleMapProvider
::
_getSecGoogleWords
(
int
x
,
int
y
,
QString
&
sec1
,
QString
&
sec2
)
{
QString
&
sec2
)
{
sec1
=
""
;
// after &x=...
sec2
=
""
;
// after &zoom=...
int
seclen
=
((
x
*
3
)
+
y
)
%
8
;
...
...
@@ -93,7 +92,6 @@ void GoogleMapProvider::_googleVersionCompleted() {
_googleReply
=
nullptr
;
}
//-----------------------------------------------------------------------------
void
GoogleMapProvider
::
_tryCorrectGoogleVersions
(
QNetworkAccessManager
*
networkManager
)
{
QMutexLocker
locker
(
&
_googleVersionMutex
);
...
...
@@ -128,10 +126,9 @@ void GoogleMapProvider::_tryCorrectGoogleVersions(
networkManager
->
setProxy
(
proxy
);
}
}
//
//-----------------------------------------------------------------------------
QString
GoogleMapProvider
::
_getURL
(
int
x
,
int
y
,
int
zoom
,
QNetworkAccessManager
*
networkManager
)
{
QNetworkAccessManager
*
networkManager
)
{
// http://mt1.google.com/vt/lyrs=m
QString
server
=
"mt"
;
QString
request
=
"vt"
;
...
...
@@ -151,78 +148,11 @@ QString GoogleMapProvider::_getURL(int x, int y, int zoom,
.
arg
(
y
)
.
arg
(
zoom
)
.
arg
(
sec2
);
//} break;
//case GoogleSatellite: {
// // http://mt1.google.com/vt/lyrs=s
// QString server = "khm";
// QString request = "kh";
// QString sec1 = ""; // after &x=...
// QString sec2 = ""; // after &zoom=...
// _getSecGoogleWords(x, y, sec1, sec2);
// _tryCorrectGoogleVersions(networkManager);
// return QString(
// "http://%1%2.google.com/%3/v=%4&hl=%5&x=%6%7&y=%8&z=%9&s=%10")
// .arg(server)
// .arg(_getServerNum(x, y, 4))
// .arg(request)
// .arg(_versionGoogleSatellite)
// .arg(_language)
// .arg(x)
// .arg(sec1)
// .arg(y)
// .arg(zoom)
// .arg(sec2);
//} break;
//case GoogleLabels: {
// QString server = "mts";
// QString request = "vt";
// QString sec1 = ""; // after &x=...
// QString sec2 = ""; // after &zoom=...
// _getSecGoogleWords(x, y, sec1, sec2);
// _tryCorrectGoogleVersions(networkManager);
// return QString(
// "http://%1%2.google.com/%3/lyrs=%4&hl=%5&x=%6%7&y=%8&z=%9&s=%10")
// .arg(server)
// .arg(_getServerNum(x, y, 4))
// .arg(request)
// .arg(_versionGoogleLabels)
// .arg(_language)
// .arg(x)
// .arg(sec1)
// .arg(y)
// .arg(zoom)
// .arg(sec2);
//} break;
//case GoogleTerrain: {
// QString server = "mt";
// QString request = "vt";
// QString sec1 = ""; // after &x=...
// QString sec2 = ""; // after &zoom=...
// _getSecGoogleWords(x, y, sec1, sec2);
// _tryCorrectGoogleVersions(networkManager);
// return QString(
// "http://%1%2.google.com/%3/v=%4&hl=%5&x=%6%7&y=%8&z=%9&s=%10")
// .arg(server)
// .arg(_getServerNum(x, y, 4))
// .arg(request)
// .arg(_versionGoogleTerrain)
// .arg(_language)
// .arg(x)
// .arg(sec1)
// .arg(y)
// .arg(zoom)
// .arg(sec2);
//} break;
//default:
// qWarning("Unknown map id %d\n", type);
// break;
//}
//return {};
}
QString
GoogleSatelliteMapProvider
::
_getURL
(
int
x
,
int
y
,
int
zoom
,
QNetworkAccessManager
*
networkManager
)
{
qDebug
()
<<
"Yohou"
;
QString
GoogleSatelliteMapProvider
::
_getURL
(
int
x
,
int
y
,
int
zoom
,
QNetworkAccessManager
*
networkManager
)
{
// http://mt1.google.com/vt/lyrs=s
QString
server
=
"khm"
;
QString
request
=
"kh"
;
...
...
@@ -243,3 +173,49 @@ QString GoogleSatelliteMapProvider::_getURL(int x, int y, int zoom,
.
arg
(
zoom
)
.
arg
(
sec2
);
}
QString
GoogleLabelsMapProvider
::
_getURL
(
int
x
,
int
y
,
int
zoom
,
QNetworkAccessManager
*
networkManager
)
{
QString
server
=
"mts"
;
QString
request
=
"vt"
;
QString
sec1
=
""
;
// after &x=...
QString
sec2
=
""
;
// after &zoom=...
_getSecGoogleWords
(
x
,
y
,
sec1
,
sec2
);
_tryCorrectGoogleVersions
(
networkManager
);
return
QString
(
"http://%1%2.google.com/%3/lyrs=%4&hl=%5&x=%6%7&y=%8&z=%9&s=%10"
)
.
arg
(
server
)
.
arg
(
_getServerNum
(
x
,
y
,
4
))
.
arg
(
request
)
.
arg
(
_versionGoogleLabels
)
.
arg
(
_language
)
.
arg
(
x
)
.
arg
(
sec1
)
.
arg
(
y
)
.
arg
(
zoom
)
.
arg
(
sec2
);
}
QString
GoogleTerrainMapProvider
::
_getURL
(
int
x
,
int
y
,
int
zoom
,
QNetworkAccessManager
*
networkManager
)
{
QString
server
=
"mt"
;
QString
request
=
"vt"
;
QString
sec1
=
""
;
// after &x=...
QString
sec2
=
""
;
// after &zoom=...
_getSecGoogleWords
(
x
,
y
,
sec1
,
sec2
);
_tryCorrectGoogleVersions
(
networkManager
);
return
QString
(
"http://%1%2.google.com/%3/v=%4&hl=%5&x=%6%7&y=%8&z=%9&s=%10"
)
.
arg
(
server
)
.
arg
(
_getServerNum
(
x
,
y
,
4
))
.
arg
(
request
)
.
arg
(
_versionGoogleTerrain
)
.
arg
(
_language
)
.
arg
(
x
)
.
arg
(
sec1
)
.
arg
(
y
)
.
arg
(
zoom
)
.
arg
(
sec2
);
}
src/QtLocationPlugin/GoogleMapProvider.h
View file @
9da70e37
...
...
@@ -51,3 +51,21 @@ class GoogleSatelliteMapProvider : public GoogleMapProvider {
QString
_getURL
(
int
x
,
int
y
,
int
zoom
,
QNetworkAccessManager
*
networkManager
);
};
class
GoogleLabelsMapProvider
:
public
GoogleMapProvider
{
Q_OBJECT
public:
GoogleLabelsMapProvider
(
QObject
*
parent
)
:
GoogleMapProvider
(
parent
){}
protected:
QString
_getURL
(
int
x
,
int
y
,
int
zoom
,
QNetworkAccessManager
*
networkManager
);
};
class
GoogleTerrainMapProvider
:
public
GoogleMapProvider
{
Q_OBJECT
public:
GoogleTerrainMapProvider
(
QObject
*
parent
)
:
GoogleMapProvider
(
parent
){}
protected:
QString
_getURL
(
int
x
,
int
y
,
int
zoom
,
QNetworkAccessManager
*
networkManager
);
};
src/QtLocationPlugin/QGCMapUrlEngine.cpp
View file @
9da70e37
...
...
@@ -45,10 +45,11 @@ UrlFactory::UrlFactory()
// BingMaps
//_versionBingMaps = "563";
#ifndef QGC_NO_GOOGLE_MAPS
_googleMapProvider
=
new
GoogleSatelliteMapProvider
(
this
);
_providersTable
[
"GoogleStreet"
]
=
new
GoogleMapProvider
(
this
);
_providersTable
[
"GoogleSatellite"
]
=
new
GoogleSatelliteMapProvider
(
this
);
#endif
_curMapProvider
=
_providersTable
[
"GoogleStreet"
];
}
//-----------------------------------------------------------------------------
...
...
@@ -62,7 +63,7 @@ QString
UrlFactory
::
getImageFormat
(
MapType
type
,
const
QByteArray
&
image
)
{
Q_UNUSED
(
type
);
return
_
google
MapProvider
->
getImageFormat
(
image
);
return
_
cur
MapProvider
->
getImageFormat
(
image
);
//QString format;
//if(image.size() > 2)
//{
...
...
@@ -132,7 +133,7 @@ QNetworkRequest
UrlFactory
::
getTileURL
(
MapType
type
,
int
x
,
int
y
,
int
zoom
,
QNetworkAccessManager
*
networkManager
)
{
Q_UNUSED
(
type
);
return
_
google
MapProvider
->
getTileURL
(
x
,
y
,
zoom
,
networkManager
);
return
_
cur
MapProvider
->
getTileURL
(
x
,
y
,
zoom
,
networkManager
);
////-- Build URL
//QNetworkRequest request;
//QString url = _getURL(type, x, y, zoom, networkManager);
...
...
src/QtLocationPlugin/QGCMapUrlEngine.h
View file @
9da70e37
...
...
@@ -94,7 +94,9 @@ private:
// BingMaps
//QString _versionBingMaps;
GoogleMapProvider
*
_googleMapProvider
;
MapProvider
*
_curMapProvider
;
QHash
<
QString
,
MapProvider
*>
_providersTable
;
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment