Back to home page

EIC code displayed by LXR

 
 

    


Warning, /include/Geant4/tools/sg/style_parser is written in an unsupported language. File is not indexed.

0001 // Copyright (C) 2010, Guy Barrand. All rights reserved.
0002 // See the file tools.license for terms.
0003 
0004 #ifndef tools_sg_style_parser
0005 #define tools_sg_style_parser
0006 
0007 #include "senum"
0008 #include "strings"
0009 #include "style_colormap"
0010 
0011 #include "../mathf"
0012 #include "../lina/vec3f"
0013 #include "../sout"
0014 #include "../colorfs"
0015 #include "../get_lines"
0016 
0017 namespace tools {
0018 namespace sg {
0019 
0020 class style_parser {
0021 #ifdef TOOLS_MEM
0022   TOOLS_SCLASS(tools::sg::style_parser)
0023 #endif
0024 public:
0025   style_parser()
0026   :m_color(0,0,0)
0027   ,m_highlight_color(0,0,0)
0028   ,m_back_color(1,1,1)
0029   ,m_width(1)
0030   ,m_line_width(1)
0031   ,m_marker_size(1)
0032   ,m_point_size(1)
0033   ,m_font_size(10)
0034   ,m_font_modeling(font_filled)
0035   ,m_pattern(line_solid)
0036   ,m_line_pattern(line_solid)
0037   ,m_marker_style(marker_dot)
0038   ,m_area_style(area_solid)
0039   ,m_modeling(modeling_boxes())
0040   ,m_light_model(light_model_phong())
0041   ,m_tick_modeling(tick_modeling_hippo())
0042   ,m_encoding(encoding_none())
0043   ,m_smoothing(false)
0044   ,m_hinting(false)
0045   ,m_cut()
0046   ,m_painting(painting_uniform)
0047   ,m_hatching(hatching_none)
0048   ,m_projection(projection_none)
0049   ,m_font("default")
0050   ,m_multi_node_limit(no_limit())
0051   ,m_divisions(510) //Same as CERN-ROOT/TAttAxis
0052   ,m_rotation_steps(24) //Same as SbPolyhedron default.
0053   ,m_back_shadow(0)
0054   ,m_spacing(0.05F)
0055   ,m_angle(fpi()/4.0F)
0056   ,m_scale(1)
0057   ,m_offset(0)
0058   ,m_strip_width(0)
0059   ,m_visible(true)
0060   ,m_bar_offset(0.25F)
0061   ,m_bar_width(0.5F)
0062   ,m_editable(false)
0063   ,m_automated(true)
0064   ,m_options()
0065   ,m_color_mapping()
0066   ,m_enforced(false)
0067   ,m_translation(0,0,0)
0068   ,m_front_face(winding_ccw)
0069   ,m_hjust(left)
0070   ,m_vjust(bottom)
0071   ,m_coloring()
0072   ,m_title()
0073   ,m_pickable(false)
0074   {
0075 #ifdef TOOLS_MEM
0076     mem::increment(s_class().c_str());
0077 #endif
0078   }
0079 
0080   virtual ~style_parser(){
0081 #ifdef TOOLS_MEM
0082     mem::decrement(s_class().c_str());
0083 #endif
0084   }
0085 public:
0086   style_parser(const style_parser& a_from)
0087   :m_color(a_from.m_color)
0088   ,m_highlight_color(a_from.m_highlight_color)
0089   ,m_back_color(a_from.m_back_color)
0090   ,m_width(a_from.m_width)
0091   ,m_line_width(a_from.m_line_width)
0092   ,m_marker_size(a_from.m_marker_size)
0093   ,m_point_size(a_from.m_point_size)
0094   ,m_font_size(a_from.m_font_size)
0095   ,m_font_modeling(a_from.m_font_modeling)
0096   ,m_pattern(a_from.m_pattern)
0097   ,m_line_pattern(a_from.m_line_pattern)
0098   ,m_marker_style(a_from.m_marker_style)
0099   ,m_area_style(a_from.m_area_style)
0100   ,m_modeling (a_from.m_modeling )
0101   ,m_light_model(a_from.m_light_model)
0102   ,m_tick_modeling(a_from.m_tick_modeling)
0103   ,m_encoding(a_from.m_encoding)
0104   ,m_smoothing(a_from.m_smoothing)
0105   ,m_hinting(a_from.m_hinting)
0106   ,m_cut(a_from.m_cut)
0107   ,m_painting(a_from.m_painting)
0108   ,m_hatching(a_from.m_hatching)
0109   ,m_projection(a_from.m_projection)
0110   ,m_font(a_from.m_font)
0111   ,m_multi_node_limit(a_from.m_multi_node_limit)
0112   ,m_divisions(a_from.m_divisions)
0113   ,m_rotation_steps(a_from.m_rotation_steps)
0114   ,m_back_shadow(a_from.m_back_shadow)
0115   ,m_spacing(a_from.m_spacing)
0116   ,m_angle(a_from.m_angle)
0117   ,m_scale(a_from.m_scale)
0118   ,m_offset(a_from.m_offset)
0119   ,m_strip_width(a_from.m_strip_width)
0120   ,m_visible(a_from.m_visible)
0121   ,m_bar_offset(a_from.m_bar_offset)
0122   ,m_bar_width(a_from.m_bar_width)
0123   ,m_editable(a_from.m_editable)
0124   ,m_automated(a_from.m_automated)
0125   ,m_options(a_from.m_options)
0126   ,m_color_mapping(a_from.m_color_mapping)
0127   ,m_enforced(a_from.m_enforced)
0128   ,m_translation(a_from.m_translation)
0129   ,m_front_face(a_from.m_front_face)
0130   ,m_hjust(a_from.m_hjust)
0131   ,m_vjust(a_from.m_vjust)
0132   ,m_coloring(a_from.m_coloring)
0133   ,m_title(a_from.m_title)
0134   ,m_pickable(a_from.m_pickable)
0135   {
0136 #ifdef TOOLS_MEM
0137     mem::increment(s_class().c_str());
0138 #endif
0139   }
0140 
0141   style_parser& operator=(const style_parser& a_from){
0142     copy(a_from);
0143     return *this;
0144   }
0145 public:
0146   static int no_limit() {return (-1);}
0147 public:
0148   void copy(const style_parser& a_from){
0149     m_color = a_from.m_color;
0150     m_highlight_color = a_from.m_highlight_color;
0151     m_back_color = a_from.m_back_color;
0152     m_width = a_from.m_width;
0153     m_line_width = a_from.m_line_width;
0154     m_marker_size = a_from.m_marker_size;
0155     m_point_size = a_from.m_point_size;
0156     m_font_size = a_from.m_font_size;
0157     m_font_modeling = a_from.m_font_modeling;
0158     m_pattern = a_from.m_pattern;
0159     m_line_pattern = a_from.m_line_pattern;
0160     m_marker_style = a_from.m_marker_style;
0161     m_area_style = a_from.m_area_style;
0162     m_modeling  = a_from.m_modeling;
0163     m_light_model = a_from.m_light_model;
0164     m_tick_modeling = a_from.m_tick_modeling;
0165     m_encoding = a_from.m_encoding;
0166     m_smoothing = a_from.m_smoothing;
0167     m_hinting = a_from.m_hinting;
0168     m_cut = a_from.m_cut;
0169     m_painting = a_from.m_painting;
0170     m_hatching = a_from.m_hatching;
0171     m_projection = a_from.m_projection;
0172     m_font = a_from.m_font;
0173     m_multi_node_limit = a_from.m_multi_node_limit;
0174     m_divisions = a_from.m_divisions;
0175     m_rotation_steps = a_from.m_rotation_steps;
0176     m_back_shadow = a_from.m_back_shadow;
0177     m_spacing = a_from.m_spacing;
0178     m_angle = a_from.m_angle;
0179     m_scale = a_from.m_scale;
0180     m_offset = a_from.m_offset;
0181     m_strip_width = a_from.m_strip_width;
0182     m_visible = a_from.m_visible;
0183     m_bar_offset = a_from.m_bar_offset;
0184     m_bar_width = a_from.m_bar_width;
0185     m_editable = a_from.m_editable;
0186     m_automated = a_from.m_automated;
0187     m_options = a_from.m_options;
0188     m_color_mapping = a_from.m_color_mapping;
0189     m_enforced = a_from.m_enforced;
0190     m_translation = a_from.m_translation;
0191     m_front_face = a_from.m_front_face;
0192     m_hjust = a_from.m_hjust;
0193     m_vjust = a_from.m_vjust;
0194     m_coloring  = a_from.m_coloring;
0195     m_title  = a_from.m_title;
0196     m_pickable  = a_from.m_pickable;
0197   }
0198 
0199   bool equal(const style_parser& a_from){
0200     if(m_width!=a_from.m_width) return false;
0201     if(m_line_width!=a_from.m_line_width) return false;
0202     if(m_marker_size!=a_from.m_marker_size) return false;
0203     if(m_point_size!=a_from.m_point_size) return false;
0204     if(m_font_size!=a_from.m_font_size) return false;
0205     if(m_font_modeling!=a_from.m_font_modeling) return false;
0206     if(m_pattern!=a_from.m_pattern) return false;
0207     if(m_line_pattern!=a_from.m_line_pattern) return false;
0208     if(m_marker_style!=a_from.m_marker_style) return false;
0209     if(m_area_style!=a_from.m_area_style) return false;
0210     if(m_smoothing!=a_from.m_smoothing) return false;
0211     if(m_hinting!=a_from.m_hinting) return false;
0212     if(m_painting!=a_from.m_painting) return false;
0213     if(m_hatching!=a_from.m_hatching) return false;
0214     if(m_projection!=a_from.m_projection) return false;
0215     if(m_multi_node_limit!=a_from.m_multi_node_limit) return false;
0216     if(m_divisions!=a_from.m_divisions) return false;
0217     if(m_rotation_steps!=a_from.m_rotation_steps) return false;
0218     if(m_back_shadow!=a_from.m_back_shadow) return false;
0219     if(m_spacing!=a_from.m_spacing) return false;
0220     if(m_angle!=a_from.m_angle) return false;
0221     if(m_scale!=a_from.m_scale) return false;
0222     if(m_offset!=a_from.m_offset) return false;
0223     if(m_strip_width!=a_from.m_strip_width) return false;
0224     if(m_visible!=a_from.m_visible) return false;
0225     if(m_bar_offset!=a_from.m_bar_offset) return false;
0226     if(m_bar_width!=a_from.m_bar_width) return false;
0227     if(m_editable!=a_from.m_editable) return false;
0228     if(m_automated!=a_from.m_automated) return false;
0229     if(m_enforced!=a_from.m_enforced) return false;
0230 
0231     //color
0232     if(m_color!=a_from.m_color) return false;
0233     if(m_highlight_color!=a_from.m_highlight_color) return false;
0234     if(m_back_color!=a_from.m_back_color) return false;
0235 
0236     //std::string
0237     if(m_modeling!=a_from.m_modeling) return false;
0238     if(m_light_model!=a_from.m_light_model) return false;
0239     if(m_tick_modeling!=a_from.m_tick_modeling) return false;
0240     if(m_encoding!=a_from.m_encoding) return false;
0241     if(m_cut!=a_from.m_cut) return false;
0242     if(m_font!=a_from.m_font) return false;
0243     if(m_options!=a_from.m_options) return false;
0244     if(m_color_mapping!=a_from.m_color_mapping) return false;
0245 
0246     if(m_translation!=a_from.m_translation) return false;
0247 
0248     if(m_front_face!=a_from.m_front_face) return false;
0249 
0250     if(m_hjust!=a_from.m_hjust) return false;
0251     if(m_vjust!=a_from.m_vjust) return false;
0252 
0253     if(m_coloring!=a_from.m_coloring) return false;
0254     if(m_title!=a_from.m_title) return false;
0255     if(m_pickable!=a_from.m_pickable) return false;
0256 
0257     return true;
0258   }
0259 
0260   virtual void reset(){ //virtual because of SoGC
0261     m_color = colorf_black();
0262     m_highlight_color = colorf_lightgrey();
0263     m_back_color = colorf_white();
0264     m_width = 1;
0265     m_line_width = 1;
0266     m_marker_size = 1;
0267     m_point_size = 1;
0268     m_font_size = 10;
0269     m_font_modeling = font_filled;
0270     m_pattern = line_solid;
0271     m_line_pattern = line_solid;
0272     m_marker_style = marker_dot;
0273     m_area_style = area_solid;
0274     m_modeling  = modeling_boxes();
0275     m_light_model = light_model_phong();
0276     m_tick_modeling = tick_modeling_hippo();
0277     m_encoding = encoding_none();
0278     m_smoothing = false;
0279     m_hinting = false;
0280     m_cut = "";
0281     m_painting = painting_uniform;
0282     m_hatching = hatching_none;
0283     m_projection = projection_none;
0284     m_font = "default";
0285     m_multi_node_limit = no_limit();
0286     m_back_shadow = 0;
0287     m_divisions = 510;
0288     m_rotation_steps = 24;
0289     m_spacing = 0.05F;
0290     m_angle = fpi()/4;
0291     m_scale = 1;
0292     m_offset = 0;
0293     m_strip_width = 0;
0294     m_visible = true;
0295     m_bar_offset = 0.25F;
0296     m_bar_width = 0.5F;
0297     m_editable = false;
0298     m_automated = true;
0299     m_options = "";
0300     m_color_mapping = "";
0301     m_enforced = false;
0302     m_translation = vec3f(0,0,0);
0303     m_front_face = winding_ccw;
0304     m_hjust = left;
0305     m_vjust = bottom;
0306     m_coloring = "";
0307     m_title = "";
0308     m_pickable = false;
0309   }
0310 
0311   std::string tos() const{
0312     char ss[40 * 32];
0313     snpf(ss,sizeof(ss),
0314 "color %g %g %g\n\
0315 highlight_color %g %g %g\n\
0316 back_color %g %g %g\n\
0317 width %g\n\
0318 line_width %g\n\
0319 marker_size %g\n\
0320 point_size %g\n\
0321 font_size %g\n\
0322 pattern %x\n\
0323 line_pattern %x\n\
0324 multi_node_limit %d\n\
0325 back_shadow %g\n\
0326 divisions %d\n\
0327 rotation_steps %d\n\
0328 angle %g\n\
0329 scale %g\n\
0330 offset %g\n\
0331 strip_width %g\n\
0332 spacing %g\n\
0333 bar_offset %g\n\
0334 bar_width %g\n\
0335 translation %g %g %g"
0336     ,m_color[0],m_color[1],m_color[2]
0337     ,m_highlight_color[0],m_highlight_color[1],m_highlight_color[2]
0338     ,m_back_color[0],m_back_color[1],m_back_color[2]
0339     ,m_width
0340     ,m_line_width
0341     ,m_marker_size
0342     ,m_point_size
0343     ,m_font_size
0344     ,m_pattern
0345     ,m_line_pattern
0346     ,m_multi_node_limit
0347     ,m_back_shadow
0348     ,m_divisions
0349     ,m_rotation_steps
0350     ,m_angle
0351     ,m_scale
0352     ,m_offset
0353     ,m_strip_width
0354     ,m_spacing
0355     ,m_bar_offset
0356     ,m_bar_width
0357     ,m_translation[0],m_translation[1],m_translation[2]);
0358 
0359     std::string lf("\n");
0360     std::string _s(ss);
0361 
0362     _s += lf;
0363     _s += "smoothing ";
0364     _s += (m_smoothing?"true":"false");
0365 
0366     _s += lf;
0367     _s += "hinting ";
0368     _s += (m_hinting?"true":"false");
0369 
0370     _s += lf;
0371     _s += "enforced ";
0372     _s += (m_enforced?"true":"false");
0373 
0374     _s += lf;
0375     _s += "visible ";
0376     _s += (m_visible?"true":"false");
0377 
0378     _s += lf;
0379     _s += "editable ";
0380     _s += (m_editable?"true":"false");
0381 
0382     _s += lf;
0383     _s += "automated ";
0384     _s += (m_automated?"true":"false");
0385 
0386     _s += lf;
0387     _s += "pickable ";
0388     _s += (m_pickable?"true":"false");
0389 
0390     _s += lf;
0391     _s += "marker_style ";
0392     _s += smarker_style(m_marker_style);
0393 
0394     _s += lf;
0395     _s += "area_style ";
0396     _s += sarea_style(m_area_style);
0397 
0398     _s += lf;
0399     _s += "modeling ";
0400     _s += m_modeling;
0401 
0402     _s += lf;
0403     _s += "coloring ";
0404     _s += m_coloring;
0405 
0406     _s += lf;
0407     _s += "title ";
0408     _s += m_title;
0409 
0410     _s += lf;
0411     _s += "light_model ";
0412     _s += m_light_model;
0413 
0414     _s += lf;
0415     _s += "tick_modeling ";
0416     _s += m_tick_modeling;
0417 
0418     _s += lf;
0419     _s += "encoding ";
0420     _s += m_encoding;
0421 
0422     _s += lf;
0423     _s += "cut ";
0424     _s += m_cut;
0425 
0426     _s += lf;
0427     _s += "painting ";
0428     _s += spainting_policy(m_painting);
0429 
0430     _s += lf;
0431     _s += "hatching ";
0432     _s += shatching_policy(m_hatching);
0433 
0434     _s += lf;
0435     _s += "projection ";
0436     _s += sprojection_type(m_projection);
0437 
0438     _s += lf;
0439     _s += "font ";
0440     _s += m_font;
0441 
0442     if(m_font_modeling==font_outline) {
0443       _s += lf;
0444       _s += "font_modeling ";
0445       _s += s_font_outline();
0446     } else if(m_font_modeling==font_filled)  {
0447       _s += lf;
0448       _s += "font_modeling ";
0449       _s += s_font_filled();
0450     } else if(m_font_modeling==font_pixmap)  {
0451       _s += lf;
0452       _s += "font_modeling ";
0453       _s += s_font_pixmap();
0454     }
0455 
0456     _s += lf;
0457     _s += "options ";
0458     _s += m_options;
0459 
0460     _s += lf;
0461     _s += "color_mapping ";
0462     _s += m_color_mapping;
0463 
0464     _s += lf;
0465     _s += "front_face ";
0466     _s += (m_front_face==winding_ccw?"ccw":"cw");
0467 
0468     _s += lf;
0469     _s += "hjust ";
0470     _s += shjust(m_hjust);
0471 
0472     _s += lf;
0473     _s += "vjust ";
0474     _s += svjust(m_vjust);
0475 
0476     return _s;
0477   }
0478 
0479   void color(const colorf& a_v){m_color = a_v;}
0480   colorf color() const {return m_color;}
0481 
0482   void highlight_color(const colorf& a_v){m_highlight_color = a_v;}
0483   colorf highlight_color() const {return m_highlight_color;}
0484 
0485   void back_color(const colorf& a_v){m_back_color = a_v;}
0486   colorf back_color() const {return m_back_color;}
0487 
0488   void width(float a_v){m_width = a_v;}
0489   float width() const {return m_width;}
0490 
0491   void line_width(float a_v){m_line_width = a_v;}
0492   float line_width() const {return m_line_width;}
0493 
0494   float back_shadow() const {return m_back_shadow;}
0495   void back_shadow(float a_v) {m_back_shadow = a_v;}
0496 
0497   void marker_style(sg::marker_style a_v){m_marker_style = a_v;}
0498   sg::marker_style marker_style() const {return m_marker_style;}
0499 
0500   void marker_size(float a_v){m_marker_size = a_v;}
0501   float marker_size() const {return m_marker_size;}
0502 
0503   void point_size(float a_v){m_point_size = a_v;}
0504   float point_size() const {return m_point_size;}
0505 
0506   void font_size(float a_v){m_font_size = a_v;}
0507   float font_size() const {return m_font_size;}
0508 
0509   void font_modeling(sg::font_modeling a_v){m_font_modeling = a_v;}
0510   sg::font_modeling font_modeling() const {return m_font_modeling;}
0511 
0512   void area_style(sg::area_style a_v){m_area_style = a_v;}
0513   sg::area_style area_style() const {return m_area_style;}
0514 
0515   void modeling(const std::string& a_v){m_modeling  = a_v;}
0516   const std::string& modeling() const {return m_modeling ;}
0517 
0518   void light_model(const std::string& a_v){m_light_model = a_v;}
0519   const std::string& light_model() const {return m_light_model;}
0520 
0521   void tick_modeling(const std::string& a_v){m_tick_modeling = a_v;}
0522   const std::string& tick_modeling() const {return m_tick_modeling;}
0523 
0524   void encoding(const std::string& a_v){m_encoding = a_v;}
0525   const std::string& encoding() const {return m_encoding;}
0526 
0527   void smoothing(bool a_v){m_smoothing = a_v;}
0528   bool smoothing() const {return m_smoothing;}
0529 
0530   void hinting(bool a_v){m_hinting = a_v;}
0531   bool hinting() const {return m_hinting;}
0532 
0533   sg::painting_policy painting() const {return m_painting;}
0534   void painting(sg::painting_policy a_v){m_painting = a_v;}
0535 
0536   sg::hatching_policy hatching() const {return m_hatching;}
0537   void hatching(sg::hatching_policy a_v) {m_hatching = a_v;}
0538 
0539   sg::projection_type projection() const {return m_projection;}
0540   void projection(sg::projection_type a_v){m_projection = a_v;}
0541 
0542   void pattern(lpat a_v){m_pattern = a_v;}
0543   lpat pattern() const {return m_pattern;}
0544 
0545   void line_pattern(lpat a_v){m_line_pattern = a_v;}
0546   lpat line_pattern() const {return m_line_pattern;}
0547 
0548   void font(const std::string& a_v){m_font = a_v;}
0549   const std::string& font() const {return m_font;}
0550 
0551   void divisions(int a_v){m_divisions = a_v;}
0552   int divisions() const {return m_divisions;}
0553 
0554   void rotation_steps(unsigned int a_v){m_rotation_steps = a_v;}
0555   unsigned int rotation_steps() const {return m_rotation_steps;}
0556 
0557   void offset(float a_v){m_offset = a_v;}
0558   float offset() const {return m_offset;}
0559 
0560   void strip_width(float a_v){m_strip_width = a_v;}
0561   float strip_width() const {return m_strip_width;}
0562 
0563   void angle(float a_v){m_angle = a_v;}
0564   float angle() const {return m_angle;}
0565 
0566   void scale(float a_v){m_scale = a_v;}
0567   float scale() const {return m_scale;}
0568 
0569   void bar_offset(float a_v){m_bar_offset = a_v;}
0570   float bar_offset() const {return m_bar_offset;}
0571 
0572   void bar_width(float a_v){m_bar_width = a_v;}
0573   float bar_width() const {return m_bar_width;}
0574 
0575   void multi_node_limit(int a_v){m_multi_node_limit = a_v;}
0576   int multi_node_limit() const {return m_multi_node_limit;}
0577 
0578   void spacing(float a_v){m_spacing = a_v;}
0579   float spacing() const {return m_spacing;}
0580 
0581   void visible(bool a_v){m_visible = a_v;}
0582   bool visible() const{return m_visible;}
0583 
0584   void editable(bool a_v){m_editable = a_v;}
0585   bool editable() const{return m_editable;}
0586 
0587   void automated(bool a_v){m_automated = a_v;}
0588   bool automated() const{return m_automated;}
0589 
0590   void cut(const std::string& a_v){m_cut = a_v;}
0591   const std::string& cut() const {return m_cut;}
0592 
0593   void options(const std::string& a_v){m_options = a_v;}
0594   const std::string& options() const{return m_options;}
0595 
0596   void color_mapping(const std::string& a_v){m_color_mapping = a_v;}
0597   const std::string& color_mapping() const{return m_color_mapping;}
0598 
0599   void enforced(bool a_v){m_enforced = a_v;}
0600   bool enforced() const{return m_enforced;}
0601 
0602   void translation(const vec3f& a_v){m_translation = a_v;}
0603   vec3f translation() const {return m_translation;}
0604 
0605   void front_face(winding_type a_v){m_front_face = a_v;}
0606   winding_type front_face() const {return m_front_face;}
0607 
0608   void hjust(sg::hjust a_v){m_hjust = a_v;}
0609   sg::hjust hjust() const {return m_hjust;}
0610 
0611   void vjust(sg::vjust a_v){m_vjust = a_v;}
0612   sg::vjust vjust() const {return m_vjust;}
0613 
0614   void coloring(const std::string& a_v){m_coloring  = a_v;}
0615   const std::string& coloring() const {return m_coloring;}
0616 
0617   void title(const std::string& a_v){m_title  = a_v;}
0618   const std::string& title() const {return m_title;}
0619 
0620   void pickable(bool a_v){m_pickable  = a_v;}
0621   bool pickable() const {return m_pickable;}
0622 
0623 public:
0624   bool parse(std::ostream& a_out,const cmaps_t& a_cmaps,const std::string& a_s){
0625     // a_s = list of "name value" separated by \n
0626     //::printf("debug : style_parser::parse : \"%s\"\n",a_s.c_str());
0627     std::vector<std::string> lines;
0628     get_lines(a_s,lines);
0629 
0630     tools_vforcit(std::string,lines,it) {
0631       const std::string& line = *it;
0632       if(line.empty()) continue;
0633       if(line=="reset") {
0634         reset();
0635         continue;
0636       }
0637       std::vector<std::string> ws;
0638       words(line," ",false,ws);
0639       size_t wordn = ws.size();
0640       if(!wordn) {
0641         a_out << "style_parser::parse :"
0642               << " in " << sout(a_s)
0643               << " : " << sout(line)
0644               << " has a bad word count (at least two expected)."
0645               << std::endl;
0646         return false;
0647       }
0648       const std::string& word0 = ws[0];
0649       if(word0=="color") {
0650         if(wordn==2) {
0651           const std::string& word1 = ws[1];
0652           if(!find_color(a_cmaps,word1,m_color)) {
0653             a_out << "style_parser::parse :"
0654                   << " in " << sout(a_s)
0655                   << " : " << sout(word1)
0656                   << " not a color."
0657                   << std::endl;
0658             return false;
0659           }
0660         } else if (wordn==4) {
0661           const std::string& rs = ws[1];
0662           float r;
0663           if(!to<float>(rs,r))  {
0664             a_out << "style_parser::parse :"
0665                   << " in " << sout(a_s)
0666                   << " : " << sout(rs)
0667                   << " not a number."
0668                   << std::endl;
0669             return false;
0670           }
0671           const std::string& gs = ws[2];
0672           float g;
0673           if(!to<float>(gs,g))  {
0674             a_out << "style_parser::parse :"
0675                   << " in " << sout(a_s)
0676                   << " : " << sout(gs)
0677                   << " not a number."
0678                   << std::endl;
0679             return false;
0680           }
0681           const std::string& bs = ws[3];
0682           float b;
0683           if(!to<float>(bs,b))  {
0684             a_out << "style_parser::parse :"
0685                   << " in " << sout(a_s)
0686                   << " : " << sout(bs)
0687                   << " not a number."
0688                   << std::endl;
0689             return false;
0690           }
0691           m_color.set_value(r,g,b,1);
0692 
0693         } else if (wordn==5) {
0694           const std::string& rs = ws[1];
0695           float r;
0696           if(!to<float>(rs,r))  {
0697             a_out << "style_parser::parse :"
0698                   << " in " << sout(a_s)
0699                   << " : " << sout(rs)
0700                   << " not a number."
0701                   << std::endl;
0702             return false;
0703           }
0704           const std::string& gs = ws[2];
0705           float g;
0706           if(!to<float>(gs,g))  {
0707             a_out << "style_parser::parse :"
0708                   << " in " << sout(a_s)
0709                   << " : " << sout(gs)
0710                   << " not a number."
0711                   << std::endl;
0712             return false;
0713           }
0714           const std::string& bs = ws[3];
0715           float b;
0716           if(!to<float>(bs,b))  {
0717             a_out << "style_parser::parse :"
0718                   << " in " << sout(a_s)
0719                   << " : " << sout(bs)
0720                   << " not a number."
0721                   << std::endl;
0722             return false;
0723           }
0724           const std::string& as = ws[4];
0725           float a;
0726           if(!to<float>(as,a))  {
0727             a_out << "style_parser::parse :"
0728                   << " in " << sout(a_s)
0729                   << " : " << sout(as)
0730                   << " not a number."
0731                   << std::endl;
0732             return false;
0733           }
0734           m_color.set_value(r,g,b,a);
0735 
0736         } else {
0737           a_out << "style_parser::parse :"
0738                 << " in " << sout(a_s)
0739                 << " : " << sout(line)
0740                 << " has a bad word count (two or four expected)."
0741                 << std::endl;
0742           return false;
0743         }
0744 
0745       } else if(word0=="highlight_color") {
0746         if(wordn==2) {
0747           const std::string& word1 = ws[1];
0748           if(!find_color(a_cmaps,word1,m_highlight_color)) {
0749             a_out << "style_parser::parse :"
0750                   << " in " << sout(a_s)
0751                   << " : " << sout(word1)
0752                   << " not a color."
0753                   << std::endl;
0754             return false;
0755           }
0756         } else if (wordn==4) {
0757           const std::string& rs = ws[1];
0758           float r;
0759           if(!to<float>(rs,r))  {
0760             a_out << "style_parser::parse :"
0761                   << " in " << sout(a_s)
0762                   << " : " << sout(rs)
0763                   << " not a number."
0764                   << std::endl;
0765             return false;
0766           }
0767           const std::string& gs = ws[2];
0768           float g;
0769           if(!to<float>(gs,g))  {
0770             a_out << "style_parser::parse :"
0771                   << " in " << sout(a_s)
0772                   << " : " << sout(gs)
0773                   << " not a number."
0774                   << std::endl;
0775             return false;
0776           }
0777           const std::string& bs = ws[3];
0778           float b;
0779           if(!to<float>(bs,b))  {
0780             a_out << "style_parser::parse :"
0781                   << " in " << sout(a_s)
0782                   << " : " << sout(bs)
0783                   << " not a number."
0784                   << std::endl;
0785             return false;
0786           }
0787           m_highlight_color.set_value(r,g,b,1);
0788 
0789         } else if (wordn==5) {
0790           const std::string& rs = ws[1];
0791           float r;
0792           if(!to<float>(rs,r))  {
0793             a_out << "style_parser::parse :"
0794                   << " in " << sout(a_s)
0795                   << " : " << sout(rs)
0796                   << " not a number."
0797                   << std::endl;
0798             return false;
0799           }
0800           const std::string& gs = ws[2];
0801           float g;
0802           if(!to<float>(gs,g))  {
0803             a_out << "style_parser::parse :"
0804                   << " in " << sout(a_s)
0805                   << " : " << sout(gs)
0806                   << " not a number."
0807                   << std::endl;
0808             return false;
0809           }
0810           const std::string& bs = ws[3];
0811           float b;
0812           if(!to<float>(bs,b))  {
0813             a_out << "style_parser::parse :"
0814                   << " in " << sout(a_s)
0815                   << " : " << sout(bs)
0816                   << " not a number."
0817                   << std::endl;
0818             return false;
0819           }
0820           const std::string& as = ws[4];
0821           float a;
0822           if(!to<float>(as,a))  {
0823             a_out << "style_parser::parse :"
0824                   << " in " << sout(a_s)
0825                   << " : " << sout(as)
0826                   << " not a number."
0827                   << std::endl;
0828             return false;
0829           }
0830           m_highlight_color.set_value(r,g,b,a);
0831 
0832         } else {
0833           a_out << "style_parser::parse :"
0834                 << " in " << sout(a_s)
0835                 << " : " << sout(line)
0836                 << " has a bad word count (two or four expected)."
0837                 << std::endl;
0838           return false;
0839         }
0840 
0841       } else if(word0=="back_color") {
0842         if(wordn==2) {
0843           const std::string& word1 = ws[1];
0844           if(!find_color(a_cmaps,word1,m_back_color)) {
0845             a_out << "style_parser::parse :"
0846                   << " in " << sout(a_s)
0847                   << " : " << sout(word1)
0848                   << " not a color."
0849                   << std::endl;
0850             return false;
0851           }
0852         } else if (wordn==4) {
0853           const std::string& rs = ws[1];
0854           float r;
0855           if(!to<float>(rs,r))  {
0856             a_out << "style_parser::parse :"
0857                   << " in " << sout(a_s)
0858                   << " : " << sout(rs)
0859                   << " not a number."
0860                   << std::endl;
0861             return false;
0862           }
0863           const std::string& gs = ws[2];
0864           float g;
0865           if(!to<float>(gs,g))  {
0866             a_out << "style_parser::parse :"
0867                   << " in " << sout(a_s)
0868                   << " : " << sout(gs)
0869                   << " not a number."
0870                   << std::endl;
0871             return false;
0872           }
0873           const std::string& bs = ws[3];
0874           float b;
0875           if(!to<float>(bs,b))  {
0876             a_out << "style_parser::parse :"
0877                   << " in " << sout(a_s)
0878                   << " : " << sout(bs)
0879                   << " not a number."
0880                   << std::endl;
0881             return false;
0882           }
0883           m_back_color.set_value(r,g,b,1);
0884 
0885         } else if (wordn==5) {
0886           const std::string& rs = ws[1];
0887           float r;
0888           if(!to<float>(rs,r))  {
0889             a_out << "style_parser::parse :"
0890                   << " in " << sout(a_s)
0891                   << " : " << sout(rs)
0892                   << " not a number."
0893                   << std::endl;
0894             return false;
0895           }
0896           const std::string& gs = ws[2];
0897           float g;
0898           if(!to<float>(gs,g))  {
0899             a_out << "style_parser::parse :"
0900                   << " in " << sout(a_s)
0901                   << " : " << sout(gs)
0902                   << " not a number."
0903                   << std::endl;
0904             return false;
0905           }
0906           const std::string& bs = ws[3];
0907           float b;
0908           if(!to<float>(bs,b))  {
0909             a_out << "style_parser::parse :"
0910                   << " in " << sout(a_s)
0911                   << " : " << sout(bs)
0912                   << " not a number."
0913                   << std::endl;
0914             return false;
0915           }
0916           const std::string& as = ws[4];
0917           float a;
0918           if(!to<float>(as,a))  {
0919             a_out << "style_parser::parse :"
0920                   << " in " << sout(a_s)
0921                   << " : " << sout(as)
0922                   << " not a number."
0923                   << std::endl;
0924             return false;
0925           }
0926           m_back_color.set_value(r,g,b,a);
0927 
0928         } else {
0929           a_out << "style_parser::parse :"
0930                 << " in " << sout(a_s)
0931                 << " : " << sout(line)
0932                 << " has a bad word count (two or four expected)."
0933                 << std::endl;
0934           return false;
0935         }
0936 
0937       } else if(word0=="pattern") {
0938         if(!check_2(wordn,a_s,line,a_out)) return false;
0939         const std::string& word1 = ws[1];
0940         unsigned long ul;
0941         if(!sline_pattern(word1,m_pattern)) {
0942           if(!to_ulong(word1,ul)) {
0943             a_out << "style_parser::parse :"
0944                   << " in " << sout(a_s)
0945                   << " : " << sout(word1)
0946                   << " not a line pattern."
0947                   << std::endl;
0948             return false;
0949           }
0950           m_pattern = (lpat)ul;
0951         }
0952 
0953       } else if(word0=="line_pattern") {
0954         if(!check_2(wordn,a_s,line,a_out)) return false;
0955         const std::string& word1 = ws[1];
0956         unsigned long ul;
0957         if(!sline_pattern(word1,m_line_pattern)) {
0958           if(!to_ulong(word1,ul)) {
0959             a_out << "style_parser::parse :"
0960                   << " in " << sout(a_s)
0961                   << " : " << sout(word1)
0962                   << " not a line pattern."
0963                   << std::endl;
0964             return false;
0965           }
0966           m_line_pattern = (lpat)ul;
0967         }
0968       } else if(word0=="marker_style") {
0969         if(!check_2(wordn,a_s,line,a_out)) return false;
0970         const std::string& word1 = ws[1];
0971         if(!smarker_style(word1,m_marker_style)) {
0972           a_out << "style_parser::parse :"
0973                 << " in " << sout(a_s)
0974                 << " : " << sout(word1)
0975                 << " not a marker_style."
0976                 << std::endl;
0977           return false;
0978         }
0979       } else if(word0=="area_style") {
0980         if(!check_2(wordn,a_s,line,a_out)) return false;
0981         const std::string& word1 = ws[1];
0982         if(!sarea_style(word1,m_area_style)) {
0983           a_out << "style_parser::parse :"
0984                 << " in " << sout(a_s)
0985                 << " : " << sout(word1)
0986                 << " not a area_style."
0987                 << std::endl;
0988           return false;
0989         }
0990       } else if(word0=="modeling") {
0991         if(!check_2(wordn,a_s,line,a_out)) return false;
0992         m_modeling  = ws[1];
0993       } else if(word0=="light_model") {
0994         if(!check_2(wordn,a_s,line,a_out)) return false;
0995         m_light_model = ws[1];
0996       } else if(word0=="tick_modeling") {
0997         if(!check_2(wordn,a_s,line,a_out)) return false;
0998         m_tick_modeling = ws[1];
0999       } 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;
1095              if(ws[1]==s_font_outline()) m_font_modeling = font_outline;
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;
1116         m_multi_node_limit = value;
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;
1126         m_rotation_steps = value;
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") {
1228           m_front_face = winding_ccw;
1229         } else if(word1=="cw") {
1230           m_front_face = winding_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:
1352   colorf m_color;
1353   colorf m_highlight_color;
1354   colorf m_back_color;
1355   float m_width;
1356   float m_line_width;
1357   float m_marker_size;
1358   float m_point_size;
1359   float m_font_size;
1360   sg::font_modeling m_font_modeling;
1361   lpat m_pattern;
1362   lpat m_line_pattern;
1363   sg::marker_style m_marker_style;
1364   sg::area_style m_area_style;
1365   std::string m_modeling;
1366   std::string m_light_model;
1367   std::string m_tick_modeling;
1368   std::string m_encoding;
1369   bool m_smoothing;
1370   bool m_hinting;
1371   std::string m_cut;
1372   sg::painting_policy m_painting;
1373   sg::hatching_policy m_hatching;
1374   sg::projection_type m_projection;
1375   std::string m_font;
1376   int m_multi_node_limit; //could be no_limit = -1.
1377   int m_divisions;
1378   unsigned int m_rotation_steps;
1379   float m_back_shadow;
1380   float m_spacing;
1381   float m_angle;
1382   float m_scale;
1383   float m_offset;
1384   float m_strip_width;
1385   bool m_visible;
1386   float m_bar_offset;
1387   float m_bar_width;
1388   bool m_editable;
1389   bool m_automated;
1390   std::string m_options;
1391   std::string m_color_mapping;
1392   bool m_enforced;
1393   vec3f m_translation;
1394   winding_type m_front_face;
1395   sg::hjust m_hjust;
1396   sg::vjust m_vjust;
1397   std::string m_coloring;
1398   std::string m_title;
1399   bool m_pickable;
1400 };
1401 
1402 }}
1403 
1404 #endif