Commit 12f888dc authored by Valentin Platzgummer's avatar Valentin Platzgummer

about to add fact system to wima

parent 00d7ea68
import QtQuick 2.0
Item {
}
......@@ -1307,3 +1307,6 @@ contains (CONFIG, QGC_DISABLE_INSTALLER_SETUP) {
} else {
include(QGCInstaller.pri)
}
DISTFILES += \
src/MissionManager/WimaGlobalMeasurementPolygon.SettingsGroup.json
......@@ -213,7 +213,8 @@
<file alias="QGroundControl/Controls/WimaMapVisual.qml">src/WimaView/WimaMapVisual.qml</file>
<file alias="QGroundControl/Controls/WimaGlobalMeasurementPolygonMapVisual.qml">src/WimaView/WimaGlobalMeasurementPolygonMapVisual.qml</file>
<file alias="QGroundControl/Controls/WimaServicePolygonMapVisual.qml">src/WimaView/WimaServicePolygonMapVisual.qml</file>
<file alias="WimaItemEditor.qml">src/WimaView/WimaItemEditor.qml</file>
<file alias="QGroundControl/Controls/WimaItemEditor.qml">src/WimaView/WimaItemEditor.qml</file>
<file alias="QGroundControl/Controls/WimaGlobalMeasurementPolygonEditor.qml">WimaGlobalMeasurementPolygonEditor.qml</file>
</qresource>
<qresource prefix="/json">
<file alias="APMMavlinkStreamRate.SettingsGroup.json">src/Settings/APMMavlinkStreamRate.SettingsGroup.json</file>
......
......@@ -23,7 +23,7 @@ void WimaController::setMissionController(MissionController *missionC)
void WimaController::setCurrentPolygonIndex(int index)
{
if(index > 0 && index < _visualItems->count() && index != _currentPolygonIndex){
if(index >= 0 && index < _visualItems->count() && index != _currentPolygonIndex){
_currentPolygonIndex = index;
emit currentPolygonIndexChanged(index);
......@@ -47,6 +47,12 @@ void WimaController::removeArea(int index)
_visualItems->removeAt(index);
emit visualItemsChanged();
if(_currentPolygonIndex >= _visualItems->count()){
setCurrentPolygonIndex(_visualItems->count() - 1);
}else{
recalcPolygonInteractivity(_currentPolygonIndex);
}
}else{
qWarning("Index out of bounds!");
}
......
......@@ -5,7 +5,7 @@
WimaGlobalMeasurementPolygon::WimaGlobalMeasurementPolygon(QObject *parent):
WimaPolygon (parent)
{
this->setObjectName("Operating Area");
}
WimaGlobalMeasurementPolygon::WimaGlobalMeasurementPolygon(QGCMapPolygon *other, QObject *parent):
......
......@@ -44,6 +44,10 @@ public:
void setNumberOfLayers (int numberOfLayers);
void setLayerDistance (double distance);
static const char* settingsGroup;
signals:
void bottomLayerAltitudeChanged (void);
void numberOfLayersChanged (void);
......@@ -54,11 +58,21 @@ signals:
private:
double _bottomLayerAltitude;
int _numberOfLayers;
double _layerDistance;
QMap<QString, FactMetaData*> _metaDataMap;
SettingsFact _bottomLayerAltitude;
SettingsFact _numberOfLayers;
SettingsFact _layerDistance;
QmlObjectListModel* _vehicleList;
QGCMapPolyline* _entryPolyline;
SettingsFact
};
......@@ -36,8 +36,11 @@ void WimaPolygon::setVehicle(Vehicle *vehicle)
void WimaPolygon::setIsCurrentPolygon(bool isCurrentPolygon)
{
_isCurrentPolygon = isCurrentPolygon;
emit isCurrentPolygonChanged();
if(_isCurrentPolygon != isCurrentPolygon){
_isCurrentPolygon = isCurrentPolygon;
emit isCurrentPolygonChanged();
}
}
QList<QGCMapPolygon*>* WimaPolygon::splitPolygonArea(int numberOfFractions)
......
......@@ -42,7 +42,6 @@ public:
//Property setters
void setMaxAltitude (double alt);
void setName (QString name);
void setVehicle (Vehicle* vehicle);
void setIsCurrentPolygon(bool isCurrentPolygon);
......
......@@ -3,7 +3,7 @@
WimaServicePolygon::WimaServicePolygon(QObject *parent):
WimaPolygon (parent)
{
this->setObjectName("Service Area");
}
WimaServicePolygon::WimaServicePolygon(QGCMapPolygon *other, QObject *parent):
......
......@@ -3,7 +3,7 @@
WimaVehicleCorridor::WimaVehicleCorridor(QObject *parent):
WimaPolygon(parent)
{
this->setObjectName("Corridor");
}
WimaVehicleCorridor::WimaVehicleCorridor(QGCMapPolygon *other, QObject *parent):
......
......@@ -4,7 +4,7 @@
WimaVehicleMeasurementPolygon::WimaVehicleMeasurementPolygon(QObject *parent):
WimaPolygon (parent)
{
this->setObjectName("Vehicle Area");
}
WimaVehicleMeasurementPolygon::WimaVehicleMeasurementPolygon(QGCMapPolygon *other, QObject *parent):
......
......@@ -15,14 +15,13 @@ import QGroundControl.Palette 1.0
/// Fly Area Item edit control
Rectangle {
id: _root
height: editorLoader.visible ? (editorLoader.y + editorLoader.height + (_margin * 2)) : (descriptionLabel.y + descriptionLabel.height + _margin / 2)
height: editorLoader.visible ? (editorLoader.y + editorLoader.height + (_margin * 2)) : (commandPicker.y + commandPicker.height + _margin / 2)
color: _currentItem ? qgcPal.missionItemEditor : qgcPal.windowShade
radius: _radius
property var map ///< Map control
property var flyArea
property var wimaController
property var masterController
property var polygon ///< MissionItem associated with this editor
property bool readOnly ///< true: read only view, false: full editing view
property var rootQgcView
property int _index
......@@ -32,16 +31,15 @@ Rectangle {
property var _masterController: masterController
property var _missionController: _masterController.missionController
property bool _currentItem: polygon.interactive
property var _polygon: object.polygon
property bool _currentItem: object.isCurrentPolygon
property color _outerTextColor: _currentItem ? qgcPal.primaryButtonText : qgcPal.text
property bool _noMissionItemsAdded: ListView.view.model.count === 1
property real _sectionSpacer: ScreenTools.defaultFontPixelWidth / 2 // spacing between section headings
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 _hamburgerSize: descriptionLabel.height * 0.75
readonly property bool _waypointsOnlyMode: QGroundControl.corePlugin.options.missionWaypointsOnly
readonly property real _hamburgerSize: commandPicker.height * 0.75
QGCPalette {
id: qgcPal
......@@ -64,10 +62,10 @@ Rectangle {
QGCLabel {
id: label
anchors.verticalCenter: descriptionLabel.verticalCenter
anchors.verticalCenter: commandPicker.verticalCenter
anchors.leftMargin: _margin
anchors.left: parent.left
text: index
text: _index+1
color: _outerTextColor
}
......@@ -75,7 +73,7 @@ Rectangle {
id: hamburger
anchors.rightMargin: ScreenTools.defaultFontPixelWidth
anchors.right: parent.right
anchors.verticalCenter: descriptionLabel.verticalCenter
anchors.verticalCenter: commandPicker.verticalCenter
width: _hamburgerSize
height: _hamburgerSize
sourceSize.height: _hamburgerSize
......@@ -96,43 +94,66 @@ Rectangle {
id: hamburgerMenu
MenuItem {
text: qsTr("Insert Fly Area")
onTriggered: flyArea.appendFlyAreaPolygon()
text: qsTr("Add Operating Area")
onTriggered: wimaController.addGlobalMeasurementArea()
}
MenuItem {
text: qsTr("Add Service Area")
onTriggered: wimaController.addServiceArea()
}
MenuItem {
text: qsTr("Delete")
onTriggered: remove()
}
MenuItem {
text: qsTr("Copy Fly Area")
//onTriggered: //To Do
text: qsTr("Change Area Type ...")
onTriggered: commandPicker.clicked()
}
}
}
QGCLabel {
id: descriptionLabel
QGCButton {
id: commandPicker
anchors.topMargin: _margin / 2
anchors.leftMargin: ScreenTools.defaultFontPixelWidth * 2
anchors.rightMargin: ScreenTools.defaultFontPixelWidth
anchors.left: label.right
anchors.top: parent.top
text: "Fly Area"
verticalAlignment: Text.AlignVCenter
color: _outerTextColor
visible: _currentItem
text: object.objectName;
Component {
id: commandDialog
MissionCommandDialog {
missionItem: object
}
}
onClicked: qgcView.showDialog(commandDialog, qsTr("Select Mission Command"), qgcView.showDialogDefaultWidth, StandardButton.Cancel)
}
QGCLabel {
id: commandLabel
anchors.fill: commandPicker
visible: !_currentItem
verticalAlignment: Text.AlignVCenter
text: object.objectName;
color: _outerTextColor
}
Loader {
id: editorLoader
anchors.leftMargin: _margin
anchors.topMargin: _margin
anchors.left: parent.left
anchors.top: descriptionLabel.bottom
source: "FlyAreaEditor.qml"
anchors.top: commandPicker.bottom
source: object.editorQml
visible: _currentItem
property var masterController: _masterController
......@@ -140,3 +161,8 @@ Rectangle {
property var editorRoot: _root
}
} // Rectangle
......@@ -155,7 +155,7 @@ QGCView {
}
}
}
}_layerWimaPlan
}
Connections {
target: QGroundControl.airspaceManager
......@@ -257,7 +257,7 @@ QGCView {
}
Connections {
target: _missionController_layerWimaPlan
target: _missionController
onNewItemsFromVehicle: {
if (_visualItems && _visualItems.count != 1) {
......@@ -376,7 +376,7 @@ QGCView {
toIndex = 1
}
_missionController.moveMissionItem(_moveDialogMissionItemIndex, toIndex)
hideDialog()_layerWimaPlan
hideDialog()
}
Column {
......@@ -413,7 +413,7 @@ QGCView {
planView: true
qgcView: _qgcView
// This is the center rectangle of the map which is not obscured by tools
// This is the center rectangle of the map which is not_layerWimaPlan obscured by tools
property rect centerViewport: Qt.rect(_leftToolWidth, _toolbarHeight, editorMap.width - _leftToolWidth - _rightPanelWidth, editorMap.height - _statusHeight - _toolbarHeight)
property real _leftToolWidth: toolStrip.x + toolStrip.width
......@@ -434,7 +434,7 @@ QGCView {
QGCMapPalette { id: mapPal; lightColors: editorMap.isSatelliteMap }
onZoomLevelChanged: updateAirspace(false)
onCenterChanged: updateAirspace(false)_layerWimaPlan
onCenterChanged: updateAirspace(false)
MouseArea {
//-- It's a whole lot faster to just fill parent and deal with top offset below
......@@ -785,7 +785,7 @@ QGCView {
//-------------------------------------------------------
// Wima Item Editor
Item {
id: flyAreaItemEditor
id: wimaItemEditor
anchors.left: parent.left
anchors.right: parent.right
anchors.top: rightControls.bottom
......@@ -794,7 +794,7 @@ QGCView {
anchors.bottomMargin: ScreenTools.defaultFontPixelHeight * 0.25
visible: _editingLayer == _layerWima && !planControlColapsed
QGCListView {
id: flyAreaItemEditorListView
id: wimaItemEditorListView
anchors.fill: parent
spacing: ScreenTools.defaultFontPixelHeight / 4
orientation: ListView.Vertical
......@@ -808,20 +808,16 @@ QGCView {
delegate: WimaItemEditor {
map: editorMap
masterController: _planMasterController
flyArea: _flyArea
wimaController: _wimaController
_index: index
polygon: object
width: parent.width
readOnly: false
rootQgcView: _qgcView
onClicked: _flyArea.selectCurrentPolygon(index)
onClicked: _wimaController.currentPolygonIndex = index
onRemove: {
var removeIndex = index
_flyArea.removeFlyAreaPolygon(removeIndex)
if (removeIndex >= _flyArea.polygons.count) {
removeIndex--
}
_flyArea.selectCurrentPolygon(removeIndex)
_wimaController.removeArea(removeIndex)
}
}
}
......@@ -970,7 +966,7 @@ QGCView {
id: clearVehicleMissionDialog
QGCViewMessage {
message: qsTr("Are you sure you want to remove all mission items and clear the mission from the vehicle?")
function accept() {
function accept() {_layerWimaPlan
masterController.removeAllFromVehicle()
hideDialog()
}
......@@ -1065,7 +1061,7 @@ QGCView {
}
QGCButton {
text: qsTr("Save Mission Waypoints As KML...")
text: qsTr("Save Mission Waypoints As K_layerWimaPlanML...")
Layout.columnSpan: 2
enabled: !masterController.syncInProgress && _visualItems.count > 1
onClicked: {
......@@ -1151,13 +1147,13 @@ QGCView {
QGCListView {
anchors.fill: parent
model: _flyArea.polygons
model: wimaController.visualItems
delegate: Rectangle{
height: 15
color: "lightsteelblue"
radius: 1
Text {
text: object.interactive
text: object.isCurrentPolygon
}
}
}
......
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