#include #include #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" /** * Auxiliary data structure for line. */ struct JText { /** * Read text from input stream. * * \param in input stream * \param text text * \return input stream */ friend inline std::istream& operator>>(std::istream& in, JText& text) { in >> text.x1 >> text.y1; return getline(in, text.text); } /** * Write text to output stream. * * \param out output stream * \param text text * \return output stream */ friend inline std::ostream& operator<<(std::ostream& out, const JText& text) { return out << text.x1 << ' ' << text.y1 << ' ' << text.text; } double x1; double y1; std::string text; }; /** * \file * Auxiliary program to create TText. * \author mdejong */ int main(int argc, char **argv) { using namespace std; using namespace JPP; typedef JContainer< vector > JParameters_t; string outputFile; JParameters_t parameters; Short_t align = 22; Float_t angle = 0.0; Color_t color = kBlack; Font_t font = 43; Float_t size = 40; int debug; try { JProperties properties; properties.insert(gmake_property(align)); properties.insert(gmake_property(angle)); properties.insert(gmake_property(color)); properties.insert(gmake_property(font)); properties.insert(gmake_property(size)); JParser<> zap("Auxiliary program to create TText."); zap['o'] = make_field(outputFile); zap['p'] = make_field(parameters, "x1 y1 text"); zap['@'] = make_field(properties, "text attributes") = JPARSER::initialised(); zap['d'] = make_field(debug) = 1; zap(argc, argv); } catch(const exception &error) { FATAL(error.what() << endl); } TFile out(outputFile.c_str(), "recreate"); for (size_t i = 0; i != parameters.size(); ++i) { TText* p = new TText(parameters[i].x1, parameters[i].y1, parameters[i].text.c_str()); p->SetTextAlign(align); p->SetTextAngle(angle); p->SetTextColor(color); p->SetTextFont (font); p->SetTextSize (size); out.WriteTObject(p); } out.Write(); out.Close(); }