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
7ece95e3
Commit
7ece95e3
authored
Jan 13, 2012
by
hengli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed module display issues in 3D widgets.
parent
5b27576f
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
48 additions
and
34 deletions
+48
-34
HUDScaleGeode.cc
src/ui/map3D/HUDScaleGeode.cc
+2
-2
HUDScaleGeode.h
src/ui/map3D/HUDScaleGeode.h
+1
-1
ImageWindowGeode.cc
src/ui/map3D/ImageWindowGeode.cc
+10
-4
ImageWindowGeode.h
src/ui/map3D/ImageWindowGeode.h
+4
-2
Pixhawk3DWidget.cc
src/ui/map3D/Pixhawk3DWidget.cc
+30
-25
Pixhawk3DWidget.h
src/ui/map3D/Pixhawk3DWidget.h
+1
-0
No files found.
src/ui/map3D/HUDScaleGeode.cc
View file @
7ece95e3
...
@@ -40,7 +40,7 @@ HUDScaleGeode::HUDScaleGeode()
...
@@ -40,7 +40,7 @@ HUDScaleGeode::HUDScaleGeode()
}
}
void
void
HUDScaleGeode
::
init
(
void
)
HUDScaleGeode
::
init
(
osg
::
ref_ptr
<
osgText
::
Font
>&
font
)
{
{
osg
::
ref_ptr
<
osg
::
Vec2Array
>
outlineVertices
(
new
osg
::
Vec2Array
);
osg
::
ref_ptr
<
osg
::
Vec2Array
>
outlineVertices
(
new
osg
::
Vec2Array
);
outlineVertices
->
push_back
(
osg
::
Vec2
(
20.0
f
,
50.0
f
));
outlineVertices
->
push_back
(
osg
::
Vec2
(
20.0
f
,
50.0
f
));
...
@@ -96,7 +96,7 @@ HUDScaleGeode::init(void)
...
@@ -96,7 +96,7 @@ HUDScaleGeode::init(void)
text
=
new
osgText
::
Text
;
text
=
new
osgText
::
Text
;
text
->
setCharacterSize
(
11
);
text
->
setCharacterSize
(
11
);
text
->
setFont
(
"images/Vera.ttf"
);
text
->
setFont
(
font
);
text
->
setAxisAlignment
(
osgText
::
Text
::
SCREEN
);
text
->
setAxisAlignment
(
osgText
::
Text
::
SCREEN
);
text
->
setColor
(
osg
::
Vec4
(
1.0
f
,
1.0
f
,
1.0
f
,
1.0
f
));
text
->
setColor
(
osg
::
Vec4
(
1.0
f
,
1.0
f
,
1.0
f
,
1.0
f
));
text
->
setPosition
(
osg
::
Vec3
(
40.0
f
,
45.0
f
,
-
1.5
f
));
text
->
setPosition
(
osg
::
Vec3
(
40.0
f
,
45.0
f
,
-
1.5
f
));
...
...
src/ui/map3D/HUDScaleGeode.h
View file @
7ece95e3
...
@@ -41,7 +41,7 @@ class HUDScaleGeode : public osg::Geode
...
@@ -41,7 +41,7 @@ class HUDScaleGeode : public osg::Geode
public:
public:
HUDScaleGeode
();
HUDScaleGeode
();
void
init
(
void
);
void
init
(
osg
::
ref_ptr
<
osgText
::
Font
>&
font
);
void
update
(
int
windowHeight
,
float
cameraFov
,
float
cameraDistance
,
void
update
(
int
windowHeight
,
float
cameraFov
,
float
cameraDistance
,
bool
darkBackground
);
bool
darkBackground
);
...
...
src/ui/map3D/ImageWindowGeode.cc
View file @
7ece95e3
...
@@ -31,11 +31,17 @@
...
@@ -31,11 +31,17 @@
#include "ImageWindowGeode.h"
#include "ImageWindowGeode.h"
ImageWindowGeode
::
ImageWindowGeode
(
const
QString
&
caption
,
ImageWindowGeode
::
ImageWindowGeode
()
const
osg
::
Vec4
&
backgroundColor
,
osg
::
ref_ptr
<
osg
::
Image
>&
image
)
:
border
(
5
)
:
border
(
5
)
{
{
}
void
ImageWindowGeode
::
init
(
const
QString
&
caption
,
const
osg
::
Vec4
&
backgroundColor
,
osg
::
ref_ptr
<
osg
::
Image
>&
image
,
osg
::
ref_ptr
<
osgText
::
Font
>&
font
)
{
// image
// image
osg
::
ref_ptr
<
osg
::
Geometry
>
imageGeometry
=
new
osg
::
Geometry
;
osg
::
ref_ptr
<
osg
::
Geometry
>
imageGeometry
=
new
osg
::
Geometry
;
imageVertices
=
new
osg
::
Vec3Array
(
4
);
imageVertices
=
new
osg
::
Vec3Array
(
4
);
...
@@ -82,7 +88,7 @@ ImageWindowGeode::ImageWindowGeode(const QString& caption,
...
@@ -82,7 +88,7 @@ ImageWindowGeode::ImageWindowGeode(const QString& caption,
text
=
new
osgText
::
Text
;
text
=
new
osgText
::
Text
;
text
->
setText
(
caption
.
toStdString
().
c_str
());
text
->
setText
(
caption
.
toStdString
().
c_str
());
text
->
setCharacterSize
(
11
);
text
->
setCharacterSize
(
11
);
text
->
setFont
(
"images/Vera.ttf"
);
text
->
setFont
(
font
);
text
->
setAxisAlignment
(
osgText
::
Text
::
SCREEN
);
text
->
setAxisAlignment
(
osgText
::
Text
::
SCREEN
);
text
->
setColor
(
osg
::
Vec4
(
1.0
f
,
1.0
f
,
1.0
f
,
1.0
f
));
text
->
setColor
(
osg
::
Vec4
(
1.0
f
,
1.0
f
,
1.0
f
,
1.0
f
));
...
...
src/ui/map3D/ImageWindowGeode.h
View file @
7ece95e3
...
@@ -40,8 +40,10 @@
...
@@ -40,8 +40,10 @@
class
ImageWindowGeode
:
public
osg
::
Geode
class
ImageWindowGeode
:
public
osg
::
Geode
{
{
public:
public:
ImageWindowGeode
(
const
QString
&
caption
,
const
osg
::
Vec4
&
backgroundColor
,
ImageWindowGeode
();
osg
::
ref_ptr
<
osg
::
Image
>&
image
);
void
init
(
const
QString
&
caption
,
const
osg
::
Vec4
&
backgroundColor
,
osg
::
ref_ptr
<
osg
::
Image
>&
image
,
osg
::
ref_ptr
<
osgText
::
Font
>&
font
);
void
setAttributes
(
int
x
,
int
y
,
int
width
,
int
height
);
void
setAttributes
(
int
x
,
int
y
,
int
width
,
int
height
);
...
...
src/ui/map3D/Pixhawk3DWidget.cc
View file @
7ece95e3
...
@@ -114,6 +114,8 @@ Pixhawk3DWidget::Pixhawk3DWidget(QWidget* parent)
...
@@ -114,6 +114,8 @@ Pixhawk3DWidget::Pixhawk3DWidget(QWidget* parent)
buildLayout
();
buildLayout
();
updateHUD
(
0.0
,
0.0
,
0.0
,
0.0
,
0.0
,
0.0
,
"132N"
);
connect
(
UASManager
::
instance
(),
SIGNAL
(
activeUASSet
(
UASInterface
*
)),
connect
(
UASManager
::
instance
(),
SIGNAL
(
activeUASSet
(
UASInterface
*
)),
this
,
SLOT
(
setActiveUAS
(
UASInterface
*
)));
this
,
SLOT
(
setActiveUAS
(
UASInterface
*
)));
}
}
...
@@ -567,9 +569,30 @@ Pixhawk3DWidget::buildLayout(void)
...
@@ -567,9 +569,30 @@ Pixhawk3DWidget::buildLayout(void)
this
,
SLOT
(
toggleFollowCamera
(
int
)));
this
,
SLOT
(
toggleFollowCamera
(
int
)));
}
}
void
Pixhawk3DWidget
::
resizeGL
(
int
width
,
int
height
)
{
Q3DWidget
::
resizeGL
(
width
,
height
);
resizeHUD
();
}
void
void
Pixhawk3DWidget
::
display
(
void
)
Pixhawk3DWidget
::
display
(
void
)
{
{
// set node visibility
rollingMap
->
setChildValue
(
gridNode
,
displayGrid
);
rollingMap
->
setChildValue
(
trailNode
,
displayTrail
);
rollingMap
->
setChildValue
(
mapNode
,
displayImagery
);
rollingMap
->
setChildValue
(
waypointGroupNode
,
displayWaypoints
);
rollingMap
->
setChildValue
(
targetNode
,
enableTarget
);
#ifdef QGC_PROTOBUF_ENABLED
rollingMap
->
setChildValue
(
obstacleGroupNode
,
displayObstacleList
);
#endif
rollingMap
->
setChildValue
(
rgbd3DNode
,
displayRGBD3D
);
hudGroup
->
setChildValue
(
rgb2DGeode
,
displayRGBD2D
);
hudGroup
->
setChildValue
(
depth2DGeode
,
displayRGBD2D
);
if
(
!
uas
)
if
(
!
uas
)
{
{
return
;
return
;
...
@@ -636,20 +659,6 @@ Pixhawk3DWidget::display(void)
...
@@ -636,20 +659,6 @@ Pixhawk3DWidget::display(void)
updateHUD
(
robotX
,
robotY
,
robotZ
,
robotRoll
,
robotPitch
,
robotYaw
,
utmZone
);
updateHUD
(
robotX
,
robotY
,
robotZ
,
robotRoll
,
robotPitch
,
robotYaw
,
utmZone
);
// set node visibility
rollingMap
->
setChildValue
(
gridNode
,
displayGrid
);
rollingMap
->
setChildValue
(
trailNode
,
displayTrail
);
rollingMap
->
setChildValue
(
mapNode
,
displayImagery
);
rollingMap
->
setChildValue
(
waypointGroupNode
,
displayWaypoints
);
rollingMap
->
setChildValue
(
targetNode
,
enableTarget
);
#ifdef QGC_PROTOBUF_ENABLED
rollingMap
->
setChildValue
(
obstacleGroupNode
,
displayObstacleList
);
#endif
rollingMap
->
setChildValue
(
rgbd3DNode
,
displayRGBD3D
);
hudGroup
->
setChildValue
(
rgb2DGeode
,
displayRGBD2D
);
hudGroup
->
setChildValue
(
depth2DGeode
,
displayRGBD2D
);
lastRobotX
=
robotX
;
lastRobotX
=
robotX
;
lastRobotY
=
robotY
;
lastRobotY
=
robotY
;
lastRobotZ
=
robotZ
;
lastRobotZ
=
robotZ
;
...
@@ -952,27 +961,25 @@ Pixhawk3DWidget::setupHUD(void)
...
@@ -952,27 +961,25 @@ Pixhawk3DWidget::setupHUD(void)
statusText
->
setAxisAlignment
(
osgText
::
Text
::
SCREEN
);
statusText
->
setAxisAlignment
(
osgText
::
Text
::
SCREEN
);
statusText
->
setColor
(
osg
::
Vec4
(
255
,
255
,
255
,
1
));
statusText
->
setColor
(
osg
::
Vec4
(
255
,
255
,
255
,
1
));
resizeHUD
();
osg
::
ref_ptr
<
osg
::
Geode
>
statusGeode
=
new
osg
::
Geode
;
osg
::
ref_ptr
<
osg
::
Geode
>
statusGeode
=
new
osg
::
Geode
;
statusGeode
->
addDrawable
(
hudBackgroundGeometry
);
statusGeode
->
addDrawable
(
hudBackgroundGeometry
);
statusGeode
->
addDrawable
(
statusText
);
statusGeode
->
addDrawable
(
statusText
);
hudGroup
->
addChild
(
statusGeode
);
hudGroup
->
addChild
(
statusGeode
);
rgbImage
=
new
osg
::
Image
;
rgbImage
=
new
osg
::
Image
;
rgb2DGeode
=
new
ImageWindowGeode
(
"RGB Image"
,
rgb2DGeode
=
new
ImageWindowGeode
;
osg
::
Vec4
(
0.0
f
,
0.0
f
,
0.1
f
,
1.0
f
),
rgb2DGeode
->
init
(
"RGB Image"
,
osg
::
Vec4
(
0.0
f
,
0.0
f
,
0.1
f
,
1.0
f
),
rgbImage
);
rgbImage
,
font
);
hudGroup
->
addChild
(
rgb2DGeode
);
hudGroup
->
addChild
(
rgb2DGeode
);
depthImage
=
new
osg
::
Image
;
depthImage
=
new
osg
::
Image
;
depth2DGeode
=
new
ImageWindowGeode
(
"Depth Image"
,
depth2DGeode
=
new
ImageWindowGeode
;
osg
::
Vec4
(
0.0
f
,
0.0
f
,
0.1
f
,
1.0
f
),
depth2DGeode
->
init
(
"Depth Image"
,
osg
::
Vec4
(
0.0
f
,
0.0
f
,
0.1
f
,
1.0
f
),
depthImage
);
depthImage
,
font
);
hudGroup
->
addChild
(
depth2DGeode
);
hudGroup
->
addChild
(
depth2DGeode
);
scaleGeode
=
new
HUDScaleGeode
;
scaleGeode
=
new
HUDScaleGeode
;
scaleGeode
->
init
();
scaleGeode
->
init
(
font
);
hudGroup
->
addChild
(
scaleGeode
);
hudGroup
->
addChild
(
scaleGeode
);
}
}
...
@@ -1018,8 +1025,6 @@ Pixhawk3DWidget::updateHUD(double robotX, double robotY, double robotZ,
...
@@ -1018,8 +1025,6 @@ Pixhawk3DWidget::updateHUD(double robotX, double robotY, double robotZ,
double
robotRoll
,
double
robotPitch
,
double
robotYaw
,
double
robotRoll
,
double
robotPitch
,
double
robotYaw
,
const
QString
&
utmZone
)
const
QString
&
utmZone
)
{
{
resizeHUD
();
std
::
pair
<
double
,
double
>
cursorPosition
=
std
::
pair
<
double
,
double
>
cursorPosition
=
getGlobalCursorPosition
(
getMouseX
(),
getMouseY
(),
-
robotZ
);
getGlobalCursorPosition
(
getMouseX
(),
getMouseY
(),
-
robotZ
);
...
...
src/ui/map3D/Pixhawk3DWidget.h
View file @
7ece95e3
...
@@ -81,6 +81,7 @@ private slots:
...
@@ -81,6 +81,7 @@ private slots:
protected:
protected:
QVector
<
osg
::
ref_ptr
<
osg
::
Node
>
>
findVehicleModels
(
void
);
QVector
<
osg
::
ref_ptr
<
osg
::
Node
>
>
findVehicleModels
(
void
);
void
buildLayout
(
void
);
void
buildLayout
(
void
);
virtual
void
resizeGL
(
int
width
,
int
height
);
virtual
void
display
(
void
);
virtual
void
display
(
void
);
virtual
void
keyPressEvent
(
QKeyEvent
*
event
);
virtual
void
keyPressEvent
(
QKeyEvent
*
event
);
virtual
void
mousePressEvent
(
QMouseEvent
*
event
);
virtual
void
mousePressEvent
(
QMouseEvent
*
event
);
...
...
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