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 #ifdef tools_viewplot
0049   //deprecated, use set_current_plotter_style().
0050   void style_from_res(const std::string& a_path,bool a_verbose = false) {
0051     style_from_res(a_path,m_plots.current_plotter(),a_verbose);
0052   }
0053 #endif
0054   void set_current_plotter_style(const std::string& a_path,bool a_verbose = false) {
0055     style_from_res(a_path,m_plots.current_plotter(),a_verbose);
0056   }
0057 
0058 public:
0059   void set_cols_rows(unsigned int a_cols,unsigned int a_rows) {
0060     m_plots.cols = a_cols;
0061     m_plots.rows = a_rows;
0062     m_plots.adjust_size(width(),height());
0063   }
0064 
0065 //#ifdef tools_viewplot
0066   bool write(const std::string& a_file,bool a_anonymous = false) {
0067     return parent::write_inzb_ps(a_file,a_anonymous);
0068   }
0069   bool open_file(const std::string& a_file,bool a_anonymous = false) {return open_inzb_ps_file(a_file,a_anonymous);}
0070   bool write_page() {return write_inzb_ps_page();}
0071   bool close_file() {return close_inzb_ps_file();}
0072 //#endif
0073 
0074 
0075   const xml::styles& styles() const {return m_styles;}
0076   xml::styles& styles() {return m_styles;}
0077 
0078 protected:
0079   void style_from_res(const std::string& a_path,sg::plotter& a_plotter,bool a_verbose) {
0080     sg::style_from_res(m_styles,a_path,a_plotter,a_verbose);
0081   }
0082 
0083 protected:
0084   sg::zb_manager m_mgr;
0085   wps m_wps;
0086   sg::dummy_freetype m_ttf;
0087   xml::styles m_styles;
0088 };
0089 
0090 }
0091 
0092 #endif
0093