Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
8144d1f2
Commit
8144d1f2
authored
Nov 08, 2018
by
Gus Grubba
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move split survey polygons from app settings to survey settings.
parent
bec854d0
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
49 additions
and
55 deletions
+49
-55
Survey.SettingsGroup.json
src/MissionManager/Survey.SettingsGroup.json
+6
-0
SurveyComplexItem.cc
src/MissionManager/SurveyComplexItem.cc
+13
-7
SurveyComplexItem.h
src/MissionManager/SurveyComplexItem.h
+5
-0
SurveyItemEditor.qml
src/PlanView/SurveyItemEditor.qml
+1
-1
App.SettingsGroup.json
src/Settings/App.SettingsGroup.json
+0
-7
AppSettings.cc
src/Settings/AppSettings.cc
+23
-35
AppSettings.h
src/Settings/AppSettings.h
+1
-5
No files found.
src/MissionManager/Survey.SettingsGroup.json
View file @
8144d1f2
...
...
@@ -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
}
]
src/MissionManager/SurveyComplexItem.cc
View file @
8144d1f2
...
...
@@ -28,6 +28,7 @@ const char* SurveyComplexItem::settingsGroup = "Survey";
const
char
*
SurveyComplexItem
::
gridAngleName
=
"GridAngle"
;
const
char
*
SurveyComplexItem
::
gridEntryLocationName
=
"GridEntryLocation"
;
const
char
*
SurveyComplexItem
::
flyAlternateTransectsName
=
"FlyAlternateTransects"
;
const
char
*
SurveyComplexItem
::
splitConcavePolygonsName
=
"SplitConcavePolygons"
;
const
char
*
SurveyComplexItem
::
_jsonGridAngleKey
=
"angle"
;
const
char
*
SurveyComplexItem
::
_jsonEntryPointKey
=
"entryLocation"
;
...
...
@@ -58,12 +59,14 @@ const char* SurveyComplexItem::_jsonV3CameraOrientationLandscapeKey = "orienta
const
char
*
SurveyComplexItem
::
_jsonV3FixedValueIsAltitudeKey
=
"fixedValueIsAltitude"
;
const
char
*
SurveyComplexItem
::
_jsonV3Refly90DegreesKey
=
"refly90Degrees"
;
const
char
*
SurveyComplexItem
::
_jsonFlyAlternateTransectsKey
=
"flyAlternateTransects"
;
const
char
*
SurveyComplexItem
::
_jsonSplitConcavePolygonsKey
=
"splitConcavePolygons"
;
SurveyComplexItem
::
SurveyComplexItem
(
Vehicle
*
vehicle
,
bool
flyView
,
const
QString
&
kmlFile
,
QObject
*
parent
)
:
TransectStyleComplexItem
(
vehicle
,
flyView
,
settingsGroup
,
parent
)
,
_metaDataMap
(
FactMetaData
::
createMapFromJsonFile
(
QStringLiteral
(
":/json/Survey.SettingsGroup.json"
),
this
))
,
_gridAngleFact
(
settingsGroup
,
_metaDataMap
[
gridAngleName
])
,
_flyAlternateTransectsFact
(
settingsGroup
,
_metaDataMap
[
flyAlternateTransectsName
])
,
_splitConcavePolygonsFact
(
settingsGroup
,
_metaDataMap
[
splitConcavePolygonsName
])
,
_entryPoint
(
EntryLocationTopLeft
)
{
_editorQml
=
"qrc:/qml/SurveyItemEditor.qml"
;
...
...
@@ -82,14 +85,14 @@ SurveyComplexItem::SurveyComplexItem(Vehicle* vehicle, bool flyView, const QStri
connect
(
&
_gridAngleFact
,
&
Fact
::
valueChanged
,
this
,
&
SurveyComplexItem
::
_setDirty
);
connect
(
&
_flyAlternateTransectsFact
,
&
Fact
::
valueChanged
,
this
,
&
SurveyComplexItem
::
_setDirty
);
connect
(
&
_splitConcavePolygonsFact
,
&
Fact
::
valueChanged
,
this
,
&
SurveyComplexItem
::
_setDirty
);
connect
(
this
,
&
SurveyComplexItem
::
refly90DegreesChanged
,
this
,
&
SurveyComplexItem
::
_setDirty
);
connect
(
&
_gridAngleFact
,
&
Fact
::
valueChanged
,
this
,
&
SurveyComplexItem
::
_rebuildTransects
);
connect
(
&
_flyAlternateTransectsFact
,
&
Fact
::
valueChanged
,
this
,
&
SurveyComplexItem
::
_rebuildTransects
);
connect
(
&
_splitConcavePolygonsFact
,
&
Fact
::
valueChanged
,
this
,
&
SurveyComplexItem
::
_rebuildTransects
);
connect
(
this
,
&
SurveyComplexItem
::
refly90DegreesChanged
,
this
,
&
SurveyComplexItem
::
_rebuildTransects
);
connect
(
qgcApp
()
->
toolbox
()
->
settingsManager
()
->
appSettings
()
->
splitConcavePolygons
(),
&
Fact
::
valueChanged
,
this
,
&
SurveyComplexItem
::
_rebuildTransects
);
// FIXME: Shouldn't these be in TransectStyleComplexItem? They are also in CorridorScanComplexItem constructur
connect
(
&
_cameraCalc
,
&
CameraCalc
::
distanceToSurfaceRelativeChanged
,
this
,
&
SurveyComplexItem
::
coordinateHasRelativeAltitudeChanged
);
connect
(
&
_cameraCalc
,
&
CameraCalc
::
distanceToSurfaceRelativeChanged
,
this
,
&
SurveyComplexItem
::
exitCoordinateHasRelativeAltitudeChanged
);
...
...
@@ -112,6 +115,7 @@ void SurveyComplexItem::save(QJsonArray& planItems)
saveObject
[
ComplexMissionItem
::
jsonComplexItemTypeKey
]
=
jsonComplexItemTypeValue
;
saveObject
[
_jsonGridAngleKey
]
=
_gridAngleFact
.
rawValue
().
toDouble
();
saveObject
[
_jsonFlyAlternateTransectsKey
]
=
_flyAlternateTransectsFact
.
rawValue
().
toBool
();
saveObject
[
_jsonSplitConcavePolygonsKey
]
=
_splitConcavePolygonsFact
.
rawValue
().
toBool
();
saveObject
[
_jsonEntryPointKey
]
=
_entryPoint
;
// Polygon shape
...
...
@@ -168,6 +172,7 @@ bool SurveyComplexItem::_loadV4(const QJsonObject& complexObject, int sequenceNu
{
_jsonEntryPointKey
,
QJsonValue
::
Double
,
true
},
{
_jsonGridAngleKey
,
QJsonValue
::
Double
,
true
},
{
_jsonFlyAlternateTransectsKey
,
QJsonValue
::
Bool
,
false
},
{
_jsonSplitConcavePolygonsKey
,
QJsonValue
::
Bool
,
false
},
};
if
(
!
JsonHelper
::
validateKeys
(
complexObject
,
keyInfoList
,
errorString
))
{
return
false
;
...
...
@@ -196,6 +201,7 @@ bool SurveyComplexItem::_loadV4(const QJsonObject& complexObject, int sequenceNu
_gridAngleFact
.
setRawValue
(
complexObject
[
_jsonGridAngleKey
].
toDouble
());
_flyAlternateTransectsFact
.
setRawValue
(
complexObject
[
_jsonFlyAlternateTransectsKey
].
toBool
(
false
));
_splitConcavePolygonsFact
.
setRawValue
(
complexObject
[
_jsonSplitConcavePolygonsKey
].
toBool
(
true
));
_entryPoint
=
complexObject
[
_jsonEntryPointKey
].
toInt
();
...
...
@@ -1062,7 +1068,7 @@ bool SurveyComplexItem::_hoverAndCaptureEnabled(void) const
void
SurveyComplexItem
::
_rebuildTransectsPhase1
(
void
)
{
bool
split
=
qgcApp
()
->
toolbox
()
->
settingsManager
()
->
appSettings
()
->
splitConcavePolygons
()
->
rawValue
().
toBool
();
bool
split
=
splitConcavePolygons
()
->
rawValue
().
toBool
();
if
(
split
)
{
_rebuildTransectsPhase1WorkerSplitPolygons
(
false
/* refly */
);
}
else
{
...
...
@@ -1087,7 +1093,7 @@ void SurveyComplexItem::_rebuildTransectsPhase1WorkerSinglePolygon(bool refly)
if
(
_loadedMissionItemsParent
)
{
_loadedMissionItems
.
clear
();
_loadedMissionItemsParent
->
deleteLater
();
_loadedMissionItemsParent
=
NULL
;
_loadedMissionItemsParent
=
nullptr
;
}
// First pass will clear old transect data, refly will append to existing data
...
...
@@ -1260,7 +1266,7 @@ void SurveyComplexItem::_rebuildTransectsPhase1WorkerSinglePolygon(bool refly)
double
transectLength
=
transect
[
0
].
distanceTo
(
transect
[
1
]);
double
transectAzimuth
=
transect
[
0
].
azimuthTo
(
transect
[
1
]);
if
(
triggerDistance
()
<
transectLength
)
{
int
cInnerHoverPoints
=
floor
(
transectLength
/
triggerDistance
(
));
int
cInnerHoverPoints
=
static_cast
<
int
>
(
floor
(
transectLength
/
triggerDistance
()
));
qCDebug
(
SurveyComplexItemLog
)
<<
"cInnerHoverPoints"
<<
cInnerHoverPoints
;
for
(
int
i
=
0
;
i
<
cInnerHoverPoints
;
i
++
)
{
QGeoCoordinate
hoverCoord
=
transect
[
0
].
atDistanceAndAzimuth
(
triggerDistance
()
*
(
i
+
1
),
transectAzimuth
);
...
...
@@ -1303,7 +1309,7 @@ void SurveyComplexItem::_rebuildTransectsPhase1WorkerSplitPolygons(bool refly)
if
(
_loadedMissionItemsParent
)
{
_loadedMissionItems
.
clear
();
_loadedMissionItemsParent
->
deleteLater
();
_loadedMissionItemsParent
=
NULL
;
_loadedMissionItemsParent
=
nullptr
;
}
// First pass will clear old transect data, refly will append to existing data
...
...
@@ -1669,7 +1675,7 @@ void SurveyComplexItem::_rebuildTranscetsFromPolygon(bool refly, const QPolygonF
double
transectLength
=
transect
[
0
].
distanceTo
(
transect
[
1
]);
double
transectAzimuth
=
transect
[
0
].
azimuthTo
(
transect
[
1
]);
if
(
triggerDistance
()
<
transectLength
)
{
int
cInnerHoverPoints
=
floor
(
transectLength
/
triggerDistance
(
));
int
cInnerHoverPoints
=
static_cast
<
int
>
(
floor
(
transectLength
/
triggerDistance
()
));
qCDebug
(
SurveyComplexItemLog
)
<<
"cInnerHoverPoints"
<<
cInnerHoverPoints
;
for
(
int
i
=
0
;
i
<
cInnerHoverPoints
;
i
++
)
{
QGeoCoordinate
hoverCoord
=
transect
[
0
].
atDistanceAndAzimuth
(
triggerDistance
()
*
(
i
+
1
),
transectAzimuth
);
...
...
src/MissionManager/SurveyComplexItem.h
View file @
8144d1f2
...
...
@@ -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
;
...
...
@@ -125,11 +128,13 @@ private:
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
;
...
...
src/PlanView/SurveyItemEditor.qml
View file @
8144d1f2
...
...
@@ -124,7 +124,7 @@ Rectangle {
text
:
qsTr
(
"
Split concave polygons
"
)
fact
:
_splitConcave
visible
:
_splitConcave
.
visible
property
Fact
_splitConcave
:
QGroundControl
.
settingsManager
.
appSettings
.
splitConcavePolygons
property
Fact
_splitConcave
:
missionItem
.
splitConcavePolygons
}
FactCheckBox
{
...
...
src/Settings/App.SettingsGroup.json
View file @
8144d1f2
...
...
@@ -199,12 +199,5 @@
"enumStrings"
:
"Never,Always,When in Follow Me Flight Mode"
,
"enumValues"
:
"0,1,2"
,
"defaultValue"
:
0
},
{
"name"
:
"SplitConcavePolygons"
,
"shortDescription"
:
"Split mission concave polygons"
,
"longDescription"
:
"Split mission concave polygons into separate regular, convex polygons"
,
"type"
:
"bool"
,
"defaultValue"
:
false
}
]
src/Settings/AppSettings.cc
View file @
8144d1f2
...
...
@@ -41,7 +41,6 @@ const char* AppSettings::esriTokenName = "EsriTok
const
char
*
AppSettings
::
defaultFirmwareTypeName
=
"DefaultFirmwareType"
;
const
char
*
AppSettings
::
gstDebugName
=
"GstreamerDebugLevel"
;
const
char
*
AppSettings
::
followTargetName
=
"FollowTarget"
;
const
char
*
AppSettings
::
splitConcavePolygonsName
=
"SplitConcavePolygons"
;
const
char
*
AppSettings
::
parameterFileExtension
=
"params"
;
const
char
*
AppSettings
::
planFileExtension
=
"plan"
;
...
...
@@ -62,30 +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
)
,
_splitConcavePolygonsFact
(
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"
);
...
...
@@ -429,13 +427,3 @@ Fact* AppSettings::followTarget(void)
return
_followTargetFact
;
}
Fact
*
AppSettings
::
splitConcavePolygons
(
void
)
{
if
(
!
_splitConcavePolygonsFact
)
{
_splitConcavePolygonsFact
=
_createSettingsFact
(
splitConcavePolygonsName
);
}
return
_splitConcavePolygonsFact
;
}
src/Settings/AppSettings.h
View file @
8144d1f2
...
...
@@ -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
)
...
...
@@ -43,7 +43,6 @@ public:
Q_PROPERTY
(
Fact
*
defaultFirmwareType
READ
defaultFirmwareType
CONSTANT
)
Q_PROPERTY
(
Fact
*
gstDebug
READ
gstDebug
CONSTANT
)
Q_PROPERTY
(
Fact
*
followTarget
READ
followTarget
CONSTANT
)
Q_PROPERTY
(
Fact
*
splitConcavePolygons
READ
splitConcavePolygons
CONSTANT
)
Q_PROPERTY
(
QString
missionSavePath
READ
missionSavePath
NOTIFY
savePathsChanged
)
Q_PROPERTY
(
QString
parameterSavePath
READ
parameterSavePath
NOTIFY
savePathsChanged
)
...
...
@@ -83,7 +82,6 @@ public:
Fact
*
defaultFirmwareType
(
void
);
Fact
*
gstDebug
(
void
);
Fact
*
followTarget
(
void
);
Fact
*
splitConcavePolygons
(
void
);
QString
missionSavePath
(
void
);
QString
parameterSavePath
(
void
);
...
...
@@ -121,7 +119,6 @@ public:
static
const
char
*
defaultFirmwareTypeName
;
static
const
char
*
gstDebugName
;
static
const
char
*
followTargetName
;
static
const
char
*
splitConcavePolygonsName
;
// Application wide file extensions
static
const
char
*
parameterFileExtension
;
...
...
@@ -173,7 +170,6 @@ private:
SettingsFact
*
_defaultFirmwareTypeFact
;
SettingsFact
*
_gstDebugFact
;
SettingsFact
*
_followTargetFact
;
SettingsFact
*
_splitConcavePolygonsFact
;
};
#endif
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment