Geant4 Cross Reference |
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