Geant4 Cross Reference |
1 // Copyright (C) 2010, Guy Barrand. All rights 1 // Copyright (C) 2010, Guy Barrand. All rights reserved. 2 // See the file tools.license for terms. 2 // See the file tools.license for terms. 3 3 4 #ifndef tools_sg_plotter_style 4 #ifndef tools_sg_plotter_style 5 #define tools_sg_plotter_style 5 #define tools_sg_plotter_style 6 6 7 #include "../xml/styles" 7 #include "../xml/styles" 8 8 9 #include "plotter" 9 #include "plotter" 10 10 11 namespace tools { 11 namespace tools { 12 namespace sg { 12 namespace sg { 13 13 14 inline void style_from_res(const xml::styles& 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; 15 {typedef xml::styles::style_t style_t; 16 const style_t* style = a_styles.find_style(a 16 const style_t* style = a_styles.find_style(a_path); 17 if(style){ 17 if(style){ 18 a_axis.set_from_style(a_styles.out(),*styl 18 a_axis.set_from_style(a_styles.out(),*style); 19 } else { 19 } else { 20 if(a_verbose) { 20 if(a_verbose) { 21 a_styles.out() << "tools::sg::style_from 21 a_styles.out() << "tools::sg::style_from_res(axis) :" 22 << " style " << sout(a_pa 22 << " style " << sout(a_path) << " not found." 23 << std::endl; 23 << std::endl; 24 } 24 } 25 }} 25 }} 26 26 27 a_styles.res_sg_style<line_style>(a_path+".l 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+".t 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+".l 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+".m 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+".t 31 a_styles.res_sg_style<text_style>(a_path+".title_style",a_axis.title_style()); 32 } 32 } 33 33 34 inline void style_from_res(const xml::styles& 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 : 35 //sg::fields of plotter : 36 {typedef xml::styles::style_t style_t; 36 {typedef xml::styles::style_t style_t; 37 const style_t* _style = a_styles.find_style( 37 const style_t* _style = a_styles.find_style(a_path); 38 if(_style){ 38 if(_style){ 39 a_plotter.set_from_style(a_styles.out(),*_ 39 a_plotter.set_from_style(a_styles.out(),*_style); 40 } else { 40 } else { 41 if(a_verbose) { 41 if(a_verbose) { 42 a_styles.out() << "tools::sg::style_from 42 a_styles.out() << "tools::sg::style_from_res :" 43 << " style " << sout(a_pa 43 << " style " << sout(a_path) << " not found." 44 << std::endl; 44 << std::endl; 45 } 45 } 46 }} 46 }} 47 47 48 //sg::fields of various xml::styles : 48 //sg::fields of various xml::styles : 49 a_styles.res_sg_style<style>(a_path+".bins_s 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 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_s 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 52 a_styles.res_sg_style<style>(a_path+".points_style.0",a_plotter.points_style(0)); 53 53 54 a_styles.res_sg_style<style>(a_path+".backgr 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+".t 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+".i 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+".t 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_ 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_s 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_s 60 a_styles.res_sg_style<style>(a_path+".wall_style",a_plotter.wall_style()); 61 61 62 style_from_res(a_styles,a_path+".x_axis",a_p 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_p 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_p 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_ax 65 style_from_res(a_styles,a_path+".colormap_axis",a_plotter.colormap_axis(),a_verbose); 66 66 67 } 67 } 68 68 69 }} 69 }} 70 70 71 #endif 71 #endif