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
5b9ba40d
Commit
5b9ba40d
authored
Apr 11, 2017
by
Don Gagne
Committed by
GitHub
Apr 11, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4956 from DonLakeFlyer/PolygonDrag
Fix survey drag visual glitches
parents
09bde0c7
5ceb1d24
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
60 additions
and
27 deletions
+60
-27
MissionItemIndicatorDrag.qml
src/FlightMap/MapItems/MissionItemIndicatorDrag.qml
+14
-6
QGCMapPolygon.cc
src/MissionManager/QGCMapPolygon.cc
+21
-2
QGCMapPolygon.h
src/MissionManager/QGCMapPolygon.h
+22
-18
QGCMapPolygonVisuals.qml
src/MissionManager/QGCMapPolygonVisuals.qml
+3
-1
No files found.
src/FlightMap/MapItems/MissionItemIndicatorDrag.qml
View file @
5b9ba40d
...
...
@@ -29,6 +29,8 @@ Rectangle {
property
var
itemCoordinate
///< Coordinate we are updating during drag
signal
clicked
signal
dragStart
signal
dragStop
property
bool
_preventCoordinateBindingLoop
:
false
...
...
@@ -37,6 +39,7 @@ Rectangle {
property
real
_touchHeight
:
Math
.
max
(
itemIndicator
.
height
,
ScreenTools
.
minTouchPixels
)
property
real
_touchMarginHorizontal
:
_mobile
?
(
_touchWidth
-
itemIndicator
.
width
)
/
2
:
0
property
real
_touchMarginVertical
:
_mobile
?
(
_touchHeight
-
itemIndicator
.
height
)
/
2
:
0
property
bool
_dragStartSignalled
:
false
onXChanged
:
liveDrag
()
onYChanged
:
liveDrag
()
...
...
@@ -65,13 +68,18 @@ Rectangle {
preventStealing
:
true
onClicked
:
itemDragger
.
clicked
()
}
Item
{
id
:
fakeItemIndicator
Item
{
id
:
anchorPoint
property
bool
dragActive
:
drag
.
active
onDragActiveChanged
:
{
if
(
dragActive
)
{
if
(
!
_dragStartSignalled
)
{
_dragStartSignalled
=
true
dragStart
()
}
}
else
{
_dragStartSignalled
=
false
dragStop
()
}
}
}
}
src/MissionManager/QGCMapPolygon.cc
View file @
5b9ba40d
...
...
@@ -22,6 +22,7 @@ QGCMapPolygon::QGCMapPolygon(QObject* newCoordParent, QObject* parent)
:
QObject
(
parent
)
,
_newCoordParent
(
newCoordParent
)
,
_dirty
(
false
)
,
_centerDrag
(
false
)
,
_ignoreCenterUpdates
(
false
)
{
connect
(
&
_polygonModel
,
&
QmlObjectListModel
::
dirtyChanged
,
this
,
&
QGCMapPolygon
::
_polygonModelDirtyChanged
);
...
...
@@ -53,7 +54,10 @@ void QGCMapPolygon::clear(void)
void
QGCMapPolygon
::
adjustVertex
(
int
vertexIndex
,
const
QGeoCoordinate
coordinate
)
{
_polygonPath
[
vertexIndex
]
=
QVariant
::
fromValue
(
coordinate
);
emit
pathChanged
();
if
(
!
_centerDrag
)
{
// When dragging center we don't signal path changed until add vertices are updated
emit
pathChanged
();
}
_polygonModel
.
value
<
QGCQGeoCoordinate
*>
(
vertexIndex
)
->
setCoordinate
(
coordinate
);
...
...
@@ -278,7 +282,22 @@ void QGCMapPolygon::setCenter(QGeoCoordinate newCenter)
adjustVertex
(
i
,
newVertex
);
}
if
(
_centerDrag
)
{
// When center dragging signals are delayed until all vertices are updated
emit
pathChanged
();
}
_ignoreCenterUpdates
=
false
;
_updateCenter
();
_center
=
newCenter
;
emit
centerChanged
(
newCenter
);
}
}
void
QGCMapPolygon
::
setCenterDrag
(
bool
centerDrag
)
{
if
(
centerDrag
!=
_centerDrag
)
{
_centerDrag
=
centerDrag
;
emit
centerDragChanged
(
centerDrag
);
}
}
src/MissionManager/QGCMapPolygon.h
View file @
5b9ba40d
...
...
@@ -26,11 +26,12 @@ class QGCMapPolygon : public QObject
public:
QGCMapPolygon
(
QObject
*
newCoordParent
,
QObject
*
parent
=
NULL
);
Q_PROPERTY
(
int
count
READ
count
NOTIFY
countChanged
)
Q_PROPERTY
(
QVariantList
path
READ
path
NOTIFY
pathChanged
)
Q_PROPERTY
(
QmlObjectListModel
*
pathModel
READ
qmlPathModel
CONSTANT
)
Q_PROPERTY
(
bool
dirty
READ
dirty
WRITE
setDirty
NOTIFY
dirtyChanged
)
Q_PROPERTY
(
QGeoCoordinate
center
READ
center
WRITE
setCenter
NOTIFY
centerChanged
)
Q_PROPERTY
(
int
count
READ
count
NOTIFY
countChanged
)
Q_PROPERTY
(
QVariantList
path
READ
path
NOTIFY
pathChanged
)
Q_PROPERTY
(
QmlObjectListModel
*
pathModel
READ
qmlPathModel
CONSTANT
)
Q_PROPERTY
(
bool
dirty
READ
dirty
WRITE
setDirty
NOTIFY
dirtyChanged
)
Q_PROPERTY
(
QGeoCoordinate
center
READ
center
WRITE
setCenter
NOTIFY
centerChanged
)
Q_PROPERTY
(
bool
centerDrag
READ
centerDrag
WRITE
setCenterDrag
NOTIFY
centerDragChanged
)
Q_INVOKABLE
void
clear
(
void
);
Q_INVOKABLE
void
appendVertex
(
const
QGeoCoordinate
&
coordinate
);
...
...
@@ -63,28 +64,30 @@ public:
// Property methods
int
count
(
void
)
const
{
return
_polygonPath
.
count
();
}
bool
dirty
(
void
)
const
{
return
_dirty
;
}
void
setDirty
(
bool
dirty
);
QGeoCoordinate
center
(
void
)
const
{
return
_center
;
}
int
count
(
void
)
const
{
return
_polygonPath
.
count
();
}
bool
dirty
(
void
)
const
{
return
_dirty
;
}
void
setDirty
(
bool
dirty
);
QGeoCoordinate
center
(
void
)
const
{
return
_center
;
}
bool
centerDrag
(
void
)
const
{
return
_centerDrag
;
}
QVariantList
path
(
void
)
const
{
return
_polygonPath
;
}
QmlObjectListModel
*
qmlPathModel
(
void
)
{
return
&
_polygonModel
;
}
QmlObjectListModel
&
pathModel
(
void
)
{
return
_polygonModel
;
}
void
setPath
(
const
QList
<
QGeoCoordinate
>&
path
);
void
setPath
(
const
QVariantList
&
path
);
void
setCenter
(
QGeoCoordinate
newCenter
);
void
setPath
(
const
QList
<
QGeoCoordinate
>&
path
);
void
setPath
(
const
QVariantList
&
path
);
void
setCenter
(
QGeoCoordinate
newCenter
);
void
setCenterDrag
(
bool
centerDrag
);
static
const
char
*
jsonPolygonKey
;
signals:
void
countChanged
(
int
count
);
void
pathChanged
(
void
);
void
dirtyChanged
(
bool
dirty
);
void
cleared
(
void
);
void
centerChanged
(
QGeoCoordinate
center
);
void
countChanged
(
int
count
);
void
pathChanged
(
void
);
void
dirtyChanged
(
bool
dirty
);
void
cleared
(
void
);
void
centerChanged
(
QGeoCoordinate
center
);
void
centerDragChanged
(
bool
centerDrag
);
private
slots
:
void
_polygonModelCountChanged
(
int
count
);
...
...
@@ -101,6 +104,7 @@ private:
QmlObjectListModel
_polygonModel
;
bool
_dirty
;
QGeoCoordinate
_center
;
bool
_centerDrag
;
bool
_ignoreCenterUpdates
;
};
...
...
src/MissionManager/QGCMapPolygonVisuals.qml
View file @
5b9ba40d
...
...
@@ -222,7 +222,9 @@ Item {
id
:
centerDragAreaComponent
MissionItemIndicatorDrag
{
onItemCoordinateChanged
:
mapPolygon
.
center
=
itemCoordinate
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