ATLAS Offline Software
DrawLabel.h
Go to the documentation of this file.
1 /* emacs: this is -*- c++ -*- */
12 #ifndef DRAWLABEL_H
13 #define DRAWLABEL_H
14 
15 #include <iostream>
16 #include <string>
17 
18 #include "TLatex.h"
19 
20 
21 
22 class DrawLabel {
23 
24 public:
25 
26  DrawLabel(double x, double y, const std::string& s, int colour=kBlack, double size=0.033, double font=42 ) :
28  {
29  // std::cout << "DrawLabel::DrawLabel() " << m_text << std::endl;
30  Draw();
31  }
32 
33  virtual ~DrawLabel() { }
34 
35  void Draw() const {
36  TLatex* tt = new TLatex();
37  tt->SetNDC();
38  tt->SetTextColor(m_colour);
39  tt->SetTextSize(m_size);
40  tt->SetTextFont(m_font);
41  tt->DrawLatex(m_x, m_y, m_text.c_str() );
42  }
43 
44  std::string& text() { return m_text; }
45  std::string text() const { return m_text; }
46 
47 private:
48 
49  std::string m_text;
50  int m_colour;
51  int m_font;
52 
53  double m_x;
54  double m_y;
55 
56  double m_size;
57 
58 };
59 
60 inline std::ostream& operator<<( std::ostream& s, const DrawLabel& d ) {
61  return s << d.text();
62 }
63 
64 
65 #endif // DRAWLABEL_H
66 
67 
68 
69 
70 
71 
72 
73 
74 
75 
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
DrawLabel::DrawLabel
DrawLabel(double x, double y, const std::string &s, int colour=kBlack, double size=0.033, double font=42)
Definition: DrawLabel.h:26
operator<<
std::ostream & operator<<(std::ostream &s, const DrawLabel &d)
Definition: DrawLabel.h:60
hist_file_dump.d
d
Definition: hist_file_dump.py:137
DrawLabel::text
std::string text() const
Definition: DrawLabel.h:45
DrawLabel::text
std::string & text()
Definition: DrawLabel.h:44
x
#define x
DrawLabel::~DrawLabel
virtual ~DrawLabel()
Definition: DrawLabel.h:33
DrawLabel::m_text
std::string m_text
Definition: DrawLabel.h:49
DrawLabel::m_colour
int m_colour
Definition: DrawLabel.h:50
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
DrawLabel::m_size
double m_size
Definition: DrawLabel.h:56
DrawLabel::Draw
void Draw() const
Definition: DrawLabel.h:35
DrawLabel::m_y
double m_y
Definition: DrawLabel.h:54
DrawLabel::m_font
int m_font
Definition: DrawLabel.h:51
DrawLabel
Definition: DrawLabel.h:22
python.DetStatusLib.colour
def colour(code)
Definition: DetStatusLib.py:15
y
#define y
plotBeamSpotMon.font
font
Definition: plotBeamSpotMon.py:80
DrawLabel::m_x
double m_x
Definition: DrawLabel.h:53
TileDCSDataPlotter.tt
tt
Definition: TileDCSDataPlotter.py:874