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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/style (Version 11.3.0) and /externals/g4tools/include/tools/sg/style (Version 10.0.p3)


  1 // Copyright (C) 2010, Guy Barrand. All rights    
  2 // See the file tools.license for terms.          
  3                                                   
  4 #ifndef tools_sg_style                            
  5 #define tools_sg_style                            
  6                                                   
  7 // fields of style_parser but put as sf on a n    
  8                                                   
  9 #include "node"                                   
 10                                                   
 11 #include "style_parser"                           
 12 #include "sf_string"                              
 13 #include "sf_vec3f"                               
 14 #include "sf_enum"                                
 15                                                   
 16 namespace tools {                                 
 17 namespace sg {                                    
 18                                                   
 19 class style : public node {                       
 20   TOOLS_NODE(style,tools::sg::style,node)         
 21 public:                                           
 22   sf_vec<colorf,float> color;                     
 23   sf_vec<colorf,float> highlight_color;           
 24   sf_vec<colorf,float> back_color;                
 25   sf<float> line_width;                           
 26   sf<float> marker_size;                          
 27   sf<float> point_size;                           
 28   sf<float> font_size;                            
 29   sf_enum<sg::font_modeling> font_modeling;       
 30   sf_enum<winding_type> front_face;               
 31   sf<lpat> line_pattern;                          
 32   sf_enum<sg::marker_style> marker_style;         
 33   sf_enum<sg::area_style> area_style;             
 34   sf_string modeling;                             
 35   sf_string light_model;                          
 36   sf_string tick_modeling;                        
 37   sf_string encoding;                             
 38   sf<bool> smoothing;                             
 39   sf<bool> hinting;                               
 40   sf_string cut;                                  
 41   sf_enum<sg::painting_policy> painting;          
 42   sf_enum<sg::hatching_policy> hatching;          
 43   sf_enum<sg::projection_type> projection;        
 44   sf_string font;                                 
 45   sf<int> multi_node_limit;                       
 46   sf<int> divisions;                              
 47   sf<unsigned int> rotation_steps;                
 48   sf<float> spacing;                              
 49   sf<float> angle;                                
 50   sf<float> scale;                                
 51   sf<float> offset;                               
 52   sf<float> strip_width;                          
 53   sf<bool> visible;                               
 54   sf<float> bar_offset;                           
 55   sf<float> bar_width;                            
 56   sf<bool> editable;                              
 57   sf<bool> pickable;                              
 58   sf<bool> automated;                             
 59   sf_string options;                              
 60   sf_string color_mapping;                        
 61   sf<bool> enforced;                              
 62   sf_vec3f translation;                           
 63   sf_string coloring;                             
 64   sf_string title;                                
 65 public:                                           
 66   virtual const desc_fields& node_desc_fields(    
 67     TOOLS_FIELD_DESC_NODE_CLASS(tools::sg::sty    
 68     static const desc_fields s_v(parent::node_    
 69       TOOLS_ARG_FIELD_DESC(color),  //1           
 70       TOOLS_ARG_FIELD_DESC(highlight_color),      
 71       TOOLS_ARG_FIELD_DESC(back_color),           
 72       TOOLS_ARG_FIELD_DESC(line_width),           
 73       TOOLS_ARG_FIELD_DESC(marker_size),          
 74       TOOLS_ARG_FIELD_DESC(point_size),           
 75       TOOLS_ARG_FIELD_DESC(font_size),            
 76       TOOLS_ARG_FIELD_DESC(font_modeling),        
 77       TOOLS_ARG_FIELD_DESC(front_face),           
 78       TOOLS_ARG_FIELD_DESC(line_pattern),   //    
 79                                                   
 80       TOOLS_ARG_FIELD_DESC(marker_style),         
 81       TOOLS_ARG_FIELD_DESC(area_style),           
 82       TOOLS_ARG_FIELD_DESC(modeling),             
 83       TOOLS_ARG_FIELD_DESC(light_model),          
 84       TOOLS_ARG_FIELD_DESC(tick_modeling),        
 85       TOOLS_ARG_FIELD_DESC(encoding),             
 86       TOOLS_ARG_FIELD_DESC(smoothing),            
 87       TOOLS_ARG_FIELD_DESC(hinting),              
 88       TOOLS_ARG_FIELD_DESC(cut),                  
 89       TOOLS_ARG_FIELD_DESC(painting),  //20       
 90                                                   
 91       TOOLS_ARG_FIELD_DESC(hatching),             
 92       TOOLS_ARG_FIELD_DESC(projection),           
 93       TOOLS_ARG_FIELD_DESC(font),                 
 94       TOOLS_ARG_FIELD_DESC(multi_node_limit),     
 95       TOOLS_ARG_FIELD_DESC(divisions),            
 96       TOOLS_ARG_FIELD_DESC(rotation_steps),       
 97       TOOLS_ARG_FIELD_DESC(spacing),              
 98       TOOLS_ARG_FIELD_DESC(angle),                
 99       TOOLS_ARG_FIELD_DESC(scale),                
100       TOOLS_ARG_FIELD_DESC(offset),  //30         
101                                                   
102       TOOLS_ARG_FIELD_DESC(strip_width),          
103       TOOLS_ARG_FIELD_DESC(visible),              
104       TOOLS_ARG_FIELD_DESC(bar_offset),           
105       TOOLS_ARG_FIELD_DESC(bar_width),            
106       TOOLS_ARG_FIELD_DESC(editable),             
107       TOOLS_ARG_FIELD_DESC(pickable),             
108       TOOLS_ARG_FIELD_DESC(automated),            
109       TOOLS_ARG_FIELD_DESC(options),              
110       TOOLS_ARG_FIELD_DESC(color_mapping),        
111       TOOLS_ARG_FIELD_DESC(enforced),   //40      
112                                                   
113       TOOLS_ARG_FIELD_DESC(translation),          
114       TOOLS_ARG_FIELD_DESC(coloring),             
115       TOOLS_ARG_FIELD_DESC(title)                 
116     );                                            
117     return s_v;                                   
118   }                                               
119 private:                                          
120   void add_fields(){                              
121     add_field(&color);                            
122     add_field(&highlight_color);                  
123     add_field(&back_color);                       
124     add_field(&line_width);                       
125     add_field(&marker_size);                      
126     add_field(&point_size);                       
127     add_field(&font_size);                        
128     add_field(&font_modeling);                    
129     add_field(&front_face);                       
130     add_field(&line_pattern);                     
131     add_field(&marker_style);                     
132     add_field(&area_style);                       
133     add_field(&modeling);                         
134     add_field(&light_model);                      
135     add_field(&tick_modeling);                    
136     add_field(&encoding);                         
137     add_field(&smoothing);                        
138     add_field(&hinting);                          
139     add_field(&cut);                              
140     add_field(&painting);                         
141     add_field(&hatching);                         
142     add_field(&projection);                       
143     add_field(&font);                             
144     add_field(&multi_node_limit);                 
145     add_field(&divisions);                        
146     add_field(&rotation_steps);                   
147     add_field(&spacing);                          
148     add_field(&angle);                            
149     add_field(&scale);                            
150     add_field(&offset);                           
151     add_field(&strip_width);                      
152     add_field(&visible);                          
153     add_field(&bar_offset);                       
154     add_field(&bar_width);                        
155     add_field(&editable);                         
156     add_field(&pickable);                         
157     add_field(&automated);                        
158     add_field(&options);                          
159     add_field(&color_mapping);                    
160     add_field(&enforced);                         
161     add_field(&translation);                      
162     add_field(&coloring);                         
163     add_field(&title);                            
164   }                                               
165 public:                                           
166   style()                                         
167   :parent()                                       
168   ,color(colorf_black())                          
169   ,highlight_color(colorf_black())                
170   ,back_color(colorf_white())                     
171   ,line_width(1)                                  
172   ,marker_size(1)                                 
173   ,point_size(1)                                  
174   ,font_size(10)                                  
175   ,font_modeling(font_filled)                     
176   ,front_face(winding_ccw)                        
177   ,line_pattern(line_solid)                       
178   ,marker_style(marker_dot)                       
179   ,area_style(area_solid)                         
180   ,modeling(modeling_boxes())                     
181   ,light_model(light_model_phong())               
182   ,tick_modeling(tick_modeling_hippo())           
183   ,encoding(encoding_none())                      
184   ,smoothing(false)                               
185   ,hinting(false)                                 
186   ,cut()                                          
187   ,painting(painting_uniform)                     
188   ,hatching(hatching_none)                        
189   ,projection(projection_none)                    
190   ,font(font_hershey())                           
191   ,multi_node_limit(style_parser::no_limit())     
192   ,divisions(510) //Same as ROOT/TAttAxis         
193   ,rotation_steps(24) //Same as SbPolyhedron d    
194   ,spacing(0.05F)                                 
195   ,angle(fpi()/4.0F)                              
196   ,scale(1)                                       
197   ,offset(0)                                      
198   ,strip_width(0)                                 
199   ,visible(true)                                  
200   ,bar_offset(0.25F)                              
201   ,bar_width(0.5F)                                
202   ,editable(false)                                
203   ,pickable(false)                                
204   ,automated(true)                                
205   ,options()                                      
206   ,color_mapping()                                
207   ,enforced(false)                                
208   ,translation(vec3f(0,0,0))                      
209   ,coloring()                                     
210   ,title()                                        
211   {                                               
212     add_fields();                                 
213   }                                               
214   virtual ~style(){}                              
215 public:                                           
216   style(const style& a_from)                      
217   :parent(a_from)                                 
218   ,color(a_from.color)                            
219   ,highlight_color(a_from.highlight_color)        
220   ,back_color(a_from.back_color)                  
221   ,line_width(a_from.line_width)                  
222   ,marker_size(a_from.marker_size)                
223   ,point_size(a_from.point_size)                  
224   ,font_size(a_from.font_size)                    
225   ,font_modeling(a_from.font_modeling)            
226   ,front_face(a_from.front_face)                  
227   ,line_pattern(a_from.line_pattern)              
228   ,marker_style(a_from.marker_style)              
229   ,area_style(a_from.area_style)                  
230   ,modeling (a_from.modeling )                    
231   ,light_model(a_from.light_model)                
232   ,tick_modeling(a_from.tick_modeling)            
233   ,encoding(a_from.encoding)                      
234   ,smoothing(a_from.smoothing)                    
235   ,hinting(a_from.hinting)                        
236   ,cut(a_from.cut)                                
237   ,painting(a_from.painting)                      
238   ,hatching(a_from.hatching)                      
239   ,projection(a_from.projection)                  
240   ,font(a_from.font)                              
241   ,multi_node_limit(a_from.multi_node_limit)      
242   ,divisions(a_from.divisions)                    
243   ,rotation_steps(a_from.rotation_steps)          
244   ,spacing(a_from.spacing)                        
245   ,angle(a_from.angle)                            
246   ,scale(a_from.scale)                            
247   ,offset(a_from.offset)                          
248   ,strip_width(a_from.strip_width)                
249   ,visible(a_from.visible)                        
250   ,bar_offset(a_from.bar_offset)                  
251   ,bar_width(a_from.bar_width)                    
252   ,editable(a_from.editable)                      
253   ,pickable(a_from.pickable)                      
254   ,automated(a_from.automated)                    
255   ,options(a_from.options)                        
256   ,color_mapping(a_from.color_mapping)            
257   ,enforced(a_from.enforced)                      
258   ,translation(a_from.translation)                
259   ,coloring(a_from.coloring)                      
260   ,title(a_from.title)                            
261   {                                               
262     add_fields();                                 
263   }                                               
264   style& operator=(const style& a_from){          
265     parent::operator=(a_from);                    
266                                                   
267     color = a_from.color;                         
268     highlight_color = a_from.highlight_color;     
269     back_color = a_from.back_color;               
270     line_width = a_from.line_width;               
271     marker_size = a_from.marker_size;             
272     point_size = a_from.point_size;               
273     font_size = a_from.font_size;                 
274     font_modeling = a_from.font_modeling;         
275     front_face = a_from.front_face;               
276     line_pattern = a_from.line_pattern;           
277     marker_style = a_from.marker_style;           
278     area_style = a_from.area_style;               
279     modeling  = a_from.modeling ;                 
280     light_model = a_from.light_model;             
281     tick_modeling = a_from.tick_modeling;         
282     encoding = a_from.encoding;                   
283     smoothing = a_from.smoothing;                 
284     hinting = a_from.hinting;                     
285     cut = a_from.cut;                             
286     painting = a_from.painting;                   
287     hatching = a_from.hatching;                   
288     projection = a_from.projection;               
289     font = a_from.font;                           
290     multi_node_limit = a_from.multi_node_limit    
291     divisions = a_from.divisions;                 
292     rotation_steps = a_from.rotation_steps;       
293     spacing = a_from.spacing;                     
294     angle = a_from.angle;                         
295     scale = a_from.scale;                         
296     offset = a_from.offset;                       
297     strip_width = a_from.strip_width;             
298     visible = a_from.visible;                     
299     bar_offset = a_from.bar_offset;               
300     bar_width = a_from.bar_width;                 
301     editable = a_from.editable;                   
302     pickable = a_from.pickable;                   
303     automated = a_from.automated;                 
304     options = a_from.options;                     
305     color_mapping = a_from.color_mapping;         
306     enforced = a_from.enforced;                   
307     translation = a_from.translation;             
308     coloring = a_from.coloring;                   
309     title = a_from.title;                         
310                                                   
311     return *this;                                 
312   }                                               
313 public:                                           
314   void reset() {                                  
315     color = colorf_black();                       
316     highlight_color = colorf_black();             
317     back_color = colorf_white();                  
318     line_width = 1;                               
319     marker_size = 1;                              
320     point_size = 1;                               
321     font_size = 10;                               
322     font_modeling = font_filled;                  
323     front_face = winding_ccw;                     
324     line_pattern = line_solid;                    
325     marker_style = marker_dot;                    
326     area_style = area_solid;                      
327     modeling = modeling_boxes();                  
328     light_model = light_model_phong();            
329     tick_modeling = tick_modeling_hippo();        
330     encoding = encoding_none();                   
331     smoothing = false;                            
332     hinting = false;                              
333     cut = "";                                     
334     painting = painting_uniform;                  
335     hatching = hatching_none;                     
336     projection = projection_none;                 
337     font = font_hershey();                        
338     multi_node_limit = style_parser::no_limit(    
339     divisions = 510;                              
340     rotation_steps = 24;                          
341     spacing = 0.05F;                              
342     angle = fpi()/4.0F;                           
343     scale = 1;                                    
344     offset = 0;                                   
345     strip_width = 0;                              
346     visible = true;                               
347     bar_offset = 0.25F;                           
348     bar_width = 0.5F;                             
349     editable = false;                             
350     pickable = false;                             
351     automated = true;                             
352     options = "";                                 
353     color_mapping = "";                           
354     enforced = false;                             
355     translation = vec3f(0,0,0);                   
356     coloring = "";                                
357     title = "";                                   
358   }                                               
359                                                   
360   bool from_string(std::ostream& a_out,const c    
361     style_parser sp;                              
362                                                   
363     sp.color(color.value());                      
364     sp.highlight_color(highlight_color.value()    
365     sp.back_color(back_color.value());            
366     sp.line_width(line_width.value());            
367     sp.marker_size(marker_size.value());          
368     sp.point_size(point_size.value());            
369     sp.font_size(font_size.value());              
370     sp.font_modeling(font_modeling.value());      
371     sp.front_face(front_face.value());            
372     sp.line_pattern(line_pattern.value());        
373     sp.marker_style(marker_style.value());        
374     sp.area_style(area_style.value());            
375     sp.modeling(modeling.value());                
376     sp.light_model(light_model.value());          
377     sp.tick_modeling(tick_modeling.value());      
378     sp.encoding(encoding.value());                
379     sp.smoothing(smoothing.value());              
380     sp.hinting(hinting.value());                  
381     sp.cut(cut.value());                          
382     sp.painting(painting.value());                
383     sp.hatching(hatching.value());                
384     sp.projection(projection.value());            
385     sp.font(font.value());                        
386     sp.multi_node_limit(multi_node_limit.value    
387     sp.divisions(divisions.value());              
388     sp.rotation_steps(rotation_steps.value());    
389   //sp.transparency(transparency.value());        
390   //sp.back_transparency(back_transparency.val    
391     sp.spacing(spacing.value());                  
392     sp.angle(angle.value());                      
393     sp.scale(scale.value());                      
394     sp.offset(offset.value());                    
395     sp.strip_width(strip_width.value());          
396     sp.visible(visible.value());                  
397     sp.bar_offset(bar_offset.value());            
398     sp.bar_width(bar_width.value());              
399     sp.editable(editable.value());                
400     sp.pickable(pickable.value());                
401     sp.automated(automated.value());              
402     sp.options(options.value());                  
403     sp.color_mapping(color_mapping.value());      
404     sp.enforced(enforced.value());                
405     sp.translation(translation.value());          
406     sp.coloring(coloring.value());                
407     sp.title(title.value());                      
408                                                   
409     //if(!sp.parse(a_s,style_parser::def_error    
410     //  return false;                             
411                                                   
412     if(!sp.parse(a_out,a_cmaps,a_s)) {            
413       a_out << "tools::sg::style::from_string     
414             << " parse failed."                   
415             << std::endl;                         
416       return false;                               
417     }                                             
418                                                   
419     color.value(sp.color());                      
420     highlight_color.value(sp.highlight_color()    
421     back_color.value(sp.back_color());            
422     line_width.value(sp.line_width());            
423     marker_size.value(sp.marker_size());          
424     point_size.value(sp.point_size());            
425     font_size.value(sp.font_size());              
426     font_modeling.value(sp.font_modeling());      
427     front_face = sp.front_face();                 
428     line_pattern.value(sp.line_pattern());        
429     marker_style.value(sp.marker_style());        
430     area_style.value(sp.area_style());            
431     modeling.value(sp.modeling());                
432     light_model.value(sp.light_model());          
433     tick_modeling.value(sp.tick_modeling());      
434     encoding.value(sp.encoding());                
435     smoothing.value(sp.smoothing());              
436     hinting.value(sp.hinting());                  
437     cut.value(sp.cut());                          
438     painting.value(sp.painting());                
439     hatching.value(sp.hatching());                
440     projection.value(sp.projection());            
441     font.value(sp.font());                        
442     multi_node_limit.value(sp.multi_node_limit    
443     divisions.value(sp.divisions());              
444     rotation_steps.value(sp.rotation_steps());    
445   //transparency.value(sp.transparency());        
446   //back_transparency.value(sp.back_transparen    
447     spacing.value(sp.spacing());                  
448     angle.value(sp.angle());                      
449     scale.value(sp.scale());                      
450     offset.value(sp.offset());                    
451     strip_width.value(sp.strip_width());          
452     visible.value(sp.visible());                  
453     bar_offset.value(sp.bar_offset());            
454     bar_width.value(sp.bar_width());              
455     editable.value(sp.editable());                
456     pickable.value(sp.pickable());                
457     automated.value(sp.automated());              
458     options.value(sp.options());                  
459     color_mapping.value(sp.color_mapping());      
460     enforced.value(sp.enforced());                
461     translation.value(sp.translation());          
462     coloring.value(sp.coloring());                
463     title.value(sp.title());                      
464                                                   
465     return true;                                  
466   }                                               
467                                                   
468 };                                                
469                                                   
470 }}                                                
471                                                   
472 #endif