Index: appl-conv/trunk/src/DrawLabel.h =================================================================== --- appl-conv/trunk/src/DrawLabel.h (revision 0) +++ appl-conv/trunk/src/DrawLabel.h (revision 1830) @@ -0,0 +1,78 @@ +// emacs: this is -*- c++ -*- +// +// @file DrawLabel.h +// +// +// +// Copyright (C) 2012 M.Sutton (sutt@cern.ch) +// +// $Id: DrawLabel.h, v0.0 Sun 11 Nov 2012 01:18:14 GMT sutt $ + + +#ifndef DRAWLABEL_H +#define DRAWLABEL_H + +#include +#include + +#include "TLatex.h" + +#include "label.h" + +class DrawLabel { + +public: + + DrawLabel(double x, double y, const std::string& s, int colour=kBlack, double size=0.033, bool NDC=true, int _font=42 ) : + m_text(s), m_colour(colour), m_font(_font), m_x(x), m_y(y), m_size(size) + { + // std::cout << "DrawLabel::DrawLabel() " << m_text << std::endl; + Draw(NDC); + } + + virtual ~DrawLabel() { } + + void Draw(bool NDC=true) const { + TLatex* tt = new TLatex(); + if ( NDC ) tt->SetNDC(); + tt->SetTextFont(m_font); + tt->SetTextColor(m_colour); + tt->SetTextSize(m_size); + tt->DrawLatex(m_x, m_y, m_text.c_str() ); + } + + std::string& text() { return m_text; } + std::string text() const { return m_text; } + void font( int f ) { m_font = f; } + +private: + + std::string m_text; + int m_colour; + + int m_font; + + double m_x; + double m_y; + + + double m_size; + +}; + +inline std::ostream& operator<<( std::ostream& s, const DrawLabel& _d ) { + return s << _d.text(); +} + + +#endif // DRAWLABEL_H + + + + + + + + + +