Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
reps
AverageTextRep.cxx
Go to the documentation of this file.
1
12
#include "
AverageTextRep.h
"
13
14
#include "
graphics/ViewBase.h
"
15
#include "
pattern/string_convert.h
"
16
#include "
projectors/NTupleProjector.h
"
17
18
using namespace
hippodraw;
19
20
using
std::string;
21
22
AverageTextRep::AverageTextRep
( )
23
:
TextRepBase
(
"averagex"
)
24
{
25
m_axis
=
Axes::X
;
26
}
27
28
AverageTextRep::
29
AverageTextRep
(
hippodraw::Axes::Type
axis )
30
:
TextRepBase
(
"averagex"
)
31
{
32
m_axis
= axis;
33
if
( axis ==
Axes::Y
)
m_name
=
"averagey"
;
34
}
35
36
AverageTextRep::AverageTextRep
(
const
AverageTextRep
& rep )
37
:
TextRepBase
( rep )
38
{
39
m_axis
= rep.
m_axis
;
40
}
41
42
/* virtual */
43
RepBase
*
AverageTextRep::clone
()
44
{
45
return
new
AverageTextRep
( *
this
);
46
}
47
48
void
49
AverageTextRep::
50
drawProjectedValues
(
ProjectorBase
& projector,
51
ViewBase
& view )
52
53
{
54
double
average = projector.
getAverage
(
m_axis
);
55
56
string
text (
"average "
);
57
58
if
(
m_axis
==
Axes::X
) {
59
text +=
"X"
;
60
}
61
if
(
m_axis
==
Axes::Y
) {
62
text +=
"Y"
;
63
}
64
text +=
"-value "
;
65
text +=
String::convert
( average );
66
67
view.
drawText
( text, 5, 10,
m_size
, 0,
'l'
,
't'
,
true
, 0, &
m_color
);
68
}
Generated for HippoDraw Class Library by