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
09ae02eb
Commit
09ae02eb
authored
Sep 07, 2010
by
tecnosapiens
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
functionalities to widget of WaypointGlobalView.cpp were added
parent
d0bca7cb
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
154 additions
and
46 deletions
+154
-46
qgroundcontrol.pro
qgroundcontrol.pro
+6
-3
MainWindow.cc
src/ui/MainWindow.cc
+2
-0
MapWidget.cc
src/ui/MapWidget.cc
+9
-0
MapWidget.h
src/ui/MapWidget.h
+1
-0
WaypointList.cc
src/ui/WaypointList.cc
+126
-36
WaypointList.h
src/ui/WaypointList.h
+6
-1
WaypointView.ui
src/ui/WaypointView.ui
+4
-6
No files found.
qgroundcontrol.pro
View file @
09ae02eb
...
...
@@ -74,7 +74,8 @@ FORMS += src/ui/MainWindow.ui \
src
/
ui
/
watchdog
/
WatchdogView
.
ui
\
src
/
ui
/
QGCFirmwareUpdate
.
ui
\
src
/
ui
/
QGCPxImuFirmwareUpdate
.
ui
\
src
/
ui
/
QGCDataPlot2D
.
ui
src
/
ui
/
QGCDataPlot2D
.
ui
\
src
/
ui
/
WaypointGlobalView
.
ui
INCLUDEPATH
+=
src
\
src
/
ui
\
src
/
ui
/
linechart
\
...
...
@@ -156,7 +157,8 @@ HEADERS += src/MG.h \
src
/
ui
/
map
/
Waypoint2DIcon
.
h
\
src
/
ui
/
map
/
MAV2DIcon
.
h
\
src
/
ui
/
map
/
QGC2DIcon
.
h
\
src
/
WaypointGlobal
.
h
src
/
WaypointGlobal
.
h
\
src
/
ui
/
WaypointGlobalView
.
h
SOURCES
+=
src
/
main
.
cc
\
src
/
Core
.
cc
\
src
/
uas
/
UASManager
.
cc
\
...
...
@@ -220,7 +222,8 @@ SOURCES += src/main.cc \
src
/
ui
/
map
/
Waypoint2DIcon
.
cc
\
src
/
ui
/
map
/
MAV2DIcon
.
cc
\
src
/
ui
/
map
/
QGC2DIcon
.
cc
\
src
/
WaypointGlobal
.
cpp
src
/
WaypointGlobal
.
cpp
\
src
/
ui
/
WaypointGlobalView
.
cpp
RESOURCES
=
mavground
.
qrc
#
Include
RT
-
LAB
Library
...
...
src/ui/MainWindow.cc
View file @
09ae02eb
...
...
@@ -102,6 +102,8 @@ MainWindow::MainWindow(QWidget *parent) :
connect
(
waypoints
,
SIGNAL
(
clearPathclicked
()),
map
,
SLOT
(
clearPath
()));
// add Waypoint widget in the WaypointList widget when mouse clicked
connect
(
map
,
SIGNAL
(
captureMapCoordinateClick
(
QPointF
)),
waypoints
,
SLOT
(
addWaypointMouse
(
QPointF
)));
// it notifies that a waypoint global goes to do create
connect
(
map
,
SIGNAL
(
createGlobalWP
(
bool
)),
waypoints
,
SLOT
(
setIsWPGlobal
(
bool
)));
}
MainWindow
::~
MainWindow
()
...
...
src/ui/MapWidget.cc
View file @
09ae02eb
...
...
@@ -299,12 +299,17 @@ void MapWidget::createPathButtonClicked(bool checked)
{
Q_UNUSED
(
checked
);
if
(
createPath
->
isChecked
())
{
// change the cursor shape
this
->
setCursor
(
Qt
::
PointingHandCursor
);
mc
->
setMouseMode
(
qmapcontrol
::
MapControl
::
None
);
// emit signal start to create a Waypoint global
emit
createGlobalWP
(
true
);
// // Clear the previous WP track
// // TODO: Move this to an actual clear track button and add a warning dialog
// mc->layer("Waypoints")->clearGeometries();
...
...
@@ -315,8 +320,11 @@ void MapWidget::createPathButtonClicked(bool checked)
}
else
{
this
->
setCursor
(
Qt
::
ArrowCursor
);
mc
->
setMouseMode
(
qmapcontrol
::
MapControl
::
Panning
);
}
}
...
...
@@ -345,6 +353,7 @@ void MapWidget::captureMapClick(const QMouseEvent* event, const QPointF coordina
// emit signal mouse was clicked
emit
captureMapCoordinateClick
(
coordinate
);
}
}
...
...
src/ui/MapWidget.h
View file @
09ae02eb
...
...
@@ -116,6 +116,7 @@ protected:
signals:
//void movePoint(QPointF newCoord);
void
captureMapCoordinateClick
(
const
QPointF
coordinate
);
//ROCA
void
createGlobalWP
(
bool
value
);
private:
...
...
src/ui/WaypointList.cc
View file @
09ae02eb
...
...
@@ -37,6 +37,7 @@ This file is part of the PIXHAWK project
#include <UASManager.h>
#include <QDebug>
#include <QFileDialog>
#include "WaypointGlobalView.h"
WaypointList
::
WaypointList
(
QWidget
*
parent
,
UASInterface
*
uas
)
:
QWidget
(
parent
),
...
...
@@ -86,6 +87,7 @@ WaypointList::WaypointList(QWidget *parent, UASInterface* uas) :
updateStatusLabel
(
""
);
this
->
setVisible
(
false
);
isGlobalWP
=
false
;
}
WaypointList
::~
WaypointList
()
...
...
@@ -242,53 +244,113 @@ void WaypointList::waypointListChanged()
{
const
QVector
<
Waypoint
*>
&
waypoints
=
uas
->
getWaypointManager
().
getWaypointList
();
// first remove all views of non existing waypoints
if
(
!
wpViews
.
empty
())
{
QMapIterator
<
Waypoint
*
,
WaypointView
*>
viewIt
(
wpViews
);
viewIt
.
toFront
();
while
(
viewIt
.
hasNext
())
// For Global Waypoints
if
(
isGlobalWP
)
{
viewIt
.
next
();
Waypoint
*
cur
=
viewIt
.
key
();
int
i
;
for
(
i
=
0
;
i
<
waypoints
.
size
();
i
++
)
// first remove all views of non existing waypoints
if
(
!
wpGlobalViews
.
empty
())
{
if
(
waypoints
[
i
]
==
cur
)
QMapIterator
<
Waypoint
*
,
WaypointGlobalView
*>
viewIt
(
wpGlobalViews
);
viewIt
.
toFront
();
while
(
viewIt
.
hasNext
())
{
break
;
viewIt
.
next
();
Waypoint
*
cur
=
viewIt
.
key
();
int
i
;
for
(
i
=
0
;
i
<
waypoints
.
size
();
i
++
)
{
if
(
waypoints
[
i
]
==
cur
)
{
break
;
}
}
if
(
i
==
waypoints
.
size
())
{
WaypointGlobalView
*
widget
=
wpGlobalViews
.
find
(
cur
).
value
();
widget
->
hide
();
listLayout
->
removeWidget
(
widget
);
wpGlobalViews
.
remove
(
cur
);
}
}
}
if
(
i
==
waypoints
.
size
())
// then add/update the views for each waypoint in the list
for
(
int
i
=
0
;
i
<
waypoints
.
size
();
i
++
)
{
WaypointView
*
widget
=
wpViews
.
find
(
cur
).
value
();
widget
->
hide
();
listLayout
->
removeWidget
(
widget
);
wpViews
.
remove
(
cur
);
}
Waypoint
*
wp
=
waypoints
[
i
];
if
(
!
wpGlobalViews
.
contains
(
wp
))
{
WaypointGlobalView
*
wpview
=
new
WaypointGlobalView
(
wp
,
this
);
wpGlobalViews
.
insert
(
wp
,
wpview
);
// connect(wpview, SIGNAL(moveDownWaypoint(Waypoint*)), this, SLOT(moveDown(Waypoint*)));
// connect(wpview, SIGNAL(moveUpWaypoint(Waypoint*)), this, SLOT(moveUp(Waypoint*)));
connect
(
wpview
,
SIGNAL
(
removeWaypoint
(
Waypoint
*
)),
this
,
SLOT
(
removeWaypoint
(
Waypoint
*
)));
// connect(wpview, SIGNAL(currentWaypointChanged(quint16)), this, SLOT(currentWaypointChanged(quint16)));
// connect(wpview, SIGNAL(changeCurrentWaypoint(quint16)), this, SLOT(changeCurrentWaypoint(quint16)));
}
WaypointGlobalView
*
wpgv
=
wpGlobalViews
.
value
(
wp
);
wpgv
->
updateValues
();
listLayout
->
addWidget
(
wpgv
);
}
}
// then add/update the views for each waypoint in the list
for
(
int
i
=
0
;
i
<
waypoints
.
size
();
i
++
)
{
Waypoint
*
wp
=
waypoints
[
i
];
if
(
!
wpViews
.
contains
(
wp
))
}
else
{
WaypointView
*
wpview
=
new
WaypointView
(
wp
,
this
);
wpViews
.
insert
(
wp
,
wpview
);
connect
(
wpview
,
SIGNAL
(
moveDownWaypoint
(
Waypoint
*
)),
this
,
SLOT
(
moveDown
(
Waypoint
*
)));
connect
(
wpview
,
SIGNAL
(
moveUpWaypoint
(
Waypoint
*
)),
this
,
SLOT
(
moveUp
(
Waypoint
*
)));
connect
(
wpview
,
SIGNAL
(
removeWaypoint
(
Waypoint
*
)),
this
,
SLOT
(
removeWaypoint
(
Waypoint
*
)));
connect
(
wpview
,
SIGNAL
(
currentWaypointChanged
(
quint16
)),
this
,
SLOT
(
currentWaypointChanged
(
quint16
)));
connect
(
wpview
,
SIGNAL
(
changeCurrentWaypoint
(
quint16
)),
this
,
SLOT
(
changeCurrentWaypoint
(
quint16
)));
// for local Waypoints
// first remove all views of non existing waypoints
if
(
!
wpViews
.
empty
())
{
QMapIterator
<
Waypoint
*
,
WaypointView
*>
viewIt
(
wpViews
);
viewIt
.
toFront
();
while
(
viewIt
.
hasNext
())
{
viewIt
.
next
();
Waypoint
*
cur
=
viewIt
.
key
();
int
i
;
for
(
i
=
0
;
i
<
waypoints
.
size
();
i
++
)
{
if
(
waypoints
[
i
]
==
cur
)
{
break
;
}
}
if
(
i
==
waypoints
.
size
())
{
WaypointView
*
widget
=
wpViews
.
find
(
cur
).
value
();
widget
->
hide
();
listLayout
->
removeWidget
(
widget
);
wpViews
.
remove
(
cur
);
}
}
}
// then add/update the views for each waypoint in the list
for
(
int
i
=
0
;
i
<
waypoints
.
size
();
i
++
)
{
Waypoint
*
wp
=
waypoints
[
i
];
if
(
!
wpViews
.
contains
(
wp
))
{
WaypointView
*
wpview
=
new
WaypointView
(
wp
,
this
);
wpViews
.
insert
(
wp
,
wpview
);
connect
(
wpview
,
SIGNAL
(
moveDownWaypoint
(
Waypoint
*
)),
this
,
SLOT
(
moveDown
(
Waypoint
*
)));
connect
(
wpview
,
SIGNAL
(
moveUpWaypoint
(
Waypoint
*
)),
this
,
SLOT
(
moveUp
(
Waypoint
*
)));
connect
(
wpview
,
SIGNAL
(
removeWaypoint
(
Waypoint
*
)),
this
,
SLOT
(
removeWaypoint
(
Waypoint
*
)));
connect
(
wpview
,
SIGNAL
(
currentWaypointChanged
(
quint16
)),
this
,
SLOT
(
currentWaypointChanged
(
quint16
)));
connect
(
wpview
,
SIGNAL
(
changeCurrentWaypoint
(
quint16
)),
this
,
SLOT
(
changeCurrentWaypoint
(
quint16
)));
}
WaypointView
*
wpv
=
wpViews
.
value
(
wp
);
wpv
->
updateValues
();
// update the values of the ui elements in the view
listLayout
->
addWidget
(
wpv
);
}
}
WaypointView
*
wpv
=
wpViews
.
value
(
wp
);
wpv
->
updateValues
();
// update the values of the ui elements in the view
listLayout
->
addWidget
(
wpv
);
}
}
}
void
WaypointList
::
moveUp
(
Waypoint
*
wp
)
...
...
@@ -362,7 +424,28 @@ void WaypointList::on_clearWPListButton_clicked()
if
(
uas
)
{
const
QVector
<
Waypoint
*>
&
waypoints
=
uas
->
getWaypointManager
().
getWaypointList
();
if
(
isGlobalWP
)
{
const
QVector
<
Waypoint
*>
&
waypoints
=
uas
->
getWaypointManager
().
getWaypointList
();
while
(
!
waypoints
.
isEmpty
())
//for(int i = 0; i <= waypoints.size(); i++)
{
//Waypoint *temp = waypoints[i];
WaypointGlobalView
*
widget
=
wpGlobalViews
.
find
(
waypoints
[
0
]).
value
();
widget
->
remove
();
}
isGlobalWP
=
false
;
}
else
{
const
QVector
<
Waypoint
*>
&
waypoints
=
uas
->
getWaypointManager
().
getWaypointList
();
while
(
!
waypoints
.
isEmpty
())
//for(int i = 0; i <= waypoints.size(); i++)
{
//Waypoint *temp = waypoints[i];
...
...
@@ -372,6 +455,7 @@ void WaypointList::on_clearWPListButton_clicked()
widget
->
remove
();
}
}
}
}
...
...
@@ -396,3 +480,9 @@ void WaypointList::addWaypointMouse(QPointF coordinate)
}
}
/** @brief it notifies that a global waypoint goes to do created */
void
WaypointList
::
setIsWPGlobal
(
bool
value
)
{
isGlobalWP
=
value
;
}
src/ui/WaypointList.h
View file @
09ae02eb
...
...
@@ -41,6 +41,7 @@ This file is part of the QGROUNDCONTROL project
#include "Waypoint.h"
#include "UASInterface.h"
#include "WaypointView.h"
#include "WaypointGlobalView.h"
namespace
Ui
{
...
...
@@ -75,7 +76,8 @@ public slots:
void
addCurrentPositonWaypoint
();
/** @brief Add a waypoint by mouse click over the map */
void
addWaypointMouse
(
QPointF
coordinate
);
/** @brief it notifies that a global waypoint goes to do created */
void
setIsWPGlobal
(
bool
value
);
//Update events
...
...
@@ -104,12 +106,14 @@ protected:
protected:
QMap
<
Waypoint
*
,
WaypointView
*>
wpViews
;
QMap
<
Waypoint
*
,
WaypointGlobalView
*>
wpGlobalViews
;
QVBoxLayout
*
listLayout
;
UASInterface
*
uas
;
double
mavX
;
double
mavY
;
double
mavZ
;
double
mavYaw
;
bool
isGlobalWP
;
private:
Ui
::
WaypointList
*
m_ui
;
...
...
@@ -120,6 +124,7 @@ private:
private
slots
:
void
on_clearWPListButton_clicked
();
};
#endif // WAYPOINTLIST_H
src/ui/WaypointView.ui
View file @
09ae02eb
...
...
@@ -355,7 +355,7 @@ QProgressBar::chunk#thrustBar {
<string/>
</property>
<property
name=
"icon"
>
<iconset
resource=
"../../mavground.qrc"
>
<iconset>
<normaloff>
:/images/actions/go-up.svg
</normaloff>
:/images/actions/go-up.svg
</iconset>
</property>
</widget>
...
...
@@ -375,7 +375,7 @@ QProgressBar::chunk#thrustBar {
<string/>
</property>
<property
name=
"icon"
>
<iconset
resource=
"../../mavground.qrc"
>
<iconset>
<normaloff>
:/images/actions/go-down.svg
</normaloff>
:/images/actions/go-down.svg
</iconset>
</property>
</widget>
...
...
@@ -395,7 +395,7 @@ QProgressBar::chunk#thrustBar {
<string/>
</property>
<property
name=
"icon"
>
<iconset
resource=
"../../mavground.qrc"
>
<iconset>
<normaloff>
:/images/actions/list-remove.svg
</normaloff>
:/images/actions/list-remove.svg
</iconset>
</property>
</widget>
...
...
@@ -405,8 +405,6 @@ QProgressBar::chunk#thrustBar {
</item>
</layout>
</widget>
<resources>
<include
location=
"../../mavground.qrc"
/>
</resources>
<resources/>
<connections/>
</ui>
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