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 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /externals/g4tools/include/tools/sg/plottables (Version 11.3.0) and /externals/g4tools/include/tools/sg/plottables (Version 8.2)


  1 // Copyright (C) 2010, Guy Barrand. All rights    
  2 // See the file tools.license for terms.          
  3                                                   
  4 #ifndef tools_sg_plottables                       
  5 #define tools_sg_plottables                       
  6                                                   
  7 #include "plottable"                              
  8 #include "enums"                                  
  9                                                   
 10 namespace tools {                                 
 11 namespace sg {                                    
 12                                                   
 13 class bins1D : public virtual plottable {         
 14 public:                                           
 15   TOOLS_SCLASS(tools::sg::bins1D)                 
 16 public:                                           
 17   virtual void* cast(const std::string& a_clas    
 18     if(void* p = cmp_cast<bins1D>(this,a_class    
 19     return plottable::cast(a_class);              
 20   }                                               
 21 public:                                           
 22   virtual ~bins1D(){}                             
 23 public:                                           
 24   virtual void bins_Sw_range(float&,float&,boo    
 25 public:                                           
 26   // axis :                                       
 27   virtual unsigned int bins() const = 0;          
 28   virtual float axis_min() const = 0;             
 29   virtual float axis_max() const = 0;             
 30   // bins on axis :                               
 31   virtual float bin_lower_edge(int) const = 0;    
 32   virtual float bin_upper_edge(int) const = 0;    
 33   // bins :                                       
 34   virtual bool has_entries_per_bin() const = 0    
 35   virtual unsigned int bin_entries(int) const     
 36   virtual float bin_Sw(int) const = 0;            
 37   virtual float bin_error(int) const = 0;         
 38 public:                                           
 39   virtual bool is_profile() const = 0;            
 40 };                                                
 41                                                   
 42 class bins2D : public virtual plottable {         
 43 public:                                           
 44   TOOLS_SCLASS(tools::sg::bins2D)                 
 45 public:                                           
 46   virtual void* cast(const std::string& a_clas    
 47     if(void* p = cmp_cast<bins2D>(this,a_class    
 48     return plottable::cast(a_class);              
 49   }                                               
 50 public:                                           
 51   virtual ~bins2D(){}                             
 52 public:                                           
 53   virtual void bins_Sw_range(float&,float&,boo    
 54 public:                                           
 55   // x axis :                                     
 56   virtual unsigned int x_bins() const = 0;        
 57   virtual float x_axis_min() const = 0;           
 58   virtual float x_axis_max() const = 0;           
 59   // y axis :                                     
 60   virtual unsigned int y_bins() const = 0;        
 61   virtual float y_axis_min() const = 0;           
 62   virtual float y_axis_max() const = 0;           
 63   // bins on x axis :                             
 64   virtual float bin_lower_edge_x(int) const =     
 65   virtual float bin_upper_edge_x(int) const =     
 66   // bins on y axis :                             
 67   virtual float bin_lower_edge_y(int) const =     
 68   virtual float bin_upper_edge_y(int) const =     
 69   // bins :                                       
 70   virtual bool has_entries_per_bin() const = 0    
 71   virtual unsigned int bin_entries(int,int) co    
 72   virtual float bin_Sw(int,int) const = 0;        
 73   virtual float bin_error(int,int) const = 0;     
 74 };                                                
 75                                                   
 76 class func1D : public virtual plottable {         
 77 public:                                           
 78   TOOLS_SCLASS(tools::sg::func1D)                 
 79 public:                                           
 80   virtual void* cast(const std::string& a_clas    
 81     if(void* p = cmp_cast<func1D>(this,a_class    
 82     return plottable::cast(a_class);              
 83   }                                               
 84 public:                                           
 85   virtual ~func1D(){}                             
 86 public:                                           
 87   virtual bool value(float,float&) const = 0;     
 88   virtual unsigned int x_steps() const = 0;       
 89   virtual float x_min() const = 0;                
 90   virtual float x_max() const = 0;                
 91 };                                                
 92                                                   
 93 class func2D : public virtual plottable {         
 94 public:                                           
 95   TOOLS_SCLASS(tools::sg::func2D)                 
 96 public:                                           
 97   virtual void* cast(const std::string& a_clas    
 98     if(void* p = cmp_cast<func2D>(this,a_class    
 99     return plottable::cast(a_class);              
100   }                                               
101 public:                                           
102   virtual ~func2D(){}                             
103 public:                                           
104   virtual bool value(float,float,float&) const    
105   virtual unsigned int x_steps() const = 0;       
106   virtual float x_min() const = 0;                
107   virtual float x_max() const = 0;                
108   virtual unsigned int y_steps() const = 0;       
109   virtual float y_min() const = 0;                
110   virtual float y_max() const = 0;                
111 /*                                                
112   //For "inside" functions :                      
113   virtual unsigned int number_of_points() cons    
114   virtual bool ith_point(int,float&,float&,boo    
115   virtual bool set_ith_point(int,float,float)     
116   virtual bool dragger_update_points() const =    
117 */                                                
118 };                                                
119                                                   
120 class points2D : public virtual plottable {       
121 public:                                           
122   TOOLS_SCLASS(tools::sg::points2D)               
123 public:                                           
124   virtual void* cast(const std::string& a_clas    
125     if(void* p = cmp_cast<points2D>(this,a_cla    
126     return plottable::cast(a_class);              
127   }                                               
128 public:                                           
129   virtual ~points2D(){}                           
130 public:                                           
131   virtual float x_axis_min() const = 0;           
132   virtual float x_axis_max() const = 0;           
133   virtual float y_axis_min() const = 0;           
134   virtual float y_axis_max() const = 0;           
135                                                   
136   virtual unsigned int points() const = 0;        
137   virtual bool ith_point(unsigned int,float&,f    
138 };                                                
139                                                   
140 class points3D : public virtual plottable {       
141 public:                                           
142   TOOLS_SCLASS(tools::sg::points3D)               
143 public:                                           
144   virtual void* cast(const std::string& a_clas    
145     if(void* p = cmp_cast<points3D>(this,a_cla    
146     return plottable::cast(a_class);              
147   }                                               
148 public:                                           
149   virtual ~points3D(){}                           
150 public:                                           
151   virtual float x_axis_min() const = 0;           
152   virtual float x_axis_max() const = 0;           
153   virtual float y_axis_min() const = 0;           
154   virtual float y_axis_max() const = 0;           
155   virtual float z_axis_min() const = 0;           
156   virtual float z_axis_max() const = 0;           
157                                                   
158   virtual unsigned int points() const = 0;        
159   virtual bool ith_point(unsigned int,float&,f    
160 };                                                
161                                                   
162 inline const std::string& s_tools_sg_fit2plot(    
163   static const std::string s_v("tools::sg::fit    
164   return s_v;                                     
165 }                                                 
166                                                   
167 }}                                                
168                                                   
169 //////////////////////////////////////////////    
170 /// primitives : /////////////////////////////    
171 //////////////////////////////////////////////    
172 #include "../colorf"                              
173                                                   
174 namespace tools {                                 
175 namespace sg {                                    
176                                                   
177 class plottable_text : public virtual plotprim    
178   typedef plotprim parent;                        
179 public:                                           
180   TOOLS_SCLASS(plottable_text)                    
181 public: //tools::sg::plotprim                     
182   virtual void* cast(const std::string& a_clas    
183     if(void* p = cmp_cast<plottable_text>(this    
184     return 0;                                     
185   }                                               
186   virtual plotprim* copy() const {return new p    
187 public:                                           
188   enum text_mode {                                
189     text_as_it,                                   
190     text_enforce_width,                           
191     text_enforce_height                           
192   };                                              
193 public:                                           
194   plottable_text(const std::string& a_TEXT,flo    
195                  float a_SIZE,text_mode a_text    
196   /*                                              
197                  float a_ANGLE = 0,               
198                  char a_HJUST = 'L',char a_VJU    
199                  const std::string& a_FONT = "    
200                  float a_SCALE = 1,bool a_SMOO    
201                  font_modeling a_font_modeling    
202      */                                           
203                  float a_ANGLE,                   
204                  char a_HJUST,char a_VJUST,       
205                  const std::string& a_FONT,con    
206                  float a_SCALE,bool a_SMOOTHIN    
207                  font_modeling a_font_modeling    
208      )                                            
209   :m_TEXT(a_TEXT),m_X(a_X),m_Y(a_Y)               
210   ,m_SIZE(a_SIZE),m_text_mode(a_text_mode)        
211   ,m_ANGLE(a_ANGLE)                               
212   ,m_HJUST(a_HJUST)                               
213   ,m_VJUST(a_VJUST)                               
214   ,m_FONT(a_FONT),m_TXCI(a_TXCI)                  
215   ,m_SCALE(a_SCALE),m_SMOOTHING(a_SMOOTHING),m    
216   ,m_font_modeling(a_font_modeling)               
217   {}                                              
218 public:                                           
219   plottable_text(const plottable_text& a_from)    
220   :parent(a_from)                                 
221   ,m_TEXT(a_from.m_TEXT)                          
222   ,m_X(a_from.m_X),m_Y(a_from.m_Y)                
223   ,m_SIZE(a_from.m_SIZE),m_text_mode(a_from.m_    
224   ,m_ANGLE(a_from.m_ANGLE)                        
225   ,m_HJUST(a_from.m_HJUST)                        
226   ,m_VJUST(a_from.m_VJUST)                        
227   ,m_FONT(a_from.m_FONT),m_TXCI(a_from.m_TXCI)    
228   ,m_SCALE(a_from.m_SCALE),m_SMOOTHING(a_from.    
229   ,m_font_modeling(a_from.m_font_modeling)        
230   {}                                              
231   plottable_text& operator=(const plottable_te    
232     m_TEXT = a_from.m_TEXT;                       
233     m_X = a_from.m_X;                             
234     m_Y = a_from.m_Y;                             
235     m_SIZE = a_from.m_SIZE;                       
236     m_text_mode = a_from.m_text_mode;             
237     m_ANGLE = a_from.m_ANGLE;                     
238     m_HJUST = a_from.m_HJUST;                     
239     m_VJUST = a_from.m_VJUST;                     
240     m_FONT = a_from.m_FONT;                       
241     m_TXCI = a_from.m_TXCI;                       
242     m_SCALE = a_from.m_SCALE;                     
243     m_SMOOTHING = a_from.m_SMOOTHING;             
244     m_HINTING = a_from.m_HINTING;                 
245     m_line_width = a_from.m_line_width;           
246     m_font_modeling = a_from.m_font_modeling;     
247     return *this;                                 
248   }                                               
249 public:                                           
250   std::string m_TEXT;                             
251   float m_X;                                      
252   float m_Y;                                      
253   float m_SIZE;                                   
254   text_mode m_text_mode;                          
255   float m_ANGLE;                                  
256   char m_HJUST;                                   
257   char m_VJUST;                                   
258   std::string m_FONT;                             
259   colorf m_TXCI;                                  
260   float m_SCALE;                                  
261   bool m_SMOOTHING;                               
262   bool m_HINTING;                                 
263   float m_line_width; //used if font is hershe    
264   font_modeling m_font_modeling;                  
265 };                                                
266                                                   
267 class plottable_box : public virtual plotprim     
268   typedef plotprim parent;                        
269 public:                                           
270   TOOLS_SCLASS(plottable_box)                     
271 public: //tools::sg::plotprim                     
272   virtual void* cast(const std::string& a_clas    
273     if(void* p = cmp_cast<plottable_box>(this,    
274     return 0;                                     
275   }                                               
276   virtual plotprim* copy() const {return new p    
277 public:                                           
278   enum fill_area_style {                          
279     HOLLOW = 0,                                   
280     SOLID = 1,                                    
281     PATTERN = 2,                                  
282     HATCHED = 3                                   
283   };                                              
284 public:                                           
285   plottable_box(float a_X1,float a_Y1,float a_    
286                 fill_area_style a_FAIS,const c    
287                 int a_FASI,                       
288                 bool a_BORD,const colorf& a_PL    
289   :m_X1(a_X1),m_Y1(a_Y1),m_X2(a_X2),m_Y2(a_Y2)    
290   ,m_FAIS(a_FAIS),m_FACI(a_FACI),m_FASI(a_FASI    
291   {}                                              
292 public:                                           
293   plottable_box(const plottable_box& a_from)      
294   :parent(a_from)                                 
295   ,m_X1(a_from.m_X1),m_Y1(a_from.m_Y1)            
296   ,m_X2(a_from.m_X2),m_Y2(a_from.m_Y2)            
297   ,m_FAIS(a_from.m_FAIS),m_FACI(a_from.m_FACI)    
298   ,m_LWID(a_from.m_LWID)                          
299   {}                                              
300   plottable_box& operator=(const plottable_box    
301     m_X1 = a_from.m_X1;                           
302     m_Y1 = a_from.m_Y1;                           
303     m_X2 = a_from.m_X2;                           
304     m_Y2 = a_from.m_Y2;                           
305     m_FAIS = a_from.m_FAIS;                       
306     m_FACI = a_from.m_FACI;                       
307     m_FASI = a_from.m_FASI;                       
308     m_BORD = a_from.m_BORD;                       
309     m_PLCI = a_from.m_PLCI;                       
310     m_LWID = a_from.m_LWID;                       
311     return *this;                                 
312   }                                               
313 public:                                           
314   float m_X1;                                     
315   float m_Y1;                                     
316   float m_X2;                                     
317   float m_Y2;                                     
318   fill_area_style m_FAIS;                         
319   colorf m_FACI;                                  
320   int m_FASI;                                     
321   bool m_BORD;                                    
322   colorf m_PLCI;                                  
323   float m_LWID;                                   
324 };                                                
325                                                   
326 class plottable_ellipse : public virtual plotp    
327   typedef plotprim parent;                        
328 public:                                           
329   TOOLS_SCLASS(plottable_ellipse)                 
330 public: //tools::sg::plotprim                     
331   virtual void* cast(const std::string& a_clas    
332     if(void* p = cmp_cast<plottable_ellipse>(t    
333     return 0;                                     
334   }                                               
335   virtual plotprim* copy() const {return new p    
336 public:                                           
337   enum fill_area_style {                          
338     HOLLOW = 0,                                   
339     SOLID = 1,                                    
340     PATTERN = 2,                                  
341     HATCHED = 3                                   
342   };                                              
343 public:                                           
344   plottable_ellipse(float a_X,float a_Y,float     
345                 fill_area_style a_FAIS,const c    
346                 int a_FASI,                       
347                 bool a_BORD,const colorf& a_PL    
348   :m_X(a_X),m_Y(a_Y),m_R1(a_R1),m_R2(a_R2)        
349   ,m_FAIS(a_FAIS),m_FACI(a_FACI),m_FASI(a_FASI    
350   {}                                              
351 public:                                           
352   plottable_ellipse(const plottable_ellipse& a    
353   :parent(a_from)                                 
354   ,m_X(a_from.m_X),m_Y(a_from.m_Y)                
355   ,m_R1(a_from.m_R1),m_R2(a_from.m_R2)            
356   ,m_FAIS(a_from.m_FAIS),m_FACI(a_from.m_FACI)    
357   ,m_LWID(a_from.m_LWID)                          
358   {}                                              
359   plottable_ellipse& operator=(const plottable    
360     m_X = a_from.m_X;                             
361     m_Y = a_from.m_Y;                             
362     m_R1 = a_from.m_R1;                           
363     m_R2 = a_from.m_R2;                           
364     m_FAIS = a_from.m_FAIS;                       
365     m_FACI = a_from.m_FACI;                       
366     m_FASI = a_from.m_FASI;                       
367     m_BORD = a_from.m_BORD;                       
368     m_PLCI = a_from.m_PLCI;                       
369     m_LWID = a_from.m_LWID;                       
370     return *this;                                 
371   }                                               
372 public:                                           
373   float m_X;                                      
374   float m_Y;                                      
375   float m_R1;                                     
376   float m_R2;                                     
377   fill_area_style m_FAIS;                         
378   colorf m_FACI;                                  
379   int m_FASI;                                     
380   bool m_BORD;                                    
381   colorf m_PLCI;                                  
382   float m_LWID;                                   
383 };                                                
384                                                   
385 }}                                                
386                                                   
387 #include "../img"                                 
388 #include "../typedefs"                            
389                                                   
390 namespace tools {                                 
391 namespace sg {                                    
392                                                   
393 class plottable_img : public virtual plotprim     
394   typedef plotprim parent;                        
395 public:                                           
396   TOOLS_SCLASS(plottable_img)                     
397 public: //tools::sg::plotprim                     
398   virtual void* cast(const std::string& a_clas    
399     if(void* p = cmp_cast<plottable_img>(this,    
400     return 0;                                     
401   }                                               
402   virtual plotprim* copy() const {return new p    
403 public:                                           
404   plottable_img(const img<byte>& a_img,float a    
405   :m_img(a_img)                                   
406   ,m_X(a_X),m_Y(a_Y)                              
407   ,m_WIDTH(a_WIDTH),m_HEIGHT(a_HEIGHT),m_THETA    
408   {}                                              
409 public:                                           
410   plottable_img(const plottable_img& a_from)      
411   :parent(a_from)                                 
412   ,m_img(a_from.m_img)                            
413   ,m_X(a_from.m_X),m_Y(a_from.m_Y)                
414   ,m_WIDTH(a_from.m_WIDTH),m_HEIGHT(a_from.m_H    
415   {}                                              
416   plottable_img& operator=(const plottable_img    
417     m_img = a_from.m_img;                         
418     m_X = a_from.m_X;                             
419     m_Y = a_from.m_Y;                             
420     m_WIDTH = a_from.m_WIDTH;                     
421     m_HEIGHT = a_from.m_HEIGHT;                   
422     m_THETA = a_from.m_THETA;                     
423     m_PHI = a_from.m_PHI;                         
424     return *this;                                 
425   }                                               
426 public:                                           
427   img<byte> m_img;                                
428   float m_X;                                      
429   float m_Y;                                      
430   float m_WIDTH;                                  
431   float m_HEIGHT;                                 
432   float m_THETA;                                  
433   float m_PHI;                                    
434 };                                                
435                                                   
436 }}                                                
437                                                   
438                                                   
439 #endif