Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
b6d12211
Unverified
Commit
b6d12211
authored
Jan 03, 2018
by
Don Gagne
Committed by
GitHub
Jan 03, 2018
Browse files
Merge pull request #5954 from DonLakeFlyer/GeoToNed
Fix NaN in convertGeoToNed
parents
c08104b7
ceb1107f
Changes
3
Show whitespace changes
Inline
Side-by-side
src/MissionManager/QGCMapPolygon.cc
View file @
b6d12211
...
...
@@ -302,10 +302,11 @@ void QGCMapPolygon::_updateCenter(void)
}
center
=
_coordFromPointF
(
QPointF
(
centroid
.
x
()
/
polygonF
.
count
(),
centroid
.
y
()
/
polygonF
.
count
()));
}
if
(
_center
!=
center
)
{
_center
=
center
;
emit
centerChanged
(
center
);
}
}
}
void
QGCMapPolygon
::
setCenter
(
QGeoCoordinate
newCenter
)
...
...
src/MissionManager/QGCMapPolygonTest.cc
View file @
b6d12211
...
...
@@ -122,7 +122,12 @@ void QGCMapPolygonTest::_testVertexManipulation(void)
QCOMPARE
(
_mapPolygon
->
count
(),
i
);
_mapPolygon
->
appendVertex
(
_polyPoints
[
i
]);
if
(
i
>=
2
)
{
// Center is no recalculated until there are 3 points or more
QVERIFY
(
_multiSpyPolygon
->
checkOnlySignalByMask
(
pathChangedMask
|
polygonDirtyChangedMask
|
polygonCountChangedMask
|
centerChangedMask
));
}
else
{
QVERIFY
(
_multiSpyPolygon
->
checkOnlySignalByMask
(
pathChangedMask
|
polygonDirtyChangedMask
|
polygonCountChangedMask
));
}
QVERIFY
(
_multiSpyModel
->
checkOnlySignalByMask
(
modelDirtyChangedMask
|
modelCountChangedMask
));
QCOMPARE
(
_multiSpyPolygon
->
pullIntFromSignalIndex
(
polygonCountChangedIndex
),
i
+
1
);
QCOMPARE
(
_multiSpyModel
->
pullIntFromSignalIndex
(
modelCountChangedIndex
),
i
+
1
);
...
...
src/QGCGeo.cc
View file @
b6d12211
...
...
@@ -28,7 +28,13 @@
static
const
float
epsilon
=
std
::
numeric_limits
<
double
>::
epsilon
();
void
convertGeoToNed
(
QGeoCoordinate
coord
,
QGeoCoordinate
origin
,
double
*
x
,
double
*
y
,
double
*
z
)
{
void
convertGeoToNed
(
QGeoCoordinate
coord
,
QGeoCoordinate
origin
,
double
*
x
,
double
*
y
,
double
*
z
)
{
if
(
coord
==
origin
)
{
// Short circuit to prevent NaNs in calculation
*
x
=
*
y
=
*
z
=
0
;
return
;
}
double
lat_rad
=
coord
.
latitude
()
*
M_DEG_TO_RAD
;
double
lon_rad
=
coord
.
longitude
()
*
M_DEG_TO_RAD
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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