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
81564629
Commit
81564629
authored
Oct 19, 2016
by
Don Gagne
Committed by
GitHub
Oct 19, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4153 from nanthony21/Multicolored_polygon
Multicolored polygon
parents
aa956db7
eb751017
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
9 deletions
+21
-9
FlightMap.qml
src/FlightMap/FlightMap.qml
+21
-9
No files found.
src/FlightMap/FlightMap.qml
View file @
81564629
...
...
@@ -197,7 +197,8 @@ Map {
property
alias
drawingPolygon
:
polygonDrawer
.
hoverEnabled
property
bool
adjustingPolygon
:
false
property
bool
polygonReady
:
polygonDrawerPolygon
.
path
.
length
>
3
///< true: enough points have been captured to create a closed polygon
property
bool
polygonReady
:
polygonDrawerPolygonSet
.
path
.
length
>
2
///< true: enough points have been captured to create a closed polygon
property
bool
justClicked
:
false
property
var
_callbackObject
...
...
@@ -220,8 +221,7 @@ Map {
return
false
}
var
polygonPath
=
polygonDrawerPolygon
.
path
polygonPath
.
pop
()
// get rid of drag coordinate
var
polygonPath
=
polygonDrawerPolygonSet
.
path
_cancelCapturePolygon
()
polygonDrawer
.
_callbackObject
.
polygonCaptureFinished
(
polygonPath
)
return
true
...
...
@@ -322,10 +322,13 @@ Map {
polygonDrawerNextPoint
.
path
=
[
bogusCoord
,
bogusCoord
]
polygonDrawerPolygon
.
path
=
[
]
polygonDrawerNextPoint
.
path
=
[
]
polygonDrawerPolygonSet
.
path
=
[
bogusCoord
,
bogusCoord
]
polygonDrawerPolygonSet
.
path
=
[
]
}
onClicked
:
{
if
(
mouse
.
button
==
Qt
.
LeftButton
)
{
polygonDrawer
.
justClicked
=
true
if
(
polygonDrawerPolygon
.
path
.
length
>
2
)
{
// Make sure the new line doesn't intersect the existing polygon
var
lastSegment
=
polygonDrawerPolygon
.
path
.
length
-
2
...
...
@@ -349,8 +352,7 @@ Map {
// Update finalized coordinate
polygonPath
[
polygonDrawerPolygon
.
path
.
length
-
1
]
=
clickCoordinate
}
// Add next drag coordinate
polygonPath
.
push
(
clickCoordinate
)
polygonDrawerPolygonSet
.
path
=
polygonPath
polygonDrawerPolygon
.
path
=
polygonPath
}
else
if
(
polygonDrawer
.
polygonReady
)
{
finishCapturePolygon
()
...
...
@@ -360,14 +362,18 @@ Map {
onPositionChanged
:
{
if
(
polygonDrawerPolygon
.
path
.
length
)
{
var
dragCoordinate
=
_map
.
toCoordinate
(
Qt
.
point
(
mouse
.
x
,
mouse
.
y
))
var
polygonPath
=
polygonDrawerPolygon
.
path
if
(
polygonDrawer
.
justClicked
){
polygonPath
.
push
(
dragCoordinate
)
polygonDrawer
.
justClicked
=
false
}
// Update drag line
polygonDrawerNextPoint
.
path
=
[
polygonDrawerPolygon
.
path
[
polygonDrawerPolygon
.
path
.
length
-
2
],
dragCoordinate
]
// Update drag coordinate
var
polygonPath
=
polygonDrawerPolygon
.
path
polygonPath
[
polygonDrawerPolygon
.
path
.
length
-
1
]
=
dragCoordinate
polygonDrawerPolygon
.
path
=
polygonPath
}
}
}
...
...
@@ -377,14 +383,20 @@ Map {
id
:
polygonDrawerPolygon
color
:
"
blue
"
opacity
:
0.5
visible
:
polygonDrawer
.
drawingPolygon
visible
:
polygonDrawerPolygon
.
path
.
length
>
2
}
MapPolygon
{
id
:
polygonDrawerPolygonSet
color
:
'
green
'
opacity
:
0.5
visible
:
polygonDrawer
.
polygonReady
}
/// Next line for polygon
MapPolyline
{
id
:
polygonDrawerNextPoint
line.color
:
"
green
"
line.width
:
5
line.width
:
3
visible
:
polygonDrawer
.
drawingPolygon
}
...
...
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