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
50bdc46d
Commit
50bdc46d
authored
Jul 08, 2017
by
Don Gagne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
New polygon center calc
parent
19bffaa8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
6 deletions
+13
-6
QGCMapPolygon.cc
src/MissionManager/QGCMapPolygon.cc
+9
-3
QGCMapPolygonVisuals.qml
src/MissionManager/QGCMapPolygonVisuals.qml
+4
-3
No files found.
src/MissionManager/QGCMapPolygon.cc
View file @
50bdc46d
...
...
@@ -253,6 +253,8 @@ void QGCMapPolygon::removeVertex(int vertexIndex)
_polygonPath
.
removeAt
(
vertexIndex
);
emit
pathChanged
();
_updateCenter
();
}
void
QGCMapPolygon
::
_polygonModelCountChanged
(
int
count
)
...
...
@@ -265,9 +267,13 @@ void QGCMapPolygon::_updateCenter(void)
if
(
!
_ignoreCenterUpdates
)
{
QGeoCoordinate
center
;
if
(
_polygonPath
.
count
()
>
2
)
{
QPointF
centerPoint
=
_toPolygonF
().
boundingRect
().
center
();
center
=
_coordFromPointF
(
centerPoint
);
if
(
_polygonPath
.
count
()
>
2
)
{
QPointF
centroid
(
0
,
0
);
QPolygonF
polygonF
=
_toPolygonF
();
for
(
int
i
=
0
;
i
<
polygonF
.
count
();
i
++
)
{
centroid
+=
polygonF
[
i
];
}
center
=
_coordFromPointF
(
QPointF
(
centroid
.
x
()
/
polygonF
.
count
(),
centroid
.
y
()
/
polygonF
.
count
()));
}
_center
=
center
;
...
...
src/MissionManager/QGCMapPolygonVisuals.qml
View file @
50bdc46d
...
...
@@ -35,8 +35,9 @@ Item {
property
var
_splitHandlesComponent
property
var
_centerDragHandleComponent
property
real
_zorderDragHandle
:
QGroundControl
.
zOrderMapItems
+
2
property
real
_zorderSplitHandle
:
QGroundControl
.
zOrderMapItems
+
1
property
real
_zorderDragHandle
:
QGroundControl
.
zOrderMapItems
+
3
// Highest to prevent splitting when items overlap
property
real
_zorderSplitHandle
:
QGroundControl
.
zOrderMapItems
+
2
property
real
_zorderCenterHandle
:
QGroundControl
.
zOrderMapItems
+
1
// Lowest such that drag or split takes precedence
function
addVisuals
()
{
_polygonComponent
=
polygonComponent
.
createObject
(
mapControl
)
...
...
@@ -281,7 +282,7 @@ Item {
id
:
centerDragAreaComponent
MissionItemIndicatorDrag
{
z
:
_zorder
Drag
Handle
z
:
_zorder
Center
Handle
onItemCoordinateChanged
:
mapPolygon
.
center
=
itemCoordinate
onDragStart
:
mapPolygon
.
centerDrag
=
true
onDragStop
:
mapPolygon
.
centerDrag
=
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