34 #if defined(TOOLS_USE_FREETYPE)
35 #include <tools/sg/text_freetype>
36 #include <tools/xml/xml_style>
37 #include <tools/xml/wrap_viewplot_style>
44 void HD_style(tools::sg::plots& a_plots,
float a_line_width) {
45 std::vector<tools::sg::plotter*> plotters;
46 a_plots.plotters(plotters);
47 tools_vforcit(tools::sg::plotter*,plotters,it) {
48 tools::sg::plotter* _plotter = *it;
49 _plotter->bins_style(0).line_width = a_line_width;
50 _plotter->inner_frame_style().line_width = a_line_width;
51 _plotter->grid_style().line_width = a_line_width;
52 _plotter->x_axis().line_style().width = a_line_width;
53 _plotter->x_axis().ticks_style().width = a_line_width;
54 _plotter->y_axis().line_style().width = a_line_width;
55 _plotter->y_axis().ticks_style().width = a_line_width;
56 _plotter->z_axis().line_style().width = a_line_width;
57 _plotter->z_axis().ticks_style().width = a_line_width;
60 _plotter->title_style().line_width = a_line_width;
61 _plotter->infos_style().line_width = a_line_width;
62 _plotter->title_box_style().line_width = a_line_width;
64 _plotter->x_axis().labels_style().line_width = a_line_width;
65 _plotter->x_axis().mag_style().line_width = a_line_width;
66 _plotter->x_axis().title_style().line_width = a_line_width;
68 _plotter->y_axis().labels_style().line_width = a_line_width;
69 _plotter->y_axis().mag_style().line_width = a_line_width;
70 _plotter->y_axis().title_style().line_width = a_line_width;
72 _plotter->z_axis().labels_style().line_width = a_line_width;
73 _plotter->z_axis().mag_style().line_width = a_line_width;
74 _plotter->z_axis().title_style().line_width = a_line_width;
80 void regions_style(tools::sg::plots& a_plots,
float a_plotter_scale = 1) {
86 float ww_wc = a_plots.width;
87 float wh_wc = a_plots.height;
88 float rw_wc = ww_wc/a_plots.cols;
89 float rh_wc = wh_wc/a_plots.rows;
93 float wfac = (rw_wc/ww_wc)*cooking;
94 float hfac = (rh_wc/wh_wc)*cooking;
96 float label_cooking = 1.6f;
98 if((a_plots.cols.value()>=4)&&(a_plots.cols.value()>a_plots.rows.value())) label_cooking = 0.9f;
100 float title_cooking = 1.1f;
102 a_plots.plotter_scale = a_plotter_scale;
104 std::vector<tools::sg::plotter*> plotters;
105 a_plots.plotters(plotters);
106 tools_vforcit(tools::sg::plotter*,plotters,it) {
107 tools::sg::plotter* _plotter = *it;
109 _plotter->left_margin = _plotter->left_margin * wfac;
110 _plotter->right_margin = _plotter->right_margin * wfac;
111 _plotter->bottom_margin = _plotter->bottom_margin * hfac;
112 _plotter->top_margin = _plotter->top_margin * hfac;
114 _plotter->x_axis().tick_length = _plotter->x_axis().tick_length * wfac;
115 _plotter->y_axis().tick_length = _plotter->y_axis().tick_length * hfac;
117 _plotter->title_to_axis = _plotter->title_to_axis * hfac;
118 _plotter->title_height = _plotter->title_height * hfac * title_cooking;
120 _plotter->x_axis().label_height = _plotter->x_axis().label_height * hfac * label_cooking;
121 _plotter->y_axis().label_height = _plotter->y_axis().label_height * hfac * label_cooking;
128 bool load_embeded_styles(tools::xml::styles& a_styles) {
131 const char** lines = viewplot_style(linen);
132 for(
unsigned int index=0;index<linen;index++) {
133 std::string
s = lines[index];
134 tools::replace(s,
"@@double_quote@@",
"\"");
135 tools::replace(s,
"@@back_slash@@",
"\\");
138 return tools::xml::load_style_string(a_styles,ss);
161 #if defined(TOOLS_USE_FREETYPE)
167 G4cout <<
"... using high resolution with Freetype fonts" <<
G4endl;
173 static tools::sg::text_freetype ttf;
179 fViewer->plots().view_border =
false;
180 load_embeded_styles(
fViewer->styles());
181 fViewer->styles().add_colormap(
"default",tools::sg::style_default_colormap());
182 fViewer->styles().add_colormap(
"ROOT",tools::sg::style_ROOT_colormap());
187 G4cout <<
"... using low resolution with Hershey fonts" <<
G4endl;
194 fViewer->plots().view_border =
false;
214 #if defined(TOOLS_USE_FREETYPE)
222 description <<
" " <<
"Cannot write a page in the plot file " <<
fFileName;
257 description <<
" " <<
"Cannot open plot file " << fileName;
281 description <<
" " <<
"Cannot close the plot file.";
std::ostringstream G4ExceptionDescription
static G4PlotParameters fgPlotParameters
G4PlotManager(const G4AnalysisManagerState &state)
G4bool OpenFile(const G4String &fileName)
std::unique_ptr< tools::viewplot > fViewer
const G4AnalysisVerbose * GetVerboseL4() const
const G4AnalysisVerbose * GetVerboseL3() const
G4double G4ParticleHPJENDLHEData::G4double result
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
void Message(const G4String &action, const G4String &object, const G4String &objectName, G4bool success=true) const
G4GLOB_DLL std::ostream G4cout
const G4AnalysisManagerState & fState
const G4AnalysisVerbose * GetVerboseL1() const