Commit 900ce1ee authored by Gus Grubba's avatar Gus Grubba

Restore mission bounding box, which was lost with master branch changes

parent 18120b0d
......@@ -362,13 +362,32 @@ void TransectStyleComplexItem::_rebuildTransects(void)
}
}
// Calc bounding cube
double north = 0.0;
double south = 180.0;
double east = 0.0;
double west = 360.0;
double bottom = 100000.;
double top = 0.;
// Generate the visuals transect representation
_visualTransectPoints.clear();
foreach (const QList<CoordInfo_t>& transect, _transects) {
foreach (const CoordInfo_t& coordInfo, transect) {
_visualTransectPoints.append(QVariant::fromValue(coordInfo.coord));
double lat = coordInfo.coord.latitude() + 90.0;
double lon = coordInfo.coord.longitude() + 180.0;
north = fmax(north, lat);
south = fmin(south, lat);
east = fmax(east, lon);
west = fmin(west, lon);
bottom = fmin(bottom, coordInfo.coord.altitude());
top = fmax(top, coordInfo.coord.altitude());
}
}
//-- Update bounding cube for airspace management control
_setBoundingCube(QGCGeoBoundingCube(
QGeoCoordinate(north - 90.0, west - 180.0, bottom),
QGeoCoordinate(south - 90.0, east - 180.0, top)));
emit visualTransectPointsChanged();
_coordinate = _visualTransectPoints.count() ? _visualTransectPoints.first().value<QGeoCoordinate>() : QGeoCoordinate();
......@@ -382,6 +401,14 @@ void TransectStyleComplexItem::_rebuildTransects(void)
emit timeBetweenShotsChanged();
}
void TransectStyleComplexItem::_setBoundingCube(QGCGeoBoundingCube bc)
{
if (bc != _boundingCube) {
_boundingCube = bc;
emit boundingCubeChanged();
}
}
void TransectStyleComplexItem::_queryTransectsPathHeightInfo(void)
{
_transectsPathHeightInfo.clear();
......
......@@ -68,9 +68,10 @@ public:
// Overrides from ComplexMissionItem
int lastSequenceNumber (void) const final;
QString mapVisualQML (void) const override = 0;
bool load (const QJsonObject& complexObject, int sequenceNumber, QString& errorString) override = 0;
int lastSequenceNumber (void) const final;
QString mapVisualQML (void) const override = 0;
bool load (const QJsonObject& complexObject, int sequenceNumber, QString& errorString) override = 0;
QGCGeoBoundingCube boundingCube (void) const override { return _boundingCube; }
double complexDistance (void) const final { return _complexDistance; }
double greatestDistanceTo (const QGeoCoordinate &other) const final;
......@@ -140,12 +141,14 @@ protected:
double _triggerDistance (void) const;
bool _hasTurnaround (void) const;
double _turnaroundDistance (void) const;
int _sequenceNumber;
bool _dirty;
QGeoCoordinate _coordinate;
QGeoCoordinate _exitCoordinate;
QGCMapPolygon _surveyAreaPolygon;
void _setBoundingCube (QGCGeoBoundingCube bc);
int _sequenceNumber;
bool _dirty;
QGeoCoordinate _coordinate;
QGeoCoordinate _exitCoordinate;
QGCMapPolygon _surveyAreaPolygon;
QGCGeoBoundingCube _boundingCube;
enum CoordType {
CoordTypeInterior,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment