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
b98f08d7
Commit
b98f08d7
authored
Nov 10, 2017
by
Beat Küng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
AirMapManager: handle multi_polygon
parent
44a05ab6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
20 deletions
+28
-20
AirMapManager.cc
src/MissionManager/AirMapManager.cc
+26
-20
AirMapManager.h
src/MissionManager/AirMapManager.h
+2
-0
No files found.
src/MissionManager/AirMapManager.cc
View file @
b98f08d7
...
...
@@ -162,36 +162,21 @@ void AirMapRestrictionManager::setROI(const QGeoCoordinate& center, double radiu
if
(
result
)
{
const
std
::
vector
<
Airspace
>&
airspaces
=
result
.
value
();
qCDebug
(
AirMapManagerLog
)
<<
"Successful search
:
"
<<
airspaces
.
size
();
qCDebug
(
AirMapManagerLog
)
<<
"Successful search
. Items:
"
<<
airspaces
.
size
();
for
(
const
auto
&
airspace
:
airspaces
)
{
const
Geometry
&
geometry
=
airspace
.
geometry
();
switch
(
geometry
.
type
())
{
case
Geometry
:
:
Type
::
polygon
:
{
const
Geometry
::
Polygon
&
polygon
=
geometry
.
details_for_polygon
();
QVariantList
polygonArray
;
if
(
polygon
.
size
()
==
1
)
{
for
(
const
auto
&
vertex
:
polygon
[
0
].
coordinates
)
{
QGeoCoordinate
coord
;
if
(
vertex
.
altitude
)
{
coord
=
QGeoCoordinate
(
vertex
.
latitude
,
vertex
.
longitude
,
vertex
.
altitude
.
get
());
}
else
{
coord
=
QGeoCoordinate
(
vertex
.
latitude
,
vertex
.
longitude
);
}
polygonArray
.
append
(
QVariant
::
fromValue
(
coord
));
}
_polygonList
.
append
(
new
PolygonAirspaceRestriction
(
polygonArray
));
}
else
{
// TODO: support that?
qWarning
()
<<
"Empty polygon, or Polygon with holes. Size: "
<<
polygon
.
size
();
}
_addPolygonToList
(
polygon
,
_polygonList
);
}
break
;
case
Geometry
:
:
Type
::
multi_polygon
:
{
const
Geometry
::
MultiPolygon
&
multiPolygon
=
geometry
.
details_for_multi_polygon
();
qWarning
()
<<
"multi polygon "
<<
multiPolygon
.
size
();
// TODO
for
(
const
auto
&
polygon
:
multiPolygon
)
{
_addPolygonToList
(
polygon
,
_polygonList
);
}
}
break
;
case
Geometry
:
:
Type
::
point
:
{
...
...
@@ -220,6 +205,27 @@ void AirMapRestrictionManager::setROI(const QGeoCoordinate& center, double radiu
});
}
void
AirMapRestrictionManager
::
_addPolygonToList
(
const
airmap
::
Geometry
::
Polygon
&
polygon
,
QList
<
PolygonAirspaceRestriction
*>&
list
)
{
QVariantList
polygonArray
;
if
(
polygon
.
size
()
==
1
)
{
for
(
const
auto
&
vertex
:
polygon
[
0
].
coordinates
)
{
QGeoCoordinate
coord
;
if
(
vertex
.
altitude
)
{
coord
=
QGeoCoordinate
(
vertex
.
latitude
,
vertex
.
longitude
,
vertex
.
altitude
.
get
());
}
else
{
coord
=
QGeoCoordinate
(
vertex
.
latitude
,
vertex
.
longitude
);
}
polygonArray
.
append
(
QVariant
::
fromValue
(
coord
));
}
list
.
append
(
new
PolygonAirspaceRestriction
(
polygonArray
));
}
else
{
// TODO: support that?
qWarning
()
<<
"Empty polygon, or Polygon with holes. Size: "
<<
polygon
.
size
();
}
}
AirMapFlightManager
::
AirMapFlightManager
(
AirMapSharedState
&
shared
)
:
_shared
(
shared
)
{
...
...
src/MissionManager/AirMapManager.h
View file @
b98f08d7
...
...
@@ -109,6 +109,8 @@ signals:
private:
static
void
_addPolygonToList
(
const
airmap
::
Geometry
::
Polygon
&
polygon
,
QList
<
PolygonAirspaceRestriction
*>&
list
);
enum
class
State
{
Idle
,
RetrieveItems
,
...
...
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