g4tools  5.4.0
style_parser
Go to the documentation of this file.
1 // Copyright (C) 2010, Guy Barrand. All rights reserved.
2 // See the file tools.license for terms.
3 
4 #ifndef tools_sg_style_parser
5 #define tools_sg_style_parser
6 
7 #include "senum"
8 #include "strings"
9 #include "style_colormap"
10 
11 #include "../mathf"
12 #include "../lina/vec3f"
13 #include "../sout"
14 #include "../colorfs"
15 #include "../get_lines"
16 
17 namespace tools {
18 namespace sg {
19 
20 class style_parser {
21 #ifdef TOOLS_MEM
23 #endif
24 public:
26  :m_color(0,0,0)
27  ,m_highlight_color(0,0,0)
28  ,m_back_color(1,1,1)
29  ,m_width(1)
30  ,m_line_width(1)
31  ,m_marker_size(1)
32  ,m_point_size(1)
33  ,m_font_size(10)
43  ,m_smoothing(false)
44  ,m_hinting(false)
45  ,m_cut()
49  ,m_font("default")
51  ,m_divisions(510) //Same as CERN-ROOT/TAttAxis
52  ,m_rotation_steps(24) //Same as SbPolyhedron default.
53  ,m_back_shadow(0)
54  ,m_spacing(0.05F)
55  ,m_angle(fpi()/4.0F)
56  ,m_scale(1)
57  ,m_offset(0)
58  ,m_strip_width(0)
59  ,m_visible(true)
60  ,m_bar_offset(0.25F)
61  ,m_bar_width(0.5F)
62  ,m_editable(false)
63  ,m_automated(true)
64  ,m_options()
66  ,m_enforced(false)
67  ,m_translation(0,0,0)
69  ,m_hjust(left)
70  ,m_vjust(bottom)
71  ,m_coloring()
72  ,m_title()
73  ,m_pickable(false)
74  {
75 #ifdef TOOLS_MEM
76  mem::increment(s_class().c_str());
77 #endif
78  }
79 
80  virtual ~style_parser(){
81 #ifdef TOOLS_MEM
82  mem::decrement(s_class().c_str());
83 #endif
84  }
85 public:
86  style_parser(const style_parser& a_from)
87  :m_color(a_from.m_color)
89  ,m_back_color(a_from.m_back_color)
90  ,m_width(a_from.m_width)
91  ,m_line_width(a_from.m_line_width)
93  ,m_point_size(a_from.m_point_size)
94  ,m_font_size(a_from.m_font_size)
96  ,m_pattern(a_from.m_pattern)
99  ,m_area_style(a_from.m_area_style)
100  ,m_modeling (a_from.m_modeling )
103  ,m_encoding(a_from.m_encoding)
104  ,m_smoothing(a_from.m_smoothing)
105  ,m_hinting(a_from.m_hinting)
106  ,m_cut(a_from.m_cut)
107  ,m_painting(a_from.m_painting)
108  ,m_hatching(a_from.m_hatching)
109  ,m_projection(a_from.m_projection)
110  ,m_font(a_from.m_font)
112  ,m_divisions(a_from.m_divisions)
115  ,m_spacing(a_from.m_spacing)
116  ,m_angle(a_from.m_angle)
117  ,m_scale(a_from.m_scale)
118  ,m_offset(a_from.m_offset)
120  ,m_visible(a_from.m_visible)
121  ,m_bar_offset(a_from.m_bar_offset)
122  ,m_bar_width(a_from.m_bar_width)
123  ,m_editable(a_from.m_editable)
124  ,m_automated(a_from.m_automated)
125  ,m_options(a_from.m_options)
127  ,m_enforced(a_from.m_enforced)
129  ,m_front_face(a_from.m_front_face)
130  ,m_hjust(a_from.m_hjust)
131  ,m_vjust(a_from.m_vjust)
132  ,m_coloring(a_from.m_coloring)
133  ,m_title(a_from.m_title)
134  ,m_pickable(a_from.m_pickable)
135  {
136 #ifdef TOOLS_MEM
137  mem::increment(s_class().c_str());
138 #endif
139  }
140 
142  copy(a_from);
143  return *this;
144  }
145 public:
146  static int no_limit() {return (-1);}
147 public:
148  void copy(const style_parser& a_from){
149  m_color = a_from.m_color;
151  m_back_color = a_from.m_back_color;
152  m_width = a_from.m_width;
153  m_line_width = a_from.m_line_width;
154  m_marker_size = a_from.m_marker_size;
155  m_point_size = a_from.m_point_size;
156  m_font_size = a_from.m_font_size;
158  m_pattern = a_from.m_pattern;
161  m_area_style = a_from.m_area_style;
162  m_modeling = a_from.m_modeling;
163  m_light_model = a_from.m_light_model;
165  m_encoding = a_from.m_encoding;
166  m_smoothing = a_from.m_smoothing;
167  m_hinting = a_from.m_hinting;
168  m_cut = a_from.m_cut;
169  m_painting = a_from.m_painting;
170  m_hatching = a_from.m_hatching;
171  m_projection = a_from.m_projection;
172  m_font = a_from.m_font;
174  m_divisions = a_from.m_divisions;
176  m_back_shadow = a_from.m_back_shadow;
177  m_spacing = a_from.m_spacing;
178  m_angle = a_from.m_angle;
179  m_scale = a_from.m_scale;
180  m_offset = a_from.m_offset;
181  m_strip_width = a_from.m_strip_width;
182  m_visible = a_from.m_visible;
183  m_bar_offset = a_from.m_bar_offset;
184  m_bar_width = a_from.m_bar_width;
185  m_editable = a_from.m_editable;
186  m_automated = a_from.m_automated;
187  m_options = a_from.m_options;
189  m_enforced = a_from.m_enforced;
190  m_translation = a_from.m_translation;
191  m_front_face = a_from.m_front_face;
192  m_hjust = a_from.m_hjust;
193  m_vjust = a_from.m_vjust;
194  m_coloring = a_from.m_coloring;
195  m_title = a_from.m_title;
196  m_pickable = a_from.m_pickable;
197  }
198 
199  bool equal(const style_parser& a_from){
200  if(m_width!=a_from.m_width) return false;
201  if(m_line_width!=a_from.m_line_width) return false;
202  if(m_marker_size!=a_from.m_marker_size) return false;
203  if(m_point_size!=a_from.m_point_size) return false;
204  if(m_font_size!=a_from.m_font_size) return false;
205  if(m_font_modeling!=a_from.m_font_modeling) return false;
206  if(m_pattern!=a_from.m_pattern) return false;
207  if(m_line_pattern!=a_from.m_line_pattern) return false;
208  if(m_marker_style!=a_from.m_marker_style) return false;
209  if(m_area_style!=a_from.m_area_style) return false;
210  if(m_smoothing!=a_from.m_smoothing) return false;
211  if(m_hinting!=a_from.m_hinting) return false;
212  if(m_painting!=a_from.m_painting) return false;
213  if(m_hatching!=a_from.m_hatching) return false;
214  if(m_projection!=a_from.m_projection) return false;
215  if(m_multi_node_limit!=a_from.m_multi_node_limit) return false;
216  if(m_divisions!=a_from.m_divisions) return false;
217  if(m_rotation_steps!=a_from.m_rotation_steps) return false;
218  if(m_back_shadow!=a_from.m_back_shadow) return false;
219  if(m_spacing!=a_from.m_spacing) return false;
220  if(m_angle!=a_from.m_angle) return false;
221  if(m_scale!=a_from.m_scale) return false;
222  if(m_offset!=a_from.m_offset) return false;
223  if(m_strip_width!=a_from.m_strip_width) return false;
224  if(m_visible!=a_from.m_visible) return false;
225  if(m_bar_offset!=a_from.m_bar_offset) return false;
226  if(m_bar_width!=a_from.m_bar_width) return false;
227  if(m_editable!=a_from.m_editable) return false;
228  if(m_automated!=a_from.m_automated) return false;
229  if(m_enforced!=a_from.m_enforced) return false;
230 
231  //color
232  if(m_color!=a_from.m_color) return false;
233  if(m_highlight_color!=a_from.m_highlight_color) return false;
234  if(m_back_color!=a_from.m_back_color) return false;
235 
236  //std::string
237  if(m_modeling!=a_from.m_modeling) return false;
238  if(m_light_model!=a_from.m_light_model) return false;
239  if(m_tick_modeling!=a_from.m_tick_modeling) return false;
240  if(m_encoding!=a_from.m_encoding) return false;
241  if(m_cut!=a_from.m_cut) return false;
242  if(m_font!=a_from.m_font) return false;
243  if(m_options!=a_from.m_options) return false;
244  if(m_color_mapping!=a_from.m_color_mapping) return false;
245 
246  if(m_translation!=a_from.m_translation) return false;
247 
248  if(m_front_face!=a_from.m_front_face) return false;
249 
250  if(m_hjust!=a_from.m_hjust) return false;
251  if(m_vjust!=a_from.m_vjust) return false;
252 
253  if(m_coloring!=a_from.m_coloring) return false;
254  if(m_title!=a_from.m_title) return false;
255  if(m_pickable!=a_from.m_pickable) return false;
256 
257  return true;
258  }
259 
260  virtual void reset(){ //virtual because of SoGC
261  m_color = colorf_black();
262  m_highlight_color = colorf_lightgrey();
263  m_back_color = colorf_white();
264  m_width = 1;
265  m_line_width = 1;
266  m_marker_size = 1;
267  m_point_size = 1;
268  m_font_size = 10;
278  m_smoothing = false;
279  m_hinting = false;
280  m_cut = "";
284  m_font = "default";
286  m_back_shadow = 0;
287  m_divisions = 510;
288  m_rotation_steps = 24;
289  m_spacing = 0.05F;
290  m_angle = fpi()/4;
291  m_scale = 1;
292  m_offset = 0;
293  m_strip_width = 0;
294  m_visible = true;
295  m_bar_offset = 0.25F;
296  m_bar_width = 0.5F;
297  m_editable = false;
298  m_automated = true;
299  m_options = "";
300  m_color_mapping = "";
301  m_enforced = false;
302  m_translation = vec3f(0,0,0);
304  m_hjust = left;
305  m_vjust = bottom;
306  m_coloring = "";
307  m_title = "";
308  m_pickable = false;
309  }
310 
311  std::string tos() const{
312  char ss[40 * 32];
313  snpf(ss,sizeof(ss),
314 "color %g %g %g\n\
315 highlight_color %g %g %g\n\
316 back_color %g %g %g\n\
317 width %g\n\
318 line_width %g\n\
319 marker_size %g\n\
320 point_size %g\n\
321 font_size %g\n\
322 pattern %x\n\
323 line_pattern %x\n\
324 multi_node_limit %d\n\
325 back_shadow %g\n\
326 divisions %d\n\
327 rotation_steps %d\n\
328 angle %g\n\
329 scale %g\n\
330 offset %g\n\
331 strip_width %g\n\
332 spacing %g\n\
333 bar_offset %g\n\
334 bar_width %g\n\
335 translation %g %g %g"
336  ,m_color[0],m_color[1],m_color[2]
339  ,m_width
340  ,m_line_width
342  ,m_point_size
343  ,m_font_size
344  ,m_pattern
348  ,m_divisions
350  ,m_angle
351  ,m_scale
352  ,m_offset
354  ,m_spacing
355  ,m_bar_offset
356  ,m_bar_width
358 
359  std::string lf("\n");
360  std::string s(ss);
361 
362  s += lf;
363  s += "smoothing ";
364  s += (m_smoothing?"true":"false");
365 
366  s += lf;
367  s += "hinting ";
368  s += (m_hinting?"true":"false");
369 
370  s += lf;
371  s += "enforced ";
372  s += (m_enforced?"true":"false");
373 
374  s += lf;
375  s += "visible ";
376  s += (m_visible?"true":"false");
377 
378  s += lf;
379  s += "editable ";
380  s += (m_editable?"true":"false");
381 
382  s += lf;
383  s += "automated ";
384  s += (m_automated?"true":"false");
385 
386  s += lf;
387  s += "pickable ";
388  s += (m_pickable?"true":"false");
389 
390  s += lf;
391  s += "marker_style ";
393 
394  s += lf;
395  s += "area_style ";
397 
398  s += lf;
399  s += "modeling ";
400  s += m_modeling;
401 
402  s += lf;
403  s += "coloring ";
404  s += m_coloring;
405 
406  s += lf;
407  s += "title ";
408  s += m_title;
409 
410  s += lf;
411  s += "light_model ";
412  s += m_light_model;
413 
414  s += lf;
415  s += "tick_modeling ";
416  s += m_tick_modeling;
417 
418  s += lf;
419  s += "encoding ";
420  s += m_encoding;
421 
422  s += lf;
423  s += "cut ";
424  s += m_cut;
425 
426  s += lf;
427  s += "painting ";
429 
430  s += lf;
431  s += "hatching ";
433 
434  s += lf;
435  s += "projection ";
437 
438  s += lf;
439  s += "font ";
440  s += m_font;
441 
443  s += lf;
444  s += "font_modeling ";
445  s += s_font_outline();
446  } else if(m_font_modeling==font_filled) {
447  s += lf;
448  s += "font_modeling ";
449  s += s_font_filled();
450  } else if(m_font_modeling==font_pixmap) {
451  s += lf;
452  s += "font_modeling ";
453  s += s_font_pixmap();
454  }
455 
456  s += lf;
457  s += "options ";
458  s += m_options;
459 
460  s += lf;
461  s += "color_mapping ";
462  s += m_color_mapping;
463 
464  s += lf;
465  s += "front_face ";
466  s += (m_front_face==winding_ccw?"ccw":"cw");
467 
468  s += lf;
469  s += "hjust ";
470  s += shjust(m_hjust);
471 
472  s += lf;
473  s += "vjust ";
474  s += svjust(m_vjust);
475 
476  return s;
477  }
478 
479  void color(const colorf& a_v){m_color = a_v;}
480  colorf color() const {return m_color;}
481 
482  void highlight_color(const colorf& a_v){m_highlight_color = a_v;}
484 
485  void back_color(const colorf& a_v){m_back_color = a_v;}
486  colorf back_color() const {return m_back_color;}
487 
488  void width(float a_v){m_width = a_v;}
489  float width() const {return m_width;}
490 
491  void line_width(float a_v){m_line_width = a_v;}
492  float line_width() const {return m_line_width;}
493 
494  float back_shadow() const {return m_back_shadow;}
495  void back_shadow(float a_v) {m_back_shadow = a_v;}
496 
499 
500  void marker_size(float a_v){m_marker_size = a_v;}
501  float marker_size() const {return m_marker_size;}
502 
503  void point_size(float a_v){m_point_size = a_v;}
504  float point_size() const {return m_point_size;}
505 
506  void font_size(float a_v){m_font_size = a_v;}
507  float font_size() const {return m_font_size;}
508 
511 
514 
515  void modeling(const std::string& a_v){m_modeling = a_v;}
516  const std::string& modeling() const {return m_modeling ;}
517 
518  void light_model(const std::string& a_v){m_light_model = a_v;}
519  const std::string& light_model() const {return m_light_model;}
520 
521  void tick_modeling(const std::string& a_v){m_tick_modeling = a_v;}
522  const std::string& tick_modeling() const {return m_tick_modeling;}
523 
524  void encoding(const std::string& a_v){m_encoding = a_v;}
525  const std::string& encoding() const {return m_encoding;}
526 
527  void smoothing(bool a_v){m_smoothing = a_v;}
528  bool smoothing() const {return m_smoothing;}
529 
530  void hinting(bool a_v){m_hinting = a_v;}
531  bool hinting() const {return m_hinting;}
532 
535 
538 
541 
542  void pattern(lpat a_v){m_pattern = a_v;}
543  lpat pattern() const {return m_pattern;}
544 
545  void line_pattern(lpat a_v){m_line_pattern = a_v;}
546  lpat line_pattern() const {return m_line_pattern;}
547 
548  void font(const std::string& a_v){m_font = a_v;}
549  const std::string& font() const {return m_font;}
550 
551  void divisions(int a_v){m_divisions = a_v;}
552  int divisions() const {return m_divisions;}
553 
554  void rotation_steps(unsigned int a_v){m_rotation_steps = a_v;}
555  unsigned int rotation_steps() const {return m_rotation_steps;}
556 
557  void offset(float a_v){m_offset = a_v;}
558  float offset() const {return m_offset;}
559 
560  void strip_width(float a_v){m_strip_width = a_v;}
561  float strip_width() const {return m_strip_width;}
562 
563  void angle(float a_v){m_angle = a_v;}
564  float angle() const {return m_angle;}
565 
566  void scale(float a_v){m_scale = a_v;}
567  float scale() const {return m_scale;}
568 
569  void bar_offset(float a_v){m_bar_offset = a_v;}
570  float bar_offset() const {return m_bar_offset;}
571 
572  void bar_width(float a_v){m_bar_width = a_v;}
573  float bar_width() const {return m_bar_width;}
574 
575  void multi_node_limit(int a_v){m_multi_node_limit = a_v;}
576  int multi_node_limit() const {return m_multi_node_limit;}
577 
578  void spacing(float a_v){m_spacing = a_v;}
579  float spacing() const {return m_spacing;}
580 
581  void visible(bool a_v){m_visible = a_v;}
582  bool visible() const{return m_visible;}
583 
584  void editable(bool a_v){m_editable = a_v;}
585  bool editable() const{return m_editable;}
586 
587  void automated(bool a_v){m_automated = a_v;}
588  bool automated() const{return m_automated;}
589 
590  void cut(const std::string& a_v){m_cut = a_v;}
591  const std::string& cut() const {return m_cut;}
592 
593  void options(const std::string& a_v){m_options = a_v;}
594  const std::string& options() const{return m_options;}
595 
596  void color_mapping(const std::string& a_v){m_color_mapping = a_v;}
597  const std::string& color_mapping() const{return m_color_mapping;}
598 
599  void enforced(bool a_v){m_enforced = a_v;}
600  bool enforced() const{return m_enforced;}
601 
602  void translation(const vec3f& a_v){m_translation = a_v;}
603  vec3f translation() const {return m_translation;}
604 
607 
608  void hjust(sg::hjust a_v){m_hjust = a_v;}
609  sg::hjust hjust() const {return m_hjust;}
610 
611  void vjust(sg::vjust a_v){m_vjust = a_v;}
612  sg::vjust vjust() const {return m_vjust;}
613 
614  void coloring(const std::string& a_v){m_coloring = a_v;}
615  const std::string& coloring() const {return m_coloring;}
616 
617  void title(const std::string& a_v){m_title = a_v;}
618  const std::string& title() const {return m_title;}
619 
620  void pickable(bool a_v){m_pickable = a_v;}
621  bool pickable() const {return m_pickable;}
622 
623 public:
624  bool parse(std::ostream& a_out,const cmaps_t& a_cmaps,const std::string& a_s){
625  // a_s = list of "name value" separated by \n
626  //::printf("debug : style_parser::parse : \"%s\"\n",a_s.c_str());
627  std::vector<std::string> lines;
628  get_lines(a_s,lines);
629 
630  tools_vforcit(std::string,lines,it) {
631  const std::string& line = *it;
632  if(line.empty()) continue;
633  if(line=="reset") {
634  reset();
635  continue;
636  }
637  std::vector<std::string> ws;
638  words(line," ",false,ws);
639  size_t wordn = ws.size();
640  if(!wordn) {
641  a_out << "style_parser::parse :"
642  << " in " << sout(a_s)
643  << " : " << sout(line)
644  << " has a bad word count (at least two expected)."
645  << std::endl;
646  return false;
647  }
648  const std::string& word0 = ws[0];
649  if(word0=="color") {
650  if(wordn==2) {
651  const std::string& word1 = ws[1];
652  if(!find_color(a_cmaps,word1,m_color)) {
653  a_out << "style_parser::parse :"
654  << " in " << sout(a_s)
655  << " : " << sout(word1)
656  << " not a color."
657  << std::endl;
658  return false;
659  }
660  } else if (wordn==4) {
661  const std::string& rs = ws[1];
662  float r;
663  if(!to<float>(rs,r)) {
664  a_out << "style_parser::parse :"
665  << " in " << sout(a_s)
666  << " : " << sout(rs)
667  << " not a number."
668  << std::endl;
669  return false;
670  }
671  const std::string& gs = ws[2];
672  float g;
673  if(!to<float>(gs,g)) {
674  a_out << "style_parser::parse :"
675  << " in " << sout(a_s)
676  << " : " << sout(gs)
677  << " not a number."
678  << std::endl;
679  return false;
680  }
681  const std::string& bs = ws[3];
682  float b;
683  if(!to<float>(bs,b)) {
684  a_out << "style_parser::parse :"
685  << " in " << sout(a_s)
686  << " : " << sout(bs)
687  << " not a number."
688  << std::endl;
689  return false;
690  }
691  m_color.set_value(r,g,b,1);
692 
693  } else if (wordn==5) {
694  const std::string& rs = ws[1];
695  float r;
696  if(!to<float>(rs,r)) {
697  a_out << "style_parser::parse :"
698  << " in " << sout(a_s)
699  << " : " << sout(rs)
700  << " not a number."
701  << std::endl;
702  return false;
703  }
704  const std::string& gs = ws[2];
705  float g;
706  if(!to<float>(gs,g)) {
707  a_out << "style_parser::parse :"
708  << " in " << sout(a_s)
709  << " : " << sout(gs)
710  << " not a number."
711  << std::endl;
712  return false;
713  }
714  const std::string& bs = ws[3];
715  float b;
716  if(!to<float>(bs,b)) {
717  a_out << "style_parser::parse :"
718  << " in " << sout(a_s)
719  << " : " << sout(bs)
720  << " not a number."
721  << std::endl;
722  return false;
723  }
724  const std::string& as = ws[4];
725  float a;
726  if(!to<float>(as,a)) {
727  a_out << "style_parser::parse :"
728  << " in " << sout(a_s)
729  << " : " << sout(as)
730  << " not a number."
731  << std::endl;
732  return false;
733  }
734  m_color.set_value(r,g,b,a);
735 
736  } else {
737  a_out << "style_parser::parse :"
738  << " in " << sout(a_s)
739  << " : " << sout(line)
740  << " has a bad word count (two or four expected)."
741  << std::endl;
742  return false;
743  }
744 
745  } else if(word0=="highlight_color") {
746  if(wordn==2) {
747  const std::string& word1 = ws[1];
748  if(!find_color(a_cmaps,word1,m_highlight_color)) {
749  a_out << "style_parser::parse :"
750  << " in " << sout(a_s)
751  << " : " << sout(word1)
752  << " not a color."
753  << std::endl;
754  return false;
755  }
756  } else if (wordn==4) {
757  const std::string& rs = ws[1];
758  float r;
759  if(!to<float>(rs,r)) {
760  a_out << "style_parser::parse :"
761  << " in " << sout(a_s)
762  << " : " << sout(rs)
763  << " not a number."
764  << std::endl;
765  return false;
766  }
767  const std::string& gs = ws[2];
768  float g;
769  if(!to<float>(gs,g)) {
770  a_out << "style_parser::parse :"
771  << " in " << sout(a_s)
772  << " : " << sout(gs)
773  << " not a number."
774  << std::endl;
775  return false;
776  }
777  const std::string& bs = ws[3];
778  float b;
779  if(!to<float>(bs,b)) {
780  a_out << "style_parser::parse :"
781  << " in " << sout(a_s)
782  << " : " << sout(bs)
783  << " not a number."
784  << std::endl;
785  return false;
786  }
787  m_highlight_color.set_value(r,g,b,1);
788 
789  } else if (wordn==5) {
790  const std::string& rs = ws[1];
791  float r;
792  if(!to<float>(rs,r)) {
793  a_out << "style_parser::parse :"
794  << " in " << sout(a_s)
795  << " : " << sout(rs)
796  << " not a number."
797  << std::endl;
798  return false;
799  }
800  const std::string& gs = ws[2];
801  float g;
802  if(!to<float>(gs,g)) {
803  a_out << "style_parser::parse :"
804  << " in " << sout(a_s)
805  << " : " << sout(gs)
806  << " not a number."
807  << std::endl;
808  return false;
809  }
810  const std::string& bs = ws[3];
811  float b;
812  if(!to<float>(bs,b)) {
813  a_out << "style_parser::parse :"
814  << " in " << sout(a_s)
815  << " : " << sout(bs)
816  << " not a number."
817  << std::endl;
818  return false;
819  }
820  const std::string& as = ws[4];
821  float a;
822  if(!to<float>(as,a)) {
823  a_out << "style_parser::parse :"
824  << " in " << sout(a_s)
825  << " : " << sout(as)
826  << " not a number."
827  << std::endl;
828  return false;
829  }
830  m_highlight_color.set_value(r,g,b,a);
831 
832  } else {
833  a_out << "style_parser::parse :"
834  << " in " << sout(a_s)
835  << " : " << sout(line)
836  << " has a bad word count (two or four expected)."
837  << std::endl;
838  return false;
839  }
840 
841  } else if(word0=="back_color") {
842  if(wordn==2) {
843  const std::string& word1 = ws[1];
844  if(!find_color(a_cmaps,word1,m_back_color)) {
845  a_out << "style_parser::parse :"
846  << " in " << sout(a_s)
847  << " : " << sout(word1)
848  << " not a color."
849  << std::endl;
850  return false;
851  }
852  } else if (wordn==4) {
853  const std::string& rs = ws[1];
854  float r;
855  if(!to<float>(rs,r)) {
856  a_out << "style_parser::parse :"
857  << " in " << sout(a_s)
858  << " : " << sout(rs)
859  << " not a number."
860  << std::endl;
861  return false;
862  }
863  const std::string& gs = ws[2];
864  float g;
865  if(!to<float>(gs,g)) {
866  a_out << "style_parser::parse :"
867  << " in " << sout(a_s)
868  << " : " << sout(gs)
869  << " not a number."
870  << std::endl;
871  return false;
872  }
873  const std::string& bs = ws[3];
874  float b;
875  if(!to<float>(bs,b)) {
876  a_out << "style_parser::parse :"
877  << " in " << sout(a_s)
878  << " : " << sout(bs)
879  << " not a number."
880  << std::endl;
881  return false;
882  }
883  m_back_color.set_value(r,g,b,1);
884 
885  } else if (wordn==5) {
886  const std::string& rs = ws[1];
887  float r;
888  if(!to<float>(rs,r)) {
889  a_out << "style_parser::parse :"
890  << " in " << sout(a_s)
891  << " : " << sout(rs)
892  << " not a number."
893  << std::endl;
894  return false;
895  }
896  const std::string& gs = ws[2];
897  float g;
898  if(!to<float>(gs,g)) {
899  a_out << "style_parser::parse :"
900  << " in " << sout(a_s)
901  << " : " << sout(gs)
902  << " not a number."
903  << std::endl;
904  return false;
905  }
906  const std::string& bs = ws[3];
907  float b;
908  if(!to<float>(bs,b)) {
909  a_out << "style_parser::parse :"
910  << " in " << sout(a_s)
911  << " : " << sout(bs)
912  << " not a number."
913  << std::endl;
914  return false;
915  }
916  const std::string& as = ws[4];
917  float a;
918  if(!to<float>(as,a)) {
919  a_out << "style_parser::parse :"
920  << " in " << sout(a_s)
921  << " : " << sout(as)
922  << " not a number."
923  << std::endl;
924  return false;
925  }
926  m_back_color.set_value(r,g,b,a);
927 
928  } else {
929  a_out << "style_parser::parse :"
930  << " in " << sout(a_s)
931  << " : " << sout(line)
932  << " has a bad word count (two or four expected)."
933  << std::endl;
934  return false;
935  }
936 
937  } else if(word0=="pattern") {
938  if(!check_2(wordn,a_s,line,a_out)) return false;
939  const std::string& word1 = ws[1];
940  unsigned long ul;
941  if(!sline_pattern(word1,m_pattern)) {
942  if(!to_ulong(word1,ul)) {
943  a_out << "style_parser::parse :"
944  << " in " << sout(a_s)
945  << " : " << sout(word1)
946  << " not a line pattern."
947  << std::endl;
948  return false;
949  }
950  m_pattern = (lpat)ul;
951  }
952 
953  } else if(word0=="line_pattern") {
954  if(!check_2(wordn,a_s,line,a_out)) return false;
955  const std::string& word1 = ws[1];
956  unsigned long ul;
957  if(!sline_pattern(word1,m_line_pattern)) {
958  if(!to_ulong(word1,ul)) {
959  a_out << "style_parser::parse :"
960  << " in " << sout(a_s)
961  << " : " << sout(word1)
962  << " not a line pattern."
963  << std::endl;
964  return false;
965  }
966  m_line_pattern = (lpat)ul;
967  }
968  } else if(word0=="marker_style") {
969  if(!check_2(wordn,a_s,line,a_out)) return false;
970  const std::string& word1 = ws[1];
971  if(!smarker_style(word1,m_marker_style)) {
972  a_out << "style_parser::parse :"
973  << " in " << sout(a_s)
974  << " : " << sout(word1)
975  << " not a marker_style."
976  << std::endl;
977  return false;
978  }
979  } else if(word0=="area_style") {
980  if(!check_2(wordn,a_s,line,a_out)) return false;
981  const std::string& word1 = ws[1];
982  if(!sarea_style(word1,m_area_style)) {
983  a_out << "style_parser::parse :"
984  << " in " << sout(a_s)
985  << " : " << sout(word1)
986  << " not a area_style."
987  << std::endl;
988  return false;
989  }
990  } else if(word0=="modeling") {
991  if(!check_2(wordn,a_s,line,a_out)) return false;
992  m_modeling = ws[1];
993  } else if(word0=="light_model") {
994  if(!check_2(wordn,a_s,line,a_out)) return false;
995  m_light_model = ws[1];
996  } else if(word0=="tick_modeling") {
997  if(!check_2(wordn,a_s,line,a_out)) return false;
998  m_tick_modeling = ws[1];
999  } else if(word0=="encoding") {
1000  if(!check_2(wordn,a_s,line,a_out)) return false;
1001  m_encoding = ws[1];
1002  } else if(word0=="smoothing") {
1003  if(!check_2(wordn,a_s,line,a_out)) return false;
1004  bool value;
1005  if(!check_bool(ws[1],a_s,a_out,value)) return false;
1006  m_smoothing = value;
1007  } else if(word0=="hinting") {
1008  if(!check_2(wordn,a_s,line,a_out)) return false;
1009  bool value;
1010  if(!check_bool(ws[1],a_s,a_out,value)) return false;
1011  m_hinting = value;
1012  } else if(word0=="enforced") {
1013  if(!check_2(wordn,a_s,line,a_out)) return false;
1014  bool value;
1015  if(!check_bool(ws[1],a_s,a_out,value)) return false;
1016  m_enforced = value;
1017  } else if(word0=="cut") {
1018  m_cut = "";
1019  for(unsigned int wordi=1;wordi<wordn;wordi++) {
1020  if(wordi!=1) m_cut += " ";
1021  m_cut += ws[wordi];
1022  }
1023  } else if(word0=="options") {
1024  m_options = "";
1025  for(unsigned int wordi=1;wordi<wordn;wordi++) {
1026  if(wordi!=1) m_options += " ";
1027  m_options += ws[wordi];
1028  }
1029  } else if(word0=="color_mapping") {
1030  m_color_mapping = "";
1031  for(unsigned int wordi=1;wordi<wordn;wordi++) {
1032  if(wordi!=1) m_color_mapping += " ";
1033  m_color_mapping += ws[wordi];
1034  }
1035  } else if(word0=="painting") {
1036  if(!check_2(wordn,a_s,line,a_out)) return false;
1037  if(!spainting_policy(ws[1],m_painting)) {
1038  a_out << "style_parser::parse :"
1039  << " in " << sout(a_s)
1040  << " : " << sout(ws[1])
1041  << " not a painting_policy."
1042  << std::endl;
1043  return false;
1044  }
1045  } else if(word0=="hatching") {
1046  if(!check_2(wordn,a_s,line,a_out)) return false;
1047  if(!shatching_policy(ws[1],m_hatching)) {
1048  a_out << "style_parser::parse :"
1049  << " in " << sout(a_s)
1050  << " : " << sout(ws[1])
1051  << " not a hatching_policy."
1052  << std::endl;
1053  return false;
1054  }
1055  } else if(word0=="projection") {
1056  if(!check_2(wordn,a_s,line,a_out)) return false;
1057  if(!sprojection_type(ws[1],m_projection)) {
1058  a_out << "style_parser::parse :"
1059  << " in " << sout(a_s)
1060  << " : " << sout(ws[1])
1061  << " not a projection_type."
1062  << std::endl;
1063  return false;
1064  }
1065  } else if(word0=="font") {
1066  if(!check_2(wordn,a_s,line,a_out)) return false;
1067  font(ws[1]);
1068  } else if(word0=="width") {
1069  if(!check_2(wordn,a_s,line,a_out)) return false;
1070  float value;
1071  if(!check_float(ws[1],a_s,a_out,value)) return false;
1072  m_width = value;
1073  } else if(word0=="line_width") {
1074  if(!check_2(wordn,a_s,line,a_out)) return false;
1075  float value;
1076  if(!check_float(ws[1],a_s,a_out,value)) return false;
1077  m_line_width = value;
1078  } else if(word0=="marker_size") {
1079  if(!check_2(wordn,a_s,line,a_out)) return false;
1080  float value;
1081  if(!check_float(ws[1],a_s,a_out,value)) return false;
1082  m_marker_size = value;
1083  } else if(word0=="point_size") {
1084  if(!check_2(wordn,a_s,line,a_out)) return false;
1085  float value;
1086  if(!check_float(ws[1],a_s,a_out,value)) return false;
1087  m_point_size = value;
1088  } else if(word0=="font_size") {
1089  if(!check_2(wordn,a_s,line,a_out)) return false;
1090  float value;
1091  if(!check_float(ws[1],a_s,a_out,value)) return false;
1092  m_font_size = value;
1093  } else if(word0=="font_modeling") {
1094  if(!check_2(wordn,a_s,line,a_out)) return false;
1096  else if(ws[1]==s_font_filled()) m_font_modeling = font_filled;
1097  else if(ws[1]==s_font_pixmap()) m_font_modeling = font_pixmap;
1098  else {
1099  a_out << "style_parser::parse :"
1100  << " in " << sout(a_s)
1101  << " : " << sout(ws[1])
1102  << " not a font_modeling."
1103  << std::endl;
1104  return false;
1105  }
1106  } else if(word0=="back_shadow") {
1107  if(!check_2(wordn,a_s,line,a_out)) return false;
1108  float value;
1109  if(!check_float(ws[1],a_s,a_out,value)) return false;
1110  if(value<0.F) value = 0.F;
1111  m_back_shadow = value;
1112  } else if(word0=="multi_node_limit") {
1113  if(!check_2(wordn,a_s,line,a_out)) return false;
1114  int value = 0;
1115  if(!check_int(ws[1],a_s,a_out,value)) return false;
1117  } else if(word0=="divisions") {
1118  if(!check_2(wordn,a_s,line,a_out)) return false;
1119  int value = 0;
1120  if(!check_int(ws[1],a_s,a_out,value)) return false;
1121  m_divisions = value;
1122  } else if(word0=="rotation_steps") {
1123  if(!check_2(wordn,a_s,line,a_out)) return false;
1124  unsigned int value;
1125  if(!check_uint(ws[1],a_s,a_out,value)) return false;
1127  } else if(word0=="angle") {
1128  if(!check_2(wordn,a_s,line,a_out)) return false;
1129  float value;
1130  if(!check_float(ws[1],a_s,a_out,value)) return false;
1131  m_angle = value;
1132  } else if(word0=="scale") {
1133  if(!check_2(wordn,a_s,line,a_out)) return false;
1134  float value;
1135  if(!check_float(ws[1],a_s,a_out,value)) return false;
1136  m_scale = value;
1137  } else if(word0=="offset") {
1138  if(!check_2(wordn,a_s,line,a_out)) return false;
1139  float value;
1140  if(!check_float(ws[1],a_s,a_out,value)) return false;
1141  m_offset = value;
1142  } else if(word0=="strip_width") {
1143  if(!check_2(wordn,a_s,line,a_out)) return false;
1144  float value;
1145  if(!check_float(ws[1],a_s,a_out,value)) return false;
1146  m_strip_width = value;
1147  } else if(word0=="spacing") {
1148  if(!check_2(wordn,a_s,line,a_out)) return false;
1149  float value;
1150  if(!check_float(ws[1],a_s,a_out,value)) return false;
1151  m_spacing = value;
1152  } else if(word0=="visible") {
1153  if(!check_2(wordn,a_s,line,a_out)) return false;
1154  bool value;
1155  if(!check_bool(ws[1],a_s,a_out,value)) return false;
1156  m_visible = value;
1157  } else if(word0=="editable") {
1158  if(!check_2(wordn,a_s,line,a_out)) return false;
1159  bool value;
1160  if(!check_bool(ws[1],a_s,a_out,value)) return false;
1161  m_editable = value;
1162  } else if(word0=="pickable") {
1163  if(!check_2(wordn,a_s,line,a_out)) return false;
1164  bool value;
1165  if(!check_bool(ws[1],a_s,a_out,value)) return false;
1166  m_pickable = value;
1167  } else if(word0=="automated") {
1168  if(!check_2(wordn,a_s,line,a_out)) return false;
1169  bool value;
1170  if(!check_bool(ws[1],a_s,a_out,value)) return false;
1171  m_automated = value;
1172  } else if(word0=="bar_offset") {
1173  if(!check_2(wordn,a_s,line,a_out)) return false;
1174  float value;
1175  if(!check_float(ws[1],a_s,a_out,value)) return false;
1176  m_bar_offset = value;
1177  } else if(word0=="bar_width") {
1178  if(!check_2(wordn,a_s,line,a_out)) return false;
1179  float value;
1180  if(!check_float(ws[1],a_s,a_out,value)) return false;
1181  m_bar_width = value;
1182 
1183  } else if(word0=="translation") {
1184  if (wordn==4) {
1185  const std::string& sx = ws[1];
1186  float x;
1187  if(!to<float>(sx,x)) {
1188  a_out << "style_parser::parse :"
1189  << " in " << sout(a_s)
1190  << " : " << sout(sx)
1191  << " not a number."
1192  << std::endl;
1193  return false;
1194  }
1195  const std::string& sy = ws[2];
1196  float y;
1197  if(!to<float>(sy,y)) {
1198  a_out << "style_parser::parse :"
1199  << " in " << sout(a_s)
1200  << " : " << sout(sy)
1201  << " not a number."
1202  << std::endl;
1203  return false;
1204  }
1205  const std::string& sz = ws[3];
1206  float z;
1207  if(!to<float>(sz,z)) {
1208  a_out << "style_parser::parse :"
1209  << " in " << sout(a_s)
1210  << " : " << sout(sz)
1211  << " not a number."
1212  << std::endl;
1213  return false;
1214  }
1215  m_translation.set_value(x,y,z);
1216  } else {
1217  a_out << "style_parser::parse :"
1218  << " in " << sout(a_s)
1219  << " has a bad word count (four expected)."
1220  << std::endl;
1221  return false;
1222  }
1223 
1224  } else if(word0=="front_face") {
1225  if(!check_2(wordn,a_s,line,a_out)) return false;
1226  const std::string& word1 = ws[1];
1227  if(word1=="ccw") {
1229  } else if(word1=="cw") {
1231  } else { //ccw
1232  a_out << "style_parser::parse :"
1233  << " in " << sout(a_s)
1234  << " : " << sout(word1)
1235  << " not a winding type."
1236  << std::endl;
1237  return false;
1238  }
1239 
1240  } else if(word0=="hjust") {
1241  if(!check_2(wordn,a_s,line,a_out)) return false;
1242  const std::string& word1 = ws[1];
1243  if(!shjust(word1,m_hjust)) {
1244  a_out << "style_parser::parse :"
1245  << " in " << sout(a_s)
1246  << " : " << sout(word1)
1247  << " not a hjust."
1248  << std::endl;
1249  return false;
1250  }
1251 
1252  } else if(word0=="vjust") {
1253  if(!check_2(wordn,a_s,line,a_out)) return false;
1254  const std::string& word1 = ws[1];
1255  if(!svjust(word1,m_vjust)) {
1256  a_out << "style_parser::parse :"
1257  << " in " << sout(a_s)
1258  << " : " << sout(word1)
1259  << " not a vjust."
1260  << std::endl;
1261  return false;
1262  }
1263 
1264  } else if(word0=="coloring") {
1265  if(!check_2(wordn,a_s,line,a_out)) return false;
1266  m_coloring = ws[1];
1267 
1268  } else if(word0=="title") {
1269  if(!check_2(wordn,a_s,line,a_out)) return false;
1270  m_title = ws[1];
1271 
1272  } else {
1273  a_out << "style_parser::parse :"
1274  << " in " << sout(a_s)
1275  << " : " << sout(word0)
1276  << " bad option."
1277  << std::endl;
1278  return false;
1279  }
1280  }
1281  return true;
1282  }
1283 
1284 protected:
1285  static bool check_2(size_t a_n,
1286  const std::string& a_s,
1287  const std::string& a_line,std::ostream& a_out) {
1288  if(a_n!=2) {
1289  a_out << "style_parser::parse :"
1290  << " in " << sout(a_s)
1291  << " : " << sout(a_line)
1292  << " has a bad word count (two expected)."
1293  << std::endl;
1294  return false;
1295  }
1296  return true;
1297  }
1298 
1299  static bool check_bool(const std::string& a_w,
1300  const std::string& a_s,std::ostream& a_out,bool& a_v){
1301  if(!to(a_w,a_v)){
1302  a_out << "style_parser::parse :"
1303  << " in " << sout(a_s)
1304  << " : " << sout(a_w)
1305  << " not a boolean."
1306  << std::endl;
1307  return false;
1308  }
1309  return true;
1310  }
1311 
1312  static bool check_int(const std::string& a_w,
1313  const std::string& a_s,std::ostream& a_out,int& a_v) {
1314  if(!to<int>(a_w,a_v)){
1315  a_out << "style_parser::parse :"
1316  << " in " << sout(a_s)
1317  << " : " << sout(a_w)
1318  << " not an int."
1319  << std::endl;
1320  return false;
1321  }
1322  return true;
1323  }
1324 
1325  static bool check_uint(const std::string& a_w,
1326  const std::string& a_s,std::ostream& a_out,unsigned int& a_v) {
1327  if(!to<unsigned int>(a_w,a_v)){
1328  a_out << "style_parser::parse :"
1329  << " in " << sout(a_s)
1330  << " : " << sout(a_w)
1331  << " not an unsigned int."
1332  << std::endl;
1333  return false;
1334  }
1335  return true;
1336  }
1337 
1338  static bool check_float(const std::string& a_w,
1339  const std::string& a_s,std::ostream& a_out,float& a_v) {
1340  if(!to<float>(a_w,a_v)){
1341  a_out << "style_parser::parse :"
1342  << " in " << sout(a_s)
1343  << " : " << sout(a_w)
1344  << " not a float."
1345  << std::endl;
1346  return false;
1347  }
1348  return true;
1349  }
1350 
1351 protected:
1355  float m_width;
1365  std::string m_modeling;
1366  std::string m_light_model;
1367  std::string m_tick_modeling;
1368  std::string m_encoding;
1371  std::string m_cut;
1375  std::string m_font;
1376  int m_multi_node_limit; //could be no_limit = -1.
1378  unsigned int m_rotation_steps;
1380  float m_spacing;
1381  float m_angle;
1382  float m_scale;
1383  float m_offset;
1390  std::string m_options;
1391  std::string m_color_mapping;
1397  std::string m_coloring;
1398  std::string m_title;
1400 };
1401 
1402 }}
1403 
1404 #endif
style_colormap
tools::sg::style_parser::multi_node_limit
int multi_node_limit() const
Definition: style_parser:576
tools::sg::style_parser::no_limit
static int no_limit()
Definition: style_parser:146
tools::sg::style_parser::m_encoding
std::string m_encoding
Definition: style_parser:1368
tools::sg::style_parser::marker_size
void marker_size(float a_v)
Definition: style_parser:500
tools::sg::area_style
area_style
Definition: enums:42
tools::sg::style_parser::offset
float offset() const
Definition: style_parser:558
tools::sg::style_parser::scale
float scale() const
Definition: style_parser:567
tools::sg::style_parser::encoding
const std::string & encoding() const
Definition: style_parser:525
tools::sg::style_parser::back_shadow
float back_shadow() const
Definition: style_parser:494
tools::sg::style_parser::pickable
bool pickable() const
Definition: style_parser:621
tools::sg::style_parser::coloring
const std::string & coloring() const
Definition: style_parser:615
tools::sg::style_parser::hatching
void hatching(sg::hatching_policy a_v)
Definition: style_parser:537
tools::sg::style_parser::automated
void automated(bool a_v)
Definition: style_parser:587
tools::sg::style_parser::m_tick_modeling
std::string m_tick_modeling
Definition: style_parser:1367
tools::sg::font_pixmap
@ font_pixmap
Definition: enums:94
tools::value
Definition: value:18
tools::sg::style_parser::color_mapping
const std::string & color_mapping() const
Definition: style_parser:597
strings
tools::sg::style_parser::color_mapping
void color_mapping(const std::string &a_v)
Definition: style_parser:596
tools::sg::style_parser::point_size
void point_size(float a_v)
Definition: style_parser:503
tools::sg::style_parser::hjust
void hjust(sg::hjust a_v)
Definition: style_parser:608
tools::sg::light_model_phong
const std::string & light_model_phong()
Definition: strings:178
tools::sg::style_parser::width
float width() const
Definition: style_parser:489
tools::sg::style_parser::cut
void cut(const std::string &a_v)
Definition: style_parser:590
tools::sg::style_parser::m_marker_size
float m_marker_size
Definition: style_parser:1357
tools::sg::modeling_boxes
const std::string & modeling_boxes()
Definition: strings:64
tools::sg::style_parser::scale
void scale(float a_v)
Definition: style_parser:566
tools::sg::style_parser::bar_offset
void bar_offset(float a_v)
Definition: style_parser:569
tools::sg::style_parser::m_rotation_steps
unsigned int m_rotation_steps
Definition: style_parser:1378
tools::sg::style_parser::hinting
bool hinting() const
Definition: style_parser:531
tools::sg::sarea_style
bool sarea_style(const std::string &a_s, area_style &a_v)
Definition: senum:147
tools::sg::find_color
bool find_color(const cmaps_t &a_cmaps, const std::string &a_s, colorf &a_col)
Definition: style_colormap:549
tools::sg::style_parser::spacing
float spacing() const
Definition: style_parser:579
tools::sg::style_parser::m_point_size
float m_point_size
Definition: style_parser:1358
tools::sg::painting_policy
painting_policy
Definition: enums:57
tools::sg::winding_ccw
@ winding_ccw
Definition: enums:105
tools::sg::style_parser::bar_width
void bar_width(float a_v)
Definition: style_parser:572
tools::sg::projection_none
@ projection_none
Definition: enums:50
tools::sg::style_parser::m_multi_node_limit
int m_multi_node_limit
Definition: style_parser:1376
tools::get_lines
void get_lines(const std::string &a_string, std::vector< std::string > &a_lines)
Definition: get_lines:14
tools::sg::style_parser::font
void font(const std::string &a_v)
Definition: style_parser:548
tools::colorf
Definition: colorf:11
tools::sg::hjust
hjust
Definition: enums:73
tools::vec3::set_value
void set_value(const T &a0, const T &a1, const T &a2)
Definition: vec3:92
tools::sg::style_parser::m_modeling
std::string m_modeling
Definition: style_parser:1365
tools::sg::style_parser::front_face
void front_face(winding_type a_v)
Definition: style_parser:605
tools::sg::style_parser::parse
bool parse(std::ostream &a_out, const cmaps_t &a_cmaps, const std::string &a_s)
Definition: style_parser:624
tools::sg::marker_style
marker_style
Definition: enums:17
tools::sg::style_parser::m_line_width
float m_line_width
Definition: style_parser:1356
tools::sg::style_parser::area_style
sg::area_style area_style() const
Definition: style_parser:513
tools::sg::style_parser::m_line_pattern
lpat m_line_pattern
Definition: style_parser:1362
tools::sg::style_parser::m_spacing
float m_spacing
Definition: style_parser:1380
tools::sg::style_parser::strip_width
void strip_width(float a_v)
Definition: style_parser:560
tools::sg::style_parser::editable
bool editable() const
Definition: style_parser:585
tools::sg::style_parser::check_float
static bool check_float(const std::string &a_w, const std::string &a_s, std::ostream &a_out, float &a_v)
Definition: style_parser:1338
tools::sg::style_parser::tos
std::string tos() const
Definition: style_parser:311
tools::gl::lines
mode_t lines()
Definition: glprims:17
tools::sg::shjust
bool shjust(const std::string &a_s, hjust &a_v)
Definition: senum:26
senum
tools::sg::style_parser::marker_style
void marker_style(sg::marker_style a_v)
Definition: style_parser:497
tools::sg::style_parser::font_size
float font_size() const
Definition: style_parser:507
tools::sg::style_parser::translation
vec3f translation() const
Definition: style_parser:603
tools::sg::style_parser::m_projection
sg::projection_type m_projection
Definition: style_parser:1374
tools::sg::style_parser::divisions
int divisions() const
Definition: style_parser:552
tools::sg::style_parser::m_offset
float m_offset
Definition: style_parser:1383
tools::sg::spainting_policy
bool spainting_policy(const std::string &a_s, painting_policy &a_v)
Definition: senum:189
tools::sg::style_parser::color
void color(const colorf &a_v)
Definition: style_parser:479
tools::sg::style_parser::marker_style
sg::marker_style marker_style() const
Definition: style_parser:498
tools::sg::style_parser::back_color
void back_color(const colorf &a_v)
Definition: style_parser:485
tools::fpi
float fpi()
Definition: mathf:11
tools::sg::marker_dot
@ marker_dot
Definition: enums:18
tools::sg::style_parser::offset
void offset(float a_v)
Definition: style_parser:557
tools::sg::style_parser::options
const std::string & options() const
Definition: style_parser:594
tools::sg::style_parser::m_font_modeling
sg::font_modeling m_font_modeling
Definition: style_parser:1360
tools::sg::style_parser::title
void title(const std::string &a_v)
Definition: style_parser:617
tools::sg::winding_cw
@ winding_cw
Definition: enums:106
tools::sg::style_parser::hjust
sg::hjust hjust() const
Definition: style_parser:609
tools::sg::style_parser::rotation_steps
void rotation_steps(unsigned int a_v)
Definition: style_parser:554
tools::sg::style_parser::check_int
static bool check_int(const std::string &a_w, const std::string &a_s, std::ostream &a_out, int &a_v)
Definition: style_parser:1312
tools::sg::style_parser::m_painting
sg::painting_policy m_painting
Definition: style_parser:1372
TOOLS_SCLASS
#define TOOLS_SCLASS(a_name)
Definition: S_STRING:41
tools::sg::style_parser::painting
sg::painting_policy painting() const
Definition: style_parser:533
tools::sg::style_parser::m_divisions
int m_divisions
Definition: style_parser:1377
tools::sg::style_parser::modeling
const std::string & modeling() const
Definition: style_parser:516
tools::sg::tick_modeling_hippo
const std::string & tick_modeling_hippo()
Definition: strings:19
tools::sg::style_parser::back_color
colorf back_color() const
Definition: style_parser:486
tools::sg::style_parser::bar_offset
float bar_offset() const
Definition: style_parser:570
tools::sg::style_parser::m_light_model
std::string m_light_model
Definition: style_parser:1366
tools::sg::style_parser::m_smoothing
bool m_smoothing
Definition: style_parser:1369
tools::sg::left
@ left
Definition: enums:74
tools::sg::style_parser::m_marker_style
sg::marker_style m_marker_style
Definition: style_parser:1363
tools::snpf
int snpf(char *a_s, size_t a_n, const char *a_fmt,...)
Definition: snpf:27
tools::sg::style_parser::vjust
sg::vjust vjust() const
Definition: style_parser:612
tools::sg::s_font_pixmap
const std::string & s_font_pixmap()
Definition: strings:53
tools::sg::style_parser::m_pickable
bool m_pickable
Definition: style_parser:1399
tools::sg::style_parser::copy
void copy(const style_parser &a_from)
Definition: style_parser:148
tools::sout
Definition: sout:17
tools::sg::style_parser::font_modeling
void font_modeling(sg::font_modeling a_v)
Definition: style_parser:509
tools::sg::style_parser::m_color
colorf m_color
Definition: style_parser:1352
tools::sg::style_parser::equal
bool equal(const style_parser &a_from)
Definition: style_parser:199
tools::sg::style_parser::m_hatching
sg::hatching_policy m_hatching
Definition: style_parser:1373
tools::sg::style_parser::tick_modeling
const std::string & tick_modeling() const
Definition: style_parser:522
tools::sg::style_parser::enforced
bool enforced() const
Definition: style_parser:600
tools::sg::style_parser::front_face
winding_type front_face() const
Definition: style_parser:606
tools::sg::cmaps_t
std::map< std::string, style_colormap > cmaps_t
Definition: style_colormap:536
tools::sg::style_parser::highlight_color
void highlight_color(const colorf &a_v)
Definition: style_parser:482
tools::sg::style_parser::m_width
float m_width
Definition: style_parser:1355
tools::sg::sline_pattern
bool sline_pattern(const std::string &a_s, lpat &aPattern)
Definition: senum:276
tools::sg::style_parser::m_highlight_color
colorf m_highlight_color
Definition: style_parser:1353
tools::sg::style_parser::font
const std::string & font() const
Definition: style_parser:549
tools::sg::style_parser::painting
void painting(sg::painting_policy a_v)
Definition: style_parser:534
tools::sg::style_parser::~style_parser
virtual ~style_parser()
Definition: style_parser:80
tools::sg::style_parser::tick_modeling
void tick_modeling(const std::string &a_v)
Definition: style_parser:521
tools::sg::font_modeling
font_modeling
Definition: enums:91
tools::sg::style_parser::reset
virtual void reset()
Definition: style_parser:260
tools::sg::lpat
unsigned short lpat
Definition: lpat:10
tools::sg::style_parser::m_pattern
lpat m_pattern
Definition: style_parser:1361
tools::sg::font_outline
@ font_outline
Definition: enums:92
tools::sg::style_parser
Definition: style_parser:20
tools::sg::style_parser::encoding
void encoding(const std::string &a_v)
Definition: style_parser:524
tools::sg::style_parser::check_uint
static bool check_uint(const std::string &a_w, const std::string &a_s, std::ostream &a_out, unsigned int &a_v)
Definition: style_parser:1325
tools::sg::style_parser::m_back_shadow
float m_back_shadow
Definition: style_parser:1379
tools::sg::encoding_none
const std::string & encoding_none()
Definition: strings:38
tools::sg::style_parser::smoothing
void smoothing(bool a_v)
Definition: style_parser:527
tools::sg::style_parser::m_front_face
winding_type m_front_face
Definition: style_parser:1394
tools::sg::style_parser::m_vjust
sg::vjust m_vjust
Definition: style_parser:1396
tools::sg::vjust
vjust
Definition: enums:79
tools::sg::style_parser::operator=
style_parser & operator=(const style_parser &a_from)
Definition: style_parser:141
tools::sg::style_parser::m_scale
float m_scale
Definition: style_parser:1382
tools::to
std::vector< std::string > to(int a_argc, char **a_argv)
Definition: args:507
tools::sg::style_parser::m_strip_width
float m_strip_width
Definition: style_parser:1384
tools::sg::style_parser::pattern
lpat pattern() const
Definition: style_parser:543
tools::vec3f
Definition: vec3f:13
tools::sg::style_parser::m_color_mapping
std::string m_color_mapping
Definition: style_parser:1391
tools::sg::style_parser::hatching
sg::hatching_policy hatching() const
Definition: style_parser:536
tools::sg::style_parser::spacing
void spacing(float a_v)
Definition: style_parser:578
tools::sg::bottom
@ bottom
Definition: enums:80
tools::sg::smarker_style
bool smarker_style(const std::string &a_s, marker_style &a_v)
Definition: senum:107
tools::sg::hatching_none
@ hatching_none
Definition: enums:67
tools::sg::style_parser::font_size
void font_size(float a_v)
Definition: style_parser:506
tools::sg::style_parser::back_shadow
void back_shadow(float a_v)
Definition: style_parser:495
tools
inlined C code : ///////////////////////////////////
Definition: aida_ntuple:26
tools::sg::painting_uniform
@ painting_uniform
Definition: enums:58
tools::sg::style_parser::pattern
void pattern(lpat a_v)
Definition: style_parser:542
tools::words
void words(const std::string &a_string, const std::string &a_sep, bool a_take_empty, std::vector< std::string > &a_words, bool a_clear=true)
Definition: words:12
tools::sg::style_parser::m_hinting
bool m_hinting
Definition: style_parser:1370
tools::sg::style_parser::projection
sg::projection_type projection() const
Definition: style_parser:539
tools::sg::style_parser::check_bool
static bool check_bool(const std::string &a_w, const std::string &a_s, std::ostream &a_out, bool &a_v)
Definition: style_parser:1299
tools::sg::projection_type
projection_type
Definition: enums:49
tools::sg::shatching_policy
bool shatching_policy(const std::string &a_s, hatching_policy &a_v)
Definition: senum:222
tools::vec4::set_value
void set_value(const T &a0, const T &a1, const T &a2, const T &a3)
Definition: vec4:100
tools::sg::style_parser::m_coloring
std::string m_coloring
Definition: style_parser:1397
tools::sg::winding_type
winding_type
Definition: enums:104
tools::sg::style_parser::highlight_color
colorf highlight_color() const
Definition: style_parser:483
tools::sg::area_solid
@ area_solid
Definition: enums:43
tools::sg::style_parser::m_font
std::string m_font
Definition: style_parser:1375
tools::sg::style_parser::m_editable
bool m_editable
Definition: style_parser:1388
tools::sg::style_parser::visible
bool visible() const
Definition: style_parser:582
tools::sg::style_parser::m_angle
float m_angle
Definition: style_parser:1381
tools::sg::style_parser::m_font_size
float m_font_size
Definition: style_parser:1359
tools::sg::style_parser::m_cut
std::string m_cut
Definition: style_parser:1371
tools::sg::style_parser::projection
void projection(sg::projection_type a_v)
Definition: style_parser:540
tools::sg::style_parser::line_width
void line_width(float a_v)
Definition: style_parser:491
tools::sg::style_parser::angle
float angle() const
Definition: style_parser:564
tools::sg::line_solid
@ line_solid
Definition: enums:11
tools::sg::style_parser::visible
void visible(bool a_v)
Definition: style_parser:581
tools::sg::style_parser::angle
void angle(float a_v)
Definition: style_parser:563
tools::sg::style_parser::m_bar_width
float m_bar_width
Definition: style_parser:1387
tools::sg::style_parser::smoothing
bool smoothing() const
Definition: style_parser:528
tools::sg::style_parser::editable
void editable(bool a_v)
Definition: style_parser:584
tools::sg::style_parser::light_model
void light_model(const std::string &a_v)
Definition: style_parser:518
tools::sg::style_parser::style_parser
style_parser(const style_parser &a_from)
Definition: style_parser:86
tools::sg::style_parser::m_back_color
colorf m_back_color
Definition: style_parser:1354
tools::sg::style_parser::translation
void translation(const vec3f &a_v)
Definition: style_parser:602
tools::sg::style_parser::m_bar_offset
float m_bar_offset
Definition: style_parser:1386
tools::line
Definition: line:13
tools::sg::style_parser::line_pattern
lpat line_pattern() const
Definition: style_parser:546
tools::sg::style_parser::marker_size
float marker_size() const
Definition: style_parser:501
tools::sg::style_parser::automated
bool automated() const
Definition: style_parser:588
tools::sg::style_parser::m_visible
bool m_visible
Definition: style_parser:1385
tools::sg::style_parser::width
void width(float a_v)
Definition: style_parser:488
tools::sg::style_parser::light_model
const std::string & light_model() const
Definition: style_parser:519
tools::sg::style_parser::strip_width
float strip_width() const
Definition: style_parser:561
tools::sg::s_font_filled
const std::string & s_font_filled()
Definition: strings:52
tools_vforcit
#define tools_vforcit(a__T, a__v, a__it)
Definition: forit:7
tools::sg::style_parser::point_size
float point_size() const
Definition: style_parser:504
tools::sg::style_parser::modeling
void modeling(const std::string &a_v)
Definition: style_parser:515
tools::sg::style_parser::color
colorf color() const
Definition: style_parser:480
tools::sg::style_parser::multi_node_limit
void multi_node_limit(int a_v)
Definition: style_parser:575
tools::sg::hatching_policy
hatching_policy
Definition: enums:66
tools::sg::font_filled
@ font_filled
Definition: enums:93
tools::sg::style_parser::cut
const std::string & cut() const
Definition: style_parser:591
tools::sg::style_parser::enforced
void enforced(bool a_v)
Definition: style_parser:599
tools::sg::style_parser::line_width
float line_width() const
Definition: style_parser:492
tools::sg::to_ulong
bool to_ulong(const std::string &a_s, unsigned long &a_v)
Definition: style_colormap:538
tools::sg::style_parser::m_enforced
bool m_enforced
Definition: style_parser:1392
tools::sg::style_parser::options
void options(const std::string &a_v)
Definition: style_parser:593
tools::sg::style_parser::title
const std::string & title() const
Definition: style_parser:618
tools::sg::style_parser::m_translation
vec3f m_translation
Definition: style_parser:1393
tools::sg::style_parser::line_pattern
void line_pattern(lpat a_v)
Definition: style_parser:545
tools::sg::s_font_outline
const std::string & s_font_outline()
Definition: strings:51
tools::sg::style_parser::m_hjust
sg::hjust m_hjust
Definition: style_parser:1395
tools::sg::style_parser::font_modeling
sg::font_modeling font_modeling() const
Definition: style_parser:510
tools::sg::style_parser::pickable
void pickable(bool a_v)
Definition: style_parser:620
tools::sg::style_parser::area_style
void area_style(sg::area_style a_v)
Definition: style_parser:512
tools::sg::style_parser::check_2
static bool check_2(size_t a_n, const std::string &a_s, const std::string &a_line, std::ostream &a_out)
Definition: style_parser:1285
tools::sg::style_parser::m_area_style
sg::area_style m_area_style
Definition: style_parser:1364
tools::sg::style_parser::bar_width
float bar_width() const
Definition: style_parser:573
tools::sg::style_parser::rotation_steps
unsigned int rotation_steps() const
Definition: style_parser:555
tools::sg::style_parser::coloring
void coloring(const std::string &a_v)
Definition: style_parser:614
tools::sg::svjust
bool svjust(const std::string &a_s, vjust &a_v)
Definition: senum:57
tools::sg::style_parser::style_parser
style_parser()
Definition: style_parser:25
tools::sg::style_parser::vjust
void vjust(sg::vjust a_v)
Definition: style_parser:611
tools::sg::style_parser::m_options
std::string m_options
Definition: style_parser:1390
tools::sg::style_parser::hinting
void hinting(bool a_v)
Definition: style_parser:530
tools::sg::sprojection_type
bool sprojection_type(const std::string &a_s, projection_type &a_v)
Definition: senum:255
tools::sg::style_parser::m_automated
bool m_automated
Definition: style_parser:1389
tools::sg::style_parser::m_title
std::string m_title
Definition: style_parser:1398
tools::sg::style_parser::divisions
void divisions(int a_v)
Definition: style_parser:551