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
bf9dbefb
Unverified
Commit
bf9dbefb
authored
Sep 06, 2019
by
Don Gagne
Committed by
GitHub
Sep 06, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #7782 from DonLakeFlyer/MissionControllerRecalc
Mission controller recalc
parents
c850bd92
06823adf
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
55 additions
and
21 deletions
+55
-21
MissionController.cc
src/MissionManager/MissionController.cc
+13
-3
MissionController.h
src/MissionManager/MissionController.h
+1
-2
MissionControllerTest.cc
src/MissionManager/MissionControllerTest.cc
+1
-4
MissionControllerTest.h
src/MissionManager/MissionControllerTest.h
+0
-2
QmlObjectListModel.cc
src/QmlControls/QmlObjectListModel.cc
+36
-8
QmlObjectListModel.h
src/QmlControls/QmlObjectListModel.h
+4
-2
No files found.
src/MissionManager/MissionController.cc
View file @
bf9dbefb
...
...
@@ -1110,9 +1110,14 @@ void MissionController::_recalcWaypointLines(void)
qCDebug
(
MissionControllerLog
)
<<
"_recalcWaypointLines homePositionValid"
<<
homePositionValid
;
CoordVectHashTable
old_table
=
_linesTable
;
_linesTable
.
clear
();
_waypointLines
.
clear
();
_waypointPath
.
clear
();
_waypointLines
.
beginReset
();
_directionArrows
.
beginReset
();
_waypointLines
.
clear
();
_directionArrows
.
clear
();
bool
linkEndToHome
;
...
...
@@ -1150,7 +1155,10 @@ void MissionController::_recalcWaypointLines(void)
lastSegmentVisualItemPair
=
VisualItemPair
(
lastCoordinateItem
,
item
);
if
(
!
_flyView
||
addDirectionArrow
)
{
_directionArrows
.
append
(
_addWaypointLineSegment
(
old_table
,
lastSegmentVisualItemPair
));
CoordinateVector
*
coordVector
=
_addWaypointLineSegment
(
old_table
,
lastSegmentVisualItemPair
);
if
(
addDirectionArrow
)
{
_directionArrows
.
append
(
coordVector
);
}
}
}
firstCoordinateItem
=
false
;
...
...
@@ -1205,6 +1213,9 @@ void MissionController::_recalcWaypointLines(void)
_waypointLines
.
swapObjectList
(
objs
);
}
_waypointLines
.
endReset
();
_directionArrows
.
endReset
();
// Anything left in the old table is an obsolete line object that can go
qDeleteAll
(
old_table
);
...
...
@@ -1218,7 +1229,6 @@ void MissionController::_recalcWaypointLines(void)
_waypointPath
.
append
(
QVariant
::
fromValue
(
QGeoCoordinate
(
0
,
0
)));
}
emit
waypointLinesChanged
();
emit
waypointPathChanged
();
}
...
...
src/MissionManager/MissionController.h
View file @
bf9dbefb
...
...
@@ -68,7 +68,7 @@ public:
}
MissionFlightStatus_t
;
Q_PROPERTY
(
QmlObjectListModel
*
visualItems
READ
visualItems
NOTIFY
visualItemsChanged
)
Q_PROPERTY
(
QmlObjectListModel
*
waypointLines
READ
waypointLines
NOTIFY
waypointLinesChanged
)
///< Used by Plan view only for interactive editing
Q_PROPERTY
(
QmlObjectListModel
*
waypointLines
READ
waypointLines
CONSTANT
)
///< Used by Plan view only for interactive editing
Q_PROPERTY
(
QVariantList
waypointPath
READ
waypointPath
NOTIFY
waypointPathChanged
)
///< Used by Fly view only for static display
Q_PROPERTY
(
QmlObjectListModel
*
directionArrows
READ
directionArrows
CONSTANT
)
Q_PROPERTY
(
QStringList
complexMissionItemNames
READ
complexMissionItemNames
NOTIFY
complexMissionItemNamesChanged
)
...
...
@@ -206,7 +206,6 @@ public:
signals:
void
visualItemsChanged
(
void
);
void
waypointLinesChanged
(
void
);
void
waypointPathChanged
(
void
);
void
newItemsFromVehicle
(
void
);
void
missionDistanceChanged
(
double
missionDistance
);
...
...
src/MissionManager/MissionControllerTest.cc
View file @
bf9dbefb
...
...
@@ -48,7 +48,6 @@ void MissionControllerTest::_initForFirmwareType(MAV_AUTOPILOT firmwareType)
// MissionController signals
_rgMissionControllerSignals
[
visualItemsChangedSignalIndex
]
=
SIGNAL
(
visualItemsChanged
());
_rgMissionControllerSignals
[
waypointLinesChangedSignalIndex
]
=
SIGNAL
(
waypointLinesChanged
());
// Master controller pulls offline vehicle info from settings
qgcApp
()
->
toolbox
()
->
settingsManager
()
->
appSettings
()
->
offlineEditingFirmwareType
()
->
setRawValue
(
firmwareType
);
...
...
@@ -62,7 +61,7 @@ void MissionControllerTest::_initForFirmwareType(MAV_AUTOPILOT firmwareType)
_masterController
->
start
(
false
/* flyView */
);
// All signals should some through on start
QCOMPARE
(
_multiSpyMissionController
->
checkOnlySignalsByMask
(
visualItemsChangedSignalMask
|
waypointLinesChangedSignalMask
),
true
);
QCOMPARE
(
_multiSpyMissionController
->
checkOnlySignalsByMask
(
visualItemsChangedSignalMask
),
true
);
_multiSpyMissionController
->
clearAllSignals
();
QmlObjectListModel
*
visualItems
=
_missionController
->
visualItems
();
...
...
@@ -120,8 +119,6 @@ void MissionControllerTest::_testAddWaypointWorker(MAV_AUTOPILOT firmwareType)
_missionController
->
insertSimpleMissionItem
(
coordinate
,
_missionController
->
visualItems
()
->
count
());
QCOMPARE
(
_multiSpyMissionController
->
checkOnlySignalsByMask
(
waypointLinesChangedSignalMask
),
true
);
QmlObjectListModel
*
visualItems
=
_missionController
->
visualItems
();
QVERIFY
(
visualItems
);
...
...
src/MissionManager/MissionControllerTest.h
View file @
bf9dbefb
...
...
@@ -70,13 +70,11 @@ private:
enum
{
visualItemsChangedSignalIndex
=
0
,
waypointLinesChangedSignalIndex
,
missionControllerMaxSignalIndex
};
enum
{
visualItemsChangedSignalMask
=
1
<<
visualItemsChangedSignalIndex
,
waypointLinesChangedSignalMask
=
1
<<
waypointLinesChangedSignalIndex
,
};
MultiSignalSpy
*
_multiSpyMissionController
;
...
...
src/QmlControls/QmlObjectListModel.cc
View file @
bf9dbefb
...
...
@@ -20,9 +20,10 @@ const int QmlObjectListModel::ObjectRole = Qt::UserRole;
const
int
QmlObjectListModel
::
TextRole
=
Qt
::
UserRole
+
1
;
QmlObjectListModel
::
QmlObjectListModel
(
QObject
*
parent
)
:
QAbstractListModel
(
parent
)
,
_dirty
(
false
)
,
_skipDirtyFirstItem
(
false
)
:
QAbstractListModel
(
parent
)
,
_dirty
(
false
)
,
_skipDirtyFirstItem
(
false
)
,
_externalBeginResetModel
(
false
)
{
}
...
...
@@ -142,8 +143,13 @@ const QObject* QmlObjectListModel::operator[](int index) const
void
QmlObjectListModel
::
clear
()
{
while
(
rowCount
())
{
removeAt
(
0
);
if
(
!
_externalBeginResetModel
)
{
beginResetModel
();
}
_objectList
.
clear
();
if
(
!
_externalBeginResetModel
)
{
endResetModel
();
emit
countChanged
(
count
());
}
}
...
...
@@ -221,10 +227,14 @@ void QmlObjectListModel::append(QList<QObject*> objects)
QObjectList
QmlObjectListModel
::
swapObjectList
(
const
QObjectList
&
newlist
)
{
QObjectList
oldlist
(
_objectList
);
beginResetModel
();
if
(
!
_externalBeginResetModel
)
{
beginResetModel
();
}
_objectList
=
newlist
;
endResetModel
();
emit
countChanged
(
count
());
if
(
!
_externalBeginResetModel
)
{
endResetModel
();
emit
countChanged
(
count
());
}
return
oldlist
;
}
...
...
@@ -274,3 +284,21 @@ void QmlObjectListModel::clearAndDeleteContents()
clear
();
endResetModel
();
}
void
QmlObjectListModel
::
beginReset
(
void
)
{
if
(
_externalBeginResetModel
)
{
qWarning
()
<<
"QmlObjectListModel::beginReset already set"
;
}
_externalBeginResetModel
=
true
;
beginResetModel
();
}
void
QmlObjectListModel
::
endReset
(
void
)
{
if
(
!
_externalBeginResetModel
)
{
qWarning
()
<<
"QmlObjectListModel::endReset begin not set"
;
}
_externalBeginResetModel
=
false
;
endResetModel
();
}
src/QmlControls/QmlObjectListModel.h
View file @
bf9dbefb
...
...
@@ -33,6 +33,7 @@ public:
int
count
()
const
;
bool
dirty
()
const
{
return
_dirty
;
}
void
setDirty
(
bool
dirty
);
void
append
(
QObject
*
object
);
void
append
(
QList
<
QObject
*>
objects
);
...
...
@@ -56,8 +57,8 @@ public:
/// Clears the list and calls deleteLater on each entry
void
clearAndDeleteContents
();
void
beginReset
()
{
beginResetModel
();
}
void
endReset
()
{
endResetModel
();
}
void
beginReset
()
;
void
endReset
()
;
signals:
void
countChanged
(
int
count
);
...
...
@@ -80,6 +81,7 @@ private:
bool
_dirty
;
bool
_skipDirtyFirstItem
;
bool
_externalBeginResetModel
;
static
const
int
ObjectRole
;
static
const
int
TextRole
;
...
...
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