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
598d1464
Commit
598d1464
authored
Nov 02, 2019
by
olliw42
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into pr-batterystatus
parents
8dc2837b
901e895d
Changes
18
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
545 additions
and
668 deletions
+545
-668
AirframeFactMetaData.xml
src/AutoPilotPlugins/PX4/AirframeFactMetaData.xml
+2
-2
QGCCameraManager.cc
src/Camera/QGCCameraManager.cc
+4
-2
CameraPageWidget.qml
src/FlightMap/Widgets/CameraPageWidget.qml
+12
-12
BingMapProvider.cpp
src/QtLocationPlugin/BingMapProvider.cpp
+32
-44
BingMapProvider.h
src/QtLocationPlugin/BingMapProvider.h
+34
-42
ElevationMapProvider.cpp
src/QtLocationPlugin/ElevationMapProvider.cpp
+13
-21
ElevationMapProvider.h
src/QtLocationPlugin/ElevationMapProvider.h
+14
-21
EsriMapProvider.cpp
src/QtLocationPlugin/EsriMapProvider.cpp
+33
-43
EsriMapProvider.h
src/QtLocationPlugin/EsriMapProvider.h
+27
-25
GenericMapProvider.cpp
src/QtLocationPlugin/GenericMapProvider.cpp
+54
-82
GenericMapProvider.h
src/QtLocationPlugin/GenericMapProvider.h
+30
-38
GoogleMapProvider.cpp
src/QtLocationPlugin/GoogleMapProvider.cpp
+72
-90
GoogleMapProvider.h
src/QtLocationPlugin/GoogleMapProvider.h
+54
-56
MapProvider.cpp
src/QtLocationPlugin/MapProvider.cpp
+41
-24
MapProvider.h
src/QtLocationPlugin/MapProvider.h
+37
-29
MapboxMapProvider.cpp
src/QtLocationPlugin/MapboxMapProvider.cpp
+11
-25
MapboxMapProvider.h
src/QtLocationPlugin/MapboxMapProvider.h
+75
-58
patch
src/Terrain/patch
+0
-54
No files found.
src/AutoPilotPlugins/PX4/AirframeFactMetaData.xml
View file @
598d1464
...
...
@@ -430,9 +430,9 @@
<maintainer>
Henry Zhang
<
zhanghui629@gmail.com
>
</maintainer>
<type>
Quadrotor x
</type>
</airframe>
<airframe
id=
"4250"
maintainer=
"
Jacob Dahl <jacob.dahl
@tealdrones.com>"
name=
"Teal One"
>
<airframe
id=
"4250"
maintainer=
"
Matt McFadden <matt.mcfadden
@tealdrones.com>"
name=
"Teal One"
>
<class>
Copter
</class>
<maintainer>
Jacob Dahl
<
jacob.dahl
@tealdrones.com
>
</maintainer>
<maintainer>
Matt McFadden
<
matt.mcfadden
@tealdrones.com
>
</maintainer>
<type>
Quadrotor x
</type>
<output
name=
"MAIN1"
>
motor 1
</output>
<output
name=
"MAIN2"
>
motor 2
</output>
...
...
src/Camera/QGCCameraManager.cc
View file @
598d1464
...
...
@@ -110,8 +110,10 @@ QGCCameraManager::_handleHeartbeat(const mavlink_message_t &message)
{
mavlink_heartbeat_t
heartbeat
;
mavlink_msg_heartbeat_decode
(
&
message
,
&
heartbeat
);
//-- Only pay attention to "camera" component IDs
if
(
_vehicleReadyState
&&
_vehicle
->
id
()
==
message
.
sysid
&&
message
.
compid
>=
MAV_COMP_ID_CAMERA
&&
message
.
compid
<=
MAV_COMP_ID_CAMERA6
)
{
//-- Only pay attention to camera components, as identified by their MAV_TYPE, and as fallback by their compId
if
(
_vehicleReadyState
&&
_vehicle
->
id
()
==
message
.
sysid
&&
((
heartbeat
.
autopilot
==
MAV_AUTOPILOT_INVALID
&&
heartbeat
.
type
==
MAV_TYPE_CAMERA
)
||
(
message
.
compid
>=
MAV_COMP_ID_CAMERA
&&
message
.
compid
<=
MAV_COMP_ID_CAMERA6
)))
{
//-- First time hearing from this one?
QString
sCompID
=
QString
::
number
(
message
.
compid
);
if
(
!
_cameraInfoRequest
.
contains
(
sCompID
))
{
...
...
src/FlightMap/Widgets/CameraPageWidget.qml
View file @
598d1464
...
...
@@ -32,23 +32,23 @@ Column {
property
var
_dynamicCameras
:
activeVehicle
?
activeVehicle
.
dynamicCameras
:
null
property
bool
_isCamera
:
_dynamicCameras
?
_dynamicCameras
.
cameras
.
count
>
0
:
false
property
int
_curCameraIndex
:
_dynamicCameras
?
_dynamicCameras
.
currentCamera
:
0
property
var
_camera
:
_isCamera
?
(
_dynamicCameras
.
cameras
.
get
(
_curCameraIndex
)
&&
_dynamicCameras
.
cameras
.
get
(
_curCameraIndex
).
paramComplete
?
_dynamicCameras
.
cameras
.
get
(
_curCameraIndex
)
:
null
)
:
null
property
bool
_cameraModeUndefined
:
_camera
?
_dynamicCameras
.
cameras
.
get
(
_curCameraIndex
).
cameraMode
===
QGCCameraControl
.
CAMERA_MODE_UNDEFINED
:
true
property
bool
_cameraVideoMode
:
_camera
?
_dynamicCameras
.
cameras
.
get
(
_curCameraIndex
).
cameraMode
===
1
:
false
property
bool
_cameraPhotoMode
:
_camera
?
_dynamicCameras
.
cameras
.
get
(
_curCameraIndex
).
cameraMode
===
0
:
false
property
bool
_cameraPhotoIdle
:
_camera
&&
_camera
.
photoStatus
===
QGCCameraControl
.
PHOTO_CAPTURE_IDLE
property
bool
_cameraModeUndefined
:
_camera
?
_camera
.
cameraMode
===
QGCCameraControl
.
CAM_MODE_UNDEFINED
:
true
property
bool
_cameraVideoMode
:
_camera
?
_camera
.
cameraMode
===
QGCCameraControl
.
CAM_MODE_VIDEO
:
false
property
bool
_cameraPhotoMode
:
_camera
?
_camera
.
cameraMode
===
QGCCameraControl
.
CAM_MODE_PHOTO
:
false
property
bool
_cameraElapsedMode
:
_camera
&&
_camera
.
cameraMode
===
QGCCameraControl
.
CAM_MODE_PHOTO
&&
_camera
.
photoMode
===
QGCCameraControl
.
PHOTO_CAPTURE_TIMELAPSE
property
real
_spacers
:
ScreenTools
.
defaultFontPixelHeight
*
0.5
property
real
_labelFieldWidth
:
ScreenTools
.
defaultFontPixelWidth
*
30
property
real
_editFieldWidth
:
ScreenTools
.
defaultFontPixelWidth
*
30
property
bool
_communicationLost
:
activeVehicle
?
activeVehicle
.
connectionLost
:
false
property
bool
_hasModes
:
_camera
&&
_camera
&&
_camera
.
hasModes
property
bool
_hasModes
:
_camera
&&
_camera
.
hasModes
property
bool
_videoRecording
:
_camera
&&
_camera
.
videoStatus
===
QGCCameraControl
.
VIDEO_CAPTURE_STATUS_RUNNING
property
bool
_photoIdle
:
_camera
&&
_camera
.
photoStatus
===
QGCCameraControl
.
PHOTO_CAPTURE_IDLE
property
bool
_storageReady
:
_camera
&&
_camera
.
storageStatus
===
QGCCameraControl
.
STORAGE_READY
property
bool
_batteryReady
:
_camera
&&
_camera
.
batteryRemaining
>=
0
property
bool
_storageIgnored
:
_camera
&&
_camera
.
storageStatus
===
QGCCameraControl
.
STORAGE_NOT_SUPPORTED
property
bool
_canShoot
:
!
_videoRecording
&&
_cameraPhotoIdle
&&
((
_storageReady
&&
_camera
.
storageFree
>
0
)
||
_storageIgnored
)
property
int
_curCameraIndex
:
_dynamicCameras
?
_dynamicCameras
.
currentCamera
:
0
property
bool
_canShoot
:
!
_cameraModeUndefined
&&
!
_videoRecording
&&
_photoIdle
&&
((
_storageReady
&&
_camera
.
storageFree
>
0
)
||
_storageIgnored
)
function
showSettings
()
{
mainWindow
.
showComponentDialog
(
cameraSettings
,
_cameraVideoMode
?
qsTr
(
"
Video Settings
"
)
:
qsTr
(
"
Camera Settings
"
),
70
,
StandardButton
.
Ok
)
...
...
@@ -161,20 +161,20 @@ Column {
border.width
:
3
anchors.horizontalCenter
:
parent
.
horizontalCenter
Rectangle
{
width
:
parent
.
width
*
(
_videoRecording
||
(
_cameraPhotoMode
&&
!
_
cameraP
hotoIdle
&&
_cameraElapsedMode
)
?
0.5
:
0.75
)
width
:
parent
.
width
*
(
_videoRecording
||
(
_cameraPhotoMode
&&
!
_
p
hotoIdle
&&
_cameraElapsedMode
)
?
0.5
:
0.75
)
height
:
width
radius
:
_videoRecording
||
(
_cameraPhotoMode
&&
!
_
cameraP
hotoIdle
&&
_cameraElapsedMode
)
?
0
:
width
*
0.5
color
:
(
_cameraModeUndefined
||
!
_canShoot
)
?
qgcPal
.
colorGrey
:
qgcPal
.
colorRed
radius
:
_videoRecording
||
(
_cameraPhotoMode
&&
!
_
p
hotoIdle
&&
_cameraElapsedMode
)
?
0
:
width
*
0.5
color
:
_canShoot
?
qgcPal
.
colorRed
:
qgcPal
.
colorGrey
anchors.centerIn
:
parent
}
MouseArea
{
anchors.fill
:
parent
enabled
:
!
_cameraModeUndefined
&&
_canShoot
enabled
:
_canShoot
onClicked
:
{
if
(
_cameraVideoMode
)
{
_camera
.
toggleVideo
()
}
else
{
if
(
_cameraPhotoMode
&&
!
_
cameraP
hotoIdle
&&
_cameraElapsedMode
)
{
if
(
_cameraPhotoMode
&&
!
_
p
hotoIdle
&&
_cameraElapsedMode
)
{
_camera
.
stopTakePhoto
()
}
else
{
_camera
.
takePhoto
()
...
...
src/QtLocationPlugin/BingMapProvider.cpp
View file @
598d1464
/****************************************************************************
*
* (c) 2009-2019 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
* QGroundControl is licensed according to the terms in the file
* COPYING.md in the root of the source code directory.
*
****************************************************************************/
#include "BingMapProvider.h"
#if defined(DEBUG_GOOGLE_MAPS)
#include <QFile>
#include <QStandardPaths>
#endif
#include "QGCMapEngine.h"
BingMapProvider
::
BingMapProvider
(
QString
imageFormat
,
quint32
averageSize
,
QGeoMapType
::
MapStyle
mapType
,
QObject
*
parent
)
:
MapProvider
(
QString
(
"https://www.bing.com/maps/"
),
imageFormat
,
averageSize
,
mapType
,
parent
)
{}
BingMapProvider
::~
BingMapProvider
()
{}
QString
BingRoadMapProvider
::
_getURL
(
int
x
,
int
y
,
int
zoom
,
QNetworkAccessManager
*
networkManager
)
{
Q_UNUSED
(
networkManager
);
QString
key
=
_tileXYToQuadKey
(
x
,
y
,
zoom
);
return
QString
(
"http://ecn.t%1.tiles.virtualearth.net/tiles/"
"r%2.png?g=%3&mkt=%4"
)
.
arg
(
_getServerNum
(
x
,
y
,
4
))
.
arg
(
key
)
.
arg
(
_versionBingMaps
)
.
arg
(
_language
);
BingMapProvider
::
BingMapProvider
(
const
QString
&
imageFormat
,
const
quint32
averageSize
,
const
QGeoMapType
::
MapStyle
mapType
,
QObject
*
parent
)
:
MapProvider
(
QStringLiteral
(
"https://www.bing.com/maps/"
),
imageFormat
,
averageSize
,
mapType
,
parent
)
{}
static
const
QString
RoadMapUrl
=
QStringLiteral
(
"http://ecn.t%1.tiles.virtualearth.net/tiles/r%2.png?g=%3&mkt=%4"
);
QString
BingRoadMapProvider
::
_getURL
(
const
int
x
,
const
int
y
,
const
int
zoom
,
QNetworkAccessManager
*
networkManager
)
{
Q_UNUSED
(
networkManager
)
const
QString
key
=
_tileXYToQuadKey
(
x
,
y
,
zoom
);
return
RoadMapUrl
.
arg
(
QString
::
number
(
_getServerNum
(
x
,
y
,
4
)),
key
,
_versionBingMaps
,
_language
);
}
QString
BingSatelliteMapProvider
::
_getURL
(
int
x
,
int
y
,
int
zoom
,
QNetworkAccessManager
*
networkManager
)
{
Q_UNUSED
(
networkManager
);
QString
key
=
_tileXYToQuadKey
(
x
,
y
,
zoom
);
return
QString
(
"http://ecn.t%1.tiles.virtualearth.net/tiles/"
"a%2.jpeg?g=%3&mkt=%4"
)
.
arg
(
_getServerNum
(
x
,
y
,
4
))
.
arg
(
key
)
.
arg
(
_versionBingMaps
)
.
arg
(
_language
);
static
const
QString
SatteliteMapUrl
=
QStringLiteral
(
"http://ecn.t%1.tiles.virtualearth.net/tiles/a%2.jpeg?g=%3&mkt=%4"
);
QString
BingSatelliteMapProvider
::
_getURL
(
const
int
x
,
const
int
y
,
const
int
zoom
,
QNetworkAccessManager
*
networkManager
)
{
Q_UNUSED
(
networkManager
)
const
QString
key
=
_tileXYToQuadKey
(
x
,
y
,
zoom
);
return
SatteliteMapUrl
.
arg
(
QString
::
number
(
_getServerNum
(
x
,
y
,
4
))
,
key
,
_versionBingMaps
,
_language
);
}
QString
BingHybridMapProvider
::
_getURL
(
int
x
,
int
y
,
int
zoom
,
QNetworkAccessManager
*
networkManager
)
{
Q_UNUSED
(
networkManager
);
QString
key
=
_tileXYToQuadKey
(
x
,
y
,
zoom
);
return
QString
(
"http://ecn.t%1.tiles.virtualearth.net/tiles/"
"h%2.jpeg?g=%3&mkt=%4"
)
.
arg
(
_getServerNum
(
x
,
y
,
4
))
.
arg
(
key
)
.
arg
(
_versionBingMaps
)
.
arg
(
_language
);
static
const
QString
HybridMapUrl
=
QStringLiteral
(
"http://ecn.t%1.tiles.virtualearth.net/tiles/h%2.jpeg?g=%3&mkt=%4"
);
QString
BingHybridMapProvider
::
_getURL
(
const
int
x
,
const
int
y
,
const
int
zoom
,
QNetworkAccessManager
*
networkManager
)
{
Q_UNUSED
(
networkManager
)
const
QString
key
=
_tileXYToQuadKey
(
x
,
y
,
zoom
);
return
HybridMapUrl
.
arg
(
QString
::
number
(
_getServerNum
(
x
,
y
,
4
)),
key
,
_versionBingMaps
,
_language
);
}
src/QtLocationPlugin/BingMapProvider.h
View file @
598d1464
/****************************************************************************
*
* (c) 2009-2019 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
* QGroundControl is licensed according to the terms in the file
* COPYING.md in the root of the source code directory.
*
****************************************************************************/
#pragma once
#include "MapProvider.h"
#include <QByteArray>
#include <QMutex>
#include <QNetworkProxy>
#include <QNetworkReply>
#include <QPoint>
#include <QString>
class
BingMapProvider
:
public
MapProvider
{
Q_OBJECT
public:
BingMapProvider
(
QString
imageFormat
,
quint32
averageSize
,
QGeoMapType
::
MapStyle
mapType
,
QObject
*
parent
);
~
BingMapProvider
();
public:
BingMapProvider
(
const
QString
&
imageFormat
,
const
quint32
averageSize
,
const
QGeoMapType
::
MapStyle
mapType
,
QObject
*
parent
=
nullptr
);
protected:
// Define the url to Request
virtual
QString
_getURL
(
int
x
,
int
y
,
int
zoom
,
QNetworkAccessManager
*
networkManager
)
=
0
;
~
BingMapProvider
()
=
default
;
const
QString
_versionBingMaps
=
"563"
;
protected:
const
QString
_versionBingMaps
=
QStringLiteral
(
"563"
);
};
const
quint32
AVERAGE_BING_STREET_MAP
=
1297
;
const
quint32
AVERAGE_BING_SAT_MAP
=
19597
;
static
const
quint32
AVERAGE_BING_STREET_MAP
=
1297
;
static
const
quint32
AVERAGE_BING_SAT_MAP
=
19597
;
// -----------------------------------------------------------
// Bing Road Map
class
BingRoadMapProvider
:
public
BingMapProvider
{
Q_OBJECT
public:
BingRoadMapProvider
(
QObject
*
parent
)
:
BingMapProvider
(
QString
(
"png"
),
AVERAGE_BING_STREET_MAP
,
QGeoMapType
::
StreetMap
,
parent
)
{}
protected:
QString
_getURL
(
int
x
,
int
y
,
int
zoom
,
QNetworkAccessManager
*
networkManager
);
public:
BingRoadMapProvider
(
QObject
*
parent
=
nullptr
)
:
BingMapProvider
(
QStringLiteral
(
"png"
),
AVERAGE_BING_STREET_MAP
,
QGeoMapType
::
StreetMap
,
parent
)
{}
QString
_getURL
(
const
int
x
,
const
int
y
,
const
int
zoom
,
QNetworkAccessManager
*
networkManager
)
override
;
};
// -----------------------------------------------------------
...
...
@@ -48,14 +45,12 @@ class BingRoadMapProvider : public BingMapProvider {
class
BingSatelliteMapProvider
:
public
BingMapProvider
{
Q_OBJECT
public:
BingSatelliteMapProvider
(
QObject
*
parent
)
:
BingMapProvider
(
QString
(
"jpg"
),
AVERAGE_BING_SAT_MAP
,
QGeoMapType
::
SatelliteMapDay
,
parent
)
{}
protected:
QString
_getURL
(
int
x
,
int
y
,
int
zoom
,
QNetworkAccessManager
*
networkManager
);
public:
BingSatelliteMapProvider
(
QObject
*
parent
=
nullptr
)
:
BingMapProvider
(
QStringLiteral
(
"jpg"
),
AVERAGE_BING_SAT_MAP
,
QGeoMapType
::
SatelliteMapDay
,
parent
)
{}
QString
_getURL
(
const
int
x
,
const
int
y
,
const
int
zoom
,
QNetworkAccessManager
*
networkManager
)
override
;
};
// -----------------------------------------------------------
...
...
@@ -63,12 +58,9 @@ class BingSatelliteMapProvider : public BingMapProvider {
class
BingHybridMapProvider
:
public
BingMapProvider
{
Q_OBJECT
public:
BingHybridMapProvider
(
QObject
*
parent
)
:
BingMapProvider
(
QString
(
"jpg"
),
AVERAGE_BING_SAT_MAP
,
QGeoMapType
::
HybridMap
,
parent
)
{}
protected:
QString
_getURL
(
int
x
,
int
y
,
int
zoom
,
QNetworkAccessManager
*
networkManager
);
public:
BingHybridMapProvider
(
QObject
*
parent
=
nullptr
)
:
BingMapProvider
(
QStringLiteral
(
"jpg"
),
AVERAGE_BING_SAT_MAP
,
QGeoMapType
::
HybridMap
,
parent
)
{}
QString
_getURL
(
const
int
x
,
const
int
y
,
const
int
zoom
,
QNetworkAccessManager
*
networkManager
)
override
;
};
src/QtLocationPlugin/ElevationMapProvider.cpp
View file @
598d1464
...
...
@@ -5,42 +5,34 @@
#endif
#include "QGCMapEngine.h"
ElevationProvider
::
ElevationProvider
(
QString
imageFormat
,
quint32
averageSize
,
QGeoMapType
::
MapStyle
mapType
,
QObject
*
parent
)
:
MapProvider
(
QString
(
"https://api.airmap.com/"
),
imageFormat
,
averageSize
,
mapType
,
parent
)
{}
ElevationProvider
::~
ElevationProvider
()
{}
ElevationProvider
::
ElevationProvider
(
const
QString
&
imageFormat
,
quint32
averageSize
,
QGeoMapType
::
MapStyle
mapType
,
QObject
*
parent
)
:
MapProvider
(
QStringLiteral
(
"https://api.airmap.com/"
),
imageFormat
,
averageSize
,
mapType
,
parent
)
{}
//-----------------------------------------------------------------------------
int
AirmapElevationProvider
::
long2tileX
(
double
lon
,
int
z
)
{
Q_UNUSED
(
z
)
;
int
AirmapElevationProvider
::
long2tileX
(
const
double
lon
,
const
int
z
)
const
{
Q_UNUSED
(
z
)
return
static_cast
<
int
>
(
floor
((
lon
+
180.0
)
/
srtm1TileSize
));
}
//-----------------------------------------------------------------------------
int
AirmapElevationProvider
::
lat2tileY
(
double
lat
,
int
z
)
{
Q_UNUSED
(
z
)
;
int
AirmapElevationProvider
::
lat2tileY
(
const
double
lat
,
const
int
z
)
const
{
Q_UNUSED
(
z
)
return
static_cast
<
int
>
(
floor
((
lat
+
90.0
)
/
srtm1TileSize
));
}
QString
AirmapElevationProvider
::
_getURL
(
int
x
,
int
y
,
int
zoom
,
QNetworkAccessManager
*
networkManager
)
{
Q_UNUSED
(
networkManager
);
Q_UNUSED
(
zoom
);
return
QString
(
"https://api.airmap.com/elevation/v1/ele/"
"carpet?points=%1,%2,%3,%4"
)
QString
AirmapElevationProvider
::
_getURL
(
const
int
x
,
const
int
y
,
const
int
zoom
,
QNetworkAccessManager
*
networkManager
)
{
Q_UNUSED
(
networkManager
)
Q_UNUSED
(
zoom
)
return
QString
(
"https://api.airmap.com/elevation/v1/ele/carpet?points=%1,%2,%3,%4"
)
.
arg
(
static_cast
<
double
>
(
y
)
*
srtm1TileSize
-
90.0
)
.
arg
(
static_cast
<
double
>
(
x
)
*
srtm1TileSize
-
180.0
)
.
arg
(
static_cast
<
double
>
(
y
+
1
)
*
srtm1TileSize
-
90.0
)
.
arg
(
static_cast
<
double
>
(
x
+
1
)
*
srtm1TileSize
-
180.0
);
}
QGCTileSet
AirmapElevationProvider
::
getTileCount
(
int
zoom
,
double
topleftLon
,
double
topleftLat
,
double
bottomRightLon
,
double
bottomRightLat
)
{
QGCTileSet
AirmapElevationProvider
::
getTileCount
(
const
int
zoom
,
const
double
topleftLon
,
const
double
topleftLat
,
const
double
bottomRightLon
,
const
double
bottomRightLat
)
const
{
QGCTileSet
set
;
set
.
tileX0
=
long2tileX
(
topleftLon
,
zoom
);
set
.
tileY0
=
lat2tileY
(
bottomRightLat
,
zoom
);
...
...
src/QtLocationPlugin/ElevationMapProvider.h
View file @
598d1464
...
...
@@ -10,24 +10,17 @@
#include <QPoint>
#include <QString>
const
quint32
AVERAGE_AIRMAP_ELEV_SIZE
=
2786
;
static
const
quint32
AVERAGE_AIRMAP_ELEV_SIZE
=
2786
;
//-----------------------------------------------------------------------------
const
double
srtm1TileSize
=
0
.
01
;
static
const
double
srtm1TileSize
=
0
.
01
;
class
ElevationProvider
:
public
MapProvider
{
Q_OBJECT
public:
ElevationProvider
(
QString
imageFormat
,
quint32
averageSize
,
QGeoMapType
::
MapStyle
mapType
,
QObject
*
parent
);
ElevationProvider
(
const
QString
&
imageFormat
,
quint32
averageSize
,
QGeoMapType
::
MapStyle
mapType
,
QObject
*
parent
=
nullptr
);
~
ElevationProvider
();
bool
_isElevationProvider
(){
return
true
;}
protected:
// Define the url to Request
virtual
QString
_getURL
(
int
x
,
int
y
,
int
zoom
,
QNetworkAccessManager
*
networkManager
)
=
0
;
virtual
bool
_isElevationProvider
()
const
override
{
return
true
;
}
};
// -----------------------------------------------------------
...
...
@@ -36,19 +29,19 @@ class ElevationProvider : public MapProvider {
class
AirmapElevationProvider
:
public
ElevationProvider
{
Q_OBJECT
public:
AirmapElevationProvider
(
QObject
*
parent
)
:
ElevationProvider
(
QString
(
"bin"
),
AVERAGE_AIRMAP_ELEV_SIZE
,
AirmapElevationProvider
(
QObject
*
parent
=
nullptr
)
:
ElevationProvider
(
QString
Literal
(
"bin"
),
AVERAGE_AIRMAP_ELEV_SIZE
,
QGeoMapType
::
StreetMap
,
parent
)
{}
int
long2tileX
(
double
lon
,
int
z
);
int
lat2tileY
(
double
lat
,
int
z
);
QGCTileSet
getTileCount
(
int
zoom
,
double
topleftLon
,
double
topleftLat
,
double
bottomRightLon
,
double
bottomRightLat
);
int
long2tileX
(
const
double
lon
,
const
int
z
)
const
override
;
int
lat2tileY
(
const
double
lat
,
const
int
z
)
const
override
;
QGCTileSet
getTileCount
(
const
int
zoom
,
const
double
topleftLon
,
const
double
topleftLat
,
const
double
bottomRightLon
,
const
double
bottomRightLat
)
const
override
;
protected:
QString
_getURL
(
int
x
,
int
y
,
int
zoom
,
QNetworkAccessManager
*
networkManager
);
QString
_getURL
(
const
int
x
,
const
int
y
,
const
int
zoom
,
QNetworkAccessManager
*
networkManager
)
override
;
};
src/QtLocationPlugin/EsriMapProvider.cpp
View file @
598d1464
/****************************************************************************
*
* (c) 2009-2019 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
* QGroundControl is licensed according to the terms in the file
* COPYING.md in the root of the source code directory.
*
****************************************************************************/
#include "EsriMapProvider.h"
#include "QGCApplication.h"
#include "QGCMapEngine.h"
#include "SettingsManager.h"
QNetworkRequest
EsriMapProvider
::
getTileURL
(
int
x
,
int
y
,
int
zoom
,
QNetworkAccessManager
*
networkManager
)
{
EsriMapProvider
::
EsriMapProvider
(
const
quint32
averageSize
,
const
QGeoMapType
::
MapStyle
mapType
,
QObject
*
parent
)
:
MapProvider
(
QString
(),
QString
(),
averageSize
,
mapType
,
parent
)
{}
QNetworkRequest
EsriMapProvider
::
getTileURL
(
const
int
x
,
const
int
y
,
const
int
zoom
,
QNetworkAccessManager
*
networkManager
)
{
//-- Build URL
QNetworkRequest
request
;
QString
url
=
_getURL
(
x
,
y
,
zoom
,
networkManager
);
const
QString
url
=
_getURL
(
x
,
y
,
zoom
,
networkManager
);
if
(
url
.
isEmpty
())
{
return
request
;
}
request
.
setUrl
(
QUrl
(
url
));
request
.
setRawHeader
(
"Accept"
,
"*/*"
);
QByteArray
token
=
qgcApp
()
->
toolbox
()
->
settingsManager
()
->
appSettings
()
->
esriToken
()
->
rawValue
()
.
toString
()
.
toLatin1
();
request
.
setRawHeader
(
"User-Agent"
,
QByteArrayLiteral
(
"Qt Location based application"
));
request
.
setRawHeader
(
"User-Token"
,
token
);
request
.
setRawHeader
(
QByteArrayLiteral
(
"Accept"
),
QByteArrayLiteral
(
"*/*"
));
const
QByteArray
token
=
qgcApp
()
->
toolbox
()
->
settingsManager
()
->
appSettings
()
->
esriToken
()
->
rawValue
().
toString
().
toLatin1
();
request
.
setRawHeader
(
QByteArrayLiteral
(
"User-Agent"
),
QByteArrayLiteral
(
"Qt Location based application"
));
request
.
setRawHeader
(
QByteArrayLiteral
(
"User-Token"
),
token
);
return
request
;
}
QString
EsriWorldStreetMapProvider
::
_getURL
(
int
x
,
int
y
,
int
zoom
,
QNetworkAccessManager
*
networkManager
)
{
Q_UNUSED
(
networkManager
);
return
QString
(
"http://services.arcgisonline.com/ArcGIS/rest/services/"
"World_Street_Map/MapServer/tile/%1/%2/%3"
)
.
arg
(
zoom
)
.
arg
(
y
)
.
arg
(
x
);
static
const
QString
WorldStreetMapUrl
=
QStringLiteral
(
"http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/%1/%2/%3"
);
QString
EsriWorldStreetMapProvider
::
_getURL
(
const
int
x
,
const
int
y
,
const
int
zoom
,
QNetworkAccessManager
*
networkManager
)
{
Q_UNUSED
(
networkManager
)
return
WorldStreetMapUrl
.
arg
(
zoom
).
arg
(
y
).
arg
(
x
);
}
QString
EsriWorldSatelliteMapProvider
::
_getURL
(
int
x
,
int
y
,
int
zoom
,
QNetworkAccessManager
*
networkManager
)
{
Q_UNUSED
(
networkManager
);
return
QString
(
"http://server.arcgisonline.com/ArcGIS/rest/"
"services/World_Imagery/MapServer/tile/%1/%2/%3"
)
.
arg
(
zoom
)
.
arg
(
y
)
.
arg
(
x
);
static
const
QString
WorldSatelliteMapUrl
=
QStringLiteral
(
"http://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/%1/%2/%3"
);
QString
EsriWorldSatelliteMapProvider
::
_getURL
(
const
int
x
,
const
int
y
,
const
int
zoom
,
QNetworkAccessManager
*
networkManager
)
{
Q_UNUSED
(
networkManager
)
return
WorldSatelliteMapUrl
.
arg
(
zoom
).
arg
(
y
).
arg
(
x
);
}
QString
EsriTerrainMapProvider
::
_getURL
(
int
x
,
int
y
,
int
zoom
,
QNetworkAccessManager
*
networkManager
)
{
Q_UNUSED
(
networkManager
);
return
QString
(
"http://server.arcgisonline.com/ArcGIS/rest/services/"
"World_Terrain_Base/MapServer/tile/%1/%2/%3"
)
.
arg
(
zoom
)
.
arg
(
y
)
.
arg
(
x
);
static
const
QString
TerrainMapUrl
=
QStringLiteral
(
"http://server.arcgisonline.com/ArcGIS/rest/services/World_Terrain_Base/MapServer/tile/%1/%2/%3"
);
QString
EsriTerrainMapProvider
::
_getURL
(
const
int
x
,
const
int
y
,
const
int
zoom
,
QNetworkAccessManager
*
networkManager
)
{
Q_UNUSED
(
networkManager
)
return
TerrainMapUrl
.
arg
(
zoom
).
arg
(
y
).
arg
(
x
);
}
src/QtLocationPlugin/EsriMapProvider.h
View file @
598d1464
/****************************************************************************
*
* (c) 2009-2019 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
* QGroundControl is licensed according to the terms in the file
* COPYING.md in the root of the source code directory.
*
****************************************************************************/
#pragma once
#include "MapProvider.h"
#include <QByteArray>
#include <QMutex>
#include <QNetworkProxy>
#include <QNetworkReply>
#include <QPoint>
#include <QString>
class
EsriMapProvider
:
public
MapProvider
{
Q_OBJECT
public:
using
MapProvider
::
MapProvider
;
EsriMapProvider
(
const
quint32
averageSize
,
const
QGeoMapType
::
MapStyle
mapType
,
QObject
*
parent
=
nullptr
)
;
QNetworkRequest
getTileURL
(
int
x
,
int
y
,
int
zoom
,
QNetworkAccessManager
*
networkManager
);
QNetworkRequest
getTileURL
(
const
int
x
,
const
int
y
,
const
int
zoom
,
QNetworkAccessManager
*
networkManager
)
override
;
};
class
EsriWorldStreetMapProvider
:
public
EsriMapProvider
{
Q_OBJECT
public:
EsriWorldStreetMapProvider
(
QObject
*
parent
)
:
EsriMapProvider
(
QString
(
""
),
QString
(
""
),
AVERAGE_TILE_SIZE
,
QGeoMapType
::
StreetMap
,
parent
)
{}
QString
_getURL
(
int
x
,
int
y
,
int
zoom
,
QNetworkAccessManager
*
networkManager
);
EsriWorldStreetMapProvider
(
QObject
*
parent
=
nullptr
)
:
EsriMapProvider
(
AVERAGE_TILE_SIZE
,
QGeoMapType
::
StreetMap
,
parent
)
{}
QString
_getURL
(
const
int
x
,
const
int
y
,
const
int
zoom
,
QNetworkAccessManager
*
networkManager
)
override
;
};
class
EsriWorldSatelliteMapProvider
:
public
EsriMapProvider
{
Q_OBJECT
public:
EsriWorldSatelliteMapProvider
(
QObject
*
parent
)
:
EsriMapProvider
(
QString
(
""
),
QString
(
""
),
AVERAGE_TILE_SIZE
,
QGeoMapType
::
SatelliteMapDay
,
parent
)
{}
QString
_getURL
(
int
x
,
int
y
,
int
zoom
,
QNetworkAccessManager
*
networkManager
);
EsriWorldSatelliteMapProvider
(
QObject
*
parent
=
nullptr
)
:
EsriMapProvider
(
AVERAGE_TILE_SIZE
,
QGeoMapType
::
SatelliteMapDay
,
parent
)
{}
QString
_getURL
(
const
int
x
,
const
int
y
,
const
int
zoom
,
QNetworkAccessManager
*
networkManager
)
override
;
};
class
EsriTerrainMapProvider
:
public
EsriMapProvider
{
Q_OBJECT
public:
EsriTerrainMapProvider
(
QObject
*
parent
)
:
EsriMapProvider
(
QString
(
""
),
QString
(
""
),
AVERAGE_TILE_SIZE
,
QGeoMapType
::
TerrainMap
,
parent
)
{}
QString
_getURL
(
int
x
,
int
y
,
int
zoom
,
QNetworkAccessManager
*
networkManager
);
EsriTerrainMapProvider
(
QObject
*
parent
=
nullptr
)
:
EsriMapProvider
(
AVERAGE_TILE_SIZE
,
QGeoMapType
::
TerrainMap
,
parent
)
{}
QString
_getURL
(
const
int
x
,
const
int
y
,
const
int
zoom
,
QNetworkAccessManager
*
networkManager
)
override
;
};
src/QtLocationPlugin/GenericMapProvider.cpp
View file @
598d1464
/****************************************************************************
*
* (c) 2009-2019 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
* QGroundControl is licensed according to the terms in the file
* COPYING.md in the root of the source code directory.
*
****************************************************************************/
#include "GenericMapProvider.h"
#include "QGCMapEngine.h"
QString
StatkartMapProvider
::
_getURL
(
int
x
,
int
y
,
int
zoom
,
QNetworkAccessManager
*
networkManager
)
{
Q_UNUSED
(
networkManager
);
return
QString
(
"http://opencache.statkart.no/gatekeeper/gk/"
"gk.open_gmaps?layers=topo4&zoom=%1&x=%2&y=%3"
)
.
arg
(
zoom
)
.
arg
(
x
)
.
arg
(
y
);
static
const
QString
StatkartMapUrl
=
QStringLiteral
(
"http://opencache.statkart.no/gatekeeper/gk/gk.open_gmaps?layers=topo4&zoom=%1&x=%2&y=%3"
);
QString
StatkartMapProvider
::
_getURL
(
const
int
x
,
const
int
y
,
const
int
zoom
,
QNetworkAccessManager
*
networkManager
)
{
Q_UNUSED
(
networkManager
)
return
StatkartMapUrl
.
arg
(
zoom
).
arg
(
x
).
arg
(
y
);
}
QString
EniroMapProvider
::
_getURL
(
int
x
,
int
y
,
int
zoom
,
QNetworkAccessManager
*
networkManager
)
{
Q_UNUSED
(
networkManager
);
return
QString
(
"http://map.eniro.com/geowebcache/service/tms1.0.0/map/%1/"
"%2/%3.png"
)
.
arg
(
zoom
)
.
arg
(
x
)
.
arg
((
1
<<
zoom
)
-
1
-
y
);
static
const
QString
EniroMapUrl
=
QStringLiteral
(
"http://map.eniro.com/geowebcache/service/tms1.0.0/map/%1/%2/%3.png"
);
QString
EniroMapProvider
::
_getURL
(
const
int
x
,
const
int
y
,
const
int
zoom
,
QNetworkAccessManager
*
networkManager
)
{
Q_UNUSED
(
networkManager
)
return
EniroMapUrl
.
arg
(
zoom
).
arg
(
x
).
arg
((
1
<<
zoom
)
-
1
-
y
);
}
QString
MapQuestMapMapProvider
::
_getURL
(
int
x
,
int
y
,
int
zoom
,
QNetworkAccessManager
*
networkManager
)
{
Q_UNUSED
(
networkManager
);
char
letter
=
"1234"
[
_getServerNum
(
x
,
y
,
4
)];
return
QString
(
"http://otile%1.mqcdn.com/tiles/1.0.0/map/%2/%3/%4.jpg"
)
.
arg
(
letter
)
.
arg
(
zoom
)
.
arg
(
x
)
.
arg
(
y
);
static
const
QString
MapQuestMapUrl
=
QStringLiteral
(
"http://otile%1.mqcdn.com/tiles/1.0.0/map/%2/%3/%4.jpg"
);
QString
MapQuestMapMapProvider
::
_getURL
(
const
int
x
,
const
int
y
,
const
int
zoom
,
QNetworkAccessManager
*
networkManager
)
{
Q_UNUSED
(
networkManager
)
return
MapQuestMapUrl
.
arg
(
_getServerNum
(
x
,
y
,
4
)).
arg
(
zoom
).
arg
(
x
).
arg
(
y
);
}
QString
MapQuestSatMapProvider
::
_getURL
(
int
x
,
int
y
,
int
zoom
,
QNetworkAccessManager
*
networkManager
)
{
Q_UNUSED
(
networkManager
);
char
letter
=
"1234"
[
_getServerNum
(
x
,
y
,
4
)];
return
QString
(
"http://otile%1.mqcdn.com/tiles/1.0.0/sat/%2/%3/%4.jpg"
)
.
arg
(
letter
)
.
arg
(
zoom
)
.
arg
(
x
)
.
arg
(
y
);
static
const
QString
MapQuestSatUrl
=
QStringLiteral
(
"http://otile%1.mqcdn.com/tiles/1.0.0/sat/%2/%3/%4.jpg"
);
QString
MapQuestSatMapProvider
::
_getURL
(
const
int
x
,
const
int
y
,
const
int
zoom
,
QNetworkAccessManager
*
networkManager
)
{
Q_UNUSED
(
networkManager
)
return
MapQuestSatUrl
.
arg
(
_getServerNum
(
x
,
y
,
4
)).
arg
(
zoom
).
arg
(
x
).
arg
(
y
);
}
QString
VWorldStreetMapProvider
::
_getURL
(
int
x
,
int
y
,
int
zoom
,
QNetworkAccessManager
*
networkManager
)
{
Q_UNUSED
(
networkManager
);
int
gap
=
zoom
-
6
;
int
x_min
=
53
*
pow
(
2
,
gap
);
int
x_max
=
55
*
pow
(
2
,
gap
)
+
(
2
*
gap
-
1
);
int
y_min
=
22
*
pow
(
2
,
gap
);
int
y_max
=
26
*
pow
(
2
,
gap
)
+
(
2
*
gap
-
1
);
QString
VWorldStreetMapProvider
::
_getURL
(
const
int
x
,
const
int
y
,
const
int
zoom
,
QNetworkAccessManager
*
networkManager
)
{
Q_UNUSED
(
networkManager
)
const
int
gap
=
zoom
-
6
;
const
int
x_min
=
int
(
53
*
pow
(
2
,
gap
));
const
int
x_max
=
int
(
55
*
pow
(
2
,
gap
)
+
(
2
*
gap
-
1
));
const
int
y_min
=
int
(
22
*
pow
(
2
,
gap
));
const
int
y_max
=
int
(
26
*
pow
(
2
,
gap
)
+
(
2
*
gap
-
1
));
if
(
zoom
>
19
)
{
return
{};
}
else
if
(
zoom
>
5
&&
x
>=
x_min
&&
x
<=
x_max
&&
y
>=
y_min
&&
y
<=
y_max
)
{
return
QString
(
"http://xdworld.vworld.kr:8080/2d/Base/service/%1/%2/%3.png"
)
.
arg
(
zoom
)
.
arg
(
x
)
.
arg
(
y
);
return
QString
();
}
else
if
(
zoom
>
5
&&
x
>=
x_min
&&
x
<=
x_max
&&
y
>=
y_min
&&
y
<=
y_max
)
{
return
QString
(
QStringLiteral
(
"http://xdworld.vworld.kr:8080/2d/Base/service/%1/%2/%3.png"
)).
arg
(
zoom
,
x
,
y
);
}
else
{
QString
key
=
_tileXYToQuadKey
(
x
,
y
,
zoom
);
return
QString
(
"http://ecn.t%1.tiles.virtualearth.net/tiles/"
"r%2.png?g=%3&mkt=%4"
)
.
arg
(
_getServerNum
(
x
,
y
,
4
))
.
arg
(
key
)
.
arg
(
_versionBingMaps
)
.
arg
(
_language
);
const
QString
key
=
_tileXYToQuadKey
(
x
,
y
,
zoom
);
return
QString
(
QStringLiteral
(
"http://ecn.t%1.tiles.virtualearth.net/tiles/r%2.png?g=%3&mkt=%4"
))
.
arg
(
_getServerNum
(
x
,
y
,
4
)).
arg
(
key
,
_versionBingMaps
,
_language
);
}
}
QString
VWorldSatMapProvider
::
_getURL
(
int
x
,
int
y
,
int
zoom
,
QNetworkAccessManager
*
networkManager
)
{
Q_UNUSED
(
networkManager
);
int
gap
=
zoom
-
6
;
int
x_min
=
53
*
pow
(
2
,
gap
);
int
x_max
=
55
*
pow
(
2
,
gap
)
+
(
2
*
gap
-
1
);
int
y_min
=
22
*
pow
(
2
,
gap
);
int
y_max
=
26
*
pow
(
2
,
gap
)
+
(
2
*
gap
-
1
);
QString
VWorldSatMapProvider
::
_getURL
(
const
int
x
,
const
int
y
,
const
int
zoom
,
QNetworkAccessManager
*
networkManager
)
{
Q_UNUSED
(
networkManager
)
const
int
gap
=
zoom
-
6
;
const
int
x_min
=
int
(
53
*
pow
(
2
,
gap
));
const
int
x_max
=
int
(
55
*
pow
(
2
,
gap
)
+
(
2
*
gap
-
1
));
const
int
y_min
=
int
(
22
*
pow
(
2
,
gap
));
const
int
y_max
=
int
(
26
*
pow
(
2
,
gap
)
+
(
2
*
gap
-
1
));
if
(
zoom
>
19
)
{
return
{};
}
else
if
(
zoom
>
5
&&
x
>=
x_min
&&
x
<=
x_max
&&
y
>=
y_min
&&
y
<=
y_max
)
{
return
QString
(
"http://xdworld.vworld.kr:8080/2d/Satellite/service/%1/"
"%2/%3.jpeg"
)
.
arg
(
zoom
)
.
arg
(
x
)
.
arg
(
y
);
return
QString
();
}
else
if
(
zoom
>
5
&&
x
>=
x_min
&&
x
<=
x_max
&&
y
>=
y_min
&&
y
<=
y_max
)
{
return
QString
(
"http://xdworld.vworld.kr:8080/2d/Satellite/service/%1/%2/%3.jpeg"
).
arg
(
zoom
,
x
,
y
);
}
else
{
QString
key
=
_tileXYToQuadKey
(
x
,
y
,
zoom
);
return
QString
(
"http://ecn.t%1.tiles.virtualearth.net/tiles/"
"a%2.jpeg?g=%3&mkt=%4"
)
.
arg
(
_getServerNum
(
x
,
y
,
4
))
.
arg
(
key
)
.
arg
(
_versionBingMaps
)
.
arg
(
_language
);
const
QString
key
=
_tileXYToQuadKey
(
x
,
y
,
zoom
);
return
QString
(
"http://ecn.t%1.tiles.virtualearth.net/tiles/a%2.jpeg?g=%3&mkt=%4"
)
.
arg
(
_getServerNum
(
x
,
y
,
4
)).
arg
(
key
,
_versionBingMaps
,
_language
);
}
}
src/QtLocationPlugin/GenericMapProvider.h
View file @
598d1464
/****************************************************************************
*
* (c) 2009-2019 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
* QGroundControl is licensed according to the terms in the file
* COPYING.md in the root of the source code directory.
*
****************************************************************************/
#pragma once
#include "MapProvider.h"
#include <cmath>
#include <QByteArray>
#include <QMutex>
#include <QNetworkProxy>
#include <QNetworkReply>
#include <QPoint>
#include <QString>
class
StatkartMapProvider
:
public
MapProvider
{
Q_OBJECT
public:
StatkartMapProvider
(
QObject
*
parent
)
:
MapProvider
(
QString
(
"https://www.norgeskart.no/"
),
QString
(
"png"
),
StatkartMapProvider
(
QObject
*
parent
=
nullptr
)
:
MapProvider
(
QString
Literal
(
"https://www.norgeskart.no/"
),
QStringLiteral
(
"png"
),
AVERAGE_TILE_SIZE
,
QGeoMapType
::
StreetMap
,
parent
)
{}
QString
_getURL
(
int
x
,
int
y
,
int
zoom
,
QNetworkAccessManager
*
networkManager
);
QString
_getURL
(
const
int
x
,
const
int
y
,
const
int
zoom
,
QNetworkAccessManager
*
networkManager
)
override
;
};
class
EniroMapProvider
:
public
MapProvider
{
Q_OBJECT
public:
EniroMapProvider
(
QObject
*
parent
)
:
MapProvider
(
QString
(
"https://www.eniro.se/"
),
QString
(
"png"
),
EniroMapProvider
(
QObject
*
parent
=
nullptr
)
:
MapProvider
(
QString
Literal
(
"https://www.eniro.se/"
),
QStringLiteral
(
"png"
),
AVERAGE_TILE_SIZE
,
QGeoMapType
::
StreetMap
,
parent
)
{}
QString
_getURL
(
int
x
,
int
y
,
int
zoom
,
QNetworkAccessManager
*
networkManager
);
QString
_getURL
(
const
int
x
,
const
int
y
,
const
int
zoom
,
QNetworkAccessManager
*
networkManager
)
override
;
};
class
MapQuestMapMapProvider
:
public
MapProvider
{
Q_OBJECT
public:
MapQuestMapMapProvider
(
QObject
*
parent
)
:
MapProvider
(
QString
(
"https://mapquest.com"
),
QString
(
"jpg"
),
MapQuestMapMapProvider
(
QObject
*
parent
=
nullptr
)
:
MapProvider
(
QString
Literal
(
"https://mapquest.com"
),
QStringLiteral
(
"jpg"
),
AVERAGE_TILE_SIZE
,
QGeoMapType
::
StreetMap
,
parent
)
{}
QString
_getURL
(
int
x
,
int
y
,
int
zoom
,
QNetworkAccessManager
*
networkManager
);
QString
_getURL
(
const
int
x
,
const
int
y
,
const
int
zoom
,
QNetworkAccessManager
*
networkManager
)
override
;
};
class
MapQuestSatMapProvider
:
public
MapProvider
{
Q_OBJECT
public:
MapQuestSatMapProvider
(
QObject
*
parent
)
:
MapProvider
(
QString
(
"https://mapquest.com"
),
QString
(
"jpg"
),
AVERAGE_TILE_SIZE
,
QGeoMapType
::
SatelliteMapDay
,
parent
)
{
}
MapQuestSatMapProvider
(
QObject
*
parent
=
nullptr
)
:
MapProvider
(
QStringLiteral
(
"https://mapquest.com"
),
QStringLiteral
(
"jpg"
),
AVERAGE_TILE_SIZE
,
QGeoMapType
::
SatelliteMapDay
,
parent
)
{}
QString
_getURL
(
int
x
,
int
y
,
int
zoom
,
QNetworkAccessManager
*
networkManager
);
QString
_getURL
(
const
int
x
,
const
int
y
,
const
int
zoom
,
QNetworkAccessManager
*
networkManager
)
override
;
};
class
VWorldStreetMapProvider
:
public
MapProvider
{
Q_OBJECT
public:
VWorldStreetMapProvider
(
QObject
*
parent
)
:
MapProvider
(
QString
(
"www.vworld.kr"
),
QString
(
"png"
),
VWorldStreetMapProvider
(
QObject
*
parent
=
nullptr
)
:
MapProvider
(
QString
Literal
(
"www.vworld.kr"
),
QStringLiteral
(
"png"
),
AVERAGE_TILE_SIZE
,
QGeoMapType
::
StreetMap
,
parent
)
{}
QString
_getURL
(
int
x
,
int
y
,
int
zoom
,
QNetworkAccessManager
*
networkManager
);
QString
_getURL
(
const
int
x
,
const
int
y
,
const
int
zoom
,
QNetworkAccessManager
*
networkManager
)
override
;
private:
const
QString
_versionBingMaps
=
"563"
;
const
QString
_versionBingMaps
=
QStringLiteral
(
"563"
)
;
};
class
VWorldSatMapProvider
:
public
MapProvider
{
Q_OBJECT
public:
VWorldSatMapProvider
(
QObject
*
parent
)
:
MapProvider
(
QString
(
"www.vworld.kr"
),
QString
(
"jpg"
),
AVERAGE_TILE_SIZE
,
QGeoMapType
::
SatelliteMapDay
,
parent
)
{
}
VWorldSatMapProvider
(
QObject
*
parent
=
nullptr
)
:
MapProvider
(
QStringLiteral
(
"www.vworld.kr"
),
QStringLiteral
(
"jpg"
),
AVERAGE_TILE_SIZE
,
QGeoMapType
::
SatelliteMapDay
,
parent
)
{}
QString
_getURL
(
int
x
,
int
y
,
int
zoom
,
QNetworkAccessManager
*
networkManager
);
QString
_getURL
(
const
int
x
,
const
int
y
,
const
int
zoom
,
QNetworkAccessManager
*
networkManager
)
override
;
private:
const
QString
_versionBingMaps
=
"563"
;
const
QString
_versionBingMaps
=
QStringLiteral
(
"563"
)
;
};
src/QtLocationPlugin/GoogleMapProvider.cpp
View file @
598d1464
This diff is collapsed.
Click to expand it.
src/QtLocationPlugin/GoogleMapProvider.h
View file @
598d1464
/****************************************************************************
*
* (c) 2009-2019 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
* QGroundControl is licensed according to the terms in the file
* COPYING.md in the root of the source code directory.
*
****************************************************************************/
#pragma once
#include "MapProvider.h"
#include <QByteArray>
#include <QMutex>
#include <QNetworkProxy>
#include <QNetworkReply>
#include <QPoint>
#include <QString>
#include <QMutex>
class
GoogleMapProvider
:
public
MapProvider
{
Q_OBJECT
public:
GoogleMapProvider
(
QString
imageFormat
,
quint32
averageSize
,
QGeoMapType
::
MapStyle
mapType
,
QObject
*
parent
);
public:
GoogleMapProvider
(
const
QString
&
imageFormat
,
const
quint32
averageSize
,
const
QGeoMapType
::
MapStyle
_mapType
,
QObject
*
parent
=
nullptr
);
~
GoogleMapProvider
();
// Google Specific private slots
private
slots
:
private
slots
:
void
_networkReplyError
(
QNetworkReply
::
NetworkError
error
);
void
_googleVersionCompleted
();
void
_replyDestroyed
();
protected:
// Define the url to Request
virtual
QString
_getURL
(
int
x
,
int
y
,
int
zoom
,
QNetworkAccessManager
*
networkManager
)
=
0
;
protected:
// Google Specific private methods
void
_getSecGoogleWords
(
int
x
,
int
y
,
QString
&
sec1
,
QString
&
sec2
)
;
void
_getSecGoogleWords
(
const
int
x
,
const
int
y
,
QString
&
sec1
,
QString
&
sec2
)
const
;
void
_tryCorrectGoogleVersions
(
QNetworkAccessManager
*
networkManager
);
// Google Specific attributes
...
...
@@ -57,23 +59,22 @@ class GoogleMapProvider : public MapProvider {
// CycleMap,
// CustomMap = 100
const
quint32
AVERAGE_GOOGLE_STREET_MAP
=
4913
;
const
quint32
AVERAGE_GOOGLE_SAT_MAP
=
56887
;
const
quint32
AVERAGE_GOOGLE_TERRAIN_MAP
=
19391
;
static
const
quint32
AVERAGE_GOOGLE_STREET_MAP
=
4913
;
static
const
quint32
AVERAGE_GOOGLE_SAT_MAP
=
56887
;
static
const
quint32
AVERAGE_GOOGLE_TERRAIN_MAP
=
19391
;
// -----------------------------------------------------------
// Google Street Map
class
GoogleStreetMapProvider
:
public
GoogleMapProvider
{
Q_OBJECT
public:
GoogleStreetMapProvider
(
QObject
*
parent
)
:
GoogleMapProvider
(
QString
(
"png"
),
AVERAGE_GOOGLE_STREET_MAP
,
QGeoMapType
::
StreetMap
,
parent
)
{}
protected:
QString
_getURL
(
int
x
,
int
y
,
int
zoom
,
QNetworkAccessManager
*
networkManager
);
public:
GoogleStreetMapProvider
(
QObject
*
parent
=
nullptr
)
:
GoogleMapProvider
(
QStringLiteral
(
"png"
),
AVERAGE_GOOGLE_STREET_MAP
,
QGeoMapType
::
StreetMap
,
parent
)
{}
protected:
QString
_getURL
(
const
int
x
,
const
int
y
,
const
int
zoom
,
QNetworkAccessManager
*
networkManager
)
override
;
};
// -----------------------------------------------------------
...
...
@@ -81,14 +82,14 @@ class GoogleStreetMapProvider : public GoogleMapProvider {
class
GoogleSatelliteMapProvider
:
public
GoogleMapProvider
{
Q_OBJECT
public:
GoogleSatelliteMapProvider
(
QObject
*
parent
)
:
GoogleMapProvider
(
QString
(
"jpg"
),
AVERAGE_GOOGLE_SAT_MAP
,
public:
GoogleSatelliteMapProvider
(
QObject
*
parent
=
nullptr
)
:
GoogleMapProvider
(
QStringLiteral
(
"jpg"
),
AVERAGE_GOOGLE_SAT_MAP
,
QGeoMapType
::
SatelliteMapDay
,
parent
)
{}
protected:
QString
_getURL
(
int
x
,
int
y
,
int
zoom
,
QNetworkAccessManager
*
networkManager
);
protected:
QString
_getURL
(
const
int
x
,
const
int
y
,
const
int
zoom
,
QNetworkAccessManager
*
networkManager
)
override
;
};
// -----------------------------------------------------------
...
...
@@ -96,14 +97,13 @@ class GoogleSatelliteMapProvider : public GoogleMapProvider {
class
GoogleLabelsMapProvider
:
public
GoogleMapProvider
{
Q_OBJECT
public:
GoogleLabelsMapProvider
(
QObject
*
parent
)
:
GoogleMapProvider
(
QString
(
"png"
),
AVERAGE_TILE_SIZE
,
QGeoMapType
::
CustomMap
,
parent
)
{}
protected:
QString
_getURL
(
int
x
,
int
y
,
int
zoom
,
QNetworkAccessManager
*
networkManager
);
public:
GoogleLabelsMapProvider
(
QObject
*
parent
=
nullptr
)
:
GoogleMapProvider
(
QStringLiteral
(
"png"
),
AVERAGE_TILE_SIZE
,
QGeoMapType
::
CustomMap
,
parent
)
{}
protected:
QString
_getURL
(
const
int
x
,
const
int
y
,
const
int
zoom
,
QNetworkAccessManager
*
networkManager
)
override
;
};
// -----------------------------------------------------------
...
...
@@ -111,14 +111,13 @@ class GoogleLabelsMapProvider : public GoogleMapProvider {
class
GoogleTerrainMapProvider
:
public
GoogleMapProvider
{
Q_OBJECT
public:
GoogleTerrainMapProvider
(
QObject
*
parent
)
:
GoogleMapProvider
(
QString
(
"png"
),
AVERAGE_GOOGLE_TERRAIN_MAP
,
QGeoMapType
::
TerrainMap
,
parent
)
{}
protected:
QString
_getURL
(
int
x
,
int
y
,
int
zoom
,
QNetworkAccessManager
*
networkManager
);
public:
GoogleTerrainMapProvider
(
QObject
*
parent
=
nullptr
)
:
GoogleMapProvider
(
QStringLiteral
(
"png"
),
AVERAGE_GOOGLE_TERRAIN_MAP
,
QGeoMapType
::
TerrainMap
,
parent
)
{}
protected:
QString
_getURL
(
const
int
x
,
const
int
y
,
const
int
zoom
,
QNetworkAccessManager
*
networkManager
)
override
;
};
// -----------------------------------------------------------
...
...
@@ -126,12 +125,11 @@ class GoogleTerrainMapProvider : public GoogleMapProvider {
class
GoogleHybridMapProvider
:
public
GoogleMapProvider
{
Q_OBJECT
public:
GoogleHybridMapProvider
(
QObject
*
parent
)
:
GoogleMapProvider
(
QString
(
"png"
),
AVERAGE_GOOGLE_SAT_MAP
,
QGeoMapType
::
HybridMap
,
parent
)
{}
protected:
QString
_getURL
(
int
x
,
int
y
,
int
zoom
,
QNetworkAccessManager
*
networkManager
);
public:
GoogleHybridMapProvider
(
QObject
*
parent
=
nullptr
)
:
GoogleMapProvider
(
QStringLiteral
(
"png"
),
AVERAGE_GOOGLE_SAT_MAP
,
QGeoMapType
::
HybridMap
,
parent
)
{}
protected:
QString
_getURL
(
const
int
x
,
const
int
y
,
const
int
zoom
,
QNetworkAccessManager
*
networkManager
)
override
;
};
src/QtLocationPlugin/MapProvider.cpp
View file @
598d1464
/****************************************************************************
*
* (c) 2009-2019 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
* QGroundControl is licensed according to the terms in the file
* COPYING.md in the root of the source code directory.
*
****************************************************************************/
#include <QNetworkAccessManager>
#include <QNetworkRequest>
#include "MapProvider.h"
MapProvider
::
MapProvider
(
QString
referrer
,
QString
imageFormat
,
quint32
averageSize
,
QGeoMapType
::
MapStyle
mapType
,
QObject
*
parent
)
:
QObject
(
parent
),
_referrer
(
referrer
),
_imageFormat
(
imageFormat
),
_averageSize
(
averageSize
),
_mapType
(
mapType
)
{
QStringList
langs
=
QLocale
::
system
().
uiLanguages
();
MapProvider
::
MapProvider
(
const
QString
&
referrer
,
const
QString
&
imageFormat
,
const
quint32
averageSize
,
const
QGeoMapType
::
MapStyle
mapType
,
QObject
*
parent
)
:
QObject
(
parent
)
,
_referrer
(
referrer
)
,
_imageFormat
(
imageFormat
)
,
_averageSize
(
averageSize
)
,
_mapType
(
mapType
)
{
const
QStringList
langs
=
QLocale
::
system
().
uiLanguages
();
if
(
langs
.
length
()
>
0
)
{
_language
=
langs
[
0
];
}
}
QNetworkRequest
MapProvider
::
getTileURL
(
int
x
,
int
y
,
int
zoom
,
QNetworkAccessManager
*
networkManager
)
{
QNetworkRequest
MapProvider
::
getTileURL
(
const
int
x
,
const
int
y
,
const
int
zoom
,
QNetworkAccessManager
*
networkManager
)
{
//-- Build URL
QNetworkRequest
request
;
QString
url
=
_getURL
(
x
,
y
,
zoom
,
networkManager
);
const
QString
url
=
_getURL
(
x
,
y
,
zoom
,
networkManager
);
if
(
url
.
isEmpty
())
{
return
request
;
}
request
.
setUrl
(
QUrl
(
url
));
request
.
setRawHeader
(
"Accept"
,
"*/*"
);
request
.
setRawHeader
(
"Referrer"
,
_referrer
.
toUtf8
());
request
.
setRawHeader
(
"User-Agent"
,
_userAgent
);
request
.
setRawHeader
(
QByteArrayLiteral
(
"Accept"
),
QByteArrayLiteral
(
"*/*"
)
);
request
.
setRawHeader
(
QByteArrayLiteral
(
"Referrer"
)
,
_referrer
.
toUtf8
());
request
.
setRawHeader
(
QByteArrayLiteral
(
"User-Agent"
)
,
_userAgent
);
return
request
;
}
QString
MapProvider
::
getImageFormat
(
const
QByteArray
&
image
)
{
QString
MapProvider
::
getImageFormat
(
const
QByteArray
&
image
)
const
{
QString
format
;
if
(
image
.
size
()
>
2
)
{
if
(
image
.
startsWith
(
reinterpret_cast
<
const
char
*>
(
pngSignature
)))
format
=
"png"
;
format
=
QStringLiteral
(
"png"
)
;
else
if
(
image
.
startsWith
(
reinterpret_cast
<
const
char
*>
(
jpegSignature
)))
format
=
"jpg"
;
format
=
QStringLiteral
(
"jpg"
)
;
else
if
(
image
.
startsWith
(
reinterpret_cast
<
const
char
*>
(
gifSignature
)))
format
=
"gif"
;
format
=
QStringLiteral
(
"gif"
)
;
else
{
return
_imageFormat
;
}
...
...
@@ -41,11 +56,11 @@ QString MapProvider::getImageFormat(const QByteArray& image) {
return
format
;
}
QString
MapProvider
::
_tileXYToQuadKey
(
int
tileX
,
int
tileY
,
int
levelOfDetail
)
{
QString
MapProvider
::
_tileXYToQuadKey
(
const
int
tileX
,
const
int
tileY
,
const
int
levelOfDetail
)
const
{
QString
quadKey
;
for
(
int
i
=
levelOfDetail
;
i
>
0
;
i
--
)
{
char
digit
=
'0'
;
int
mask
=
1
<<
(
i
-
1
);
const
int
mask
=
1
<<
(
i
-
1
);
if
((
tileX
&
mask
)
!=
0
)
{
digit
++
;
}
...
...
@@ -58,27 +73,29 @@ QString MapProvider::_tileXYToQuadKey(int tileX, int tileY, int levelOfDetail) {
return
quadKey
;
}
int
MapProvider
::
_getServerNum
(
int
x
,
int
y
,
int
max
)
{
int
MapProvider
::
_getServerNum
(
const
int
x
,
const
int
y
,
const
int
max
)
const
{
return
(
x
+
2
*
y
)
%
max
;
}
int
MapProvider
::
long2tileX
(
double
lon
,
int
z
)
{
int
MapProvider
::
long2tileX
(
const
double
lon
,
const
int
z
)
const
{
return
static_cast
<
int
>
(
floor
((
lon
+
180.0
)
/
360.0
*
pow
(
2.0
,
z
)));
}
//-----------------------------------------------------------------------------
int
MapProvider
::
lat2tileY
(
double
lat
,
int
z
)
{
int
MapProvider
::
lat2tileY
(
const
double
lat
,
const
int
z
)
const
{
return
static_cast
<
int
>
(
floor
(
(
1.0
-
log
(
tan
(
lat
*
M_PI
/
180.0
)
+
1.0
/
cos
(
lat
*
M_PI
/
180.0
))
/
M_PI
)
/
2.0
*
pow
(
2.0
,
z
)));
}
bool
MapProvider
::
_isElevationProvider
()
{
return
false
;
}
bool
MapProvider
::
_isElevationProvider
()
const
{
return
false
;
}
QGCTileSet
MapProvider
::
getTileCount
(
int
zoom
,
double
topleftLon
,
double
topleftLat
,
double
bottomRightLon
,
double
bottomRightLat
)
{
QGCTileSet
MapProvider
::
getTileCount
(
const
int
zoom
,
const
double
topleftLon
,
const
double
topleftLat
,
const
double
bottomRightLon
,
const
double
bottomRightLat
)
const
{
QGCTileSet
set
;
set
.
tileX0
=
long2tileX
(
topleftLon
,
zoom
);
set
.
tileY0
=
lat2tileY
(
topleftLat
,
zoom
);
...
...
src/QtLocationPlugin/MapProvider.h
View file @
598d1464
#pragma once
/****************************************************************************
*
* (c) 2009-2019 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
* QGroundControl is licensed according to the terms in the file
* COPYING.md in the root of the source code directory.
*
****************************************************************************/
#include <cmath>
#include "QGCTileSet.h"
#pragma once
#include <QByteArray>
#include <QNetworkProxy>
#include <QNetworkReply>
#include <QString>
#include <cmath>
#include "QGCTileSet.h"
#include <QtLocation/private/qgeomaptype_p.h>
static
const
unsigned
char
pngSignature
[]
=
{
0x89
,
0x50
,
0x4E
,
0x47
,
0x0D
,
0x0A
,
0x1A
,
0x0A
,
0x00
};
static
const
unsigned
char
pngSignature
[]
=
{
0x89
,
0x50
,
0x4E
,
0x47
,
0x0D
,
0x0A
,
0x1A
,
0x0A
,
0x00
};
static
const
unsigned
char
jpegSignature
[]
=
{
0xFF
,
0xD8
,
0xFF
,
0x00
};
static
const
unsigned
char
gifSignature
[]
=
{
0x47
,
0x49
,
0x46
,
0x38
,
0x00
};
const
quint32
AVERAGE_TILE_SIZE
=
13652
;
static
const
quint32
AVERAGE_TILE_SIZE
=
13652
;
class
QNetworkRequest
;
class
QNetworkAccessManager
;
class
MapProvider
:
public
QObject
{
Q_OBJECT
public:
MapProvider
(
QString
referrer
,
QString
imageFormat
,
quint32
averageSize
,
QGeoMapType
::
MapStyle
_mapType
=
QGeoMapType
::
CustomMap
,
QObject
*
parent
=
nullptr
);
QNetworkRequest
getTileURL
(
int
x
,
int
y
,
int
zoom
,
QNetworkAccessManager
*
networkManager
);
public:
MapProvider
(
const
QString
&
referrer
,
const
QString
&
imageFormat
,
const
quint32
averageSize
,
const
QGeoMapType
::
MapStyle
mapType
=
QGeoMapType
::
CustomMap
,
QObject
*
parent
=
nullptr
);
QString
getImageFormat
(
const
QByteArray
&
image
);
virtual
QNetworkRequest
getTileURL
(
const
int
x
,
const
int
y
,
const
int
zoom
,
QNetworkAccessManager
*
networkManager
);
quint32
getAverageSize
(){
return
_averageSize
;}
QString
getImageFormat
(
const
QByteArray
&
image
)
const
;
QGeoMapType
::
MapStyle
getMapStyle
(){
return
_mapType
;
}
quint32
getAverageSize
()
const
{
return
_averageSize
;
}
virtual
int
long2tileX
(
double
lon
,
int
z
);
QGeoMapType
::
MapStyle
getMapStyle
()
{
return
_mapType
;
}
virtual
int
l
at2tileY
(
double
lat
,
int
z
)
;
virtual
int
l
ong2tileX
(
const
double
lon
,
const
int
z
)
const
;
virtual
bool
_isElevationProvider
()
;
virtual
int
lat2tileY
(
const
double
lat
,
const
int
z
)
const
;
virtual
QGCTileSet
getTileCount
(
int
zoom
,
double
topleftLon
,
double
topleftLat
,
double
bottomRightLon
,
double
bottomRightLat
);
virtual
bool
_isElevationProvider
()
const
;
protected:
QString
_tileXYToQuadKey
(
int
tileX
,
int
tileY
,
int
levelOfDetail
);
int
_getServerNum
(
int
x
,
int
y
,
int
max
);
virtual
QGCTileSet
getTileCount
(
const
int
zoom
,
const
double
topleftLon
,
const
double
topleftLat
,
const
double
bottomRightLon
,
const
double
bottomRightLat
)
const
;
protected:
QString
_tileXYToQuadKey
(
const
int
tileX
,
const
int
tileY
,
const
int
levelOfDetail
)
const
;
int
_getServerNum
(
const
int
x
,
const
int
y
,
const
int
max
)
const
;
// Define the url to Request
virtual
QString
_getURL
(
const
int
x
,
const
int
y
,
const
int
zoom
,
QNetworkAccessManager
*
networkManager
)
=
0
;
// Define Referrer for Request RawHeader
QString
_referrer
;
...
...
@@ -54,7 +65,4 @@ class MapProvider : public QObject {
QString
_language
;
QGeoMapType
::
MapStyle
_mapType
;
// Define the url to Request
virtual
QString
_getURL
(
int
x
,
int
y
,
int
zoom
,
QNetworkAccessManager
*
networkManager
)
=
0
;
};
src/QtLocationPlugin/MapboxMapProvider.cpp
View file @
598d1464
...
...
@@ -3,33 +3,19 @@
#include "QGCMapEngine.h"
#include "SettingsManager.h"
MapboxMapProvider
::
MapboxMapProvider
(
QString
mapName
,
quint32
averageSize
,
QGeoMapType
::
MapStyle
mapType
,
QObject
*
parent
)
:
MapProvider
(
QString
(
"https://www.mapbox.com/"
),
QString
(
"jpg"
),
averageSize
,
mapType
,
parent
),
mapboxName
(
mapName
)
{
static
const
QString
MapBoxUrl
=
QStringLiteral
(
"https://api.mapbox.com/v4/%1/%2/%3/%4.jpg80?access_token=%5"
);
MapboxMapProvider
::
MapboxMapProvider
(
const
QString
&
mapName
,
const
quint32
averageSize
,
const
QGeoMapType
::
MapStyle
mapType
,
QObject
*
parent
)
:
MapProvider
(
QStringLiteral
(
"https://www.mapbox.com/"
),
QStringLiteral
(
"jpg"
),
averageSize
,
mapType
,
parent
)
,
_mapboxName
(
mapName
)
{
}
QString
MapboxMapProvider
::
_getURL
(
int
x
,
int
y
,
int
zoom
,
QNetworkAccessManager
*
networkManager
)
{
Q_UNUSED
(
networkManager
);
QString
mapBoxToken
=
qgcApp
()
->
toolbox
()
->
settingsManager
()
->
appSettings
()
->
mapboxToken
()
->
rawValue
()
.
toString
();
QString
MapboxMapProvider
::
_getURL
(
const
int
x
,
const
int
y
,
const
int
zoom
,
QNetworkAccessManager
*
networkManager
)
{
Q_UNUSED
(
networkManager
)
const
QString
mapBoxToken
=
qgcApp
()
->
toolbox
()
->
settingsManager
()
->
appSettings
()
->
mapboxToken
()
->
rawValue
().
toString
();
if
(
!
mapBoxToken
.
isEmpty
())
{
QString
server
=
"https://api.mapbox.com/v4/"
;
server
+=
mapboxName
;
server
+=
QString
(
"/%1/%2/%3.jpg80?access_token=%4"
)
.
arg
(
zoom
)
.
arg
(
x
)
.
arg
(
y
)
.
arg
(
mapBoxToken
);
return
server
;
return
MapBoxUrl
.
arg
(
_mapboxName
).
arg
(
zoom
).
arg
(
x
).
arg
(
y
).
arg
(
mapBoxToken
);
}
return
QString
(
""
);
return
QString
();
}
src/QtLocationPlugin/MapboxMapProvider.h
View file @
598d1464
/****************************************************************************
*
* (c) 2009-2019 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
* QGroundControl is licensed according to the terms in the file
* COPYING.md in the root of the source code directory.
*
****************************************************************************/
#pragma once
#include "MapProvider.h"
#include <QByteArray>
#include <QMutex>
#include <QNetworkProxy>
#include <QNetworkReply>
#include <QPoint>
#include <QString>
const
quint32
AVERAGE_MAPBOX_SAT_MAP
=
15739
;
const
quint32
AVERAGE_MAPBOX_STREET_MAP
=
5648
;
static
const
quint32
AVERAGE_MAPBOX_SAT_MAP
=
15739
;
static
const
quint32
AVERAGE_MAPBOX_STREET_MAP
=
5648
;
class
MapboxMapProvider
:
public
MapProvider
{
Q_OBJECT
public:
MapboxMapProvider
(
QString
mapName
,
quint32
averageSize
,
QGeoMapType
::
MapStyle
mapType
,
QObject
*
parent
);
QString
_getURL
(
int
x
,
int
y
,
int
zoom
,
QNetworkAccessManager
*
networkManager
);
protected:
QString
mapboxName
;
public:
MapboxMapProvider
(
const
QString
&
mapName
,
const
quint32
averageSize
,
const
QGeoMapType
::
MapStyle
mapType
,
QObject
*
parent
=
nullptr
);
protected:
QString
_getURL
(
const
int
x
,
const
int
y
,
const
int
zoom
,
QNetworkAccessManager
*
networkManager
)
override
;
QString
_mapboxName
;
};
class
MapboxStreetMapProvider
:
public
MapboxMapProvider
{
Q_OBJECT
public:
MapboxStreetMapProvider
(
QObject
*
parent
)
:
MapboxMapProvider
(
"mapbox.streets"
,
AVERAGE_MAPBOX_STREET_MAP
,
public:
MapboxStreetMapProvider
(
QObject
*
parent
=
nullptr
)
:
MapboxMapProvider
(
QStringLiteral
(
"mapbox.streets"
),
AVERAGE_MAPBOX_STREET_MAP
,
QGeoMapType
::
StreetMap
,
parent
)
{}
};
class
MapboxLightMapProvider
:
public
MapboxMapProvider
{
Q_OBJECT
public:
MapboxLightMapProvider
(
QObject
*
parent
)
:
MapboxMapProvider
(
"mapbox.light"
,
AVERAGE_TILE_SIZE
,
public:
MapboxLightMapProvider
(
QObject
*
parent
=
nullptr
)
:
MapboxMapProvider
(
QStringLiteral
(
"mapbox.light"
),
AVERAGE_TILE_SIZE
,
QGeoMapType
::
CustomMap
,
parent
)
{}
};
class
MapboxDarkMapProvider
:
public
MapboxMapProvider
{
Q_OBJECT
public:
MapboxDarkMapProvider
(
QObject
*
parent
)
:
MapboxMapProvider
(
"mapbox.dark"
,
AVERAGE_TILE_SIZE
,
public:
MapboxDarkMapProvider
(
QObject
*
parent
=
nullptr
)
:
MapboxMapProvider
(
QStringLiteral
(
"mapbox.dark"
),
AVERAGE_TILE_SIZE
,
QGeoMapType
::
CustomMap
,
parent
)
{}
};
class
MapboxSatelliteMapProvider
:
public
MapboxMapProvider
{
Q_OBJECT
public:
MapboxSatelliteMapProvider
(
QObject
*
parent
)
:
MapboxMapProvider
(
"mapbox.satellite"
,
AVERAGE_MAPBOX_SAT_MAP
,
public:
MapboxSatelliteMapProvider
(
QObject
*
parent
=
nullptr
)
:
MapboxMapProvider
(
QStringLiteral
(
"mapbox.satellite"
),
AVERAGE_MAPBOX_SAT_MAP
,
QGeoMapType
::
SatelliteMapDay
,
parent
)
{}
};
class
MapboxHybridMapProvider
:
public
MapboxMapProvider
{
Q_OBJECT
public:
MapboxHybridMapProvider
(
QObject
*
parent
)
:
MapboxMapProvider
(
"mapbox.hybrid"
,
AVERAGE_MAPBOX_SAT_MAP
,
public:
MapboxHybridMapProvider
(
QObject
*
parent
=
nullptr
)
:
MapboxMapProvider
(
QStringLiteral
(
"mapbox.hybrid"
),
AVERAGE_MAPBOX_SAT_MAP
,
QGeoMapType
::
HybridMap
,
parent
)
{}
};
class
MapboxWheatPasteMapProvider
:
public
MapboxMapProvider
{
Q_OBJECT
public:
MapboxWheatPasteMapProvider
(
QObject
*
parent
)
:
MapboxMapProvider
(
"mapbox.wheatpaste"
,
AVERAGE_TILE_SIZE
,
public:
MapboxWheatPasteMapProvider
(
QObject
*
parent
=
nullptr
)
:
MapboxMapProvider
(
QStringLiteral
(
"mapbox.wheatpaste"
),
AVERAGE_TILE_SIZE
,
QGeoMapType
::
CustomMap
,
parent
)
{}
};
class
MapboxStreetsBasicMapProvider
:
public
MapboxMapProvider
{
Q_OBJECT
public:
MapboxStreetsBasicMapProvider
(
QObject
*
parent
)
:
MapboxMapProvider
(
"mapbox.streets-basic"
,
AVERAGE_TILE_SIZE
,
public:
MapboxStreetsBasicMapProvider
(
QObject
*
parent
=
nullptr
)
:
MapboxMapProvider
(
QStringLiteral
(
"mapbox.streets-basic"
),
AVERAGE_TILE_SIZE
,
QGeoMapType
::
StreetMap
,
parent
)
{}
};
class
MapboxComicMapProvider
:
public
MapboxMapProvider
{
Q_OBJECT
public:
MapboxComicMapProvider
(
QObject
*
parent
)
:
MapboxMapProvider
(
"mapbox.comic"
,
AVERAGE_TILE_SIZE
,
public:
MapboxComicMapProvider
(
QObject
*
parent
=
nullptr
)
:
MapboxMapProvider
(
QStringLiteral
(
"mapbox.comic"
),
AVERAGE_TILE_SIZE
,
QGeoMapType
::
CustomMap
,
parent
)
{}
};
class
MapboxOutdoorsMapProvider
:
public
MapboxMapProvider
{
Q_OBJECT
public:
MapboxOutdoorsMapProvider
(
QObject
*
parent
)
:
MapboxMapProvider
(
"mapbox.outdoors"
,
AVERAGE_TILE_SIZE
,
public:
MapboxOutdoorsMapProvider
(
QObject
*
parent
=
nullptr
)
:
MapboxMapProvider
(
QStringLiteral
(
"mapbox.outdoors"
),
AVERAGE_TILE_SIZE
,
QGeoMapType
::
CustomMap
,
parent
)
{}
};
class
MapboxRunBikeHikeMapProvider
:
public
MapboxMapProvider
{
Q_OBJECT
public:
MapboxRunBikeHikeMapProvider
(
QObject
*
parent
)
:
MapboxMapProvider
(
"mapbox.run-bike-hike"
,
AVERAGE_MAPBOX_STREET_MAP
,
public:
MapboxRunBikeHikeMapProvider
(
QObject
*
parent
=
nullptr
)
:
MapboxMapProvider
(
QStringLiteral
(
"mapbox.run-bike-hike"
),
AVERAGE_MAPBOX_STREET_MAP
,
QGeoMapType
::
CycleMap
,
parent
)
{}
};
class
MapboxPencilMapProvider
:
public
MapboxMapProvider
{
Q_OBJECT
public:
MapboxPencilMapProvider
(
QObject
*
parent
)
:
MapboxMapProvider
(
"mapbox.pencil"
,
AVERAGE_TILE_SIZE
,
public:
MapboxPencilMapProvider
(
QObject
*
parent
=
nullptr
)
:
MapboxMapProvider
(
QStringLiteral
(
"mapbox.pencil"
),
AVERAGE_TILE_SIZE
,
QGeoMapType
::
CustomMap
,
parent
)
{}
};
class
MapboxPiratesMapProvider
:
public
MapboxMapProvider
{
Q_OBJECT
public:
MapboxPiratesMapProvider
(
QObject
*
parent
)
:
MapboxMapProvider
(
"mapbox.pirates"
,
AVERAGE_TILE_SIZE
,
public:
MapboxPiratesMapProvider
(
QObject
*
parent
=
nullptr
)
:
MapboxMapProvider
(
QStringLiteral
(
"mapbox.pirates"
),
AVERAGE_TILE_SIZE
,
QGeoMapType
::
CustomMap
,
parent
)
{}
};
class
MapboxEmeraldMapProvider
:
public
MapboxMapProvider
{
Q_OBJECT
public:
MapboxEmeraldMapProvider
(
QObject
*
parent
)
:
MapboxMapProvider
(
"mapbox.emerald"
,
AVERAGE_TILE_SIZE
,
public:
MapboxEmeraldMapProvider
(
QObject
*
parent
=
nullptr
)
:
MapboxMapProvider
(
QStringLiteral
(
"mapbox.emerald"
),
AVERAGE_TILE_SIZE
,
QGeoMapType
::
CustomMap
,
parent
)
{}
};
class
MapboxHighContrastMapProvider
:
public
MapboxMapProvider
{
Q_OBJECT
public:
MapboxHighContrastMapProvider
(
QObject
*
parent
)
:
MapboxMapProvider
(
"mapbox.high-contrast"
,
AVERAGE_TILE_SIZE
,
public:
MapboxHighContrastMapProvider
(
QObject
*
parent
=
nullptr
)
:
MapboxMapProvider
(
QStringLiteral
(
"mapbox.high-contrast"
),
AVERAGE_TILE_SIZE
,
QGeoMapType
::
CustomMap
,
parent
)
{}
};
src/Terrain/patch
deleted
100644 → 0
View file @
8dc2837b
diff --git a/libs/mavlink/include/mavlink/v2.0 b/libs/mavlink/include/mavlink/v2.0
--- a/libs/mavlink/include/mavlink/v2.0
+++ b/libs/mavlink/include/mavlink/v2.0
@@ -1 +1 @@
-Subproject commit 68869da6575d4ca61b92e9081b7c81587f157ed6
+Subproject commit 68869da6575d4ca61b92e9081b7c81587f157ed6-dirty
diff --git a/src/Terrain/TerrainQueryManager.cc b/src/Terrain/TerrainQueryManager.cc
index 59ec2d4..c38a870 100644
--- a/src/Terrain/TerrainQueryManager.cc
+++ b/src/Terrain/TerrainQueryManager.cc
@@ -3,17 +3,20 @@
TerrainQueryManager::TerrainQueryManager(QObject* parent)
: TerrainQueryInterface(parent)
{
- _providerAirMap = new TerrainOfflineAirMapQuery(parent);
+ connect(&_providerAirMap, &TerrainQueryInterface::coordinateHeightsReceived, this, &TerrainQueryInterface::coordinateHeightsReceived);
+ connect(&_providerAirMap, &TerrainQueryInterface::pathHeightsReceived, this, &TerrainQueryInterface::pathHeightsReceived);
+ connect(&_providerAirMap, &TerrainQueryInterface::carpetHeightsReceived, this, &TerrainQueryInterface::carpetHeightsReceived);
}
void TerrainQueryManager::requestCoordinateHeights(const QList<QGeoCoordinate>& coordinates){
- _providerAirMap->requestCoordinateHeights(coordinates);
+ _providerAirMap.requestCoordinateHeights(coordinates);
}
void TerrainQueryManager::requestPathHeights(const QGeoCoordinate& fromCoord, const QGeoCoordinate& toCoord){
- _providerAirMap->requestPathHeights(fromCoord,toCoord);
+ _providerAirMap.requestPathHeights(fromCoord,toCoord);
}
void TerrainQueryManager::requestCarpetHeights(const QGeoCoordinate& swCoord, const QGeoCoordinate& neCoord, bool statsOnly){
- _providerAirMap->requestCarpetHeights(swCoord,neCoord,statsOnly);
+ _providerAirMap.requestCarpetHeights(swCoord,neCoord,statsOnly);
}
+
diff --git a/src/Terrain/TerrainQueryManager.h b/src/Terrain/TerrainQueryManager.h
index 2921679..9b4494c 100644
--- a/src/Terrain/TerrainQueryManager.h
+++ b/src/Terrain/TerrainQueryManager.h
@@ -27,12 +27,12 @@
public:
/// @param neCoord North-East bound of rectangular area to query
/// @param statsOnly true: Return only stats, no carpet data
void requestCarpetHeights(const QGeoCoordinate& swCoord, const QGeoCoordinate& neCoord, bool statsOnly);
-
+
signals:
void coordinateHeightsReceived(bool success, QList<double> heights);
void pathHeightsReceived(bool success, double latStep, double lonStep, const QList<double>& heights);
void carpetHeightsReceived(bool success, double minHeight, double maxHeight, const QList<QList<double>>& carpet);
private:
- TerrainOfflineAirMapQuery * _providerAirMap;
+ TerrainOfflineAirMapQuery _providerAirMap;
};
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