Commit 87ae0874 authored by Valentin Platzgummer's avatar Valentin Platzgummer

befor editing WimaView.qml (allow only one masterController)

parent 8f6a4a95
......@@ -127,6 +127,8 @@ void WimaArea::join(WimaArea &poly1, WimaArea &poly2, WimaArea &joinedPoly)
if (poly1.count() >= 3 && poly2.count() >= 3) {
joinedPoly.clear();
poly1.verifyClockwiseWinding();
poly2.verifyClockwiseWinding();
......
......@@ -45,7 +45,14 @@ void WimaController::setCurrentPolygonIndex(int index)
void WimaController::removeArea(int index)
{
if(index >= 0 && index < _visualItems->count()){
_visualItems->removeAt(index);
WimaArea* area = qobject_cast<WimaArea*>(_visualItems->removeAt(index));
if ( area == nullptr) {
qWarning("WimaController::removeArea(): nullptr catched, internal error.");
return;
}
disconnect(area, &WimaArea::pathChanged, this, &WimaController::updateJoinedArea);
emit visualItemsChanged();
......@@ -67,41 +74,88 @@ void WimaController::removeArea(int index)
}
void WimaController::addGOperationArea()
bool WimaController::addGOperationArea()
{
WimaGOperationArea* newPoly = new WimaGOperationArea(this);
_visualItems->append(newPoly);
// check if opArea exists already
WimaGOperationArea* opArea = nullptr;
for (int i = 0; i < _visualItems->count(); i++) {
WimaGOperationArea* currentArea = qobject_cast<WimaGOperationArea*>(_visualItems->get(i));
if ( currentArea != nullptr ) {
opArea = currentArea;
return false;
}
}
// create one if no opArea available
opArea = new WimaGOperationArea(this);
connect(opArea, &WimaArea::pathChanged, this, &WimaController::updateJoinedArea);
_visualItems->append(opArea);
int newIndex = _visualItems->count()-1;
setCurrentPolygonIndex(newIndex);
emit visualItemsChanged();
return true;
}
void WimaController::addServiceArea()
bool WimaController::addServiceArea()
{
WimaServiceArea* newPoly = new WimaServiceArea(this);
_visualItems->append(newPoly);
// check if serArea exists already
WimaServiceArea* serArea = nullptr;
for (int i = 0; i < _visualItems->count(); i++) {
WimaServiceArea* currentArea = qobject_cast<WimaServiceArea*>(_visualItems->get(i));
if ( currentArea != nullptr ) {
serArea = currentArea;
return false;
}
}
// create one if no serArea available
serArea = new WimaServiceArea(this);
connect(serArea, &WimaArea::pathChanged, this, &WimaController::updateJoinedArea);
_visualItems->append(serArea);
int newIndex = _visualItems->count()-1;
setCurrentPolygonIndex(newIndex);
emit visualItemsChanged();
return true;
}
void WimaController::addVehicleCorridor()
bool WimaController::addVehicleCorridor()
{
WimaVCorridor* corridor = new WimaVCorridor(this);
// check if corridor exists already
WimaVCorridor* corridor = nullptr;
for (int i = 0; i < _visualItems->count(); i++) {
WimaVCorridor* currentArea = qobject_cast<WimaVCorridor*>(_visualItems->get(i));
if ( currentArea != nullptr ) {
corridor = currentArea;
return false;
}
}
// create one if no corridor available
corridor = new WimaVCorridor(this);
connect(corridor, &WimaArea::pathChanged, this, &WimaController::updateJoinedArea);
_visualItems->append(corridor);
int newIndex = _visualItems->count()-1;
setCurrentPolygonIndex(newIndex);
emit visualItemsChanged();
return true;
}
void WimaController::removeAllAreas()
void WimaController::removeAll()
{
bool changesApplied = false;
while (_visualItems->count() > 0) {
_visualItems->removeAt(0);
removeArea(0);
changesApplied = true;
}
_missionController->removeAll();
_currentFile = "";
emit currentFileChanged();
......@@ -165,14 +219,7 @@ bool WimaController::updateMission()
break;
}
}
// join service area and op area
WimaArea joinedArea;
if (corridor != nullptr) {
WimaArea::join(*corridor, *serArea, joinedArea);
joinedArea.join(*opArea);
} else {
WimaArea::join(*serArea, *opArea, joinedArea);
}
#if debug
WimaArea* joinedAreaPt = new WimaArea(joinedArea, this);
......@@ -180,10 +227,23 @@ bool WimaController::updateMission()
#endif
// extract survey if present
QmlObjectListModel* missionItems = _missionController->visualItems();
SurveyComplexItem* oldSurveyItem;
{
int i = 0;
while( i < missionItems->count() ) {
oldSurveyItem = qobject_cast<SurveyComplexItem*>(missionItems->get(i));
if (oldSurveyItem != nullptr){
break;
}
i++;
}
}
// reset visual items
_missionController->removeAll();
QmlObjectListModel* missionItems = _missionController->visualItems();
missionItems = _missionController->visualItems();
// set home position to serArea center
MissionSettingsItem* settingsItem= qobject_cast<MissionSettingsItem*>(missionItems->get(0));
if (settingsItem == nullptr){
......@@ -205,13 +265,14 @@ bool WimaController::updateMission()
} else {
survey->surveyAreaPolygon()->clear();
survey->surveyAreaPolygon()->appendVertices(opArea->coordinateList());
//survey->
}
// calculate path from take off to opArea
QGeoCoordinate start = serArea->center();
QGeoCoordinate end = survey->visualTransectPoints().first().value<QGeoCoordinate>();
QList<QGeoCoordinate> path;
WimaArea::dijkstraPath(start, end, joinedArea, path);
WimaArea::dijkstraPath(start, end, _joinedArea, path);
for (int i = 1; i < path.count()-1; i++) {
_missionController->insertSimpleMissionItem(path.value(i), i+1);
index++;
......@@ -221,7 +282,7 @@ bool WimaController::updateMission()
start = survey->visualTransectPoints().last().value<QGeoCoordinate>();
end = serArea->center();
path.clear();
WimaArea::dijkstraPath(start, end, joinedArea, path);
WimaArea::dijkstraPath(start, end, _joinedArea, path);
for (int i = 1; i < path.count()-1; i++) {
_missionController->insertSimpleMissionItem(path.value(i), index++);
}
......@@ -240,9 +301,6 @@ bool WimaController::updateMission()
}
}
//saveToFile("TestFile.wima");
//loadFromFile("TestFile.wima");
return true;
}
......@@ -376,6 +434,7 @@ bool WimaController::loadFromFile(const QString &filename)
_currentFile.sprintf("%s/%s.%s", fileInfo.path().toLocal8Bit().data(), fileInfo.completeBaseName().toLocal8Bit().data(), wimaFileExtension);
emit currentFileChanged();
updateJoinedArea();
return true;
......@@ -410,6 +469,51 @@ void WimaController::recalcPolygonInteractivity(int index)
}
}
void WimaController::updateJoinedArea()
{
// pick first WimaGOperationArea
WimaGOperationArea* opArea = nullptr;
for (int i = 0; i < _visualItems->count(); i++) {
WimaGOperationArea* currentArea = qobject_cast<WimaGOperationArea*>(_visualItems->get(i));
if (currentArea != nullptr){
opArea = currentArea;
break;
}
}
if (opArea == nullptr)
return;
// pick first WimaServiceArea
WimaServiceArea* serArea = nullptr;
for (int i = 0; i < _visualItems->count(); i++) {
WimaServiceArea* currentArea = qobject_cast<WimaServiceArea*>(_visualItems->get(i));
if (currentArea != nullptr){
serArea = currentArea;
break;
}
}
if ( serArea == nullptr )
return;
// pick first WimaVCorridor
WimaVCorridor* corridor = nullptr;
for (int i = 0; i < _visualItems->count(); i++) {
WimaVCorridor* currentArea = qobject_cast<WimaVCorridor*>(_visualItems->get(i));
if (currentArea != nullptr){
corridor = currentArea;
break;
}
}
// join service area, op area and corridor
if (corridor != nullptr) {
WimaArea::join(*corridor, *serArea, _joinedArea);
_joinedArea.join(*opArea);
} else {
WimaArea::join(*serArea, *opArea, _joinedArea);
}
}
void WimaController::resetAllInteractive()
{
int itemCount = _visualItems->count();
......
......@@ -33,6 +33,7 @@ public:
Q_PROPERTY(QString currentFile READ currentFile NOTIFY currentFileChanged)
Q_PROPERTY(QStringList loadNameFilters READ loadNameFilters CONSTANT)
Q_PROPERTY(QString fileExtension READ fileExtension CONSTANT)
Q_PROPERTY(QGeoCoordinate joinedAreaCenter READ joinedAreaCenter CONSTANT)
// Property accessors
......@@ -42,7 +43,8 @@ public:
int currentPolygonIndex (void) const { return _currentPolygonIndex; }
QString currentFile (void) const { return _currentFile; }
QStringList loadNameFilters (void) const;
QString fileExtension (void) const { return wimaFileExtension; }
QString fileExtension (void) const { return wimaFileExtension; }
QGeoCoordinate joinedAreaCenter (void) const { return _joinedArea.center(); }
......@@ -52,14 +54,13 @@ public:
/// Sets the integer index pointing to the current polygon. Current polygon is set interactive.
void setCurrentPolygonIndex (int index);
Q_INVOKABLE void addGOperationArea();
Q_INVOKABLE bool 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.
Q_INVOKABLE void addVehicleCorridor();
Q_INVOKABLE void removeAllAreas();
Q_INVOKABLE bool addServiceArea();
Q_INVOKABLE bool addVehicleCorridor();
Q_INVOKABLE void removeAll();
Q_INVOKABLE void startMission();
Q_INVOKABLE void abortMission();
......@@ -97,11 +98,13 @@ private slots:
void recalcVehicleMeasurementAreas();
void recalcAll();
void recalcPolygonInteractivity(int index);
void updateJoinedArea();
private:
bool _planView;
QmlObjectListModel* _visualItems;
WimaArea _joinedArea;
PlanMasterController* _masterController;
MissionController* _missionController;
int _currentPolygonIndex;
......
......@@ -21,7 +21,7 @@ Rectangle {
visible: false
anchors.bottomMargin: 1
signal showFlyView
signal showWimaFlightView
property var planMasterController
property var currentMissionItem ///< Mission item to display status for
......@@ -100,12 +100,12 @@ Rectangle {
id: settingsButton
anchors.top: parent.top
anchors.bottom: parent.bottom
source: "/qmlimages/PaperPlane.svg"
source: "/qmlimages/TelemRSSI.svg"
logo: true
checked: false
onClicked: {
checked = false
showFlyView()
showWimaFlightView()
}
}
}
......
......@@ -65,7 +65,7 @@ QGCView {
property bool _singleComplexItem: _missionController.complexMissionItemNames.length === 1
property real _toolbarHeight: _qgcView.height - ScreenTools.availableHeight
property int _editingLayer: _layerMission
property int _toolStripBottom: toolStrip.height + toolStrip.y
property int _toolStripBottom: _editingLayer == _layerWima ? ( wimaToolStrip.height + wimaToolStrip.y ) : ( missionToolStrip.height + missionToolStrip.y )
property var _appSettings: QGroundControl.settingsManager.appSettings
readonly property int _layerMission: 1
......@@ -347,6 +347,7 @@ QGCView {
onAcceptedForLoad: {
wimaController.loadFromFile(file)
editorMap.center = wimaController.joinedAreaCenter;
close()
}
}
......@@ -449,7 +450,7 @@ QGCView {
// This is the center rectangle of the map which is not 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
property real _leftToolWidth: _editingLayer == _layerWima ? ( wimaToolStrip.x + wimaToolStrip.width ) : ( missionToolStrip.x + missionToolStrip.width )
property real _statusHeight: waypointValuesDisplay.visible ? editorMap.height - waypointValuesDisplay.y : 0
readonly property real animationDuration: 500
......@@ -584,98 +585,167 @@ QGCView {
}
ToolStrip {
id: toolStrip
id: wimaToolStrip
anchors.leftMargin: ScreenTools.defaultFontPixelWidth
anchors.left: parent.left
anchors.topMargin: _toolButtonTopMargin
anchors.top: parent.top
color: qgcPal.window
title: qsTr("Wima")
visible: _editingLayer == _layerWima
z: QGroundControl.zOrderWidgets
showAlternateIcon: [ false, false, false, false, false, false, false, false, false ]
rotateImage: [ false, false, false, false, false, false, false, false, false ]
animateImage: [ false, false, false, false, false, false, false, false, false ]
buttonEnabled: [ true, true, true, true, true, true, true, true, true ]
buttonVisible: [ true, true, true, true, true, true, true, _showZoom, _showZoom ]
maxHeight: mapScale.y - wimaToolStrip.y
property bool _showZoom: !ScreenTools.isMobile
model: [
{
name: qsTr("File"),
iconSource: "/qmlimages/MapSync.svg",
alternateIconSource: "/qmlimages/MapSyncChanged.svg",
dropPanelComponent: syncDropPanel
},
{
name: qsTr("Global"),
iconSource: "/qmlimages/Target.svg"
},
{
name: qsTr("Service"),
iconSource: "/qmlimages/noFlyArea.svg"
},
{
name: qsTr("Corridor"),
iconSource: "/qmlimages/noFlyArea.svg"
},
{
name: qsTr("Calculate"),
iconSource: "/res/gear-white.svg"
},
{
name: qsTr("Center"),
iconSource: "/qmlimages/MapCenter.svg",
dropPanelComponent: centerMapDropPanel
},
{
name: qsTr("In"),
iconSource: "/qmlimages/ZoomPlus.svg"
},
{
name: qsTr("Out"),
iconSource: "/qmlimages/ZoomMinus.svg"
}
]
onClicked: {
switch (index) {
case 1:
wimaController.addGOperationArea();
break
case 2:
wimaController.addServiceArea();
break
case 3:
wimaController.addVehicleCorridor();
break
case 4:
wimaController.updateMission();
break
case 6:
editorMap.zoomLevel += 0.5
break
case 7:
editorMap.zoomLevel -= 0.5
break
}
}
}
ToolStrip {
id: missionToolStrip
anchors.leftMargin: ScreenTools.defaultFontPixelWidth
anchors.left: parent.left
anchors.topMargin: _toolButtonTopMargin
anchors.top: parent.top
color: qgcPal.window
title: qsTr("Plan")
visible: _editingLayer == _layerMission
z: QGroundControl.zOrderWidgets
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
maxHeight: mapScale.y - missionToolStrip.y
property bool _showZoom: !ScreenTools.isMobile
model: [
{
name: qsTr("File"),
iconSource: "/qmlimages/MapSync.svg",
alternateIconSource: "/qmlimages/MapSyncChanged.svg",
dropPanelComponent: syncDropPanel
},
{
name: qsTr("Global"),
iconSource: "/qmlimages/Target.svg"
},
{
name: qsTr("Service"),
iconSource: "/qmlimages/noFlyArea.svg"
},
{
name: qsTr("Corridor"),
iconSource: "/qmlimages/noFlyArea.svg"
},
{
name: qsTr("Calculate"),
iconSource: "/res/gear-white.svg"
},
/*{
name: _singleComplexItem ? _missionController.complexMissionItemNames[0] : qsTr("Pattern"),
iconSource: "/qmlimages/MapDrawShape.svg",
dropPanelComponent: _singleComplexItem ? undefined : patternDropPanel
},*/
{
name: qsTr("Center"),
iconSource: "/qmlimages/MapCenter.svg",
dropPanelComponent: centerMapDropPanel
},
{
name: qsTr("In"),
iconSource: "/qmlimages/ZoomPlus.svg"
},
{
name: qsTr("Out"),
iconSource: "/qmlimages/ZoomMinus.svg"
}
]
model: [
{
name: qsTr("File"),
iconSource: "/qmlimages/MapSync.svg",
alternateIconSource: "/qmlimages/MapSyncChanged.svg",
dropPanelComponent: syncDropPanel
},
{
name: qsTr("Waypoint"),
iconSource: "/qmlimages/MapAddMission.svg",
toggle: true
},
{
name: qsTr("ROI"),
iconSource: "/qmlimages/MapAddMission.svg",
toggle: true
},
{
name: _singleComplexItem ? _missionController.complexMissionItemNames[0] : qsTr("Pattern"),
iconSource: "/qmlimages/MapDrawShape.svg",
dropPanelComponent: _singleComplexItem ? undefined : patternDropPanel
},
{
name: qsTr("Center"),
iconSource: "/qmlimages/MapCenter.svg",
dropPanelComponent: centerMapDropPanel
},
{
name: qsTr("In"),
iconSource: "/qmlimages/ZoomPlus.svg"
},
{
name: qsTr("Out"),
iconSource: "/qmlimages/ZoomMinus.svg"
}
]
onClicked: {
switch (index) {
case 1:
wimaController.addGOperationArea();
//addComplexItem(_missionController.complexMissionItemNames[2])
/*_addWaypointOnClick = checked
_addROIOnClick = false*/
break
case 2:
wimaController.addServiceArea(); /*
_addROIOnClick = checked
_addWaypointOnClick = false*/
break
case 3:
wimaController.addVehicleCorridor();
break
case 4:
/*if (_singleComplexItem) {
addComplexItem(_missionController.complexMissionItemNames[0])
}*/
wimaController.updateMission();
break
case 6:
editorMap.zoomLevel += 0.5
break
case 7:
editorMap.zoomLevel -= 0.5
break
}
switch (index) {
case 1:
_addWaypointOnClick = checked
_addROIOnClick = false
break
case 2:
_addROIOnClick = checked
_addWaypointOnClick = false
break
case 3:
if (_singleComplexItem) {
addComplexItem(_missionController.complexMissionItemNames[0])
}
break
case 5:
editorMap.zoomLevel += 0.5
break
case 6:
editorMap.zoomLevel -= 0.5
break
}
}
}
}
}
......@@ -910,39 +980,6 @@ QGCView {
}
}
}
/*
// GeoFence Editor
GeoFenceEditor {
anchors.top: rightControls.bottom
anchors.topMargin: ScreenTools.defaultFontPixelHeight * 0.5
anchors.bottom: parent.bottom
anchors.left: parent.left
anchors.right: parent.right
myGeoFenceController: _geoFenceController
flightMap: editorMap
visible: _editingLayer == _layerGeoFence
}
// Rally Point Editor
RallyPointEditorHeader {
id: rallyPointHeader
anchors.top: rightControls.bottom
anchors.topMargin: ScreenTools.defaultFontPixelHeight * 0.5
anchors.left: parent.left
anchors.right: parent.right
visible: _editingLayer == _layerRallyPoints
controller: _rallyPointController
}
RallyPointItemEditor {
id: rallyPointEditor
anchors.top: rallyPointHeader.bottom
anchors.topMargin: ScreenTools.defaultFontPixelHeight * 0.5
anchors.left: parent.left
anchors.right: parent.right
visible: _editingLayer == _layerRallyPoints && _rallyPointController.points.count
rallyPoint: _rallyPointController.currentRallyPoint
controller: _rallyPointController
}
*/
}
MapScale {
......@@ -966,18 +1003,6 @@ QGCView {
}
}
Component {
id: syncLoadFromVehicleOverwrite
QGCViewMessage {
id: syncLoadFromVehicleCheck
message: qsTr("You have unsaved/unsent changes. Loading from the Vehicle will lose these changes. Are you sure you want to load from the Vehicle?")
function accept() {
hideDialog()
masterController.loadFromVehicle()
}
}
}
Component {
id: syncLoadFromFileOverwrite
QGCViewMessage {
......@@ -1011,7 +1036,7 @@ QGCView {
QGCViewMessage {
message: qsTr("Are you sure you want to remove all items and create a Wima mission? ")
function accept() {
wimaController.removeAllAreas();
wimaController.removeAll();
hideDialog()
}
}
......@@ -1039,6 +1064,48 @@ QGCView {
}
}
Component {
id: patternDropPanel
ColumnLayout {
spacing: ScreenTools.defaultFontPixelWidth * 0.5
QGCLabel { text: qsTr("Create complex pattern:") }
Repeater {
model: _missionController.complexMissionItemNames
QGCButton {
text: modelData
Layout.fillWidth: true
onClicked: {
addComplexItem(modelData)
dropPanel.hide()
}
}
}
Rectangle {
width: parent.width * 0.8
height: 1
color: qgcPal.text
opacity: 0.5
Layout.fillWidth: true
Layout.columnSpan: 2
}
QGCButton {
text: qsTr("Load KML/SHP...")
Layout.fillWidth: true
enabled: !masterController.syncInProgress
onClicked: {
masterController.loadShapeFromSelectedFile()
dropPanel.hide()
}
}
} // Column
}
Component {
id: syncDropPanel
......@@ -1071,7 +1138,7 @@ QGCView {
QGCButton {
text: qsTr("New...Testing")
Layout.fillWidth: true
enabled: _wimaVisualItems.count > 1
enabled: _wimaVisualItems.count >= 1
onClicked: {
dropPanel.hide()
_qgcView.showDialog(wimaRemoveAllPromptDialog, qsTr("New Plan"), _qgcView.showDialogDefaultWidth, StandardButton.Yes | StandardButton.No)
......@@ -1102,7 +1169,7 @@ QGCView {
QGCButton {
text: qsTr("Save As...")
Layout.fillWidth: true
enabled: _wimaVisualItems.count > 1
enabled: _wimaVisualItems.count >= 1
onClicked: {
dropPanel.hide()
wimaController.saveToSelectedFile()
......
......@@ -33,7 +33,7 @@ Item {
property var activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
property string formatedMessage: activeVehicle ? activeVehicle.formatedMessage : ""
property var _viewList: [ settingsViewLoader, setupViewLoader, planViewLoader, wimaViewLoader, flightView, analyzeViewLoader ]
property var _viewList: [ settingsViewLoader, setupViewLoader, planViewLoader, wimaViewLoader, wimaFlightView, flightView, analyzeViewLoader ]
readonly property string _settingsViewSource: "AppSettings.qml"
readonly property string _setupViewSource: "SetupView.qml"
......@@ -125,6 +125,18 @@ Item {
wimaToolBar.visible = true
}
function showWimaFlightView() {
mainWindow.enableToolbar()
rootLoader.sourceComponent = null
if(currentPopUp) {
currentPopUp.close()
}
ScreenTools.availableHeight = parent.height - toolBar.height
hideAllViews()
wimaFlightView.visible = true
toolBar.checkWimaFlyButton()
}
function showFlyView() {
mainWindow.enableToolbar()
rootLoader.sourceComponent = null
......@@ -301,7 +313,7 @@ Item {
anchors.left: parent.left
anchors.right: parent.right
anchors.top: parent.top
opacity: planToolBar.visible ? 0 : 1
opacity: planToolBar.visible || wimaToolBar.visible ? 0 : 1
z: QGroundControl.zOrderTopMost
Component.onCompleted: ScreenTools.availableHeight = parent.height - toolBar.height
......@@ -311,6 +323,7 @@ Item {
onShowPlanView: mainWindow.showPlanView()
onShowWimaView: mainWindow.showWimaView()
onShowAnalyzeView: mainWindow.showAnalyzeView()
onShowWimaFlightView: mainWindow.showWimaFlightView()
onArmVehicle: flightView.guidedController.confirmAction(flightView.guidedController.actionArm)
onDisarmVehicle: {
if (flightView.guidedController.showEmergenyStop) {
......@@ -330,22 +343,22 @@ Item {
}
}
PlanToolBar {
id: planToolBar
WimaToolBar {
id: wimaToolBar
height: ScreenTools.toolbarHeight
anchors.left: parent.left
anchors.right: parent.right
anchors.top: parent.top
z: toolBar.z + 1
onShowFlyView: {
planToolBar.visible = false
mainWindow.showFlyView()
onShowWimaFlightView: {
wimaToolBar.visible = false
mainWindow.showWimaFlightView()
}
}
WimaToolBar {
id: wimaToolBar
PlanToolBar {
id: planToolBar
height: ScreenTools.toolbarHeight
anchors.left: parent.left
anchors.right: parent.right
......@@ -353,7 +366,7 @@ Item {
z: toolBar.z + 1
onShowFlyView: {
wimaToolBar.visible = false
planToolBar.visible = false
mainWindow.showFlyView()
}
}
......@@ -401,6 +414,7 @@ Item {
property var toolbar: wimaToolBar
}
FlightDisplayView {
id: flightView
anchors.fill: parent
......@@ -414,6 +428,19 @@ Item {
}
}
FlightDisplayView {
id: wimaFlightView
anchors.fill: parent
visible: true
//-------------------------------------------------------------------------
//-- Loader helper for any child, no matter how deep can display an element
// on top of the video window.
/*Loader {
id: rootVideoLoader
anchors.centerIn: parent
}*/
}
Loader {
id: analyzeViewLoader
anchors.left: parent.left
......
......@@ -31,6 +31,7 @@ Rectangle {
signal showSetupView
signal showPlanView
signal showWimaView
signal showWimaFlightView
signal showFlyView
signal showAnalyzeView
signal armVehicle
......@@ -54,6 +55,10 @@ Rectangle {
wimaButton.checked = true
}
function checkWimaFlyButton() {
wimaFlyButton.checked = true
}
function checkFlyButton() {
flyButton.checked = true
}
......@@ -64,7 +69,7 @@ Rectangle {
Component.onCompleted: {
//-- TODO: Get this from the actual state
flyButton.checked = true
planButton.checked = true
}
// Prevent all clicks from going through to lower layers
......@@ -126,6 +131,15 @@ Rectangle {
onClicked: toolBar.showPlanView()
}
QGCToolBarButton {
id: flyButton
anchors.top: parent.top
anchors.bottom: parent.bottom
exclusiveGroup: mainActionGroup
source: "/qmlimages/PaperPlane.svg"
onClicked: toolBar.showFlyView()
}
QGCToolBarButton {
id: wimaButton
anchors.top: parent.top
......@@ -136,12 +150,12 @@ Rectangle {
}
QGCToolBarButton {
id: flyButton
id: wimaFlyButton
anchors.top: parent.top
anchors.bottom: parent.bottom
exclusiveGroup: mainActionGroup
source: "/qmlimages/PaperPlane.svg"
onClicked: toolBar.showFlyView()
source: "/qmlimages/TelemRSSI.svg"
onClicked: toolBar.showWimaFlyView()
}
QGCToolBarButton {
......
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