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
85fbef36
Unverified
Commit
85fbef36
authored
Oct 29, 2018
by
Don Gagne
Committed by
GitHub
Oct 29, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #6957 from DonLakeFlyer/VertexEditPosition
Polygon editing: Edit position available on vertices
parents
270c1eec
bbf16438
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
41 additions
and
18 deletions
+41
-18
ChangeLog.md
ChangeLog.md
+1
-0
QGCMapPolygon.cc
src/MissionManager/QGCMapPolygon.cc
+1
-1
QGCMapPolygon.h
src/MissionManager/QGCMapPolygon.h
+1
-1
QGCMapPolygonVisuals.qml
src/MissionManager/QGCMapPolygonVisuals.qml
+38
-16
No files found.
ChangeLog.md
View file @
85fbef36
...
...
@@ -11,6 +11,7 @@ Note: This file only contains high level features or important fixes.
*
Added Chinese and Turkish localization and partial German localization.
*
Make Distance to GCS available for display from instrument panel.
*
Make Heading to Home available for display from instrument panel.
*
Edit Position dialog available on polygon vertices.
## 3.4
...
...
src/MissionManager/QGCMapPolygon.cc
View file @
85fbef36
...
...
@@ -92,11 +92,11 @@ void QGCMapPolygon::clear(void)
void
QGCMapPolygon
::
adjustVertex
(
int
vertexIndex
,
const
QGeoCoordinate
coordinate
)
{
_polygonPath
[
vertexIndex
]
=
QVariant
::
fromValue
(
coordinate
);
_polygonModel
.
value
<
QGCQGeoCoordinate
*>
(
vertexIndex
)
->
setCoordinate
(
coordinate
);
if
(
!
_centerDrag
)
{
// When dragging center we don't signal path changed until add vertices are updated
emit
pathChanged
();
}
_polygonModel
.
value
<
QGCQGeoCoordinate
*>
(
vertexIndex
)
->
setCoordinate
(
coordinate
);
setDirty
(
true
);
}
...
...
src/MissionManager/QGCMapPolygon.h
View file @
85fbef36
...
...
@@ -64,7 +64,7 @@ public:
QList
<
QGeoCoordinate
>
coordinateList
(
void
)
const
;
/// Returns the QGeoCoordinate for the vertex specified
QGeoCoordinate
vertexCoordinate
(
int
vertex
)
const
;
Q
_INVOKABLE
Q
GeoCoordinate
vertexCoordinate
(
int
vertex
)
const
;
/// Saves the polygon to the json object.
/// @param json Json object to save to
...
...
src/MissionManager/QGCMapPolygonVisuals.qml
View file @
85fbef36
...
...
@@ -189,20 +189,25 @@ Item {
Menu
{
id
:
menu
property
int
_
removeVertexIndex
property
int
_
editingVertexIndex
:
-
1
function
popUpWithIndex
(
curIndex
)
{
_removeVertexIndex
=
curIndex
removeVertexItem
.
visible
=
(
mapPolygon
.
count
>
3
&&
_removeVertexIndex
>=
0
)
function
popupVertex
(
curIndex
)
{
menu
.
_editingVertexIndex
=
curIndex
removeVertexItem
.
visible
=
(
mapPolygon
.
count
>
3
&&
menu
.
_editingVertexIndex
>=
0
)
menu
.
popup
()
}
function
popupCenter
()
{
menu
.
popup
()
}
MenuItem
{
id
:
removeVertexItem
visible
:
!
_circle
text
:
qsTr
(
"
Remove vertex
"
)
onTriggered
:
{
if
(
menu
.
_remove
VertexIndex
>=
0
)
{
mapPolygon
.
removeVertex
(
menu
.
_
remove
VertexIndex
)
if
(
menu
.
_editing
VertexIndex
>=
0
)
{
mapPolygon
.
removeVertex
(
menu
.
_
editing
VertexIndex
)
}
}
}
...
...
@@ -229,8 +234,14 @@ Item {
MenuItem
{
text
:
qsTr
(
"
Edit position...
"
)
enabled
:
_circle
onTriggered
:
qgcView
.
showDialog
(
editPositionDialog
,
qsTr
(
"
Edit Position
"
),
qgcView
.
showDialogDefaultWidth
,
StandardButton
.
Close
)
visible
:
_circle
onTriggered
:
qgcView
.
showDialog
(
editCenterPositionDialog
,
qsTr
(
"
Edit Center Position
"
),
qgcView
.
showDialogDefaultWidth
,
StandardButton
.
Close
)
}
MenuItem
{
text
:
qsTr
(
"
Edit position...
"
)
visible
:
!
_circle
&&
menu
.
_editingVertexIndex
>=
0
onTriggered
:
qgcView
.
showDialog
(
editVertexPositionDialog
,
qsTr
(
"
Edit Vertex Position
"
),
qgcView
.
showDialogDefaultWidth
,
StandardButton
.
Close
)
}
MenuItem
{
...
...
@@ -345,9 +356,7 @@ Item {
}
}
onClicked
:
{
menu
.
popUpWithIndex
(
polygonVertex
)
}
onClicked
:
menu
.
popupVertex
(
polygonVertex
)
}
}
...
...
@@ -436,11 +445,26 @@ Item {
}
Component
{
id
:
editPositionDialog
id
:
edit
Center
PositionDialog
EditPositionDialog
{
coordinate
:
mapPolygon
.
center
onCoordinateChanged
:
mapPolygon
.
center
=
coordinate
onCoordinateChanged
:
{
// Prevent spamming signals on vertex changes by setting centerDrag = true when changing center position.
// This also fixes a bug where Qt gets confused by all the signalling and draws a bad visual.
mapPolygon
.
centerDrag
=
true
mapPolygon
.
center
=
coordinate
mapPolygon
.
centerDrag
=
false
}
}
}
Component
{
id
:
editVertexPositionDialog
EditPositionDialog
{
coordinate
:
mapPolygon
.
vertexCoordinate
(
menu
.
_editingVertexIndex
)
onCoordinateChanged
:
mapPolygon
.
adjustVertex
(
menu
.
_editingVertexIndex
,
coordinate
)
}
}
...
...
@@ -454,9 +478,7 @@ Item {
onDragStart
:
mapPolygon
.
centerDrag
=
true
onDragStop
:
mapPolygon
.
centerDrag
=
false
onClicked
:
{
menu
.
popUpWithIndex
(
-
1
)
//-- Don't offer a choice to delete vertex (cur index == -1)
}
onClicked
:
menu
.
popupCenter
()
function
setRadiusFromDialog
()
{
var
radius
=
QGroundControl
.
appSettingsDistanceUnitsToMeters
(
radiusField
.
text
)
...
...
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