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
3924f851
Commit
3924f851
authored
Sep 06, 2019
by
Don Gagne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
parent
e1e6df46
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
59 additions
and
16 deletions
+59
-16
FlightDisplayViewMap.qml
src/FlightDisplay/FlightDisplayViewMap.qml
+11
-0
MissionController.cc
src/MissionManager/MissionController.cc
+44
-10
CoordinateVector.cc
src/QmlControls/CoordinateVector.cc
+0
-4
CoordinateVector.h
src/QmlControls/CoordinateVector.h
+4
-2
No files found.
src/FlightDisplay/FlightDisplayViewMap.qml
View file @
3924f851
...
...
@@ -244,6 +244,17 @@ FlightMap {
}
}
MapItemView
{
model
:
mainIsMap
?
_missionController
.
directionArrows
:
undefined
delegate
:
MapLineArrow
{
fromCoord
:
object
?
object
.
coordinate1
:
undefined
toCoord
:
object
?
object
.
coordinate2
:
undefined
arrowPosition
:
2
z
:
QGroundControl
.
zOrderWaypointLines
}
}
// Allow custom builds to add map items
CustomMapItems
{
map
:
flightMap
...
...
src/MissionManager/MissionController.cc
View file @
3924f851
...
...
@@ -1101,7 +1101,7 @@ CoordinateVector* MissionController::_addWaypointLineSegment(CoordVectHashTable&
void
MissionController
::
_recalcWaypointLines
(
void
)
{
int
segmentCount
=
0
;
CoordinateVector
*
lastCoordVector
=
nullpt
r
;
VisualItemPair
lastSegmentVisualItemPai
r
;
bool
firstCoordinateItem
=
true
;
VisualMissionItem
*
lastCoordinateItem
=
qobject_cast
<
VisualMissionItem
*>
(
_visualItems
->
get
(
0
));
...
...
@@ -1138,6 +1138,22 @@ void MissionController::_recalcWaypointLines(void)
if
(
item
->
specifiesCoordinate
()
&&
!
item
->
isStandaloneCoordinate
())
{
if
(
lastCoordinateItem
!=
_settingsItem
||
(
homePositionValid
&&
linkStartToHome
))
{
#if 1
// Direction arrows are added to the first segment and every 5 segments in the middle.
bool
addDirectionArrow
=
false
;
if
(
firstCoordinateItem
||
!
lastCoordinateItem
->
isSimpleItem
()
||
!
item
->
isSimpleItem
())
{
addDirectionArrow
=
true
;
}
else
if
(
segmentCount
>
5
)
{
segmentCount
=
0
;
addDirectionArrow
=
true
;
}
segmentCount
++
;
lastSegmentVisualItemPair
=
VisualItemPair
(
lastCoordinateItem
,
item
);
if
(
!
_flyView
||
addDirectionArrow
)
{
_directionArrows
.
append
(
_addWaypointLineSegment
(
old_table
,
lastSegmentVisualItemPair
));
}
#else
if
(
!
_flyView
)
{
VisualItemPair
pair
(
lastCoordinateItem
,
item
);
lastCoordVector
=
_addWaypointLineSegment
(
old_table
,
pair
);
...
...
@@ -1149,6 +1165,7 @@ void MissionController::_recalcWaypointLines(void)
_directionArrows
.
append
(
lastCoordVector
);
}
}
#endif
}
firstCoordinateItem
=
false
;
_waypointPath
.
append
(
QVariant
::
fromValue
(
item
->
coordinate
()));
...
...
@@ -1161,15 +1178,36 @@ void MissionController::_recalcWaypointLines(void)
}
if
(
linkEndToHome
&&
lastCoordinateItem
!=
_settingsItem
&&
homePositionValid
)
{
if
(
!
_flyView
)
{
VisualItemPair
pair
(
lastCoordinateItem
,
_settingsItem
);
lastCoordVector
=
_addWaypointLineSegment
(
old_table
,
pair
);
}
else
{
lastSegmentVisualItemPair
=
VisualItemPair
(
lastCoordinateItem
,
_settingsItem
);
if
(
_flyView
)
{
_waypointPath
.
append
(
QVariant
::
fromValue
(
_settingsItem
->
coordinate
()));
}
_addWaypointLineSegment
(
old_table
,
lastSegmentVisualItemPair
);
}
{
// Add direction arrow to last segment
if
(
lastSegmentVisualItemPair
.
first
)
{
CoordinateVector
*
coordVector
=
nullptr
;
// The pair may not be in the hash, this can happen in the fly view where only segments with arrows on them are added to ahsh.
// check for that first and add if needed
if
(
_linesTable
.
contains
(
lastSegmentVisualItemPair
))
{
// Pair exists in the new table already just reuse it
coordVector
=
_linesTable
[
lastSegmentVisualItemPair
];
}
else
if
(
old_table
.
contains
(
lastSegmentVisualItemPair
))
{
// Pair already exists in old table, pull from old to new and reuse
_linesTable
[
lastSegmentVisualItemPair
]
=
coordVector
=
old_table
.
take
(
lastSegmentVisualItemPair
);
}
else
{
// Create a new segment. Since this is the fly view there is no need to wire change signals.
coordVector
=
new
CoordinateVector
(
lastSegmentVisualItemPair
.
first
->
isSimpleItem
()
?
lastSegmentVisualItemPair
.
first
->
coordinate
()
:
lastSegmentVisualItemPair
.
first
->
exitCoordinate
(),
lastSegmentVisualItemPair
.
second
->
coordinate
(),
this
);
_linesTable
[
lastSegmentVisualItemPair
]
=
coordVector
;
}
_directionArrows
.
append
(
coordVector
);
}
if
(
!
_flyView
)
{
// Create a temporary QObjectList and replace the model data
QObjectList
objs
;
objs
.
reserve
(
_linesTable
.
count
());
...
...
@@ -1184,10 +1222,6 @@ void MissionController::_recalcWaypointLines(void)
// Anything left in the old table is an obsolete line object that can go
qDeleteAll
(
old_table
);
if
(
lastCoordVector
)
{
_directionArrows
.
append
(
lastCoordVector
);
}
_recalcMissionFlightStatus
();
if
(
_waypointPath
.
count
()
==
0
)
{
...
...
src/QmlControls/CoordinateVector.cc
View file @
3924f851
...
...
@@ -7,10 +7,6 @@
*
****************************************************************************/
/// @file
/// @author Don Gagne <don@thegagnes.com>
#include "CoordinateVector.h"
CoordinateVector
::
CoordinateVector
(
QObject
*
parent
)
...
...
src/QmlControls/CoordinateVector.h
View file @
3924f851
...
...
@@ -7,7 +7,6 @@
*
****************************************************************************/
#ifndef CoordinateVector_H
#define CoordinateVector_H
...
...
@@ -24,7 +23,10 @@ public:
Q_PROPERTY
(
QGeoCoordinate
coordinate1
MEMBER
_coordinate1
NOTIFY
coordinate1Changed
)
Q_PROPERTY
(
QGeoCoordinate
coordinate2
MEMBER
_coordinate2
NOTIFY
coordinate2Changed
)
QGeoCoordinate
coordinate1
(
void
)
const
{
return
_coordinate1
;
}
QGeoCoordinate
coordinate2
(
void
)
const
{
return
_coordinate2
;
}
void
setCoordinates
(
const
QGeoCoordinate
&
coordinate1
,
const
QGeoCoordinate
&
coordinate2
);
public
slots
:
...
...
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