Commit 7a0feac0 authored by Valentin Platzgummer's avatar Valentin Platzgummer

seg. fault on startup

parent a110c7f5
This diff is collapsed.
......@@ -413,7 +413,8 @@ HEADERS += \
src/Wima/WimaVCorridor.h \
src/Wima/WimaTrackerPolyline.h \
src/Wima/WimaController.h \
src/Wima/WimaVehicle.h
src/Wima/WimaVehicle.h \
src/Wima/WimaDataContainer.h
SOURCES += \
src/api/QGCCorePlugin.cc \
src/api/QGCOptions.cc \
......@@ -426,7 +427,8 @@ SOURCES += \
src/Wima/WimaVCorridor.cc \
src/Wima/WimaTrackerPolyline.cc \
src/Wima/WimaController.cc \
src/Wima/WimaVehicle.cc
src/Wima/WimaVehicle.cc \
src/Wima/WimaDataContainer.cc
#
# Unit Test specific configuration goes here (requires full debug build with all plugins)
......
......@@ -28,14 +28,13 @@ import QGroundControl.FlightMap 1.0
import QGroundControl.Palette 1.0
import QGroundControl.ScreenTools 1.0
import QGroundControl.Vehicle 1.0
import Wima 1.0
/// Flight Display View
QGCView {
id: root
viewPanel: _panel
property var wimaController
QGCPalette { id: qgcPal; colorGroupEnabled: enabled }
property alias guidedController: guidedActionsController
......@@ -115,6 +114,13 @@ QGCView {
Component.onCompleted: start(true /* flyView */)
}
WimaController {
id: wimaController
Component.onCompleted: {
startWimaController(true /* flyView */)
}
}
BuiltInPreFlightCheckModel {
id: preFlightCheckModel
}
......@@ -129,6 +135,10 @@ QGCView {
if(QGroundControl.corePlugin.options.flyViewOverlay.toString().length) {
flyViewOverlay.source = QGroundControl.corePlugin.options.flyViewOverlay
}
wimaController.masterController = masterController
wimaController.missionController = masterController.missionController
wimaController.dataContainer = dataContainer
}
// The following code is used to track vehicle states such that we prompt to remove mission from vehicle when mission completes
......@@ -331,6 +341,7 @@ QGCView {
id: _flightMap
anchors.fill: parent
planMasterController: masterController
wimaController: wimaController
guidedActionsController: _guidedController
flightWidgets: flightDisplayViewWidgets
rightPanelWidth: ScreenTools.defaultFontPixelHeight * 9
......
......@@ -37,12 +37,12 @@ FlightMap {
// The following properties must be set by the consumer
property var planMasterController
property var wimaController
property var guidedActionsController
property var flightWidgets
property var rightPanelWidth
property var qgcView ///< QGCView control which contains this map
property var multiVehicleView ///< true: multi-vehicle view, false: single vehicle view
property var wimaController
property rect centerViewport: Qt.rect(0, 0, width, height)
......@@ -196,7 +196,7 @@ FlightMap {
// Add wima Areas to the Map
WimaMapPolygonVisuals {
mapControl: flightMap
mapPolygon: wimaController ? wimaController.joinedArea : undefined
mapPolygon: wimaController.joinedArea
borderWidth: 1
borderColor: "transparent"
interiorColor: "gray"
......
......@@ -68,6 +68,7 @@
#include "CoordinateVector.h"
#include "PlanMasterController.h"
#include "Wima/WimaController.h" //custom
#include "Wima/WimaDataContainer.h" //custom
#include "VideoManager.h"
#include "VideoSurface.h"
#include "VideoReceiver.h"
......@@ -465,6 +466,7 @@ void QGCApplication::_initCommon(void)
#endif
// Wima
qmlRegisterType<WimaController> ("Wima", 1, 0, "WimaController"); //custom
qmlRegisterType<WimaDataContainer> ("Wima", 1, 0, "WimaDataContainer"); //custom
// Register Qml Singletons
......
This diff is collapsed.
......@@ -8,22 +8,23 @@
#include "WimaGOperationArea.h"
#include "WimaServiceArea.h"
#include "WimaVCorridor.h"
#include "WimaDataContainer.h"
#include "PlanMasterController.h"
#include "MissionController.h"
#include "SurveyComplexItem.h"
#include "SimpleMissionItem.h"
#include "MissionSettingsItem.h"
#include "JsonHelper.h"
#include "QGCApplication.h"
class WimaController : public QObject
{
Q_OBJECT
enum FileType {WimaFile, PlanFile};
Q_OBJECT
public:
WimaController(QObject *parent = nullptr);
......@@ -37,20 +38,25 @@ public:
Q_PROPERTY(QStringList saveNameFilters READ saveNameFilters CONSTANT)
Q_PROPERTY(QString fileExtension READ fileExtension CONSTANT)
Q_PROPERTY(QGeoCoordinate joinedAreaCenter READ joinedAreaCenter CONSTANT)
Q_PROPERTY(QGCMapPolygon joinedArea READ joinedArea NOTIFY joinedAreaChanged)
Q_PROPERTY(WimaArea* joinedArea READ joinedArea NOTIFY joinedAreaChanged)
Q_PROPERTY(bool flyView READ flyView CONSTANT)
Q_PROPERTY(WimaDataContainer* dataContainer READ dataContainer WRITE setDataContainer NOTIFY dataContainerChanged)
// Property accessors
PlanMasterController* masterController (void) const { return _masterController; }
MissionController* missionController (void) const { return _missionController; }
QmlObjectListModel* visualItems (void) const { return _visualItems; }
QmlObjectListModel* visualItems (void) const { return _container->visualItems(); }
int currentPolygonIndex (void) const { return _currentPolygonIndex; }
QString currentFile (void) const { return _currentFile; }
QStringList loadNameFilters (void) const;
QStringList saveNameFilters (void) const;
QString fileExtension (void) const { return wimaFileExtension; }
QGeoCoordinate joinedAreaCenter (void) const { return _joinedArea.center(); }
QGCMapPolygon joinedArea (void) const { return _joinedArea.toQGCPolygon(); }
QGeoCoordinate joinedAreaCenter (void) const { return _container->joinedArea()->center(); }
WimaArea* joinedArea (void) const { return _container->joinedArea(); }
WimaDataContainer* dataContainer (void) const { return _container; }
bool flyView (void) const { return _flyView; }
......@@ -59,7 +65,9 @@ public:
void setMissionController (MissionController* missionController);
/// Sets the integer index pointing to the current polygon. Current polygon is set interactive.
void setCurrentPolygonIndex (int index);
void setDataContainer (WimaDataContainer* container);
Q_INVOKABLE void startWimaController(bool flyView);
Q_INVOKABLE bool addGOperationArea();
/// Removes an area from _visualItems
/// @param index Index of the area to be removed
......@@ -103,6 +111,7 @@ signals:
void currentPolygonIndexChanged (int index);
void currentFileChanged ();
void joinedAreaChanged ();
void dataContainerChanged ();
private slots:
void recalcVehicleCorridor();
......@@ -113,12 +122,12 @@ private slots:
private:
bool _planView;
QmlObjectListModel* _visualItems;
WimaArea _joinedArea;
bool _flyView;
PlanMasterController* _masterController;
MissionController* _missionController;
int _currentPolygonIndex;
QString _currentFile;
WimaDataContainer* _container;
};
#include "WimaDataContainer.h"
WimaDataContainer::WimaDataContainer(QObject *parent)
: QObject(parent)
, _visualItems(this)
, _joinedArea(this)
{
}
#ifndef WIMADATACONTAINER_H
#define WIMADATACONTAINER_H
#include <QObject>
#include "QmlObjectListModel.h"
#include "WimaArea.h"
class WimaDataContainer : public QObject
{
Q_OBJECT
public:
explicit WimaDataContainer(QObject *parent = nullptr);
QmlObjectListModel* visualItems (void) { return &_visualItems; }
WimaArea* joinedArea (void) { return &_joinedArea; }
signals:
public slots:
private:
QmlObjectListModel _visualItems;
WimaArea _joinedArea;
};
#endif // WIMADATACONTAINER_H
......@@ -68,7 +68,7 @@ QGCView {
property var _appSettings: QGroundControl.settingsManager.appSettings
readonly property int _layerMission: 1
readonly property int _layerWima: 2
readonly property int _layerWima: 2
readonly property string _armedVehicleUploadPrompt: qsTr("Vehicle is currently armed. Do you want to upload the mission to the vehicle?")
Component.onCompleted: {
......@@ -76,6 +76,7 @@ QGCView {
toolbar.currentMissionItem = Qt.binding(function () { return _missionController.currentPlanViewItem })
_wimaController.masterController = _planMasterController
_wimaController.missionController = _planMasterController.missionController
_wimaController.dataContainer = dataContainer;
}
function addComplexItem(complexItemName) {
......@@ -194,6 +195,7 @@ QGCView {
Component.onCompleted: {
wimaController.masterController = Qt.binding(function () { return masterController})
wimaController.missionController = Qt.binding(function () { return masterController.missionController})
startWimaController(false /* flyView */)
}
function addComplexItem(complexItemName) {
var coordinate = editorMap.center
......
......@@ -19,6 +19,7 @@ import QGroundControl.Controls 1.0
import QGroundControl.FlightDisplay 1.0
import QGroundControl.ScreenTools 1.0
import QGroundControl.MultiVehicleManager 1.0
import Wima 1.0
/// Inner common QML for mainWindow
Item {
......@@ -28,8 +29,6 @@ Item {
QGCPalette { id: qgcPal; colorGroupEnabled: true }
property var wimaController
property bool wimaAvailable: wimaViewLoader.wimaController !== undefined
property var currentPopUp: null
property real currentCenterX: 0
property var activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
......@@ -50,16 +49,6 @@ Item {
}
}
onWimaAvailableChanged: {
if ( available ) {
wimaController = wimaViewLoader.wimaController
console.log("WimaController connected");
}
else {
wimaController = undefined
}
}
function disableToolbar() {
toolbarBlocker.enabled = true
......@@ -88,7 +77,7 @@ Item {
if (settingsViewLoader.source != _settingsViewSource) {
settingsViewLoader.source = _settingsViewSource
}
settingsViewLoader.visible = true, wimaFlightView
settingsViewLoader.visible = true
toolBar.checkSettingsButton()
}
......@@ -182,6 +171,11 @@ Item {
}
}
// Wima Data Container
WimaDataContainer{
id: wimaDataContainer
}
MessageDialog {
id: unsavedMissionCloseDialog
title: qsTr("%1 close").arg(QGroundControl.appName)
......@@ -192,15 +186,6 @@ Item {
onYes: activeConnectionsCloseDialog.check()
// here what to do?
function check() {
if (planViewLoader.item && planViewLoader.item.dirty) {
......@@ -397,8 +382,9 @@ Item {
anchors.bottom: parent.bottom
visible: false
property var planToolBar: planToolBar
} wimaController: wimaViewLoader.wimaController ? wimaViewLoader.wimaController : undefined
property var planToolBar: planToolBar
property var dataContainer: wimaDataContainer
}
Loader {
......@@ -414,7 +400,8 @@ Item {
anchors.fill: parent
visible: false
property var toolbar: wimaToolBar
property var toolbar: wimaToolBar
property var dataContainer: wimaDataContainer
}
......@@ -422,6 +409,8 @@ Item {
id: flightView
anchors.fill: parent
visible: true
property var dataContainer: wimaDataContainer
//-------------------------------------------------------------------------
//-- Loader helper for any child, no matter how deep can display an element
// on top of the video window.
......
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