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
4feba023
Commit
4feba023
authored
Feb 27, 2018
by
Gus Grubba
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WIP Flight List Management
parent
a39013e9
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
360 additions
and
37 deletions
+360
-37
AirMapFlightPlanManager.cc
src/Airmap/AirMapFlightPlanManager.cc
+2
-2
AirMapFlightPlanManager.h
src/Airmap/AirMapFlightPlanManager.h
+5
-5
AirmapSettings.qml
src/Airmap/AirmapSettings.qml
+223
-22
AirspaceFlightPlanProvider.cc
src/AirspaceManagement/AirspaceFlightPlanProvider.cc
+86
-0
AirspaceFlightPlanProvider.h
src/AirspaceManagement/AirspaceFlightPlanProvider.h
+44
-8
No files found.
src/Airmap/AirMapFlightPlanManager.cc
View file @
4feba023
...
...
@@ -658,7 +658,7 @@ AirMapFlightPlanManager::loadFlightList()
void
AirMapFlightPlanManager
::
_loadFlightList
()
{
_flightList
.
clear
AndDeleteContents
();
_flightList
.
clear
();
emit
flightListChanged
();
_state
=
State
::
LoadFlightList
;
std
::
weak_ptr
<
LifetimeChecker
>
isAlive
(
_instance
);
...
...
@@ -667,7 +667,7 @@ AirMapFlightPlanManager::_loadFlightList()
if
(
_state
!=
State
::
LoadFlightList
)
return
;
Flights
::
Search
::
Parameters
params
;
params
.
authorization
=
login_token
.
toStdString
();
params
.
limit
=
20
0
;
params
.
limit
=
6
0
;
params
.
pilot_id
=
_pilotID
.
toStdString
();
_shared
.
client
()
->
flights
().
search
(
params
,
[
this
,
isAlive
](
const
Flights
::
Search
::
Result
&
result
)
{
if
(
!
isAlive
.
lock
())
return
;
...
...
src/Airmap/AirMapFlightPlanManager.h
View file @
4feba023
...
...
@@ -29,9 +29,9 @@ class AirMapFlightInfo : public AirspaceFlightInfo
public:
AirMapFlightInfo
(
const
airmap
::
Flight
&
flight
,
QObject
*
parent
=
nullptr
);
virtual
QString
flightID
()
override
{
return
QString
::
fromStdString
(
_flight
.
id
);
}
virtual
Q
DateTime
createdTime
()
override
{
return
QDateTime
(
);
}
//-- TODO: Need to get rid of boost first
virtual
Q
DateTime
startTime
()
override
{
return
QDateTime
(
);
}
//-- TODO: Need to get rid of boost first
virtual
Q
DateTime
endTime
()
override
{
return
QDateTime
(
);
}
//-- TODO: Need to get rid of boost first
virtual
Q
String
createdTime
()
override
{
return
QDateTime
::
currentDateTime
().
toString
(
Qt
::
SystemLocaleShortDate
);
}
//-- TODO: Need to get rid of boost first
virtual
Q
String
startTime
()
override
{
return
QDateTime
::
currentDateTime
().
toString
(
Qt
::
SystemLocaleShortDate
);
}
//-- TODO: Need to get rid of boost first
virtual
Q
String
endTime
()
override
{
return
QDateTime
::
currentDateTime
().
toString
(
Qt
::
SystemLocaleShortDate
);
}
//-- TODO: Need to get rid of boost first
virtual
QGeoCoordinate
takeOff
()
override
{
return
QGeoCoordinate
(
_flight
.
latitude
,
_flight
.
longitude
);}
virtual
QmlObjectListModel
*
boundingBox
()
override
{
return
&
_boundingBox
;
}
private:
...
...
@@ -64,7 +64,7 @@ public:
QmlObjectListModel
*
rulesReview
()
override
{
return
&
_rulesReview
;
}
QmlObjectListModel
*
rulesFollowing
()
override
{
return
&
_rulesFollowing
;
}
QmlObjectListModel
*
briefFeatures
()
override
{
return
&
_briefFeatures
;
}
QmlObjectListModel
*
flightList
()
override
{
return
&
_flightList
;
}
AirspaceFlightModel
*
flightList
()
override
{
return
&
_flightList
;
}
void
updateFlightPlan
()
override
;
void
submitFlightPlan
()
override
;
...
...
@@ -131,7 +131,7 @@ private:
QmlObjectListModel
_rulesReview
;
QmlObjectListModel
_rulesFollowing
;
QmlObjectListModel
_briefFeatures
;
QmlObjectListModel
_flightList
;
AirspaceFlightModel
_flightList
;
AirspaceAdvisoryProvider
::
AdvisoryColor
_airspaceColor
;
AirspaceFlightPlanProvider
::
PermitStatus
_flightPermitStatus
=
AirspaceFlightPlanProvider
::
PermitNone
;
...
...
src/Airmap/AirmapSettings.qml
View file @
4feba023
...
...
@@ -8,21 +8,25 @@
****************************************************************************/
import
QtGraphicalEffects
1.0
import
QtMultimedia
5.5
import
QtQuick
2.3
import
QtQuick
.
Controls
1.2
import
QtQuick
.
Controls
.
Styles
1.4
import
QtQuick
.
Dialogs
1.2
import
QtMultimedia
5.5
import
QtQuick
.
Layouts
1.2
import
QtLocation
5.3
import
QtPositioning
5.3
import
QGroundControl
1.0
import
QGroundControl
.
FactSystem
1.0
import
QGroundControl
.
FactControls
1.0
import
QGroundControl
.
Controllers
1.0
import
QGroundControl
.
Controls
1.0
import
QGroundControl
.
ScreenTools
1.0
import
QGroundControl
.
FactControls
1.0
import
QGroundControl
.
FactSystem
1.0
import
QGroundControl
.
FlightMap
1.0
import
QGroundControl
.
MultiVehicleManager
1.0
import
QGroundControl
.
Palette
1.0
import
QGroundControl
.
Controller
s
1.0
import
QGroundControl
.
ScreenTool
s
1.0
import
QGroundControl
.
SettingsManager
1.0
QGCView
{
...
...
@@ -34,6 +38,7 @@ QGCView {
property
real
_labelWidth
:
ScreenTools
.
defaultFontPixelWidth
*
20
property
real
_editFieldWidth
:
ScreenTools
.
defaultFontPixelWidth
*
30
property
real
_buttonWidth
:
ScreenTools
.
defaultFontPixelWidth
*
18
property
real
_panelWidth
:
_qgcView
.
width
*
_internalWidthRatio
property
Fact
_enableAirMapFact
:
QGroundControl
.
settingsManager
.
airMapSettings
.
enableAirMap
property
bool
_airMapEnabled
:
_enableAirMapFact
.
rawValue
...
...
@@ -238,35 +243,231 @@ QGCView {
anchors.horizontalCenter
:
parent
.
horizontalCenter
visible
:
QGroundControl
.
settingsManager
.
appSettings
.
visible
QGCLabel
{
id
:
flightListLabel
text
:
qsTr
(
"
Flight List
"
)
font.family
:
ScreenTools
.
demiboldFontFamily
}
Component.onCompleted
:
{
QGroundControl
.
airspaceManager
.
flightPlan
.
loadFlightList
()
id
:
flightListLabel
text
:
qsTr
(
"
Flight List Management
"
)
font.family
:
ScreenTools
.
demiboldFontFamily
}
}
Rectangle
{
height
:
flight
Col
.
height
+
(
ScreenTools
.
defaultFontPixelHeight
*
2
)
height
:
flight
ListButton
.
height
+
(
ScreenTools
.
defaultFontPixelHeight
*
2
)
width
:
_panelWidth
color
:
qgcPal
.
windowShade
anchors.margins
:
ScreenTools
.
defaultFontPixelWidth
anchors.horizontalCenter
:
parent
.
horizontalCenter
QGCButton
{
id
:
flightListButton
text
:
qsTr
(
"
Show Flight List
"
)
backRadius
:
4
heightFactor
:
0.3333
showBorder
:
true
width
:
ScreenTools
.
defaultFontPixelWidth
*
16
anchors.centerIn
:
parent
onClicked
:
{
panelLoader
.
sourceComponent
=
flightList
}
}
}
}
}
Loader
{
id
:
panelLoader
anchors.centerIn
:
parent
}
}
//---------------------------------------------------------------
//-- Flight List
Component
{
id
:
flightList
Rectangle
{
id
:
flightListRoot
width
:
_qgcView
.
width
height
:
_qgcView
.
height
color
:
qgcPal
.
window
property
var
_flightList
:
QGroundControl
.
airspaceManager
.
flightPlan
.
flightList
Component.onCompleted
:
{
QGroundControl
.
airspaceManager
.
flightPlan
.
loadFlightList
()
}
Connections
{
target
:
_flightList
onCountChanged
:
{
tableView
.
resizeColumnsToContents
()
}
}
MouseArea
{
anchors.fill
:
parent
hoverEnabled
:
true
onWheel
:
{
wheel
.
accepted
=
true
;
}
onPressed
:
{
mouse
.
accepted
=
true
;
}
onReleased
:
{
mouse
.
accepted
=
true
;
}
}
//---------------------------------------------------------
//-- Flight List
RowLayout
{
anchors.fill
:
parent
TableView
{
id
:
tableView
anchors.top
:
parent
.
top
anchors.bottom
:
parent
.
bottom
model
:
_flightList
selectionMode
:
SelectionMode
.
MultiSelection
Layout.fillWidth
:
true
TableViewColumn
{
title
:
qsTr
(
"
Created
"
)
width
:
ScreenTools
.
defaultFontPixelWidth
*
20
horizontalAlignment
:
Text
.
AlignHCenter
delegate
:
Text
{
horizontalAlignment
:
Text
.
AlignHCenter
text
:
{
var
o
=
_flightList
.
get
(
styleData
.
row
)
return
o
?
o
.
createdTime
:
""
}
}
}
TableViewColumn
{
title
:
qsTr
(
"
Flight Start
"
)
width
:
ScreenTools
.
defaultFontPixelWidth
*
20
horizontalAlignment
:
Text
.
AlignHCenter
delegate
:
Text
{
horizontalAlignment
:
Text
.
AlignHCenter
text
:
{
var
o
=
_flightList
.
get
(
styleData
.
row
)
return
o
?
o
.
startTime
:
""
}
}
}
TableViewColumn
{
title
:
qsTr
(
"
Take Off
"
)
width
:
ScreenTools
.
defaultFontPixelWidth
*
22
horizontalAlignment
:
Text
.
AlignHCenter
delegate
:
Text
{
horizontalAlignment
:
Text
.
AlignHCenter
text
:
{
var
o
=
_flightList
.
get
(
styleData
.
row
)
return
o
?
o
.
takeOff
.
latitude
.
toFixed
(
6
)
+
'
,
'
+
o
.
takeOff
.
longitude
.
toFixed
(
6
)
:
""
}
}
}
}
Item
{
width
:
map
.
width
height
:
parent
.
height
Layout.alignment
:
Qt
.
AlignTop
|
Qt
.
AlignLeft
Column
{
id
:
flightCol
spacing
:
ScreenTools
.
defaultFontPixelHeight
anchors.centerIn
:
parent
Repeater
{
model
:
QGroundControl
.
airspaceManager
.
flightPlan
.
flightList
Row
{
spacing
:
ScreenTools
.
defaultFontPixelWidth
QGCCheckBox
{
text
:
object
.
flightID
checked
:
object
.
selected
onClicked
:
object
.
selected
=
checked
anchors.top
:
parent
.
top
anchors.horizontalCenter
:
parent
.
horizontalCenter
QGCLabel
{
text
:
qsTr
(
"
Flight List
"
)
anchors.horizontalCenter
:
parent
.
horizontalCenter
}
QGCButton
{
text
:
qsTr
(
"
Refresh
"
)
backRadius
:
4
heightFactor
:
0.3333
showBorder
:
true
width
:
_buttonWidth
enabled
:
true
anchors.horizontalCenter
:
parent
.
horizontalCenter
onClicked
:
{
QGroundControl
.
airspaceManager
.
flightPlan
.
loadFlightList
()
}
}
QGCButton
{
text
:
qsTr
(
"
Select All
"
)
backRadius
:
4
heightFactor
:
0.3333
showBorder
:
true
width
:
_buttonWidth
enabled
:
_flightList
.
count
>
0
anchors.horizontalCenter
:
parent
.
horizontalCenter
onClicked
:
{
tableView
.
selection
.
selectAll
()
}
}
QGCButton
{
text
:
qsTr
(
"
Select None
"
)
backRadius
:
4
heightFactor
:
0.3333
showBorder
:
true
width
:
_buttonWidth
enabled
:
_flightList
.
count
>
0
anchors.horizontalCenter
:
parent
.
horizontalCenter
onClicked
:
{
tableView
.
selection
.
clear
()
}
}
QGCButton
{
text
:
qsTr
(
"
Delete Selected
"
)
backRadius
:
4
heightFactor
:
0.3333
showBorder
:
true
width
:
_buttonWidth
enabled
:
false
anchors.horizontalCenter
:
parent
.
horizontalCenter
onClicked
:
{
//-- Clear selection
for
(
var
i
=
0
;
i
<
_flightList
.
count
;
i
++
)
{
var
o
=
_flightList
.
get
(
i
)
if
(
o
)
o
.
selected
=
false
}
//-- Flag selected flights
tableView
.
selection
.
forEach
(
function
(
rowIndex
){
var
o
=
_flightList
.
get
(
rowIndex
)
if
(
o
)
o
.
selected
=
true
})
//TODO:
}
}
QGCButton
{
text
:
qsTr
(
"
Close
"
)
backRadius
:
4
heightFactor
:
0.3333
showBorder
:
true
width
:
_buttonWidth
anchors.horizontalCenter
:
parent
.
horizontalCenter
onClicked
:
{
panelLoader
.
sourceComponent
=
null
}
}
}
QGCLabel
{
text
:
qsTr
(
"
Flight Area
"
)
anchors.bottom
:
map
.
top
anchors.bottomMargin
:
ScreenTools
.
defaultFontPixelHeight
*
0.25
}
Map
{
id
:
map
width
:
ScreenTools
.
defaultFontPixelWidth
*
40
height
:
width
*
0.6666
anchors.bottom
:
parent
.
bottom
anchors.horizontalCenter
:
parent
.
horizontalCenter
zoomLevel
:
QGroundControl
.
flightMapZoom
center
:
QGroundControl
.
flightMapPosition
gesture.acceptedGestures
:
MapGestureArea
.
PinchGesture
plugin
:
Plugin
{
name
:
"
QGroundControl
"
}
function
updateActiveMapType
()
{
var
settings
=
QGroundControl
.
settingsManager
.
flightMapSettings
var
fullMapName
=
settings
.
mapProvider
.
enumStringValue
+
"
"
+
settings
.
mapType
.
enumStringValue
for
(
var
i
=
0
;
i
<
_map
.
supportedMapTypes
.
length
;
i
++
)
{
if
(
fullMapName
===
_map
.
supportedMapTypes
[
i
].
name
)
{
_map
.
activeMapType
=
_map
.
supportedMapTypes
[
i
]
return
}
}
}
Component.onCompleted
:
{
updateActiveMapType
()
}
Connections
{
target
:
QGroundControl
.
settingsManager
.
flightMapSettings
.
mapType
onRawValueChanged
:
updateActiveMapType
()
}
Connections
{
target
:
QGroundControl
.
settingsManager
.
flightMapSettings
.
mapProvider
onRawValueChanged
:
updateActiveMapType
()
}
}
}
}
...
...
src/AirspaceManagement/AirspaceFlightPlanProvider.cc
View file @
4feba023
...
...
@@ -8,14 +8,100 @@
****************************************************************************/
#include "AirspaceFlightPlanProvider.h"
#include <QQmlEngine>
//-----------------------------------------------------------------------------
AirspaceFlightInfo
::
AirspaceFlightInfo
(
QObject
*
parent
)
:
QObject
(
parent
)
,
_selected
(
false
)
{
}
//-----------------------------------------------------------------------------
AirspaceFlightPlanProvider
::
AirspaceFlightPlanProvider
(
QObject
*
parent
)
:
QObject
(
parent
)
{
}
//-----------------------------------------------------------------------------
AirspaceFlightModel
::
AirspaceFlightModel
(
QObject
*
parent
)
:
QAbstractListModel
(
parent
)
{
}
//-----------------------------------------------------------------------------
AirspaceFlightInfo
*
AirspaceFlightModel
::
get
(
int
index
)
{
if
(
index
<
0
||
index
>=
_flightEntries
.
count
())
{
return
NULL
;
}
return
_flightEntries
[
index
];
}
//-----------------------------------------------------------------------------
int
AirspaceFlightModel
::
count
()
const
{
return
_flightEntries
.
count
();
}
//-----------------------------------------------------------------------------
void
AirspaceFlightModel
::
append
(
AirspaceFlightInfo
*
object
)
{
beginInsertRows
(
QModelIndex
(),
rowCount
(),
rowCount
());
QQmlEngine
::
setObjectOwnership
(
object
,
QQmlEngine
::
CppOwnership
);
_flightEntries
.
append
(
object
);
endInsertRows
();
emit
countChanged
();
}
//-----------------------------------------------------------------------------
void
AirspaceFlightModel
::
clear
(
void
)
{
if
(
!
_flightEntries
.
isEmpty
())
{
beginRemoveRows
(
QModelIndex
(),
0
,
_flightEntries
.
count
());
while
(
_flightEntries
.
count
())
{
AirspaceFlightInfo
*
entry
=
_flightEntries
.
last
();
if
(
entry
)
entry
->
deleteLater
();
_flightEntries
.
removeLast
();
}
endRemoveRows
();
emit
countChanged
();
}
}
//-----------------------------------------------------------------------------
AirspaceFlightInfo
*
AirspaceFlightModel
::
operator
[](
int
index
)
{
return
get
(
index
);
}
//-----------------------------------------------------------------------------
int
AirspaceFlightModel
::
rowCount
(
const
QModelIndex
&
/*parent*/
)
const
{
return
_flightEntries
.
count
();
}
//-----------------------------------------------------------------------------
QVariant
AirspaceFlightModel
::
data
(
const
QModelIndex
&
index
,
int
role
)
const
{
if
(
index
.
row
()
<
0
||
index
.
row
()
>=
_flightEntries
.
count
())
return
QVariant
();
if
(
role
==
ObjectRole
)
return
QVariant
::
fromValue
(
_flightEntries
[
index
.
row
()]);
return
QVariant
();
}
//-----------------------------------------------------------------------------
QHash
<
int
,
QByteArray
>
AirspaceFlightModel
::
roleNames
()
const
{
QHash
<
int
,
QByteArray
>
roles
;
roles
[
ObjectRole
]
=
"flightEntry"
;
return
roles
;
}
src/AirspaceManagement/AirspaceFlightPlanProvider.h
View file @
4feba023
...
...
@@ -19,8 +19,10 @@
#include <QObject>
#include <QDateTime>
#include <QAbstractListModel>
class
PlanMasterController
;
class
AirspaceFlightInfo
;
//-----------------------------------------------------------------------------
class
AirspaceFlightInfo
:
public
QObject
...
...
@@ -30,17 +32,17 @@ public:
AirspaceFlightInfo
(
QObject
*
parent
=
nullptr
);
Q_PROPERTY
(
QString
flightID
READ
flightID
CONSTANT
)
Q_PROPERTY
(
Q
DateTime
createdTime
READ
createdTime
CONSTANT
)
Q_PROPERTY
(
Q
DateTime
startTime
READ
startTime
CONSTANT
)
Q_PROPERTY
(
Q
DateTime
endTime
READ
endTime
CONSTANT
)
Q_PROPERTY
(
Q
String
createdTime
READ
createdTime
CONSTANT
)
Q_PROPERTY
(
Q
String
startTime
READ
startTime
CONSTANT
)
Q_PROPERTY
(
Q
String
endTime
READ
endTime
CONSTANT
)
Q_PROPERTY
(
QGeoCoordinate
takeOff
READ
takeOff
CONSTANT
)
Q_PROPERTY
(
QmlObjectListModel
*
boundingBox
READ
boundingBox
CONSTANT
)
Q_PROPERTY
(
bool
selected
READ
selected
WRITE
setSelected
NOTIFY
selectedChanged
)
virtual
QString
flightID
()
=
0
;
virtual
Q
DateTime
createdTime
()
=
0
;
virtual
Q
DateTime
startTime
()
=
0
;
virtual
Q
DateTime
endTime
()
=
0
;
virtual
Q
String
createdTime
()
=
0
;
virtual
Q
String
startTime
()
=
0
;
virtual
Q
String
endTime
()
=
0
;
virtual
QGeoCoordinate
takeOff
()
=
0
;
virtual
QmlObjectListModel
*
boundingBox
()
=
0
;
...
...
@@ -54,6 +56,40 @@ protected:
bool
_selected
;
};
//-----------------------------------------------------------------------------
class
AirspaceFlightModel
:
public
QAbstractListModel
{
Q_OBJECT
public:
enum
QGCLogModelRoles
{
ObjectRole
=
Qt
::
UserRole
+
1
};
AirspaceFlightModel
(
QObject
*
parent
=
0
);
Q_PROPERTY
(
int
count
READ
count
NOTIFY
countChanged
)
Q_INVOKABLE
AirspaceFlightInfo
*
get
(
int
index
);
int
count
(
void
)
const
;
void
append
(
AirspaceFlightInfo
*
entry
);
void
clear
(
void
);
AirspaceFlightInfo
*
operator
[]
(
int
i
);
int
rowCount
(
const
QModelIndex
&
parent
=
QModelIndex
())
const
;
QVariant
data
(
const
QModelIndex
&
index
,
int
role
=
Qt
::
DisplayRole
)
const
;
signals:
void
countChanged
();
protected:
QHash
<
int
,
QByteArray
>
roleNames
()
const
;
private:
QList
<
AirspaceFlightInfo
*>
_flightEntries
;
};
//-----------------------------------------------------------------------------
class
AirspaceFlightPlanProvider
:
public
QObject
{
...
...
@@ -85,7 +121,7 @@ public:
Q_PROPERTY
(
QmlObjectListModel
*
rulesReview
READ
rulesReview
NOTIFY
rulesChanged
)
Q_PROPERTY
(
QmlObjectListModel
*
rulesFollowing
READ
rulesFollowing
NOTIFY
rulesChanged
)
Q_PROPERTY
(
QmlObjectListModel
*
briefFeatures
READ
briefFeatures
NOTIFY
rulesChanged
)
Q_PROPERTY
(
QmlObjectListModel
*
flightList
READ
flightList
NOTIFY
flightListChanged
)
Q_PROPERTY
(
AirspaceFlightModel
*
flightList
READ
flightList
NOTIFY
flightListChanged
)
//-- TODO: This will submit the current flight plan in memory.
Q_INVOKABLE
virtual
void
submitFlightPlan
()
=
0
;
...
...
@@ -106,7 +142,7 @@ public:
virtual
QmlObjectListModel
*
rulesReview
()
=
0
;
///< List of AirspaceRule should review
virtual
QmlObjectListModel
*
rulesFollowing
()
=
0
;
///< List of AirspaceRule following
virtual
QmlObjectListModel
*
briefFeatures
()
=
0
;
///< List of AirspaceRule in violation
virtual
QmlObjectListModel
*
flightList
()
=
0
;
///< List of AirspaceFlightInfo
virtual
AirspaceFlightModel
*
flightList
()
=
0
;
///< List of AirspaceFlightInfo
virtual
void
setFlightStartTime
(
QDateTime
start
)
=
0
;
virtual
void
setFlightEndTime
(
QDateTime
end
)
=
0
;
...
...
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