Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
libstage
vis_strip.cc
Go to the documentation of this file.
1
/* Strip plot visualizer
2
* Richard Vaughan 30 March 2009
3
*/
4
5
#include "
stage.hh
"
6
#include "
canvas.hh
"
7
using namespace
Stg
;
8
9
StripPlotVis::StripPlotVis
(
float
x,
float
y,
float
w,
float
h,
10
size_t
len,
11
Color
fgcolor,
Color
bgcolor,
12
const
char
* name,
const
char
* wfname )
13
:
Visualizer
( name, wfname ),
14
data( new float[len] ),
15
len(len),
16
count(0),
17
x(x),
18
y(y),
19
w(w),
20
h(h),
21
min(1e32),
22
max(-1e32),
23
fgcolor(fgcolor),
24
bgcolor(bgcolor)
25
{
26
// zero the data
27
memset(
data
, 0, len *
sizeof
(
float
) );
28
}
29
30
StripPlotVis::~StripPlotVis
()
31
{
32
if
(
data
)
33
free(
data
);
34
}
35
36
void
StripPlotVis::Visualize
(
Model
*
mod
,
Camera
* cam )
37
{
38
Canvas
* canvas =
dynamic_cast<
WorldGui
*
>
(mod->
GetWorld
())->GetCanvas();
39
40
if
( ! canvas->
selected
( mod ) )
// == canvas->SelectedVisualizeAll() )
41
return
;
42
43
canvas->
EnterScreenCS
();
44
45
mod->
PushColor
(
bgcolor
);
46
glRectf(
x
,
y
,
w
,
h
);
47
mod->
PopColor
();
48
49
mod->
PushColor
(
fgcolor
);
50
Gl::draw_array
(
x
,
y
,
w
,
h
,
data
,
len
,
count
%
len
,
min
,
max
);
51
mod->
PopColor
();
52
53
canvas->
LeaveScreenCS
();
54
}
55
56
void
StripPlotVis::AppendValue
(
float
value )
57
{
58
data
[
count
%
len
] = value;
59
count
++;
60
61
min
= std::min( value,
min
);
62
max
= std::max( value,
max
);
63
}
Stg::Model::PushColor
virtual void PushColor(Color col)
Definition:
stage.hh:2189
Stg::Model
Model class
Definition:
stage.hh:1742
Stg::StripPlotVis::StripPlotVis
StripPlotVis(float x, float y, float w, float h, size_t len, Color fgcolor, Color bgcolor, const char *name, const char *wfname)
Definition:
vis_strip.cc:9
Stg::StripPlotVis::bgcolor
Color bgcolor
Definition:
stage.hh:1615
Stg::StripPlotVis::y
float y
Definition:
stage.hh:1614
Stg
The Stage library uses its own namespace.
Definition:
canvas.hh:8
Stg::Canvas::EnterScreenCS
void EnterScreenCS()
Definition:
canvas.cc:1087
Stg::StripPlotVis::len
size_t len
Definition:
stage.hh:1611
Stg::StripPlotVis::w
float w
Definition:
stage.hh:1614
stage.hh
Stg::StripPlotVis::h
float h
Definition:
stage.hh:1614
Stg::StripPlotVis::data
float * data
Definition:
stage.hh:1610
Stg::Model::PopColor
virtual void PopColor()
Definition:
stage.hh:2191
Stg::Model::GetWorld
World * GetWorld() const
Definition:
stage.hh:2302
Stg::Gl::draw_array
void draw_array(float x, float y, float w, float h, float *data, size_t len, size_t offset, float min, float max)
Definition:
gl.cc:24
Stg::StripPlotVis::max
float max
Definition:
stage.hh:1614
Stg::StripPlotVis::mod
Model * mod
Definition:
stage.hh:1609
Stg::StripPlotVis::~StripPlotVis
virtual ~StripPlotVis()
Definition:
vis_strip.cc:30
Stg::WorldGui
Definition:
stage.hh:1498
Stg::StripPlotVis::min
float min
Definition:
stage.hh:1614
Stg::StripPlotVis::x
float x
Definition:
stage.hh:1614
Stg::Canvas::LeaveScreenCS
void LeaveScreenCS()
Definition:
canvas.cc:1101
Stg::Color
Definition:
stage.hh:197
Stg::StripPlotVis::fgcolor
Color fgcolor
Definition:
stage.hh:1615
Stg::Visualizer
Definition:
stage.hh:546
canvas.hh
Stg::Camera
Definition:
stage.hh:1364
Stg::StripPlotVis::AppendValue
void AppendValue(float value)
Definition:
vis_strip.cc:56
Stg::StripPlotVis::count
size_t count
Definition:
stage.hh:1612
Stg::Canvas
Definition:
canvas.hh:10
Stg::StripPlotVis::Visualize
virtual void Visualize(Model *mod, Camera *cam)
Definition:
vis_strip.cc:36
Stg::Canvas::selected
bool selected(Model *mod)
Definition:
canvas.cc:296
stage
Author(s): Richard Vaughan
, Brian Gerkey
, Reed Hedges
, Andrew Howard
, Toby Collett
, Pooya Karimian
, Jeremy Asher
, Alex Couture-Beil
, Geoff Biggs
, Rich Mattes
, Abbas Sadat
autogenerated on Mon Jun 10 2019 15:06:10