Back to home page

EIC code displayed by LXR

 
 

    


Warning, /include/Geant4/tools/viewplot 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_viewplot
0005 #define tools_viewplot
0006 
0007 #include "sg/plots_viewer"
0008 
0009 #include "sg/dummy_freetype"
0010 #include "sg/plotter_style"
0011 
0012 #include "wps"
0013 
0014 namespace tools {
0015 
0016 class viewplot : public sg::plots_viewer {
0017   typedef sg::plots_viewer parent;
0018 public:
0019   viewplot(std::ostream& a_out,
0020            unsigned int a_cols = 1,unsigned int a_rows = 1,
0021            unsigned int a_width = 500,unsigned int a_height = 500)
0022   :parent(a_out,m_ttf,a_cols,a_rows,a_width,a_height)
0023   ,m_wps(a_out)
0024   ,m_ttf()
0025   ,m_styles(a_out)
0026   {}
0027   viewplot(std::ostream& a_out,const sg::base_freetype& a_ttf,
0028            unsigned int a_cols = 1,unsigned int a_rows = 1,
0029            unsigned int a_width = 500,unsigned int a_height = 500)
0030   :parent(a_out,a_ttf,a_cols,a_rows,a_width,a_height)
0031   ,m_wps(a_out)
0032   ,m_ttf()
0033   ,m_styles(a_out)
0034   {}
0035   virtual ~viewplot() {}
0036 public:
0037   viewplot(const viewplot& a_from)
0038   :parent(a_from)
0039   ,m_wps(a_from.m_out)
0040   ,m_styles(a_from.m_styles)
0041   {}
0042   viewplot& operator=(const viewplot& a_from){
0043     parent::operator=(a_from);
0044     m_styles = a_from.m_styles;
0045     return *this;
0046   }
0047 public:
0048   void set_current_plotter_style(const std::string& a_path,bool a_verbose = false) {
0049     style_from_res(a_path,m_plots.current_plotter(),a_verbose);
0050   }
0051 
0052 public:
0053   void set_cols_rows(unsigned int a_cols,unsigned int a_rows) {
0054     m_plots.cols = a_cols;
0055     m_plots.rows = a_rows;
0056     m_plots.adjust_size(width(),height());
0057   }
0058 
0059   bool write(const std::string& a_file,bool a_anonymous = false) {
0060     return parent::write_inzb_ps(a_file,a_anonymous);
0061   }
0062   bool open_file(const std::string& a_file,bool a_anonymous = false) {return open_inzb_ps_file(a_file,a_anonymous);}
0063   bool write_page() {return write_inzb_ps_page();}
0064   bool close_file() {return close_inzb_ps_file();}
0065 
0066 
0067   const xml::styles& styles() const {return m_styles;}
0068   xml::styles& styles() {return m_styles;}
0069 
0070 protected:
0071   void style_from_res(const std::string& a_path,sg::plotter& a_plotter,bool a_verbose) {
0072     sg::style_from_res(m_styles,a_path,a_plotter,a_verbose);
0073   }
0074 
0075 protected:
0076   sg::zb_manager m_mgr;
0077   wps m_wps;
0078   sg::dummy_freetype m_ttf;
0079   xml::styles m_styles;
0080 };
0081 
0082 }
0083 
0084 #endif
0085