|
|
|
@ -1392,26 +1392,28 @@ void MissionController::_addPlannedHomePosition(Vehicle* vehicle, QmlObjectListM
@@ -1392,26 +1392,28 @@ void MissionController::_addPlannedHomePosition(Vehicle* vehicle, QmlObjectListM
|
|
|
|
|
visualItems->insert(0, homeItem); |
|
|
|
|
|
|
|
|
|
if (visualItems->count() > 1 && addToCenter) { |
|
|
|
|
double north, south, east, west; |
|
|
|
|
double north = 0.0; |
|
|
|
|
double south = 0.0; |
|
|
|
|
double east = 0.0; |
|
|
|
|
double west = 0.0; |
|
|
|
|
bool firstCoordSet = false; |
|
|
|
|
|
|
|
|
|
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); |
|
|
|
|
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; |
|
|
|
|
east = _normalizeLon(item->coordinate().longitude()); |
|
|
|
|
west = east; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|