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
eb341a6e
Commit
eb341a6e
authored
Aug 08, 2018
by
Gus Grubba
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update airmapd (fixes airspace crashes)
Added some basic color management for airspaces
parent
6c1fb389
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
76 additions
and
36 deletions
+76
-36
airspace.h
libs/airmapd/include/airmap/airspace.h
+3
-1
airspaces.h
libs/airmapd/include/airmap/airspaces.h
+1
-1
libairmap-qt.0.dylib
libs/airmapd/macOS/Qt.5.11.0/libairmap-qt.0.dylib
+0
-0
AirMapManager.cc
src/Airmap/AirMapManager.cc
+3
-3
AirMapRestrictionManager.cc
src/Airmap/AirMapRestrictionManager.cc
+41
-8
AirMapRestrictionManager.h
src/Airmap/AirMapRestrictionManager.h
+3
-1
AirspaceManager.cc
src/AirspaceManagement/AirspaceManager.cc
+1
-1
AirspaceRestriction.cc
src/AirspaceManagement/AirspaceRestriction.cc
+6
-5
AirspaceRestriction.h
src/AirspaceManagement/AirspaceRestriction.h
+14
-12
FlightDisplayViewMap.qml
src/FlightDisplay/FlightDisplayViewMap.qml
+2
-2
PlanView.qml
src/PlanView/PlanView.qml
+2
-2
No files found.
libs/airmapd/include/airmap/airspace.h
View file @
eb341a6e
...
...
@@ -48,7 +48,9 @@ class Airspace {
/// ControlledAirspace bundles up properties describing
/// a controlled airspace.
struct
ControlledAirspace
{};
struct
ControlledAirspace
{
std
::
string
airspace_classification
;
///< The classification of the ControlledAirspace.
};
/// SpecialUseAirspace bundles up properties describing
/// a special use airspace.
...
...
libs/airmapd/include/airmap/airspaces.h
View file @
eb341a6e
...
...
@@ -24,7 +24,7 @@ class Airspaces : DoNotCopyOrMove {
};
/// Result models the outcome of calling Airspaces::for_id.
using
Result
=
Outcome
<
std
::
vector
<
Airspace
>
,
Error
>
;
using
Result
=
Outcome
<
Airspace
,
Error
>
;
/// Callback describes the function signature of the callback that is
/// invoked when a call to Airspaces::for_id finishes.
using
Callback
=
std
::
function
<
void
(
const
Result
&
)
>
;
...
...
libs/airmapd/macOS/Qt.5.11.0/libairmap-qt.0.dylib
View file @
eb341a6e
No preview for this file type
src/Airmap/AirMapManager.cc
View file @
eb341a6e
...
...
@@ -43,9 +43,9 @@ AirMapManager::AirMapManager(QGCApplication* app, QGCToolbox* toolbox)
{
_logger
=
std
::
make_shared
<
qt
::
Logger
>
();
qt
::
register_types
();
// TODO: still needed?
_logger
->
logging_category
().
setEnabled
(
QtDebugMsg
,
tru
e
);
_logger
->
logging_category
().
setEnabled
(
QtInfoMsg
,
tru
e
);
_logger
->
logging_category
().
setEnabled
(
QtWarningMsg
,
tru
e
);
_logger
->
logging_category
().
setEnabled
(
QtDebugMsg
,
fals
e
);
_logger
->
logging_category
().
setEnabled
(
QtInfoMsg
,
fals
e
);
_logger
->
logging_category
().
setEnabled
(
QtWarningMsg
,
fals
e
);
_dispatchingLogger
=
std
::
make_shared
<
qt
::
DispatchingLogger
>
(
_logger
);
connect
(
&
_shared
,
&
AirMapSharedState
::
error
,
this
,
&
AirMapManager
::
_error
);
connect
(
&
_shared
,
&
AirMapSharedState
::
authStatus
,
this
,
&
AirMapManager
::
_authStatusChanged
);
...
...
src/Airmap/AirMapRestrictionManager.cc
View file @
eb341a6e
...
...
@@ -11,8 +11,6 @@
#include "AirMapManager.h"
#include "AirspaceRestriction.h"
#include "airmap/airspaces.h"
#define RESTRICTION_UPDATE_DISTANCE 500 //-- 500m threshold for updates
using
namespace
airmap
;
...
...
@@ -37,6 +35,40 @@ AirMapRestrictionManager::setROI(const QGCGeoBoundingCube& roi, bool reset)
}
}
//-----------------------------------------------------------------------------
QColor
AirMapRestrictionManager
::
_getColor
(
const
Airspace
::
Type
type
)
{
if
(
type
==
Airspace
::
Type
::
airport
)
return
QColor
(
254
,
65
,
65
,
30
);
if
(
type
==
Airspace
::
Type
::
controlled_airspace
)
return
QColor
(
254
,
158
,
65
,
60
);
if
(
type
==
Airspace
::
Type
::
special_use_airspace
)
return
QColor
(
65
,
230
,
254
,
30
);
if
(
type
==
Airspace
::
Type
::
tfr
)
return
QColor
(
95
,
230
,
254
,
30
);
if
(
type
==
Airspace
::
Type
::
wildfire
)
return
QColor
(
254
,
120
,
0
,
30
);
if
(
type
==
Airspace
::
Type
::
park
)
return
QColor
(
7
,
165
,
22
,
30
);
if
(
type
==
Airspace
::
Type
::
power_plant
)
return
QColor
(
11
,
7
,
165
,
30
);
if
(
type
==
Airspace
::
Type
::
heliport
)
return
QColor
(
233
,
57
,
57
,
30
);
if
(
type
==
Airspace
::
Type
::
prison
)
return
QColor
(
100
,
100
,
100
,
30
);
if
(
type
==
Airspace
::
Type
::
school
)
return
QColor
(
56
,
224
,
190
,
30
);
if
(
type
==
Airspace
::
Type
::
hospital
)
return
QColor
(
56
,
159
,
224
,
30
);
if
(
type
==
Airspace
::
Type
::
fire
)
return
QColor
(
223
,
83
,
10
,
30
);
if
(
type
==
Airspace
::
Type
::
emergency
)
return
QColor
(
255
,
0
,
0
,
30
);
return
QColor
(
255
,
0
,
255
,
30
);
}
//-----------------------------------------------------------------------------
void
AirMapRestrictionManager
::
_requestRestrictions
(
const
QGCGeoBoundingCube
&
roi
)
...
...
@@ -54,7 +86,7 @@ AirMapRestrictionManager::_requestRestrictions(const QGCGeoBoundingCube& roi)
_circles
.
clear
();
_state
=
State
::
RetrieveItems
;
Airspaces
::
Search
::
Parameters
params
;
params
.
full
=
tru
e
;
params
.
full
=
fals
e
;
params
.
date_time
=
Clock
::
universal_time
();
//-- Geometry: Polygon
Geometry
::
Polygon
polygon
;
...
...
@@ -74,23 +106,24 @@ AirMapRestrictionManager::_requestRestrictions(const QGCGeoBoundingCube& roi)
const
std
::
vector
<
Airspace
>&
airspaces
=
result
.
value
();
qCDebug
(
AirMapManagerLog
)
<<
"Successful search. Items:"
<<
airspaces
.
size
();
for
(
const
auto
&
airspace
:
airspaces
)
{
QColor
color
=
_getColor
(
airspace
.
type
());
const
Geometry
&
geometry
=
airspace
.
geometry
();
switch
(
geometry
.
type
())
{
case
Geometry
:
:
Type
::
polygon
:
{
const
Geometry
::
Polygon
&
polygon
=
geometry
.
details_for_polygon
();
_addPolygonToList
(
polygon
);
_addPolygonToList
(
polygon
,
color
);
}
break
;
case
Geometry
:
:
Type
::
multi_polygon
:
{
const
Geometry
::
MultiPolygon
&
multiPolygon
=
geometry
.
details_for_multi_polygon
();
for
(
const
auto
&
polygon
:
multiPolygon
)
{
_addPolygonToList
(
polygon
);
_addPolygonToList
(
polygon
,
color
);
}
}
break
;
case
Geometry
:
:
Type
::
point
:
{
const
Geometry
::
Point
&
point
=
geometry
.
details_for_point
();
_circles
.
append
(
new
AirspaceCircularRestriction
(
QGeoCoordinate
(
point
.
latitude
,
point
.
longitude
),
0.
));
_circles
.
append
(
new
AirspaceCircularRestriction
(
QGeoCoordinate
(
point
.
latitude
,
point
.
longitude
),
0.
,
color
));
// TODO: radius???
}
break
;
...
...
@@ -114,7 +147,7 @@ AirMapRestrictionManager::_requestRestrictions(const QGCGeoBoundingCube& roi)
//-----------------------------------------------------------------------------
void
AirMapRestrictionManager
::
_addPolygonToList
(
const
airmap
::
Geometry
::
Polygon
&
polygon
)
AirMapRestrictionManager
::
_addPolygonToList
(
const
airmap
::
Geometry
::
Polygon
&
polygon
,
const
QColor
color
)
{
QVariantList
polygonArray
;
for
(
const
auto
&
vertex
:
polygon
.
outer_ring
.
coordinates
)
{
...
...
@@ -126,7 +159,7 @@ AirMapRestrictionManager::_addPolygonToList(const airmap::Geometry::Polygon& pol
}
polygonArray
.
append
(
QVariant
::
fromValue
(
coord
));
}
_polygons
.
append
(
new
AirspacePolygonRestriction
(
polygonArray
));
_polygons
.
append
(
new
AirspacePolygonRestriction
(
polygonArray
,
color
));
if
(
polygon
.
inner_rings
.
size
()
>
0
)
{
// no need to support those (they are rare, and in most cases, there's a more restrictive polygon filling the hole)
qCDebug
(
AirMapManagerLog
)
<<
"Polygon with holes. Size: "
<<
polygon
.
inner_rings
.
size
();
...
...
src/Airmap/AirMapRestrictionManager.h
View file @
eb341a6e
...
...
@@ -18,6 +18,7 @@
#include <QGeoCoordinate>
#include "airmap/geometry.h"
#include "airmap/airspaces.h"
/**
* @file AirMapRestrictionManager.h
...
...
@@ -38,7 +39,8 @@ signals:
private:
void
_requestRestrictions
(
const
QGCGeoBoundingCube
&
roi
);
void
_addPolygonToList
(
const
airmap
::
Geometry
::
Polygon
&
polygon
);
void
_addPolygonToList
(
const
airmap
::
Geometry
::
Polygon
&
polygon
,
const
QColor
color
);
QColor
_getColor
(
const
airmap
::
Airspace
::
Type
type
);
enum
class
State
{
Idle
,
...
...
src/AirspaceManagement/AirspaceManager.cc
View file @
eb341a6e
...
...
@@ -117,7 +117,7 @@ AirspaceManager::_setROI(const QGCGeoBoundingCube& roi)
{
if
(
_roi
!=
roi
)
{
_roi
=
roi
;
_
ruleU
pdateTimer
.
start
();
_
u
pdateTimer
.
start
();
}
}
...
...
src/AirspaceManagement/AirspaceRestriction.cc
View file @
eb341a6e
...
...
@@ -9,20 +9,21 @@
#include "AirspaceRestriction.h"
AirspaceRestriction
::
AirspaceRestriction
(
QObject
*
parent
)
AirspaceRestriction
::
AirspaceRestriction
(
Q
Color
color
,
Q
Object
*
parent
)
:
QObject
(
parent
)
,
_color
(
color
)
{
}
AirspacePolygonRestriction
::
AirspacePolygonRestriction
(
const
QVariantList
&
polygon
,
QObject
*
parent
)
:
AirspaceRestriction
(
parent
)
AirspacePolygonRestriction
::
AirspacePolygonRestriction
(
const
QVariantList
&
polygon
,
Q
Color
color
,
Q
Object
*
parent
)
:
AirspaceRestriction
(
color
,
parent
)
,
_polygon
(
polygon
)
{
}
AirspaceCircularRestriction
::
AirspaceCircularRestriction
(
const
QGeoCoordinate
&
center
,
double
radius
,
QObject
*
parent
)
:
AirspaceRestriction
(
parent
)
AirspaceCircularRestriction
::
AirspaceCircularRestriction
(
const
QGeoCoordinate
&
center
,
double
radius
,
Q
Color
color
,
Q
Object
*
parent
)
:
AirspaceRestriction
(
color
,
parent
)
,
_center
(
center
)
,
_radius
(
radius
)
{
...
...
src/AirspaceManagement/AirspaceRestriction.h
View file @
eb341a6e
...
...
@@ -12,6 +12,7 @@
#include <QObject>
#include <QGeoCoordinate>
#include <QVariantList>
#include <QColor>
/**
* @class AirspaceRestriction
...
...
@@ -22,7 +23,11 @@ class AirspaceRestriction : public QObject
{
Q_OBJECT
public:
AirspaceRestriction
(
QObject
*
parent
=
nullptr
);
AirspaceRestriction
(
QColor
color
,
QObject
*
parent
=
nullptr
);
Q_PROPERTY
(
QColor
color
READ
color
CONSTANT
)
QColor
color
()
{
return
_color
;
}
protected:
QColor
_color
;
};
/**
...
...
@@ -34,12 +39,9 @@ class AirspacePolygonRestriction : public AirspaceRestriction
{
Q_OBJECT
public:
AirspacePolygonRestriction
(
const
QVariantList
&
polygon
,
QObject
*
parent
=
nullptr
);
Q_PROPERTY
(
QVariantList
polygon
MEMBER
_polygon
CONSTANT
)
const
QVariantList
&
getPolygon
()
const
{
return
_polygon
;
}
AirspacePolygonRestriction
(
const
QVariantList
&
polygon
,
QColor
color
,
QObject
*
parent
=
nullptr
);
Q_PROPERTY
(
QVariantList
polygon
READ
polygon
CONSTANT
)
QVariantList
polygon
()
{
return
_polygon
;
}
private:
QVariantList
_polygon
;
};
...
...
@@ -53,11 +55,11 @@ class AirspaceCircularRestriction : public AirspaceRestriction
{
Q_OBJECT
public:
AirspaceCircularRestriction
(
const
QGeoCoordinate
&
center
,
double
radius
,
QObject
*
parent
=
nullptr
);
Q_PROPERTY
(
QGeoCoordinate
center
MEMBER
_center
CONSTANT
)
Q
_PROPERTY
(
double
radius
MEMBER
_radius
CONSTANT
)
AirspaceCircularRestriction
(
const
QGeoCoordinate
&
center
,
double
radius
,
Q
Color
color
,
Q
Object
*
parent
=
nullptr
);
Q_PROPERTY
(
QGeoCoordinate
center
READ
center
CONSTANT
)
Q_PROPERTY
(
double
radius
READ
radius
CONSTANT
)
Q
GeoCoordinate
center
()
{
return
_center
;
}
double
radius
()
{
return
_radius
;
}
private:
QGeoCoordinate
_center
;
double
_radius
;
...
...
src/FlightDisplay/FlightDisplayViewMap.qml
View file @
eb341a6e
...
...
@@ -438,7 +438,7 @@ FlightMap {
delegate
:
MapCircle
{
center
:
object
.
center
radius
:
object
.
radius
color
:
Qt
.
rgba
(
0.94
,
0.87
,
0
,
0.15
)
color
:
object
.
color
border.color
:
Qt
.
rgba
(
1
,
1
,
1
,
0.85
)
}
}
...
...
@@ -447,7 +447,7 @@ FlightMap {
model
:
_airspaceEnabled
&&
QGroundControl
.
airspaceManager
.
airspaceVisible
?
QGroundControl
.
airspaceManager
.
airspaces
.
polygons
:
[]
delegate
:
MapPolygon
{
path
:
object
.
polygon
color
:
Qt
.
rgba
(
0.94
,
0.87
,
0
,
0.15
)
color
:
object
.
color
border.color
:
Qt
.
rgba
(
1
,
1
,
1
,
0.85
)
}
}
...
...
src/PlanView/PlanView.qml
View file @
eb341a6e
...
...
@@ -560,7 +560,7 @@ QGCView {
delegate
:
MapCircle
{
center
:
object
.
center
radius
:
object
.
radius
color
:
Qt
.
rgba
(
0.94
,
0.87
,
0
,
0.1
)
color
:
object
.
color
border.color
:
Qt
.
rgba
(
1
,
1
,
1
,
0.65
)
}
}
...
...
@@ -569,7 +569,7 @@ QGCView {
model
:
_airspaceEnabled
&&
QGroundControl
.
airspaceManager
.
airspaceVisible
?
QGroundControl
.
airspaceManager
.
airspaces
.
polygons
:
[]
delegate
:
MapPolygon
{
path
:
object
.
polygon
color
:
Qt
.
rgba
(
0.94
,
0.87
,
0
,
0.1
)
color
:
object
.
color
border.color
:
Qt
.
rgba
(
1
,
1
,
1
,
0.65
)
}
}
...
...
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