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
7b00e7a3
Commit
7b00e7a3
authored
Mar 19, 2018
by
Sebastian Verling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
first implementation of binary representation of elevation data
parent
612d219d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
20 deletions
+18
-20
QGeoMapReplyQGC.cpp
src/QtLocationPlugin/QGeoMapReplyQGC.cpp
+4
-12
TerrainTile.cc
src/TerrainTile.cc
+9
-3
TerrainTile.h
src/TerrainTile.h
+5
-5
No files found.
src/QtLocationPlugin/QGeoMapReplyQGC.cpp
View file @
7b00e7a3
...
...
@@ -52,9 +52,6 @@
#include <QtNetwork/QNetworkAccessManager>
#include <QFile>
#include "TerrainTile.h"
#include <QJsonDocument>
#include <QJsonObject>
#include <QJsonArray>
int
QGeoTiledMapReplyQGC
::
_requestCount
=
0
;
...
...
@@ -129,18 +126,13 @@ QGeoTiledMapReplyQGC::networkReplyFinished()
// convert "a" to binary in case we have elevation data
if
((
UrlFactory
::
MapType
)
tileSpec
().
mapId
()
==
UrlFactory
::
MapType
::
AirmapElevation
)
{
QJsonParseError
parseError
;
QJsonDocument
json
=
QJsonDocument
::
fromJson
(
a
,
&
parseError
);
if
(
parseError
.
error
!=
QJsonParseError
::
NoError
)
{
a
=
TerrainTile
::
serialize
(
a
);
if
(
a
.
isEmpty
()
)
{
emit
aborted
();
return
;
}
else
{
a
=
TerrainTile
::
serialize
(
json
);
if
(
a
.
isEmpty
())
{
emit
aborted
();
return
;
}
}
}
setMapImageData
(
a
);
if
(
!
format
.
isEmpty
())
{
...
...
src/TerrainTile.cc
View file @
7b00e7a3
...
...
@@ -111,11 +111,17 @@ QGeoCoordinate TerrainTile::centerCoordinate(void) const
return
_southWest
.
atDistanceAndAzimuth
(
_southWest
.
distanceTo
(
_northEast
)
/
2.0
,
_southWest
.
azimuthTo
(
_northEast
));
}
QByteArray
TerrainTile
::
serialize
(
Q
JsonDocument
documen
t
)
QByteArray
TerrainTile
::
serialize
(
Q
ByteArray
inpu
t
)
{
QJsonParseError
parseError
;
QJsonDocument
document
=
QJsonDocument
::
fromJson
(
input
,
&
parseError
);
if
(
parseError
.
error
!=
QJsonParseError
::
NoError
)
{
QByteArray
emptyArray
;
return
emptyArray
;
}
QByteArray
byteArray
;
QIODevice
::
OpenMode
writeonly
=
QIODevice
::
WriteOnly
;
QDataStream
stream
(
&
byteArray
,
writeonly
);
QDataStream
stream
(
&
byteArray
,
QIODevice
::
WriteOnly
);
if
(
!
document
.
isObject
())
{
qCDebug
(
TerrainTileLog
)
<<
"Terrain tile json doc is no object"
;
QByteArray
emptyArray
;
...
...
src/TerrainTile.h
View file @
7b00e7a3
...
...
@@ -89,7 +89,7 @@ public:
*
* @return serialized data
*/
static
QByteArray
serialize
(
Q
JsonDocument
documen
t
);
static
QByteArray
serialize
(
Q
ByteArray
inpu
t
);
private:
inline
int
_latToDataIndex
(
double
latitude
)
const
;
...
...
@@ -98,11 +98,11 @@ private:
QGeoCoordinate
_southWest
;
/// South west corner of the tile
QGeoCoordinate
_northEast
;
/// North east corner of the tile
int
_minElevation
;
/// Minimum elevation in tile
int
_maxElevation
;
/// Maximum elevation in tile
double
_avgElevation
;
/// Average elevation of the tile
int
_minElevation
;
/// Minimum elevation in tile
int
_maxElevation
;
/// Maximum elevation in tile
double
_avgElevation
;
/// Average elevation of the tile
double
**
_data
;
/// 2D elevation data array
double
**
_data
;
/// 2D elevation data array
int
_gridSizeLat
;
/// data grid size in latitude direction
int
_gridSizeLon
;
/// data grid size in longitude direction
bool
_isValid
;
/// data loaded is valid
...
...
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