g4tools  5.4.0
viewplot
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_viewplot
5 #define tools_viewplot
6 
7 #include "sg/plots_viewer"
8 
9 #include "sg/dummy_freetype"
10 #include "sg/plotter_style"
11 
12 #include "wps"
13 
14 namespace tools {
15 
16 class viewplot : public sg::plots_viewer {
17  typedef sg::plots_viewer parent;
18 public:
19  viewplot(std::ostream& a_out,
20  unsigned int a_cols = 1,unsigned int a_rows = 1,
21  unsigned int a_width = 500,unsigned int a_height = 500)
22  :parent(a_out,m_ttf,a_cols,a_rows,a_width,a_height)
23  ,m_wps(a_out)
24  ,m_ttf()
25  ,m_styles(a_out)
26  {}
27  viewplot(std::ostream& a_out,const sg::base_freetype& a_ttf,
28  unsigned int a_cols = 1,unsigned int a_rows = 1,
29  unsigned int a_width = 500,unsigned int a_height = 500)
30  :parent(a_out,a_ttf,a_cols,a_rows,a_width,a_height)
31  ,m_wps(a_out)
32  ,m_ttf()
33  ,m_styles(a_out)
34  {}
35  virtual ~viewplot() {}
36 public:
37  viewplot(const viewplot& a_from)
38  :parent(a_from)
39  ,m_wps(a_from.m_out)
40  ,m_styles(a_from.m_styles)
41  {}
42  viewplot& operator=(const viewplot& a_from){
43  parent::operator=(a_from);
44  m_styles = a_from.m_styles;
45  return *this;
46  }
47 public:
48 #ifdef tools_viewplot
49  //deprecated, use set_current_plotter_style().
50  void style_from_res(const std::string& a_path,bool a_verbose = false) {
51  style_from_res(a_path,m_plots.current_plotter(),a_verbose);
52  }
53 #endif
54  void set_current_plotter_style(const std::string& a_path,bool a_verbose = false) {
55  style_from_res(a_path,m_plots.current_plotter(),a_verbose);
56  }
57 
58 public:
59  void set_cols_rows(unsigned int a_cols,unsigned int a_rows) {
60  m_plots.cols = a_cols;
61  m_plots.rows = a_rows;
63  }
64 
65 //#ifdef tools_viewplot
66  bool write(const std::string& a_file,bool a_anonymous = false) {
67  return parent::write_inzb_ps(a_file,a_anonymous);
68  }
69  bool open_file(const std::string& a_file,bool a_anonymous = false) {return open_inzb_ps_file(a_file,a_anonymous);}
70  bool write_page() {return write_inzb_ps_page();}
71  bool close_file() {return close_inzb_ps_file();}
72 //#endif
73 
74 
75  const xml::styles& styles() const {return m_styles;}
77 
78 protected:
79  void style_from_res(const std::string& a_path,sg::plotter& a_plotter,bool a_verbose) {
80  sg::style_from_res(m_styles,a_path,a_plotter,a_verbose);
81  }
82 
83 protected:
88 };
89 
90 }
91 
92 #endif
93 
tools::viewplot
Definition: viewplot:16
tools::xml::styles
Definition: styles:17
tools::sg::plots::adjust_size
void adjust_size(unsigned int a_ww, unsigned int a_wh)
Definition: plots:271
tools::viewplot::viewplot
viewplot(std::ostream &a_out, unsigned int a_cols=1, unsigned int a_rows=1, unsigned int a_width=500, unsigned int a_height=500)
Definition: viewplot:19
tools::sg::plots_viewer::open_inzb_ps_file
bool open_inzb_ps_file(const std::string &a_file, bool a_anonymous=false)
Definition: plots_viewer:188
tools::viewplot::viewplot
viewplot(const viewplot &a_from)
Definition: viewplot:37
tools::viewplot::style_from_res
void style_from_res(const std::string &a_path, bool a_verbose=false)
Definition: viewplot:50
tools::sg::plots_viewer::m_plots
sg::plots m_plots
Definition: plots_viewer:240
tools::sg::plots::current_plotter
plotter & current_plotter()
Definition: plots:390
tools::viewplot::set_current_plotter_style
void set_current_plotter_style(const std::string &a_path, bool a_verbose=false)
Definition: viewplot:54
tools::viewplot::operator=
viewplot & operator=(const viewplot &a_from)
Definition: viewplot:42
tools::sg::dummy_freetype
Definition: dummy_freetype:15
tools::sg::base_freetype
Definition: base_freetype:16
tools::viewplot::style_from_res
void style_from_res(const std::string &a_path, sg::plotter &a_plotter, bool a_verbose)
Definition: viewplot:79
tools::viewplot::styles
const xml::styles & styles() const
Definition: viewplot:75
plots_viewer
tools::sg::plots_viewer::close_inzb_ps_file
bool close_inzb_ps_file()
Definition: plots_viewer:208
tools::viewplot::viewplot
viewplot(std::ostream &a_out, const sg::base_freetype &a_ttf, unsigned int a_cols=1, unsigned int a_rows=1, unsigned int a_width=500, unsigned int a_height=500)
Definition: viewplot:27
tools::sg::plots_viewer::write_inzb_ps
bool write_inzb_ps(const std::string &a_file, unsigned int a_width, unsigned int a_height, bool a_anonymous=false)
Definition: plots_viewer:165
tools::viewplot::write_page
bool write_page()
Definition: viewplot:70
wps
tools::sg::plots_viewer
Definition: plots_viewer:28
tools::sg::plotter
Definition: plotter:45
tools::viewplot::m_styles
xml::styles m_styles
Definition: viewplot:87
tools::viewplot::set_cols_rows
void set_cols_rows(unsigned int a_cols, unsigned int a_rows)
Definition: viewplot:59
tools::viewplot::m_mgr
sg::zb_manager m_mgr
Definition: viewplot:84
tools::wps
Definition: wps:16
tools::viewplot::m_ttf
sg::dummy_freetype m_ttf
Definition: viewplot:86
tools::sg::zb_manager
Definition: zb_manager:18
tools::sg::plots_viewer::operator=
plots_viewer & operator=(const plots_viewer &a_from)
Definition: plots_viewer:63
tools::viewplot::styles
xml::styles & styles()
Definition: viewplot:76
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::viewer::m_out
std::ostream & m_out
Definition: viewer:169
tools::sg::plots_viewer::write_inzb_ps_page
bool write_inzb_ps_page()
Definition: plots_viewer:207
tools::viewplot::write
bool write(const std::string &a_file, bool a_anonymous=false)
Definition: viewplot:66
tools::viewplot::m_wps
wps m_wps
Definition: viewplot:85
dummy_freetype
tools::viewplot::close_file
bool close_file()
Definition: viewplot:71
plotter_style
tools::sg::viewer::height
unsigned int height() const
Definition: viewer:98
tools::sg::viewer::width
unsigned int width() const
Definition: viewer:97
tools::viewplot::open_file
bool open_file(const std::string &a_file, bool a_anonymous=false)
Definition: viewplot:69
tools::sg::plots::rows
sf< unsigned int > rows
Definition: plots:22
tools::viewplot::~viewplot
virtual ~viewplot()
Definition: viewplot:35
tools::sg::plots::cols
sf< unsigned int > cols
Definition: plots:21