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
587df7a2
Commit
587df7a2
authored
Jun 13, 2017
by
Beat Küng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
GeoFenceManager: upload AirMap polygons
This is just to test, will need much better integration
parent
ca2c3722
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
0 deletions
+31
-0
AirMapManager.h
src/MissionManager/AirMapManager.h
+2
-0
GeoFenceManager.cc
src/MissionManager/GeoFenceManager.cc
+27
-0
GeoFenceManager.h
src/MissionManager/GeoFenceManager.h
+2
-0
No files found.
src/MissionManager/AirMapManager.h
View file @
587df7a2
...
...
@@ -40,6 +40,8 @@ public:
Q_PROPERTY
(
QVariantList
polygon
MEMBER
_polygon
CONSTANT
)
const
QVariantList
&
getPolygon
()
const
{
return
_polygon
;
}
private:
QVariantList
_polygon
;
};
...
...
src/MissionManager/GeoFenceManager.cc
View file @
587df7a2
...
...
@@ -11,6 +11,7 @@
#include "Vehicle.h"
#include "QmlObjectListModel.h"
#include "ParameterManager.h"
#include "QGCApplication.h"
#include "QGCMapPolygon.h"
#include "QGCMapCircle.h"
...
...
@@ -20,6 +21,7 @@ GeoFenceManager::GeoFenceManager(Vehicle* vehicle)
:
_vehicle
(
vehicle
)
,
_planManager
(
vehicle
,
MAV_MISSION_TYPE_FENCE
)
,
_firstParamLoadComplete
(
false
)
,
_airmapManager
(
qgcApp
()
->
toolbox
()
->
airMapManager
())
{
connect
(
&
_planManager
,
&
PlanManager
::
inProgressChanged
,
this
,
&
GeoFenceManager
::
inProgressChanged
);
connect
(
&
_planManager
,
&
PlanManager
::
error
,
this
,
&
GeoFenceManager
::
error
);
...
...
@@ -99,6 +101,31 @@ void GeoFenceManager::sendToVehicle(const QGeoCoordinate& breachReturn,
fenceItems
.
append
(
item
);
}
// send AirMap polygons
const
QmlObjectListModel
&
airmapPolygons
=
*
_airmapManager
->
polygonRestrictions
();
for
(
int
i
=
0
;
i
<
airmapPolygons
.
count
();
++
i
)
{
PolygonAirspaceRestriction
*
polygon
=
(
PolygonAirspaceRestriction
*
)
airmapPolygons
[
i
];
int
polygonCount
=
polygon
->
getPolygon
().
count
()
-
1
;
// last vertex is equal to the first
for
(
int
j
=
0
;
j
<
polygonCount
;
++
j
)
{
const
QGeoCoordinate
&
vertex
=
polygon
->
getPolygon
()[
j
].
value
<
QGeoCoordinate
>
();
MissionItem
*
item
=
new
MissionItem
(
0
,
MAV_CMD_NAV_FENCE_POLYGON_VERTEX_EXCLUSION
,
MAV_FRAME_GLOBAL
,
polygonCount
,
// vertex count
0
,
0
,
0
,
// param 2-4 unused
vertex
.
latitude
(),
vertex
.
longitude
(),
0
,
// param 7 unused
false
,
// autocontinue
false
,
// isCurrentItem
this
);
// parent
fenceItems
.
append
(
item
);
}
}
// TODO: circles too
_planManager
.
writeMissionItems
(
fenceItems
);
for
(
int
i
=
0
;
i
<
fenceItems
.
count
();
i
++
)
{
...
...
src/MissionManager/GeoFenceManager.h
View file @
587df7a2
...
...
@@ -13,6 +13,7 @@
#include <QObject>
#include <QGeoCoordinate>
#include "AirMapManager.h"
#include "QGCLoggingCategory.h"
#include "FactSystem.h"
#include "PlanManager.h"
...
...
@@ -96,6 +97,7 @@ private:
bool
_firstParamLoadComplete
;
QList
<
QGCFencePolygon
>
_sendPolygons
;
QList
<
QGCFenceCircle
>
_sendCircles
;
AirMapManager
*
_airmapManager
;
};
#endif
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