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

123

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