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 @@
...
@@ -430,9 +430,9 @@
<maintainer>
Henry Zhang
<
zhanghui629@gmail.com
>
</maintainer>
<maintainer>
Henry Zhang
<
zhanghui629@gmail.com
>
</maintainer>
<type>
Quadrotor x
</type>
<type>
Quadrotor x
</type>
</airframe>
</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>
<class>
Copter
</class>
<maintainer>
Jacob Dahl
<
jacob.dahl
@tealdrones.com
>
</maintainer>
<maintainer>
Matt McFadden
<
matt.mcfadden
@tealdrones.com
>
</maintainer>
<type>
Quadrotor x
</type>
<type>
Quadrotor x
</type>
<output
name=
"MAIN1"
>
motor 1
</output>
<output
name=
"MAIN1"
>
motor 1
</output>
<output
name=
"MAIN2"
>
motor 2
</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)
...
@@ -110,8 +110,10 @@ QGCCameraManager::_handleHeartbeat(const mavlink_message_t &message)
{
{
mavlink_heartbeat_t
heartbeat
;
mavlink_heartbeat_t
heartbeat
;
mavlink_msg_heartbeat_decode
(
&
message
,
&
heartbeat
);
mavlink_msg_heartbeat_decode
(
&
message
,
&
heartbeat
);
//-- Only pay attention to "camera" component IDs
//-- Only pay attention to camera components, as identified by their MAV_TYPE, and as fallback by their compId
if
(
_vehicleReadyState
&&
_vehicle
->
id
()
==
message
.
sysid
&&
message
.
compid
>=
MAV_COMP_ID_CAMERA
&&
message
.
compid
<=
MAV_COMP_ID_CAMERA6
)
{
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?
//-- First time hearing from this one?
QString
sCompID
=
QString
::
number
(
message
.
compid
);
QString
sCompID
=
QString
::
number
(
message
.
compid
);
if
(
!
_cameraInfoRequest
.
contains
(
sCompID
))
{
if
(
!
_cameraInfoRequest
.
contains
(
sCompID
))
{
...
...
src/FlightMap/Widgets/CameraPageWidget.qml
View file @
598d1464
...
@@ -32,23 +32,23 @@ Column {
...
@@ -32,23 +32,23 @@ Column {
property
var
_dynamicCameras
:
activeVehicle
?
activeVehicle
.
dynamicCameras
:
null
property
var
_dynamicCameras
:
activeVehicle
?
activeVehicle
.
dynamicCameras
:
null
property
bool
_isCamera
:
_dynamicCameras
?
_dynamicCameras
.
cameras
.
count
>
0
:
false
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
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
_cameraModeUndefined
:
_camera
?
_camera
.
cameraMode
===
QGCCameraControl
.
CAM_MODE_UNDEFINED
:
true
property
bool
_cameraVideoMode
:
_camera
?
_dynamicCameras
.
cameras
.
get
(
_curCameraIndex
).
cameraMode
===
1
:
false
property
bool
_cameraVideoMode
:
_camera
?
_camera
.
cameraMode
===
QGCCameraControl
.
CAM_MODE_VIDEO
:
false
property
bool
_cameraPhotoMode
:
_camera
?
_dynamicCameras
.
cameras
.
get
(
_curCameraIndex
).
cameraMode
===
0
:
false
property
bool
_cameraPhotoMode
:
_camera
?
_camera
.
cameraMode
===
QGCCameraControl
.
CAM_MODE_PHOTO
:
false
property
bool
_cameraPhotoIdle
:
_camera
&&
_camera
.
photoStatus
===
QGCCameraControl
.
PHOTO_CAPTURE_IDLE
property
bool
_cameraElapsedMode
:
_camera
&&
_camera
.
cameraMode
===
QGCCameraControl
.
CAM_MODE_PHOTO
&&
_camera
.
photoMode
===
QGCCameraControl
.
PHOTO_CAPTURE_TIMELAPSE
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
_spacers
:
ScreenTools
.
defaultFontPixelHeight
*
0.5
property
real
_labelFieldWidth
:
ScreenTools
.
defaultFontPixelWidth
*
30
property
real
_labelFieldWidth
:
ScreenTools
.
defaultFontPixelWidth
*
30
property
real
_editFieldWidth
:
ScreenTools
.
defaultFontPixelWidth
*
30
property
real
_editFieldWidth
:
ScreenTools
.
defaultFontPixelWidth
*
30
property
bool
_communicationLost
:
activeVehicle
?
activeVehicle
.
connectionLost
:
false
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
_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
_storageReady
:
_camera
&&
_camera
.
storageStatus
===
QGCCameraControl
.
STORAGE_READY
property
bool
_batteryReady
:
_camera
&&
_camera
.
batteryRemaining
>=
0
property
bool
_batteryReady
:
_camera
&&
_camera
.
batteryRemaining
>=
0
property
bool
_storageIgnored
:
_camera
&&
_camera
.
storageStatus
===
QGCCameraControl
.
STORAGE_NOT_SUPPORTED
property
bool
_storageIgnored
:
_camera
&&
_camera
.
storageStatus
===
QGCCameraControl
.
STORAGE_NOT_SUPPORTED
property
bool
_canShoot
:
!
_videoRecording
&&
_cameraPhotoIdle
&&
((
_storageReady
&&
_camera
.
storageFree
>
0
)
||
_storageIgnored
)
property
bool
_canShoot
:
!
_cameraModeUndefined
&&
!
_videoRecording
&&
_photoIdle
&&
((
_storageReady
&&
_camera
.
storageFree
>
0
)
||
_storageIgnored
)
property
int
_curCameraIndex
:
_dynamicCameras
?
_dynamicCameras
.
currentCamera
:
0
function
showSettings
()
{
function
showSettings
()
{
mainWindow
.
showComponentDialog
(
cameraSettings
,
_cameraVideoMode
?
qsTr
(
"
Video Settings
"
)
:
qsTr
(
"
Camera Settings
"
),
70
,
StandardButton
.
Ok
)
mainWindow
.
showComponentDialog
(
cameraSettings
,
_cameraVideoMode
?
qsTr
(
"
Video Settings
"
)
:
qsTr
(
"
Camera Settings
"
),
70
,
StandardButton
.
Ok
)
...
@@ -161,20 +161,20 @@ Column {
...
@@ -161,20 +161,20 @@ Column {
border.width
:
3
border.width
:
3
anchors.horizontalCenter
:
parent
.
horizontalCenter
anchors.horizontalCenter
:
parent
.
horizontalCenter
Rectangle
{
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
height
:
width
radius
:
_videoRecording
||
(
_cameraPhotoMode
&&
!
_
cameraP
hotoIdle
&&
_cameraElapsedMode
)
?
0
:
width
*
0.5
radius
:
_videoRecording
||
(
_cameraPhotoMode
&&
!
_
p
hotoIdle
&&
_cameraElapsedMode
)
?
0
:
width
*
0.5
color
:
(
_cameraModeUndefined
||
!
_canShoot
)
?
qgcPal
.
colorGrey
:
qgcPal
.
colorRed
color
:
_canShoot
?
qgcPal
.
colorRed
:
qgcPal
.
colorGrey
anchors.centerIn
:
parent
anchors.centerIn
:
parent
}
}
MouseArea
{
MouseArea
{
anchors.fill
:
parent
anchors.fill
:
parent
enabled
:
!
_cameraModeUndefined
&&
_canShoot
enabled
:
_canShoot
onClicked
:
{
onClicked
:
{
if
(
_cameraVideoMode
)
{
if
(
_cameraVideoMode
)
{
_camera
.
toggleVideo
()
_camera
.
toggleVideo
()
}
else
{
}
else
{
if
(
_cameraPhotoMode
&&
!
_
cameraP
hotoIdle
&&
_cameraElapsedMode
)
{
if
(
_cameraPhotoMode
&&
!
_
p
hotoIdle
&&
_cameraElapsedMode
)
{
_camera
.
stopTakePhoto
()
_camera
.
stopTakePhoto
()
}
else
{
}
else
{
_camera
.
takePhoto
()
_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"
#include "BingMapProvider.h"
#if defined(DEBUG_GOOGLE_MAPS)
#include <QFile>
BingMapProvider
::
BingMapProvider
(
const
QString
&
imageFormat
,
const
quint32
averageSize
,
#include <QStandardPaths>
const
QGeoMapType
::
MapStyle
mapType
,
QObject
*
parent
)
#endif
:
MapProvider
(
QStringLiteral
(
"https://www.bing.com/maps/"
),
imageFormat
,
averageSize
,
mapType
,
parent
)
{}
#include "QGCMapEngine.h"
static
const
QString
RoadMapUrl
=
QStringLiteral
(
"http://ecn.t%1.tiles.virtualearth.net/tiles/r%2.png?g=%3&mkt=%4"
);
BingMapProvider
::
BingMapProvider
(
QString
imageFormat
,
quint32
averageSize
,
QGeoMapType
::
MapStyle
mapType
,
QObject
*
parent
)
QString
BingRoadMapProvider
::
_getURL
(
const
int
x
,
const
int
y
,
const
int
zoom
,
QNetworkAccessManager
*
networkManager
)
{
:
MapProvider
(
QString
(
"https://www.bing.com/maps/"
),
imageFormat
,
Q_UNUSED
(
networkManager
)
averageSize
,
mapType
,
parent
)
{}
const
QString
key
=
_tileXYToQuadKey
(
x
,
y
,
zoom
);
return
RoadMapUrl
.
arg
(
QString
::
number
(
_getServerNum
(
x
,
y
,
4
)),
key
,
_versionBingMaps
,
_language
);
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
);
}
}
QString
static
const
QString
SatteliteMapUrl
=
QStringLiteral
(
"http://ecn.t%1.tiles.virtualearth.net/tiles/a%2.jpeg?g=%3&mkt=%4"
);
BingSatelliteMapProvider
::
_getURL
(
int
x
,
int
y
,
int
zoom
,
QNetworkAccessManager
*
networkManager
)
{
QString
BingSatelliteMapProvider
::
_getURL
(
const
int
x
,
const
int
y
,
const
int
zoom
,
QNetworkAccessManager
*
networkManager
)
{
Q_UNUSED
(
networkManager
);
Q_UNUSED
(
networkManager
)
QString
key
=
_tileXYToQuadKey
(
x
,
y
,
zoom
);
const
QString
key
=
_tileXYToQuadKey
(
x
,
y
,
zoom
);
return
QString
(
"http://ecn.t%1.tiles.virtualearth.net/tiles/"
return
SatteliteMapUrl
.
arg
(
QString
::
number
(
_getServerNum
(
x
,
y
,
4
))
,
key
,
_versionBingMaps
,
_language
);
"a%2.jpeg?g=%3&mkt=%4"
)
.
arg
(
_getServerNum
(
x
,
y
,
4
))
.
arg
(
key
)
.
arg
(
_versionBingMaps
)
.
arg
(
_language
);
}
}
QString
BingHybridMapProvider
::
_getURL
(
int
x
,
int
y
,
int
zoom
,
static
const
QString
HybridMapUrl
=
QStringLiteral
(
"http://ecn.t%1.tiles.virtualearth.net/tiles/h%2.jpeg?g=%3&mkt=%4"
);
QNetworkAccessManager
*
networkManager
)
{
Q_UNUSED
(
networkManager
);
QString
BingHybridMapProvider
::
_getURL
(
const
int
x
,
const
int
y
,
const
int
zoom
,
QNetworkAccessManager
*
networkManager
)
{
QString
key
=
_tileXYToQuadKey
(
x
,
y
,
zoom
);
Q_UNUSED
(
networkManager
)
return
QString
(
"http://ecn.t%1.tiles.virtualearth.net/tiles/"
const
QString
key
=
_tileXYToQuadKey
(
x
,
y
,
zoom
);
"h%2.jpeg?g=%3&mkt=%4"
)
return
HybridMapUrl
.
arg
(
QString
::
number
(
_getServerNum
(
x
,
y
,
4
)),
key
,
_versionBingMaps
,
_language
);
.
arg
(
_getServerNum
(
x
,
y
,
4
))
.
arg
(
key
)
.
arg
(
_versionBingMaps
)
.
arg
(
_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
#pragma once
#include "MapProvider.h"
#include "MapProvider.h"
#include <QByteArray>
#include <QMutex>
#include <QNetworkProxy>
#include <QNetworkReply>
#include <QPoint>
#include <QString>
class
BingMapProvider
:
public
MapProvider
{
class
BingMapProvider
:
public
MapProvider
{
Q_OBJECT
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:
~
BingMapProvider
()
=
default
;
// Define the url to Request
virtual
QString
_getURL
(
int
x
,
int
y
,
int
zoom
,
QNetworkAccessManager
*
networkManager
)
=
0
;
const
QString
_versionBingMaps
=
"563"
;
protected:
const
QString
_versionBingMaps
=
QStringLiteral
(
"563"
);
};
};
const
quint32
AVERAGE_BING_STREET_MAP
=
1297
;
static
const
quint32
AVERAGE_BING_STREET_MAP
=
1297
;
const
quint32
AVERAGE_BING_SAT_MAP
=
19597
;
static
const
quint32
AVERAGE_BING_SAT_MAP
=
19597
;
// -----------------------------------------------------------
// -----------------------------------------------------------
// Bing Road Map
// Bing Road Map
class
BingRoadMapProvider
:
public
BingMapProvider
{
class
BingRoadMapProvider
:
public
BingMapProvider
{
Q_OBJECT
Q_OBJECT
public:
BingRoadMapProvider
(
QObject
*
parent
)
public:
:
BingMapProvider
(
QString
(
"png"
),
AVERAGE_BING_STREET_MAP
,
QGeoMapType
::
StreetMap
,
BingRoadMapProvider
(
QObject
*
parent
=
nullptr
)
parent
)
{}
:
BingMapProvider
(
QStringLiteral
(
"png"
),
AVERAGE_BING_STREET_MAP
,
QGeoMapType
::
StreetMap
,
parent
)
{}
protected:
QString
_getURL
(
const
int
x
,
const
int
y
,
const
int
zoom
,
QNetworkAccessManager
*
networkManager
)
override
;
QString
_getURL
(
int
x
,
int
y
,
int
zoom
,
QNetworkAccessManager
*
networkManager
);
};
};
// -----------------------------------------------------------
// -----------------------------------------------------------
...
@@ -48,14 +45,12 @@ class BingRoadMapProvider : public BingMapProvider {
...
@@ -48,14 +45,12 @@ class BingRoadMapProvider : public BingMapProvider {
class
BingSatelliteMapProvider
:
public
BingMapProvider
{
class
BingSatelliteMapProvider
:
public
BingMapProvider
{
Q_OBJECT
Q_OBJECT
public:
BingSatelliteMapProvider
(
QObject
*
parent
)
public:
:
BingMapProvider
(
QString
(
"jpg"
),
AVERAGE_BING_SAT_MAP
,
QGeoMapType
::
SatelliteMapDay
,
BingSatelliteMapProvider
(
QObject
*
parent
=
nullptr
)
parent
)
{}
:
BingMapProvider
(
QStringLiteral
(
"jpg"
),
AVERAGE_BING_SAT_MAP
,
QGeoMapType
::
SatelliteMapDay
,
parent
)
{}
protected:
QString
_getURL
(
const
int
x
,
const
int
y
,
const
int
zoom
,
QNetworkAccessManager
*
networkManager
)
override
;
QString
_getURL
(
int
x
,
int
y
,
int
zoom
,
QNetworkAccessManager
*
networkManager
);
};
};
// -----------------------------------------------------------
// -----------------------------------------------------------
...
@@ -63,12 +58,9 @@ class BingSatelliteMapProvider : public BingMapProvider {
...
@@ -63,12 +58,9 @@ class BingSatelliteMapProvider : public BingMapProvider {
class
BingHybridMapProvider
:
public
BingMapProvider
{
class
BingHybridMapProvider
:
public
BingMapProvider
{
Q_OBJECT
Q_OBJECT
public:
public:
BingHybridMapProvider
(
QObject
*
parent
)
BingHybridMapProvider
(
QObject
*
parent
=
nullptr
)
:
BingMapProvider
(
QString
(
"jpg"
),
AVERAGE_BING_SAT_MAP
,
QGeoMapType
::
HybridMap
,
:
BingMapProvider
(
QStringLiteral
(
"jpg"
),
AVERAGE_BING_SAT_MAP
,
QGeoMapType
::
HybridMap
,
parent
)
{}
parent
)
{}
QString
_getURL
(
const
int
x
,
const
int
y
,
const
int
zoom
,
QNetworkAccessManager
*
networkManager
)
override
;
protected:
QString
_getURL
(
int
x
,
int
y
,
int
zoom
,
QNetworkAccessManager
*
networkManager
);
};
};
src/QtLocationPlugin/ElevationMapProvider.cpp
View file @
598d1464
...
@@ -5,42 +5,34 @@
...
@@ -5,42 +5,34 @@
#endif
#endif
#include "QGCMapEngine.h"
#include "QGCMapEngine.h"
ElevationProvider
::
ElevationProvider
(
QString
imageFormat
,
quint32
averageSize
,
ElevationProvider
::
ElevationProvider
(
const
QString
&
imageFormat
,
quint32
averageSize
,
QGeoMapType
::
MapStyle
mapType
,
QObject
*
parent
)
QGeoMapType
::
MapStyle
mapType
,
:
MapProvider
(
QStringLiteral
(
"https://api.airmap.com/"
),
imageFormat
,
averageSize
,
mapType
,
parent
)
{}
QObject
*
parent
)
:
MapProvider
(
QString
(
"https://api.airmap.com/"
),
imageFormat
,
averageSize
,
mapType
,
parent
)
{}
ElevationProvider
::~
ElevationProvider
()
{}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
int
AirmapElevationProvider
::
long2tileX
(
double
lon
,
int
z
)
{
int
AirmapElevationProvider
::
long2tileX
(
const
double
lon
,
const
int
z
)
const
{
Q_UNUSED
(
z
)
;
Q_UNUSED
(
z
)
return
static_cast
<
int
>
(
floor
((
lon
+
180.0
)
/
srtm1TileSize
));
return
static_cast
<
int
>
(
floor
((
lon
+
180.0
)
/
srtm1TileSize
));
}
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
int
AirmapElevationProvider
::
lat2tileY
(
double
lat
,
int
z
)
{
int
AirmapElevationProvider
::
lat2tileY
(
const
double
lat
,
const
int
z
)
const
{
Q_UNUSED
(
z
)
;
Q_UNUSED
(
z
)
return
static_cast
<
int
>
(
floor
((
lat
+
90.0
)
/
srtm1TileSize
));
return
static_cast
<
int
>
(
floor
((
lat
+
90.0
)
/
srtm1TileSize
));
}
}
QString
QString
AirmapElevationProvider
::
_getURL
(
const
int
x
,
const
int
y
,
const
int
zoom
,
QNetworkAccessManager
*
networkManager
)
{
AirmapElevationProvider
::
_getURL
(
int
x
,
int
y
,
int
zoom
,
Q_UNUSED
(
networkManager
)
QNetworkAccessManager
*
networkManager
)
{
Q_UNUSED
(
zoom
)
Q_UNUSED
(
networkManager
);
return
QString
(
"https://api.airmap.com/elevation/v1/ele/carpet?points=%1,%2,%3,%4"
)
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
>
(
y
)
*
srtm1TileSize
-
90.0
)
.
arg
(
static_cast
<
double
>
(
x
)
*
srtm1TileSize
-
180.0
)
.
arg
(
static_cast
<
double
>
(
x
)
*
srtm1TileSize
-
180.0
)
.
arg
(
static_cast
<
double
>
(
y
+
1
)
*
srtm1TileSize
-
90.0
)
.
arg
(
static_cast
<
double
>
(
y
+
1
)
*
srtm1TileSize
-
90.0
)
.
arg
(
static_cast
<
double
>
(
x
+
1
)
*
srtm1TileSize
-
180.0
);
.
arg
(
static_cast
<
double
>
(
x
+
1
)
*
srtm1TileSize
-
180.0
);
}
}
QGCTileSet
AirmapElevationProvider
::
getTileCount
(
int
zoom
,
double
topleftLon
,
QGCTileSet
AirmapElevationProvider
::
getTileCount
(
const
int
zoom
,
const
double
topleftLon
,
double
topleftLat
,
const
double
topleftLat
,
const
double
bottomRightLon
,
double
bottomRightLon
,
const
double
bottomRightLat
)
const
{
double
bottomRightLat
)
{
QGCTileSet
set
;
QGCTileSet
set
;
set
.
tileX0
=
long2tileX
(
topleftLon
,
zoom
);
set
.
tileX0
=
long2tileX
(
topleftLon
,
zoom
);
set
.
tileY0
=
lat2tileY
(
bottomRightLat
,
zoom
);
set
.
tileY0
=
lat2tileY
(
bottomRightLat
,
zoom
);
...
...
src/QtLocationPlugin/ElevationMapProvider.h
View file @
598d1464
...
@@ -10,24 +10,17 @@
...
@@ -10,24 +10,17 @@
#include <QPoint>
#include <QPoint>
#include <QString>
#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
{
class
ElevationProvider
:
public
MapProvider
{
Q_OBJECT
Q_OBJECT
public:
public:
ElevationProvider
(
QString
imageFormat
,
quint32
averageSize
,
ElevationProvider
(
const
QString
&
imageFormat
,
quint32
averageSize
,
QGeoMapType
::
MapStyle
mapType
,
QObject
*
parent
);
QGeoMapType
::
MapStyle
mapType
,
QObject
*
parent
=
nullptr
);
~
ElevationProvider
();
virtual
bool
_isElevationProvider
()
const
override
{
return
true
;
}
bool
_isElevationProvider
(){
return
true
;}
protected:
// Define the url to Request
virtual
QString
_getURL
(
int
x
,
int
y
,
int
zoom
,
QNetworkAccessManager
*
networkManager
)
=
0
;
};
};
// -----------------------------------------------------------
// -----------------------------------------------------------
...
@@ -36,19 +29,19 @@ class ElevationProvider : public MapProvider {
...
@@ -36,19 +29,19 @@ class ElevationProvider : public MapProvider {
class
AirmapElevationProvider
:
public
ElevationProvider
{
class
AirmapElevationProvider
:
public
ElevationProvider
{
Q_OBJECT
Q_OBJECT
public:
public:
AirmapElevationProvider
(
QObject
*
parent
)
AirmapElevationProvider
(
QObject
*
parent
=
nullptr
)
:
ElevationProvider
(
QString
(
"bin"
),
AVERAGE_AIRMAP_ELEV_SIZE
,
:
ElevationProvider
(
QString
Literal
(
"bin"
),
AVERAGE_AIRMAP_ELEV_SIZE
,
QGeoMapType
::
StreetMap
,
parent
)
{}
QGeoMapType
::
StreetMap
,
parent
)
{}
int
long2tileX
(
double
lon
,
int
z
);
int
long2tileX
(
const
double
lon
,
const
int
z
)
const
override
;
int
lat2tileY
(
double
lat
,
int
z
);
QGCTileSet
getTileCount
(
int
zoom
,
double
topleftLon
,
int
lat2tileY
(
const
double
lat
,
const
int
z
)
const
override
;
double
topleftLat
,
double
bottomRightLon
,
double
bottomRightLat
);
QGCTileSet
getTileCount
(
const
int
zoom
,
const
double
topleftLon
,
const
double
topleftLat
,
const
double
bottomRightLon
,
const
double
bottomRightLat
)
const
override
;
protected:
protected:
QString
_getURL
(
int
x
,
int
y
,
int
zoom
,
QString
_getURL
(
const
int
x
,
const
int
y
,
const
int
zoom
,
QNetworkAccessManager
*
networkManager
)
override
;
QNetworkAccessManager
*
networkManager
);
};
};
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 "EsriMapProvider.h"
#include "QGCApplication.h"
#include "QGCApplication.h"
#include "QGCMapEngine.h"
#include "SettingsManager.h"
#include "SettingsManager.h"
QNetworkRequest
EsriMapProvider
::
EsriMapProvider
(
const
quint32
averageSize
,
const
QGeoMapType
::
MapStyle
mapType
,
QObject
*
parent
)
EsriMapProvider
::
getTileURL
(
int
x
,
int
y
,
int
zoom
,
:
MapProvider
(
QString
(),
QString
(),
averageSize
,
mapType
,
parent
)
{}
QNetworkAccessManager
*
networkManager
)
{
QNetworkRequest
EsriMapProvider
::
getTileURL
(
const
int
x
,
const
int
y
,
const
int
zoom
,
QNetworkAccessManager
*
networkManager
)
{
//-- Build URL
//-- Build URL
QNetworkRequest
request
;
QNetworkRequest
request
;
QString
url
=
_getURL
(
x
,
y
,
zoom
,
networkManager
);
const
QString
url
=
_getURL
(
x
,
y
,
zoom
,
networkManager
);
if
(
url
.
isEmpty
())
{
if
(
url
.
isEmpty
())
{
return
request
;
return
request
;
}
}
request
.
setUrl
(
QUrl
(
url
));
request
.
setUrl
(
QUrl
(
url
));
request
.
setRawHeader
(
"Accept"
,
"*/*"
);
request
.
setRawHeader
(
QByteArrayLiteral
(
"Accept"
),
QByteArrayLiteral
(
"*/*"
));
QByteArray
token
=
qgcApp
()
const
QByteArray
token
=
qgcApp
()
->
toolbox
()
->
settingsManager
()
->
appSettings
()
->
esriToken
()
->
rawValue
().
toString
().
toLatin1
();
->
toolbox
()
request
.
setRawHeader
(
QByteArrayLiteral
(
"User-Agent"
),
QByteArrayLiteral
(
"Qt Location based application"
));
->
settingsManager
()
request
.
setRawHeader
(
QByteArrayLiteral
(
"User-Token"
),
token
);
->
appSettings
()
->
esriToken
()
->
rawValue
()
.
toString
()
.
toLatin1
();
request
.
setRawHeader
(
"User-Agent"
,
QByteArrayLiteral
(
"Qt Location based application"
));
request
.
setRawHeader
(
"User-Token"
,
token
);
return
request
;
return
request
;
}
}
QString
static
const
QString
WorldStreetMapUrl
=
QStringLiteral
(
"http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/%1/%2/%3"
);
EsriWorldStreetMapProvider
::
_getURL
(
int
x
,
int
y
,
int
zoom
,
QNetworkAccessManager
*
networkManager
)
{
QString
EsriWorldStreetMapProvider
::
_getURL
(
const
int
x
,
const
int
y
,
const
int
zoom
,
QNetworkAccessManager
*
networkManager
)
{
Q_UNUSED
(
networkManager
);
Q_UNUSED
(
networkManager
)
return
QString
(
"http://services.arcgisonline.com/ArcGIS/rest/services/"
return
WorldStreetMapUrl
.
arg
(
zoom
).
arg
(
y
).
arg
(
x
);
"World_Street_Map/MapServer/tile/%1/%2/%3"
)
.
arg
(
zoom
)
.
arg
(
y
)
.
arg
(
x
);
}
}
QString
static
const
QString
WorldSatelliteMapUrl
=
QStringLiteral
(
"http://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/%1/%2/%3"
);
EsriWorldSatelliteMapProvider
::
_getURL
(
int
x
,
int
y
,
int
zoom
,
QNetworkAccessManager
*
networkManager
)
{
QString
EsriWorldSatelliteMapProvider
::
_getURL
(
const
int
x
,
const
int
y
,
const
int
zoom
,
QNetworkAccessManager
*
networkManager
)
{
Q_UNUSED
(
networkManager
);
Q_UNUSED
(
networkManager
)
return
QString
(
"http://server.arcgisonline.com/ArcGIS/rest/"
return
WorldSatelliteMapUrl
.
arg
(
zoom
).
arg
(
y
).
arg
(
x
);
"services/World_Imagery/MapServer/tile/%1/%2/%3"
)
.
arg
(
zoom
)
.
arg
(
y
)
.
arg
(
x
);
}
}
QString
EsriTerrainMapProvider
::
_getURL
(
int
x
,
int
y
,
int
zoom
,
static
const
QString
TerrainMapUrl
=
QStringLiteral
(
"http://server.arcgisonline.com/ArcGIS/rest/services/World_Terrain_Base/MapServer/tile/%1/%2/%3"
);
QNetworkAccessManager
*
networkManager
)
{
Q_UNUSED
(
networkManager
);
QString
EsriTerrainMapProvider
::
_getURL
(
const
int
x
,
const
int
y
,
const
int
zoom
,
QNetworkAccessManager
*
networkManager
)
{
return
QString
(
"http://server.arcgisonline.com/ArcGIS/rest/services/"
Q_UNUSED
(
networkManager
)
"World_Terrain_Base/MapServer/tile/%1/%2/%3"
)
return
TerrainMapUrl
.
arg
(
zoom
).
arg
(
y
).
arg
(
x
);
.
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
#pragma once
#include "MapProvider.h"
#include "MapProvider.h"
#include <QByteArray>
#include <QMutex>
#include <QNetworkProxy>
#include <QNetworkReply>
#include <QPoint>
#include <QString>
class
EsriMapProvider
:
public
MapProvider
{
class
EsriMapProvider
:
public
MapProvider
{
Q_OBJECT
Q_OBJECT
public:
public:
using
MapProvider
::
MapProvider
;
EsriMapProvider
(
const
quint32
averageSize
,
const
QGeoMapType
::
MapStyle
mapType
,
QObject
*
parent
=
nullptr
)
;
QNetworkRequest
getTileURL
(
int
x
,
int
y
,
int
zoom
,
QNetworkRequest
getTileURL
(
const
int
x
,
const
int
y
,
const
int
zoom
,
QNetworkAccessManager
*
networkManager
)
override
;
QNetworkAccessManager
*
networkManager
);
};
};
class
EsriWorldStreetMapProvider
:
public
EsriMapProvider
{
class
EsriWorldStreetMapProvider
:
public
EsriMapProvider
{
Q_OBJECT
Q_OBJECT
public:
public:
EsriWorldStreetMapProvider
(
QObject
*
parent
)
EsriWorldStreetMapProvider
(
QObject
*
parent
=
nullptr
)
:
EsriMapProvider
(
QString
(
""
),
QString
(
""
),
AVERAGE_TILE_SIZE
,
:
EsriMapProvider
(
AVERAGE_TILE_SIZE
,
QGeoMapType
::
StreetMap
,
parent
)
{}
QGeoMapType
::
StreetMap
,
parent
)
{}
QString
_getURL
(
int
x
,
int
y
,
int
zoom
,
QString
_getURL
(
const
int
x
,
const
int
y
,
const
int
zoom
,
QNetworkAccessManager
*
networkManager
)
override
;
QNetworkAccessManager
*
networkManager
);
};
};
class
EsriWorldSatelliteMapProvider
:
public
EsriMapProvider
{
class
EsriWorldSatelliteMapProvider
:
public
EsriMapProvider
{
Q_OBJECT
Q_OBJECT
public:
public:
EsriWorldSatelliteMapProvider
(
QObject
*
parent
)
EsriWorldSatelliteMapProvider
(
QObject
*
parent
=
nullptr
)
:
EsriMapProvider
(
QString
(
""
),
QString
(
""
),
AVERAGE_TILE_SIZE
,
:
EsriMapProvider
(
AVERAGE_TILE_SIZE
,
QGeoMapType
::
SatelliteMapDay
,
parent
)
{}
QGeoMapType
::
SatelliteMapDay
,
parent
)
{}
QString
_getURL
(
int
x
,
int
y
,
int
zoom
,
QString
_getURL
(
const
int
x
,
const
int
y
,
const
int
zoom
,
QNetworkAccessManager
*
networkManager
)
override
;
QNetworkAccessManager
*
networkManager
);
};
};
class
EsriTerrainMapProvider
:
public
EsriMapProvider
{
class
EsriTerrainMapProvider
:
public
EsriMapProvider
{
Q_OBJECT
Q_OBJECT
public:
public:
EsriTerrainMapProvider
(
QObject
*
parent
)
EsriTerrainMapProvider
(
QObject
*
parent
=
nullptr
)
:
EsriMapProvider
(
QString
(
""
),
QString
(
""
),
AVERAGE_TILE_SIZE
,
:
EsriMapProvider
(
AVERAGE_TILE_SIZE
,
QGeoMapType
::
TerrainMap
,
parent
)
{}
QGeoMapType
::
TerrainMap
,
parent
)
{}
QString
_getURL
(
int
x
,
int
y
,
int
zoom
,
QString
_getURL
(
const
int
x
,
const
int
y
,
const
int
zoom
,
QNetworkAccessManager
*
networkManager
)
override
;
QNetworkAccessManager
*
networkManager
);
};
};
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 "GenericMapProvider.h"
#include "QGCMapEngine.h"
QString
StatkartMapProvider
::
_getURL
(
int
x
,
int
y
,
int
zoom
,
static
const
QString
StatkartMapUrl
=
QStringLiteral
(
"http://opencache.statkart.no/gatekeeper/gk/gk.open_gmaps?layers=topo4&zoom=%1&x=%2&y=%3"
);
QNetworkAccessManager
*
networkManager
)
{
Q_UNUSED
(
networkManager
);
QString
StatkartMapProvider
::
_getURL
(
const
int
x
,
const
int
y
,
const
int
zoom
,
QNetworkAccessManager
*
networkManager
)
{
return
QString
(
"http://opencache.statkart.no/gatekeeper/gk/"
Q_UNUSED
(
networkManager
)
"gk.open_gmaps?layers=topo4&zoom=%1&x=%2&y=%3"
)
return
StatkartMapUrl
.
arg
(
zoom
).
arg
(
x
).
arg
(
y
);
.
arg
(
zoom
)
.
arg
(
x
)
.
arg
(
y
);
}
}
QString
EniroMapProvider
::
_getURL
(
int
x
,
int
y
,
int
zoom
,
static
const
QString
EniroMapUrl
=
QStringLiteral
(
"http://map.eniro.com/geowebcache/service/tms1.0.0/map/%1/%2/%3.png"
);
QNetworkAccessManager
*
networkManager
)
{
Q_UNUSED
(
networkManager
);
QString
EniroMapProvider
::
_getURL
(
const
int
x
,
const
int
y
,
const
int
zoom
,
QNetworkAccessManager
*
networkManager
)
{
return
QString
(
"http://map.eniro.com/geowebcache/service/tms1.0.0/map/%1/"
Q_UNUSED
(
networkManager
)
"%2/%3.png"
)
return
EniroMapUrl
.
arg
(
zoom
).
arg
(
x
).
arg
((
1
<<
zoom
)
-
1
-
y
);
.
arg
(
zoom
)
.
arg
(
x
)
.
arg
((
1
<<
zoom
)
-
1
-
y
);
}
}
QString
MapQuestMapMapProvider
::
_getURL
(
int
x
,
int
y
,
int
zoom
,
static
const
QString
MapQuestMapUrl
=
QStringLiteral
(
"http://otile%1.mqcdn.com/tiles/1.0.0/map/%2/%3/%4.jpg"
);
QNetworkAccessManager
*
networkManager
)
{
Q_UNUSED
(
networkManager
);
QString
MapQuestMapMapProvider
::
_getURL
(
const
int
x
,
const
int
y
,
const
int
zoom
,
QNetworkAccessManager
*
networkManager
)
{
char
letter
=
"1234"
[
_getServerNum
(
x
,
y
,
4
)];
Q_UNUSED
(
networkManager
)
return
QString
(
"http://otile%1.mqcdn.com/tiles/1.0.0/map/%2/%3/%4.jpg"
)
return
MapQuestMapUrl
.
arg
(
_getServerNum
(
x
,
y
,
4
)).
arg
(
zoom
).
arg
(
x
).
arg
(
y
);
.
arg
(
letter
)
.
arg
(
zoom
)
.
arg
(
x
)
.
arg
(
y
);
}
}
QString
MapQuestSatMapProvider
::
_getURL
(
int
x
,
int
y
,
int
zoom
,
static
const
QString
MapQuestSatUrl
=
QStringLiteral
(
"http://otile%1.mqcdn.com/tiles/1.0.0/sat/%2/%3/%4.jpg"
);
QNetworkAccessManager
*
networkManager
)
{
Q_UNUSED
(
networkManager
);
QString
MapQuestSatMapProvider
::
_getURL
(
const
int
x
,
const
int
y
,
const
int
zoom
,
QNetworkAccessManager
*
networkManager
)
{
char
letter
=
"1234"
[
_getServerNum
(
x
,
y
,
4
)];
Q_UNUSED
(
networkManager
)
return
QString
(
"http://otile%1.mqcdn.com/tiles/1.0.0/sat/%2/%3/%4.jpg"
)
return
MapQuestSatUrl
.
arg
(
_getServerNum
(
x
,
y
,
4
)).
arg
(
zoom
).
arg
(
x
).
arg
(
y
);
.
arg
(
letter
)
.
arg
(
zoom
)
.
arg
(
x
)
.
arg
(
y
);
}
}
QString
QString
VWorldStreetMapProvider
::
_getURL
(
const
int
x
,
const
int
y
,
const
int
zoom
,
QNetworkAccessManager
*
networkManager
)
{
VWorldStreetMapProvider
::
_getURL
(
int
x
,
int
y
,
int
zoom
,
Q_UNUSED
(
networkManager
)
QNetworkAccessManager
*
networkManager
)
{
const
int
gap
=
zoom
-
6
;
Q_UNUSED
(
networkManager
);
const
int
x_min
=
int
(
53
*
pow
(
2
,
gap
));
int
gap
=
zoom
-
6
;
const
int
x_max
=
int
(
55
*
pow
(
2
,
gap
)
+
(
2
*
gap
-
1
));
int
x_min
=
53
*
pow
(
2
,
gap
);
const
int
y_min
=
int
(
22
*
pow
(
2
,
gap
));
int
x_max
=
55
*
pow
(
2
,
gap
)
+
(
2
*
gap
-
1
);
const
int
y_max
=
int
(
26
*
pow
(
2
,
gap
)
+
(
2
*
gap
-
1
));
int
y_min
=
22
*
pow
(
2
,
gap
);
int
y_max
=
26
*
pow
(
2
,
gap
)
+
(
2
*
gap
-
1
);
if
(
zoom
>
19
)
{
if
(
zoom
>
19
)
{
return
{};
return
QString
();
}
else
if
(
zoom
>
5
&&
x
>=
x_min
&&
x
<=
x_max
&&
y
>=
y_min
&&
}
else
if
(
zoom
>
5
&&
x
>=
x_min
&&
x
<=
x_max
&&
y
>=
y_min
&&
y
<=
y_max
)
{
y
<=
y_max
)
{
return
QString
(
QStringLiteral
(
"http://xdworld.vworld.kr:8080/2d/Base/service/%1/%2/%3.png"
)).
arg
(
zoom
,
x
,
y
);
return
QString
(
"http://xdworld.vworld.kr:8080/2d/Base/service/%1/%2/%3.png"
)
.
arg
(
zoom
)
.
arg
(
x
)
.
arg
(
y
);
}
else
{
}
else
{
QString
key
=
_tileXYToQuadKey
(
x
,
y
,
zoom
);
const
QString
key
=
_tileXYToQuadKey
(
x
,
y
,
zoom
);
return
QString
(
"http://ecn.t%1.tiles.virtualearth.net/tiles/"
return
QString
(
QStringLiteral
(
"http://ecn.t%1.tiles.virtualearth.net/tiles/r%2.png?g=%3&mkt=%4"
))
"r%2.png?g=%3&mkt=%4"
)
.
arg
(
_getServerNum
(
x
,
y
,
4
)).
arg
(
key
,
_versionBingMaps
,
_language
);
.
arg
(
_getServerNum
(
x
,
y
,
4
))
.
arg
(
key
)
.
arg
(
_versionBingMaps
)
.
arg
(
_language
);
}
}
}
}
QString
VWorldSatMapProvider
::
_getURL
(
int
x
,
int
y
,
int
zoom
,
QString
VWorldSatMapProvider
::
_getURL
(
const
int
x
,
const
int
y
,
const
int
zoom
,
QNetworkAccessManager
*
networkManager
)
{
QNetworkAccessManager
*
networkManager
)
{
Q_UNUSED
(
networkManager
)
Q_UNUSED
(
networkManager
);
const
int
gap
=
zoom
-
6
;
int
gap
=
zoom
-
6
;
const
int
x_min
=
int
(
53
*
pow
(
2
,
gap
));
int
x_min
=
53
*
pow
(
2
,
gap
);
const
int
x_max
=
int
(
55
*
pow
(
2
,
gap
)
+
(
2
*
gap
-
1
));
int
x_max
=
55
*
pow
(
2
,
gap
)
+
(
2
*
gap
-
1
);
const
int
y_min
=
int
(
22
*
pow
(
2
,
gap
));
int
y_min
=
22
*
pow
(
2
,
gap
);
const
int
y_max
=
int
(
26
*
pow
(
2
,
gap
)
+
(
2
*
gap
-
1
));
int
y_max
=
26
*
pow
(
2
,
gap
)
+
(
2
*
gap
-
1
);
if
(
zoom
>
19
)
{
if
(
zoom
>
19
)
{
return
{};
return
QString
();
}
else
if
(
zoom
>
5
&&
x
>=
x_min
&&
x
<=
x_max
&&
y
>=
y_min
&&
}
else
if
(
zoom
>
5
&&
x
>=
x_min
&&
x
<=
x_max
&&
y
>=
y_min
&&
y
<=
y_max
)
{
y
<=
y_max
)
{
return
QString
(
"http://xdworld.vworld.kr:8080/2d/Satellite/service/%1/%2/%3.jpeg"
).
arg
(
zoom
,
x
,
y
);
return
QString
(
"http://xdworld.vworld.kr:8080/2d/Satellite/service/%1/"
"%2/%3.jpeg"
)
.
arg
(
zoom
)
.
arg
(
x
)
.
arg
(
y
);
}
else
{
}
else
{
QString
key
=
_tileXYToQuadKey
(
x
,
y
,
zoom
);
const
QString
key
=
_tileXYToQuadKey
(
x
,
y
,
zoom
);
return
QString
(
"http://ecn.t%1.tiles.virtualearth.net/tiles/"
return
QString
(
"http://ecn.t%1.tiles.virtualearth.net/tiles/a%2.jpeg?g=%3&mkt=%4"
)
"a%2.jpeg?g=%3&mkt=%4"
)
.
arg
(
_getServerNum
(
x
,
y
,
4
)).
arg
(
key
,
_versionBingMaps
,
_language
);
.
arg
(
_getServerNum
(
x
,
y
,
4
))
.
arg
(
key
)
.
arg
(
_versionBingMaps
)
.
arg
(
_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
#pragma once
#include "MapProvider.h"
#include "MapProvider.h"
#include <cmath>
#include <QByteArray>
#include <QMutex>
#include <QNetworkProxy>
#include <QNetworkReply>
#include <QPoint>
#include <QString>
class
StatkartMapProvider
:
public
MapProvider
{
class
StatkartMapProvider
:
public
MapProvider
{
Q_OBJECT
Q_OBJECT
public:
public:
StatkartMapProvider
(
QObject
*
parent
)
StatkartMapProvider
(
QObject
*
parent
=
nullptr
)
:
MapProvider
(
QString
(
"https://www.norgeskart.no/"
),
QString
(
"png"
),
:
MapProvider
(
QString
Literal
(
"https://www.norgeskart.no/"
),
QStringLiteral
(
"png"
),
AVERAGE_TILE_SIZE
,
QGeoMapType
::
StreetMap
,
parent
)
{}
AVERAGE_TILE_SIZE
,
QGeoMapType
::
StreetMap
,
parent
)
{}
QString
_getURL
(
int
x
,
int
y
,
int
zoom
,
QString
_getURL
(
const
int
x
,
const
int
y
,
const
int
zoom
,
QNetworkAccessManager
*
networkManager
)
override
;
QNetworkAccessManager
*
networkManager
);
};
};
class
EniroMapProvider
:
public
MapProvider
{
class
EniroMapProvider
:
public
MapProvider
{
Q_OBJECT
Q_OBJECT
public:
public:
EniroMapProvider
(
QObject
*
parent
)
EniroMapProvider
(
QObject
*
parent
=
nullptr
)
:
MapProvider
(
QString
(
"https://www.eniro.se/"
),
QString
(
"png"
),
:
MapProvider
(
QString
Literal
(
"https://www.eniro.se/"
),
QStringLiteral
(
"png"
),
AVERAGE_TILE_SIZE
,
QGeoMapType
::
StreetMap
,
parent
)
{}
AVERAGE_TILE_SIZE
,
QGeoMapType
::
StreetMap
,
parent
)
{}
QString
_getURL
(
int
x
,
int
y
,
int
zoom
,
QString
_getURL
(
const
int
x
,
const
int
y
,
const
int
zoom
,
QNetworkAccessManager
*
networkManager
)
override
;
QNetworkAccessManager
*
networkManager
);
};
};
class
MapQuestMapMapProvider
:
public
MapProvider
{
class
MapQuestMapMapProvider
:
public
MapProvider
{
Q_OBJECT
Q_OBJECT
public:
public:
MapQuestMapMapProvider
(
QObject
*
parent
)
MapQuestMapMapProvider
(
QObject
*
parent
=
nullptr
)
:
MapProvider
(
QString
(
"https://mapquest.com"
),
QString
(
"jpg"
),
:
MapProvider
(
QString
Literal
(
"https://mapquest.com"
),
QStringLiteral
(
"jpg"
),
AVERAGE_TILE_SIZE
,
QGeoMapType
::
StreetMap
,
parent
)
{}
AVERAGE_TILE_SIZE
,
QGeoMapType
::
StreetMap
,
parent
)
{}
QString
_getURL
(
int
x
,
int
y
,
int
zoom
,
QString
_getURL
(
const
int
x
,
const
int
y
,
const
int
zoom
,
QNetworkAccessManager
*
networkManager
)
override
;
QNetworkAccessManager
*
networkManager
);
};
};
class
MapQuestSatMapProvider
:
public
MapProvider
{
class
MapQuestSatMapProvider
:
public
MapProvider
{
Q_OBJECT
Q_OBJECT
public:
public:
MapQuestSatMapProvider
(
QObject
*
parent
)
MapQuestSatMapProvider
(
QObject
*
parent
=
nullptr
)
:
MapProvider
(
QString
(
"https://mapquest.com"
),
QString
(
"jpg"
),
:
MapProvider
(
QStringLiteral
(
"https://mapquest.com"
),
QStringLiteral
(
"jpg"
),
AVERAGE_TILE_SIZE
,
QGeoMapType
::
SatelliteMapDay
,
parent
)
{
AVERAGE_TILE_SIZE
,
QGeoMapType
::
SatelliteMapDay
,
parent
)
{}
}
QString
_getURL
(
int
x
,
int
y
,
int
zoom
,
QString
_getURL
(
const
int
x
,
const
int
y
,
const
int
zoom
,
QNetworkAccessManager
*
networkManager
)
override
;
QNetworkAccessManager
*
networkManager
);
};
};
class
VWorldStreetMapProvider
:
public
MapProvider
{
class
VWorldStreetMapProvider
:
public
MapProvider
{
Q_OBJECT
Q_OBJECT
public:
public:
VWorldStreetMapProvider
(
QObject
*
parent
)
VWorldStreetMapProvider
(
QObject
*
parent
=
nullptr
)
:
MapProvider
(
QString
(
"www.vworld.kr"
),
QString
(
"png"
),
:
MapProvider
(
QString
Literal
(
"www.vworld.kr"
),
QStringLiteral
(
"png"
),
AVERAGE_TILE_SIZE
,
QGeoMapType
::
StreetMap
,
parent
)
{}
AVERAGE_TILE_SIZE
,
QGeoMapType
::
StreetMap
,
parent
)
{}
QString
_getURL
(
int
x
,
int
y
,
int
zoom
,
QString
_getURL
(
const
int
x
,
const
int
y
,
const
int
zoom
,
QNetworkAccessManager
*
networkManager
)
override
;
QNetworkAccessManager
*
networkManager
);
private:
private:
const
QString
_versionBingMaps
=
"563"
;
const
QString
_versionBingMaps
=
QStringLiteral
(
"563"
)
;
};
};
class
VWorldSatMapProvider
:
public
MapProvider
{
class
VWorldSatMapProvider
:
public
MapProvider
{
Q_OBJECT
Q_OBJECT
public:
public:
VWorldSatMapProvider
(
QObject
*
parent
)
VWorldSatMapProvider
(
QObject
*
parent
=
nullptr
)
:
MapProvider
(
QString
(
"www.vworld.kr"
),
QString
(
"jpg"
),
:
MapProvider
(
QStringLiteral
(
"www.vworld.kr"
),
QStringLiteral
(
"jpg"
),
AVERAGE_TILE_SIZE
,
QGeoMapType
::
SatelliteMapDay
,
parent
)
{
AVERAGE_TILE_SIZE
,
QGeoMapType
::
SatelliteMapDay
,
parent
)
{}
}
QString
_getURL
(
int
x
,
int
y
,
int
zoom
,
QString
_getURL
(
const
int
x
,
const
int
y
,
const
int
zoom
,
QNetworkAccessManager
*
networkManager
)
override
;
QNetworkAccessManager
*
networkManager
);
private:
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
#pragma once
#include "MapProvider.h"
#include "MapProvider.h"
#include <QByteArray>
#include <QMutex>
#include <QNetworkProxy>
#include <QNetworkReply>
#include <QNetworkReply>
#include <QPoint>
#include <QMutex>
#include <QString>
class
GoogleMapProvider
:
public
MapProvider
{
class
GoogleMapProvider
:
public
MapProvider
{
Q_OBJECT
Q_OBJECT
public:
GoogleMapProvider
(
QString
imageFormat
,
quint32
averageSize
,
public:
QGeoMapType
::
MapStyle
mapType
,
QObject
*
parent
);
GoogleMapProvider
(
const
QString
&
imageFormat
,
const
quint32
averageSize
,
const
QGeoMapType
::
MapStyle
_mapType
,
QObject
*
parent
=
nullptr
);
~
GoogleMapProvider
();
~
GoogleMapProvider
();
// Google Specific private slots
// Google Specific private slots
private
slots
:
private
slots
:
void
_networkReplyError
(
QNetworkReply
::
NetworkError
error
);
void
_networkReplyError
(
QNetworkReply
::
NetworkError
error
);
void
_googleVersionCompleted
();
void
_googleVersionCompleted
();
void
_replyDestroyed
();
void
_replyDestroyed
();
protected:
protected:
// Define the url to Request
virtual
QString
_getURL
(
int
x
,
int
y
,
int
zoom
,
QNetworkAccessManager
*
networkManager
)
=
0
;
// Google Specific private methods
// 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
);
void
_tryCorrectGoogleVersions
(
QNetworkAccessManager
*
networkManager
);
// Google Specific attributes
// Google Specific attributes
...
@@ -57,23 +59,22 @@ class GoogleMapProvider : public MapProvider {
...
@@ -57,23 +59,22 @@ class GoogleMapProvider : public MapProvider {
// CycleMap,
// CycleMap,
// CustomMap = 100
// CustomMap = 100
const
quint32
AVERAGE_GOOGLE_STREET_MAP
=
4913
;
static
const
quint32
AVERAGE_GOOGLE_STREET_MAP
=
4913
;
const
quint32
AVERAGE_GOOGLE_SAT_MAP
=
56887
;
static
const
quint32
AVERAGE_GOOGLE_SAT_MAP
=
56887
;
const
quint32
AVERAGE_GOOGLE_TERRAIN_MAP
=
19391
;
static
const
quint32
AVERAGE_GOOGLE_TERRAIN_MAP
=
19391
;
// -----------------------------------------------------------
// -----------------------------------------------------------
// Google Street Map
// Google Street Map
class
GoogleStreetMapProvider
:
public
GoogleMapProvider
{
class
GoogleStreetMapProvider
:
public
GoogleMapProvider
{
Q_OBJECT
Q_OBJECT
public:
GoogleStreetMapProvider
(
QObject
*
parent
)
public:
:
GoogleMapProvider
(
QString
(
"png"
),
AVERAGE_GOOGLE_STREET_MAP
,
GoogleStreetMapProvider
(
QObject
*
parent
=
nullptr
)
QGeoMapType
::
StreetMap
,
parent
)
{}
:
GoogleMapProvider
(
QStringLiteral
(
"png"
),
AVERAGE_GOOGLE_STREET_MAP
,
QGeoMapType
::
StreetMap
,
parent
)
{}
protected:
protected:
QString
_getURL
(
int
x
,
int
y
,
int
zoom
,
QString
_getURL
(
const
int
x
,
const
int
y
,
const
int
zoom
,
QNetworkAccessManager
*
networkManager
)
override
;
QNetworkAccessManager
*
networkManager
);
};
};
// -----------------------------------------------------------
// -----------------------------------------------------------
...
@@ -81,14 +82,14 @@ class GoogleStreetMapProvider : public GoogleMapProvider {
...
@@ -81,14 +82,14 @@ class GoogleStreetMapProvider : public GoogleMapProvider {
class
GoogleSatelliteMapProvider
:
public
GoogleMapProvider
{
class
GoogleSatelliteMapProvider
:
public
GoogleMapProvider
{
Q_OBJECT
Q_OBJECT
public:
GoogleSatelliteMapProvider
(
QObject
*
parent
)
public:
:
GoogleMapProvider
(
QString
(
"jpg"
),
AVERAGE_GOOGLE_SAT_MAP
,
GoogleSatelliteMapProvider
(
QObject
*
parent
=
nullptr
)
:
GoogleMapProvider
(
QStringLiteral
(
"jpg"
),
AVERAGE_GOOGLE_SAT_MAP
,
QGeoMapType
::
SatelliteMapDay
,
parent
)
{}
QGeoMapType
::
SatelliteMapDay
,
parent
)
{}
protected:
protected:
QString
_getURL
(
int
x
,
int
y
,
int
zoom
,
QString
_getURL
(
const
int
x
,
const
int
y
,
const
int
zoom
,
QNetworkAccessManager
*
networkManager
)
override
;
QNetworkAccessManager
*
networkManager
);
};
};
// -----------------------------------------------------------
// -----------------------------------------------------------
...
@@ -96,14 +97,13 @@ class GoogleSatelliteMapProvider : public GoogleMapProvider {
...
@@ -96,14 +97,13 @@ class GoogleSatelliteMapProvider : public GoogleMapProvider {
class
GoogleLabelsMapProvider
:
public
GoogleMapProvider
{
class
GoogleLabelsMapProvider
:
public
GoogleMapProvider
{
Q_OBJECT
Q_OBJECT
public:
GoogleLabelsMapProvider
(
QObject
*
parent
)
public:
:
GoogleMapProvider
(
QString
(
"png"
),
AVERAGE_TILE_SIZE
,
GoogleLabelsMapProvider
(
QObject
*
parent
=
nullptr
)
QGeoMapType
::
CustomMap
,
parent
)
{}
:
GoogleMapProvider
(
QStringLiteral
(
"png"
),
AVERAGE_TILE_SIZE
,
QGeoMapType
::
CustomMap
,
parent
)
{}
protected:
protected:
QString
_getURL
(
int
x
,
int
y
,
int
zoom
,
QString
_getURL
(
const
int
x
,
const
int
y
,
const
int
zoom
,
QNetworkAccessManager
*
networkManager
)
override
;
QNetworkAccessManager
*
networkManager
);
};
};
// -----------------------------------------------------------
// -----------------------------------------------------------
...
@@ -111,14 +111,13 @@ class GoogleLabelsMapProvider : public GoogleMapProvider {
...
@@ -111,14 +111,13 @@ class GoogleLabelsMapProvider : public GoogleMapProvider {
class
GoogleTerrainMapProvider
:
public
GoogleMapProvider
{
class
GoogleTerrainMapProvider
:
public
GoogleMapProvider
{
Q_OBJECT
Q_OBJECT
public:
GoogleTerrainMapProvider
(
QObject
*
parent
)
public:
:
GoogleMapProvider
(
QString
(
"png"
),
AVERAGE_GOOGLE_TERRAIN_MAP
,
GoogleTerrainMapProvider
(
QObject
*
parent
=
nullptr
)
QGeoMapType
::
TerrainMap
,
parent
)
{}
:
GoogleMapProvider
(
QStringLiteral
(
"png"
),
AVERAGE_GOOGLE_TERRAIN_MAP
,
QGeoMapType
::
TerrainMap
,
parent
)
{}
protected:
protected:
QString
_getURL
(
int
x
,
int
y
,
int
zoom
,
QString
_getURL
(
const
int
x
,
const
int
y
,
const
int
zoom
,
QNetworkAccessManager
*
networkManager
)
override
;
QNetworkAccessManager
*
networkManager
);
};
};
// -----------------------------------------------------------
// -----------------------------------------------------------
...
@@ -126,12 +125,11 @@ class GoogleTerrainMapProvider : public GoogleMapProvider {
...
@@ -126,12 +125,11 @@ class GoogleTerrainMapProvider : public GoogleMapProvider {
class
GoogleHybridMapProvider
:
public
GoogleMapProvider
{
class
GoogleHybridMapProvider
:
public
GoogleMapProvider
{
Q_OBJECT
Q_OBJECT
public:
GoogleHybridMapProvider
(
QObject
*
parent
)
public:
:
GoogleMapProvider
(
QString
(
"png"
),
AVERAGE_GOOGLE_SAT_MAP
,
GoogleHybridMapProvider
(
QObject
*
parent
=
nullptr
)
QGeoMapType
::
HybridMap
,
parent
)
{}
:
GoogleMapProvider
(
QStringLiteral
(
"png"
),
AVERAGE_GOOGLE_SAT_MAP
,
QGeoMapType
::
HybridMap
,
parent
)
{}
protected:
protected:
QString
_getURL
(
int
x
,
int
y
,
int
zoom
,
QString
_getURL
(
const
int
x
,
const
int
y
,
const
int
zoom
,
QNetworkAccessManager
*
networkManager
)
override
;
QNetworkAccessManager
*
networkManager
);
};
};
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"
#include "MapProvider.h"
MapProvider
::
MapProvider
(
QString
referrer
,
QString
imageFormat
,
MapProvider
::
MapProvider
(
const
QString
&
referrer
,
const
QString
&
imageFormat
,
quint32
averageSize
,
QGeoMapType
::
MapStyle
mapType
,
QObject
*
parent
)
const
quint32
averageSize
,
const
QGeoMapType
::
MapStyle
mapType
,
QObject
*
parent
)
:
QObject
(
parent
),
_referrer
(
referrer
),
_imageFormat
(
imageFormat
),
:
QObject
(
parent
)
_averageSize
(
averageSize
),
_mapType
(
mapType
)
{
,
_referrer
(
referrer
)
QStringList
langs
=
QLocale
::
system
().
uiLanguages
();
,
_imageFormat
(
imageFormat
)
,
_averageSize
(
averageSize
)
,
_mapType
(
mapType
)
{
const
QStringList
langs
=
QLocale
::
system
().
uiLanguages
();
if
(
langs
.
length
()
>
0
)
{
if
(
langs
.
length
()
>
0
)
{
_language
=
langs
[
0
];
_language
=
langs
[
0
];
}
}
}
}
QNetworkRequest
MapProvider
::
getTileURL
(
int
x
,
int
y
,
int
zoom
,
QNetworkRequest
MapProvider
::
getTileURL
(
const
int
x
,
const
int
y
,
const
int
zoom
,
QNetworkAccessManager
*
networkManager
)
{
QNetworkAccessManager
*
networkManager
)
{
//-- Build URL
//-- Build URL
QNetworkRequest
request
;
QNetworkRequest
request
;
QString
url
=
_getURL
(
x
,
y
,
zoom
,
networkManager
);
const
QString
url
=
_getURL
(
x
,
y
,
zoom
,
networkManager
);
if
(
url
.
isEmpty
())
{
if
(
url
.
isEmpty
())
{
return
request
;
return
request
;
}
}
request
.
setUrl
(
QUrl
(
url
));
request
.
setUrl
(
QUrl
(
url
));
request
.
setRawHeader
(
"Accept"
,
"*/*"
);
request
.
setRawHeader
(
QByteArrayLiteral
(
"Accept"
),
QByteArrayLiteral
(
"*/*"
)
);
request
.
setRawHeader
(
"Referrer"
,
_referrer
.
toUtf8
());
request
.
setRawHeader
(
QByteArrayLiteral
(
"Referrer"
)
,
_referrer
.
toUtf8
());
request
.
setRawHeader
(
"User-Agent"
,
_userAgent
);
request
.
setRawHeader
(
QByteArrayLiteral
(
"User-Agent"
)
,
_userAgent
);
return
request
;
return
request
;
}
}
QString
MapProvider
::
getImageFormat
(
const
QByteArray
&
image
)
{
QString
MapProvider
::
getImageFormat
(
const
QByteArray
&
image
)
const
{
QString
format
;
QString
format
;
if
(
image
.
size
()
>
2
)
{
if
(
image
.
size
()
>
2
)
{
if
(
image
.
startsWith
(
reinterpret_cast
<
const
char
*>
(
pngSignature
)))
if
(
image
.
startsWith
(
reinterpret_cast
<
const
char
*>
(
pngSignature
)))
format
=
"png"
;
format
=
QStringLiteral
(
"png"
)
;
else
if
(
image
.
startsWith
(
reinterpret_cast
<
const
char
*>
(
jpegSignature
)))
else
if
(
image
.
startsWith
(
reinterpret_cast
<
const
char
*>
(
jpegSignature
)))
format
=
"jpg"
;
format
=
QStringLiteral
(
"jpg"
)
;
else
if
(
image
.
startsWith
(
reinterpret_cast
<
const
char
*>
(
gifSignature
)))
else
if
(
image
.
startsWith
(
reinterpret_cast
<
const
char
*>
(
gifSignature
)))
format
=
"gif"
;
format
=
QStringLiteral
(
"gif"
)
;
else
{
else
{
return
_imageFormat
;
return
_imageFormat
;
}
}
...
@@ -41,11 +56,11 @@ QString MapProvider::getImageFormat(const QByteArray& image) {
...
@@ -41,11 +56,11 @@ QString MapProvider::getImageFormat(const QByteArray& image) {
return
format
;
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
;
QString
quadKey
;
for
(
int
i
=
levelOfDetail
;
i
>
0
;
i
--
)
{
for
(
int
i
=
levelOfDetail
;
i
>
0
;
i
--
)
{
char
digit
=
'0'
;
char
digit
=
'0'
;
int
mask
=
1
<<
(
i
-
1
);
const
int
mask
=
1
<<
(
i
-
1
);
if
((
tileX
&
mask
)
!=
0
)
{
if
((
tileX
&
mask
)
!=
0
)
{
digit
++
;
digit
++
;
}
}
...
@@ -58,27 +73,29 @@ QString MapProvider::_tileXYToQuadKey(int tileX, int tileY, int levelOfDetail) {
...
@@ -58,27 +73,29 @@ QString MapProvider::_tileXYToQuadKey(int tileX, int tileY, int levelOfDetail) {
return
quadKey
;
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
;
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
)));
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
(
return
static_cast
<
int
>
(
floor
(
(
1.0
-
(
1.0
-
log
(
tan
(
lat
*
M_PI
/
180.0
)
+
1.0
/
cos
(
lat
*
M_PI
/
180.0
))
/
M_PI
)
/
log
(
tan
(
lat
*
M_PI
/
180.0
)
+
1.0
/
cos
(
lat
*
M_PI
/
180.0
))
/
M_PI
)
/
2.0
*
pow
(
2.0
,
z
)));
2.0
*
pow
(
2.0
,
z
)));
}
}
bool
MapProvider
::
_isElevationProvider
()
{
return
false
;
}
bool
MapProvider
::
_isElevationProvider
()
const
{
return
false
;
}
QGCTileSet
MapProvider
::
getTileCount
(
int
zoom
,
double
topleftLon
,
QGCTileSet
MapProvider
::
getTileCount
(
const
int
zoom
,
const
double
topleftLon
,
double
topleftLat
,
double
bottomRightLon
,
const
double
topleftLat
,
const
double
bottomRightLon
,
double
bottomRightLat
)
{
const
double
bottomRightLat
)
const
{
QGCTileSet
set
;
QGCTileSet
set
;
set
.
tileX0
=
long2tileX
(
topleftLon
,
zoom
);
set
.
tileX0
=
long2tileX
(
topleftLon
,
zoom
);
set
.
tileY0
=
lat2tileY
(
topleftLat
,
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>
#pragma once
#include "QGCTileSet.h"
#include <QByteArray>
#include <QByteArray>
#include <QNetworkProxy>
#include <QNetworkReply>
#include <QString>
#include <QString>
#include <cmath>
#include "QGCTileSet.h"
#include <QtLocation/private/qgeomaptype_p.h>
#include <QtLocation/private/qgeomaptype_p.h>
static
const
unsigned
char
pngSignature
[]
=
{
0x89
,
0x50
,
0x4E
,
0x47
,
0x0D
,
static
const
unsigned
char
pngSignature
[]
=
{
0x89
,
0x50
,
0x4E
,
0x47
,
0x0D
,
0x0A
,
0x1A
,
0x0A
,
0x00
};
0x0A
,
0x1A
,
0x0A
,
0x00
};
static
const
unsigned
char
jpegSignature
[]
=
{
0xFF
,
0xD8
,
0xFF
,
0x00
};
static
const
unsigned
char
jpegSignature
[]
=
{
0xFF
,
0xD8
,
0xFF
,
0x00
};
static
const
unsigned
char
gifSignature
[]
=
{
0x47
,
0x49
,
0x46
,
0x38
,
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
{
class
MapProvider
:
public
QObject
{
Q_OBJECT
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
,
public:
QNetworkAccessManager
*
networkManager
);
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
,
virtual
bool
_isElevationProvider
()
const
;
double
topleftLat
,
double
bottomRightLon
,
double
bottomRightLat
);
protected:
virtual
QGCTileSet
getTileCount
(
const
int
zoom
,
const
double
topleftLon
,
QString
_tileXYToQuadKey
(
int
tileX
,
int
tileY
,
int
levelOfDetail
);
const
double
topleftLat
,
const
double
bottomRightLon
,
int
_getServerNum
(
int
x
,
int
y
,
int
max
);
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
// Define Referrer for Request RawHeader
QString
_referrer
;
QString
_referrer
;
...
@@ -54,7 +65,4 @@ class MapProvider : public QObject {
...
@@ -54,7 +65,4 @@ class MapProvider : public QObject {
QString
_language
;
QString
_language
;
QGeoMapType
::
MapStyle
_mapType
;
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 @@
...
@@ -3,33 +3,19 @@
#include "QGCMapEngine.h"
#include "QGCMapEngine.h"
#include "SettingsManager.h"
#include "SettingsManager.h"
MapboxMapProvider
::
MapboxMapProvider
(
QString
mapName
,
quint32
averageSize
,
static
const
QString
MapBoxUrl
=
QStringLiteral
(
"https://api.mapbox.com/v4/%1/%2/%3/%4.jpg80?access_token=%5"
);
QGeoMapType
::
MapStyle
mapType
,
QObject
*
parent
)
MapboxMapProvider
::
MapboxMapProvider
(
const
QString
&
mapName
,
const
quint32
averageSize
,
const
QGeoMapType
::
MapStyle
mapType
,
QObject
*
parent
)
:
MapProvider
(
QString
(
"https://www.mapbox.com/"
),
QString
(
"jpg"
),
:
MapProvider
(
QStringLiteral
(
"https://www.mapbox.com/"
),
QStringLiteral
(
"jpg"
),
averageSize
,
mapType
,
parent
)
averageSize
,
mapType
,
parent
),
mapboxName
(
mapName
)
{
,
_mapboxName
(
mapName
)
{
}
}
QString
QString
MapboxMapProvider
::
_getURL
(
const
int
x
,
const
int
y
,
const
int
zoom
,
QNetworkAccessManager
*
networkManager
)
{
MapboxMapProvider
::
_getURL
(
int
x
,
int
y
,
int
zoom
,
Q_UNUSED
(
networkManager
)
QNetworkAccessManager
*
networkManager
)
{
const
QString
mapBoxToken
=
qgcApp
()
->
toolbox
()
->
settingsManager
()
->
appSettings
()
->
mapboxToken
()
->
rawValue
().
toString
();
Q_UNUSED
(
networkManager
);
QString
mapBoxToken
=
qgcApp
()
->
toolbox
()
->
settingsManager
()
->
appSettings
()
->
mapboxToken
()
->
rawValue
()
.
toString
();
if
(
!
mapBoxToken
.
isEmpty
())
{
if
(
!
mapBoxToken
.
isEmpty
())
{
QString
server
=
"https://api.mapbox.com/v4/"
;
return
MapBoxUrl
.
arg
(
_mapboxName
).
arg
(
zoom
).
arg
(
x
).
arg
(
y
).
arg
(
mapBoxToken
);
server
+=
mapboxName
;
server
+=
QString
(
"/%1/%2/%3.jpg80?access_token=%4"
)
.
arg
(
zoom
)
.
arg
(
x
)
.
arg
(
y
)
.
arg
(
mapBoxToken
);
return
server
;
}
}
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
#pragma once
#include "MapProvider.h"
#include "MapProvider.h"
#include <QByteArray>
static
const
quint32
AVERAGE_MAPBOX_SAT_MAP
=
15739
;
#include <QMutex>
static
const
quint32
AVERAGE_MAPBOX_STREET_MAP
=
5648
;
#include <QNetworkProxy>
#include <QNetworkReply>
#include <QPoint>
#include <QString>
const
quint32
AVERAGE_MAPBOX_SAT_MAP
=
15739
;
const
quint32
AVERAGE_MAPBOX_STREET_MAP
=
5648
;
class
MapboxMapProvider
:
public
MapProvider
{
class
MapboxMapProvider
:
public
MapProvider
{
Q_OBJECT
Q_OBJECT
public:
MapboxMapProvider
(
QString
mapName
,
quint32
averageSize
,
public:
QGeoMapType
::
MapStyle
mapType
,
QObject
*
parent
);
MapboxMapProvider
(
const
QString
&
mapName
,
const
quint32
averageSize
,
const
QGeoMapType
::
MapStyle
mapType
,
QObject
*
parent
=
nullptr
);
QString
_getURL
(
int
x
,
int
y
,
int
zoom
,
QNetworkAccessManager
*
networkManager
);
protected:
protected:
QString
_getURL
(
const
int
x
,
const
int
y
,
const
int
zoom
,
QNetworkAccessManager
*
networkManager
)
override
;
QString
mapboxName
;
QString
_mapboxName
;
};
};
class
MapboxStreetMapProvider
:
public
MapboxMapProvider
{
class
MapboxStreetMapProvider
:
public
MapboxMapProvider
{
Q_OBJECT
Q_OBJECT
public:
MapboxStreetMapProvider
(
QObject
*
parent
)
public:
:
MapboxMapProvider
(
"mapbox.streets"
,
AVERAGE_MAPBOX_STREET_MAP
,
MapboxStreetMapProvider
(
QObject
*
parent
=
nullptr
)
:
MapboxMapProvider
(
QStringLiteral
(
"mapbox.streets"
),
AVERAGE_MAPBOX_STREET_MAP
,
QGeoMapType
::
StreetMap
,
parent
)
{}
QGeoMapType
::
StreetMap
,
parent
)
{}
};
};
class
MapboxLightMapProvider
:
public
MapboxMapProvider
{
class
MapboxLightMapProvider
:
public
MapboxMapProvider
{
Q_OBJECT
Q_OBJECT
public:
MapboxLightMapProvider
(
QObject
*
parent
)
public:
:
MapboxMapProvider
(
"mapbox.light"
,
AVERAGE_TILE_SIZE
,
MapboxLightMapProvider
(
QObject
*
parent
=
nullptr
)
:
MapboxMapProvider
(
QStringLiteral
(
"mapbox.light"
),
AVERAGE_TILE_SIZE
,
QGeoMapType
::
CustomMap
,
parent
)
{}
QGeoMapType
::
CustomMap
,
parent
)
{}
};
};
class
MapboxDarkMapProvider
:
public
MapboxMapProvider
{
class
MapboxDarkMapProvider
:
public
MapboxMapProvider
{
Q_OBJECT
Q_OBJECT
public:
MapboxDarkMapProvider
(
QObject
*
parent
)
public:
:
MapboxMapProvider
(
"mapbox.dark"
,
AVERAGE_TILE_SIZE
,
MapboxDarkMapProvider
(
QObject
*
parent
=
nullptr
)
:
MapboxMapProvider
(
QStringLiteral
(
"mapbox.dark"
),
AVERAGE_TILE_SIZE
,
QGeoMapType
::
CustomMap
,
parent
)
{}
QGeoMapType
::
CustomMap
,
parent
)
{}
};
};
class
MapboxSatelliteMapProvider
:
public
MapboxMapProvider
{
class
MapboxSatelliteMapProvider
:
public
MapboxMapProvider
{
Q_OBJECT
Q_OBJECT
public:
MapboxSatelliteMapProvider
(
QObject
*
parent
)
public:
:
MapboxMapProvider
(
"mapbox.satellite"
,
AVERAGE_MAPBOX_SAT_MAP
,
MapboxSatelliteMapProvider
(
QObject
*
parent
=
nullptr
)
:
MapboxMapProvider
(
QStringLiteral
(
"mapbox.satellite"
),
AVERAGE_MAPBOX_SAT_MAP
,
QGeoMapType
::
SatelliteMapDay
,
parent
)
{}
QGeoMapType
::
SatelliteMapDay
,
parent
)
{}
};
};
class
MapboxHybridMapProvider
:
public
MapboxMapProvider
{
class
MapboxHybridMapProvider
:
public
MapboxMapProvider
{
Q_OBJECT
Q_OBJECT
public:
MapboxHybridMapProvider
(
QObject
*
parent
)
public:
:
MapboxMapProvider
(
"mapbox.hybrid"
,
AVERAGE_MAPBOX_SAT_MAP
,
MapboxHybridMapProvider
(
QObject
*
parent
=
nullptr
)
:
MapboxMapProvider
(
QStringLiteral
(
"mapbox.hybrid"
),
AVERAGE_MAPBOX_SAT_MAP
,
QGeoMapType
::
HybridMap
,
parent
)
{}
QGeoMapType
::
HybridMap
,
parent
)
{}
};
};
class
MapboxWheatPasteMapProvider
:
public
MapboxMapProvider
{
class
MapboxWheatPasteMapProvider
:
public
MapboxMapProvider
{
Q_OBJECT
Q_OBJECT
public:
MapboxWheatPasteMapProvider
(
QObject
*
parent
)
public:
:
MapboxMapProvider
(
"mapbox.wheatpaste"
,
AVERAGE_TILE_SIZE
,
MapboxWheatPasteMapProvider
(
QObject
*
parent
=
nullptr
)
:
MapboxMapProvider
(
QStringLiteral
(
"mapbox.wheatpaste"
),
AVERAGE_TILE_SIZE
,
QGeoMapType
::
CustomMap
,
parent
)
{}
QGeoMapType
::
CustomMap
,
parent
)
{}
};
};
class
MapboxStreetsBasicMapProvider
:
public
MapboxMapProvider
{
class
MapboxStreetsBasicMapProvider
:
public
MapboxMapProvider
{
Q_OBJECT
Q_OBJECT
public:
MapboxStreetsBasicMapProvider
(
QObject
*
parent
)
public:
:
MapboxMapProvider
(
"mapbox.streets-basic"
,
AVERAGE_TILE_SIZE
,
MapboxStreetsBasicMapProvider
(
QObject
*
parent
=
nullptr
)
:
MapboxMapProvider
(
QStringLiteral
(
"mapbox.streets-basic"
),
AVERAGE_TILE_SIZE
,
QGeoMapType
::
StreetMap
,
parent
)
{}
QGeoMapType
::
StreetMap
,
parent
)
{}
};
};
class
MapboxComicMapProvider
:
public
MapboxMapProvider
{
class
MapboxComicMapProvider
:
public
MapboxMapProvider
{
Q_OBJECT
Q_OBJECT
public:
MapboxComicMapProvider
(
QObject
*
parent
)
public:
:
MapboxMapProvider
(
"mapbox.comic"
,
AVERAGE_TILE_SIZE
,
MapboxComicMapProvider
(
QObject
*
parent
=
nullptr
)
:
MapboxMapProvider
(
QStringLiteral
(
"mapbox.comic"
),
AVERAGE_TILE_SIZE
,
QGeoMapType
::
CustomMap
,
parent
)
{}
QGeoMapType
::
CustomMap
,
parent
)
{}
};
};
class
MapboxOutdoorsMapProvider
:
public
MapboxMapProvider
{
class
MapboxOutdoorsMapProvider
:
public
MapboxMapProvider
{
Q_OBJECT
Q_OBJECT
public:
MapboxOutdoorsMapProvider
(
QObject
*
parent
)
public:
:
MapboxMapProvider
(
"mapbox.outdoors"
,
AVERAGE_TILE_SIZE
,
MapboxOutdoorsMapProvider
(
QObject
*
parent
=
nullptr
)
:
MapboxMapProvider
(
QStringLiteral
(
"mapbox.outdoors"
),
AVERAGE_TILE_SIZE
,
QGeoMapType
::
CustomMap
,
parent
)
{}
QGeoMapType
::
CustomMap
,
parent
)
{}
};
};
class
MapboxRunBikeHikeMapProvider
:
public
MapboxMapProvider
{
class
MapboxRunBikeHikeMapProvider
:
public
MapboxMapProvider
{
Q_OBJECT
Q_OBJECT
public:
MapboxRunBikeHikeMapProvider
(
QObject
*
parent
)
public:
:
MapboxMapProvider
(
"mapbox.run-bike-hike"
,
AVERAGE_MAPBOX_STREET_MAP
,
MapboxRunBikeHikeMapProvider
(
QObject
*
parent
=
nullptr
)
:
MapboxMapProvider
(
QStringLiteral
(
"mapbox.run-bike-hike"
),
AVERAGE_MAPBOX_STREET_MAP
,
QGeoMapType
::
CycleMap
,
parent
)
{}
QGeoMapType
::
CycleMap
,
parent
)
{}
};
};
class
MapboxPencilMapProvider
:
public
MapboxMapProvider
{
class
MapboxPencilMapProvider
:
public
MapboxMapProvider
{
Q_OBJECT
Q_OBJECT
public:
MapboxPencilMapProvider
(
QObject
*
parent
)
public:
:
MapboxMapProvider
(
"mapbox.pencil"
,
AVERAGE_TILE_SIZE
,
MapboxPencilMapProvider
(
QObject
*
parent
=
nullptr
)
:
MapboxMapProvider
(
QStringLiteral
(
"mapbox.pencil"
),
AVERAGE_TILE_SIZE
,
QGeoMapType
::
CustomMap
,
parent
)
{}
QGeoMapType
::
CustomMap
,
parent
)
{}
};
};
class
MapboxPiratesMapProvider
:
public
MapboxMapProvider
{
class
MapboxPiratesMapProvider
:
public
MapboxMapProvider
{
Q_OBJECT
Q_OBJECT
public:
MapboxPiratesMapProvider
(
QObject
*
parent
)
public:
:
MapboxMapProvider
(
"mapbox.pirates"
,
AVERAGE_TILE_SIZE
,
MapboxPiratesMapProvider
(
QObject
*
parent
=
nullptr
)
:
MapboxMapProvider
(
QStringLiteral
(
"mapbox.pirates"
),
AVERAGE_TILE_SIZE
,
QGeoMapType
::
CustomMap
,
parent
)
{}
QGeoMapType
::
CustomMap
,
parent
)
{}
};
};
class
MapboxEmeraldMapProvider
:
public
MapboxMapProvider
{
class
MapboxEmeraldMapProvider
:
public
MapboxMapProvider
{
Q_OBJECT
Q_OBJECT
public:
MapboxEmeraldMapProvider
(
QObject
*
parent
)
public:
:
MapboxMapProvider
(
"mapbox.emerald"
,
AVERAGE_TILE_SIZE
,
MapboxEmeraldMapProvider
(
QObject
*
parent
=
nullptr
)
:
MapboxMapProvider
(
QStringLiteral
(
"mapbox.emerald"
),
AVERAGE_TILE_SIZE
,
QGeoMapType
::
CustomMap
,
parent
)
{}
QGeoMapType
::
CustomMap
,
parent
)
{}
};
};
class
MapboxHighContrastMapProvider
:
public
MapboxMapProvider
{
class
MapboxHighContrastMapProvider
:
public
MapboxMapProvider
{
Q_OBJECT
Q_OBJECT
public:
MapboxHighContrastMapProvider
(
QObject
*
parent
)
public:
:
MapboxMapProvider
(
"mapbox.high-contrast"
,
AVERAGE_TILE_SIZE
,
MapboxHighContrastMapProvider
(
QObject
*
parent
=
nullptr
)
:
MapboxMapProvider
(
QStringLiteral
(
"mapbox.high-contrast"
),
AVERAGE_TILE_SIZE
,
QGeoMapType
::
CustomMap
,
parent
)
{}
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