Commit 6256464b authored by Valentin Platzgummer's avatar Valentin Platzgummer

saveToJson works

parent c82f5a2a
......@@ -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<WimaArea*>(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<WimaArea *>* polyList, WimaArea* joinedPoly)
......@@ -110,18 +122,16 @@ void WimaArea::join(QList<WimaArea *>* 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<QPair<int, int>> neighbourList;
QList<QGeoCoordinate> 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<qreal>::infinity();
}
} else {
......
......@@ -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<WimaArea*>* 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<WimaArea*>* polyList);// change to & notation, if necessary
bool isDisjunct (WimaArea* poly1, WimaArea* poly2);// change to & notation, if necessary
/// calculates the next polygon vertex index
......
......@@ -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<WimaServiceArea*>(area);
if (serArea != nullptr) {
serArea->saveToJson(json);
jsonArray.append(json);
break;
continue;
}
WimaVCorridor* corridor = qobject_cast<WimaVCorridor*>(area);
if (corridor != nullptr) {
corridor->saveToJson(json);
jsonArray.append(json);
break;
continue;
}
// if non of the obove branches was trigger, type must be WimaArea
......
......@@ -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; }
......
......@@ -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();
......
......@@ -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;
};
......@@ -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);
}
......
......@@ -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
......
......@@ -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);
}
......
......@@ -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);
......
......@@ -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
......
......@@ -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
}
}*/
}
......@@ -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
......
......@@ -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
}
}*/
}
......@@ -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