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
d8fb65d6
Commit
d8fb65d6
authored
Oct 24, 2015
by
Don Gagne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
New item dragger visuals
parent
c880c054
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
147 additions
and
26 deletions
+147
-26
qgcresources.qrc
qgcresources.qrc
+1
-0
MissionEditor.qml
src/MissionEditor/MissionEditor.qml
+146
-26
No files found.
qgcresources.qrc
View file @
d8fb65d6
...
@@ -62,6 +62,7 @@
...
@@ -62,6 +62,7 @@
<file alias="ZoomMinus.svg">src/FlightMap/Images/ZoomMinus.svg</file>
<file alias="ZoomMinus.svg">src/FlightMap/Images/ZoomMinus.svg</file>
<!-- Map Buttons -->
<!-- Map Buttons -->
<file alias="ArrowHead.svg">src/FlightMap/Images/ArrowHead.svg</file>
<file alias="Help.svg">src/FlightMap/Images/Help.svg</file>
<file alias="Help.svg">src/FlightMap/Images/Help.svg</file>
<file alias="HelpBlack.svg">src/FlightMap/Images/HelpBlack.svg</file>
<file alias="HelpBlack.svg">src/FlightMap/Images/HelpBlack.svg</file>
<file alias="MapAddMission.svg">src/FlightMap/Images/MapAddMission.svg</file>
<file alias="MapAddMission.svg">src/FlightMap/Images/MapAddMission.svg</file>
...
...
src/MissionEditor/MissionEditor.qml
View file @
d8fb65d6
...
@@ -75,7 +75,7 @@ QGCView {
...
@@ -75,7 +75,7 @@ QGCView {
id
:
controller
id
:
controller
Component.onCompleted
:
start
(
true
/* editMode */
)
Component.onCompleted
:
start
(
true
/* editMode */
)
/*
/*
FIXME: autoSync is temporarily disconnected since it's still buggy
FIXME: autoSync is temporarily disconnected since it's still buggy
autoSync: QGroundControl.flightMapSettings.loadMapSetting(editorMap.mapName, _autoSyncKey, true)
autoSync: QGroundControl.flightMapSettings.loadMapSetting(editorMap.mapName, _autoSyncKey, true)
...
@@ -83,7 +83,7 @@ QGCView {
...
@@ -83,7 +83,7 @@ QGCView {
onAutoSyncChanged: QGroundControl.flightMapSettings.saveMapSetting(editorMap.mapName, _autoSyncKey, autoSync)
onAutoSyncChanged: QGroundControl.flightMapSettings.saveMapSetting(editorMap.mapName, _autoSyncKey, autoSync)
*/
*/
onMissionItemsChanged
:
item
Edito
r
.
clearItem
()
onMissionItemsChanged
:
item
Dragge
r
.
clearItem
()
}
}
QGCPalette
{
id
:
qgcPal
;
colorGroupEnabled
:
enabled
}
QGCPalette
{
id
:
qgcPal
;
colorGroupEnabled
:
enabled
}
...
@@ -160,58 +160,178 @@ QGCView {
...
@@ -160,58 +160,178 @@ QGCView {
}
}
// We use this item to support dragging since dragging a MapQuickItem just doesn't seem to work
// We use this item to support dragging since dragging a MapQuickItem just doesn't seem to work
Item
{
Rectangle
{
id
:
itemEditor
id
:
itemDragger
x
:
missionItemIndicator
?
(
missionItemIndicator
.
x
+
missionItemIndicator
.
anchorPoint
.
x
-
(
itemEditor
.
width
/
2
))
:
100
x
:
missionItemIndicator
?
(
missionItemIndicator
.
x
+
missionItemIndicator
.
anchorPoint
.
x
-
(
itemDragger
.
width
/
2
))
:
100
y
:
missionItemIndicator
?
(
missionItemIndicator
.
y
+
missionItemIndicator
.
anchorPoint
.
y
-
(
itemEditor
.
height
/
2
))
:
100
y
:
missionItemIndicator
?
(
missionItemIndicator
.
y
+
missionItemIndicator
.
anchorPoint
.
y
-
(
itemDragger
.
height
/
2
))
:
100
width
:
ScreenTools
.
defaultFontPixelHeight
*
7
width
:
_radius
*
2
height
:
ScreenTools
.
defaultFontPixelHeight
*
7
height
:
_radius
*
2
visible
:
false
radius
:
_radius
z
:
QGroundControl
.
zOrderMapItems
+
1
// Above item icons
border.width
:
2
border.color
:
"
white
"
color
:
"
transparent
"
visible
:
false
z
:
QGroundControl
.
zOrderMapItems
+
1
// Above item icons
property
var
missionItem
property
var
missionItem
property
var
missionItemIndicator
property
var
missionItemIndicator
property
real
heading
:
missionItem
?
missionItem
.
heading
:
0
property
real
heading
:
missionItem
?
missionItem
.
heading
:
0
readonly
property
real
_radius
:
ScreenTools
.
defaultFontPixelHeight
*
4
readonly
property
real
_arrowHeight
:
ScreenTools
.
defaultFontPixelHeight
function
clearItem
()
{
function
clearItem
()
{
itemEditor
.
visible
=
false
itemDragger
.
visible
=
false
itemEditor
.
missionItem
=
undefined
itemDragger
.
missionItem
=
undefined
itemEditor
.
missionItemIndicator
=
undefined
itemDragger
.
missionItemIndicator
=
undefined
}
Image
{
anchors.horizontalCenter
:
parent
.
horizontalCenter
anchors.top
:
parent
.
top
height
:
parent
.
_arrowHeight
fillMode
:
Image
.
PreserveAspectFit
mipmap
:
true
smooth
:
true
source
:
"
/qmlimages/ArrowHead.svg
"
}
Image
{
id
:
arrowUp
anchors.verticalCenter
:
parent
.
verticalCenter
anchors.right
:
parent
.
right
height
:
parent
.
_arrowHeight
fillMode
:
Image
.
PreserveAspectFit
mipmap
:
true
smooth
:
true
source
:
"
/qmlimages/ArrowHead.svg
"
transform
:
Rotation
{
origin.x
:
arrowUp
.
width
/
2
;
origin.y
:
arrowUp
.
height
/
2
;
angle
:
90
}
}
Image
{
id
:
arrowDown
anchors.horizontalCenter
:
parent
.
horizontalCenter
anchors.bottom
:
parent
.
bottom
height
:
parent
.
_arrowHeight
fillMode
:
Image
.
PreserveAspectFit
mipmap
:
true
smooth
:
true
source
:
"
/qmlimages/ArrowHead.svg
"
transform
:
Rotation
{
origin.x
:
arrowDown
.
width
/
2
;
origin.y
:
arrowDown
.
height
/
2
;
angle
:
180
}
}
Image
{
id
:
arrowLeft
anchors.verticalCenter
:
parent
.
verticalCenter
anchors.left
:
parent
.
left
height
:
parent
.
_arrowHeight
fillMode
:
Image
.
PreserveAspectFit
mipmap
:
true
smooth
:
true
source
:
"
/qmlimages/ArrowHead.svg
"
transform
:
Rotation
{
origin.x
:
arrowLeft
.
width
/
2
;
origin.y
:
arrowLeft
.
height
/
2
;
angle
:
-
90
}
}
Rectangle
{
width
:
_radius
*
2
height
:
_radius
*
2
radius
:
_radius
anchors.verticalCenter
:
parent
.
verticalCenter
anchors.horizontalCenter
:
parent
.
horizontalCenter
border.width
:
1
border.color
:
"
white
"
readonly
property
real
_radius
:
ScreenTools
.
defaultFontPixelWidth
/
4
}
}
Drag.active
:
itemDrag
.
drag
.
active
Drag.active
:
itemDrag
.
drag
.
active
Drag.hotSpot.x
:
width
/
2
Drag.hotSpot.x
:
width
/
2
Drag.hotSpot.y
:
height
/
2
Drag.hotSpot.y
:
height
/
2
MissionItemIndexLabel
{
x
:
(
itemEditor
.
width
/
2
)
-
(
width
/
2
)
y
:
(
itemEditor
.
height
/
2
)
-
(
height
/
2
)
label
:
itemEditor
.
missionItemIndicator
?
itemEditor
.
missionItemIndicator
.
label
:
""
isCurrentItem
:
true
}
MouseArea
{
MouseArea
{
id
:
itemDrag
id
:
itemDrag
anchors.fill
:
parent
anchors.fill
:
parent
drag.target
:
parent
drag.target
:
parent
drag.minimumX
:
0
drag.minimumY
:
0
drag.maximumX
:
itemDragger
.
parent
.
width
-
parent
.
width
drag.maximumY
:
itemDragger
.
parent
.
height
-
parent
.
height
property
bool
dragActive
:
drag
.
active
property
bool
dragActive
:
drag
.
active
onDragActiveChanged
:
{
onDragActiveChanged
:
{
if
(
!
drag
.
active
)
{
if
(
!
drag
.
active
)
{
var
point
=
Qt
.
point
(
item
Editor
.
x
+
(
itemEditor
.
width
/
2
),
itemEditor
.
y
+
(
itemEdito
r
.
height
/
2
))
var
point
=
Qt
.
point
(
item
Dragger
.
x
+
(
itemDragger
.
width
/
2
),
itemDragger
.
y
+
(
itemDragge
r
.
height
/
2
))
var
coordinate
=
editorMap
.
toCoordinate
(
point
)
var
coordinate
=
editorMap
.
toCoordinate
(
point
)
coordinate
.
altitude
=
itemEditor
.
missionItem
.
coordinate
.
altitude
coordinate
.
altitude
=
itemDragger
.
missionItem
.
coordinate
.
altitude
itemEditor
.
missionItem
.
coordinate
=
coordinate
itemDragger
.
missionItem
.
coordinate
=
coordinate
editorMap
.
latitude
=
itemDragger
.
missionItem
.
coordinate
.
latitude
editorMap
.
longitude
=
itemDragger
.
missionItem
.
coordinate
.
longitude
}
}
}
}
}
}
}
}
// Add the mission items to the map
// Add the mission items to the map
M
ission
ItemView
{
M
ap
ItemView
{
model
:
controller
.
missionItems
model
:
controller
.
missionItems
itemDragger
:
itemEditor
delegate
:
delegateComponent
}
Component
{
id
:
delegateComponent
MissionItemIndicator
{
id
:
itemIndicator
label
:
object
.
homePosition
?
"
H
"
:
object
.
sequenceNumber
isCurrentItem
:
object
.
isCurrentItem
coordinate
:
object
.
coordinate
visible
:
object
.
specifiesCoordinate
&&
(
!
object
.
homePosition
||
object
.
homePositionValid
)
z
:
QGroundControl
.
zOrderMapItems
onClicked
:
setCurrentItem
(
object
.
sequenceNumber
)
Connections
{
target
:
object
onIsCurrentItemChanged
:
{
if
(
object
.
isCurrentItem
&&
object
.
specifiesCoordinate
)
{
// Setup our drag item
if
(
object
.
sequenceNumber
!=
0
)
{
itemDragger
.
visible
=
true
itemDragger
.
missionItem
=
Qt
.
binding
(
function
()
{
return
object
})
itemDragger
.
missionItemIndicator
=
Qt
.
binding
(
function
()
{
return
itemIndicator
})
}
else
{
itemDragger
.
clearItem
()
}
// Move to the new position
editorMap
.
latitude
=
object
.
coordinate
.
latitude
editorMap
.
longitude
=
object
.
coordinate
.
longitude
}
else
{
itemDragger
.
clearItem
()
}
}
}
// These are the non-coordinate child mission items attached to this item
Row
{
anchors.top
:
parent
.
top
anchors.left
:
parent
.
right
Repeater
{
model
:
object
.
childItems
delegate
:
MissionItemIndexLabel
{
label
:
object
.
sequenceNumber
isCurrentItem
:
object
.
isCurrentItem
z
:
2
onClicked
:
setCurrentItem
(
object
.
sequenceNumber
)
}
}
}
}
}
}
// Add lines between waypoints
// Add lines between waypoints
...
@@ -782,7 +902,7 @@ QGCView {
...
@@ -782,7 +902,7 @@ QGCView {
z
:
QGroundControl
.
zOrderWidgets
z
:
QGroundControl
.
zOrderWidgets
onClicked
:
{
onClicked
:
{
item
Edito
r
.
clearItem
()
item
Dragge
r
.
clearItem
()
controller
.
deleteCurrentMissionItem
()
controller
.
deleteCurrentMissionItem
()
checked
=
false
checked
=
false
}
}
...
...
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