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
fb486d9c
Commit
fb486d9c
authored
Mar 02, 2017
by
Don Gagne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Convert polygon editing to dynamic objects
parent
1991d269
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
422 additions
and
387 deletions
+422
-387
qgroundcontrol.qrc
qgroundcontrol.qrc
+2
-0
FlightMap.qml
src/FlightMap/FlightMap.qml
+0
-288
MissionItemIndicatorDrag.qml
src/FlightMap/MapItems/MissionItemIndicatorDrag.qml
+63
-0
PolygonEditor.qml
src/FlightMap/MapItems/PolygonEditor.qml
+307
-0
qmldir
src/FlightMap/qmldir
+6
-4
FWLandingPatternMapVisual.qml
src/MissionEditor/FWLandingPatternMapVisual.qml
+21
-46
MissionEditor.qml
src/MissionEditor/MissionEditor.qml
+1
-1
SimpleItemMapVisual.qml
src/MissionEditor/SimpleItemMapVisual.qml
+4
-37
SurveyItemEditor.qml
src/MissionEditor/SurveyItemEditor.qml
+18
-11
No files found.
qgroundcontrol.qrc
View file @
fb486d9c
...
...
@@ -133,8 +133,10 @@
<file alias="QGroundControl/FlightMap/InstrumentSwipeView.qml">src/FlightMap/Widgets/InstrumentSwipeView.qml</file>
<file alias="QGroundControl/FlightMap/MapScale.qml">src/FlightMap/MapScale.qml</file>
<file alias="QGroundControl/FlightMap/MissionItemIndicator.qml">src/FlightMap/MapItems/MissionItemIndicator.qml</file>
<file alias="QGroundControl/FlightMap/MissionItemIndicatorDrag.qml">src/FlightMap/MapItems/MissionItemIndicatorDrag.qml</file>
<file alias="QGroundControl/FlightMap/MissionItemView.qml">src/FlightMap/MapItems/MissionItemView.qml</file>
<file alias="QGroundControl/FlightMap/MissionLineView.qml">src/FlightMap/MapItems/MissionLineView.qml</file>
<file alias="QGroundControl/FlightMap/PolygonEditor.qml">src/FlightMap/MapItems/PolygonEditor.qml</file>
<file alias="QGroundControl/FlightMap/QGCArtificialHorizon.qml">src/FlightMap/Widgets/QGCArtificialHorizon.qml</file>
<file alias="QGroundControl/FlightMap/QGCAttitudeHUD.qml">src/FlightMap/Widgets/QGCAttitudeHUD.qml</file>
<file alias="QGroundControl/FlightMap/QGCAttitudeWidget.qml">src/FlightMap/Widgets/QGCAttitudeWidget.qml</file>
...
...
src/FlightMap/FlightMap.qml
View file @
fb486d9c
This diff is collapsed.
Click to expand it.
src/FlightMap/MapItems/MissionItemIndicatorDrag.qml
0 → 100644
View file @
fb486d9c
/****************************************************************************
*
* (c) 2009-2016 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
* QGroundControl is licensed according to the terms in the file
* COPYING.md in the root of the source code directory.
*
****************************************************************************/
import
QtQuick
2.4
import
QtLocation
5.3
import
QGroundControl
1.0
import
QGroundControl
.
ScreenTools
1.0
import
QGroundControl
.
Controls
1.0
/// Use the drag a MissionItemIndicator
Rectangle
{
id
:
itemDragger
x
:
itemIndicator
.
x
-
_expandMargin
y
:
itemIndicator
.
y
-
_expandMargin
width
:
itemIndicator
.
width
+
(
_expandMargin
*
2
)
height
:
itemIndicator
.
height
+
(
_expandMargin
*
2
)
color
:
"
transparent
"
z
:
QGroundControl
.
zOrderMapItems
+
1
// Above item icons
// These are handy for debugging so left in for now
//border.width: 1
//border.color: "white"
// Properties which must be specific by consumer
property
var
itemIndicator
///< The mission item indicator to drag around
property
var
itemCoordinate
///< Coordinate we are updating during drag
property
bool
_preventCoordinateBindingLoop
:
false
property
real
_expandMargin
:
ScreenTools
.
isMobile
?
ScreenTools
.
defaultFontPixelWidth
:
0
onXChanged
:
liveDrag
()
onYChanged
:
liveDrag
()
function
liveDrag
()
{
if
(
!
itemDragger
.
_preventCoordinateBindingLoop
&&
Drag
.
active
)
{
var
point
=
Qt
.
point
(
itemDragger
.
x
+
_expandMargin
+
itemIndicator
.
anchorPoint
.
x
,
itemDragger
.
y
+
_expandMargin
+
itemIndicator
.
anchorPoint
.
y
)
var
coordinate
=
map
.
toCoordinate
(
point
)
itemDragger
.
_preventCoordinateBindingLoop
=
true
coordinate
.
altitude
=
itemCoordinate
.
altitude
itemCoordinate
=
coordinate
itemDragger
.
_preventCoordinateBindingLoop
=
false
}
}
Drag.active
:
itemDrag
.
drag
.
active
MouseArea
{
id
:
itemDrag
anchors.fill
:
parent
drag.target
:
parent
drag.minimumX
:
0
drag.minimumY
:
0
drag.maximumX
:
itemDragger
.
parent
.
width
-
parent
.
width
drag.maximumY
:
itemDragger
.
parent
.
height
-
parent
.
height
}
}
src/FlightMap/MapItems/PolygonEditor.qml
0 → 100644
View file @
fb486d9c
This diff is collapsed.
Click to expand it.
src/FlightMap/qmldir
View file @
fb486d9c
...
...
@@ -22,10 +22,12 @@ VehicleHealthWidget 1.0 VehicleHealthWidget.qml
VibrationWidget 1.0 VibrationWidget.qml
# Map items
MissionItemIndicator 1.0 MissionItemIndicator.qml
MissionItemView 1.0 MissionItemView.qml
MissionLineView 1.0 MissionLineView.qml
VehicleMapItem 1.0 VehicleMapItem.qml
MissionItemIndicator 1.0 MissionItemIndicator.qml
MissionItemIndicatorDrag 1.0 MissionItemIndicatorDrag.qml
MissionItemView 1.0 MissionItemView.qml
MissionLineView 1.0 MissionLineView.qml
PolygonEditor 1.0 PolygonEditor.qml
VehicleMapItem 1.0 VehicleMapItem.qml
# Editor controls
QGCMapPolygonControls 1.0 QGCMapPolygonControls.qml
src/MissionEditor/FWLandingPatternMapVisual.qml
View file @
fb486d9c
...
...
@@ -16,6 +16,7 @@ import QGroundControl 1.0
import
QGroundControl
.
ScreenTools
1.0
import
QGroundControl
.
Palette
1.0
import
QGroundControl
.
Controls
1.0
import
QGroundControl
.
FlightMap
1.0
/// Fixed Wing Landing Pattern map visuals
Item
{
...
...
@@ -78,8 +79,8 @@ Item {
function
showDragAreas
()
{
if
(
_dragAreas
.
length
===
0
)
{
_dragAreas
.
push
(
dragAreaComponent
.
createObject
(
map
,
{
"
dragLoiter
"
:
true
}
))
_dragAreas
.
push
(
dragAreaComponent
.
createObject
(
map
,
{
"
dragLoiter
"
:
false
}
))
_dragAreas
.
push
(
loiterDragAreaComponent
.
createObject
(
map
))
_dragAreas
.
push
(
landDragAreaComponent
.
createObject
(
map
))
}
}
...
...
@@ -145,53 +146,27 @@ Item {
}
}
// Control which is used to drag
items
// Control which is used to drag
the loiter point
Component
{
id
:
dragAreaComponent
Rectangle
{
id
:
itemDragger
x
:
mapQuickItem
.
x
y
:
mapQuickItem
.
y
width
:
mapQuickItem
.
width
height
:
mapQuickItem
.
height
color
:
"
transparent
"
z
:
QGroundControl
.
zOrderMapItems
+
1
// Above item icons
property
bool
dragLoiter
property
var
mapQuickItem
:
dragLoiter
?
_itemVisuals
[
_loiterPointIndex
]
:
_itemVisuals
[
_landPointIndex
]
property
bool
_preventCoordinateBindingLoop
:
false
onXChanged
:
liveDrag
()
onYChanged
:
liveDrag
()
function
liveDrag
()
{
if
(
!
itemDragger
.
_preventCoordinateBindingLoop
&&
Drag
.
active
)
{
var
point
=
Qt
.
point
(
itemDragger
.
x
+
mapQuickItem
.
anchorPoint
.
x
,
itemDragger
.
y
+
mapQuickItem
.
anchorPoint
.
y
)
var
coordinate
=
map
.
toCoordinate
(
point
)
itemDragger
.
_preventCoordinateBindingLoop
=
true
if
(
dragLoiter
)
{
coordinate
.
altitude
=
_missionItem
.
loiterCoordinate
.
altitude
_missionItem
.
loiterCoordinate
=
coordinate
}
else
{
coordinate
.
altitude
=
_missionItem
.
landingCoordinate
.
altitude
_missionItem
.
landingCoordinate
=
coordinate
}
itemDragger
.
_preventCoordinateBindingLoop
=
false
}
}
id
:
loiterDragAreaComponent
Drag.active
:
itemDrag
.
drag
.
active
MissionItemIndicatorDrag
{
itemIndicator
:
_itemVisuals
[
_loiterPointIndex
]
itemCoordinate
:
_missionItem
.
loiterCoordinate
MouseArea
{
id
:
itemDrag
anchors.fill
:
parent
drag.target
:
parent
drag.minimumX
:
0
drag.minimumY
:
0
drag.maximumX
:
itemDragger
.
parent
.
width
-
parent
.
width
drag.maximumY
:
itemDragger
.
parent
.
height
-
parent
.
height
}
onItemCoordinateChanged
:
_missionItem
.
loiterCoordinate
=
itemCoordinate
}
}
// Control which is used to drag the loiter point
Component
{
id
:
landDragAreaComponent
MissionItemIndicatorDrag
{
itemIndicator
:
_itemVisuals
[
_landPointIndex
]
itemCoordinate
:
_missionItem
.
landingCoordinate
onItemCoordinateChanged
:
_missionItem
.
landingCoordinate
=
itemCoordinate
}
}
...
...
src/MissionEditor/MissionEditor.qml
View file @
fb486d9c
...
...
@@ -254,7 +254,7 @@ QGCView {
function
setCurrentItem
(
sequenceNumber
)
{
if
(
sequenceNumber
!==
_currentMissionIndex
)
{
editorMap
.
polygonDraw
.
cancelPolygonEdit
()
//
editorMap.polygonDraw.cancelPolygonEdit()
_currentMissionItem
=
undefined
_currentMissionIndex
=
-
1
for
(
var
i
=
0
;
i
<
_visualItems
.
count
;
i
++
)
{
...
...
src/MissionEditor/SimpleItemMapVisual.qml
View file @
fb486d9c
...
...
@@ -80,44 +80,11 @@ Item {
Component
{
id
:
dragAreaComponent
Rectangle
{
id
:
itemDragger
x
:
_itemVisual
.
x
-
_expandMargin
y
:
_itemVisual
.
y
-
_expandMargin
width
:
_itemVisual
.
width
+
(
_expandMargin
*
2
)
height
:
_itemVisual
.
height
+
(
_expandMargin
*
2
)
color
:
"
transparent
"
z
:
QGroundControl
.
zOrderMapItems
+
1
// Above item icons
property
bool
dragLoiter
property
bool
_preventCoordinateBindingLoop
:
false
property
real
_expandMargin
:
ScreenTools
.
isMobile
?
ScreenTools
.
defaultFontPixelWidth
:
0
onXChanged
:
liveDrag
()
onYChanged
:
liveDrag
()
function
liveDrag
()
{
if
(
!
itemDragger
.
_preventCoordinateBindingLoop
&&
Drag
.
active
)
{
var
point
=
Qt
.
point
(
itemDragger
.
x
+
_expandMargin
+
_itemVisual
.
anchorPoint
.
x
,
itemDragger
.
y
+
_expandMargin
+
_itemVisual
.
anchorPoint
.
y
)
var
coordinate
=
map
.
toCoordinate
(
point
)
itemDragger
.
_preventCoordinateBindingLoop
=
true
coordinate
.
altitude
=
_missionItem
.
coordinate
.
altitude
_missionItem
.
coordinate
=
coordinate
itemDragger
.
_preventCoordinateBindingLoop
=
false
}
}
MissionItemIndicatorDrag
{
itemIndicator
:
_itemVisual
itemCoordinate
:
_missionItem
.
coordinate
Drag.active
:
itemDrag
.
drag
.
active
MouseArea
{
id
:
itemDrag
anchors.fill
:
parent
drag.target
:
parent
drag.minimumX
:
0
drag.minimumY
:
0
drag.maximumX
:
itemDragger
.
parent
.
width
-
parent
.
width
drag.maximumY
:
itemDragger
.
parent
.
height
-
parent
.
height
}
onItemCoordinateChanged
:
_missionItem
.
coordinate
=
itemCoordinate
}
}
...
...
src/MissionEditor/SurveyItemEditor.qml
View file @
fb486d9c
...
...
@@ -9,6 +9,7 @@ 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
{
...
...
@@ -593,29 +594,29 @@ Rectangle {
QGCButton
{
width
:
_root
.
width
*
0.45
text
:
editorMap
.
polygonDraw
.
drawingPolygon
?
qsTr
(
"
Finish Draw
"
)
:
qsTr
(
"
Draw
"
)
visible
:
!
editorMap
.
polygonDraw
.
adjustingPolygon
enabled
:
((
editorMap
.
polygonDraw
.
drawingPolygon
&&
editorMap
.
polygonDraw
.
polygonReady
)
||
!
editorMap
.
polygonDraw
.
drawingPolygon
)
text
:
polygonEditor
.
drawingPolygon
?
qsTr
(
"
Finish Draw
"
)
:
qsTr
(
"
Draw
"
)
visible
:
!
polygonEditor
.
adjustingPolygon
enabled
:
((
polygonEditor
.
drawingPolygon
&&
polygonEditor
.
polygonReady
)
||
!
polygonEditor
.
drawingPolygon
)
onClicked
:
{
if
(
editorMap
.
polygonDraw
.
drawingPolygon
)
{
editorMap
.
polygonDraw
.
finishCapturePolygon
()
if
(
polygonEditor
.
drawingPolygon
)
{
polygonEditor
.
finishCapturePolygon
()
}
else
{
editorMap
.
polygonDraw
.
startCapturePolygon
(
_root
)
polygonEditor
.
startCapturePolygon
(
)
}
}
}
QGCButton
{
width
:
_root
.
width
*
0.4
text
:
editorMap
.
polygonDraw
.
adjustingPolygon
?
qsTr
(
"
Finish Adjust
"
)
:
qsTr
(
"
Adjust
"
)
visible
:
missionItem
.
polygonPath
.
length
>
0
&&
!
editorMap
.
polygonDraw
.
drawingPolygon
text
:
polygonEditor
.
adjustingPolygon
?
qsTr
(
"
Finish Adjust
"
)
:
qsTr
(
"
Adjust
"
)
visible
:
missionItem
.
polygonPath
.
length
>
0
&&
!
polygonEditor
.
drawingPolygon
onClicked
:
{
if
(
editorMap
.
polygonDraw
.
adjustingPolygon
)
{
editorMap
.
polygonDraw
.
finishAdjustPolygon
()
if
(
polygonEditor
.
adjustingPolygon
)
{
polygonEditor
.
finishAdjustPolygon
()
}
else
{
editorMap
.
polygonDraw
.
startAdjustPolygon
(
_root
,
missionItem
.
polygonPath
)
polygonEditor
.
startAdjustPolygon
(
missionItem
.
polygonPath
)
}
}
}
...
...
@@ -652,4 +653,10 @@ Rectangle {
}
}
}
PolygonEditor
{
id
:
polygonEditor
map
:
editorMap
callbackObject
:
parent
}
}
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