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
5ddddfda
Commit
5ddddfda
authored
Dec 03, 2016
by
Don Gagne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Correct use of specifiesCoordinate
parent
b25cde07
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
17 deletions
+29
-17
MissionController.cc
src/MissionManager/MissionController.cc
+29
-17
No files found.
src/MissionManager/MissionController.cc
View file @
5ddddfda
...
...
@@ -1208,31 +1208,43 @@ double MissionController::_normalizeLon(double lon)
/// Add the home position item to the front of the list
void
MissionController
::
_addPlannedHomePosition
(
QmlObjectListModel
*
visualItems
,
bool
addToCenter
)
{
bool
homePositionSet
=
false
;
SimpleMissionItem
*
homeItem
=
new
SimpleMissionItem
(
_activeVehicle
,
this
);
visualItems
->
insert
(
0
,
homeItem
);
if
(
visualItems
->
count
()
>
1
&&
addToCenter
)
{
VisualMissionItem
*
item
=
qobject_cast
<
VisualMissionItem
*>
(
visualItems
->
get
(
1
));
double
north
=
_normalizeLat
(
item
->
coordinate
().
latitude
());
double
south
=
north
;
double
east
=
_normalizeLon
(
item
->
coordinate
().
longitude
());
double
west
=
east
;
for
(
int
i
=
2
;
i
<
visualItems
->
count
();
i
++
)
{
item
=
qobject_cast
<
VisualMissionItem
*>
(
visualItems
->
get
(
i
));
double
north
,
south
,
east
,
west
;
bool
firstCoordSet
=
false
;
double
lat
=
_normalizeLat
(
item
->
coordinate
().
latitude
());
double
lon
=
_normalizeLon
(
item
->
coordinate
().
longitude
());
for
(
int
i
=
1
;
i
<
visualItems
->
count
();
i
++
)
{
VisualMissionItem
*
item
=
qobject_cast
<
VisualMissionItem
*>
(
visualItems
->
get
(
i
));
if
(
item
->
specifiesCoordinate
())
{
if
(
firstCoordSet
)
{
double
lat
=
_normalizeLat
(
item
->
coordinate
().
latitude
());
double
lon
=
_normalizeLon
(
item
->
coordinate
().
longitude
());
north
=
fmax
(
north
,
lat
);
south
=
fmin
(
south
,
lat
);
east
=
fmax
(
east
,
lon
);
west
=
fmin
(
west
,
lon
);
}
else
{
firstCoordSet
=
true
;
north
=
_normalizeLat
(
item
->
coordinate
().
latitude
());
south
=
north
;
east
=
_normalizeLon
(
item
->
coordinate
().
longitude
());
west
=
east
;
}
}
}
north
=
fmax
(
north
,
lat
);
south
=
fmin
(
south
,
lat
);
east
=
fmax
(
east
,
lon
);
west
=
fmin
(
west
,
lon
);
if
(
firstCoordSet
)
{
homePositionSet
=
true
;
homeItem
->
setCoordinate
(
QGeoCoordinate
((
south
+
((
north
-
south
)
/
2
))
-
90.0
,
(
west
+
((
east
-
west
)
/
2
))
-
180.0
,
0.0
));
}
}
homeItem
->
setCoordinate
(
QGeoCoordinate
((
south
+
((
north
-
south
)
/
2
))
-
90.0
,
(
west
+
((
east
-
west
)
/
2
))
-
180.0
,
0.0
));
}
else
{
if
(
!
homePositionSet
)
{
homeItem
->
setCoordinate
(
qgcApp
()
->
lastKnownHomePosition
());
}
}
...
...
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