diff --git a/qgroundcontrol.qrc b/qgroundcontrol.qrc
index fc85d1a6eef961ffefdf9bf730ba02ad9f2bb944..a3a9ac9b1bcb3791ef76d2f37830d8084642af74 100644
--- a/qgroundcontrol.qrc
+++ b/qgroundcontrol.qrc
@@ -218,6 +218,8 @@
src/WimaView/WimaGOperationAreaMapVisual.qml
src/WimaView/WimaServiceAreaMapVisual.qml
src/WimaView/WimaGOperationAreaEditor.qml
+ src/WimaView/WimaServiceAreaEditor.qml
+ src/WimaView/WimaVCorridorMapVisual.qml
src/Settings/APMMavlinkStreamRate.SettingsGroup.json
diff --git a/src/QmlControls/QGroundControl.Controls.qmldir b/src/QmlControls/QGroundControl.Controls.qmldir
index f4e1323cde04607fd5181c4b95610174be881fd4..fdfc2a1655ac5ceafe815b03f4dfdc56c4c4a30c 100644
--- a/src/QmlControls/QGroundControl.Controls.qmldir
+++ b/src/QmlControls/QGroundControl.Controls.qmldir
@@ -89,6 +89,9 @@ WimaMapVisual 1.0 WimaMapVisual.qml
WimaGOperationAreaMapVisual 1.0 WimaGOperationAreaMapVisual.qml
WimaGOperationAreaEditor 1.0 WimaGOperationAreaEditor.qml
WimaServiceAreaMapVisual 1.0 WimaServiceAreaMapVisual.qml
+WimaServiceAreaEditor 1.0 WimaServiceAreaEditor.qml
+WimaVCorridorMapVisual 1.0 WimaVCorridorMapVisual.qml
WimaItemEditor 1.0 WimaItemEditor.qml
WimaMapPolygonVisuals 1.0 WimaMapPolygonVisuals.qml
WimaMapPolylineVisuals 1.0 WimaMapPolylineVisuals.qml
+
diff --git a/src/Wima/WimaController.cc b/src/Wima/WimaController.cc
index 100a0597b36f68e64e6796a3428100f36f3c85d5..0a6b974c74b807eeb0ebe95f88cee6c12f964f19 100644
--- a/src/Wima/WimaController.cc
+++ b/src/Wima/WimaController.cc
@@ -1,10 +1,10 @@
#include "WimaController.h"
-#include "MissionController.h"
WimaController::WimaController(QObject *parent) :
QObject (parent)
,_planView (true)
,_visualItems (new QmlObjectListModel(parent))
+ ,_currentPolygonIndex (-1)
{
connect(this, &WimaController::currentPolygonIndexChanged, this, &WimaController::recalcPolygonInteractivity);
}
@@ -30,17 +30,6 @@ void WimaController::setCurrentPolygonIndex(int index)
}
}
-void WimaController::addGOperationArea()
-{
- WimaGOperationArea* newPoly = new WimaGOperationArea(this);
- _visualItems->append(newPoly);
- int newIndex = _visualItems->count()-1;
- _currentPolygonIndex = newIndex;
-
- emit currentPolygonIndexChanged(newIndex);
- emit visualItemsChanged();
-}
-
void WimaController::removeArea(int index)
{
if(index >= 0 && index < _visualItems->count()){
@@ -48,6 +37,13 @@ void WimaController::removeArea(int index)
emit visualItemsChanged();
+ if (_visualItems->count() == 0) {
+ // this branch is reached if all items are removed
+ // to guarentee proper behavior, _currentPolygonIndex must be set to a invalid value, as on constructor init.
+ _currentPolygonIndex = -1;
+ return;
+ }
+
if(_currentPolygonIndex >= _visualItems->count()){
setCurrentPolygonIndex(_visualItems->count() - 1);
}else{
@@ -59,16 +55,75 @@ void WimaController::removeArea(int index)
}
+void WimaController::addGOperationArea()
+{
+ WimaGOperationArea* newPoly = new WimaGOperationArea(this);
+ _visualItems->append(newPoly);
+ int newIndex = _visualItems->count()-1;
+ setCurrentPolygonIndex(newIndex);
+ emit visualItemsChanged();
+}
+
void WimaController::addServiceArea()
{
- resetAllIsCurrentPolygon();
WimaServiceArea* newPoly = new WimaServiceArea(this);
- newPoly->setInteractive(true);
_visualItems->append(newPoly);
-
+ int newIndex = _visualItems->count()-1;
+ setCurrentPolygonIndex(newIndex);
emit visualItemsChanged();
}
+bool WimaController::addVehicleCorridor(WimaGOperationArea *opArea, WimaServiceArea *serviceArea)
+{
+ WimaVCorridor* corridor = nullptr;
+ if (opArea != nullptr && serviceArea != nullptr){
+ for (int i = 0; i < _visualItems->count(); i++) {
+ corridor = qobject_cast(_visualItems->get(i));
+ if (corridor != nullptr){
+ if (corridor->serviceArea() == serviceArea && corridor->opArea() == opArea){
+ break;
+ }else {
+ corridor = nullptr;
+ }
+ }
+ }
+
+ bool newCorridorCreated = false;
+ if(corridor == nullptr){
+ corridor = new WimaVCorridor(this);
+ newCorridorCreated = true;
+ }else {
+ corridor->clear();
+ }
+
+ QList opAreaPolyline = opArea->polyline()->coordinateList();
+ QList serAreaPolyline = serviceArea->polyline()->coordinateList();
+ if (opAreaPolyline.size() > 1 && serAreaPolyline.size() > 1){
+ corridor->appendVertices(opAreaPolyline);
+ corridor->appendVertices(serAreaPolyline);
+
+ if (newCorridorCreated){
+ corridor->setServiceArea(serviceArea);
+ corridor->setOpArea(opArea);
+ serviceArea->setVehicleCorridor(corridor);
+ opArea->setVehicleCorridor(corridor);
+ _visualItems->append(corridor);
+ emit visualItemsChanged();
+ }
+
+ return true;
+ }else {
+ qWarning("WimaController::addVehicleCorridor(): OpArea or serviceArea polyline size <= 1!");
+ if (newCorridorCreated){
+ corridor->deleteLater();
+ }
+ return false;
+ }
+ }else {
+ return false;
+ }
+}
+
void WimaController::startMission()
{
@@ -89,6 +144,33 @@ void WimaController::resumeMission()
}
+bool WimaController::updateMission()
+{
+ WimaGOperationArea* opArea = nullptr;
+ for (int i = 0; i < _visualItems->count(); i++) {
+ WimaGOperationArea* currentArea = qobject_cast(_visualItems->get(i));
+ if (currentArea != nullptr){
+ opArea = currentArea;
+ break;
+ }
+ }
+
+ WimaServiceArea* serArea = nullptr;
+ for (int i = 0; i < _visualItems->count(); i++) {
+ WimaServiceArea* currentArea = qobject_cast(_visualItems->get(i));
+ if (currentArea != nullptr){
+ serArea = currentArea;
+ break;
+ }
+ }
+
+ if (opArea != nullptr && serArea != nullptr){
+ return addVehicleCorridor(opArea, serArea);
+ }else{
+ return false;
+ }
+}
+
void WimaController::saveMission()
{
diff --git a/src/Wima/WimaController.h b/src/Wima/WimaController.h
index c1b3435280b4fd1976d31c0828ef12d4c275b566..fdc7e3e0c951ba3a3a5c31e0770672624d647aa0 100644
--- a/src/Wima/WimaController.h
+++ b/src/Wima/WimaController.h
@@ -7,6 +7,7 @@
#include "WimaArea.h"
#include "WimaGOperationArea.h"
#include "WimaServiceArea.h"
+#include "WimaVCorridor.h"
#include "PlanMasterController.h"
#include "MissionController.h"
@@ -37,16 +38,23 @@ public:
// Property setters
void setMasterController (PlanMasterController* masterController);
void setMissionController (MissionController* missionController);
+ /// Sets the integer index pointing to the current polygon. Current polygon is set interactive.
void setCurrentPolygonIndex (int index);
Q_INVOKABLE void addGOperationArea();
+ /// Removes an area from _visualItems
+ /// @param index Index of the area to be removed
Q_INVOKABLE void removeArea(int index);
Q_INVOKABLE void addServiceArea();
+ /// @return true if a vehicle corridor was added sucessfully and false otherwise.
+ bool addVehicleCorridor(WimaGOperationArea* opArea, WimaServiceArea* serviceArea);
Q_INVOKABLE void startMission();
Q_INVOKABLE void abortMission();
Q_INVOKABLE void pauseMission();
Q_INVOKABLE void resumeMission();
+ /// Recalculates vehicle corridor, flight path, etc.
+ Q_INVOKABLE bool updateMission();
Q_INVOKABLE void saveMission();
Q_INVOKABLE void loadMission();
diff --git a/src/Wima/WimaGOperationArea.cc b/src/Wima/WimaGOperationArea.cc
index 8e27e1b7bda9e1ef1d8ddf0b29ca884985d4ed7b..f5b2101d5d3f576e61ae5601a0c183048c5d8c61 100644
--- a/src/Wima/WimaGOperationArea.cc
+++ b/src/Wima/WimaGOperationArea.cc
@@ -42,6 +42,21 @@ void WimaGOperationArea::removeVehicle(int vehicleIndex)
}
}
+void WimaGOperationArea::setVehicleCorridor(WimaVCorridor *corridor)
+{
+ if(corridor != nullptr){
+ if (corridor != _vehicleCorridor){
+ _vehicleCorridor = corridor;
+ emit vehicleCorridorChanged(_vehicleCorridor);
+ }
+ else {
+ qWarning("WimaGOperationArea::setVehicleCorridor(): new corridor equals old _vehicleCorridor!");
+ }
+ }else{
+ qWarning("WimaGOperationArea::setVehicleCorridor(): corridor == nullptr!");
+ }
+}
+
/*void WimaGOperationArea::recalculatesubPolygons()
{
int vehicleCount = _vehicleList->count();
diff --git a/src/Wima/WimaGOperationArea.h b/src/Wima/WimaGOperationArea.h
index 27e25d2ac078048db60a672d8c6f14dbdce2595d..c234170463ed364e58b430c8c64ed3adc42fce02 100644
--- a/src/Wima/WimaGOperationArea.h
+++ b/src/Wima/WimaGOperationArea.h
@@ -4,6 +4,7 @@
#include "WimaArea.h"
#include "SettingsFact.h"
#include "WimaTrackerPolyline.h"
+#include "WimaGOperationArea.h"
#include "QScopedPointer"
@@ -14,16 +15,17 @@ public:
WimaGOperationArea(QObject* parent = nullptr);
WimaGOperationArea(WimaArea* other, QObject* parent = nullptr);
- Q_PROPERTY(Fact* bottomLayerAltitude READ bottomLayerAltitude CONSTANT)
- Q_PROPERTY(Fact* numberOfLayers READ numberOfLayers CONSTANT)
- Q_PROPERTY(Fact* layerDistance READ layerDistance CONSTANT)
+ 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(QmlObjectListModel* vehiclePolygons READ vehiclePolygons NOTIFY vehiclePolygonsChanged)*/
- Q_PROPERTY(WimaTrackerPolyline* polyline READ polyline CONSTANT)
+ Q_PROPERTY(WimaTrackerPolyline* polyline READ polyline CONSTANT)
Q_INVOKABLE void addVehicle (WimaVehicle *vehicle);
Q_INVOKABLE void removeVehicle (int vehicleIndex);
+ void setVehicleCorridor (WimaVCorridor* corridor);
/*Q_INVOKABLE void recalculatesubPolygons ();
Q_INVOKABLE void removeAllVehicles ();
Q_INVOKABLE void addVehiclePolygon ();
@@ -42,6 +44,7 @@ public:
/*QmlObjectListModel* vehicleList (void) const { return _vehicleList;}
QmlObjectListModel* vehiclePolygons (void) const { return _vehiclePolygons;}*/
WimaTrackerPolyline* polyline (void) { return &_polyline;}
+ WimaVCorridor* vehicleCorridor (void) { return _vehicleCorridor;}
static const char* settingsGroup;
@@ -57,7 +60,7 @@ signals:
//void vehicleListChanged (void);
void polylineChanged (void);
//void vehiclePolygonsChanged (void);
-
+ void vehicleCorridorChanged (WimaVCorridor* corridor);
private:
QMap _metaDataMap;
@@ -69,7 +72,9 @@ private:
/*QmlObjectListModel* _vehicleList;
QmlObjectListModel* _vehiclePolygons;*/
- WimaTrackerPolyline _polyline;
+ WimaTrackerPolyline _polyline;
+ WimaVCorridor* _vehicleCorridor;
+
diff --git a/src/Wima/WimaServiceArea.cc b/src/Wima/WimaServiceArea.cc
index af224e93ae1ba91fd2b12063753d33e1cc441263..de15881adc2b77dd21080e1a89a7b626e81f0e0a 100644
--- a/src/Wima/WimaServiceArea.cc
+++ b/src/Wima/WimaServiceArea.cc
@@ -9,6 +9,7 @@ WimaServiceArea::WimaServiceArea(QObject *parent):
WimaServiceArea::WimaServiceArea(WimaArea *other, QObject *parent):
WimaArea (other, parent)
{
+ _polyline.bindPolygon(this);
this->setObjectName("Service Area");
}
@@ -28,3 +29,18 @@ void WimaServiceArea::setLandPosition(QGeoCoordinate* coordinate)
}
}
+void WimaServiceArea::setVehicleCorridor(WimaVCorridor *corridor)
+{
+ if(corridor != nullptr){
+ if (corridor != _vehicleCorridor){
+ _vehicleCorridor = corridor;
+ emit vehicleCorridorChanged(_vehicleCorridor);
+ }
+ else {
+ qWarning("WimaServiceArea::setVehicleCorridor(): new corridor equals old _vehicleCorridor!");
+ }
+ }else{
+ qWarning("WimaServiceArea::setVehicleCorridor(): corridor == nullptr!");
+ }
+}
+
diff --git a/src/Wima/WimaServiceArea.h b/src/Wima/WimaServiceArea.h
index 008191ac1cfeb15f9e4a8e379a763ab8c4b479c7..46d0e1d75cf8a318682b73a2671a1cb6a852c3ed 100644
--- a/src/Wima/WimaServiceArea.h
+++ b/src/Wima/WimaServiceArea.h
@@ -2,6 +2,7 @@
#include
#include "WimaArea.h"
+#include "WimaTrackerPolyline.h"
class WimaServiceArea : public WimaArea
{
@@ -10,8 +11,10 @@ public:
WimaServiceArea(QObject* parent = nullptr);
WimaServiceArea(WimaArea* other = nullptr, QObject* parent = nullptr);
- Q_PROPERTY(QGeoCoordinate* takeOffPosition READ takeOffPosition WRITE setTakeOffPosition NOTIFY takeOffPositionChanged)
- Q_PROPERTY(QGeoCoordinate* landPosition READ landPosition WRITE setLandPosition NOTIFY landPositionChanged)
+ Q_PROPERTY(QGeoCoordinate* takeOffPosition READ takeOffPosition WRITE setTakeOffPosition NOTIFY takeOffPositionChanged)
+ Q_PROPERTY(QGeoCoordinate* landPosition READ landPosition WRITE setLandPosition NOTIFY landPositionChanged)
+ Q_PROPERTY(WimaTrackerPolyline* polyline READ polyline CONSTANT)
+
// Overrides from WimaPolygon
QString mapVisualQML (void) const { return "WimaServiceAreaMapVisual.qml";}
@@ -20,16 +23,23 @@ public:
// Property acessors
QGeoCoordinate* takeOffPosition (void) { return &_takeOffPosition;}
QGeoCoordinate* landPosition (void) { return &_landPosition;}
+ WimaTrackerPolyline* polyline (void) { return &_polyline;}
+ WimaVCorridor* vehicleCorridor (void) { return _vehicleCorridor;}
+
// Property setters
void setTakeOffPosition (QGeoCoordinate* coordinate);
void setLandPosition (QGeoCoordinate* coordinate);
+ void setVehicleCorridor (WimaVCorridor* corridor);
signals:
void takeOffPositionChanged (void);
void landPositionChanged (void);
+ void vehicleCorridorChanged (WimaVCorridor* corridor);
private:
+ WimaTrackerPolyline _polyline;
QGeoCoordinate _takeOffPosition;
QGeoCoordinate _landPosition;
+ WimaVCorridor* _vehicleCorridor;
};
diff --git a/src/Wima/WimaTrackerPolyline.cc b/src/Wima/WimaTrackerPolyline.cc
index db5e2d8442ec27f80afb11a3888a2ec96616f991..9237aea7a5dc13238e741aca221305cc3eb76095 100644
--- a/src/Wima/WimaTrackerPolyline.cc
+++ b/src/Wima/WimaTrackerPolyline.cc
@@ -33,11 +33,12 @@ void WimaTrackerPolyline::unbindPolygon()
}
}
-void WimaTrackerPolyline::swapLimits()
+void WimaTrackerPolyline::swapEndPoints()
{
int storage = _startVertexIndex;
_startVertexIndex = _endVertexIndex;
_endVertexIndex = storage;
+ recalcPolyline();
}
@@ -115,7 +116,7 @@ void WimaTrackerPolyline::snapStartVertex()
void WimaTrackerPolyline::recalcPolyline()
{
- qWarning("WimaTrackerPolyline::recalcPolyline()");
+ //qWarning("WimaTrackerPolyline::recalcPolyline()");
if (_boundArea != nullptr && _boundArea->count() > 0){
if (_startVertexIndex >= _boundArea->count()){
_startVertexIndex = 0;
@@ -124,10 +125,10 @@ void WimaTrackerPolyline::recalcPolyline()
_endVertexIndex = _boundArea->count()-1;
}
- _polyline.clear();
+ this->clear();
int i = _startVertexIndex;
while(1){
- _polyline.appendVertex(_boundArea->vertexCoordinate(i));
+ this->appendVertex(_boundArea->vertexCoordinate(i));
if (i == _boundArea->count()-1 && i != _endVertexIndex){
i = 0;
}else if (i == _endVertexIndex) {
diff --git a/src/Wima/WimaTrackerPolyline.h b/src/Wima/WimaTrackerPolyline.h
index bee769032bfc79872ec546272a38159090788c9a..09eeb59a89d18b114a5618cb99bd535d73770255 100644
--- a/src/Wima/WimaTrackerPolyline.h
+++ b/src/Wima/WimaTrackerPolyline.h
@@ -23,7 +23,7 @@ public:
//Property setters
Q_INVOKABLE void bindPolygon (WimaArea* polygon);
Q_INVOKABLE void unbindPolygon ();
- Q_INVOKABLE void swapLimits ();
+ Q_INVOKABLE void swapEndPoints ();
Q_INVOKABLE void setStartVertexIndex (int PolygonVertexIndex);
Q_INVOKABLE void setEndVertexIndex (int PolygonVertexIndex);
@@ -48,7 +48,6 @@ public slots:
void recalcPolyline(void);
private:
- QGCMapPolyline _polyline;
WimaArea* _boundArea;
// this->vertexCoordinate(this->count()-1) and _boundArea->vertexCoordinate(_startVertexIndex) are linked
int _startVertexIndex;
diff --git a/src/Wima/WimaVCorridor.cc b/src/Wima/WimaVCorridor.cc
index 7a51fdf3b9e130c5ba86a03a69ed7c1efc16f1c0..0ee3ae3e444a421a9f6274d6620b0b739d0d2bd4 100644
--- a/src/Wima/WimaVCorridor.cc
+++ b/src/Wima/WimaVCorridor.cc
@@ -7,7 +7,39 @@ WimaVCorridor::WimaVCorridor(QObject *parent):
}
WimaVCorridor::WimaVCorridor(WimaArea *other, QObject *parent):
- WimaArea (other, parent)
+ WimaArea (other, parent)
+ ,_serviceArea (nullptr)
+ ,_opArea (nullptr)
{
this->setObjectName("Corridor");
}
+
+void WimaVCorridor::setServiceArea(WimaServiceArea *serviceArea)
+{
+ if (serviceArea != nullptr){
+ if(serviceArea != _serviceArea){
+ _serviceArea = serviceArea;
+ emit serviceAreaChanged(_serviceArea);
+ }else {
+ qWarning("WimaVCorridor::setServiceArea(): new serviceArea does not differ from old _serviceArea!");
+ }
+
+ }else {
+ qWarning("WimaVCorridor::setServiceArea(): serviceArea == nullptr!");
+ }
+}
+
+void WimaVCorridor::setOpArea(WimaGOperationArea *opArea)
+{
+ if (opArea != nullptr){
+ if(&opArea != &_opArea){
+ _opArea = opArea;
+ emit opAreaChanged(_opArea);
+ }else {
+ qWarning("WimaVCorridor::setOpArea(): new opArea does not differ from old _opArea!");
+ }
+
+ }else {
+ qWarning("WimaVCorridor::setOpArea(): opArea == nullptr!");
+ }
+}
diff --git a/src/Wima/WimaVCorridor.h b/src/Wima/WimaVCorridor.h
index 3af63c6c9e0aa9f6f6cb1ffa6ef7889952c8ae44..7c87a4fd18c67f0463e780bbe87095e59477bb09 100644
--- a/src/Wima/WimaVCorridor.h
+++ b/src/Wima/WimaVCorridor.h
@@ -2,6 +2,8 @@
#include
#include "WimaArea.h"
+#include "WimaServiceArea.h"
+#include "WimaGOperationArea.h"
class WimaVCorridor : public WimaArea
{
@@ -13,5 +15,20 @@ public:
// Overrides from WimaPolygon
QString mapVisualQML (void) const { return "WimaVCorridorMapVisual.qml";}
QString editorQML (void) const { return "WimaVCorridorEditor.qml";}
+
+ // Methodes
+ void setServiceArea (WimaServiceArea* serviceArea);
+ void setOpArea (WimaGOperationArea* opArea);
+ WimaServiceArea* serviceArea (void) const {return _serviceArea;}
+ WimaGOperationArea* opArea (void) const {return _opArea;}
+
+signals:
+ void serviceAreaChanged (WimaServiceArea* serviceArea);
+ void opAreaChanged (WimaGOperationArea* opArea);
+
+private:
+ WimaServiceArea* _serviceArea;
+ WimaGOperationArea* _opArea;
+
};
diff --git a/src/WimaView/WimaGOperationAreaEditor.qml b/src/WimaView/WimaGOperationAreaEditor.qml
index a0a8a2803fb1208d7bda911dcefa147c727d7ee9..e3c0fa7db5795e6a751fd2181b65d14bf7c8d230 100644
--- a/src/WimaView/WimaGOperationAreaEditor.qml
+++ b/src/WimaView/WimaGOperationAreaEditor.qml
@@ -28,11 +28,29 @@ Rectangle {
property real _margin: ScreenTools.defaultFontPixelWidth / 2
property real _fieldWidth: ScreenTools.defaultFontPixelWidth * 10.5
property var polyline: areaItem.polyline
- property var operatingPolygon: areaItem
+ property bool polylineInteractive: polyline.interactive
+ property bool polygonInteractive: areaItem.interactive
+ property var polygon: areaItem
property bool initNecesarry: true
+ onPolylineInteractiveChanged: {
+ polyline.interactive = polylineInteractive;
+ }
+
+ onPolygonInteractiveChanged: {
+ polygon.interactive = polygonInteractive;
+ }
+
function editPolyline(){
- polyline.interactive = true;
+ if (polylineInteractive){
+ //polyline.interactive = false;
+ polylineInteractive = false;
+ //polygonInteractive = true;
+ }else{
+ //polyline.interactive = true;
+ polylineInteractive = true;
+ //polygonInteractive = false;
+ }
}
@@ -74,7 +92,7 @@ Rectangle {
Layout.fillWidth: true
}
- /*QGCLabel { text: qsTr("Number of Layers") }
+ QGCLabel { text: qsTr("Number of Layers") }
FactTextField {
fact: areaItem.numberOfLayers
Layout.fillWidth: true
@@ -84,7 +102,7 @@ Rectangle {
FactTextField {
fact: areaItem.layerDistance
Layout.fillWidth: true
- }*/
+ }
}
@@ -104,11 +122,21 @@ Rectangle {
anchors.topMargin: _margin / 2
anchors.leftMargin: ScreenTools.defaultFontPixelWidth * 2
anchors.rightMargin: ScreenTools.defaultFontPixelWidth
- text: "Edit Polyline"
+ text: polylineInteractive ? "Done" : "Edit"
onClicked: editPolyline()
}
+ QGCButton {
+ id: swapEndpoints
+ anchors.topMargin: _margin / 2
+ anchors.leftMargin: ScreenTools.defaultFontPixelWidth * 2
+ anchors.rightMargin: ScreenTools.defaultFontPixelWidth
+ text: "Swap End-Points"
+
+ onClicked: polyline.swapEndPoints()
+ }
+
SectionHeader {
id: statsHeader
text: qsTr("Statistics")
diff --git a/src/WimaView/WimaGOperationAreaMapVisual.qml b/src/WimaView/WimaGOperationAreaMapVisual.qml
index 3c14b98fcde2777c26b179209ae6ff632dea355e..6a96c9ce36bcb43d5b9d723436fe088d3bd6a12c 100644
--- a/src/WimaView/WimaGOperationAreaMapVisual.qml
+++ b/src/WimaView/WimaGOperationAreaMapVisual.qml
@@ -65,7 +65,7 @@ Item {
function _addInitialPolyline(){
_polyline.setStartVertexIndex(0);
- _polyline.setEndVertexIndex(2);
+ _polyline.setEndVertexIndex(1);
}
@@ -95,22 +95,10 @@ Item {
mapControl: map
mapPolyline: _polyline
lineWidth: 4
- lineColor: interactive ? "yellow" : "green"
+ lineColor: interactive ? "white" : "green"
+ enableSplitHandels: false
+ enableDragHandels: true
+ edgeHandelsOnly: true
}
- /*QGCMapPolylineVisuals {
- id: mapPolylineVisuals
- qgcView: _root.qgcView
- mapControl: map
- mapPolyline: _polyline
- lineWidth: 3
- lineColor: "#be781c"
- }*/
-
-
-
-
-
-
-
}
diff --git a/src/WimaView/WimaMapPolylineVisuals.qml b/src/WimaView/WimaMapPolylineVisuals.qml
index 7f0e5444b4c4d389ff34dd84c10d6579bd8580ad..72c72ddbaf18e01866eb12a8c902137a4ddc99b8 100644
--- a/src/WimaView/WimaMapPolylineVisuals.qml
+++ b/src/WimaView/WimaMapPolylineVisuals.qml
@@ -108,6 +108,7 @@ Item {
}
Component.onCompleted: {
+ addInitialPolyline()
addVisuals()
if (interactive) {
addHandles()
@@ -151,6 +152,11 @@ Item {
text: qsTr("Remove vertex" )
onTriggered: mapPolyline.removeVertex(menu._removeVertexIndex)
}
+ MenuItem {
+ id: swapEndPoints
+ text: qsTr("Swap End-Points" )
+ onTriggered: mapPolyline.swapEndPoints()
+ }
MenuSeparator {
visible: removeVertexItem.visible
@@ -283,7 +289,7 @@ Item {
onDragStop: {
if (_creationComplete) {
// During component creation some bad coordinate values got through which screws up draw
- mapPolyline.snapVertices(polylineVertex)
+ mapPolyline.snapVertex(polylineVertex)
}
}
diff --git a/src/WimaView/WimaServiceAreaEditor.qml b/src/WimaView/WimaServiceAreaEditor.qml
new file mode 100644
index 0000000000000000000000000000000000000000..a4523051e73ab13aaeecea4514928ce32df9251e
--- /dev/null
+++ b/src/WimaView/WimaServiceAreaEditor.qml
@@ -0,0 +1,155 @@
+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
+
+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 areaItem ///< Mission Item for editor
+
+ property real _margin: ScreenTools.defaultFontPixelWidth / 2
+ property real _fieldWidth: ScreenTools.defaultFontPixelWidth * 10.5
+ property var polyline: areaItem.polyline
+ property bool polylineInteractive: polyline.interactive
+ property bool polygonInteractive: areaItem.interactive
+ property var polygon: areaItem
+ property bool initNecesarry: true
+
+ onPolylineInteractiveChanged: {
+ polyline.interactive = polylineInteractive;
+ }
+
+ onPolygonInteractiveChanged: {
+ polygon.interactive = polygonInteractive;
+ }
+
+ function editPolyline(){
+ if (polylineInteractive){
+ //polyline.interactive = false;
+ polylineInteractive = false;
+ //polygonInteractive = true;
+ }else{
+ //polyline.interactive = true;
+ polylineInteractive = true;
+ //polygonInteractive = false;
+ }
+ }
+
+
+
+
+ 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("Settings")
+ }
+
+ Column {
+ anchors.left: parent.left
+ anchors.right: parent.rightsetI
+ spacing: _margin
+ visible: scanHeader.checked
+
+ GridLayout {
+ anchors.left: parent.left
+ anchors.right: parent.right
+ columnSpacing: _margin
+ rowSpacing: _margin
+ columns: 2
+
+ /*QGCLabel {
+ text: qsTr("Bottom Layer Altitude")
+ }
+ FactTextField {
+ fact: areaItem.bottomLayerAltitude
+ Layout.fillWidth: true
+ }
+
+ QGCLabel { text: qsTr("Number of Layers") }
+ FactTextField {
+ fact: areaItem.numberOfLayers
+ Layout.fillWidth: true
+ }
+
+ QGCLabel { text: qsTr("Layer Distance") }
+ FactTextField {
+ fact: areaItem.layerDistance
+ Layout.fillWidth: true
+ }*/
+
+
+ }
+
+ Item {
+ height: ScreenTools.defaultFontPixelHeight / 2
+ width: 1
+ }
+ } // Column - Scan
+ SectionHeader {
+ id: polylineHeader
+ text: qsTr("Gateway Poly Line")
+ }
+
+ QGCButton {
+ id: polylineEditor
+ anchors.topMargin: _margin / 2
+ anchors.leftMargin: ScreenTools.defaultFontPixelWidth * 2
+ anchors.rightMargin: ScreenTools.defaultFontPixelWidth
+ text: polylineInteractive ? "Done" : "Edit"
+
+ onClicked: editPolyline()
+ }
+
+ QGCButton {
+ id: swapEndpoints
+ anchors.topMargin: _margin / 2
+ anchors.leftMargin: ScreenTools.defaultFontPixelWidth * 2
+ anchors.rightMargin: ScreenTools.defaultFontPixelWidth
+ text: "Swap End-Points"
+
+ onClicked: polyline.swapEndPoints()
+ }
+
+ SectionHeader {
+ id: statsHeader
+ text: qsTr("Statistics")
+ }
+
+ Grid {
+ columns: 2
+ columnSpacing: ScreenTools.defaultFontPixelWidth
+ visible: statsHeader.checked
+
+ /*QGCLabel { text: qsTr("Layers") }
+ QGCLabel { text: areaItem.layers.valueString }*/
+
+ }
+ } // Column
+} // Rectangle
diff --git a/src/WimaView/WimaServiceAreaMapVisual.qml b/src/WimaView/WimaServiceAreaMapVisual.qml
index 189a997f47f9818f36bd14d2a53dcae62bfa8ca0..f4249c65bf99a0375f01fc1557b3037afc4496df 100644
--- a/src/WimaView/WimaServiceAreaMapVisual.qml
+++ b/src/WimaView/WimaServiceAreaMapVisual.qml
@@ -25,7 +25,9 @@ Item {
property var map ///< Map control to place item in
property var qgcView ///< QGCView to use for popping dialogs
- property var _polygon: object
+ property var areaItem: object
+ property var _polygon: areaItem
+ property var _polyline: areaItem.polyline
signal clicked(int sequenceNumber)
@@ -61,8 +63,16 @@ Item {
}
}
+ function _addInitialPolyline(){
+ _polyline.setStartVertexIndex(0);
+ _polyline.setEndVertexIndex(1);
+ }
+
+
+
Component.onCompleted: {
_addInitialPolygon()
+ _addInitialPolyline()
}
Component.onDestruction: {
@@ -78,7 +88,14 @@ Item {
interiorOpacity: 0.25
}
-
-
-
+ WimaMapPolylineVisuals {
+ qgcView: _root.qgcView
+ mapControl: map
+ mapPolyline: _polyline
+ lineWidth: 4
+ lineColor: interactive ? "white" : "yellow"
+ enableSplitHandels: false
+ enableDragHandels: true
+ edgeHandelsOnly: true
+ }
}
diff --git a/src/WimaView/WimaVCorridorMapVisual.qml b/src/WimaView/WimaVCorridorMapVisual.qml
new file mode 100644
index 0000000000000000000000000000000000000000..a22033a2cbff35b9561783c7675f89402a2fc4a6
--- /dev/null
+++ b/src/WimaView/WimaVCorridorMapVisual.qml
@@ -0,0 +1,102 @@
+/****************************************************************************
+ *
+ * (c) 2009-2016 QGROUNDCONTROL PROJECT
+ *
+ * QGroundControl is licensed according to the terms in the file
+ * COPYING.md in the root of the source code directory.
+ *
+ ****************************************************************************/
+
+import QtQuick 2.3
+import QtQuick.Controls 1.2
+import QtLocation 5.3
+import QtPositioning 5.3
+
+import QGroundControl 1.0
+import QGroundControl.ScreenTools 1.0
+import QGroundControl.Palette 1.0
+import QGroundControl.Controls 1.0
+import QGroundControl.FlightMap 1.0
+
+/// Wima Global Measurement Area visuals
+Item {
+ id: _root
+
+ property var map ///< Map control to place item in
+ property var qgcView ///< QGCView to use for popping dialogs
+
+ property var areaItem: object
+ property var _polygon: areaItem
+ //property var _polyline: areaItem.polyline
+
+ signal clicked(int sequenceNumber)
+
+ /// Add an initial 4 sided polygon if there is none
+ function _addInitialPolygon() {
+ if (_polygon.count < 3) {
+ // Initial polygon is inset to take 2/3rds space
+ var rect = Qt.rect(map.centerViewport.x, map.centerViewport.y, map.centerViewport.width, map.centerViewport.height)
+ rect.x += (rect.width * 0.25) / 2
+ rect.y += (rect.height * 0.25) / 2
+ rect.width *= 0.25
+ rect.height *= 0.25
+
+ var centerCoord = map.toCoordinate(Qt.point(rect.x + (rect.width / 2), rect.y + (rect.height / 2)), false /* clipToViewPort */)
+ var topLeftCoord = map.toCoordinate(Qt.point(rect.x, rect.y), false /* clipToViewPort */)
+ var topRightCoord = map.toCoordinate(Qt.point(rect.x + rect.width, rect.y), false /* clipToViewPort */)
+ var bottomLeftCoord = map.toCoordinate(Qt.point(rect.x, rect.y + rect.height), false /* clipToViewPort */)
+ var bottomRightCoord = map.toCoordinate(Qt.point(rect.x + rect.width, rect.y + rect.height), false /* clipToViewPort */)
+
+ // Adjust polygon to max size
+ var maxSize = 100
+ var halfWidthMeters = Math.min(topLeftCoord.distanceTo(topRightCoord), maxSize) / 2
+ var halfHeightMeters = Math.min(topLeftCoord.distanceTo(bottomLeftCoord), maxSize) / 2
+ topLeftCoord = centerCoord.atDistanceAndAzimuth(halfWidthMeters, -90).atDistanceAndAzimuth(halfHeightMeters, 0)
+ topRightCoord = centerCoord.atDistanceAndAzimuth(halfWidthMeters, 90).atDistanceAndAzimuth(halfHeightMeters, 0)
+ bottomLeftCoord = centerCoord.atDistanceAndAzimuth(halfWidthMeters, -90).atDistanceAndAzimuth(halfHeightMeters, 180)
+ bottomRightCoord = centerCoord.atDistanceAndAzimuth(halfWidthMeters, 90).atDistanceAndAzimuth(halfHeightMeters, 180)
+
+ _polygon.appendVertex(topLeftCoord)
+ _polygon.appendVertex(topRightCoord)
+ _polygon.appendVertex(bottomRightCoord)
+ _polygon.appendVertex(bottomLeftCoord)
+ }
+ }
+
+ /*function _addInitialPolyline(){
+ _polyline.setStartVertexIndex(0);
+ _polyline.setEndVertexIndex(1);
+ }*/
+
+
+
+ Component.onCompleted: {
+ //_addInitialPolygon()
+ //_addInitialPolyline()
+ }
+
+ Component.onDestruction: {
+ }
+
+ WimaMapPolygonVisuals {
+ qgcView: _root.qgcView
+ mapControl: map
+ mapPolygon: _polygon
+ borderWidth: 1
+ borderColor: "black"
+ interiorColor: "blue"
+ interactive: false
+ interiorOpacity: 0.2
+ }
+
+ /*WimaMapPolylineVisuals {
+ qgcView: _root.qgcView
+ mapControl: map
+ mapPolyline: _polyline
+ lineWidth: 4
+ lineColor: interactive ? "white" : "yellow"
+ enableSplitHandels: false
+ enableDragHandels: true
+ edgeHandelsOnly: true
+ }*/
+}
diff --git a/src/WimaView/WimaView.qml b/src/WimaView/WimaView.qml
index d515b5a65d35e44b03ac75ea4d6647fa1bf9b724..3ef09492612baa435e020eee9d169b1b24bb1415 100644
--- a/src/WimaView/WimaView.qml
+++ b/src/WimaView/WimaView.qml
@@ -624,7 +624,8 @@ QGCView {
/*if (_singleComplexItem) {
addComplexItem(_missionController.complexMissionItemNames[0])
- }*/FlyArea
+ }*/
+ wimaController.updateMission();
break
case 5:
editorMap.zoomLevel += 0.5