diff --git a/src/Wima/WimaArea.cc b/src/Wima/WimaArea.cc index 85fb24f378e0a112a75937995ad74d823ad3b169..bf1040c5fa819eb6db024d19f919c123715bb1fc 100644 --- a/src/Wima/WimaArea.cc +++ b/src/Wima/WimaArea.cc @@ -6,28 +6,41 @@ const char* WimaArea::wimaAreaName = "WimaArea"; const char* WimaArea::areaTypeName = "AreaType"; -WimaArea::WimaArea(QObject *parent) : - WimaArea (nullptr, parent) +WimaArea::WimaArea() + : QGCMapPolygon (nullptr) { - //qWarning() << "WimaPolygon:: polygon count" << _polygon->count(); + this->setObjectName(wimaAreaName); + _maxAltitude = 30; + _wimaVehicle = new WimaVehicle(this); } -WimaArea::WimaArea(QGCMapPolygon *other, QObject *parent) - : QGCMapPolygon (other, parent) +WimaArea::WimaArea(QObject *parent) + : QGCMapPolygon (parent) { this->setObjectName(wimaAreaName); - WimaArea* wimaPoly = qobject_cast(other); - if (wimaPoly != nullptr) { - _maxAltitude = wimaPoly->maxAltitude(); - _wimaVehicle = wimaPoly->vehicle(); - } else { - _maxAltitude = 30; - _wimaVehicle = new WimaVehicle(this); - } + _maxAltitude = 30; + _wimaVehicle = new WimaVehicle(this); } +WimaArea::WimaArea(const QGCMapPolygon &other, QObject *parent) + : QGCMapPolygon (other, parent) +{ + this->setObjectName(wimaAreaName); + _maxAltitude = 30; + _wimaVehicle = new WimaVehicle(this); +} - +WimaArea::WimaArea(const WimaArea &other, QObject *parent) + : WimaArea (parent) +{ + this->setObjectName(wimaAreaName); + this->setPath(other.path()); + this->setCenter(other.center()); + this->setCenterDrag(other.centerDrag()); + this->setInteractive(other.interactive()); + _maxAltitude = other.maxAltitude(); + _wimaVehicle = other.vehicle(); +} void WimaArea::setMaxAltitude(double alt) @@ -38,7 +51,6 @@ void WimaArea::setMaxAltitude(double alt) } } - void WimaArea::setVehicle(WimaVehicle *vehicle) { if(_wimaVehicle != vehicle){ @@ -94,15 +106,15 @@ QGeoCoordinate WimaArea::getClosestVertex(const QGeoCoordinate& coordinate) cons return this->vertexCoordinate(getClosestVertexIndex(coordinate)); } -QGCMapPolygon &WimaArea::toQGCPolygon(const WimaArea &poly) const +QGCMapPolygon WimaArea::toQGCPolygon(const WimaArea &poly) const { - QGCMapPolygon* qgcPoly = new QGCMapPolygon(); - qgcPoly->setPath(poly.path()); - qgcPoly->setCenter(poly.center()); - qgcPoly->setCenterDrag(poly.centerDrag()); - qgcPoly->setInteractive(poly.interactive()); + QGCMapPolygon qgcPoly; + qgcPoly.setPath(poly.path()); + qgcPoly.setCenter(poly.center()); + qgcPoly.setCenterDrag(poly.centerDrag()); + qgcPoly.setInteractive(poly.interactive()); - return *qgcPoly; + return QGCMapPolygon(qgcPoly); } void WimaArea::join(QList* polyList, WimaArea* joinedPoly) @@ -110,18 +122,16 @@ void WimaArea::join(QList* polyList, WimaArea* joinedPoly) return; } -void WimaArea::join(const WimaArea &poly1, const WimaArea &poly2, WimaArea &joinedPoly) +void WimaArea::join(WimaArea &poly1, WimaArea &poly2, WimaArea &joinedPoly) { if (poly1.count() >= 3 && poly2.count() >= 3) { - WimaArea cpoly1(poly1); - WimaArea cpoly2(poly2); - cpoly1.verifyClockwiseWinding(); - cpoly2.verifyClockwiseWinding(); + poly1.verifyClockwiseWinding(); + poly2.verifyClockwiseWinding(); - WimaArea* walkerPoly = &cpoly1; // "walk" on this polygon towards higher indices - WimaArea* crossPoly = &cpoly2; // check for crossings with this polygon while "walking" + WimaArea* walkerPoly = &poly1; // "walk" on this polygon towards higher indices + WimaArea* crossPoly = &poly2; // check for crossings with this polygon while "walking" // and swicht to this polygon on a intersection, // continue to walk towards higher indices @@ -160,7 +170,7 @@ void WimaArea::join(const WimaArea &poly1, const WimaArea &poly2, WimaArea &join QList> neighbourList; QList intersectionList; //qDebug("IntersectionList.size() on init: %i", intersectionList.size()); - intersects(walkerPolySegment, crossPoly, intersectionList, neighbourList); + intersects(walkerPolySegment, *crossPoly, intersectionList, neighbourList); //qDebug("IntersectionList.size(): %i", intersectionList.size()); @@ -215,10 +225,10 @@ void WimaArea::join(const WimaArea &poly1, const WimaArea &poly2, WimaArea &join } } -void WimaArea::join(const WimaArea &poly) +void WimaArea::join(WimaArea &poly) { - WimaArea joinedArea(this); - join(this, poly, joinedArea); + WimaArea joinedArea; + join(*this, poly, joinedArea); this->setPath(joinedArea.path()); return; } @@ -302,7 +312,7 @@ bool WimaArea::intersects(const QGCMapPolyline &line1, const QGCMapPolyline &lin QPointF pt21(x, y); convertGeoToNed(line2.vertexCoordinate(1), origin, &x, &y, &z); - QPointF pt22(x, y); + QPointF pt22(x, y);; QLineF kartLine2(pt21, pt22); @@ -377,6 +387,8 @@ double WimaArea::distInsidePoly(const QGeoCoordinate &c1, const QGeoCoordinate & //if ( intersectionList.size() == (c1InPolyRim || c2InPolyRim ? 2:0) ){ if ( intersectionList.size() == 0 ){ return c1.distanceTo(c2); + } else { + return std::numeric_limits::infinity(); } } else { diff --git a/src/Wima/WimaArea.h b/src/Wima/WimaArea.h index f014f8c3a6d37264589d75d4903dd5835dec7564..a8baab8a57b9f636fffba33b20ec8b6620b756f9 100644 --- a/src/Wima/WimaArea.h +++ b/src/Wima/WimaArea.h @@ -15,8 +15,10 @@ class WimaArea : public QGCMapPolygon //abstract base class for all WimaAreas { Q_OBJECT public: - WimaArea(QObject* parent = nullptr); - WimaArea(QGCMapPolygon* other = nullptr, QObject* parent = nullptr); + WimaArea(); + WimaArea(QObject* parent); + WimaArea(const QGCMapPolygon& other, QObject* parent); + WimaArea(const WimaArea& other, QObject* parent); @@ -45,13 +47,13 @@ public: int getClosestVertexIndex (const QGeoCoordinate& coordinate) const; //iterates over all vertices in _polygon and returns that one closest to coordinate QGeoCoordinate getClosestVertex (const QGeoCoordinate& coordinate) const; - QGCMapPolygon& toQGCPolygon (const WimaArea& poly) const; + QGCMapPolygon toQGCPolygon (const WimaArea& poly) const; static void join (QList* polyList, WimaArea* joinedPoly);// change to & notation /// joins the poly1 and poly2 if possible, joins the polygons to form a simple polygon (no holes) /// see https://en.wikipedia.org/wiki/Simple_polygon /// @return the joined polygon of poly1 and poly2 if possible, poly1 else - static void join (const WimaArea& poly1, const WimaArea& poly2, WimaArea& joinedPoly); - void join (const WimaArea& poly); + static void join (WimaArea &poly1, WimaArea &poly2, WimaArea& joinedPoly); + void join (WimaArea &poly); bool isDisjunct (QList* polyList);// change to & notation, if necessary bool isDisjunct (WimaArea* poly1, WimaArea* poly2);// change to & notation, if necessary /// calculates the next polygon vertex index diff --git a/src/Wima/WimaController.cc b/src/Wima/WimaController.cc index 5468e96f45539aa8151f9270c2bc2a6a110eb544..536d3a93b246adaa753065ce18063f9434fb8207 100644 --- a/src/Wima/WimaController.cc +++ b/src/Wima/WimaController.cc @@ -11,6 +11,16 @@ WimaController::WimaController(QObject *parent) : connect(this, &WimaController::currentPolygonIndexChanged, this, &WimaController::recalcPolygonInteractivity); } +QStringList WimaController::loadNameFilters() const +{ + QStringList filters; + + filters << tr("Supported types (*.%1)").arg(wimaFileExtension) << + tr("All Files (*.*)"); + return filters; + +} + void WimaController::setMasterController(PlanMasterController *masterC) { _masterController = masterC; @@ -106,6 +116,7 @@ void WimaController::resumeMission() bool WimaController::updateMission() { + #define debug 0 // pick first WimaGOperationArea WimaGOperationArea* opArea = nullptr; for (int i = 0; i < _visualItems->count(); i++) { @@ -115,6 +126,8 @@ bool WimaController::updateMission() break; } } + if (opArea == nullptr) + return false; // pick first WimaServiceArea WimaServiceArea* serArea = nullptr; @@ -125,6 +138,8 @@ bool WimaController::updateMission() break; } } + if ( serArea == nullptr ) + return false; // pick first WimaVCorridor WimaVCorridor* corridor = nullptr; @@ -135,18 +150,20 @@ bool WimaController::updateMission() break; } } - // join service area and op area - WimaArea joinedArea(this); + WimaArea joinedArea; if (corridor != nullptr) { WimaArea::join(*corridor, *serArea, joinedArea); joinedArea.join(*opArea); } else { - WimaArea::join(serArea, opArea, joinedArea); + WimaArea::join(*serArea, *opArea, joinedArea); } + #if debug + WimaArea* joinedAreaPt = new WimaArea(joinedArea, this); + _visualItems->append(joinedAreaPt); + #endif - _visualItems->append(&joinedArea); // reset visual items @@ -208,6 +225,8 @@ bool WimaController::updateMission() } } + saveToFile("TestFile"); + return true; } @@ -306,21 +325,21 @@ QJsonDocument WimaController::saveToJson() if (opArea != nullptr) { opArea->saveToJson(json); jsonArray.append(json); - break; + continue; } WimaServiceArea* serArea = qobject_cast(area); if (serArea != nullptr) { serArea->saveToJson(json); jsonArray.append(json); - break; + continue; } WimaVCorridor* corridor = qobject_cast(area); if (corridor != nullptr) { corridor->saveToJson(json); jsonArray.append(json); - break; + continue; } // if non of the obove branches was trigger, type must be WimaArea diff --git a/src/Wima/WimaController.h b/src/Wima/WimaController.h index 42b2424803067b55a750bbe1cbedbbf5f73374c8..cdf961c5f491e7dadd2fbc2bbf58dd06cba400d1 100644 --- a/src/Wima/WimaController.h +++ b/src/Wima/WimaController.h @@ -27,7 +27,9 @@ public: Q_PROPERTY(MissionController* missionController READ missionController WRITE setMissionController NOTIFY missionControllerChanged) Q_PROPERTY(QmlObjectListModel* visualItems READ visualItems NOTIFY visualItemsChanged) Q_PROPERTY(int currentPolygonIndex READ currentPolygonIndex WRITE setCurrentPolygonIndex NOTIFY currentPolygonIndexChanged) - Q_PROPERTY(const QString currentFile READ currentFile NOTIFY currentFileChanged) + Q_PROPERTY(const QString currentFile READ currentFile NOTIFY currentFileChanged) + Q_PROPERTY(QStringList loadNameFilters READ loadNameFilters CONSTANT) + Q_PROPERTY(QString fileExtenstion READ fileExtenstion CONSTANT) // Property accessors @@ -35,8 +37,9 @@ public: MissionController* missionController (void) const { return _missionController; } QmlObjectListModel* visualItems (void) const { return _visualItems; } int currentPolygonIndex (void) const { return _currentPolygonIndex; } - const QString& currentFile (void) const { return _currentFile; } - + const QString currentFile (void) const { return _currentFile; } + QStringList loadNameFilters (void) const; + QString fileExtenstion (void) const { return wimaFileExtension; } diff --git a/src/Wima/WimaGOperationArea.cc b/src/Wima/WimaGOperationArea.cc index 0dbffae517d60c825340c62f46d20b64024e4788..4949ad348e4494fa257547414f6fb5ae6cf73079 100644 --- a/src/Wima/WimaGOperationArea.cc +++ b/src/Wima/WimaGOperationArea.cc @@ -8,14 +8,14 @@ const char* WimaGOperationArea::layerDistanceName = "LayerDistance const char* WimaGOperationArea::borderPolygonOffsetName = "BorderPolygonOffset"; const char* WimaGOperationArea::wimaGOperationAreaName = "Operation Area"; -WimaGOperationArea::WimaGOperationArea(QObject *parent) - : WimaGOperationArea (nullptr, parent) +WimaGOperationArea::WimaGOperationArea() + : WimaGOperationArea(nullptr) { } -WimaGOperationArea::WimaGOperationArea(WimaArea *other, QObject *parent) - : WimaArea(other, parent) +WimaGOperationArea::WimaGOperationArea(QObject *parent) + : WimaArea (parent) , _metaDataMap (FactMetaData::createMapFromJsonFile(QStringLiteral(":/json/WimaGOperationArea.SettingsGroup.json"), this /* QObject parent */)) , _bottomLayerAltitude (settingsGroup, _metaDataMap[bottomLayerAltitudeName]) , _numberOfLayers (settingsGroup, _metaDataMap[numberOfLayersName]) @@ -26,10 +26,22 @@ WimaGOperationArea::WimaGOperationArea(WimaArea *other, QObject *parent) this->setObjectName(wimaGOperationAreaName); connect(this, &WimaGOperationArea::pathChanged, this, &WimaGOperationArea::recalcBorderPolygon); connect(&_borderPolygonOffset, &SettingsFact::rawValueChanged, this, &WimaGOperationArea::recalcBorderPolygon); - //qWarning("Here I am!"); - //connect(&_polyline, &WimaTrackerPolyline::pathChanged, this, &WimaGOperationArea::polylineChanged ); } +WimaGOperationArea::WimaGOperationArea(const WimaArea &other, QObject *parent) + : WimaArea(other, parent) + , _metaDataMap (FactMetaData::createMapFromJsonFile(QStringLiteral(":/json/WimaGOperationArea.SettingsGroup.json"), this /* QObject parent */)) + , _bottomLayerAltitude (settingsGroup, _metaDataMap[bottomLayerAltitudeName]) + , _numberOfLayers (settingsGroup, _metaDataMap[numberOfLayersName]) + , _layerDistance (settingsGroup, _metaDataMap[layerDistanceName]) + , _borderPolygonOffset (settingsGroup, _metaDataMap[borderPolygonOffsetName]) + , _borderPolygon (new QGCMapPolygon(this)) +{ + this->setObjectName(wimaGOperationAreaName); + connect(this, &WimaGOperationArea::pathChanged, this, &WimaGOperationArea::recalcBorderPolygon); + connect(&_borderPolygonOffset, &SettingsFact::rawValueChanged, this, &WimaGOperationArea::recalcBorderPolygon); + } + void WimaGOperationArea::addVehicle(WimaVehicle *vehicle) { if(vehicle != nullptr){ @@ -113,7 +125,7 @@ bool WimaGOperationArea::loadFromJson(const QJsonObject &json, QString& errorStr void WimaGOperationArea::recalcBorderPolygon() { //qWarning("WimaGOperationArea::recalcBorderPolygon() %f", _borderPolygonOffset.rawValue().toDouble()); - QGCMapPolygon polyCopy = this->toQGCPolygon(this); + QGCMapPolygon polyCopy = this->toQGCPolygon(*this); polyCopy.offset(_borderPolygonOffset.rawValue().toDouble()); _borderPolygon.setPath(polyCopy.path()); polyCopy.deleteLater(); diff --git a/src/Wima/WimaGOperationArea.h b/src/Wima/WimaGOperationArea.h index 5e37f2ec5cf987c3813aede719150f903b994087..91a7cbe2eaf534335754f29a6766f6adb2f24f7c 100644 --- a/src/Wima/WimaGOperationArea.h +++ b/src/Wima/WimaGOperationArea.h @@ -12,8 +12,9 @@ class WimaGOperationArea : public WimaArea { Q_OBJECT public: - WimaGOperationArea(QObject* parent = nullptr); - WimaGOperationArea(WimaArea* other, QObject* parent = nullptr); + WimaGOperationArea(); + WimaGOperationArea(QObject* parent); + WimaGOperationArea(const WimaArea& other, QObject* parent = nullptr); Q_PROPERTY(Fact* bottomLayerAltitude READ bottomLayerAltitude CONSTANT) Q_PROPERTY(Fact* numberOfLayers READ numberOfLayers CONSTANT) @@ -42,8 +43,8 @@ public: Fact* bottomLayerAltitude (void) { return &_bottomLayerAltitude;} Fact* numberOfLayers (void) { return &_numberOfLayers;} Fact* layerDistance (void) { return &_layerDistance;} - Fact* borderPolygonOffset (void) { return &_borderPolygonOffset;} - /*QmlObjectListModel* vehicleList (void) const { return _vehicleList;} + Fact* borderPolygonOffset (void) { return &_borderPolygonOffset;} + /*QmlObjectListModel* vehicleList (void) const { return _vehicleList;} QmlObjectListModel* vehiclePolygons (void) const { return _vehiclePolygons;}*/ WimaVCorridor* vehicleCorridor (void) { return _vehicleCorridor;} QGCMapPolygon* borderPolygon (void) { return &_borderPolygon;} @@ -88,10 +89,6 @@ private: QmlObjectListModel* _vehiclePolygons;*/ WimaVCorridor* _vehicleCorridor; QGCMapPolygon _borderPolygon; - - - - }; diff --git a/src/Wima/WimaServiceArea.cc b/src/Wima/WimaServiceArea.cc index 58e2f7924dd624b056be5f3a17e616e00fe24b53..e85860229fd4dcbd33a9ac84c57cdf53e577a8aa 100644 --- a/src/Wima/WimaServiceArea.cc +++ b/src/Wima/WimaServiceArea.cc @@ -2,14 +2,20 @@ const char* WimaServiceArea::wimaServiceAreaName = "Service Area"; -WimaServiceArea::WimaServiceArea(QObject *parent): - WimaServiceArea (nullptr, parent) +WimaServiceArea::WimaServiceArea() + : WimaServiceArea(nullptr) { } -WimaServiceArea::WimaServiceArea(WimaArea *other, QObject *parent): - WimaArea (other, parent) +WimaServiceArea::WimaServiceArea(QObject *parent) + : WimaArea (parent) +{ + this->setObjectName(wimaServiceAreaName); +} + +WimaServiceArea::WimaServiceArea(const WimaArea &other, QObject *parent) + : WimaArea (other, parent) { this->setObjectName(wimaServiceAreaName); } diff --git a/src/Wima/WimaServiceArea.h b/src/Wima/WimaServiceArea.h index 2a5ace7c72e29f46fea2650b0029d2bde627e25b..669bdfc02045dcae962fa78c2f027fe3502bdfa8 100644 --- a/src/Wima/WimaServiceArea.h +++ b/src/Wima/WimaServiceArea.h @@ -8,8 +8,9 @@ class WimaServiceArea : public WimaArea { Q_OBJECT public: - WimaServiceArea(QObject* parent = nullptr); - WimaServiceArea(WimaArea* other = nullptr, QObject* parent = nullptr); + WimaServiceArea(); + WimaServiceArea(QObject* parent); + WimaServiceArea(const WimaArea& other, QObject* parent); Q_PROPERTY(const QGeoCoordinate& takeOffPosition READ takeOffPosition WRITE setTakeOffPosition NOTIFY takeOffPositionChanged) Q_PROPERTY(const QGeoCoordinate& landPosition READ landPosition WRITE setLandPosition NOTIFY landPositionChanged) @@ -22,7 +23,7 @@ public: // Property acessors const QGeoCoordinate& takeOffPosition (void) const { return _takeOffPosition;} const QGeoCoordinate& landPosition (void) const { return _landPosition;} - WimaVCorridor& vehicleCorridor (void) const { return *_vehicleCorridor;} + WimaVCorridor *vehicleCorridor (void) const { return _vehicleCorridor;} // Property setters diff --git a/src/Wima/WimaVCorridor.cc b/src/Wima/WimaVCorridor.cc index f0deff9fb08af7b900aa870bd8949053bd04cff7..f08b2fe5723f32ec23d7d239f8501b2b436e5234 100644 --- a/src/Wima/WimaVCorridor.cc +++ b/src/Wima/WimaVCorridor.cc @@ -2,16 +2,24 @@ const char* WimaVCorridor::wimaVCorridorName = "Corridor"; -WimaVCorridor::WimaVCorridor(QObject *parent): - WimaVCorridor(nullptr, parent) +WimaVCorridor::WimaVCorridor() + : WimaVCorridor(nullptr) { } -WimaVCorridor::WimaVCorridor(WimaArea *other, QObject *parent): - WimaArea (other, parent) - ,_serviceArea (nullptr) - ,_opArea (nullptr) +WimaVCorridor::WimaVCorridor(QObject *parent) + : WimaArea (parent) + , _serviceArea (nullptr) + , _opArea (nullptr) +{ + this->setObjectName(wimaVCorridorName); +} + +WimaVCorridor::WimaVCorridor(const WimaArea &other, QObject *parent) + : WimaArea (other, parent) + , _serviceArea (nullptr) + , _opArea (nullptr) { this->setObjectName(wimaVCorridorName); } diff --git a/src/Wima/WimaVCorridor.h b/src/Wima/WimaVCorridor.h index cdbb8e3428cd7028f35d299bfee93f2ca93c132f..8dfbea9272c979a839df012c630e17abda8dd16e 100644 --- a/src/Wima/WimaVCorridor.h +++ b/src/Wima/WimaVCorridor.h @@ -9,8 +9,9 @@ class WimaVCorridor : public WimaArea { Q_OBJECT public: - WimaVCorridor(QObject* parent = nullptr); - WimaVCorridor(WimaArea* other = nullptr, QObject* parent = nullptr); + WimaVCorridor(); + WimaVCorridor(QObject* parent); + WimaVCorridor(const WimaArea& other, QObject* parent); // Overrides from WimaPolygon QString mapVisualQML (void) const { return "WimaVCorridorMapVisual.qml";} @@ -19,8 +20,8 @@ public: // Methodes void setServiceArea (WimaServiceArea& serviceArea); void setOpArea (WimaGOperationArea& opArea); - WimaServiceArea& serviceArea (void) const {return *_serviceArea;} - WimaGOperationArea& opArea (void) const {return *_opArea;} + WimaServiceArea* serviceArea (void) const {return _serviceArea;} + WimaGOperationArea* opArea (void) const {return _opArea;} void saveToJson (QJsonObject& json); bool loadFromJson (const QJsonObject& json, QString& errorString); diff --git a/src/WimaView/WimaGOperationAreaEditor.qml b/src/WimaView/WimaGOperationAreaEditor.qml index dd1ecd493e353e4cac51f1d34fe38ce1d35edc2a..f40166f7824fcce0e1a6d39748d1819adfda5123 100644 --- a/src/WimaView/WimaGOperationAreaEditor.qml +++ b/src/WimaView/WimaGOperationAreaEditor.qml @@ -27,21 +27,21 @@ Rectangle { property real _margin: ScreenTools.defaultFontPixelWidth / 2 property real _fieldWidth: ScreenTools.defaultFontPixelWidth * 10.5 - property var polyline: areaItem.polyline - property bool polylineInteractive: polyline.interactive + //property var polyline: areaItem.polyline + //property bool polylineInteractive: polyline.interactive property bool polygonInteractive: areaItem.interactive property var polygon: areaItem property bool initNecesarry: true - onPolylineInteractiveChanged: { + /*onPolylineInteractiveChanged: { polyline.interactive = polylineInteractive; - } + }*/ onPolygonInteractiveChanged: { polygon.interactive = polygonInteractive; } - function editPolyline(){ + /*function editPolyline(){ if (polylineInteractive){ //polyline.interactive = false; polylineInteractive = false; @@ -51,7 +51,7 @@ Rectangle { polylineInteractive = true; //polygonInteractive = false; } - } + }*/ @@ -120,7 +120,7 @@ Rectangle { width: 1 } } // Column - Settings - SectionHeader { + /*SectionHeader { id: polylineHeader text: qsTr("Gateway Poly Line") } @@ -143,7 +143,7 @@ Rectangle { text: "Swap End-Points" onClicked: polyline.swapEndPoints() - } + }*/ SectionHeader { id: statsHeader diff --git a/src/WimaView/WimaGOperationAreaMapVisual.qml b/src/WimaView/WimaGOperationAreaMapVisual.qml index 311e668858c0e5a43e66592949ae94a3855c01c2..1b1ba73df3ae830f77afbc271eec43368855e4ba 100644 --- a/src/WimaView/WimaGOperationAreaMapVisual.qml +++ b/src/WimaView/WimaGOperationAreaMapVisual.qml @@ -27,7 +27,6 @@ Item { property var areaItem: object property var _polygon: areaItem - property var _polyline: areaItem.polyline property var _borderPolygon: areaItem.borderPolygon signal clicked(int sequenceNumber) @@ -64,16 +63,16 @@ Item { } } - function _addInitialPolyline(){ + /*function _addInitialPolyline(){ _polyline.setStartVertexIndex(0); _polyline.setEndVertexIndex(1); - } + }*/ Component.onCompleted: { _addInitialPolygon() - _addInitialPolyline() + //_addInitialPolyline() } Component.onDestruction: { @@ -101,7 +100,7 @@ Item { } - WimaMapPolylineVisuals { + /*WimaMapPolylineVisuals { qgcView: _root.qgcView mapControl: map mapPolyline: _polyline @@ -110,6 +109,6 @@ Item { enableSplitHandels: false enableDragHandels: true edgeHandelsOnly: true - } + }*/ } diff --git a/src/WimaView/WimaServiceAreaEditor.qml b/src/WimaView/WimaServiceAreaEditor.qml index a4523051e73ab13aaeecea4514928ce32df9251e..1ee565cebe28e434397b9034b37ceae3c9e6f736 100644 --- a/src/WimaView/WimaServiceAreaEditor.qml +++ b/src/WimaView/WimaServiceAreaEditor.qml @@ -27,21 +27,21 @@ Rectangle { property real _margin: ScreenTools.defaultFontPixelWidth / 2 property real _fieldWidth: ScreenTools.defaultFontPixelWidth * 10.5 - property var polyline: areaItem.polyline - property bool polylineInteractive: polyline.interactive + //property var polyline: areaItem.polyline + //property bool polylineInteractive: polyline.interactive property bool polygonInteractive: areaItem.interactive property var polygon: areaItem property bool initNecesarry: true - onPolylineInteractiveChanged: { + /*onPolylineInteractiveChanged: { polyline.interactive = polylineInteractive; - } + }*/ onPolygonInteractiveChanged: { polygon.interactive = polygonInteractive; } - function editPolyline(){ + /*function editPolyline(){ if (polylineInteractive){ //polyline.interactive = false; polylineInteractive = false; @@ -51,7 +51,7 @@ Rectangle { polylineInteractive = true; //polygonInteractive = false; } - } + }*/ @@ -112,7 +112,7 @@ Rectangle { width: 1 } } // Column - Scan - SectionHeader { + /*SectionHeader { id: polylineHeader text: qsTr("Gateway Poly Line") } @@ -135,7 +135,7 @@ Rectangle { text: "Swap End-Points" onClicked: polyline.swapEndPoints() - } + }*/ SectionHeader { id: statsHeader diff --git a/src/WimaView/WimaServiceAreaMapVisual.qml b/src/WimaView/WimaServiceAreaMapVisual.qml index f4249c65bf99a0375f01fc1557b3037afc4496df..a73da6b9dfa4e085d04ea6516739da21ecd8c371 100644 --- a/src/WimaView/WimaServiceAreaMapVisual.qml +++ b/src/WimaView/WimaServiceAreaMapVisual.qml @@ -27,7 +27,7 @@ Item { property var areaItem: object property var _polygon: areaItem - property var _polyline: areaItem.polyline + //property var _polyline: areaItem.polyline signal clicked(int sequenceNumber) @@ -63,16 +63,16 @@ Item { } } - function _addInitialPolyline(){ + /*function _addInitialPolyline(){ _polyline.setStartVertexIndex(0); _polyline.setEndVertexIndex(1); - } + }*/ Component.onCompleted: { _addInitialPolygon() - _addInitialPolyline() + //_addInitialPolyline() } Component.onDestruction: { @@ -88,7 +88,7 @@ Item { interiorOpacity: 0.25 } - WimaMapPolylineVisuals { + /*WimaMapPolylineVisuals { qgcView: _root.qgcView mapControl: map mapPolyline: _polyline @@ -97,5 +97,5 @@ Item { enableSplitHandels: false enableDragHandels: true edgeHandelsOnly: true - } + }*/ } diff --git a/src/WimaView/WimaView.qml b/src/WimaView/WimaView.qml index d0066150949b208b23269b8b99b8275021410dc2..ef261adf6ac0ce1414d184ca4dbfea9a3d6f6efc 100644 --- a/src/WimaView/WimaView.qml +++ b/src/WimaView/WimaView.qml @@ -96,7 +96,7 @@ QGCView { MapFitFunctions { id: mapFitFunctions // The name for this id cannot be changed without breaking references outside of this code. Beware! map: editorMap - usePlannedHomePosition: true + usePlannedHomePosition: masterController planMasterController: _planMasterController } @@ -177,6 +177,14 @@ QGCView { wimaController.masterController = Qt.binding(function () { return masterController}) wimaController.missionController = Qt.binding(function () { return masterController.missionController}) } + + function loadFromSelectedFile() { + wimaFileDialog.title = qsTr("Select Wima File") + wimaFileDialog.selectExisting = true + wimaFileDialog.nameFilters = wimaController.loadNameFilters + wimaFileDialog.fileExtension = wimaController.fileExtension + wimaFileDialog.openForLoad() + } } PlanMasterController { @@ -318,6 +326,22 @@ QGCView { } } + QGCFileDialog { + id: wimaFileDialog + qgcView: _qgcView + folder: _appSettings.missionSavePath + + onAcceptedForSave: { + wimaController.saveToFile(file) + close() + } + + onAcceptedForLoad: { + wimaController.loadFromFile(file) + close() + } + } + property string polygonSelectPatternFile Component { id: patternPolygonSelectDialog @@ -559,11 +583,11 @@ QGCView { color: qgcPal.window title: qsTr("Plan") z: QGroundControl.zOrderWidgets - showAlternateIcon: [ masterController.dirty, false, false, false, false, false, false ] - rotateImage: [ masterController.syncInProgress, false, false, false, false, false, false ] - animateImage: [ masterController.dirty, false, false, false, false, false, false ] - buttonEnabled: [ !masterController.syncInProgress, true, true, true, true, true, true ] - buttonVisible: [ true, true, true, true, true, _showZoom, _showZoom ] + showAlternateIcon: [ masterController.dirty, false, false, false, false, false, false, false, false ] + rotateImage: [ masterController.syncInProgress, false, false, false, false, false, false, false, false ] + animateImage: [ masterController.dirty, false, false, false, false, false, false, false, false ] + buttonEnabled: [ !masterController.syncInProgress, true, true, true, true, true, true, true, true ] + buttonVisible: [ true, true, true, true, true, true, true, _showZoom, _showZoom ] maxHeight: mapScale.y - toolStrip.y property bool _showZoom: !ScreenTools.isMobile @@ -1003,7 +1027,7 @@ QGCView { id: columnHolder spacing: _margin - property string _overwriteText: (_editingLayer == _layerMission) ? qsTr("Mission overwrite") : ((_editingLayer == _layerGeoFence) ? qsTr("GeoFence overwrite") : qsTr("Rally Points overwrite")) + property string _overwriteText: qsTr("Mission overwrite") QGCLabel { width: sendSaveGrid.width @@ -1142,6 +1166,8 @@ QGCView { Rectangle { id: debugMessageWindow + + visible: false anchors.bottom: parent.bottom width: parent.width*0.7 x: (parent.width-width)/2 @@ -1170,9 +1196,4 @@ QGCView { } } - - - - - } // QGCVIew