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
60bb6cbc
Commit
60bb6cbc
authored
Sep 09, 2019
by
Don Gagne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
parent
ca4d085e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
23 deletions
+39
-23
MissionController.cc
src/MissionManager/MissionController.cc
+26
-13
MissionController.h
src/MissionManager/MissionController.h
+12
-9
PlanView.qml
src/PlanView/PlanView.qml
+1
-1
No files found.
src/MissionManager/MissionController.cc
View file @
60bb6cbc
...
...
@@ -349,7 +349,7 @@ int MissionController::_nextSequenceNumber(void)
}
}
int
MissionController
::
insertSimpleMissionItem
(
QGeoCoordinate
coordinate
,
int
i
)
int
MissionController
::
insertSimpleMissionItem
(
QGeoCoordinate
coordinate
,
int
visualItemIndex
)
{
int
sequenceNumber
=
_nextSequenceNumber
();
SimpleMissionItem
*
newItem
=
new
SimpleMissionItem
(
_controllerVehicle
,
_flyView
,
this
);
...
...
@@ -367,13 +367,13 @@ int MissionController::insertSimpleMissionItem(QGeoCoordinate coordinate, int i)
double
prevAltitude
;
int
prevAltitudeMode
;
if
(
_findPreviousAltitude
(
i
,
&
prevAltitude
,
&
prevAltitudeMode
))
{
if
(
_findPreviousAltitude
(
visualItemIndex
,
&
prevAltitude
,
&
prevAltitudeMode
))
{
newItem
->
altitude
()
->
setRawValue
(
prevAltitude
);
newItem
->
setAltitudeMode
(
static_cast
<
QGroundControlQmlGlobal
::
AltitudeMode
>
(
prevAltitudeMode
));
}
}
newItem
->
setMissionFlightStatus
(
_missionFlightStatus
);
_visualItems
->
insert
(
i
,
newItem
);
_visualItems
->
insert
(
visualItemIndex
,
newItem
);
// We send the click coordinate through here to be able to set the planned home position from the user click location if needed
_recalcAllWithClickCoordinate
(
coordinate
);
...
...
@@ -381,7 +381,7 @@ int MissionController::insertSimpleMissionItem(QGeoCoordinate coordinate, int i)
return
newItem
->
sequenceNumber
();
}
int
MissionController
::
insertROIMissionItem
(
QGeoCoordinate
coordinate
,
int
i
)
int
MissionController
::
insertROIMissionItem
(
QGeoCoordinate
coordinate
,
int
visualItemIndex
)
{
int
sequenceNumber
=
_nextSequenceNumber
();
SimpleMissionItem
*
newItem
=
new
SimpleMissionItem
(
_controllerVehicle
,
_flyView
,
this
);
...
...
@@ -395,18 +395,18 @@ int MissionController::insertROIMissionItem(QGeoCoordinate coordinate, int i)
double
prevAltitude
;
int
prevAltitudeMode
;
if
(
_findPreviousAltitude
(
i
,
&
prevAltitude
,
&
prevAltitudeMode
))
{
if
(
_findPreviousAltitude
(
visualItemIndex
,
&
prevAltitude
,
&
prevAltitudeMode
))
{
newItem
->
altitude
()
->
setRawValue
(
prevAltitude
);
newItem
->
setAltitudeMode
(
static_cast
<
QGroundControlQmlGlobal
::
AltitudeMode
>
(
prevAltitudeMode
));
}
_visualItems
->
insert
(
i
,
newItem
);
_visualItems
->
insert
(
visualItemIndex
,
newItem
);
_recalcAll
();
return
newItem
->
sequenceNumber
();
}
int
MissionController
::
insertComplexMissionItem
(
QString
itemName
,
QGeoCoordinate
mapCenterCoordinate
,
int
i
)
int
MissionController
::
insertComplexMissionItem
(
QString
itemName
,
QGeoCoordinate
mapCenterCoordinate
,
int
visualItemIndex
)
{
ComplexMissionItem
*
newItem
;
...
...
@@ -425,10 +425,10 @@ int MissionController::insertComplexMissionItem(QString itemName, QGeoCoordinate
return
sequenceNumber
;
}
return
_insertComplexMissionItemWorker
(
newItem
,
i
);
return
_insertComplexMissionItemWorker
(
newItem
,
visualItemIndex
);
}
int
MissionController
::
insertComplexMissionItemFromKMLOrSHP
(
QString
itemName
,
QString
file
,
int
i
)
int
MissionController
::
insertComplexMissionItemFromKMLOrSHP
(
QString
itemName
,
QString
file
,
int
visualItemIndex
)
{
ComplexMissionItem
*
newItem
;
...
...
@@ -443,10 +443,10 @@ int MissionController::insertComplexMissionItemFromKMLOrSHP(QString itemName, QS
return
_nextSequenceNumber
();
}
return
_insertComplexMissionItemWorker
(
newItem
,
i
);
return
_insertComplexMissionItemWorker
(
newItem
,
visualItemIndex
);
}
int
MissionController
::
_insertComplexMissionItemWorker
(
ComplexMissionItem
*
complexItem
,
int
i
)
int
MissionController
::
_insertComplexMissionItemWorker
(
ComplexMissionItem
*
complexItem
,
int
visualItemIndex
)
{
int
sequenceNumber
=
_nextSequenceNumber
();
bool
surveyStyleItem
=
qobject_cast
<
SurveyComplexItem
*>
(
complexItem
)
||
...
...
@@ -482,10 +482,10 @@ int MissionController::_insertComplexMissionItemWorker(ComplexMissionItem* compl
complexItem
->
setSequenceNumber
(
sequenceNumber
);
_initVisualItem
(
complexItem
);
if
(
i
==
-
1
)
{
if
(
visualItemIndex
==
-
1
)
{
_visualItems
->
append
(
complexItem
);
}
else
{
_visualItems
->
insert
(
i
,
complexItem
);
_visualItems
->
insert
(
visualItemIndex
,
complexItem
);
}
//-- Keep track of bounding box changes in complex items
...
...
@@ -2227,3 +2227,16 @@ bool MissionController::isEmpty(void) const
{
return
_visualItems
->
count
()
<=
1
;
}
int
MissionController
::
visualItemIndexFromSequenceNumber
(
int
sequenceNumber
)
const
{
for
(
int
i
=
0
;
i
<
_visualItems
->
count
();
i
++
)
{
const
VisualMissionItem
*
vi
=
_visualItems
->
value
<
VisualMissionItem
*>
(
i
);
if
(
vi
->
sequenceNumber
()
==
sequenceNumber
)
{
return
i
;
}
}
qWarning
()
<<
"MissionController::getVisualItemIndex visual item not found"
;
return
0
;
}
src/MissionManager/MissionController.h
View file @
60bb6cbc
...
...
@@ -103,28 +103,28 @@ public:
Q_INVOKABLE
void
removeMissionItem
(
int
index
);
/// Add a new simple mission item to the list
/// @param
i
: index to insert at
/// @param
visualItemIndex
: index to insert at
/// @return Sequence number for new item
Q_INVOKABLE
int
insertSimpleMissionItem
(
QGeoCoordinate
coordinate
,
int
i
);
Q_INVOKABLE
int
insertSimpleMissionItem
(
QGeoCoordinate
coordinate
,
int
visualItemIndex
);
/// Add a new ROI mission item to the list
/// @param
i
: index to insert at
/// @param
visualItemIndex
: index to insert at
/// @return Sequence number for new item
Q_INVOKABLE
int
insertROIMissionItem
(
QGeoCoordinate
coordinate
,
int
i
);
Q_INVOKABLE
int
insertROIMissionItem
(
QGeoCoordinate
coordinate
,
int
visualItemIndex
);
/// Add a new complex mission item to the list
/// @param itemName: Name of complex item to create (from complexMissionItemNames)
/// @param mapCenterCoordinate: coordinate for current center of map
/// @param
i
: index to insert at
/// @param
visualItemIndex
: index to insert at
/// @return Sequence number for new item
Q_INVOKABLE
int
insertComplexMissionItem
(
QString
itemName
,
QGeoCoordinate
mapCenterCoordinate
,
int
i
);
Q_INVOKABLE
int
insertComplexMissionItem
(
QString
itemName
,
QGeoCoordinate
mapCenterCoordinate
,
int
visualItemIndex
);
/// Add a new complex mission item to the list
/// @param itemName: Name of complex item to create (from complexMissionItemNames)
/// @param file: kml or shp file to load from shape from
/// @param
i
: index to insert at, -1 for end
/// @param
visualItemIndex
: index to insert at, -1 for end
/// @return Sequence number for new item
Q_INVOKABLE
int
insertComplexMissionItemFromKMLOrSHP
(
QString
itemName
,
QString
file
,
int
i
);
Q_INVOKABLE
int
insertComplexMissionItemFromKMLOrSHP
(
QString
itemName
,
QString
file
,
int
visualItemIndex
);
Q_INVOKABLE
void
resumeMission
(
int
resumeIndex
);
...
...
@@ -135,6 +135,9 @@ public:
/// @param sequenceNumber - index for new item, -1 to clear current item
Q_INVOKABLE
void
setCurrentPlanViewIndex
(
int
sequenceNumber
,
bool
force
);
/// Returns the index of this item in the visual item list
Q_INVOKABLE
int
visualItemIndexFromSequenceNumber
(
int
sequenceNumber
)
const
;
/// Determines if the mission has all data needed to be saved or sent to the vehicle. Currently the only case where this
/// would return false is when it is still waiting on terrain data to determine correct altitudes.
bool
readyForSaveSend
(
void
)
const
;
...
...
@@ -280,7 +283,7 @@ private:
void
_initLoadedVisualItems
(
QmlObjectListModel
*
loadedVisualItems
);
CoordinateVector
*
_addWaypointLineSegment
(
CoordVectHashTable
&
prevItemPairHashTable
,
VisualItemPair
&
pair
);
void
_addTimeDistance
(
bool
vtolInHover
,
double
hoverTime
,
double
cruiseTime
,
double
extraTime
,
double
distance
,
int
seqNum
);
int
_insertComplexMissionItemWorker
(
ComplexMissionItem
*
complexItem
,
int
i
);
int
_insertComplexMissionItemWorker
(
ComplexMissionItem
*
complexItem
,
int
visualItemIndex
);
void
_warnIfTerrainFrameUsed
(
void
);
private:
...
...
src/PlanView/PlanView.qml
View file @
60bb6cbc
...
...
@@ -489,7 +489,7 @@ Item {
z
:
QGroundControl
.
zOrderWaypointLines
+
1
sourceItem
:
SplitIndicator
{
onClicked
:
insertSimpleMissionItem
(
splitSegmentItem
.
coordinate
,
_missionController
.
currentPlanViewIndex
)
onClicked
:
insertSimpleMissionItem
(
splitSegmentItem
.
coordinate
,
_missionController
.
visualItemIndexFromSequenceNumber
(
_missionController
.
currentPlanViewIndex
)
)
}
function
_updateSplitCoord
()
{
...
...
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