Commit f6b6211e authored by Valentin Platzgummer's avatar Valentin Platzgummer

QGCButtonArray added, Area centering added to WimaView.qml

parent 5aa529ed
......@@ -237,6 +237,7 @@
<file alias="QGroundControl/Controls/WimaJoinedAreaDataVisual.qml">src/WimaView/WimaJoinedAreaDataVisual.qml</file>
<file alias="QGroundControl/Controls/WimaAreaNoVisual.qml">src/Wima/Snake/WimaAreaNoVisual.qml</file>
<file alias="QGroundControl/Controls/WimaMeasurementAreaDataVisual.qml">src/WimaView/WimaMeasurementAreaDataVisual.qml</file>
<file alias="QGroundControl/Controls/QGCButtonColumn.qml">src/QmlControls/QGCButtonColumn.qml</file>
</qresource>
<qresource prefix="/json">
<file alias="APMMavlinkStreamRate.SettingsGroup.json">src/Settings/APMMavlinkStreamRate.SettingsGroup.json</file>
......
......@@ -2440,6 +2440,8 @@ QStringList MissionController::complexMissionItemNames(void) const {
complexItems.append(_surveyMissionItemName);
complexItems.append(patternCorridorScanName);
// Circular Survey not added here, as it can only be used together with
// WimaView.
if (_controllerVehicle->fixedWing()) {
complexItems.append(patternFWLandingName);
}
......
import QtQuick 2.3
import QtQuick.Controls 1.2
import QtQuick.Layouts 1.2
import QtPositioning 5.3
import QGroundControl 1.0
import QGroundControl.ScreenTools 1.0
import QGroundControl.Controls 1.0
import QGroundControl.Palette 1.0
ColumnLayout {
id: root
spacing: ScreenTools.defaultFontPixelWidth * 0.5
property var model // list of lists (nested list contains all entries of ENTRY_NAME)
property string headLine
property bool hideOnClicked: true
enum EntryName {
Text = 0,
Visible = 1,
Enabled = 2,
OnClicked = 3
}
QGCLabel { text: headLine }
Repeater{
model: root.model
QGCButton {
text: modelData[QGCButtonColumn.EntryName.Text]
visible: modelData[QGCButtonColumn.EntryName.Visible]
enabled: modelData[QGCButtonColumn.EntryName.Enabled]
Layout.fillWidth: true
onClicked: {
if (hideOnClicked){
dropPanel.hide()
}
root.model[index][QGCButtonColumn.EntryName.OnClicked]()
}
}
}
} // ColumnLayout
......@@ -101,5 +101,6 @@ DragCoordinate 1.0 DragCoordinate.qml
CoordinateIndicator 1.0 CoordinateIndicator.qml
CoordinateIndicatorDrag 1.0 CoordinateIndicatorDrag.qml
ProgressIndicator 1.0 ProgressIndicator.qml
QGCButtonColumn 1.0 QGCButtonColumn.qml
......@@ -26,7 +26,8 @@ public:
Q_PROPERTY(bool dirty READ dirty WRITE setDirty NOTIFY dirtyChanged)
Q_INVOKABLE QObject *get(int index) { return _objectList[index]; }
Q_INVOKABLE const QObject *get(int index) const { return _objectList[index]; }
// No Q_INVOKABLE here, as QML seems to have a problem with const QObject*.
const QObject *get(int index) const { return _objectList[index]; }
// Property accessors
......
......@@ -117,6 +117,24 @@ QGCView {
map: editorMap
usePlannedHomePosition: masterController
planMasterController: _planMasterController
function fitMapViewportToAreas() {
if (!_wimaPlaner.visualItems) {
// Being called prior to controller.start
return
}
var coordList = [ ]
for (var i = 0; i < _wimaPlaner.visualItems.count; i++){
var area = _wimaPlaner.visualItems.get(i)
for (var j = 0; j < area.path.length; ++j){
var vertex = area.path[j]
coordList.push(vertex)
}
}
console.log(coordList)
fitMapViewportToAllCoordinates(coordList)
}
}
on_AirspaceEnabledChanged: {
......@@ -1158,9 +1176,52 @@ QGCView {
Component {
id: centerMapDropPanel
CenterMapDropPanel {
map: editorMap
fitFunctions: mapFitFunctions
QGCButtonColumn {
headLine: qsTr("Center map on:")
model:[
[
qsTr("Mission"), /*button text*/
true, /*visible*/
true, /*enabled*/
function(){mapFitFunctions.fitMapViewportToMissionItems()} /*onClicked*/
],
[
qsTr("All Items"), /*button text*/
true, /*visible*/
true, /*enabled*/
function(){mapFitFunctions.fitMapViewportToAllItems()} /*onClicked*/
],
[
qsTr("Areas"), /*button text*/
true, /*visible*/
true, /*enabled*/
function(){mapFitFunctions.fitMapViewportToAreas()} /*onClicked*/
],
[
qsTr("Home"), /*button text*/
true, /*visible*/
true, /*enabled*/
function(){editorMap.center = mapFitFunctions.fitHomePosition()} /*onClicked*/
],
[
qsTr("Vehicle"), /*button text*/
true, /*visible*/
_activeVehicle && _activeVehicle.coordinate.isValid, /*enabled*/
function(){editorMap.center = _activeVehicle.coordinate} /*onClicked*/
],
[
qsTr("Current Location"), /*button text*/
true, /*visible*/
editorMap.gcsPosition.isValid, /*enabled*/
function(){editorMap.center = editorMap.gcsPosition} /*onClicked*/
],
[
qsTr("Specified Location"), /*button text*/
true, /*visible*/
true, /*enabled*/
function(){editorMap.centerToSpecifiedLocation()} /*onClicked*/
]
]
}
}
......
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