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
Expand all
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
This diff is collapsed.
Click to expand it.
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