diff --git a/qgroundcontrol.qrc b/qgroundcontrol.qrc
index 52a5fc8fae9bfea2fa9ba0dde784754a48813f2a..f21a19dc81d50927ac5078bc41d59e291ff433a8 100644
--- a/qgroundcontrol.qrc
+++ b/qgroundcontrol.qrc
@@ -192,6 +192,7 @@
src/Vehicle/WindFact.json
src/Vehicle/VibrationFact.json
src/QmlControls/QGroundControlQmlGlobal.json
- src/MissionManager/RallyPoint.json
+ src/MissionManager/RallyPoint.FactMetaData.json
+ src/MissionManager/Survey.FactMetaData.json
diff --git a/src/MissionEditor/MissionItemEditor.qml b/src/MissionEditor/MissionItemEditor.qml
index 7dbb41bf8039393af0e16a128800d626b66d67fb..7da1e34d275d30bbba04e63fd2f8a7c9c66833fe 100644
--- a/src/MissionEditor/MissionItemEditor.qml
+++ b/src/MissionEditor/MissionItemEditor.qml
@@ -142,7 +142,7 @@ Rectangle {
verticalAlignment: Text.AlignVCenter
text: missionItem.sequenceNumber == 0 ?
qsTr("Planned Home Position") :
- (missionItem.isSimpleItem ? missionItem.commandName : qsTr("Survey (WIP)"))
+ (missionItem.isSimpleItem ? missionItem.commandName : qsTr("Survey"))
color: _outerTextColor
}
diff --git a/src/MissionEditor/RallyPointItemEditor.qml b/src/MissionEditor/RallyPointItemEditor.qml
index 86cf98a61db00c7dbab9ed34cf32dcc5ad738ca5..6d02d007591d860112f206736138051b531da313 100644
--- a/src/MissionEditor/RallyPointItemEditor.qml
+++ b/src/MissionEditor/RallyPointItemEditor.qml
@@ -1,7 +1,6 @@
-import QtQuick 2.2
-import QtQuick.Controls 1.2
-import QtQuick.Controls.Styles 1.2
-import QtQuick.Dialogs 1.2
+import QtQuick 2.2
+import QtQuick.Controls 1.2
+import QtQuick.Layouts 1.2
import QGroundControl.ScreenTools 1.0
import QGroundControl.Vehicle 1.0
@@ -21,7 +20,6 @@ Rectangle {
property bool _currentItem: rallyPoint ? rallyPoint == controller.currentRallyPoint : false
property color _outerTextColor: _currentItem ? "black" : qgcPal.text
- readonly property real _editFieldWidth: Math.min(width - _margin * 2, ScreenTools.defaultFontPixelWidth * 12)
readonly property real _margin: ScreenTools.defaultFontPixelWidth / 2
readonly property real _radius: ScreenTools.defaultFontPixelWidth / 2
readonly property real _titleHeight: ScreenTools.defaultFontPixelHeight * 2
@@ -84,41 +82,39 @@ Rectangle {
anchors.left: parent.left
anchors.right: parent.right
anchors.top: titleBar.bottom
- height: valuesColumn.height + (_margin * 2)
+ height: valuesGrid.height + (_margin * 2)
color: qgcPal.windowShadeDark
visible: _currentItem
radius: _radius
- Column {
- id: valuesColumn
+ GridLayout {
+ id: valuesGrid
anchors.margins: _margin
anchors.left: parent.left
anchors.right: parent.right
anchors.top: parent.top
- spacing: _margin
+ rowSpacing: _margin
+ columnSpacing: _margin
+ rows: rallyPoint ? rallyPoint.textFieldFacts.length : 0
+ flow: GridLayout.TopToBottom
Repeater {
model: rallyPoint ? rallyPoint.textFieldFacts : 0
- Item {
- width: valuesColumn.width
- height: textField.height
+ QGCLabel {
+ text: modelData.name + ":"
+ }
+ }
- QGCLabel {
- id: textFieldLabel
- anchors.baseline: textField.baseline
- text: modelData.name + ":"
- }
+ Repeater {
+ model: rallyPoint ? rallyPoint.textFieldFacts : 0
- FactTextField {
- id: textField
- anchors.right: parent.right
- width: _editFieldWidth
- showUnits: true
- fact: modelData
- }
+ FactTextField {
+ Layout.fillWidth: true
+ showUnits: true
+ fact: modelData
}
- } // Repeater - text fields
- } // Column
+ }
+ } // GridLayout
} // Rectangle
} // Rectangle
diff --git a/src/MissionEditor/SurveyItemEditor.qml b/src/MissionEditor/SurveyItemEditor.qml
index 856f005f8e5a88b7022d9d1fa25570ac63c6db4d..70266d94c8b01efdde8a9232def1227536fbf657 100644
--- a/src/MissionEditor/SurveyItemEditor.qml
+++ b/src/MissionEditor/SurveyItemEditor.qml
@@ -194,9 +194,11 @@ Rectangle {
spacing: _margin
QGCLabel {
+ anchors.left: parent.left
+ anchors.right: parent.right
wrapMode: Text.WordWrap
font.pointSize: ScreenTools.smallFontPointSize
- text: qsTr("Work in progress, be careful!")
+ text: qsTr("Create a flight path to fully cover a polygonal area with a camera.")
}
Repeater {
@@ -210,7 +212,7 @@ Rectangle {
QGCLabel {
anchors.baseline: textField.baseline
anchors.left: parent.left
- text: modelData.name
+ text: modelData.name + ":"
}
FactTextField {
diff --git a/src/MissionManager/RallyPoint.json b/src/MissionManager/RallyPoint.FactMetaData.json
similarity index 100%
rename from src/MissionManager/RallyPoint.json
rename to src/MissionManager/RallyPoint.FactMetaData.json
diff --git a/src/MissionManager/RallyPoint.cc b/src/MissionManager/RallyPoint.cc
index 595b3a82d4a300c606dff0b949e5fa950d5bbe71..753ad3ec3ca188a2ad8578228869f520f59cb23c 100644
--- a/src/MissionManager/RallyPoint.cc
+++ b/src/MissionManager/RallyPoint.cc
@@ -64,7 +64,7 @@ RallyPoint::~RallyPoint()
void RallyPoint::_factSetup(void)
{
if (_metaDataMap.isEmpty()) {
- _metaDataMap = FactMetaData::createMapFromJsonFile(QStringLiteral(":/json/RallyPoint.json"), NULL /* metaDataParent */);
+ _metaDataMap = FactMetaData::createMapFromJsonFile(QStringLiteral(":/json/RallyPoint.FactMetaData.json"), NULL /* metaDataParent */);
}
_longitudeFact.setMetaData(_metaDataMap[_longitudeFactName]);
diff --git a/src/MissionManager/Survey.FactMetaData.json b/src/MissionManager/Survey.FactMetaData.json
new file mode 100644
index 0000000000000000000000000000000000000000..d50d12b9bf80ad162f3084e248332a944b9a8bc8
--- /dev/null
+++ b/src/MissionManager/Survey.FactMetaData.json
@@ -0,0 +1,37 @@
+[
+{
+ "name": "Altitude",
+ "shortDescription": "Altitude for all waypoints within the grid.",
+ "type": "double",
+ "units": "m",
+ "decimalPlaces": 1
+},
+{
+ "name": "Grid angle",
+ "shortDescription": "Angle for parallel lines of grid.",
+ "type": "double",
+ "units": "deg",
+ "decimalPlaces": 1
+},
+{
+ "name": "Grid spacing",
+ "shortDescription": "Amount of spacing in between parallel grid lines.",
+ "type": "double",
+ "decimalPlaces": 2,
+ "units": "m"
+},
+{
+ "name": "Turnaround dist.",
+ "shortDescription": "Amount of additional distance to add outside the grid area for vehicle turnaround.",
+ "type": "double",
+ "decimalPlaces": 2,
+ "units": "m"
+},
+{
+ "name": "Camera trigger distance",
+ "shortDescription": "Distance between each triggering of the camera.",
+ "type": "double",
+ "decimalPlaces": 2,
+ "units": "m"
+}
+]
diff --git a/src/MissionManager/SurveyMissionItem.cc b/src/MissionManager/SurveyMissionItem.cc
index 1f5e61428671e98b92d0928f168f16e23809396c..a4531e54c9fa625a07c97110da7d3ce09b299080 100644
--- a/src/MissionManager/SurveyMissionItem.cc
+++ b/src/MissionManager/SurveyMissionItem.cc
@@ -28,8 +28,16 @@ const char* SurveyMissionItem::_jsonTurnaroundDistKey = "turnaroundDist";
const char* SurveyMissionItem::_jsonCameraTriggerKey = "cameraTrigger";
const char* SurveyMissionItem::_jsonCameraTriggerDistanceKey = "cameraTriggerDistance";
+const char* SurveyMissionItem::_gridAltitudeFactName = "Altitude";
+const char* SurveyMissionItem::_gridAngleFactName = "Grid angle";
+const char* SurveyMissionItem::_gridSpacingFactName = "Grid spacing";
+const char* SurveyMissionItem::_turnaroundDistFactName = "Turnaround dist.";
+const char* SurveyMissionItem::_cameraTriggerDistanceFactName = "Camera trigger distance";
+
const char* SurveyMissionItem::_complexType = "survey";
+QMap SurveyMissionItem::_metaDataMap;
+
SurveyMissionItem::SurveyMissionItem(Vehicle* vehicle, QObject* parent)
: ComplexMissionItem(vehicle, parent)
, _sequenceNumber(0)
@@ -39,41 +47,26 @@ SurveyMissionItem::SurveyMissionItem(Vehicle* vehicle, QObject* parent)
, _surveyDistance(0.0)
, _cameraShots(0)
, _coveredArea(0.0)
-
- , _gridAltitudeFact (0, "Altitude:", FactMetaData::valueTypeDouble)
- , _gridAngleFact (0, "Grid angle:", FactMetaData::valueTypeDouble)
- , _gridSpacingFact (0, "Grid spacing:", FactMetaData::valueTypeDouble)
- , _turnaroundDistFact (0, "Turnaround dist.:", FactMetaData::valueTypeDouble)
- , _cameraTriggerDistanceFact(0, "Camera trigger distance", FactMetaData::valueTypeDouble)
-
- , _gridAltitudeMetaData (FactMetaData::valueTypeDouble)
- , _gridAngleMetaData (FactMetaData::valueTypeDouble)
- , _gridSpacingMetaData (FactMetaData::valueTypeDouble)
- , _turnaroundDistMetaData (FactMetaData::valueTypeDouble)
- , _cameraTriggerDistanceMetaData(FactMetaData::valueTypeDouble)
+ , _gridAltitudeFact (0, _gridAltitudeFactName, FactMetaData::valueTypeDouble)
+ , _gridAngleFact (0, _gridAngleFactName, FactMetaData::valueTypeDouble)
+ , _gridSpacingFact (0, _gridSpacingFactName, FactMetaData::valueTypeDouble)
+ , _turnaroundDistFact (0, _turnaroundDistFactName, FactMetaData::valueTypeDouble)
+ , _cameraTriggerDistanceFact(0, _cameraTriggerDistanceFactName, FactMetaData::valueTypeDouble)
{
+ if (_metaDataMap.isEmpty()) {
+ _metaDataMap = FactMetaData::createMapFromJsonFile(QStringLiteral(":/json/Survey.FactMetaData.json"), NULL /* metaDataParent */);
+ }
+
_gridAltitudeFact.setRawValue(50);
_gridSpacingFact.setRawValue(10);
_turnaroundDistFact.setRawValue(60);
_cameraTriggerDistanceFact.setRawValue(25);
- _gridAltitudeMetaData.setRawUnits("m");
- _gridAngleMetaData.setRawUnits("deg");
- _gridSpacingMetaData.setRawUnits("m");
- _turnaroundDistMetaData.setRawUnits("m");
- _cameraTriggerDistanceMetaData.setRawUnits("m");
-
- _gridAltitudeMetaData.setDecimalPlaces(1);
- _gridAngleMetaData.setDecimalPlaces(1);
- _gridSpacingMetaData.setDecimalPlaces(2);
- _turnaroundDistMetaData.setDecimalPlaces(2);
- _cameraTriggerDistanceMetaData.setDecimalPlaces(2);
-
- _gridAltitudeFact.setMetaData(&_gridAltitudeMetaData);
- _gridAngleFact.setMetaData(&_gridAngleMetaData);
- _gridSpacingFact.setMetaData(&_gridSpacingMetaData);
- _turnaroundDistFact.setMetaData(&_turnaroundDistMetaData);
- _cameraTriggerDistanceFact.setMetaData(&_cameraTriggerDistanceMetaData);
+ _gridAltitudeFact.setMetaData(_metaDataMap[_gridAltitudeFactName]);
+ _gridAngleFact.setMetaData(_metaDataMap[_gridAngleFactName]);
+ _gridSpacingFact.setMetaData(_metaDataMap[_gridSpacingFactName]);
+ _turnaroundDistFact.setMetaData(_metaDataMap[_turnaroundDistFactName]);
+ _cameraTriggerDistanceFact.setMetaData(_metaDataMap[_cameraTriggerDistanceFactName]);
connect(&_gridSpacingFact, &Fact::valueChanged, this, &SurveyMissionItem::_generateGrid);
connect(&_gridAngleFact, &Fact::valueChanged, this, &SurveyMissionItem::_generateGrid);
diff --git a/src/MissionManager/SurveyMissionItem.h b/src/MissionManager/SurveyMissionItem.h
index d31ed97fbe4ba85236ded5de7f3d676049014aa3..ed34cb863bb2a480c5f0fb0de9d397157f1b5490 100644
--- a/src/MissionManager/SurveyMissionItem.h
+++ b/src/MissionManager/SurveyMissionItem.h
@@ -134,11 +134,8 @@ private:
Fact _gridSpacingFact;
Fact _turnaroundDistFact;
Fact _cameraTriggerDistanceFact;
- FactMetaData _gridAltitudeMetaData;
- FactMetaData _gridAngleMetaData;
- FactMetaData _gridSpacingMetaData;
- FactMetaData _turnaroundDistMetaData;
- FactMetaData _cameraTriggerDistanceMetaData;
+
+ static QMap _metaDataMap;
static const char* _jsonTypeKey;
static const char* _jsonPolygonKey;
@@ -151,6 +148,12 @@ private:
static const char* _jsonCameraTriggerKey;
static const char* _jsonCameraTriggerDistanceKey;
+ static const char* _gridAltitudeFactName;
+ static const char* _gridAngleFactName;
+ static const char* _gridSpacingFactName;
+ static const char* _turnaroundDistFactName;
+ static const char* _cameraTriggerDistanceFactName;
+
static const char* _complexType;
};