Commit 86388db3 authored by Valentin Platzgummer's avatar Valentin Platzgummer

facts added to global m area

parent 12f888dc
import QtQuick 2.0
import QtQuick 2.3
import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.4
import QtQuick.Dialogs 1.2
import QtQuick.Extras 1.4
import QtQuick.Layouts 1.2
Item {
import QGroundControl 1.0
import QGroundControl.ScreenTools 1.0
import QGroundControl.Vehicle 1.0
import QGroundControl.Controls 1.0
import QGroundControl.FactControls 1.0
import QGroundControl.Palette 1.0
import QGroundControl.FlightMap 1.0
}
// Editor for Operating Area items
Rectangle {
id: _root
height: visible ? (editorColumn.height + (_margin * 2)) : 0
width: availableWidth
color: qgcPal.windowShadeDark
radius: _radius
// The following properties must be available up the hierarchy chain
//property real availableWidth ///< Width for control
//property var missionItem ///< Mission Item for editor
property real _margin: ScreenTools.defaultFontPixelWidth / 2
property real _fieldWidth: ScreenTools.defaultFontPixelWidth * 10.5
QGCPalette { id: qgcPal; colorGroupEnabled: true }
Column {
id: editorColumn
anchors.margins: _margin
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
spacing: _margin
SectionHeader {
id: scanHeader
text: qsTr("Scan")
}
Column {
anchors.left: parent.left
anchors.right: parent.right
spacing: _margin
visible: scanHeader.checked
GridLayout {
anchors.left: parent.left
anchors.right: parent.right
columnSpacing: _margin
rowSpacing: _margin
columns: 2
FactComboBox {
fact: missionItem.startFromTop
indexModel: true
model: [ qsTr("Start Scan From Bottom"), qsTr("Start Scan From Top") ]
Layout.columnSpan: 2
Layout.fillWidth: true
}
QGCLabel {
text: qsTr("Structure Height")
}
FactTextField {
fact: missionItem.structureHeight
Layout.fillWidth: true
}
QGCLabel { text: qsTr("Scan Bottom Alt") }
FactTextField {
fact: missionItem.scanBottomAlt
Layout.fillWidth: true
}
QGCLabel { text: qsTr("Entrance/Exit Alt") }
FactTextField {
fact: missionItem.entranceAlt
LayoWimaGlobalMeasurementPolygonEditor.qmlut.fillWidth: true
}
QGCLabel {
text: qsTr("Gimbal Pitch")
visible: missionItem.cameraCalc.isManualCamera
}
FactTextField {
fact: missionItem.gimbalPitch
Layout.fillWidth: true
visible: missionItem.cameraCalc.isManualCamera
}
}
Item {
height: ScreenTools.defaultFontPixelHeight / 2
width: 1
}
QGCButton {
text: qsTr("Rotate entry point")
onClicked: missionItem.rotateEntryPoint()
}
} // Column - Scan
SectionHeader {
id: statsHeader
text: qsTr("Statistics")
}
Grid {
columns: 2
columnSpacing: ScreenTools.defaultFontPixelWidth
visible: statsHeader.checked
QGCLabel { text: qsTr("Layers") }
QGCLabel { text: missionItem.layers.valueString }
QGCLabel { text: qsTr("Layer Height") }
QGCLabel { text: missionItem.cameraCalc.adjustedFootprintFrontal.valueString + " " + QGroundControl.appSettingsDistanceUnitsString }
QGCLabel { text: qsTr("Top Layer Alt") }
QGCLabel { text: QGroundControl.metersToAppSettingsDistanceUnits(missionItem.topFlightAlt).toFixed(1) + " " + QGroundControl.appSettingsDistanceUnitsString }
QGCLabel { text: qsTr("Bottom Layer Alt") }
QGCLabel { text: QGroundControl.metersToAppSettingsDistanceUnits(missionItem.bottomFlightAlt).toFixed(1) + " " + QGroundControl.appSettingsDistanceUnitsString }
QGCLabel { text: qsTr("Photo Count") }
QGCLabel { text: missionItem.cameraShots }
QGCLabel { text: qsTr("Photo Interval") }
QGCLabel { text: missionItem.timeBetweenShots.toFixed(1) + " " + qsTr("secs") }
QGCLabel { text: qsTr("Trigger Distance") }
QGCLabel { text: missionItem.cameraCalc.adjustedFootprintSide.valueString + " " + QGroundControl.appSettingsDistanceUnitsString }
}
} // Column
} // Rectangle
......@@ -259,6 +259,7 @@
<file alias="Vehicle/VibrationFact.json">src/Vehicle/VibrationFact.json</file>
<file alias="Vehicle/WindFact.json">src/Vehicle/WindFact.json</file>
<file alias="Video.SettingsGroup.json">src/Settings/Video.SettingsGroup.json</file>
<file>src/MissionManager/WimaGlobalMeasurementPolygon.SettingsGroup.json</file>
</qresource>
<qresource prefix="/MockLink">
<file alias="APMArduCopterMockLink.params">src/comm/APMArduCopterMockLink.params</file>
......
[
{
"name": "BottomLayerAltitude",
"shortDescription": "Altitude of the bottom layer.",
"type": "double",
"units": "m",
"min": 1,
"decimalPlaces": 2,
"defaultValue": 5
},
{
"name": "NumberOfLayers",
"shortDescription": "The number of layers",
"type": "unint32",
"min": 1,
"defaultValue": 1
},
{
"name": "LayerDistance",
"shortDescription": "The distance between to adjacent layers.",
"type": "double",
"units": "m",
"min": 0,
"decimalPlaces": 2,
"defaultValue": 1
}
]
#include "WimaGlobalMeasurementPolygon.h"
const char* WimaGlobalMeasurementPolygon::settingsGroup = "OperatingArea";
const char* WimaGlobalMeasurementPolygon::bottomLayerAltitudeName = "BottomLayerAltitude";
const char* WimaGlobalMeasurementPolygon::numberOfLayersName = "NumberOfLayers";
const char* WimaGlobalMeasurementPolygon::layerDistanceName = "LayerDistance";
WimaGlobalMeasurementPolygon::WimaGlobalMeasurementPolygon(QObject *parent):
WimaPolygon (parent)
WimaGlobalMeasurementPolygon::WimaGlobalMeasurementPolygon(QObject *parent)
: WimaPolygon (parent)
, _metaDataMap (FactMetaData::createMapFromJsonFile(QStringLiteral(":/json/WimaGlobalMeasurementPolygon.SettingsGroup.json"), this /* QObject parent */))
, _bottomLayerAltitude (settingsGroup, _metaDataMap[bottomLayerAltitudeName])
, _numberOfLayers (settingsGroup, _metaDataMap[numberOfLayersName])
, _layerDistance (settingsGroup, _metaDataMap[layerDistanceName])
{
this->setObjectName("Operating Area");
}
......@@ -55,26 +63,4 @@ void WimaGlobalMeasurementPolygon::removeAllVehicles()
emit vehicleListChanged();
}
void WimaGlobalMeasurementPolygon::setBottomLayerAltitude(double altitude)
{
if(altitude > 0 && altitude != _bottomLayerAltitude){
_bottomLayerAltitude = altitude;
emit bottomLayerAltitudeChanged();
}
}
void WimaGlobalMeasurementPolygon::setNumberOfLayers(int numberOfLayers)
{
if(numberOfLayers > 0 && _numberOfLayers != numberOfLayers){
_numberOfLayers = numberOfLayers;
emit numberOfLayersChanged();
}
}
void WimaGlobalMeasurementPolygon::setLayerDistance(double distance)
{
if(distance > 0 && distance != _layerDistance){
_layerDistance = distance;
emit layerDistanceChanged();
}
}
......@@ -5,6 +5,7 @@
#include "QGCMapPolyline.h"
#include "QGCMapPolygon.h"
#include "WimaVehicleMeasurementPolygon.h"
#include "SettingsFact.h"
#include "QScopedPointer"
......@@ -15,9 +16,9 @@ public:
WimaGlobalMeasurementPolygon(QObject* parent);
WimaGlobalMeasurementPolygon(QGCMapPolygon* other, QObject* parent);
Q_PROPERTY(double bottomLayerAltitude READ bottomLayerAltitude WRITE setBottomLayerAltitude NOTIFY bottomLayerAltitudeChanged)
Q_PROPERTY(int numberOfLayers READ numberOfLayers WRITE setNumberOfLayers NOTIFY numberOfLayersChanged)
Q_PROPERTY(double layerDistance READ layerDistance WRITE setLayerDistance NOTIFY layerDistanceChanged)
Q_PROPERTY(Fact* bottomLayerAltitude READ bottomLayerAltitude CONSTANT)
Q_PROPERTY(Fact* numberOfLayers READ numberOfLayers CONSTANT)
Q_PROPERTY(Fact* layerDistance READ layerDistance CONSTANT)
Q_PROPERTY(QmlObjectListModel* vehicleList READ vehicleList NOTIFY vehicleListChanged)
Q_PROPERTY(QGCMapPolyline* entryPolyline READ entryPolyline NOTIFY entryPolylineChanged)
......@@ -32,20 +33,17 @@ public:
QString editorQML (void) const { return "WimaGlobalMeasurementPolygonEditor.qml";}
// Property accessors
double bottomLayerAltitude (void) const { return _bottomLayerAltitude;}
int numberOfLayers (void) const { return _numberOfLayers;}
double layerDistance (void) const { return _layerDistance;}
Fact* bottomLayerAltitude (void) { return &_bottomLayerAltitude;}
Fact* numberOfLayers (void) { return &_numberOfLayers;}
Fact* layerDistance (void) { return &_layerDistance;}
QmlObjectListModel* vehicleList (void) const { return _vehicleList;}
QGCMapPolyline* entryPolyline (void) const { return _entryPolyline;}
// Property setters
void setBottomLayerAltitude (double altitude);
void setNumberOfLayers (int numberOfLayers);
void setLayerDistance (double distance);
static const char* settingsGroup;
static const char* bottomLayerAltitudeName;
static const char* numberOfLayersName;
static const char* layerDistanceName;
signals:
......@@ -69,10 +67,5 @@ private:
QGCMapPolyline* _entryPolyline;
SettingsFact
};
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