Commit d24e93d6 authored by Don Gagne's avatar Don Gagne Committed by GitHub

Merge pull request #4083 from DonLakeFlyer/MetaData

Survey: Fact Meta data
parents fc035b29 6dc2f488
......@@ -192,6 +192,7 @@
<file alias="Vehicle/WindFact.json">src/Vehicle/WindFact.json</file>
<file alias="Vehicle/VibrationFact.json">src/Vehicle/VibrationFact.json</file>
<file alias="QGroundControlQmlGlobal.json">src/QmlControls/QGroundControlQmlGlobal.json</file>
<file alias="RallyPoint.json">src/MissionManager/RallyPoint.json</file>
<file alias="RallyPoint.FactMetaData.json">src/MissionManager/RallyPoint.FactMetaData.json</file>
<file alias="Survey.FactMetaData.json">src/MissionManager/Survey.FactMetaData.json</file>
</qresource>
</RCC>
......@@ -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
}
......
import QtQuick 2.2
import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.2
import QtQuick.Dialogs 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 {
id: textFieldLabel
anchors.baseline: textField.baseline
text: modelData.name + ":"
}
}
Repeater {
model: rallyPoint ? rallyPoint.textFieldFacts : 0
FactTextField {
id: textField
anchors.right: parent.right
width: _editFieldWidth
Layout.fillWidth: true
showUnits: true
fact: modelData
}
}
} // Repeater - text fields
} // Column
} // GridLayout
} // Rectangle
} // Rectangle
......@@ -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 {
......
......@@ -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]);
......
[
{
"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"
}
]
......@@ -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<QString, FactMetaData*> 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);
......
......@@ -134,11 +134,8 @@ private:
Fact _gridSpacingFact;
Fact _turnaroundDistFact;
Fact _cameraTriggerDistanceFact;
FactMetaData _gridAltitudeMetaData;
FactMetaData _gridAngleMetaData;
FactMetaData _gridSpacingMetaData;
FactMetaData _turnaroundDistMetaData;
FactMetaData _cameraTriggerDistanceMetaData;
static QMap<QString, FactMetaData*> _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;
};
......
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