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
db75e47f
Commit
db75e47f
authored
Jun 03, 2010
by
pixhawk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Working MAV tracking
parent
5b6fa856
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
19 deletions
+44
-19
MapWidget.cc
src/ui/MapWidget.cc
+41
-19
MapWidget.h
src/ui/MapWidget.h
+3
-0
No files found.
src/ui/MapWidget.cc
View file @
db75e47f
...
...
@@ -34,6 +34,8 @@ This file is part of the PIXHAWK project
#include "UASInterface.h"
#include "UASManager.h"
#include "MG.h"
MapWidget
::
MapWidget
(
QWidget
*
parent
)
:
QWidget
(
parent
),
zoomLevel
(
0
),
...
...
@@ -48,6 +50,8 @@ MapWidget::MapWidget(QWidget *parent) :
mc
->
showScale
(
true
);
mc
->
enablePersistentCache
();
uasIcons
=
QMap
<
int
,
CirclePoint
*>
();
//QSize(480,640)
// ImageManager::instance()->setProxy("www-cache", 8080);
...
...
@@ -74,7 +78,7 @@ MapWidget::MapWidget(QWidget *parent) :
QPushButton
*
zoomout
=
new
QPushButton
(
QIcon
(
":/images/actions/list-remove.svg"
),
""
,
this
);
followgps
=
new
QPushButton
(
QIcon
(
":/images/actions/system-lock-screen.svg"
),
""
,
this
);
followgps
->
setCheckable
(
true
);
// gpsposition = new QLabel();
// gpsposition = new QLabel();
zoomin
->
setMaximumWidth
(
50
);
zoomout
->
setMaximumWidth
(
50
);
followgps
->
setMaximumWidth
(
50
);
...
...
@@ -120,27 +124,44 @@ void MapWidget::addUAS(UASInterface* uas)
void
MapWidget
::
updateGlobalPosition
(
UASInterface
*
uas
,
double
lat
,
double
lon
,
double
alt
,
quint64
usec
)
{
Q_UNUSED
(
usec
);
quint64
currTime
=
MG
::
TIME
::
getGroundTimeNow
();
if
(
currTime
-
lastUpdate
>
100
)
{
lastUpdate
=
currTime
;
// create a LineString
QList
<
Point
*>
points
;
//
QList<Point*> points;
// Points with a circle
// A QPen can be used to customize the
QPen
*
pointpen
=
new
QPen
(
uas
->
getColor
());
pointpen
->
setWidth
(
3
);
points
.
append
(
new
CirclePoint
(
lat
,
lon
,
alt
,
uas
->
getUASName
(),
Point
::
Middle
,
pointpen
));
// points.append(new CirclePoint(8.275145, 50.016992, 15, "Wiesbaden-Mainz-Kastel, Johannes-Goßner-Straße", Point::Middle, pointpen));
// points.append(new CirclePoint(8.270476, 50.021426, 15, "Wiesbaden-Mainz-Kastel, Ruthof", Point::Middle, pointpen));
// // "Blind" Points
// points.append(new Point(8.266445, 50.025913, "Wiesbaden-Mainz-Kastel, Mudra Kaserne"));
// points.append(new Point(8.260378, 50.030345, "Wiesbaden-Mainz-Amoneburg, Dyckerhoffstraße"));
// A QPen also can use transparency
QPen
*
linepen
=
new
QPen
(
QColor
(
0
,
0
,
255
,
100
));
linepen
->
setWidth
(
5
);
// Add the Points and the QPen to a LineString
LineString
*
ls
=
new
LineString
(
points
,
"Path"
,
linepen
);
// Add the LineString to the layer
osmLayer
->
addGeometry
(
ls
);
//pointpen->setWidth(3);
//points.append(new CirclePoint(lat, lon, 10, uas->getUASName(), Point::Middle, pointpen));
if
(
!
uasIcons
.
contains
(
uas
->
getUASID
()))
{
CirclePoint
*
p
=
new
CirclePoint
(
lat
,
lon
,
10
,
uas
->
getUASName
(),
Point
::
Middle
,
pointpen
);
uasIcons
.
insert
(
uas
->
getUASID
(),
p
);
osmLayer
->
addGeometry
(
p
);
}
else
{
CirclePoint
*
p
=
uasIcons
.
value
(
uas
->
getUASID
());
p
->
setCoordinate
(
QPointF
(
lat
,
lon
));
}
// points.append(new CirclePoint(8.275145, 50.016992, 15, "Wiesbaden-Mainz-Kastel, Johannes-Goßner-Straße", Point::Middle, pointpen));
// points.append(new CirclePoint(8.270476, 50.021426, 15, "Wiesbaden-Mainz-Kastel, Ruthof", Point::Middle, pointpen));
// // "Blind" Points
// points.append(new Point(8.266445, 50.025913, "Wiesbaden-Mainz-Kastel, Mudra Kaserne"));
// points.append(new Point(8.260378, 50.030345, "Wiesbaden-Mainz-Amoneburg, Dyckerhoffstraße"));
// // A QPen also can use transparency
// QPen* linepen = new QPen(QColor(0, 0, 255, 100));
// linepen->setWidth(5);
// // Add the Points and the QPen to a LineString
// LineString* ls = new LineString(points, "Path", linepen);
//
// // Add the LineString to the layer
// osmLayer->addGeometry(ls);
// Connect click events of the layer to this object
//connect(osmLayer, SIGNAL(geometryClicked(Geometry*, QPoint)),
...
...
@@ -150,9 +171,10 @@ void MapWidget::updateGlobalPosition(UASInterface* uas, double lat, double lon,
//QList<QPointF> view;
//view.append(QPointF(8.24764, 50.0319));
//view.append(QPointF(8.28412, 49.9998));
// mc->setView(view);
// mc->setView(view);
updatePosition
(
0
,
lat
,
lon
);
}
}
void
MapWidget
::
updatePosition
(
float
time
,
double
lat
,
double
lon
)
...
...
src/ui/MapWidget.h
View file @
db75e47f
...
...
@@ -33,6 +33,7 @@ This file is part of the PIXHAWK project
#define MAPWIDGET_H
#include <QtGui/QWidget>
#include <QMap>
#include "qmapcontrol.h"
#include "UASInterface.h"
...
...
@@ -71,7 +72,9 @@ protected:
Layer
*
osmLayer
;
Layer
*
gSatLayer
;
QMap
<
int
,
CirclePoint
*>
uasIcons
;
UASInterface
*
mav
;
quint64
lastUpdate
;
private:
Ui
::
MapWidget
*
m_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