g4tools  5.4.0
plotter_style
Go to the documentation of this file.
1 // Copyright (C) 2010, Guy Barrand. All rights reserved.
2 // See the file tools.license for terms.
3 
4 #ifndef tools_sg_plotter_style
5 #define tools_sg_plotter_style
6 
7 #include "../xml/styles"
8 
9 #include "plotter"
10 
11 namespace tools {
12 namespace sg {
13 
14 inline void style_from_res(const xml::styles& a_styles,const std::string& a_path,axis& a_axis,bool a_verbose) {
15  {typedef xml::styles::style_t style_t;
16  const style_t* style = a_styles.find_style(a_path);
17  if(style){
18  a_axis.set_from_style(a_styles.out(),*style);
19  } else {
20  if(a_verbose) {
21  a_styles.out() << "tools::sg::style_from_res(axis) :"
22  << " style " << sout(a_path) << " not found."
23  << std::endl;
24  }
25  }}
26 
27  a_styles.res_sg_style<line_style>(a_path+".line_style",a_axis.line_style());
28  a_styles.res_sg_style<line_style>(a_path+".ticks_style",a_axis.ticks_style());
29  a_styles.res_sg_style<text_style>(a_path+".labels_style",a_axis.labels_style());
30  a_styles.res_sg_style<text_style>(a_path+".mag_style",a_axis.mag_style());
31  a_styles.res_sg_style<text_style>(a_path+".title_style",a_axis.title_style());
32 }
33 
34 inline void style_from_res(const xml::styles& a_styles,const std::string& a_path,plotter& a_plotter,bool a_verbose) {
35  //sg::fields of plotter :
36  {typedef xml::styles::style_t style_t;
37  const style_t* _style = a_styles.find_style(a_path);
38  if(_style){
39  a_plotter.set_from_style(a_styles.out(),*_style);
40  } else {
41  if(a_verbose) {
42  a_styles.out() << "tools::sg::style_from_res :"
43  << " style " << sout(a_path) << " not found."
44  << std::endl;
45  }
46  }}
47 
48  //sg::fields of various xml::styles :
49  a_styles.res_sg_style<style>(a_path+".bins_style.0",a_plotter.bins_style(0));
50  a_styles.res_sg_style<style>(a_path+".errors_style.0",a_plotter.errors_style(0));
51  a_styles.res_sg_style<style>(a_path+".func_style.0",a_plotter.func_style(0));
52  a_styles.res_sg_style<style>(a_path+".points_style.0",a_plotter.points_style(0));
53 
54  a_styles.res_sg_style<style>(a_path+".background_style",a_plotter.background_style());
55  a_styles.res_sg_style<text_style>(a_path+".title_style",a_plotter.title_style());
56  a_styles.res_sg_style<text_style>(a_path+".infos_style",a_plotter.infos_style());
57  a_styles.res_sg_style<text_style>(a_path+".title_box_style",a_plotter.title_box_style());
58  a_styles.res_sg_style<style>(a_path+".inner_frame_style",a_plotter.inner_frame_style());
59  a_styles.res_sg_style<style>(a_path+".grid_style",a_plotter.grid_style());
60  a_styles.res_sg_style<style>(a_path+".wall_style",a_plotter.wall_style());
61 
62  style_from_res(a_styles,a_path+".x_axis",a_plotter.x_axis(),a_verbose);
63  style_from_res(a_styles,a_path+".y_axis",a_plotter.y_axis(),a_verbose);
64  style_from_res(a_styles,a_path+".z_axis",a_plotter.z_axis(),a_verbose);
65  style_from_res(a_styles,a_path+".colormap_axis",a_plotter.colormap_axis(),a_verbose);
66 
67 }
68 
69 }}
70 
71 #endif
tools::sg::line_style
Definition: line_style:17
tools::sg::plotter::wall_style
style & wall_style()
Definition: plotter:1707
tools::xml::styles
Definition: styles:17
tools::sg::plotter::set_from_style
bool set_from_style(std::ostream &a_out, const style_t &a_style)
Definition: plotter:740
plotter
tools::sg::plotter::z_axis
const sg::axis & z_axis() const
Definition: plotter:1699
tools::sg::plotter::y_axis
const sg::axis & y_axis() const
Definition: plotter:1696
tools::xml::styles::style_t
std::vector< style_item_t > style_t
Definition: styles:41
tools::xml::styles::out
std::ostream & out() const
Definition: styles:35
tools::sg::plotter::errors_style
style & errors_style(size_t a_index)
Definition: plotter:1728
tools::sg::plotter::bins_style
style & bins_style(size_t a_index)
Definition: plotter:1713
tools::xml::styles::res_sg_style
bool res_sg_style(const std::string &a_style, T &a_sg_style) const
Definition: styles:258
tools::sg::axis::set_from_style
bool set_from_style(std::ostream &a_out, const style_t &a_style)
Definition: axis:706
tools::sg::axis
Definition: axis:30
tools::sg::axis::labels_style
text_style & labels_style()
Definition: axis:334
tools::sg::plotter::colormap_axis
const sg::axis & colormap_axis() const
Definition: plotter:1702
tools::sg::plotter::infos_style
text_style & infos_style()
Definition: plotter:1710
tools::sg::plotter
Definition: plotter:45
tools::sout
Definition: sout:17
tools::sg::axis::title_style
text_style & title_style()
Definition: axis:335
tools::sg::style
Definition: style:19
tools::sg::plotter::background_style
style & background_style()
Definition: plotter:1706
tools::sg::axis::ticks_style
sg::line_style & ticks_style()
Definition: axis:333
tools::sg::plotter::title_box_style
text_style & title_box_style()
Definition: plotter:1711
tools::sg::plotter::title_style
text_style & title_style()
Definition: plotter:1705
tools::sg::style_from_res
void style_from_res(const xml::styles &a_styles, const std::string &a_path, axis &a_axis, bool a_verbose)
Definition: plotter_style:14
tools
inlined C code : ///////////////////////////////////
Definition: aida_ntuple:26
tools::sg::text_style
Definition: text_style:19
tools::sg::plotter::func_style
style & func_style(size_t a_index)
Definition: plotter:1739
tools::sg::plotter::inner_frame_style
style & inner_frame_style()
Definition: plotter:1708
tools::sg::axis::line_style
sg::line_style & line_style()
Definition: axis:332
tools::sg::axis::mag_style
text_style & mag_style()
Definition: axis:336
tools::sg::plotter::x_axis
const sg::axis & x_axis() const
Definition: plotter:1693
tools::xml::styles::find_style
const style_t * find_style(const std::string &a_name) const
Definition: styles:51
tools::sg::plotter::grid_style
style & grid_style()
Definition: plotter:1709
tools::sg::plotter::points_style
style & points_style(size_t a_index)
Definition: plotter:1749