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
60e7913f
Commit
60e7913f
authored
Jan 20, 2011
by
pixhawk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Additional minor fixes to WP interface
parent
0f85d37d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
30 deletions
+20
-30
UASWaypointManager.cc
src/uas/UASWaypointManager.cc
+5
-0
UASWaypointManager.h
src/uas/UASWaypointManager.h
+1
-1
MapWidget.cc
src/ui/MapWidget.cc
+14
-29
No files found.
src/uas/UASWaypointManager.cc
View file @
60e7913f
...
...
@@ -476,6 +476,11 @@ void UASWaypointManager::clearWaypointList()
}
}
int
UASWaypointManager
::
getIndexOf
(
Waypoint
*
wp
)
{
return
waypoints
.
indexOf
(
wp
);
}
void
UASWaypointManager
::
readWaypoints
()
{
emit
readGlobalWPFromUAS
(
true
);
...
...
src/uas/UASWaypointManager.h
View file @
60e7913f
...
...
@@ -96,7 +96,7 @@ public:
void
localMoveWaypoint
(
quint16
cur_seq
,
quint16
new_seq
);
///< locally move a waypoint from its current position cur_seq to a new position new_seq
void
localSaveWaypoints
(
const
QString
&
saveFile
);
///< saves the local waypoint list to saveFile
void
localLoadWaypoints
(
const
QString
&
loadFile
);
///< loads a waypoint list from loadFile
int
getIndexOf
(
Waypoint
*
wp
);
///< Get the index of a waypoint in the list
/*@}*/
UAS
&
getUAS
()
{
return
this
->
uas
;
}
///< Returns the owning UAS
...
...
src/ui/MapWidget.cc
View file @
60e7913f
...
...
@@ -401,7 +401,6 @@ void MapWidget::createPathButtonClicked(bool checked)
void
MapWidget
::
captureMapClick
(
const
QMouseEvent
*
event
,
const
QPointF
coordinate
)
{
//qDebug() << mc->mouseMode();
if
(
QEvent
::
MouseButtonRelease
==
event
->
type
()
&&
createPath
->
isChecked
())
{
// Create waypoint name
...
...
@@ -413,11 +412,6 @@ void MapWidget::captureMapClick(const QMouseEvent* event, const QPointF coordina
if
(
mav
)
{
mav
->
getWaypointManager
()
->
addWaypoint
(
new
Waypoint
(
mav
->
getWaypointManager
()
->
getWaypointList
().
count
(),
coordinate
.
x
(),
coordinate
.
y
()));
// QVector<Waypoint*> mavWps = mav->getWaypointManager()->getWaypointList();
// str = QString("%1").arg(mavWps.count());
// tempCirclePoint = new Waypoint2DIcon(coordinate.x(), coordinate.y(), 20, str, qmapcontrol::Point::Middle, new QPen(mav->getColor()));
// //mav->getWaypointManager()->addWaypoint(new Waypoint(mavWps.count(), coordinate.x(), coordinate.y()));
}
else
{
...
...
@@ -429,14 +423,6 @@ void MapWidget::captureMapClick(const QMouseEvent* event, const QPointF coordina
qmapcontrol
::
Point
*
tempPoint
=
new
qmapcontrol
::
Point
(
coordinate
.
x
(),
coordinate
.
y
(),
str
);
wps
.
append
(
tempPoint
);
waypointPath
->
addPoint
(
tempPoint
);
// if (mav)
// {
// QPen* pathPen = new QPen(mav->getColor());
// pathPen->setWidth(2);
// waypointPath->setPen(pathPen);
// }
//wpIndex.insert(str,tempPoint);
// Refresh the screen
mc
->
updateRequest
(
tempPoint
->
boundingBox
().
toRect
());
...
...
@@ -449,18 +435,19 @@ void MapWidget::captureMapClick(const QMouseEvent* event, const QPointF coordina
void
MapWidget
::
updateWaypoint
(
int
uas
,
Waypoint
*
wp
)
{
qDebug
()
<<
"UPDATING WP"
<<
wp
->
getId
()
<<
__FILE__
<<
__LINE__
;
//
qDebug() << "UPDATING WP" << wp->getId() << __FILE__ << __LINE__;
if
(
uas
==
this
->
mav
->
getUASID
())
{
int
wpindex
=
UASManager
::
instance
()
->
getUASForId
(
uas
)
->
getWaypointManager
()
->
getIndexOf
(
wp
);
// Create waypoint name
QString
str
=
QString
(
"%1"
).
arg
(
wp
->
getId
()
);
QString
str
=
QString
(
"%1"
).
arg
(
wp
index
);
// Check if wp exists yet
if
(
!
(
wps
.
count
()
>
wp
->
getId
()
))
if
(
!
(
wps
.
count
()
>
wp
index
))
{
QPointF
coordinate
;
coordinate
.
setX
(
wp
->
getX
());
coordinate
.
setY
(
wp
->
getY
());
createWaypointGraphAtMap
(
wp
->
getId
()
,
coordinate
);
createWaypointGraphAtMap
(
wp
index
,
coordinate
);
qDebug
()
<<
"Waypoint Index did not contain"
<<
str
;
}
...
...
@@ -469,29 +456,27 @@ void MapWidget::updateWaypoint(int uas, Waypoint* wp)
// Waypoint exists, update it
if
(
!
waypointIsDrag
)
{
qDebug
()
<<
"indice WP= "
<<
wp
->
getId
()
<<
"
\n
"
;
qDebug
()
<<
"indice WP= "
<<
wp
index
<<
"
\n
"
;
QPointF
coordinate
;
coordinate
.
setX
(
wp
->
getX
());
coordinate
.
setY
(
wp
->
getY
());
Point
*
waypoint
;
waypoint
=
wps
.
at
(
wp
->
getId
()
);
//wpIndex[str];
waypoint
=
wps
.
at
(
wp
index
);
//wpIndex[str];
if
(
waypoint
)
{
// First set waypoint coordinate
waypoint
->
setCoordinate
(
coordinate
);
// Now update icon position
//mc->layer("Waypoints")->removeGeometry(wpIcons.at(wp
->getId()
));
wpIcons
.
at
(
wp
->
getId
()
)
->
setCoordinate
(
coordinate
);
//mc->layer("Waypoints")->addGeometry(wpIcons.at(wp
->getId()
));
//mc->layer("Waypoints")->removeGeometry(wpIcons.at(wp
index
));
wpIcons
.
at
(
wp
index
)
->
setCoordinate
(
coordinate
);
//mc->layer("Waypoints")->addGeometry(wpIcons.at(wp
index
));
// Then waypoint line coordinate
int
linesegmentId
=
mav
->
getWaypointManager
()
->
getWaypointList
().
indexOf
(
wp
);
qDebug
()
<<
"SEGMENT"
<<
linesegmentId
;
Point
*
linesegment
=
NULL
;
if
(
waypointPath
->
points
().
size
()
>
linesegmentId
)
if
(
waypointPath
->
points
().
size
()
>
wpindex
)
{
linesegment
=
waypointPath
->
points
().
at
(
linesegmentId
);
linesegment
=
waypointPath
->
points
().
at
(
wpindex
);
}
if
(
linesegment
)
...
...
@@ -499,7 +484,7 @@ void MapWidget::updateWaypoint(int uas, Waypoint* wp)
linesegment
->
setCoordinate
(
coordinate
);
}
//point2Find = dynamic_cast <Point*> (mc->layer("Waypoints")->get_Geometry(wp
->getId()
));
//point2Find = dynamic_cast <Point*> (mc->layer("Waypoints")->get_Geometry(wp
index
));
//point2Find->setCoordinate(coordinate);
mc
->
updateRequest
(
waypoint
->
boundingBox
().
toRect
());
}
...
...
@@ -925,7 +910,7 @@ void MapWidget::clearWaypoints(int uas)
{
// Clear the previous WP track
mc
->
layer
(
"Waypoints"
)
->
clearGeometries
();
//
mc->layer("Waypoints")->clearGeometries();
wps
.
clear
();
waypointPath
->
points
().
clear
();
//delete waypointPath;
...
...
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