diff --git a/src/MissionManager/Survey.SettingsGroup.json b/src/MissionManager/Survey.SettingsGroup.json index b11c5e461e63c143b203be930d5a708cb262659c..8287aa689736c08bc80d1ffabc595fabca0f9f24 100644 --- a/src/MissionManager/Survey.SettingsGroup.json +++ b/src/MissionManager/Survey.SettingsGroup.json @@ -162,7 +162,7 @@ "name": "GridEntryLocation", "shortDescription": "Location for entry point into survey area", "type": "uint32", - "enumStrings": "Position 1, Position 2, Position 3, Position 4", + "enumStrings": "Position 1,Position 2,Position 3,Position 4", "enumValues": "0,1,2,3", "defaultValue": 0 } diff --git a/src/MissionManager/SurveyMissionItem.cc b/src/MissionManager/SurveyMissionItem.cc index 486b1806d0d60f2cbfc5ebff69342ea4acf4ba67..7dce0aefb9bf38bf7a0fd149ab819aa06f236694 100644 --- a/src/MissionManager/SurveyMissionItem.cc +++ b/src/MissionManager/SurveyMissionItem.cc @@ -615,66 +615,26 @@ void SurveyMissionItem::_adjustTransectsToEntryPointLocation(QList= 0.0 && firstTransectAzimuth < 90.0) || (firstTransectAzimuth > 270.0 && firstTransectAzimuth <= 360.0); - qCDebug(SurveyMissionItemLog) << (entryPointBottom ? "Entry point is at bottom" : "Entry point is at top"); - - double entryToExitAzimuth = firstTransectEntry.azimuthTo(lastTransectExit); - qCDebug(SurveyMissionItemLog) << "entryToExitAzimuth" << entryToExitAzimuth; - entryPointLeft = entryToExitAzimuth <= 180.0; - qCDebug(SurveyMissionItemLog) << (entryPointLeft ? "Entry point is at left" : "Entry point is at right"); - } else { - double firstTransectAzimuth = firstTransectEntry.azimuthTo(firstTransectExit); - qCDebug(SurveyMissionItemLog) << "firstTransectAzimuth" << firstTransectAzimuth; - entryPointLeft = firstTransectAzimuth <= 180.0; - qCDebug(SurveyMissionItemLog) << (entryPointLeft ? "Entry point is at left" : "Entry point is at right"); + int entryLocation = _gridEntryLocationFact.rawValue().toInt(); + bool reversePoints = false; + bool reverseTransects = false; - double entryToExitAzimuth = firstTransectEntry.azimuthTo(lastTransectExit); - qCDebug(SurveyMissionItemLog) << "entryToExitAzimuth" << entryToExitAzimuth; - entryPointBottom = (entryToExitAzimuth >= 0.0 && entryToExitAzimuth < 90.0) || (entryToExitAzimuth > 270.0 && entryToExitAzimuth <= 360.0); - qCDebug(SurveyMissionItemLog) << (entryPointBottom ? "Entry point is at bottom" : "Entry point is at top"); + if (entryLocation == EntryLocationBottomLeft || entryLocation == EntryLocationBottomRight) { + reversePoints = true; } - - // Now adjust the transects such that the entry point matches the requested location - - int entryLocation = _gridEntryLocationFact.rawValue().toInt(); - bool reverseTransects; - bool reversePoints; - if (northSouthTransects) { - reversePoints = ((entryLocation == EntryLocationTopLeft || entryLocation == EntryLocationTopRight) && entryPointBottom) || - ((entryLocation == EntryLocationBottomLeft || entryLocation == EntryLocationBottomRight) && !entryPointBottom); - reverseTransects = ((entryLocation == EntryLocationTopRight || entryLocation == EntryLocationBottomRight) && entryPointLeft) || - ((entryLocation == EntryLocationTopLeft || entryLocation == EntryLocationBottomLeft) && !entryPointLeft); - } else { - reverseTransects = ((entryLocation == EntryLocationTopLeft || entryLocation == EntryLocationTopRight) && entryPointBottom) || - ((entryLocation == EntryLocationBottomLeft || entryLocation == EntryLocationBottomRight) && !entryPointBottom); - reversePoints = ((entryLocation == EntryLocationTopRight || entryLocation == EntryLocationBottomRight) && entryPointLeft) || - ((entryLocation == EntryLocationTopLeft || entryLocation == EntryLocationBottomLeft) && !entryPointLeft); + if (entryLocation == EntryLocationTopRight || entryLocation == EntryLocationBottomRight) { + reverseTransects = true; } + if (reversePoints) { qCDebug(SurveyMissionItemLog) << "Reverse Points"; _reverseInternalTransectPoints(transects); } if (reverseTransects) { - // The only way we should end up here is if there is a bug in the original grid line generation - qCDebug(SurveyMissionItemLog) << "Not Reverse Transects"; - //_reverseTransectOrder(transects); + qCDebug(SurveyMissionItemLog) << "Reverse Transects"; + _reverseTransectOrder(transects); } + qCDebug(SurveyMissionItemLog) << "Modified entry point" << transects.first().first(); } @@ -965,11 +925,9 @@ int SurveyMissionItem::_gridGenerator(const QList& polygonPoints, QLis // bounding box to guarantee intersection. QList lineList; - bool northSouthTransects = _gridAngleIsNorthSouthTransects(); - int entryLocation = _gridEntryLocationFact.rawValue().toInt(); // Transects are generated to be as long as the largest width/height of the bounding rect plus some fudge factor. - // This way they will always be guaranteed to intersect with a polyong edge no matter what angle they are rotated to. + // This way they will always be guaranteed to intersect with a polygon edge no matter what angle they are rotated to. // They are initially generated with the transects flowing from west to east and then points within the transect north to south. double maxWidth = qMax(boundingRect.width(), boundingRect.height()) + 100.0; double halfWidth = maxWidth / 2.0; @@ -983,47 +941,6 @@ int SurveyMissionItem::_gridGenerator(const QList& polygonPoints, QLis transectX += gridSpacing; } - // Adjust the transects and points within transect according to the entry location - bool reversePoints = false; - bool reverseTransects = false; - if (northSouthTransects) { - // Transects start north and end south - // Internal transects points are generated north to south so they are correct - if (entryLocation == EntryLocationTopLeft || entryLocation == EntryLocationBottomLeft) { - // Transects lines start west and end east - // Nothing to do in this case since this is how they were initially generated - } else { - // Transects start east and end west - // Need to reverse order of transects - reverseTransects = true; - } - } else { - // Transects start south and end north - // Need to reverse transects - reverseTransects = true; - if (entryLocation == EntryLocationTopLeft || entryLocation == EntryLocationBottomLeft) { - // Transects start west and end east - // Nothing to do in this case since this is how they were initially generated - } else { - // Transects start east and end west - // Need to reverse order of transects - reverseTransects = true; - } - } - - if (reversePoints) { - for (int i=0; i newLineList; - for (int i=0; i intersectLines; #if 1