Jpp  18.2.0-rc.1
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Functions
JText.cc File Reference

Auxiliary program to create TText. More...

#include <string>
#include <iostream>
#include "TROOT.h"
#include "TFile.h"
#include "TText.h"
#include "Jeep/JContainer.hh"
#include "Jeep/JProperties.hh"
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"

Go to the source code of this file.

Classes

struct  JText
 Auxiliary data structure for line. More...
 

Functions

int main (int argc, char **argv)
 

Detailed Description

Auxiliary program to create TText.

Author
mdejong

Definition in file JText.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 56 of file JText.cc.

57 {
58  using namespace std;
59  using namespace JPP;
60 
61  typedef JContainer< vector<JText> > JParameters_t;
62 
63  string outputFile;
64  JParameters_t parameters;
65  Short_t align = 22;
66  Float_t angle = 0.0;
67  Color_t color = kBlack;
68  Font_t font = 43;
69  Float_t size = 40;
70  int debug;
71 
72  try {
73 
74  JProperties properties;
75 
76  properties.insert(gmake_property(align));
77  properties.insert(gmake_property(angle));
78  properties.insert(gmake_property(color));
79  properties.insert(gmake_property(font));
80  properties.insert(gmake_property(size));
81 
82  JParser<> zap("Auxiliary program to create TText.");
83 
84  zap['o'] = make_field(outputFile);
85  zap['p'] = make_field(parameters, "x1 y1 text");
86  zap['@'] = make_field(properties, "text attributes") = JPARSER::initialised();
87  zap['d'] = make_field(debug) = 1;
88 
89  zap(argc, argv);
90  }
91  catch(const exception &error) {
92  FATAL(error.what() << endl);
93  }
94 
95 
96  TFile out(outputFile.c_str(), "recreate");
97 
98  for (size_t i = 0; i != parameters.size(); ++i) {
99 
100  TText* p = new TText(parameters[i].x1, parameters[i].y1, parameters[i].text.c_str());
101 
102  p->SetTextAlign(align);
103  p->SetTextAngle(angle);
104  p->SetTextColor(color);
105  p->SetTextFont (font);
106  p->SetTextSize (size);
107 
108  out.WriteTObject(p);
109  }
110 
111  out.Write();
112  out.Close();
113 }
Utility class to parse command line options.
Definition: JParser.hh:1514
char text[TEXT_SIZE]
Definition: elog.cc:72
#define gmake_property(A)
macros to convert (template) parameter to JPropertiesElement object
Utility class to parse parameter values.
Definition: JProperties.hh:497
*fatal Wrong number of arguments esac JCookie sh typeset Z DETECTOR typeset Z SOURCE_RUN typeset Z TARGET_RUN set_variable PARAMETERS_FILE $WORKDIR parameters
Definition: diff-Tuna.sh:38
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Definition: JParser.hh:83
string outputFile
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1989
#define FATAL(A)
Definition: JMessage.hh:67
int debug
debug level