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
ac9fbc8a
Commit
ac9fbc8a
authored
Mar 21, 2018
by
Andreas Bircher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove deadlock and enable path queries
parent
f01cd04c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
7 deletions
+44
-7
TerrainQuery.cc
src/Terrain/TerrainQuery.cc
+38
-5
TerrainQuery.h
src/Terrain/TerrainQuery.h
+3
-2
TerrainTile.h
src/TerrainTile.h
+3
-0
No files found.
src/Terrain/TerrainQuery.cc
View file @
ac9fbc8a
...
...
@@ -237,12 +237,16 @@ void TerrainOfflineAirMapQuery::requestCoordinateHeights(const QList<QGeoCoordin
void
TerrainOfflineAirMapQuery
::
requestPathHeights
(
const
QGeoCoordinate
&
fromCoord
,
const
QGeoCoordinate
&
toCoord
)
{
// TODO
_terrainTileManager
->
addPathQuery
(
this
,
fromCoord
,
toCoord
);
}
void
TerrainOfflineAirMapQuery
::
requestCarpetHeights
(
const
QGeoCoordinate
&
swCoord
,
const
QGeoCoordinate
&
neCoord
,
bool
statsOnly
)
{
// TODO
Q_UNUSED
(
swCoord
);
Q_UNUSED
(
neCoord
);
Q_UNUSED
(
statsOnly
);
qWarning
()
<<
"Carpet queries are currently not supported from offline air map data"
;
}
void
TerrainOfflineAirMapQuery
::
_signalCoordinateHeights
(
bool
success
,
QList
<
double
>
heights
)
...
...
@@ -252,12 +256,12 @@ void TerrainOfflineAirMapQuery::_signalCoordinateHeights(bool success, QList<dou
void
TerrainOfflineAirMapQuery
::
_signalPathHeights
(
bool
success
,
double
latStep
,
double
lonStep
,
const
QList
<
double
>&
heights
)
{
// TODO
emit
pathHeights
(
success
,
latStep
,
lonStep
,
heights
);
}
void
TerrainOfflineAirMapQuery
::
_signalCarpetHeights
(
bool
success
,
double
minHeight
,
double
maxHeight
,
const
QList
<
QList
<
double
>>&
carpet
)
{
// TODO
emit
carpetHeights
(
success
,
minHeight
,
maxHeight
,
carpet
);
}
TerrainTileManager
::
TerrainTileManager
(
void
)
...
...
@@ -271,7 +275,7 @@ void TerrainTileManager::addCoordinateQuery(TerrainOfflineAirMapQuery* terrainQu
QList
<
double
>
altitudes
;
if
(
!
_getAltitudesForCoordinates
(
coordinates
,
altitudes
))
{
QueuedRequestInfo_t
queuedRequestInfo
=
{
terrainQueryInterface
,
coordinates
,
QueryMode
::
QueryModeC
oordinates
};
QueuedRequestInfo_t
queuedRequestInfo
=
{
terrainQueryInterface
,
QueryMode
::
QueryModeCoordinates
,
c
oordinates
};
_requestQueue
.
append
(
queuedRequestInfo
);
return
;
}
...
...
@@ -281,6 +285,35 @@ void TerrainTileManager::addCoordinateQuery(TerrainOfflineAirMapQuery* terrainQu
}
}
void
TerrainTileManager
::
addPathQuery
(
TerrainOfflineAirMapQuery
*
terrainQueryInterface
,
const
QGeoCoordinate
&
startPoint
,
const
QGeoCoordinate
&
endPoint
)
{
QList
<
QGeoCoordinate
>
coordinates
;
double
lat
=
startPoint
.
latitude
();
double
lon
=
startPoint
.
longitude
();
double
latDiff
=
endPoint
.
latitude
()
-
lat
;
double
lonDiff
=
endPoint
.
longitude
()
-
lon
;
double
steps
=
ceil
(
endPoint
.
distanceTo
(
startPoint
)
/
TerrainTile
::
terrainAltitudeSpacing
);
for
(
double
i
=
0.0
;
i
<=
steps
;
i
=
i
+
1
)
{
coordinates
.
append
(
QGeoCoordinate
(
lat
+
latDiff
*
i
/
steps
,
lon
+
lonDiff
*
i
/
steps
));
}
QList
<
double
>
altitudes
;
if
(
!
_getAltitudesForCoordinates
(
coordinates
,
altitudes
))
{
QueuedRequestInfo_t
queuedRequestInfo
=
{
terrainQueryInterface
,
QueryMode
::
QueryModePath
,
coordinates
};
_requestQueue
.
append
(
queuedRequestInfo
);
return
;
}
qCDebug
(
TerrainQueryLog
)
<<
"All altitudes taken from cached data"
;
double
stepLat
=
0
;
double
stepLon
=
0
;
if
(
coordinates
.
count
()
>
1
)
{
stepLat
=
coordinates
[
1
].
latitude
()
-
coordinates
[
0
].
latitude
();
stepLon
=
coordinates
[
1
].
longitude
()
-
coordinates
[
0
].
longitude
();
}
terrainQueryInterface
->
_signalPathHeights
(
coordinates
.
count
()
==
altitudes
.
count
(),
stepLat
,
stepLon
,
altitudes
);
}
bool
TerrainTileManager
::
_getAltitudesForCoordinates
(
const
QList
<
QGeoCoordinate
>&
coordinates
,
QList
<
double
>&
altitudes
)
{
foreach
(
const
QGeoCoordinate
&
coordinate
,
coordinates
)
{
...
...
@@ -457,8 +490,8 @@ void TerrainAtCoordinateBatchManager::_sendNextBatch(void)
}
_requestQueue
.
clear
();
_terrainQuery
.
requestCoordinateHeights
(
coords
);
_state
=
State
::
Downloading
;
_terrainQuery
.
requestCoordinateHeights
(
coords
);
}
void
TerrainAtCoordinateBatchManager
::
_batchFailed
(
void
)
...
...
src/Terrain/TerrainQuery.h
View file @
ac9fbc8a
...
...
@@ -114,7 +114,8 @@ class TerrainTileManager : public QObject {
public:
TerrainTileManager
(
void
);
void
addCoordinateQuery
(
TerrainOfflineAirMapQuery
*
terrainQueryInterface
,
const
QList
<
QGeoCoordinate
>&
coordinates
);
void
addCoordinateQuery
(
TerrainOfflineAirMapQuery
*
terrainQueryInterface
,
const
QList
<
QGeoCoordinate
>&
coordinates
);
void
addPathQuery
(
TerrainOfflineAirMapQuery
*
terrainQueryInterface
,
const
QGeoCoordinate
&
startPoint
,
const
QGeoCoordinate
&
endPoint
);
private
slots
:
void
_fetchedTile
(
void
);
/// slot to handle fetched elevation tiles
...
...
@@ -133,8 +134,8 @@ private:
typedef
struct
{
TerrainOfflineAirMapQuery
*
terrainQueryInterface
;
QList
<
QGeoCoordinate
>
coordinates
;
QueryMode
queryMode
;
QList
<
QGeoCoordinate
>
coordinates
;
}
QueuedRequestInfo_t
;
void
_tileFailed
(
void
);
...
...
src/TerrainTile.h
View file @
ac9fbc8a
...
...
@@ -77,6 +77,9 @@ public:
*/
QGeoCoordinate
centerCoordinate
(
void
)
const
;
/// Approximate spacing of the elevation data measurement points
static
constexpr
double
terrainAltitudeSpacing
=
30
.
0
;
private:
inline
int
_latToDataIndex
(
double
latitude
)
const
;
inline
int
_lonToDataIndex
(
double
longitude
)
const
;
...
...
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