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
c1543339
Commit
c1543339
authored
Mar 08, 2012
by
Lionel Heng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Color obstacle cells based on height for more intuitive visualization.
parent
efc09fbf
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
1 deletion
+26
-1
ObstacleGroupNode.cc
src/ui/map3D/ObstacleGroupNode.cc
+26
-1
No files found.
src/ui/map3D/ObstacleGroupNode.cc
View file @
c1543339
...
...
@@ -31,9 +31,11 @@ This file is part of the QGROUNDCONTROL project
#include "ObstacleGroupNode.h"
#include <limits>
#include <osg/PositionAttitudeTransform>
#include <osg/ShapeDrawable>
#include "gpl.h"
#include "Imagery.h"
ObstacleGroupNode
::
ObstacleGroupNode
()
...
...
@@ -64,6 +66,25 @@ ObstacleGroupNode::update(double robotX, double robotY, double robotZ,
osg
::
ref_ptr
<
osg
::
Geode
>
geode
=
new
osg
::
Geode
;
// find minimum and maximum height
float
zMin
=
std
::
numeric_limits
<
float
>::
max
();
float
zMax
=
std
::
numeric_limits
<
float
>::
min
();
for
(
int
i
=
0
;
i
<
obstacleList
.
obstacles_size
();
++
i
)
{
const
px
::
Obstacle
&
obs
=
obstacleList
.
obstacles
(
i
);
float
z
=
robotZ
-
obs
.
z
();
if
(
zMin
>
z
)
{
zMin
=
z
;
}
if
(
zMax
<
z
)
{
zMax
=
z
;
}
}
for
(
int
i
=
0
;
i
<
obstacleList
.
obstacles_size
();
++
i
)
{
const
px
::
Obstacle
&
obs
=
obstacleList
.
obstacles
(
i
);
...
...
@@ -74,8 +95,12 @@ ObstacleGroupNode::update(double robotX, double robotY, double robotZ,
new
osg
::
Box
(
obsPos
,
obs
.
width
(),
obs
.
width
(),
obs
.
height
());
osg
::
ref_ptr
<
osg
::
ShapeDrawable
>
sd
=
new
osg
::
ShapeDrawable
(
box
);
int
idx
=
(
obsPos
.
z
()
-
zMin
)
/
(
zMax
-
zMin
)
*
127.0
f
;
float
r
,
g
,
b
;
qgc
::
colormap
(
"jet"
,
idx
,
r
,
g
,
b
);
sd
->
getOrCreateStateSet
()
->
setMode
(
GL_BLEND
,
osg
::
StateAttribute
::
ON
);
sd
->
setColor
(
osg
::
Vec4
(
0.0
f
,
0.0
f
,
1.0
f
,
1.0
f
));
sd
->
setColor
(
osg
::
Vec4
(
r
,
g
,
b
,
1.0
f
));
geode
->
addDrawable
(
sd
);
}
...
...
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