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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/senum (Version 11.3.0) and /externals/g4tools/include/tools/sg/senum (Version 10.5)


  1 // Copyright (C) 2010, Guy Barrand. All rights    
  2 // See the file tools.license for terms.          
  3                                                   
  4 #ifndef tools_sg_senum                            
  5 #define tools_sg_senum                            
  6                                                   
  7 #include "enums"                                  
  8 #include "lpat"                                   
  9                                                   
 10 #include <string>                                 
 11 #include <vector>                                 
 12                                                   
 13 namespace tools {                                 
 14 namespace sg {                                    
 15                                                   
 16 typedef struct {char string[32];hjust value;}     
 17 inline const hjust_rec* hjust_recs(unsigned in    
 18   static const hjust_rec list[] = { //read onl    
 19     {"left",     left},                           
 20     {"center",   center},                         
 21     {"right",    right}                           
 22   };                                              
 23   a_num = sizeof(list)/sizeof(list[0]);           
 24   return list;                                    
 25 }                                                 
 26 inline bool shjust(const std::string& a_s,hjus    
 27   unsigned int number;                            
 28   const hjust_rec* list = hjust_recs(number);     
 29   for(unsigned int count=0;count<number;count+    
 30     if(a_s==list[count].string) {                 
 31       a_v = list[count].value;                    
 32       return true;                                
 33     }                                             
 34   }                                               
 35   a_v = left;                                     
 36   return false;                                   
 37 }                                                 
 38 inline const char* shjust(hjust a_v){             
 39   unsigned int number;                            
 40   const hjust_rec* list = hjust_recs(number);     
 41   for(unsigned int count=0;count<number;count+    
 42     if(a_v==list[count].value) return list[cou    
 43   }                                               
 44   return 0;                                       
 45 }                                                 
 46                                                   
 47 typedef struct {char string[32];vjust value;}     
 48 inline const vjust_rec* vjust_recs(unsigned in    
 49   static const vjust_rec list[] = { //read onl    
 50     {"bottom",   bottom},                         
 51     {"middle",   middle},                         
 52     {"top",      top}                             
 53   };                                              
 54   a_num = sizeof(list)/sizeof(list[0]);           
 55   return list;                                    
 56 }                                                 
 57 inline bool svjust(const std::string& a_s,vjus    
 58   unsigned int number;                            
 59   const vjust_rec* list = vjust_recs(number);     
 60   for(unsigned int count=0;count<number;count+    
 61     if(a_s==list[count].string) {                 
 62       a_v = list[count].value;                    
 63       return true;                                
 64     }                                             
 65   }                                               
 66   a_v = bottom;                                   
 67   return false;                                   
 68 }                                                 
 69 inline const char* svjust(vjust a_v){             
 70   unsigned int number;                            
 71   const vjust_rec* list = vjust_recs(number);     
 72   for(unsigned int count=0;count<number;count+    
 73     if(a_v==list[count].value) return list[cou    
 74   }                                               
 75   return 0;                                       
 76 }                                                 
 77                                                   
 78 typedef struct {char string[32];marker_style v    
 79 inline const marker_style_rec* marker_style_re    
 80   static const marker_style_rec list[] = { //r    
 81     {"dot",         marker_dot},                  
 82     {"plus",        marker_plus},                 
 83     {"asterisk",    marker_asterisk},             
 84     {"cross",       marker_cross},                
 85     {"star",        marker_star},                 
 86     {"circle_line",         marker_circle_line    
 87     {"circle_filled",       marker_circle_fill    
 88     {"triangle_up_line",    marker_triangle_up    
 89     {"triangle_up_filled",  marker_triangle_up    
 90     {"triangle_down_line",  marker_triangle_do    
 91     {"triangle_down_filled",marker_triangle_do    
 92     {"david_star_line",     marker_david_star_    
 93     {"david_star_filled",   marker_david_star_    
 94     {"swiss_cross_line",    marker_swiss_cross    
 95     {"swiss_cross_filled",  marker_swiss_cross    
 96     {"diamond_line",        marker_diamond_lin    
 97     {"diamond_filled",      marker_diamond_fil    
 98     {"square_line",         marker_square_line    
 99     {"square_filled",       marker_square_fill    
100     {"penta_star_line",     marker_penta_star_    
101     {"penta_star_filled",   marker_penta_star_    
102     {"minus",               marker_minus}         
103   };                                              
104   a_num = sizeof(list)/sizeof(list[0]);           
105   return list;                                    
106 }                                                 
107 inline bool smarker_style(const std::string& a    
108   unsigned int number;                            
109   const marker_style_rec* list = marker_style_    
110   for(unsigned int count=0;count<number;count+    
111     if(a_s==list[count].string) {                 
112       a_v = list[count].value;                    
113       return true;                                
114     }                                             
115   }                                               
116   a_v = marker_dot;                               
117   return false;                                   
118 }                                                 
119 inline const char* smarker_style(marker_style     
120   unsigned int number;                            
121   const marker_style_rec* list = marker_style_    
122   for(unsigned int count=0;count<number;count+    
123     if(a_v==list[count].value) return list[cou    
124   }                                               
125   return 0;                                       
126 }                                                 
127 inline void smarker_styles(std::vector<std::st    
128   a_v.clear();                                    
129   unsigned int number;                            
130   const marker_style_rec* list = marker_style_    
131   for(unsigned int count=0;count<number;count+    
132     a_v.push_back(list[count].string);            
133   }                                               
134 }                                                 
135                                                   
136 typedef struct {char string[16];area_style val    
137 inline const area_style_rec* area_style_recsLi    
138   static const area_style_rec list[] = { //rea    
139     {"solid",         area_solid},                
140     {"hatched",       area_hatched},              
141     {"checker",       area_checker},              
142     {"edged",         area_edged}                 
143   };                                              
144   a_num = sizeof(list)/sizeof(list[0]);           
145   return list;                                    
146 }                                                 
147 inline bool sarea_style(const std::string& a_s    
148   unsigned int number;                            
149   const area_style_rec* list = area_style_recs    
150   for(unsigned int count=0;count<number;count+    
151     if(a_s==list[count].string) {                 
152       a_v = list[count].value;                    
153       return true;                                
154     }                                             
155   }                                               
156   a_v = area_solid;                               
157   return false;                                   
158 }                                                 
159 inline const char* sarea_style(area_style a_v)    
160   unsigned int number;                            
161   const area_style_rec* list = area_style_recs    
162   for(unsigned int count=0;count<number;count+    
163     if(a_v==list[count].value) return list[cou    
164   }                                               
165   return 0;                                       
166 }                                                 
167                                                   
168 typedef struct {char string[20];painting_polic    
169 inline const painting_policy_rec* painting_pol    
170   static const painting_policy_rec list[] = {     
171     {"uniform",      painting_uniform},           
172     {"by_value",     painting_by_value},          
173     {"by_level",     painting_by_level},          
174     {"grey_scale",   painting_grey_scale},        
175     {"violet_to_red",painting_violet_to_red},     
176     {"grey_scale_inverse",painting_grey_scale_    
177   };                                              
178   a_num = sizeof(list)/sizeof(list[0]);           
179   return list;                                    
180 }                                                 
181 inline void spainting_policies(std::vector<std    
182   a_v.clear();                                    
183   unsigned int number;                            
184   const painting_policy_rec* list = painting_p    
185   for(unsigned int count=0;count<number;count+    
186     a_v.push_back(list[count].string);            
187   }                                               
188 }                                                 
189 inline bool spainting_policy(const std::string    
190   unsigned int number;                            
191   const painting_policy_rec* list = painting_p    
192   for(unsigned int count=0;count<number;count+    
193     if(a_s==list[count].string) {                 
194       a_v = list[count].value;                    
195       return true;                                
196     }                                             
197   }                                               
198   a_v = painting_uniform;                         
199   return false;                                   
200 }                                                 
201 inline const char* spainting_policy(painting_p    
202   unsigned int number;                            
203   const painting_policy_rec* list = painting_p    
204   for(unsigned int count=0;count<number;count+    
205     if(a_v==list[count].value) return list[cou    
206   }                                               
207   return 0;                                       
208 }                                                 
209                                                   
210                                                   
211 typedef struct {char string[16];hatching_polic    
212 inline const hatching_policy_rec* hatching_pol    
213   static const hatching_policy_rec list[] = {     
214     {"none",           hatching_none},            
215     {"right",          hatching_right},           
216     {"left",           hatching_left},            
217     {"left_and_right", hatching_left_and_right    
218   };                                              
219   a_num = sizeof(list)/sizeof(list[0]);           
220   return list;                                    
221 }                                                 
222 inline bool shatching_policy(const std::string    
223   unsigned int number;                            
224   const hatching_policy_rec* list = hatching_p    
225   for(unsigned int count=0;count<number;count+    
226     if(a_s==list[count].string) {                 
227       a_v = list[count].value;                    
228       return true;                                
229     }                                             
230   }                                               
231   a_v = hatching_none;                            
232   return false;                                   
233 }                                                 
234 inline const char* shatching_policy(hatching_p    
235   unsigned int number;                            
236   const hatching_policy_rec* list = hatching_p    
237   for(unsigned int count=0;count<number;count+    
238     if(a_v==list[count].value) return list[cou    
239   }                                               
240   return 0;                                       
241 }                                                 
242                                                   
243 typedef struct {char string[16];projection_typ    
244 inline const projection_type_rec* projection_t    
245   static const projection_type_rec list[] = {     
246     {"none",     projection_none},                
247     {"rz",       projection_rz},                  
248     {"phiz",     projection_phiz},                
249     {"zr",       projection_zr},                  
250     {"zphi",     projection_zphi}                 
251   };                                              
252   a_num = sizeof(list)/sizeof(list[0]);           
253   return list;                                    
254 }                                                 
255 inline bool sprojection_type(const std::string    
256   unsigned int number;                            
257   const projection_type_rec* list = projection    
258   for(unsigned int count=0;count<number;count+    
259     if(a_s==list[count].string) {                 
260       a_v = list[count].value;                    
261       return true;                                
262     }                                             
263   }                                               
264   a_v = projection_none;                          
265   return false;                                   
266 }                                                 
267 inline const char* sprojection_type(projection    
268   unsigned int number;                            
269   const projection_type_rec* list = projection    
270   for(unsigned int count=0;count<number;count+    
271     if(a_v==list[count].value) return list[cou    
272   }                                               
273   return 0;                                       
274 }                                                 
275                                                   
276 inline bool sline_pattern(const std::string& a    
277   if(a_s=="solid") {                              
278     aPattern = line_solid;                        
279   } else if(a_s=="dashed") {                      
280     aPattern = line_dashed;                       
281   } else if(a_s=="dotted") {                      
282     aPattern = line_dotted;                       
283   } else if(a_s=="dash_dotted") {                 
284     aPattern = line_dash_dotted;                  
285   } else {                                        
286     aPattern = line_solid;                        
287     return false;                                 
288   }                                               
289   return true;                                    
290 }                                                 
291                                                   
292 //////////////////////////////////////////////    
293 //////////////////////////////////////////////    
294 //////////////////////////////////////////////    
295 inline bool smove_type(const std::string& a_s,    
296   if(a_s=="move_rotate_right") {a_move = move_    
297   if(a_s=="move_rotate_left") {a_move = move_r    
298   if(a_s=="move_rotate_up") {a_move = move_rot    
299   if(a_s=="move_rotate_down") {a_move = move_r    
300   if(a_s=="move_roll_plus") {a_move = move_rol    
301   if(a_s=="move_roll_minus") {a_move = move_ro    
302   if(a_s=="move_translate_right") {a_move = mo    
303   if(a_s=="move_translate_left") {a_move = mov    
304   if(a_s=="move_up") {a_move = move_up;return     
305   if(a_s=="move_down") {a_move = move_down;ret    
306   if(a_s=="move_forward") {a_move = move_forwa    
307   if(a_s=="move_backward") {a_move = move_back    
308   if(a_s=="move_zoom_in") {a_move = move_zoom_    
309   if(a_s=="move_zoom_out") {a_move = move_zoom    
310   if(a_s=="move_rotate_around_focal_right") {a    
311   if(a_s=="move_rotate_around_focal_left") {a_    
312   if(a_s=="move_rotate_around_focal_up") {a_mo    
313   if(a_s=="move_rotate_around_focal_down") {a_    
314   if(a_s=="move_roll_around_focal_plus") {a_mo    
315   if(a_s=="move_roll_around_focal_minus") {a_m    
316   if(a_s=="move_zoom_in_out") {a_move = move_z    
317   if(a_s=="move_zoom_in_out_rot") {a_move = mo    
318   if(a_s=="move_curve") {a_move = move_curve;r    
319   a_move = move_rotate_left;                      
320   return false;                                   
321 }                                                 
322                                                   
323 }}                                                
324 /*                                                
325 #include "../snpf"                                
326 #include "../colorf"                              
327                                                   
328 namespace tools {                                 
329 namespace sg {                                    
330                                                   
331 inline bool scolor(const colorf& a_col,std::st    
332   char _s[256];                                   
333   snpf(_s,sizeof(_s),"%g %g %g",a_col[0],a_col    
334   a_s = _s;                                       
335   return true;                                    
336 }                                                 
337                                                   
338 }}                                                
339 */                                                
340                                                   
341 #endif