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
ce27d8fc
Commit
ce27d8fc
authored
Jun 08, 2020
by
Aleksey Kontsevich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
QGCMapPolyline select vertexes functionality
Add invalid vertex index warning
parent
a842c1a4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
1 deletion
+28
-1
QGCMapPolygon.cc
src/MissionManager/QGCMapPolygon.cc
+4
-1
QGCMapPolyline.cc
src/MissionManager/QGCMapPolyline.cc
+19
-0
QGCMapPolyline.h
src/MissionManager/QGCMapPolyline.h
+5
-0
No files found.
src/MissionManager/QGCMapPolygon.cc
View file @
ce27d8fc
...
@@ -630,9 +630,12 @@ void QGCMapPolygon::setShowAltColor(bool showAltColor){
...
@@ -630,9 +630,12 @@ void QGCMapPolygon::setShowAltColor(bool showAltColor){
void
QGCMapPolygon
::
selectVertex
(
int
index
)
void
QGCMapPolygon
::
selectVertex
(
int
index
)
{
{
if
(
0
<=
index
&&
index
<
count
()
&&
index
!=
_selectedVertexIndex
)
{
if
(
index
==
_selectedVertexIndex
)
return
;
// do nothing
if
((
0
<=
index
&&
index
<
count
())
||
index
==
-
1
)
{
_selectedVertexIndex
=
index
;
_selectedVertexIndex
=
index
;
}
else
{
}
else
{
qWarning
()
<<
"QGCMapPolygon: Selected vertex index is out of bounds!"
;
_selectedVertexIndex
=
-
1
;
// deselect vertex
_selectedVertexIndex
=
-
1
;
// deselect vertex
}
}
...
...
src/MissionManager/QGCMapPolyline.cc
View file @
ce27d8fc
...
@@ -243,6 +243,11 @@ void QGCMapPolyline::removeVertex(int vertexIndex)
...
@@ -243,6 +243,11 @@ void QGCMapPolyline::removeVertex(int vertexIndex)
QObject
*
coordObj
=
_polylineModel
.
removeAt
(
vertexIndex
);
QObject
*
coordObj
=
_polylineModel
.
removeAt
(
vertexIndex
);
coordObj
->
deleteLater
();
coordObj
->
deleteLater
();
if
(
vertexIndex
==
_selectedVertexIndex
)
{
selectVertex
(
-
1
);
}
else
if
(
vertexIndex
<
_selectedVertexIndex
)
{
selectVertex
(
_selectedVertexIndex
-
1
);
}
// else do nothing - keep current selected vertex
_polylinePath
.
removeAt
(
vertexIndex
);
_polylinePath
.
removeAt
(
vertexIndex
);
emit
pathChanged
();
emit
pathChanged
();
...
@@ -439,3 +444,17 @@ void QGCMapPolyline::setTraceMode(bool traceMode)
...
@@ -439,3 +444,17 @@ void QGCMapPolyline::setTraceMode(bool traceMode)
emit
traceModeChanged
(
traceMode
);
emit
traceModeChanged
(
traceMode
);
}
}
}
}
void
QGCMapPolyline
::
selectVertex
(
int
index
)
{
if
(
index
==
_selectedVertexIndex
)
return
;
// do nothing
if
((
0
<=
index
&&
index
<
count
())
||
index
==
-
1
)
{
_selectedVertexIndex
=
index
;
}
else
{
qWarning
()
<<
"QGCMapPolyline: Selected vertex index is out of bounds!"
;
_selectedVertexIndex
=
-
1
;
// deselect vertex
}
emit
selectedVertexChanged
(
_selectedVertexIndex
);
}
src/MissionManager/QGCMapPolyline.h
View file @
ce27d8fc
...
@@ -33,6 +33,7 @@ public:
...
@@ -33,6 +33,7 @@ public:
Q_PROPERTY
(
bool
isValid
READ
isValid
NOTIFY
isValidChanged
)
Q_PROPERTY
(
bool
isValid
READ
isValid
NOTIFY
isValidChanged
)
Q_PROPERTY
(
bool
empty
READ
empty
NOTIFY
isEmptyChanged
)
Q_PROPERTY
(
bool
empty
READ
empty
NOTIFY
isEmptyChanged
)
Q_PROPERTY
(
bool
traceMode
READ
traceMode
WRITE
setTraceMode
NOTIFY
traceModeChanged
)
Q_PROPERTY
(
bool
traceMode
READ
traceMode
WRITE
setTraceMode
NOTIFY
traceModeChanged
)
Q_PROPERTY
(
int
selectedVertex
READ
selectedVertex
WRITE
selectVertex
NOTIFY
selectedVertexChanged
)
Q_INVOKABLE
void
clear
(
void
);
Q_INVOKABLE
void
clear
(
void
);
Q_INVOKABLE
void
appendVertex
(
const
QGeoCoordinate
&
coordinate
);
Q_INVOKABLE
void
appendVertex
(
const
QGeoCoordinate
&
coordinate
);
...
@@ -90,6 +91,7 @@ public:
...
@@ -90,6 +91,7 @@ public:
bool
isValid
(
void
)
const
{
return
_polylineModel
.
count
()
>=
2
;
}
bool
isValid
(
void
)
const
{
return
_polylineModel
.
count
()
>=
2
;
}
bool
empty
(
void
)
const
{
return
_polylineModel
.
count
()
==
0
;
}
bool
empty
(
void
)
const
{
return
_polylineModel
.
count
()
==
0
;
}
bool
traceMode
(
void
)
const
{
return
_traceMode
;
}
bool
traceMode
(
void
)
const
{
return
_traceMode
;
}
int
selectedVertex
()
const
{
return
_selectedVertexIndex
;
}
QmlObjectListModel
*
qmlPathModel
(
void
)
{
return
&
_polylineModel
;
}
QmlObjectListModel
*
qmlPathModel
(
void
)
{
return
&
_polylineModel
;
}
QmlObjectListModel
&
pathModel
(
void
)
{
return
_polylineModel
;
}
QmlObjectListModel
&
pathModel
(
void
)
{
return
_polylineModel
;
}
...
@@ -98,6 +100,7 @@ public:
...
@@ -98,6 +100,7 @@ public:
void
setPath
(
const
QVariantList
&
path
);
void
setPath
(
const
QVariantList
&
path
);
void
setInteractive
(
bool
interactive
);
void
setInteractive
(
bool
interactive
);
void
setTraceMode
(
bool
traceMode
);
void
setTraceMode
(
bool
traceMode
);
void
selectVertex
(
int
index
);
static
const
char
*
jsonPolylineKey
;
static
const
char
*
jsonPolylineKey
;
...
@@ -110,6 +113,7 @@ signals:
...
@@ -110,6 +113,7 @@ signals:
void
isValidChanged
(
void
);
void
isValidChanged
(
void
);
void
isEmptyChanged
(
void
);
void
isEmptyChanged
(
void
);
void
traceModeChanged
(
bool
traceMode
);
void
traceModeChanged
(
bool
traceMode
);
void
selectedVertexChanged
(
int
index
);
private
slots
:
private
slots
:
void
_polylineModelCountChanged
(
int
count
);
void
_polylineModelCountChanged
(
int
count
);
...
@@ -128,4 +132,5 @@ private:
...
@@ -128,4 +132,5 @@ private:
bool
_interactive
;
bool
_interactive
;
bool
_resetActive
;
bool
_resetActive
;
bool
_traceMode
=
false
;
bool
_traceMode
=
false
;
int
_selectedVertexIndex
=
-
1
;
};
};
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