Warning, /include/Geant4/tools/sg/plotter_style is written in an unsupported language. File is not indexed.
0001 // Copyright (C) 2010, Guy Barrand. All rights reserved.
0002 // See the file tools.license for terms.
0003
0004 #ifndef tools_sg_plotter_style
0005 #define tools_sg_plotter_style
0006
0007 #include "../xml/styles"
0008
0009 #include "plotter"
0010
0011 namespace tools {
0012 namespace sg {
0013
0014 inline void style_from_res(const xml::styles& a_styles,const std::string& a_path,axis& a_axis,bool a_verbose) {
0015 {typedef xml::styles::style_t style_t;
0016 const style_t* style = a_styles.find_style(a_path);
0017 if(style){
0018 a_axis.set_from_style(a_styles.out(),*style);
0019 } else {
0020 if(a_verbose) {
0021 a_styles.out() << "tools::sg::style_from_res(axis) :"
0022 << " style " << sout(a_path) << " not found."
0023 << std::endl;
0024 }
0025 }}
0026
0027 a_styles.res_sg_style<line_style>(a_path+".line_style",a_axis.line_style());
0028 a_styles.res_sg_style<line_style>(a_path+".ticks_style",a_axis.ticks_style());
0029 a_styles.res_sg_style<text_style>(a_path+".labels_style",a_axis.labels_style());
0030 a_styles.res_sg_style<text_style>(a_path+".mag_style",a_axis.mag_style());
0031 a_styles.res_sg_style<text_style>(a_path+".title_style",a_axis.title_style());
0032 }
0033
0034 inline void style_from_res(const xml::styles& a_styles,const std::string& a_path,plotter& a_plotter,bool a_verbose) {
0035 //sg::fields of plotter :
0036 {typedef xml::styles::style_t style_t;
0037 const style_t* _style = a_styles.find_style(a_path);
0038 if(_style){
0039 a_plotter.set_from_style(a_styles.out(),*_style);
0040 } else {
0041 if(a_verbose) {
0042 a_styles.out() << "tools::sg::style_from_res :"
0043 << " style " << sout(a_path) << " not found."
0044 << std::endl;
0045 }
0046 }}
0047
0048 //sg::fields of various xml::styles :
0049 a_styles.res_sg_style<style>(a_path+".bins_style.0",a_plotter.bins_style(0));
0050 a_styles.res_sg_style<style>(a_path+".errors_style.0",a_plotter.errors_style(0));
0051 a_styles.res_sg_style<style>(a_path+".func_style.0",a_plotter.func_style(0));
0052 a_styles.res_sg_style<style>(a_path+".points_style.0",a_plotter.points_style(0));
0053
0054 a_styles.res_sg_style<style>(a_path+".background_style",a_plotter.background_style());
0055 a_styles.res_sg_style<text_style>(a_path+".title_style",a_plotter.title_style());
0056 a_styles.res_sg_style<text_style>(a_path+".infos_style",a_plotter.infos_style());
0057 a_styles.res_sg_style<text_style>(a_path+".title_box_style",a_plotter.title_box_style());
0058 a_styles.res_sg_style<style>(a_path+".inner_frame_style",a_plotter.inner_frame_style());
0059 a_styles.res_sg_style<style>(a_path+".grid_style",a_plotter.grid_style());
0060 a_styles.res_sg_style<style>(a_path+".wall_style",a_plotter.wall_style());
0061
0062 style_from_res(a_styles,a_path+".x_axis",a_plotter.x_axis(),a_verbose);
0063 style_from_res(a_styles,a_path+".y_axis",a_plotter.y_axis(),a_verbose);
0064 style_from_res(a_styles,a_path+".z_axis",a_plotter.z_axis(),a_verbose);
0065 style_from_res(a_styles,a_path+".colormap_axis",a_plotter.colormap_axis(),a_verbose);
0066
0067 }
0068
0069 }}
0070
0071 #endif