Unverified Commit 84a6c9d9 authored by Don Gagne's avatar Don Gagne Committed by GitHub

Merge pull request #6962 from mavlink/feature/concave_poly

Feature: Concave Polygon Support by Splitting into Sub-Polygons
parents da8e98a1 a2a82f30
......@@ -13,6 +13,7 @@ Note: This file only contains high level features or important fixes.
* Make Heading to Home available for display from instrument panel.
* Edit Position dialog available on polygon vertices.
* Fixed Wing Landing Pattern: Add stop photo/video support. Defaults to on such that doing an RTL will stop camera.
* Survey Planning: add mode that supports concave polygons
## 3.4
......
......@@ -14,5 +14,11 @@
"shortDescription": "Fly every other transect in each pass.",
"type": "bool",
"defaultValue": false
},
{
"name": "SplitConcavePolygons",
"shortDescription": "Split mission concave polygons into separate regular, convex polygons.",
"type": "bool",
"defaultValue": true
}
]
This diff is collapsed.
......@@ -28,9 +28,11 @@ public:
Q_PROPERTY(Fact* gridAngle READ gridAngle CONSTANT)
Q_PROPERTY(Fact* flyAlternateTransects READ flyAlternateTransects CONSTANT)
Q_PROPERTY(Fact* splitConcavePolygons READ splitConcavePolygons CONSTANT)
Fact* gridAngle (void) { return &_gridAngleFact; }
Fact* flyAlternateTransects (void) { return &_flyAlternateTransectsFact; }
Fact* splitConcavePolygons (void) { return &_splitConcavePolygonsFact; }
Q_INVOKABLE void rotateEntryPoint(void);
......@@ -66,6 +68,7 @@ public:
static const char* gridAngleName;
static const char* gridEntryLocationName;
static const char* flyAlternateTransectsName;
static const char* splitConcavePolygonsName;
static const char* jsonV3ComplexItemTypeValue;
......@@ -109,18 +112,29 @@ private:
double _turnaroundDistance(void) const;
bool _hoverAndCaptureEnabled(void) const;
bool _loadV3(const QJsonObject& complexObject, int sequenceNumber, QString& errorString);
bool _loadV4(const QJsonObject& complexObject, int sequenceNumber, QString& errorString);
bool _loadV4V5(const QJsonObject& complexObject, int sequenceNumber, QString& errorString, int version);
void _rebuildTransectsPhase1Worker(bool refly);
void _rebuildTransectsPhase1WorkerSinglePolygon(bool refly);
void _rebuildTransectsPhase1WorkerSplitPolygons(bool refly);
/// Adds to the _transects array from one polygon
void _rebuildTranscetsFromPolygon(bool refly, const QPolygonF& polygon, const QGeoCoordinate& tangentOrigin, const QPointF* const transitionPoint);
// Decompose polygon into list of convex sub polygons
void _PolygonDecomposeConvex(const QPolygonF& polygon, QList<QPolygonF>& decomposedPolygons);
// return true if vertex a can see vertex b
bool _VertexCanSeeOther(const QPolygonF& polygon, const QPointF* vertexA, const QPointF* vertexB);
bool _VertexIsReflex(const QPolygonF& polygon, const QPointF* vertex);
QMap<QString, FactMetaData*> _metaDataMap;
SettingsFact _gridAngleFact;
SettingsFact _flyAlternateTransectsFact;
SettingsFact _splitConcavePolygonsFact;
int _entryPoint;
static const char* _jsonGridAngleKey;
static const char* _jsonEntryPointKey;
static const char* _jsonFlyAlternateTransectsKey;
static const char* _jsonSplitConcavePolygonsKey;
static const char* _jsonV3GridObjectKey;
static const char* _jsonV3GridAltitudeKey;
......
......@@ -9,6 +9,7 @@ import QGroundControl 1.0
import QGroundControl.ScreenTools 1.0
import QGroundControl.Vehicle 1.0
import QGroundControl.Controls 1.0
import QGroundControl.FactSystem 1.0
import QGroundControl.FactControls 1.0
import QGroundControl.Palette 1.0
import QGroundControl.FlightMap 1.0
......@@ -119,6 +120,13 @@ Rectangle {
onClicked: missionItem.rotateEntryPoint();
}
FactCheckBox {
text: qsTr("Split concave polygons")
fact: _splitConcave
visible: _splitConcave.visible
property Fact _splitConcave: missionItem.splitConcavePolygons
}
FactCheckBox {
text: qsTr("Hover and capture image")
fact: missionItem.hoverAndCapture
......
......@@ -61,29 +61,29 @@ const char* AppSettings::crashDirectory = "CrashLogs";
AppSettings::AppSettings(QObject* parent)
: SettingsGroup (name, settingsGroup, parent)
, _offlineEditingFirmwareTypeFact (NULL)
, _offlineEditingVehicleTypeFact (NULL)
, _offlineEditingCruiseSpeedFact (NULL)
, _offlineEditingHoverSpeedFact (NULL)
, _offlineEditingAscentSpeedFact (NULL)
, _offlineEditingDescentSpeedFact (NULL)
, _batteryPercentRemainingAnnounceFact (NULL)
, _defaultMissionItemAltitudeFact (NULL)
, _telemetrySaveFact (NULL)
, _telemetrySaveNotArmedFact (NULL)
, _audioMutedFact (NULL)
, _virtualJoystickFact (NULL)
, _appFontPointSizeFact (NULL)
, _indoorPaletteFact (NULL)
, _showLargeCompassFact (NULL)
, _savePathFact (NULL)
, _autoLoadMissionsFact (NULL)
, _useChecklistFact (NULL)
, _mapboxTokenFact (NULL)
, _esriTokenFact (NULL)
, _defaultFirmwareTypeFact (NULL)
, _gstDebugFact (NULL)
, _followTargetFact (NULL)
, _offlineEditingFirmwareTypeFact (nullptr)
, _offlineEditingVehicleTypeFact (nullptr)
, _offlineEditingCruiseSpeedFact (nullptr)
, _offlineEditingHoverSpeedFact (nullptr)
, _offlineEditingAscentSpeedFact (nullptr)
, _offlineEditingDescentSpeedFact (nullptr)
, _batteryPercentRemainingAnnounceFact (nullptr)
, _defaultMissionItemAltitudeFact (nullptr)
, _telemetrySaveFact (nullptr)
, _telemetrySaveNotArmedFact (nullptr)
, _audioMutedFact (nullptr)
, _virtualJoystickFact (nullptr)
, _appFontPointSizeFact (nullptr)
, _indoorPaletteFact (nullptr)
, _showLargeCompassFact (nullptr)
, _savePathFact (nullptr)
, _autoLoadMissionsFact (nullptr)
, _useChecklistFact (nullptr)
, _mapboxTokenFact (nullptr)
, _esriTokenFact (nullptr)
, _defaultFirmwareTypeFact (nullptr)
, _gstDebugFact (nullptr)
, _followTargetFact (nullptr)
{
QQmlEngine::setObjectOwnership(this, QQmlEngine::CppOwnership);
qmlRegisterUncreatableType<AppSettings>("QGroundControl.SettingsManager", 1, 0, "AppSettings", "Reference only");
......@@ -427,4 +427,3 @@ Fact* AppSettings::followTarget(void)
return _followTargetFact;
}
......@@ -18,7 +18,7 @@ class AppSettings : public SettingsGroup
Q_OBJECT
public:
AppSettings(QObject* parent = NULL);
AppSettings(QObject* parent = nullptr);
Q_PROPERTY(Fact* offlineEditingFirmwareType READ offlineEditingFirmwareType CONSTANT)
Q_PROPERTY(Fact* offlineEditingVehicleType READ offlineEditingVehicleType CONSTANT)
......@@ -87,8 +87,8 @@ public:
QString parameterSavePath (void);
QString telemetrySavePath (void);
QString logSavePath (void);
QString videoSavePath (void);
QString crashSavePath (void);
QString videoSavePath (void);
QString crashSavePath (void);
static MAV_AUTOPILOT offlineEditingFirmwareTypeFromFirmwareType(MAV_AUTOPILOT firmwareType);
static MAV_TYPE offlineEditingVehicleTypeFromVehicleType(MAV_TYPE vehicleType);
......
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