@ -36,8 +36,7 @@ const char* TransectStyleComplexItem::_jsonTransectPointsKey = "Tra
@@ -36,8 +36,7 @@ const char* TransectStyleComplexItem::_jsonTransectPointsKey = "Tra
const char * TransectStyleComplexItem : : _jsonItemsKey = " Items " ;
const char * TransectStyleComplexItem : : _jsonFollowTerrainKey = " FollowTerrain " ;
const int TransectStyleComplexItem : : _terrainQueryTimeoutMsecs = 500 ;
const double TransectStyleComplexItem : : _surveyEdgeIndicator = - 10 ;
const int TransectStyleComplexItem : : _terrainQueryTimeoutMsecs = 1000 ;
TransectStyleComplexItem : : TransectStyleComplexItem ( Vehicle * vehicle , QString settingsGroup , QObject * parent )
: ComplexMissionItem ( vehicle , parent )
@ -77,18 +76,6 @@ TransectStyleComplexItem::TransectStyleComplexItem(Vehicle* vehicle, QString set
@@ -77,18 +76,6 @@ TransectStyleComplexItem::TransectStyleComplexItem(Vehicle* vehicle, QString set
connect ( _cameraCalc . adjustedFootprintSide ( ) , & Fact : : valueChanged , this , & TransectStyleComplexItem : : _rebuildTransects ) ;
connect ( _cameraCalc . adjustedFootprintFrontal ( ) , & Fact : : valueChanged , this , & TransectStyleComplexItem : : _rebuildTransects ) ;
connect ( & _turnAroundDistanceFact , & Fact : : valueChanged , this , & TransectStyleComplexItem : : _signalLastSequenceNumberChanged ) ;
connect ( & _hoverAndCaptureFact , & Fact : : valueChanged , this , & TransectStyleComplexItem : : _signalLastSequenceNumberChanged ) ;
connect ( & _refly90DegreesFact , & Fact : : valueChanged , this , & TransectStyleComplexItem : : _signalLastSequenceNumberChanged ) ;
connect ( & _surveyAreaPolygon , & QGCMapPolygon : : pathChanged , this , & TransectStyleComplexItem : : _signalLastSequenceNumberChanged ) ;
connect ( & _cameraTriggerInTurnAroundFact , & Fact : : valueChanged , this , & TransectStyleComplexItem : : _signalLastSequenceNumberChanged ) ;
connect ( _cameraCalc . adjustedFootprintSide ( ) , & Fact : : valueChanged , this , & TransectStyleComplexItem : : _signalLastSequenceNumberChanged ) ;
connect ( _cameraCalc . adjustedFootprintFrontal ( ) , & Fact : : valueChanged , this , & TransectStyleComplexItem : : _signalLastSequenceNumberChanged ) ;
connect ( this , & TransectStyleComplexItem : : followTerrainChanged , this , & TransectStyleComplexItem : : _signalLastSequenceNumberChanged ) ;
connect ( & _terrainAdjustMaxClimbRateFact , & Fact : : valueChanged , this , & TransectStyleComplexItem : : _signalLastSequenceNumberChanged ) ;
connect ( & _terrainAdjustMaxDescentRateFact , & Fact : : valueChanged , this , & TransectStyleComplexItem : : _signalLastSequenceNumberChanged ) ;
connect ( & _terrainAdjustToleranceFact , & Fact : : valueChanged , this , & TransectStyleComplexItem : : _signalLastSequenceNumberChanged ) ;
connect ( & _turnAroundDistanceFact , & Fact : : valueChanged , this , & TransectStyleComplexItem : : complexDistanceChanged ) ;
connect ( & _hoverAndCaptureFact , & Fact : : valueChanged , this , & TransectStyleComplexItem : : complexDistanceChanged ) ;
connect ( & _refly90DegreesFact , & Fact : : valueChanged , this , & TransectStyleComplexItem : : complexDistanceChanged ) ;
@ -114,8 +101,8 @@ TransectStyleComplexItem::TransectStyleComplexItem(Vehicle* vehicle, QString set
@@ -114,8 +101,8 @@ TransectStyleComplexItem::TransectStyleComplexItem(Vehicle* vehicle, QString set
connect ( & _surveyAreaPolygon , & QGCMapPolygon : : pathChanged , this , & TransectStyleComplexItem : : coveredAreaChanged ) ;
connect ( this , & TransectStyleComplexItem : : t ransectPointsChanged, this , & TransectStyleComplexItem : : complexDistanceChanged ) ;
connect ( this , & TransectStyleComplexItem : : t ransectPointsChanged, this , & TransectStyleComplexItem : : greatestDistanceToChanged ) ;
connect ( this , & TransectStyleComplexItem : : visualT ransectPointsChanged, this , & TransectStyleComplexItem : : complexDistanceChanged ) ;
connect ( this , & TransectStyleComplexItem : : visualT ransectPointsChanged, this , & TransectStyleComplexItem : : greatestDistanceToChanged ) ;
}
void TransectStyleComplexItem : : _setCameraShots ( int cameraShots )
@ -162,7 +149,7 @@ void TransectStyleComplexItem::_save(QJsonObject& complexObject)
@@ -162,7 +149,7 @@ void TransectStyleComplexItem::_save(QJsonObject& complexObject)
QJsonValue transectPointsJson ;
// Save transects polyline
JsonHelper : : saveGeoCoordinateArray ( _t ransectPoints , false /* writeAltitude */ , transectPointsJson ) ;
JsonHelper : : saveGeoCoordinateArray ( _visualT ransectPoints , false /* writeAltitude */ , transectPointsJson ) ;
innerObject [ _jsonTransectPointsKey ] = transectPointsJson ;
// Save the interal mission items
@ -226,10 +213,13 @@ bool TransectStyleComplexItem::_load(const QJsonObject& complexObject, QString&
@@ -226,10 +213,13 @@ bool TransectStyleComplexItem::_load(const QJsonObject& complexObject, QString&
return false ;
}
#if 0
// FIXME
// Load transect points
if ( ! JsonHelper : : loadGeoCoordinateArray ( innerObject [ _jsonTransectPointsKey ] , false /* altitudeRequired */ , _transectPoints , errorString ) ) {
return false ;
}
# endif
// Load generated mission items
_loadedMissionItemsParent = new QObject ( this ) ;
@ -277,8 +267,8 @@ bool TransectStyleComplexItem::_load(const QJsonObject& complexObject, QString&
@@ -277,8 +267,8 @@ bool TransectStyleComplexItem::_load(const QJsonObject& complexObject, QString&
double TransectStyleComplexItem : : greatestDistanceTo ( const QGeoCoordinate & other ) const
{
double greatestDistance = 0.0 ;
for ( int i = 0 ; i < _t ransectPoints . count ( ) ; i + + ) {
QGeoCoordinate vertex = _t ransectPoints [ i ] . value < QGeoCoordinate > ( ) ;
for ( int i = 0 ; i < _visualT ransectPoints . count ( ) ; i + + ) {
QGeoCoordinate vertex = _visualT ransectPoints [ i ] . value < QGeoCoordinate > ( ) ;
double distance = vertex . distanceTo ( other ) ;
if ( distance > greatestDistance ) {
greatestDistance = distance ;
@ -327,11 +317,6 @@ void TransectStyleComplexItem::_updateCoordinateAltitudes(void)
@@ -327,11 +317,6 @@ void TransectStyleComplexItem::_updateCoordinateAltitudes(void)
emit exitCoordinateChanged ( exitCoordinate ( ) ) ;
}
void TransectStyleComplexItem : : _signalLastSequenceNumberChanged ( void )
{
emit lastSequenceNumberChanged ( lastSequenceNumber ( ) ) ;
}
double TransectStyleComplexItem : : coveredArea ( void ) const
{
return _surveyAreaPolygon . area ( ) ;
@ -355,7 +340,21 @@ bool TransectStyleComplexItem::hoverAndCaptureAllowed(void) const
@@ -355,7 +340,21 @@ bool TransectStyleComplexItem::hoverAndCaptureAllowed(void) const
void TransectStyleComplexItem : : _rebuildTransects ( void )
{
_rebuildTransectsPhase1 ( ) ;
_queryTransectsPathHeightInfo ( ) ;
// 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 ) ) ;
}
}
emit visualTransectPointsChanged ( ) ;
_rebuildTransectsPhase2 ( ) ;
emit lastSequenceNumberChanged ( lastSequenceNumber ( ) ) ;
}
void TransectStyleComplexItem : : _queryTransectsPathHeightInfo ( void )
@ -367,89 +366,104 @@ void TransectStyleComplexItem::_queryTransectsPathHeightInfo(void)
@@ -367,89 +366,104 @@ void TransectStyleComplexItem::_queryTransectsPathHeightInfo(void)
_terrainPolyPathQuery = NULL ;
}
if ( _transectPoint s . count ( ) > 1 ) {
if ( _transects . count ( ) ) {
// We don't actually send the query until this timer times out. This way we only send
// the lase t request if we get a bunch in a row.
// the late st request if we get a bunch in a row.
_terrainQueryTimer . start ( ) ;
}
}
void TransectStyleComplexItem : : _reallyQueryTransectsPathHeightInfo ( void )
{
if ( _transectPoints . count ( ) > 1 ) {
// Append all transects into a single PolyPath query
QList < QGeoCoordinate > transectPoints ;
foreach ( const QList < CoordInfo_t > & transect , _transects ) {
foreach ( const CoordInfo_t & coordInfo , transect ) {
transectPoints . append ( coordInfo . coord ) ;
}
}
if ( transectPoints . count ( ) > 1 ) {
_terrainPolyPathQuery = new TerrainPolyPathQuery ( this ) ;
connect ( _terrainPolyPathQuery , & TerrainPolyPathQuery : : terrainData , this , & TransectStyleComplexItem : : _polyPathTerrainData ) ;
_terrainPolyPathQuery - > requestData ( _transectPoints ) ;
_terrainPolyPathQuery - > requestData ( transectPoints ) ;
}
}
void TransectStyleComplexItem : : _polyPathTerrainData ( bool success , const QList < TerrainPathQuery : : PathHeightInfo_t > & rgPathHeightInfo )
{
_transectsPathHeightInfo . clear ( ) ;
if ( success ) {
_transectsPathHeightInfo = rgPathHeightInfo ;
} else {
_transectsPathHeightInfo . clear ( ) ;
// Break out into individual transects
int pathHeightIndex = 0 ;
for ( int i = 0 ; i < _transects . count ( ) ; i + + ) {
_transectsPathHeightInfo . append ( QList < TerrainPathQuery : : PathHeightInfo_t > ( ) ) ;
int cPathHeight = _transects [ i ] . count ( ) - 1 ;
while ( cPathHeight - - > 0 ) {
_transectsPathHeightInfo [ i ] . append ( rgPathHeightInfo [ pathHeightIndex + + ] ) ;
}
pathHeightIndex + + ; // There is an extra on between each transect
}
// Now that we have terrain data we can adjust
_adjustTransectsForTerrain ( ) ;
}
}
bool TransectStyleComplexItem : : readyForSave ( void ) const
{
// Make sure we have the terrain data we need
return _transectPoints . count ( ) > 1 ? _transectsPathHeightInfo . count ( ) : false ;
return _followTerrain ? _transectsPathHeightInfo . count ( ) : tru e;
}
/// Add altitude values to the standard transect points (whether following terrain or not)
void TransectStyleComplexItem : : _adjustTransectPointsForTerrain ( void )
void TransectStyleComplexItem : : _adjustTransectsForTerrain ( void )
{
if ( _followTerrain & & ! readyForSave ( ) ) {
qCWarning ( TransectStyleComplexItemLog ) < < " _adjustTransectPointsForTerrain called when terrain data not ready " ;
qgcApp ( ) - > showMessage ( tr ( " INTERNAL ERROR: TransectStyleComplexItem::_adjustTransectPointsForTerrain called when terrain data not ready. Plan will be incorrect. " ) ) ;
return ;
}
double requestedAltitude = _cameraCalc . distanceToSurface ( ) - > rawValue ( ) . toDouble ( ) ;
qDebug ( ) < < _transectPoints . count ( ) < < _transectsPathHeightInfo . count ( ) ;
for ( int i = 0 ; i < _transectPoints . count ( ) - 1 ; i + + ) {
QGeoCoordinate transectPoint = _transectPoints [ i ] . value < QGeoCoordinate > ( ) ;
if ( _followTerrain ) {
if ( ! readyForSave ( ) ) {
qCWarning ( TransectStyleComplexItemLog ) < < " _adjustTransectPointsForTerrain called when terrain data not ready " ;
qgcApp ( ) - > showMessage ( tr ( " INTERNAL ERROR: TransectStyleComplexItem::_adjustTransectPointsForTerrain called when terrain data not ready. Plan will be incorrect. " ) ) ;
return ;
}
bool surveyEdgeIndicator = transectPoint . altitude ( ) = = _surveyEdgeIndicator ;
if ( _followTerrain ) {
transectPoint . setAltitude ( _transectsPathHeightInfo [ i ] . heights [ 0 ] + requestedAltitude ) ;
} else {
transectPoint . setAltitude ( requestedAltitude ) ;
// First step is add all interstitial points at max resolution
for ( int i = 0 ; i < _transects . count ( ) ; i + + ) {
_addInterstitialTerrainPoints ( _transects [ i ] , _transectsPathHeightInfo [ i ] ) ;
}
if ( surveyEdgeIndicator ) {
// Use to indicate survey edge
transectPoint . setAltitude ( - transectPoint . altitude ( ) ) ;
for ( int i = 0 ; i < _transects . count ( ) ; i + + ) {
_adjustForMaxRates ( _transects [ i ] ) ;
}
_transectPoints [ i ] = QVariant : : fromValue ( transectPoint ) ;
}
for ( int i = 0 ; i < _transects . count ( ) ; i + + ) {
_adjustForTolerance ( _transects [ i ] ) ;
}
// Take care of last point
QGeoCoordinate transectPoint = _transectPoints . last ( ) . value < QGeoCoordinate > ( ) ;
bool surveyEdgeIndicator = transectPoint . altitude ( ) = = _surveyEdgeIndicator ;
if ( _followTerrain ) {
transectPoint . setAltitude ( _transectsPathHeightInfo . last ( ) . heights . last ( ) + requestedAltitude ) ;
emit lastSequenceNumberChanged ( lastSequenceNumber ( ) ) ;
} else {
transectPoint . setAltitude ( requestedAltitude ) ;
}
if ( surveyEdgeIndicator ) {
// Use to indicate survey edge
transectPoint . setAltitude ( - transectPoint . altitude ( ) ) ;
}
_transectPoints [ _transectPoints . count ( ) - 1 ] = QVariant : : fromValue ( transectPoint ) ;
// Not following terrain show just add requested altitude to coords
double requestedAltitude = _cameraCalc . distanceToSurface ( ) - > rawValue ( ) . toDouble ( ) ;
for ( int i = 0 ; i < _transects . count ( ) ; i + + ) {
QList < CoordInfo_t > & transect = _transects [ i ] ;
_addInterstitialTransectsForTerrain ( ) ;
for ( int j = 0 ; j < transect . count ( ) ; j + + ) {
QGeoCoordinate & coord = transect [ j ] . coord ;
coord . setAltitude ( requestedAltitude ) ;
}
}
}
}
/// Returns the altitude in between the two points on a line.
/// @param precentTowardsTo Example: .25 = twenty five percent along the distance of from to to
double TransectStyleComplexItem : : _altitudeBetweenCoords ( const QGeoCoordinate & fromCoord , const QGeoCoordinate & toCoord , double percentTowardsTo )
{
double fromAlt = qAbs ( fromCoord . altitude ( ) ) ;
double toAlt = qAbs ( toCoord . altitude ( ) ) ;
double fromAlt = fromCoord . altitude ( ) ;
double toAlt = toCoord . altitude ( ) ;
double altDiff = toAlt - fromAlt ;
return fromAlt + ( altDiff * percentTowardsTo ) ;
}
@ -483,55 +497,146 @@ int TransectStyleComplexItem::_maxPathHeight(const TerrainPathQuery::PathHeightI
@@ -483,55 +497,146 @@ int TransectStyleComplexItem::_maxPathHeight(const TerrainPathQuery::PathHeightI
return maxIndex ;
}
/// Add points in between existing points to account for terrain
void TransectStyleComplexItem : : _addInterstitialTransectsForTerrain ( void )
void TransectStyleComplexItem : : _adjustForMaxRates ( QList < CoordInfo_t > & transect )
{
if ( ! _followTerrain ) {
double maxClimbRate = _terrainAdjustMaxClimbRateFact . rawValue ( ) . toDouble ( ) ;
double maxDescentRate = - _terrainAdjustMaxDescentRateFact . rawValue ( ) . toDouble ( ) ;
double flightSpeed = _missionFlightStatus . vehicleSpeed ;
if ( qIsNaN ( flightSpeed ) | | ( maxClimbRate = = 0 & & maxDescentRate = = 0 ) ) {
if ( qIsNaN ( flightSpeed ) ) {
qWarning ( ) < < " TransectStyleComplexItem::_adjustForMaxRates called with flightSpeed = NaN " ;
}
return ;
}
double requestedAltitude = _cameraCalc . distanceToSurface ( ) - > rawValue ( ) . toDouble ( ) ;
// Adjust climb rates
bool climbRateAdjusted ;
do {
//qDebug() << "climbrate pass";
climbRateAdjusted = false ;
for ( int i = 0 ; i < transect . count ( ) - 1 ; i + + ) {
QGeoCoordinate & fromCoord = transect [ i ] . coord ;
QGeoCoordinate & toCoord = transect [ i + 1 ] . coord ;
double altDifference = toCoord . altitude ( ) - fromCoord . altitude ( ) ;
double distance = fromCoord . distanceTo ( toCoord ) ;
double seconds = distance / flightSpeed ;
double climbRate = altDifference / seconds ;
//qDebug() << QString("Index:%1 altDifference:%2 distance:%3 seconds:%4 climbRate:%5").arg(i).arg(altDifference).arg(distance).arg(seconds).arg(climbRate);
if ( climbRate > 0 & & climbRate - maxClimbRate > 0.1 ) {
double maxAltitudeDelta = maxClimbRate * seconds ;
fromCoord . setAltitude ( toCoord . altitude ( ) - maxAltitudeDelta ) ;
//qDebug() << "Adjusting";
climbRateAdjusted = true ;
}
}
} while ( climbRateAdjusted ) ;
// Adjust descent rates
bool descentRateAdjusted ;
do {
//qDebug() << "descent rate pass";
descentRateAdjusted = false ;
for ( int i = 1 ; i < transect . count ( ) ; i + + ) {
QGeoCoordinate & fromCoord = transect [ i - 1 ] . coord ;
QGeoCoordinate & toCoord = transect [ i ] . coord ;
double altDifference = toCoord . altitude ( ) - fromCoord . altitude ( ) ;
double distance = fromCoord . distanceTo ( toCoord ) ;
double seconds = distance / flightSpeed ;
double descentRate = altDifference / seconds ;
//qDebug() << QString("Index:%1 altDifference:%2 distance:%3 seconds:%4 descentRate:%5").arg(i).arg(altDifference).arg(distance).arg(seconds).arg(descentRate);
if ( descentRate < 0 & & descentRate - maxDescentRate < - 0.1 ) {
double maxAltitudeDelta = maxDescentRate * seconds ;
toCoord . setAltitude ( fromCoord . altitude ( ) + maxAltitudeDelta ) ;
//qDebug() << "Adjusting";
descentRateAdjusted = true ;
}
}
} while ( descentRateAdjusted ) ;
}
void TransectStyleComplexItem : : _adjustForTolerance ( QList < CoordInfo_t > & transect )
{
QList < CoordInfo_t > adjustedPoints ;
double tolerance = _terrainAdjustToleranceFact . rawValue ( ) . toDouble ( ) ;
QList < QVariant > terrainAdjustedTransectPoints ;
// Check for needed terrain adjust in between the transect points
for ( int i = 0 ; i < _transectPoints . count ( ) - 1 ; i + + ) {
terrainAdjustedTransectPoints . append ( _transectPoints [ i ] ) ;
int coordIndex = 0 ;
while ( coordIndex < transect . count ( ) ) {
const CoordInfo_t & fromCoordInfo = transect [ coordIndex ] ;
QGeoCoordinate fromCoord = _transectPoints [ i ] . value < QGeoCoordinate > ( ) ;
QGeoCoordinate toCoord = _transectPoints [ i + 1 ] . value < QGeoCoordinate > ( ) ;
adjustedPoints . append ( fromCoordInfo ) ;
const TerrainPathQuery : : PathHeightInfo_t & pathHeightInfo = _transectsPathHeightInfo [ i ] ;
int cHeights = pathHeightInfo . heights . count ( ) ;
int lastAddedHeightIndex = 0 ;
//qDebug() << "cHeights" << cHeights << pathHeightInfo.heights;
// Walk forward until we fall out of tolerence or find a fixed point
while ( + + coordIndex < transect . count ( ) ) {
const CoordInfo_t & toCoordInfo = transect [ coordIndex ] ;
if ( toCoordInfo . coordType ! = CoordTypeInteriorTerrainAdded | | qAbs ( fromCoordInfo . coord . altitude ( ) - toCoordInfo . coord . altitude ( ) ) > tolerance ) {
adjustedPoints . append ( toCoordInfo ) ;
coordIndex + + ;
break ;
}
}
}
#if 0
qDebug ( ) < < " _adjustForTolerance " ;
foreach ( const TransectStyleComplexItem : : CoordInfo_t & coordInfo , adjustedPoints ) {
qDebug ( ) < < coordInfo . coordType ;
}
# endif
transect = adjustedPoints ;
}
void TransectStyleComplexItem : : _addInterstitialTerrainPoints ( QList < CoordInfo_t > & transect , const QList < TerrainPathQuery : : PathHeightInfo_t > & transectPathHeightInfo )
{
QList < CoordInfo_t > adjustedTransect ;
adjustedTransect . append ( transect . first ( ) ) ;
for ( int i = 0 ; i < transect . count ( ) - 1 ; i + + ) {
CoordInfo_t fromCoordInfo = transect [ i ] ;
CoordInfo_t toCoordInfo = transect [ i + 1 ] ;
for ( int pathHeightIndex = 1 ; pathHeightIndex < pathHeightInfo . heights . count ( ) - 2 ; pathHeightIndex + + ) {
double azimuth = fromCoordInfo . coord . azimuthTo ( toCoordInfo . coord ) ;
double distance = fromCoordInfo . coord . distanceTo ( toCoordInfo . coord ) ;
const TerrainPathQuery : : PathHeightInfo_t & pathHeightInfo = transectPathHeightInfo [ i ] ;
double requestedAltitude = _cameraCalc . distanceToSurface ( ) - > rawValue ( ) . toDouble ( ) ;
fromCoordInfo . coord . setAltitude ( pathHeightInfo . heights . first ( ) + requestedAltitude ) ;
toCoordInfo . coord . setAltitude ( pathHeightInfo . heights . last ( ) + requestedAltitude ) ;
int cHeights = pathHeightInfo . heights . count ( ) ;
for ( int pathHeightIndex = 1 ; pathHeightIndex < cHeights - 1 ; pathHeightIndex + + ) {
double interstitialTerrainHeight = pathHeightInfo . heights [ pathHeightIndex ] ;
double percentTowardsTo = ( 1.0 / ( cHeights - lastAddedHeightIndex ) ) * ( pathHeightIndex - lastAddedHeightIndex ) ;
double interstitialHeight = _altitudeBetweenCoords ( fromCoord , toCoord , percentTowardsTo ) ;
double interstitialDeltaOverTerrain = interstitialHeight - interstitialTerrainHeight ;
double requestedDeltaOverTerrain = requestedAltitude ;
//qDebug() << "interstitialDeltaOverTerrain:requestedDeltaOverTerrain" << interstitialDeltaOverTerrain << requestedDeltaOverTerrain;
if ( qAbs ( requestedDeltaOverTerrain - interstitialDeltaOverTerrain ) > tolerance ) {
// We need to add a new point to adjust for terrain
double azimuth = fromCoord . azimuthTo ( toCoord ) ;
double distance = fromCoord . distanceTo ( toCoord ) ;
QGeoCoordinate interstitialCoord = fromCoord . atDistanceAndAzimuth ( distance * percentTowardsTo , azimuth ) ;
interstitialCoord . setAltitude ( interstitialTerrainHeight + requestedAltitude ) ;
terrainAdjustedTransectPoints . append ( QVariant : : fromValue ( interstitialCoord ) ) ;
fromCoord = interstitialCoord ;
lastAddedHeightIndex = pathHeightIndex ;
//qDebug() << "Added index" << terrainAdjustedTransectPoints.count() - 1;
}
double percentTowardsTo = ( 1.0 / ( cHeights - 1 ) ) * pathHeightIndex ;
CoordInfo_t interstitialCoordInfo ;
interstitialCoordInfo . coordType = CoordTypeInteriorTerrainAdded ;
interstitialCoordInfo . coord = fromCoordInfo . coord . atDistanceAndAzimuth ( distance * percentTowardsTo , azimuth ) ;
interstitialCoordInfo . coord . setAltitude ( interstitialTerrainHeight + requestedAltitude ) ;
adjustedTransect . append ( interstitialCoordInfo ) ;
}
adjustedTransect . append ( toCoordInfo ) ;
}
#if 0
qDebug ( ) < < " _addInterstitialTerrainPoints " ;
foreach ( const TransectStyleComplexItem : : CoordInfo_t & coordInfo , adjustedTransect ) {
qDebug ( ) < < coordInfo . coordType ;
}
terrainAdjustedTransectPoints . append ( _transectPoints . last ( ) ) ;
# endif
_transectPoints = terrainAdjustedTransectPoints ;
transect = adjustedTransect ;
}
void TransectStyleComplexItem : : setFollowTerrain ( bool followTerrain )
@ -541,3 +646,23 @@ void TransectStyleComplexItem::setFollowTerrain(bool followTerrain)
@@ -541,3 +646,23 @@ void TransectStyleComplexItem::setFollowTerrain(bool followTerrain)
emit followTerrainChanged ( followTerrain ) ;
}
}
int TransectStyleComplexItem : : lastSequenceNumber ( void ) const
{
int itemCount = 0 ;
foreach ( const QList < CoordInfo_t > & rgCoordInfo , _transects ) {
itemCount + = rgCoordInfo . count ( ) ;
}
if ( _cameraTriggerInTurnAroundFact . rawValue ( ) . toBool ( ) ) {
// Only one camera start and on camera stop
itemCount + = 2 ;
} else {
// Each transect will have a camera start and stop in it
itemCount + = _transects . count ( ) * 2 ;
}
return _sequenceNumber + itemCount - 1 ;
}