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
35898750
Commit
35898750
authored
Jan 13, 2011
by
lm
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'experimental' of github.com:pixhawk/qgroundcontrol into experimental
parents
b634b5d7
9717f87c
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
127 additions
and
31 deletions
+127
-31
earth.html
images/earth.html
+31
-13
layermanager.cpp
lib/QMapControl/src/layermanager.cpp
+18
-8
layermanager.h
lib/QMapControl/src/layermanager.h
+9
-3
mapcontrol.cpp
lib/QMapControl/src/mapcontrol.cpp
+26
-0
mapcontrol.h
lib/QMapControl/src/mapcontrol.h
+9
-0
qgroundcontrol.pri
qgroundcontrol.pri
+10
-2
qgroundcontrol.pro
qgroundcontrol.pro
+0
-1
MAVLinkProtocol.cc
src/comm/MAVLinkProtocol.cc
+1
-1
MapWidget.cc
src/ui/MapWidget.cc
+23
-3
No files found.
images/earth.html
View file @
35898750
...
...
@@ -19,6 +19,7 @@ var followEnabled = false;
var
lastLat
=
0
;
var
lastLon
=
0
;
var
lastAlt
=
0
;
var
currLat
=
47.3769
;
var
currLon
=
8.549444
;
var
currAlt
=
470
;
...
...
@@ -44,6 +45,8 @@ var planeOrient;
var
planeLoc
;
var
aircraft
=
[];
var
aircraftLocations
=
[];
var
aircraftLastLocations
=
[];
var
attitudes
=
[];
var
locations
=
[];
var
trails
=
[];
...
...
@@ -133,7 +136,8 @@ function createAircraft(id, type, color)
// Write into global structure
aircraft
[
id
]
=
planePlacemark
;
attitudes
[
id
]
=
planeOrient
;
locations
[
id
]
=
planeLoc
;
aircraftLocations
[
id
]
=
planeLoc
;
aircraftLastLocations
[
id
]
=
ge
.
createLocation
(
''
);
//planeColor = color;
createTrail
(
id
,
color
);
...
...
@@ -191,7 +195,7 @@ function addTrailPosition(id, lat, lon, alt)
trails
[
id
].
setAltitudeMode
(
ge
.
ALTITUDE_ABSOLUTE
);
// Add LineString points
trails
[
id
].
getCoordinates
().
pushLatLngAlt
(
lat
,
lon
,
alt
);
trails
[
id
].
getCoordinates
().
pushLatLngAlt
(
lat
,
lon
,
alt
);
// Create a style and set width and color of line
trailPlacemarks
[
id
].
setStyleSelector
(
ge
.
createStyle
(
''
));
...
...
@@ -228,24 +232,27 @@ function setAircraftPositionAttitude(id, lat, lon, alt, roll, pitch, yaw)
{
if
(
id
==
currAircraft
)
{
lastLat
=
currLat
;
lastLon
=
lastLon
;
if
(
lastLat
==
0
)
{
lastLat
=
currLat
;
lastLon
=
lastLon
;
}
currLat
=
lat
;
currLon
=
lon
;
currAlt
=
alt
;
//currFollowHeading = ((yaw/M_PI)+1.0)*360.0;
}
// FIXME Currently invalid conversion from right-handed z-down to z-up frame
planeOrient
.
setRoll
(((
roll
/
M_PI
)
+
1.0
)
*
360.0
);
planeOrient
.
setTilt
(((
pitch
/
M_PI
)
+
1.0
)
*
360.0
);
planeOrient
.
setHeading
(((
yaw
/
M_PI
)
+
1.0
)
*
360.0
);
}
planeLoc
.
setLatitude
(
lat
);
planeLoc
.
setLongitude
(
lon
);
planeLoc
.
setAltitude
(
alt
);
//
planeLoc.setLatitude(lat);
//
planeLoc.setLongitude(lon);
//
planeLoc.setAltitude(alt);
}
...
...
@@ -280,13 +287,24 @@ function setCurrentAircraft(id)
function
updateFollowAircraft
()
{
currView
=
ge
.
getView
().
copyAsLookAt
(
ge
.
ALTITUDE_ABSOLUTE
);
currView
.
setLatitude
(
currLat
);
currView
.
setLongitude
(
currLon
);
currView
.
setAltitude
(
currAlt
);
// Interpolate between t-1 and t and set new states
lastLat
=
lastLat
*
0.7
+
currLat
*
0.3
;
lastLon
=
lastLon
*
0.7
+
currLon
*
0.3
;
lastAlt
=
lastAlt
*
0.7
+
currAlt
*
0.3
;
currView
.
setLatitude
(
lastLat
);
currView
.
setLongitude
(
lastLon
);
currView
.
setAltitude
(
lastAlt
);
currView
.
setRange
(
currViewRange
);
currView
.
setTilt
(
currFollowTilt
);
currFollowHeading
=
0.9
*
currFollowHeading
+
0.1
*
((
Math
.
atan2
(
lastLat
-
currLat
,
lastLon
-
currLon
)
/
M_PI
)
+
1.0
)
*
360.0
;
currFollowHeading
=
0
;
// 0
.9*currFollowHeading+0.1*((Math.atan2(lastLat-currLat, lastLon-currLon)/M_PI)+1.0)*360.0;
currView
.
setHeading
(
currFollowHeading
-
0.0
);
// FIXME Shouldn't update aircraft in here, but works for now
planeLoc
.
setLatitude
(
lastLat
);
planeLoc
.
setLongitude
(
lastLon
);
planeLoc
.
setAltitude
(
lastAlt
);
ge
.
getView
().
setAbstractView
(
currView
);
}
...
...
lib/QMapControl/src/layermanager.cpp
View file @
35898750
...
...
@@ -29,12 +29,9 @@ namespace qmapcontrol
LayerManager
::
LayerManager
(
MapControl
*
mapcontrol
,
QSize
size
)
:
mapcontrol
(
mapcontrol
),
scroll
(
QPoint
(
0
,
0
)),
size
(
size
),
whilenewscroll
(
QPoint
(
0
,
0
))
{
// genauer berechnen?
offSize
=
size
*
2
;
composedOffscreenImage
=
QPixmap
(
offSize
);
composedOffscreenImage2
=
QPixmap
(
offSize
);
setOffscreenImageFactor
(
2
);
zoomImage
=
QPixmap
(
size
);
zoomImage
.
fill
(
Qt
::
white
);
zoomImage
.
fill
(
Qt
::
black
);
screenmiddle
=
QPoint
(
size
.
width
()
/
2
,
size
.
height
()
/
2
);
}
...
...
@@ -44,6 +41,19 @@ namespace qmapcontrol
mylayers
.
clear
();
}
void
LayerManager
::
setOffscreenImageFactor
(
float
factor
)
{
offSize
=
size
*
factor
;
offFactor
=
factor
;
composedOffscreenImage
=
QPixmap
(
offSize
);
composedOffscreenImage2
=
QPixmap
(
offSize
);
}
float
LayerManager
::
offscreenImageFactor
()
{
return
offFactor
;
}
QPointF
LayerManager
::
currentCoordinate
()
const
{
return
mapmiddle
;
...
...
@@ -264,7 +274,7 @@ namespace qmapcontrol
// layer rendern abbrechen?
zoomImageScroll
=
QPoint
(
0
,
0
);
zoomImage
.
fill
(
Qt
::
white
);
zoomImage
.
fill
(
Qt
::
black
);
QPixmap
tmpImg
=
composedOffscreenImage
.
copy
(
screenmiddle
.
x
()
+
scroll
.
x
(),
screenmiddle
.
y
()
+
scroll
.
y
(),
size
.
width
(),
size
.
height
());
QPainter
painter
(
&
zoomImage
);
...
...
@@ -471,11 +481,11 @@ namespace qmapcontrol
void
LayerManager
::
resize
(
QSize
newSize
)
{
size
=
newSize
;
offSize
=
newSize
*
2
;
offSize
=
newSize
*
offFactor
;
composedOffscreenImage
=
QPixmap
(
offSize
);
composedOffscreenImage2
=
QPixmap
(
offSize
);
zoomImage
=
QPixmap
(
newSize
);
zoomImage
.
fill
(
Qt
::
white
);
zoomImage
.
fill
(
Qt
::
black
);
screenmiddle
=
QPoint
(
newSize
.
width
()
/
2
,
newSize
.
height
()
/
2
);
...
...
lib/QMapControl/src/layermanager.h
View file @
35898750
...
...
@@ -121,6 +121,11 @@ namespace qmapcontrol
*/
void
setZoom
(
int
zoomlevel
);
//! Sets the factor the offscreen image should be larger than the visible area
void
setOffscreenImageFactor
(
float
factor
);
//! Get the factor the offscreen image is larger than the screen
float
offscreenImageFactor
();
//! The Viewport of the display
/*!
* Returns the visible viewport in world coordinates
...
...
@@ -174,7 +179,7 @@ namespace qmapcontrol
private:
LayerManager
&
operator
=
(
const
LayerManager
&
rhs
);
LayerManager
(
const
LayerManager
&
old
);
//! This method ha
ve
to be invoked to draw a new offscreen image
//! This method ha
s
to be invoked to draw a new offscreen image
/*!
* @param clearImage if the current offscreeen image should be cleared
* @param showZoomImage if a zoom image should be painted
...
...
@@ -190,8 +195,9 @@ namespace qmapcontrol
QPoint
scroll
;
// scrollvalue of the offscreen image
QPoint
zoomImageScroll
;
// scrollvalue of the zoom image
QSize
size
;
// widget size
QSize
offSize
;
// size of the offscreen image
QSize
size
;
///< widget size
QSize
offSize
;
///< size of the offscreen image
float
offFactor
;
///< Size of the offscreen image
QPixmap
composedOffscreenImage
;
QPixmap
composedOffscreenImage2
;
...
...
lib/QMapControl/src/mapcontrol.cpp
View file @
35898750
...
...
@@ -23,6 +23,9 @@
*
*/
#include <QDialog>
#include <QDesktopServices>
#include "mapcontrol.h"
namespace
qmapcontrol
{
...
...
@@ -61,6 +64,29 @@ namespace qmapcontrol
return
layermanager
->
layer
(
layername
);
}
void
MapControl
::
setOffscreenImageFactor
(
double
factor
)
{
layermanager
->
setOffscreenImageFactor
(
factor
);
}
float
MapControl
::
offscreenImageFactor
()
{
return
layermanager
->
offscreenImageFactor
();
}
void
MapControl
::
openImageSaveDialog
()
{
QString
fileName
=
QFileDialog
::
getSaveFileName
(
this
,
tr
(
"Save Image as"
),
QDesktopServices
::
storageLocation
(
QDesktopServices
::
DesktopLocation
),
tr
(
"Image file (*.jpg *.png);;"
));
if
(
fileName
!=
""
)
{
if
(
!
fileName
.
contains
(
".png"
)
&&
!
fileName
.
contains
(
".jpg"
))
{
fileName
.
append
(
".png"
);
}
layermanager
->
getImage
().
save
(
fileName
,
fileName
.
split
(
"."
).
last
().
toUpper
().
toAscii
(),
95
);
}
}
QList
<
QString
>
MapControl
::
layers
()
const
{
return
layermanager
->
layers
();
...
...
lib/QMapControl/src/mapcontrol.h
View file @
35898750
...
...
@@ -92,6 +92,9 @@ namespace qmapcontrol
*/
Layer
*
layer
(
const
QString
&
layername
)
const
;
//! The factor the offscreen image is larger than the current viewport
float
offscreenImageFactor
();
//! returns the names of all layers
/*!
* @return returns a QList with the names of all layers
...
...
@@ -356,6 +359,12 @@ namespace qmapcontrol
*/
void
resize
(
const
QSize
newSize
);
//! Open a popup to save the current offscreen image to disk
void
openImageSaveDialog
();
//! Sets the factor the offscreen image should be larger than the visible area */
void
setOffscreenImageFactor
(
double
factor
);
private
slots
:
void
tick
();
void
loadingFinished
();
...
...
qgroundcontrol.pri
View file @
35898750
...
...
@@ -58,12 +58,18 @@ macx {
debug {
#QMAKE_CXXFLAGS += -finstrument-functions
#LIBS += -lSaturn
CONFIG += console
}
} else {
# x64 Mac OS X Snow Leopard 10.6 and later
CONFIG += x86_64 cocoa
CONFIG -= x86 phonon
message(Building for Mac OS X 64bit/Snow Leopard 10.6 and later)
debug {
#QMAKE_CXXFLAGS += -finstrument-functions
#LIBS += -lSaturn
CONFIG += console
}
}
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.5
...
...
@@ -154,12 +160,13 @@ linux-g++ {
debug {
DESTDIR = $$TARGETDIR/debug
CONFIG += debug
CONFIG += debug
console
}
release {
DESTDIR = $$TARGETDIR/release
DEFINES += QT_NO_DEBUG
CONFIG -= console
}
QMAKE_POST_LINK += cp -rf $$BASEDIR/audio $$DESTDIR/.
...
...
@@ -224,12 +231,13 @@ linux-g++-64 {
debug {
DESTDIR = $$TARGETDIR/debug
CONFIG += debug
CONFIG += debug
console
}
release {
DESTDIR = $$TARGETDIR/release
DEFINES += QT_NO_DEBUG
CONFIG -= console
}
QMAKE_POST_LINK += cp -rf $$BASEDIR/audio $$DESTDIR/.
...
...
qgroundcontrol.pro
View file @
35898750
...
...
@@ -39,7 +39,6 @@ BASEDIR = $$IN_PWD
TARGETDIR
=
$$
OUT_PWD
BUILDDIR
=
$$
TARGETDIR
/
build
LANGUAGE
=
C
++
CONFIG
+=
console
OBJECTS_DIR
=
$$
BUILDDIR
/
obj
MOC_DIR
=
$$
BUILDDIR
/
moc
UI_HEADERS_DIR
=
src
/
ui
/
generated
...
...
src/comm/MAVLinkProtocol.cc
View file @
35898750
...
...
@@ -109,7 +109,7 @@ void MAVLinkProtocol::receiveBytes(LinkInterface* link, QByteArray b)
// Log data
if
(
m_loggingEnabled
)
{
int
len
=
MAVLINK_MAX_PACKET_LEN
+
sizeof
(
quint64
);
const
int
len
=
MAVLINK_MAX_PACKET_LEN
+
sizeof
(
quint64
);
uint8_t
buf
[
len
];
quint64
time
=
QGC
::
groundTimeUsecs
();
memcpy
(
buf
,
(
void
*
)
&
time
,
sizeof
(
quint64
));
...
...
src/ui/MapWidget.cc
View file @
35898750
...
...
@@ -13,6 +13,7 @@
#include <QComboBox>
#include <QGridLayout>
#include <QDir>
#include <QDoubleSpinBox>
#include "QGC.h"
#include "MapWidget.h"
...
...
@@ -38,7 +39,7 @@ MapWidget::MapWidget(QWidget *parent) :
mc
=
new
qmapcontrol
::
MapControl
(
QSize
(
320
,
240
));
// VISUAL MAP STYLE
QString
buttonStyle
(
"QAbstractButton { background-color: rgba(20, 20, 20, 45%); border-color: rgba(10, 10, 10, 50%)}"
);
QString
buttonStyle
(
"QAbstractButton { background-color: rgba(20, 20, 20, 45%); border-color: rgba(10, 10, 10, 50%)}
QDoubleSpinBox { background-color: rgba(20, 20, 20, 45%); border-color: rgba(10, 10, 10, 50%)}
"
);
mc
->
setPen
(
QGC
::
colorCyan
.
darker
(
400
));
...
...
@@ -163,6 +164,19 @@ MapWidget::MapWidget(QWidget *parent) :
QPushButton
*
goToButton
=
new
QPushButton
(
QIcon
(
""
),
"T"
,
this
);
goToButton
->
setStyleSheet
(
buttonStyle
);
// SAVE FILES
QPushButton
*
saveButton
=
new
QPushButton
(
QIcon
(
""
),
"S"
,
this
);
saveButton
->
setStyleSheet
(
buttonStyle
);
// SET OFFSCREEN BUFFER SIZE
QDoubleSpinBox
*
offscreenSpinBox
=
new
QDoubleSpinBox
(
this
);
offscreenSpinBox
->
setStyleSheet
(
buttonStyle
);
offscreenSpinBox
->
setMinimum
(
2
);
offscreenSpinBox
->
setMaximum
(
30
);
offscreenSpinBox
->
setValue
(
mc
->
offscreenImageFactor
());
connect
(
offscreenSpinBox
,
SIGNAL
(
valueChanged
(
double
)),
mc
,
SLOT
(
setOffscreenImageFactor
(
double
)));
zoomin
->
setMaximumWidth
(
30
);
zoomout
->
setMaximumWidth
(
30
);
createPath
->
setMaximumWidth
(
30
);
...
...
@@ -188,8 +202,10 @@ MapWidget::MapWidget(QWidget *parent) :
// Add spacers to compress buttons on the top left
innerlayout
->
addItem
(
new
QSpacerItem
(
0
,
0
,
QSizePolicy
::
Expanding
,
QSizePolicy
::
Expanding
),
5
,
0
);
innerlayout
->
addItem
(
new
QSpacerItem
(
0
,
0
,
QSizePolicy
::
Expanding
,
QSizePolicy
::
Expanding
),
0
,
1
,
0
,
7
);
innerlayout
->
addWidget
(
mapButton
,
0
,
6
);
innerlayout
->
addWidget
(
goToButton
,
0
,
7
);
innerlayout
->
addWidget
(
mapButton
,
0
,
2
);
innerlayout
->
addWidget
(
goToButton
,
0
,
3
);
innerlayout
->
addWidget
(
saveButton
,
0
,
4
);
innerlayout
->
addWidget
(
offscreenSpinBox
,
0
,
5
);
innerlayout
->
setRowStretch
(
0
,
1
);
innerlayout
->
setRowStretch
(
1
,
100
);
mc
->
setLayout
(
innerlayout
);
...
...
@@ -204,6 +220,8 @@ MapWidget::MapWidget(QWidget *parent) :
connect
(
goToButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
goTo
()));
connect
(
saveButton
,
SIGNAL
(
clicked
()),
mc
,
SLOT
(
openImageSaveDialog
()));
QList
<
UASInterface
*>
systems
=
UASManager
::
instance
()
->
getUASList
();
foreach
(
UASInterface
*
system
,
systems
)
{
...
...
@@ -248,6 +266,8 @@ MapWidget::MapWidget(QWidget *parent) :
drawCamBorder
=
false
;
radioCamera
=
10
;
//mc->setOffscreenImageFactor(15);
}
void
MapWidget
::
goTo
()
...
...
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