Jpp 19.3.0-rc.3
the software that should make you happy
Loading...
Searching...
No Matches
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

◆ main()

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}
string outputFile
#define FATAL(A)
Definition JMessage.hh:67
int debug
debug level
Definition JSirene.cc:72
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition JParser.hh:2142
#define gmake_property(A)
macros to convert (template) parameter to JPropertiesElement object
Utility class to parse parameter values.
Utility class to parse command line options.
Definition JParser.hh:1698
char text[TEXT_SIZE]
Definition elog.cc:72
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary wrapper for I/O of container with optional comment (see JComment).
Definition JContainer.hh:42
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Definition JParser.hh:68