Commit 5a5b161e authored by Valentin Platzgummer's avatar Valentin Platzgummer

123

parent be40a955
...@@ -265,16 +265,16 @@ ...@@ -265,16 +265,16 @@
<file alias="QGroundControl/Controls/CircularGeneratorMapVisual.qml">src/MeasurementComplexItem/qml/CircularGeneratorMapVisual.qml</file> <file alias="QGroundControl/Controls/CircularGeneratorMapVisual.qml">src/MeasurementComplexItem/qml/CircularGeneratorMapVisual.qml</file>
<file alias="MeasurementItemEditor.qml">src/MeasurementComplexItem/qml/MeasurementItemEditor.qml</file> <file alias="MeasurementItemEditor.qml">src/MeasurementComplexItem/qml/MeasurementItemEditor.qml</file>
<file alias="QGroundControl/Controls/MeasurementItemMapVisual.qml">src/MeasurementComplexItem/qml/MeasurementItemMapVisual.qml</file> <file alias="QGroundControl/Controls/MeasurementItemMapVisual.qml">src/MeasurementComplexItem/qml/MeasurementItemMapVisual.qml</file>
<file alias="CoordinateIndicator.qml">src/MeasurementComplexItem/qml/CoordinateIndicator.qml</file> <file alias="QGroundControl/Controls/CoordinateIndicator.qml">src/MeasurementComplexItem/qml/CoordinateIndicator.qml</file>
<file alias="CoordinateIndicatorDrag.qml">src/MeasurementComplexItem/qml/CoordinateIndicatorDrag.qml</file> <file alias="QGroundControl/Controls/CoordinateIndicatorDrag.qml">src/MeasurementComplexItem/qml/CoordinateIndicatorDrag.qml</file>
<file alias="DragCoordinate.qml">src/MeasurementComplexItem/qml/DragCoordinate.qml</file> <file alias="QGroundControl/Controls/DragCoordinate.qml">src/MeasurementComplexItem/qml/DragCoordinate.qml</file>
<file alias="LinearGeneratorEditor.qml">src/MeasurementComplexItem/qml/LinearGeneratorEditor.qml</file> <file alias="LinearGeneratorEditor.qml">src/MeasurementComplexItem/qml/LinearGeneratorEditor.qml</file>
<file alias="ProgressIndicator.qml">src/MeasurementComplexItem/qml/ProgressIndicator.qml</file> <file alias="ProgressIndicator.qml">src/MeasurementComplexItem/qml/ProgressIndicator.qml</file>
<file alias="QGroundControl/Controls/GeoAreaVisualLoader.qml">src/MeasurementComplexItem/qml/GeoAreaVisualLoader.qml</file> <file alias="QGroundControl/Controls/GeoAreaVisualLoader.qml">src/MeasurementComplexItem/qml/GeoAreaVisualLoader.qml</file>
<file alias="MeasurementAreaEditor.qml">src/MeasurementComplexItem/qml/MeasurementAreaEditor.qml</file> <file alias="MeasurementAreaEditor.qml">src/MeasurementComplexItem/qml/MeasurementAreaEditor.qml</file>
<file alias="MeasurementAreaMapVisual.qml">src/MeasurementComplexItem/qml/MeasurementAreaMapVisual.qml</file> <file alias="QGroundControl/Controls/MeasurementAreaMapVisual.qml">src/MeasurementComplexItem/qml/MeasurementAreaMapVisual.qml</file>
<file alias="SafeAreaEditor.qml">src/MeasurementComplexItem/qml/SafeAreaEditor.qml</file> <file alias="SafeAreaEditor.qml">src/MeasurementComplexItem/qml/SafeAreaEditor.qml</file>
<file alias="SafeAreaMapVisual.qml">src/MeasurementComplexItem/qml/SafeAreaMapVisual.qml</file> <file alias="QGroundControl/Controls/SafeAreaMapVisual.qml">src/MeasurementComplexItem/qml/SafeAreaMapVisual.qml</file>
<file alias="SetupParameterEditor.qml">src/VehicleSetup/SetupParameterEditor.qml</file> <file alias="SetupParameterEditor.qml">src/VehicleSetup/SetupParameterEditor.qml</file>
<file alias="SetupView.qml">src/VehicleSetup/SetupView.qml</file> <file alias="SetupView.qml">src/VehicleSetup/SetupView.qml</file>
<file alias="SimpleItemEditor.qml">src/PlanView/SimpleItemEditor.qml</file> <file alias="SimpleItemEditor.qml">src/PlanView/SimpleItemEditor.qml</file>
......
...@@ -17,6 +17,8 @@ public: ...@@ -17,6 +17,8 @@ public:
AreaData(const AreaData &other, QObject *parent = nullptr); AreaData(const AreaData &other, QObject *parent = nullptr);
AreaData &operator=(const AreaData &other); AreaData &operator=(const AreaData &other);
Q_PROPERTY(QmlObjectListModel *areaList READ areaList NOTIFY areaListChanged)
// Member Methodes // Member Methodes
//! //!
//! \brief insert Inserts the area if areaList does not contain it. //! \brief insert Inserts the area if areaList does not contain it.
......
...@@ -68,7 +68,7 @@ const char *MeasurementArea::tileHeightName = "TileHeight"; ...@@ -68,7 +68,7 @@ const char *MeasurementArea::tileHeightName = "TileHeight";
const char *MeasurementArea::tileWidthName = "TileWidth"; const char *MeasurementArea::tileWidthName = "TileWidth";
const char *MeasurementArea::minTileAreaName = "MinTileAreaPercent"; const char *MeasurementArea::minTileAreaName = "MinTileAreaPercent";
const char *MeasurementArea::showTilesName = "ShowTiles"; const char *MeasurementArea::showTilesName = "ShowTiles";
const char *MeasurementArea::MeasurementAreaName = "Measurement Area"; const char *MeasurementArea::measurementAreaName = "Measurement Area";
MeasurementArea::MeasurementArea(QObject *parent) MeasurementArea::MeasurementArea(QObject *parent)
: GeoArea(parent), : GeoArea(parent),
...@@ -162,7 +162,7 @@ void MeasurementArea::saveToJson(QJsonObject &json) { ...@@ -162,7 +162,7 @@ void MeasurementArea::saveToJson(QJsonObject &json) {
json[tileWidthName] = _tileWidth.rawValue().toDouble(); json[tileWidthName] = _tileWidth.rawValue().toDouble();
json[minTileAreaName] = _minTileAreaPercent.rawValue().toDouble(); json[minTileAreaName] = _minTileAreaPercent.rawValue().toDouble();
json[showTilesName] = _showTiles.rawValue().toBool(); json[showTilesName] = _showTiles.rawValue().toBool();
json[areaTypeName] = MeasurementAreaName; json[areaTypeName] = measurementAreaName;
} else { } else {
qCDebug(MeasurementAreaLog) << "saveToJson(): not ready for saveing."; qCDebug(MeasurementAreaLog) << "saveToJson(): not ready for saveing.";
} }
...@@ -359,7 +359,7 @@ void MeasurementArea::enableUpdate() { ...@@ -359,7 +359,7 @@ void MeasurementArea::enableUpdate() {
} }
void MeasurementArea::init() { void MeasurementArea::init() {
this->setObjectName(MeasurementAreaName); this->setObjectName(measurementAreaName);
connect(&this->_tileHeight, &Fact::rawValueChanged, this, connect(&this->_tileHeight, &Fact::rawValueChanged, this,
&MeasurementArea::deferUpdate); &MeasurementArea::deferUpdate);
connect(&this->_tileWidth, &Fact::rawValueChanged, this, connect(&this->_tileWidth, &Fact::rawValueChanged, this,
......
...@@ -71,7 +71,7 @@ public: ...@@ -71,7 +71,7 @@ public:
static const char *tileWidthName; static const char *tileWidthName;
static const char *minTileAreaName; static const char *minTileAreaName;
static const char *showTilesName; static const char *showTilesName;
static const char *MeasurementAreaName; static const char *measurementAreaName;
signals: signals:
void tilesChanged(); void tilesChanged();
......
...@@ -8,7 +8,6 @@ Item { ...@@ -8,7 +8,6 @@ Item {
// Expects the following properties: // Expects the following properties:
property var map ///< Map control to place item in property var map ///< Map control to place item in
property var qgcView ///< QGCView to use for popping dialogs
property var generator property var generator
property bool checked: false property bool checked: false
...@@ -59,7 +58,6 @@ Item { ...@@ -59,7 +58,6 @@ Item {
property var ref: _root.generator.reference property var ref: _root.generator.reference
map: _root.map map: _root.map
qgcView: _root.qgcView
z: QGroundControl.zOrderMapItems z: QGroundControl.zOrderMapItems
checked: _root.checked checked: _root.checked
coordinate: ref coordinate: ref
......
...@@ -23,7 +23,6 @@ Item { ...@@ -23,7 +23,6 @@ Item {
id: _root id: _root
property var map ///< Map control to place item in property var map ///< Map control to place item in
property var qgcView ///< QGCView to use for popping dialogs
property var coordinate property var coordinate
property int sequenceNumber property int sequenceNumber
property bool checked property bool checked
......
...@@ -21,22 +21,24 @@ import QGroundControl 1.0 ...@@ -21,22 +21,24 @@ import QGroundControl 1.0
Item { Item {
id: _root id: _root
property var map ///< Map control to place item in property var map: undefined ///< Map control to place item in
property var qgcView ///< QGCView to use for popping dialogs property var geoArea: undefined ///< GeoArea derived class
property var geoArea ///< GeoArea derived class
signal clicked(int sequenceNumber) signal clicked(int sequenceNumber)
property var _visualItem property var _visualItem: undefined
Component.onCompleted: { Component.onCompleted: {
if (geoArea.mapVisualQML) { console.assert(map !== undefined, "please set the map property")
var component = Qt.createComponent(geoArea.mapVisualQML) console.assert(geoArea !== undefined, "please set the geoArea property")
if (_root.geoArea.mapVisualQML && !_visualItem) {
var component = Qt.createComponent(_root.geoArea.mapVisualQML)
if (component.status === Component.Error) { if (component.status === Component.Error) {
console.log("Error loading Qml: ", geoArea.mapVisualQML, component.errorString()) console.log("Error loading Qml: ", _root.geoArea.mapVisualQML, component.errorString())
} }
_visualItem = component.createObject(map, { "map": _root.map, "qgcView": _root.qgcView, "geoArea": _root.geoArea}) _root._visualItem = component.createObject(_root.map, { map: _root.map, geoArea: _root.geoArea})
_visualItem.clicked.connect(_root.clicked) _root._visualItem.clicked.connect(_root.clicked)
} }
} }
......
...@@ -21,23 +21,27 @@ import QGroundControl.FlightMap 1.0 ...@@ -21,23 +21,27 @@ import QGroundControl.FlightMap 1.0
Item { Item {
id: _root id: _root
property var map ///< Map control to place item in property var map: undefined ///< Map control to place item in
property var qgcView ///< QGCView to use for popping dialogs property var geoArea: undefined ///< GeoArea derived class
property var areaItem ///< GeoArea derived class
property var opacity: 0.5 opacity: 0.3
signal clicked(int sequenceNumber) signal clicked(int sequenceNumber)
Component.onCompleted: {
console.assert(map !== undefined, "please set the map property")
console.assert(geoArea !== undefined, "please set the geoArea property")
}
// Area polygon // Area polygon
QGCMapPolygonVisuals { QGCMapPolygonVisuals {
id: mapPolygonVisuals id: mapPolygonVisuals
mapControl: map
mapPolygon: areaItem mapControl: _root.map
interactive: true mapPolygon: _root.geoArea
borderWidth: 1 interactive: geoArea.interactive
borderColor: "black" borderWidth: 3
borderColor: "green"
interiorColor: "green" interiorColor: "green"
altColor: QGroundControl.globalPalette.surveyPolygonTerrainCollision altColor: QGroundControl.globalPalette.surveyPolygonTerrainCollision
interiorOpacity: _root.opacity interiorOpacity: _root.opacity
...@@ -82,13 +86,13 @@ Item { ...@@ -82,13 +86,13 @@ Item {
Repeater { Repeater {
id: progressRepeater id: progressRepeater
property bool enable: areaItem.showTiles.value property bool enable: geoArea.showTiles.value
model: enable ? areaItem.tiles : [] model: enable ? geoArea.tiles : []
Item{ Item{
property var _tileComponent property var _tileComponent
property int _progress: _root.areaItem.progress[index] ? property int _progress: _root.geoArea.progress[index] ?
_root.areaItem.progress[index] : 0 _root.geoArea.progress[index] : 0
Component.onCompleted: { Component.onCompleted: {
_tileComponent = tileComponent.createObject(map) _tileComponent = tileComponent.createObject(map)
......
...@@ -159,6 +159,36 @@ Rectangle { ...@@ -159,6 +159,36 @@ Rectangle {
} }
} // variant repeater } // variant repeater
} // variant grid } // variant grid
ExclusiveGroup{id:areaGroup}
Repeater{
id: areaReapeater
model: _missionItem.areaData.areaList
delegate: QGCRadioButton {
text: object.objectName
Layout.columnSpan: 2
onCheckedChanged: {
updateInteractive()
}
Component.onCompleted: {
if (index === 0){
checked = true
}
}
function updateInteractive(){
if (checked){
object.interactive = true
} else {
object.interactive = false
}
}
}
} // area Repeater
} // general grid } // general grid
// Generator Editor // Generator Editor
...@@ -187,7 +217,9 @@ Rectangle { ...@@ -187,7 +217,9 @@ Rectangle {
model: missionItem.generatorNameList model: missionItem.generatorNameList
onActivated: { onActivated: {
missionItem.switchToGenerator(index) if (index != -1){
missionItem.switchToGenerator(index)
}
} }
} }
} }
...@@ -207,8 +239,9 @@ Rectangle { ...@@ -207,8 +239,9 @@ Rectangle {
BusyIndicator{ BusyIndicator{
id: indicator id: indicator
anchors.horizontalCenter: parent.horizontalCenter
property bool calculating: missionItem.calculating property bool calculating: missionItem.calculating
running: calculating running: calculating
visible: calculating || timer.running visible: calculating || timer.running
......
...@@ -22,11 +22,9 @@ import QGroundControl.FlightMap 1.0 ...@@ -22,11 +22,9 @@ import QGroundControl.FlightMap 1.0
Item { Item {
id: _root id: _root
property var map ///< Map control to place item in property var map: undefined ///< Map control to place item in
property var qgcView ///< QGCView to use for popping dialogs
property var _missionItem: object property var _missionItem: object
property var _areaData: _missionItem.areaData
property bool _editing: _missionItem.editing property bool _editing: _missionItem.editing
property var _generator: _missionItem.generator property var _generator: _missionItem.generator
...@@ -52,7 +50,8 @@ Item { ...@@ -52,7 +50,8 @@ Item {
_addTransectsComponent() _addTransectsComponent()
_addGeneratorVisuals() _addGeneratorVisuals()
var bbox = boundingBox() var bbox = boundingBox()
_areaData.initialize(bbox[0], bbox[1]) _missionItem.areaData.initialize(bbox[0], bbox[1])
console.assert(map != undefined, "please set the map property")
} }
Component.onDestruction: { Component.onDestruction: {
...@@ -72,10 +71,10 @@ Item { ...@@ -72,10 +71,10 @@ Item {
id: visualTransectsComponent id: visualTransectsComponent
MapPolyline { MapPolyline {
property var transects: _missionItem.route property var route: _missionItem.route
line.color: "white" line.color: "white"
line.width: 2 line.width: 2
path: transects.length > 0 ? transects : [] path: route.length > 0 ? route : []
} }
} }
...@@ -120,12 +119,12 @@ Item { ...@@ -120,12 +119,12 @@ Item {
} }
// GeoAreas
Repeater { Repeater {
model: _areaData.areaList model: _missionItem.areaData.areaList
delegate: GeoAreaVisualLoader { delegate: GeoAreaVisualLoader {
map: _root.map map: _root.map
qgcView: _root.qgcView geoArea: object
geoArea: _areaData.areaList[index]
} }
} }
...@@ -140,7 +139,6 @@ Item { ...@@ -140,7 +139,6 @@ Item {
_generatorVisuals = _generatorVisuals =
component.createObject(_root, { component.createObject(_root, {
"map": _root.map, "map": _root.map,
"qgcView": _root.qgcView ,
"generator": _root._generator, "generator": _root._generator,
"checked": Qt.binding( "checked": Qt.binding(
function(){ function(){
......
...@@ -21,42 +21,48 @@ import QGroundControl.FlightMap 1.0 ...@@ -21,42 +21,48 @@ import QGroundControl.FlightMap 1.0
Item { Item {
id: _root id: _root
property var map ///< Map control to place item in property var map: undefined ///< Map control to place item in
property var qgcView ///< QGCView to use for popping dialogs property var geoArea: undefined ///< GeoArea derived class.
property var areaItem ///< GeoArea derived class.
property var _polygon: areaItem property var _depotVisual: undefined
property var _depot: undefined property var _depotDrag: undefined
property bool _showDepot: areaItem.interactive || areaItem.borderPolygon.interactive property bool _showDepot: geoArea.interactive
opacity: 0.3
signal clicked(int sequenceNumber) signal clicked(int sequenceNumber)
on_ShowDepotChanged: { on_ShowDepotChanged: {
if (_showDepot){ if (_showDepot){
_addDepot() _addDepotVisual()
_addDepotDrag()
} else { } else {
_destroyDepot() _destroyDepotVisual()
_destroyDepotDrag()
} }
} }
Component.onCompleted: { Component.onCompleted: {
if (_showDepot){ if (_showDepot){
_addDepot() _addDepotVisual()
_addDepotDrag()
} }
console.assert(map !== undefined, "please set the map property")
console.assert(geoArea !== undefined, "please set the geoArea property")
} }
Component.onDestruction: { Component.onDestruction: {
_destroyDepot() _destroyDepotVisual()
} }
// Area polygon // Area polygon
QGCMapPolygonVisuals { QGCMapPolygonVisuals {
id: mapPolygonVisuals id: mapPolygonVisuals
mapControl: map mapControl: map
mapPolygon: areaItem mapPolygon: geoArea
interactive: true interactive: geoArea.interactive
borderWidth: 1 borderWidth: 2
borderColor: "black" borderColor: "blue"
interiorColor: "blue" interiorColor: "blue"
altColor: QGroundControl.globalPalette.surveyPolygonTerrainCollision altColor: QGroundControl.globalPalette.surveyPolygonTerrainCollision
interiorOpacity: _root.opacity interiorOpacity: _root.opacity
...@@ -65,49 +71,72 @@ Item { ...@@ -65,49 +71,72 @@ Item {
// Depot Point. // Depot Point.
Component { Component {
id: depotPointComponent id: depotPointComponent
DragCoordinate {
property var depot: _root.areaItem.depot MapQuickItem {
coordinate: _root.geoArea.depot
map: _root.map anchorPoint.x: sourceItem.anchorPointX
qgcView: _root.qgcView anchorPoint.y: sourceItem.anchorPointY
z: QGroundControl.zOrderMapItems visible: true
checked: _root._showDepot
coordinate: _root.areaItem.depot sourceItem:
label: "Depot" MissionItemIndexLabel {
checked: geoArea.interactive
function syncAndBind(){ label: qsTr("Launch")
if (coordinate.latitude !== depot.latitude || highlightSelected: true
coordinate.longitude !== depot.longitude){ onClicked: _root.clicked(0)
if (_root.areaItem.containsCoordinate(coordinate)){ visible: true
_root.areaItem.depot = coordinate
}
} }
coordinate = Qt.binding(function(){return _root.areaItem.depot}) }
} }
onDragReleased: { Component {
syncAndBind() id: depotDragComponent
}
MissionItemIndicatorDrag {
mapControl: _root.map
itemIndicator: _depot
itemCoordinate: geoArea.depot
visible: geoArea.interactive
Component.onCompleted: { property var depot: geoArea.depot
syncAndBind()
onItemCoordinateChanged: {
if (itemCoordinate.latitude !== depot.latitude ||
itemCoordinate.longitude !== depot.longitude){
if (_root.areaItem.containsCoordinate(itemCoordinate)){
_root.areaItem.depot = itemCoordinate
}
}
itemCoordinate = Qt.binding(function(){return _root.geoArea.depot})
} }
}
}
function _addDepotVisual() {
if (!_depotVisual){
_depotVisual = depotPointComponent.createObject(_root)
map.addMapItem(_depotVisual)
}
}
function _destroyDepotVisual() {
if (_depotVisual){
map.removeMapItem(_depotVisual)
_depotVisual.destroy()
_depotVisual = undefined
} }
} }
function _addDepot() { function _addDepotDrag() {
if (!_depot){ if (!_depotDrag){
_depot = depotPointComponent.createObject(_root) _depotDrag = depotDragComponent.createObject(_root)
map.addMapItem(_depot)
} }
} }
function _destroyDepot() { function _destroyDepotDrag() {
if (_depot){ if (_depotDrag){
map.removeMapItem(_depot) _depotDrag.destroy()
_depot.destroy() _depotDrag = undefined
_depot = undefined
} }
} }
} }
...@@ -117,8 +117,7 @@ Item { ...@@ -117,8 +117,7 @@ Item {
} }
} }
Component { Component { id: launchIndicatorComponent
id: launchIndicatorComponent
MapQuickItem { MapQuickItem {
coordinate: _missionItem.launchCoordinate coordinate: _missionItem.launchCoordinate
......
...@@ -113,3 +113,6 @@ MAVLinkChart 1.0 MAVLinkChart.qml ...@@ -113,3 +113,6 @@ MAVLinkChart 1.0 MAVLinkChart.qml
MeasurementItemMapVisual 1.0 MeasurementItemMapVisual.qml MeasurementItemMapVisual 1.0 MeasurementItemMapVisual.qml
CircularGeneratorMapVisual 1.0 CircularGeneratorMapVisual.qml CircularGeneratorMapVisual 1.0 CircularGeneratorMapVisual.qml
GeoAreaVisualLoader 1.0 GeoAreaVisualLoader.qml GeoAreaVisualLoader 1.0 GeoAreaVisualLoader.qml
DragCoordinate 1.0 DragCoordinate.qml
CoordinateIndicator 1.0 CoordinateIndicator.qml
CoordinateIndicatorDrag 1.0 CoordinateIndicatorDrag.qml
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