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
a36b8886
Commit
a36b8886
authored
Mar 12, 2017
by
Don Gagne
Committed by
GitHub
Mar 12, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4755 from DonLakeFlyer/PolygonEditorMobile
Better mobile visuals for polygon draw
parents
1d444d01
cc7fb016
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
55 additions
and
6 deletions
+55
-6
PolygonEditor.qml
src/FlightMap/MapItems/PolygonEditor.qml
+55
-6
No files found.
src/FlightMap/MapItems/PolygonEditor.qml
View file @
a36b8886
...
...
@@ -28,12 +28,15 @@ Item {
property
bool
adjustingPolygon
:
false
property
bool
polygonReady
:
_currentPolygon
?
_currentPolygon
.
path
.
length
>
2
:
false
///< true: enough points have been captured to create a closed polygon
property
var
_helpLabel
///< Dynamically added help label component
property
var
_newPolygon
///< Dynamically added polygon which represents all polygon points including the one currently being drawn
property
var
_currentPolygon
///< Dynamically added polygon which represents the currently completed polygon
property
var
_nextPointLine
///< Dynamically added line which goes from last polygon point to the new one being drawn
property
var
_mouseArea
///< Dynamically added MouseArea which handles all clicking and mouse movement
property
var
_vertexDragList
:
[
]
///< Dynamically added vertex drag points
property
var
_helpLabel
///< Dynamically added help label component
property
var
_newPolygon
///< Dynamically added polygon which represents all polygon points including the one currently being drawn
property
var
_currentPolygon
///< Dynamically added polygon which represents the currently completed polygon
property
var
_nextPointLine
///< Dynamically added line which goes from last polygon point to the new one being drawn
property
var
_mobileSegment
///< Dynamically added line between first and second polygon point for mobile
property
var
_mobilePoint
///< Dynamically added point showing first polygon point on mobile
property
var
_mouseArea
///< Dynamically added MouseArea which handles all clicking and mouse movement
property
var
_vertexDragList
:
[
]
///< Dynamically added vertex drag points
property
bool
_mobile
:
ScreenTools
.
isMobile
/// Begin capturing a new polygon
/// polygonCaptureStarted will be signalled through callbackObject
...
...
@@ -42,11 +45,15 @@ Item {
_newPolygon
=
newPolygonComponent
.
createObject
(
map
)
_currentPolygon
=
currentPolygonComponent
.
createObject
(
map
)
_nextPointLine
=
nextPointComponent
.
createObject
(
map
)
_mobileSegment
=
mobileSegmentComponent
.
createObject
(
map
)
_mobilePoint
=
mobilePointComponent
.
createObject
(
map
)
_mouseArea
=
mouseAreaComponent
.
createObject
(
map
)
map
.
addMapItem
(
_newPolygon
)
map
.
addMapItem
(
_currentPolygon
)
map
.
addMapItem
(
_nextPointLine
)
map
.
addMapItem
(
_mobileSegment
)
map
.
addMapItem
(
_mobilePoint
)
drawingPolygon
=
true
callbackObject
.
polygonCaptureStarted
()
...
...
@@ -244,6 +251,19 @@ Item {
}
_currentPolygon
.
path
=
polygonPath
_newPolygon
.
path
=
polygonPath
if
(
_mobile
&&
_currentPolygon
.
path
.
length
==
1
)
{
_mobilePoint
.
coordinate
=
_currentPolygon
.
path
[
0
]
_mobilePoint
.
visible
=
true
}
else
if
(
_mobile
&&
_currentPolygon
.
path
.
length
==
2
)
{
// Show initial line segment on mobile
_mobileSegment
.
path
=
[
_currentPolygon
.
path
[
0
],
_currentPolygon
.
path
[
1
]
]
_mobileSegment
.
visible
=
true
_mobilePoint
.
visible
=
false
}
else
{
_mobileSegment
.
visible
=
false
_mobilePoint
.
visible
=
false
}
}
else
if
(
polygonReady
)
{
finishCapturePolygon
()
}
...
...
@@ -295,6 +315,35 @@ Item {
}
}
/// First line segment to show on mobile
Component
{
id
:
mobileSegmentComponent
MapPolyline
{
line.color
:
"
green
"
line.width
:
3
visible
:
false
}
}
/// First line segment to show on mobile
Component
{
id
:
mobilePointComponent
MapQuickItem
{
anchorPoint.x
:
rect
.
width
/
2
anchorPoint.y
:
rect
.
height
/
2
visible
:
false
sourceItem
:
Rectangle
{
id
:
rect
width
:
ScreenTools
.
defaultFontPixelHeight
height
:
width
color
:
"
green
"
}
}
}
/// Next line for polygon
Component
{
id
:
nextPointComponent
...
...
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