Commit 7eed1155 authored by lichenyuneec's avatar lichenyuneec

the battery and distance of structure scan always show 0

Change-Id: I80acc497ef8fc574f64b181a8d276c5b00d4e057
parent 0871b019
...@@ -83,6 +83,8 @@ StructureScanComplexItem::StructureScanComplexItem(Vehicle* vehicle, bool flyVie ...@@ -83,6 +83,8 @@ StructureScanComplexItem::StructureScanComplexItem(Vehicle* vehicle, bool flyVie
connect(&_cameraCalc, &CameraCalc::isManualCameraChanged, this, &StructureScanComplexItem::_updateGimbalPitch); connect(&_cameraCalc, &CameraCalc::isManualCameraChanged, this, &StructureScanComplexItem::_updateGimbalPitch);
connect(&_layersFact, &Fact::valueChanged, this, &StructureScanComplexItem::_recalcScanDistance);
_recalcLayerInfo(); _recalcLayerInfo();
if (!kmlOrShpFile.isEmpty()) { if (!kmlOrShpFile.isEmpty()) {
...@@ -93,14 +95,6 @@ StructureScanComplexItem::StructureScanComplexItem(Vehicle* vehicle, bool flyVie ...@@ -93,14 +95,6 @@ StructureScanComplexItem::StructureScanComplexItem(Vehicle* vehicle, bool flyVie
setDirty(false); setDirty(false);
} }
void StructureScanComplexItem::_setScanDistance(double scanDistance)
{
if (!qFuzzyCompare(_scanDistance, scanDistance)) {
_scanDistance = scanDistance;
emit complexDistanceChanged();
}
}
void StructureScanComplexItem::_setCameraShots(int cameraShots) void StructureScanComplexItem::_setCameraShots(int cameraShots)
{ {
if (_cameraShots != cameraShots) { if (_cameraShots != cameraShots) {
...@@ -519,6 +513,9 @@ void StructureScanComplexItem::_rebuildFlightPolygon(void) ...@@ -519,6 +513,9 @@ void StructureScanComplexItem::_rebuildFlightPolygon(void)
} else { } else {
_entryVertex = savedEntryVertex; _entryVertex = savedEntryVertex;
} }
_recalcScanDistance();
emit coordinateChanged(coordinate()); emit coordinateChanged(coordinate());
emit exitCoordinateChanged(exitCoordinate()); emit exitCoordinateChanged(exitCoordinate());
} }
...@@ -598,3 +595,26 @@ void StructureScanComplexItem::_signalTopBottomAltChanged(void) ...@@ -598,3 +595,26 @@ void StructureScanComplexItem::_signalTopBottomAltChanged(void)
emit topFlightAltChanged(); emit topFlightAltChanged();
emit bottomFlightAltChanged(); emit bottomFlightAltChanged();
} }
void StructureScanComplexItem::_recalcScanDistance()
{
double scanDistance = 0;
QList<QGeoCoordinate> vertices = _flightPolygon.coordinateList();
for (int i=0; i<vertices.count() - 1; i++) {
scanDistance += vertices[i].distanceTo(vertices[i+1]);
}
scanDistance *= _layersFact.rawValue().toInt();
double surfaceHeight = qMax(_structureHeightFact.rawValue().toDouble() - _scanBottomAltFact.rawValue().toDouble(), 0.0);
scanDistance += surfaceHeight;
if (!qFuzzyCompare(_scanDistance, scanDistance)) {
_scanDistance = scanDistance;
emit complexDistanceChanged();
}
qCDebug(MissionControllerLog) << "StructureScanComplexItem--_recalcScanDistance layers: "
<< _layersFact.rawValue().toInt() << " structure height: " << surfaceHeight
<< " scanDistance: " << _scanDistance;
}
...@@ -125,11 +125,11 @@ private slots: ...@@ -125,11 +125,11 @@ private slots:
void _recalcLayerInfo (void); void _recalcLayerInfo (void);
void _updateLastSequenceNumber (void); void _updateLastSequenceNumber (void);
void _updateGimbalPitch (void); void _updateGimbalPitch (void);
void _signalTopBottomAltChanged (void); void _signalTopBottomAltChanged (void);
void _recalcScanDistance (void);
private: private:
void _setExitCoordinate(const QGeoCoordinate& coordinate); void _setExitCoordinate(const QGeoCoordinate& coordinate);
void _setScanDistance(double scanDistance);
void _setCameraShots(int cameraShots); void _setCameraShots(int cameraShots);
double _triggerDistance(void) const; double _triggerDistance(void) const;
......
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