Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
3bc2c3a0
Commit
3bc2c3a0
authored
Mar 21, 2019
by
Valentin Platzgummer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fly Area Editor added
parent
0ca9e0a1
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
336 additions
and
105 deletions
+336
-105
qgroundcontrol.qrc
qgroundcontrol.qrc
+2
-0
WimaFlyArea.cc
src/MissionManager/WimaFlyArea.cc
+34
-7
WimaFlyArea.h
src/MissionManager/WimaFlyArea.h
+16
-4
QGroundControl.Controls.qmldir
src/QmlControls/QGroundControl.Controls.qmldir
+1
-0
FlyAreaEditor.qml
src/WimaView/FlyAreaEditor.qml
+48
-0
FlyAreaItemEditor.qml
src/WimaView/FlyAreaItemEditor.qml
+151
-0
WimaView.qml
src/WimaView/WimaView.qml
+84
-94
No files found.
qgroundcontrol.qrc
View file @
3bc2c3a0
...
...
@@ -211,6 +211,8 @@
<file alias="QGroundControl/Controls/WimaToolBar.qml">src/WimaView/WimaToolBar.qml</file>
<file alias="WimaView.qml">src/WimaView/WimaView.qml</file>
<file alias="QGroundControl/Controls/FlyAreaPolygonMapVisual.qml">src/WimaView/FlyAreaPolygonMapVisual.qml</file>
<file alias="QGroundControl/Controls/FlyAreaEditor.qml">src/WimaView/FlyAreaEditor.qml</file>
<file alias="QGroundControl/Controls/FlyAreaItemEditor.qml">src/WimaView/FlyAreaItemEditor.qml</file>
</qresource>
<qresource prefix="/json">
<file alias="APMMavlinkStreamRate.SettingsGroup.json">src/Settings/APMMavlinkStreamRate.SettingsGroup.json</file>
...
...
src/MissionManager/WimaFlyArea.cc
View file @
3bc2c3a0
...
...
@@ -22,20 +22,47 @@ void WimaFlyArea::_init()
_polygons
=
new
QmlObjectListModel
(
this
);
}
void
WimaFlyArea
::
append_WimaFlyArea
()
void
WimaFlyArea
::
appendFlyAreaPolygon
()
{
QGCMapPolygon
*
newPolygon
=
new
QGCMapPolygon
();
newPolygon
->
setInteractive
(
true
);
for
(
int
i
=
0
;
i
<
_polygons
->
count
();
i
++
)
{
QGCMapPolygon
*
polygon
=
qobject_cast
<
QGCMapPolygon
*>
(
_polygons
->
get
(
i
));
polygon
->
setInteractive
(
false
);
}
_polygons
->
append
(
newPolygon
);
int
index
=
_polygons
->
count
()
-
1
;
setCurrentPolygon
(
index
);
emit
polygonsChanged
();
}
void
WimaFlyArea
::
removeFlyAreaPolygon
(
int
index
)
{
if
(
index
>=
0
&&
index
<
_polygons
->
count
())
{
_polygons
->
removeAt
(
index
);
emit
polygonsChanged
();
}
}
void
WimaFlyArea
::
setCurrentPolygon
(
int
index
)
{
if
(
index
>=
0
&&
index
<
_polygons
->
count
())
{
if
(
index
==
_currentPolygonIndex
){
return
;
}
for
(
int
i
=
0
;
i
<
_polygons
->
count
();
i
++
)
{
QGCMapPolygon
*
polygon
=
qobject_cast
<
QGCMapPolygon
*>
(
_polygons
->
get
(
i
));
polygon
->
setInteractive
(
false
);
}
_currentPolygonIndex
=
index
;
_currentPolygonItem
=
qobject_cast
<
QGCMapPolygon
*>
(
_polygons
->
get
(
index
));
_currentPolygonItem
->
setInteractive
(
true
);
emit
currentPolygonItemChanged
(
_currentPolygonItem
);
emit
currentPolygonIndexChanged
(
index
);
}
}
src/MissionManager/WimaFlyArea.h
View file @
3bc2c3a0
...
...
@@ -16,12 +16,18 @@ public:
Q_PROPERTY
(
QmlObjectListModel
*
polygons
READ
polygons
NOTIFY
polygonsChanged
)
Q_PROPERTY
(
QmlObjectListModel
*
polygons
READ
polygons
NOTIFY
polygonsChanged
)
Q_PROPERTY
(
QGCMapPolygon
*
currentPolygonItem
READ
currentPolygonItem
NOTIFY
currentPolygonItemChanged
)
Q_PROPERTY
(
int
currentPolygonIndex
READ
currentPolygonIndex
NOTIFY
currentPolygonIndexChanged
)
Q_INVOKABLE
void
append_WimaFlyArea
();
Q_INVOKABLE
void
appendFlyAreaPolygon
();
Q_INVOKABLE
void
removeFlyAreaPolygon
(
int
index
);
Q_INVOKABLE
void
setCurrentPolygon
(
int
index
);
// Property Accessors
QmlObjectListModel
*
polygons
(
void
)
{
return
_polygons
;}
QmlObjectListModel
*
polygons
(
void
)
{
return
_polygons
;}
QGCMapPolygon
*
currentPolygonItem
(
void
)
{
return
_currentPolygonItem
;}
int
currentPolygonIndex
(
void
)
{
return
_currentPolygonIndex
;}
// Methodes
...
...
@@ -29,13 +35,19 @@ public:
signals:
void
polygonsChanged
(
void
);
void
currentPolygonItemChanged
(
QGCMapPolygon
*
polygon
);
void
currentPolygonIndexChanged
(
int
index
);
public
slots
:
private:
QmlObjectListModel
*
_polygons
;
QGCMapPolygon
*
_isCurrentPolygon
;
QGCMapPolygon
*
_currentPolygonItem
;
int
_currentPolygonIndex
;
};
...
...
src/QmlControls/QGroundControl.Controls.qmldir
View file @
3bc2c3a0
...
...
@@ -84,3 +84,4 @@ VehicleRotationCal 1.0 VehicleRotationCal.qml
VehicleSummaryRow 1.0 VehicleSummaryRow.qml
ViewWidget 1.0 ViewWidget.qml
FlyAreaPolygonMapVisual 1.0 FlyAreaPolygonMapVisual.qml
FlyAreaItemEditor 1.0 FlyAreaItemEditor.qml
src/WimaView/FlyAreaEditor.qml
0 → 100644
View file @
3bc2c3a0
import
QtQuick
2.3
import
QtQuick
.
Controls
1.2
import
QtQuick
.
Controls
.
Styles
1.4
import
QtQuick
.
Dialogs
1.2
import
QtQuick
.
Extras
1.4
import
QtQuick
.
Layouts
1.2
import
QGroundControl
1.0
import
QGroundControl
.
ScreenTools
1.0
import
QGroundControl
.
Vehicle
1.0
import
QGroundControl
.
Controls
1.0
import
QGroundControl
.
FactControls
1.0
import
QGroundControl
.
Palette
1.0
import
QGroundControl
.
FlightMap
1.0
// Editor for Survery mission items
Rectangle
{
id
:
_root
height
:
visible
?
(
editorColumn
.
height
+
(
_margin
*
2
))
:
0
width
:
availableWidth
color
:
qgcPal
.
windowShadeDark
radius
:
_radius
// The following properties must be available up the hierarchy chain
//property real availableWidth ///< Width for control
//property var missionItem ///< Mission Item for editor
property
real
_margin
:
ScreenTools
.
defaultFontPixelWidth
/
2
property
real
_fieldWidth
:
ScreenTools
.
defaultFontPixelWidth
*
10.5
property
var
_vehicle
:
QGroundControl
.
multiVehicleManager
.
activeVehicle
?
QGroundControl
.
multiVehicleManager
.
activeVehicle
:
QGroundControl
.
multiVehicleManager
.
offlineEditingVehicle
property
real
_cameraMinTriggerInterval
:
missionItem
.
cameraCalc
.
minTriggerInterval
.
rawValue
QGCPalette
{
id
:
qgcPal
;
colorGroupEnabled
:
true
}
Column
{
id
:
editorColumn
anchors.margins
:
_margin
anchors.top
:
parent
.
top
anchors.left
:
parent
.
left
anchors.right
:
parent
.
right
spacing
:
_margin
}
// Column
}
// Rectangle
src/WimaView/FlyAreaItemEditor.qml
0 → 100644
View file @
3bc2c3a0
import
QtQuick
2.3
import
QtQuick
.
Controls
1.2
import
QtQuick
.
Controls
.
Styles
1.4
import
QtQuick
.
Dialogs
1.2
import
QtQml
2.2
import
QGroundControl
1.0
import
QGroundControl
.
ScreenTools
1.0
import
QGroundControl
.
Vehicle
1.0
import
QGroundControl
.
Controls
1.0
import
QGroundControl
.
FactControls
1.0
import
QGroundControl
.
Palette
1.0
/// Fly Area edit control
Rectangle
{
id
:
_root
height
:
editorLoader
.
visible
?
(
editorLoader
.
y
+
editorLoader
.
height
+
(
_margin
*
2
))
:
(
commandPicker
.
y
+
commandPicker
.
height
+
_margin
/
2
)
color
:
_currentItem
?
qgcPal
.
missionItemEditor
:
qgcPal
.
windowShade
radius
:
_radius
property
var
map
///< Map control
property
var
masterController
property
var
missionItem
///< MissionItem associated with this editor
property
bool
readOnly
///< true: read only view, false: full editing view
property
var
rootQgcView
property
var
flyArea
signal
clicked
signal
remove
property
var
_masterController
:
masterController
property
var
_missionController
:
_masterController
.
missionController
property
bool
_currentItem
:
flyArea
.
currentPolygonIndex
===
index
property
color
_outerTextColor
:
_currentItem
?
qgcPal
.
primaryButtonText
:
qgcPal
.
text
property
bool
_noMissionItemsAdded
:
ListView
.
view
.
model
.
count
===
1
property
real
_sectionSpacer
:
ScreenTools
.
defaultFontPixelWidth
/
2
// spacing between section headings
readonly
property
real
_editFieldWidth
:
Math
.
min
(
width
-
_margin
*
2
,
ScreenTools
.
defaultFontPixelWidth
*
12
)
readonly
property
real
_margin
:
ScreenTools
.
defaultFontPixelWidth
/
2
readonly
property
real
_radius
:
ScreenTools
.
defaultFontPixelWidth
/
2
readonly
property
real
_hamburgerSize
:
commandPicker
.
height
readonly
property
bool
_waypointsOnlyMode
:
QGroundControl
.
corePlugin
.
options
.
missionWaypointsOnly
QGCPalette
{
id
:
qgcPal
colorGroupEnabled
:
enabled
}
FocusScope
{
id
:
currentItemScope
anchors.fill
:
parent
MouseArea
{
anchors.fill
:
parent
onClicked
:
{
currentItemScope
.
focus
=
true
_root
.
clicked
()
}
}
}
QGCLabel
{
id
:
label
anchors.verticalCenter
:
commandPicker
.
verticalCenter
anchors.leftMargin
:
_margin
anchors.left
:
parent
.
left
text
:
index
+
1
color
:
_outerTextColor
}
QGCColoredImage
{
id
:
hamburger
anchors.rightMargin
:
ScreenTools
.
defaultFontPixelWidth
anchors.right
:
parent
.
right
anchors.verticalCenter
:
commandPicker
.
verticalCenter
width
:
_hamburgerSize
height
:
_hamburgerSize
sourceSize.height
:
_hamburgerSize
source
:
"
qrc:/qmlimages/Hamburger.svg
"
visible
:
flyArea
.
currentPolygonIndex
===
index
color
:
qgcPal
.
text
}
QGCMouseArea
{
fillItem
:
hamburger
visible
:
hamburger
.
visible
onClicked
:
{
currentItemScope
.
focus
=
true
hamburgerMenu
.
popup
()
}
Menu
{
id
:
hamburgerMenu
MenuItem
{
text
:
qsTr
(
"
Insert Fly Area
"
)
onTriggered
:
flyArea
.
appendFlyAreaPolygon
()
}
MenuItem
{
text
:
qsTr
(
"
Delete
"
)
onTriggered
:
remove
()
}
}
}
QGCButton
{
id
:
commandPicker
anchors.topMargin
:
_margin
/
2
anchors.leftMargin
:
ScreenTools
.
defaultFontPixelWidth
*
2
anchors.rightMargin
:
ScreenTools
.
defaultFontPixelWidth
anchors.left
:
label
.
right
anchors.top
:
parent
.
top
visible
:
!
commandPicker
.
visible
text
:
missionItem
.
commandName
Component
{
id
:
commandDialog
MissionCommandDialog
{
missionItem
:
_root
.
missionItem
}
}
//onClicked: qgcView.showDialog(commandDialog, qsTr("Select Mission Command"), qgcView.showDialogDefaultWidth, StandardButton.Cancel)
}
QGCLabel
{
id
:
commandLabel
anchors.fill
:
parent
verticalAlignment
:
Text
.
AlignVCenter
text
:
"
Fly Area
"
color
:
_outerTextColor
}
Loader
{
id
:
editorLoader
anchors.leftMargin
:
_margin
anchors.topMargin
:
_margin
anchors.left
:
parent
.
left
anchors.top
:
commandPicker
.
bottom
source
:
"
FlyAreaEditor.qml
"
visible
:
_currentItem
property
var
masterController
:
_masterController
property
real
availableWidth
:
_root
.
width
-
(
_margin
*
2
)
///< How wide the editor should be
property
var
editorRoot
:
_root
}
}
// Rectangle
src/WimaView/WimaView.qml
View file @
3bc2c3a0
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment