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
3920c256
Commit
3920c256
authored
Jan 20, 2011
by
pixhawk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
One step closer to fulle rewritten WP interface
parent
69aed4a6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
18 deletions
+21
-18
UASWaypointManager.cc
src/uas/UASWaypointManager.cc
+2
-0
MapWidget.cc
src/ui/MapWidget.cc
+16
-16
MapWidget.h
src/ui/MapWidget.h
+3
-2
No files found.
src/uas/UASWaypointManager.cc
View file @
3920c256
...
@@ -321,6 +321,8 @@ void UASWaypointManager::addWaypoint(Waypoint *wp)
...
@@ -321,6 +321,8 @@ void UASWaypointManager::addWaypoint(Waypoint *wp)
emit
waypointListChanged
();
emit
waypointListChanged
();
emit
waypointListChanged
(
uas
.
getUASID
());
emit
waypointListChanged
(
uas
.
getUASID
());
qDebug
()
<<
"ADDED WAYPOINT WITH ID:"
<<
wp
->
getId
();
}
}
}
}
...
...
src/ui/MapWidget.cc
View file @
3920c256
...
@@ -436,7 +436,7 @@ void MapWidget::captureMapClick(const QMouseEvent* event, const QPointF coordina
...
@@ -436,7 +436,7 @@ void MapWidget::captureMapClick(const QMouseEvent* event, const QPointF coordina
// waypointPath->setPen(pathPen);
// waypointPath->setPen(pathPen);
// }
// }
wpIndex
.
insert
(
str
,
tempPoint
);
//
wpIndex.insert(str,tempPoint);
// Refresh the screen
// Refresh the screen
mc
->
updateRequest
(
tempPoint
->
boundingBox
().
toRect
());
mc
->
updateRequest
(
tempPoint
->
boundingBox
().
toRect
());
...
@@ -449,17 +449,19 @@ void MapWidget::captureMapClick(const QMouseEvent* event, const QPointF coordina
...
@@ -449,17 +449,19 @@ void MapWidget::captureMapClick(const QMouseEvent* event, const QPointF coordina
void
MapWidget
::
updateWaypoint
(
int
uas
,
Waypoint
*
wp
)
void
MapWidget
::
updateWaypoint
(
int
uas
,
Waypoint
*
wp
)
{
{
qDebug
()
<<
"UPDATING WP"
<<
wp
->
getId
()
<<
__FILE__
<<
__LINE__
;
if
(
uas
==
this
->
mav
->
getUASID
())
if
(
uas
==
this
->
mav
->
getUASID
())
{
{
// Create waypoint name
// Create waypoint name
QString
str
=
QString
(
"%1"
).
arg
(
wp
->
getId
());
QString
str
=
QString
(
"%1"
).
arg
(
wp
->
getId
());
// Check if wp exists yet
// Check if wp exists yet
if
(
!
wpIndex
.
contains
(
str
))
if
(
!
(
wps
.
count
()
>
wp
->
getId
()
))
{
{
QPointF
coordinate
;
QPointF
coordinate
;
coordinate
.
setX
(
wp
->
getX
());
coordinate
.
setX
(
wp
->
getX
());
coordinate
.
setY
(
wp
->
getY
());
coordinate
.
setY
(
wp
->
getY
());
createWaypointGraphAtMap
(
coordinate
);
createWaypointGraphAtMap
(
wp
->
getId
(),
coordinate
);
qDebug
()
<<
"Waypoint Index did not contain"
<<
str
;
qDebug
()
<<
"Waypoint Index did not contain"
<<
str
;
}
}
else
else
...
@@ -474,7 +476,7 @@ void MapWidget::updateWaypoint(int uas, Waypoint* wp)
...
@@ -474,7 +476,7 @@ void MapWidget::updateWaypoint(int uas, Waypoint* wp)
coordinate
.
setY
(
wp
->
getY
());
coordinate
.
setY
(
wp
->
getY
());
Point
*
waypoint
;
Point
*
waypoint
;
waypoint
=
wpIndex
[
str
];
waypoint
=
wp
s
.
at
(
wp
->
getId
());
//wp
Index[str];
if
(
waypoint
)
if
(
waypoint
)
{
{
// First set waypoint coordinate
// First set waypoint coordinate
...
@@ -496,16 +498,13 @@ void MapWidget::updateWaypoint(int uas, Waypoint* wp)
...
@@ -496,16 +498,13 @@ void MapWidget::updateWaypoint(int uas, Waypoint* wp)
}
}
}
}
void
MapWidget
::
createWaypointGraphAtMap
(
const
QPointF
coordinate
)
void
MapWidget
::
createWaypointGraphAtMap
(
int
id
,
const
QPointF
coordinate
)
{
{
if
(
!
wpExists
(
coordinate
))
if
(
!
wpExists
(
coordinate
))
{
{
// Create waypoint name
// Create waypoint name
QString
str
;
QString
str
;
// create the WP and set everything in the LineString to display the path
// create the WP and set everything in the LineString to display the path
//CirclePoint* tempCirclePoint = new CirclePoint(coordinate.x(), coordinate.y(), 10, str);
//CirclePoint* tempCirclePoint = new CirclePoint(coordinate.x(), coordinate.y(), 10, str);
Waypoint2DIcon
*
tempCirclePoint
;
Waypoint2DIcon
*
tempCirclePoint
;
...
@@ -513,13 +512,13 @@ void MapWidget::createWaypointGraphAtMap(const QPointF coordinate)
...
@@ -513,13 +512,13 @@ void MapWidget::createWaypointGraphAtMap(const QPointF coordinate)
if
(
mav
)
if
(
mav
)
{
{
int
uas
=
mav
->
getUASID
();
int
uas
=
mav
->
getUASID
();
str
=
QString
(
"%1"
).
arg
(
mav
->
getWaypointManager
()
->
getWaypointList
().
count
()
);
str
=
QString
(
"%1"
).
arg
(
id
);
qDebug
()
<<
"Waypoint list count:"
<<
str
;
qDebug
()
<<
"Waypoint list count:"
<<
str
;
tempCirclePoint
=
new
Waypoint2DIcon
(
coordinate
.
x
(),
coordinate
.
y
(),
20
,
str
,
qmapcontrol
::
Point
::
Middle
,
mavPens
.
value
(
uas
));
tempCirclePoint
=
new
Waypoint2DIcon
(
coordinate
.
x
(),
coordinate
.
y
(),
20
,
str
,
qmapcontrol
::
Point
::
Middle
,
mavPens
.
value
(
uas
));
}
}
else
else
{
{
str
=
QString
(
"%1"
).
arg
(
waypointPath
->
numberOfPoints
()
);
str
=
QString
(
"%1"
).
arg
(
id
);
tempCirclePoint
=
new
Waypoint2DIcon
(
coordinate
.
x
(),
coordinate
.
y
(),
20
,
str
,
qmapcontrol
::
Point
::
Middle
);
tempCirclePoint
=
new
Waypoint2DIcon
(
coordinate
.
x
(),
coordinate
.
y
(),
20
,
str
,
qmapcontrol
::
Point
::
Middle
);
}
}
...
@@ -530,7 +529,7 @@ void MapWidget::createWaypointGraphAtMap(const QPointF coordinate)
...
@@ -530,7 +529,7 @@ void MapWidget::createWaypointGraphAtMap(const QPointF coordinate)
wps
.
append
(
tempPoint
);
wps
.
append
(
tempPoint
);
waypointPath
->
addPoint
(
tempPoint
);
waypointPath
->
addPoint
(
tempPoint
);
wpIndex
.
insert
(
str
,
tempPoint
);
//
wpIndex.insert(str,tempPoint);
qDebug
()
<<
"Funcion createWaypointGraphAtMap WP= "
<<
str
<<
" -> x= "
<<
tempPoint
->
latitude
()
<<
" y= "
<<
tempPoint
->
longitude
();
qDebug
()
<<
"Funcion createWaypointGraphAtMap WP= "
<<
str
<<
" -> x= "
<<
tempPoint
->
latitude
()
<<
" y= "
<<
tempPoint
->
longitude
();
// Refresh the screen
// Refresh the screen
...
@@ -576,7 +575,7 @@ void MapWidget::captureGeometryDrag(Geometry* geom, QPointF coordinate)
...
@@ -576,7 +575,7 @@ void MapWidget::captureGeometryDrag(Geometry* geom, QPointF coordinate)
int
index
=
geom
->
name
().
toInt
(
&
wpIndexOk
);
int
index
=
geom
->
name
().
toInt
(
&
wpIndexOk
);
qmapcontrol
::
Point
*
point2Find
;
qmapcontrol
::
Point
*
point2Find
;
point2Find
=
wp
Index
[
geom
->
name
()]
;
point2Find
=
wp
s
.
at
(
geom
->
name
().
toInt
())
;
if
(
point2Find
)
if
(
point2Find
)
{
{
...
@@ -662,11 +661,10 @@ void MapWidget::updateWaypointList(int uas)
...
@@ -662,11 +661,10 @@ void MapWidget::updateWaypointList(int uas)
}
}
// Delete now unused wps
// Delete now unused wps
if
(
wp
Index
.
count
()
>
wpList
.
count
())
if
(
wp
s
.
count
()
>
wpList
.
count
())
{
{
for
(
int
i
=
wpList
.
count
();
i
<
wp
Index
.
count
();
++
i
)
for
(
int
i
=
wpList
.
count
();
i
<
wp
s
.
count
();
++
i
)
{
{
wpIndex
.
remove
(
QString
(
"%i"
).
arg
(
i
));
QRect
updateRect
=
wps
.
at
(
i
)
->
boundingBox
().
toRect
();
QRect
updateRect
=
wps
.
at
(
i
)
->
boundingBox
().
toRect
();
wps
.
removeAt
(
i
);
wps
.
removeAt
(
i
);
waypointPath
->
points
().
removeAt
(
i
);
waypointPath
->
points
().
removeAt
(
i
);
...
@@ -906,8 +904,10 @@ void MapWidget::clearWaypoints(int uas)
...
@@ -906,8 +904,10 @@ void MapWidget::clearWaypoints(int uas)
mc
->
layer
(
"Waypoints"
)
->
clearGeometries
();
mc
->
layer
(
"Waypoints"
)
->
clearGeometries
();
wps
.
clear
();
wps
.
clear
();
waypointPath
->
points
().
clear
();
waypointPath
->
points
().
clear
();
//delete waypointPath;
//waypointPath = new
mc
->
layer
(
"Waypoints"
)
->
addGeometry
(
waypointPath
);
mc
->
layer
(
"Waypoints"
)
->
addGeometry
(
waypointPath
);
wpIndex
.
clear
();
//
wpIndex.clear();
mc
->
updateRequestNew
();
//(waypointPath->boundingBox().toRect());
mc
->
updateRequestNew
();
//(waypointPath->boundingBox().toRect());
if
(
createPath
->
isChecked
())
if
(
createPath
->
isChecked
())
...
...
src/ui/MapWidget.h
View file @
3920c256
...
@@ -147,7 +147,8 @@ protected:
...
@@ -147,7 +147,8 @@ protected:
void
createPathButtonClicked
(
bool
checked
);
void
createPathButtonClicked
(
bool
checked
);
void
createWaypointGraphAtMap
(
const
QPointF
coordinate
);
/** @brief Create the graphic representation of the waypoint */
void
createWaypointGraphAtMap
(
int
id
,
const
QPointF
coordinate
);
void
mapproviderSelected
(
QAction
*
action
);
void
mapproviderSelected
(
QAction
*
action
);
signals:
signals:
...
@@ -162,7 +163,7 @@ private:
...
@@ -162,7 +163,7 @@ private:
Ui
::
MapWidget
*
m_ui
;
Ui
::
MapWidget
*
m_ui
;
QList
<
qmapcontrol
::
Point
*>
wps
;
QList
<
qmapcontrol
::
Point
*>
wps
;
qmapcontrol
::
LineString
*
waypointPath
;
qmapcontrol
::
LineString
*
waypointPath
;
QHash
<
QString
,
qmapcontrol
::
Point
*>
wpIndex
;
//
QHash <QString, qmapcontrol::Point*> wpIndex;
QPen
*
pointPen
;
QPen
*
pointPen
;
int
wpExists
(
const
QPointF
coordinate
);
int
wpExists
(
const
QPointF
coordinate
);
bool
waypointIsDrag
;
bool
waypointIsDrag
;
...
...
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