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 public:
0022   style_parser()
0023   :m_color(0,0,0)
0024   ,m_highlight_color(0,0,0)
0025   ,m_back_color(1,1,1)
0026   ,m_width(1)
0027   ,m_line_width(1)
0028   ,m_marker_size(1)
0029   ,m_point_size(1)
0030   ,m_font_size(10)
0031   ,m_font_modeling(font_filled)
0032   ,m_pattern(line_solid)
0033   ,m_line_pattern(line_solid)
0034   ,m_marker_style(marker_dot)
0035   ,m_area_style(area_solid)
0036   ,m_modeling(modeling_boxes())
0037   ,m_light_model(light_model_phong())
0038   ,m_tick_modeling(tick_modeling_hippo())
0039   ,m_encoding(encoding_none())
0040   ,m_smoothing(false)
0041   ,m_hinting(false)
0042   ,m_cut()
0043   ,m_painting(painting_uniform)
0044   ,m_hatching(hatching_none)
0045   ,m_projection(projection_none)
0046   ,m_font("default")
0047   ,m_multi_node_limit(no_limit())
0048   ,m_divisions(510) //Same as CERN-ROOT/TAttAxis
0049   ,m_rotation_steps(24) //Same as SbPolyhedron default.
0050   ,m_back_shadow(0)
0051   ,m_spacing(0.05F)
0052   ,m_angle(fpi()/4.0F)
0053   ,m_scale(1)
0054   ,m_offset(0)
0055   ,m_strip_width(0)
0056   ,m_visible(true)
0057   ,m_bar_offset(0.25F)
0058   ,m_bar_width(0.5F)
0059   ,m_editable(false)
0060   ,m_automated(true)
0061   ,m_options()
0062   ,m_color_mapping()
0063   ,m_enforced(false)
0064   ,m_translation(0,0,0)
0065   ,m_front_face(winding_ccw)
0066   ,m_hjust(left)
0067   ,m_vjust(bottom)
0068   ,m_coloring()
0069   ,m_title()
0070   ,m_pickable(false)
0071   {
0072   }
0073 
0074   virtual ~style_parser(){
0075   }
0076 public:
0077   style_parser(const style_parser& a_from)
0078   :m_color(a_from.m_color)
0079   ,m_highlight_color(a_from.m_highlight_color)
0080   ,m_back_color(a_from.m_back_color)
0081   ,m_width(a_from.m_width)
0082   ,m_line_width(a_from.m_line_width)
0083   ,m_marker_size(a_from.m_marker_size)
0084   ,m_point_size(a_from.m_point_size)
0085   ,m_font_size(a_from.m_font_size)
0086   ,m_font_modeling(a_from.m_font_modeling)
0087   ,m_pattern(a_from.m_pattern)
0088   ,m_line_pattern(a_from.m_line_pattern)
0089   ,m_marker_style(a_from.m_marker_style)
0090   ,m_area_style(a_from.m_area_style)
0091   ,m_modeling (a_from.m_modeling )
0092   ,m_light_model(a_from.m_light_model)
0093   ,m_tick_modeling(a_from.m_tick_modeling)
0094   ,m_encoding(a_from.m_encoding)
0095   ,m_smoothing(a_from.m_smoothing)
0096   ,m_hinting(a_from.m_hinting)
0097   ,m_cut(a_from.m_cut)
0098   ,m_painting(a_from.m_painting)
0099   ,m_hatching(a_from.m_hatching)
0100   ,m_projection(a_from.m_projection)
0101   ,m_font(a_from.m_font)
0102   ,m_multi_node_limit(a_from.m_multi_node_limit)
0103   ,m_divisions(a_from.m_divisions)
0104   ,m_rotation_steps(a_from.m_rotation_steps)
0105   ,m_back_shadow(a_from.m_back_shadow)
0106   ,m_spacing(a_from.m_spacing)
0107   ,m_angle(a_from.m_angle)
0108   ,m_scale(a_from.m_scale)
0109   ,m_offset(a_from.m_offset)
0110   ,m_strip_width(a_from.m_strip_width)
0111   ,m_visible(a_from.m_visible)
0112   ,m_bar_offset(a_from.m_bar_offset)
0113   ,m_bar_width(a_from.m_bar_width)
0114   ,m_editable(a_from.m_editable)
0115   ,m_automated(a_from.m_automated)
0116   ,m_options(a_from.m_options)
0117   ,m_color_mapping(a_from.m_color_mapping)
0118   ,m_enforced(a_from.m_enforced)
0119   ,m_translation(a_from.m_translation)
0120   ,m_front_face(a_from.m_front_face)
0121   ,m_hjust(a_from.m_hjust)
0122   ,m_vjust(a_from.m_vjust)
0123   ,m_coloring(a_from.m_coloring)
0124   ,m_title(a_from.m_title)
0125   ,m_pickable(a_from.m_pickable)
0126   {
0127   }
0128 
0129   style_parser& operator=(const style_parser& a_from){
0130     copy(a_from);
0131     return *this;
0132   }
0133 public:
0134   static int no_limit() {return (-1);}
0135 public:
0136   void copy(const style_parser& a_from){
0137     m_color = a_from.m_color;
0138     m_highlight_color = a_from.m_highlight_color;
0139     m_back_color = a_from.m_back_color;
0140     m_width = a_from.m_width;
0141     m_line_width = a_from.m_line_width;
0142     m_marker_size = a_from.m_marker_size;
0143     m_point_size = a_from.m_point_size;
0144     m_font_size = a_from.m_font_size;
0145     m_font_modeling = a_from.m_font_modeling;
0146     m_pattern = a_from.m_pattern;
0147     m_line_pattern = a_from.m_line_pattern;
0148     m_marker_style = a_from.m_marker_style;
0149     m_area_style = a_from.m_area_style;
0150     m_modeling  = a_from.m_modeling;
0151     m_light_model = a_from.m_light_model;
0152     m_tick_modeling = a_from.m_tick_modeling;
0153     m_encoding = a_from.m_encoding;
0154     m_smoothing = a_from.m_smoothing;
0155     m_hinting = a_from.m_hinting;
0156     m_cut = a_from.m_cut;
0157     m_painting = a_from.m_painting;
0158     m_hatching = a_from.m_hatching;
0159     m_projection = a_from.m_projection;
0160     m_font = a_from.m_font;
0161     m_multi_node_limit = a_from.m_multi_node_limit;
0162     m_divisions = a_from.m_divisions;
0163     m_rotation_steps = a_from.m_rotation_steps;
0164     m_back_shadow = a_from.m_back_shadow;
0165     m_spacing = a_from.m_spacing;
0166     m_angle = a_from.m_angle;
0167     m_scale = a_from.m_scale;
0168     m_offset = a_from.m_offset;
0169     m_strip_width = a_from.m_strip_width;
0170     m_visible = a_from.m_visible;
0171     m_bar_offset = a_from.m_bar_offset;
0172     m_bar_width = a_from.m_bar_width;
0173     m_editable = a_from.m_editable;
0174     m_automated = a_from.m_automated;
0175     m_options = a_from.m_options;
0176     m_color_mapping = a_from.m_color_mapping;
0177     m_enforced = a_from.m_enforced;
0178     m_translation = a_from.m_translation;
0179     m_front_face = a_from.m_front_face;
0180     m_hjust = a_from.m_hjust;
0181     m_vjust = a_from.m_vjust;
0182     m_coloring  = a_from.m_coloring;
0183     m_title  = a_from.m_title;
0184     m_pickable  = a_from.m_pickable;
0185   }
0186 
0187   bool equal(const style_parser& a_from){
0188     if(m_width!=a_from.m_width) return false;
0189     if(m_line_width!=a_from.m_line_width) return false;
0190     if(m_marker_size!=a_from.m_marker_size) return false;
0191     if(m_point_size!=a_from.m_point_size) return false;
0192     if(m_font_size!=a_from.m_font_size) return false;
0193     if(m_font_modeling!=a_from.m_font_modeling) return false;
0194     if(m_pattern!=a_from.m_pattern) return false;
0195     if(m_line_pattern!=a_from.m_line_pattern) return false;
0196     if(m_marker_style!=a_from.m_marker_style) return false;
0197     if(m_area_style!=a_from.m_area_style) return false;
0198     if(m_smoothing!=a_from.m_smoothing) return false;
0199     if(m_hinting!=a_from.m_hinting) return false;
0200     if(m_painting!=a_from.m_painting) return false;
0201     if(m_hatching!=a_from.m_hatching) return false;
0202     if(m_projection!=a_from.m_projection) return false;
0203     if(m_multi_node_limit!=a_from.m_multi_node_limit) return false;
0204     if(m_divisions!=a_from.m_divisions) return false;
0205     if(m_rotation_steps!=a_from.m_rotation_steps) return false;
0206     if(m_back_shadow!=a_from.m_back_shadow) return false;
0207     if(m_spacing!=a_from.m_spacing) return false;
0208     if(m_angle!=a_from.m_angle) return false;
0209     if(m_scale!=a_from.m_scale) return false;
0210     if(m_offset!=a_from.m_offset) return false;
0211     if(m_strip_width!=a_from.m_strip_width) return false;
0212     if(m_visible!=a_from.m_visible) return false;
0213     if(m_bar_offset!=a_from.m_bar_offset) return false;
0214     if(m_bar_width!=a_from.m_bar_width) return false;
0215     if(m_editable!=a_from.m_editable) return false;
0216     if(m_automated!=a_from.m_automated) return false;
0217     if(m_enforced!=a_from.m_enforced) return false;
0218 
0219     //color
0220     if(m_color!=a_from.m_color) return false;
0221     if(m_highlight_color!=a_from.m_highlight_color) return false;
0222     if(m_back_color!=a_from.m_back_color) return false;
0223 
0224     //std::string
0225     if(m_modeling!=a_from.m_modeling) return false;
0226     if(m_light_model!=a_from.m_light_model) return false;
0227     if(m_tick_modeling!=a_from.m_tick_modeling) return false;
0228     if(m_encoding!=a_from.m_encoding) return false;
0229     if(m_cut!=a_from.m_cut) return false;
0230     if(m_font!=a_from.m_font) return false;
0231     if(m_options!=a_from.m_options) return false;
0232     if(m_color_mapping!=a_from.m_color_mapping) return false;
0233 
0234     if(m_translation!=a_from.m_translation) return false;
0235 
0236     if(m_front_face!=a_from.m_front_face) return false;
0237 
0238     if(m_hjust!=a_from.m_hjust) return false;
0239     if(m_vjust!=a_from.m_vjust) return false;
0240 
0241     if(m_coloring!=a_from.m_coloring) return false;
0242     if(m_title!=a_from.m_title) return false;
0243     if(m_pickable!=a_from.m_pickable) return false;
0244 
0245     return true;
0246   }
0247 
0248   virtual void reset(){ //virtual because of SoGC
0249     m_color = colorf_black();
0250     m_highlight_color = colorf_lightgrey();
0251     m_back_color = colorf_white();
0252     m_width = 1;
0253     m_line_width = 1;
0254     m_marker_size = 1;
0255     m_point_size = 1;
0256     m_font_size = 10;
0257     m_font_modeling = font_filled;
0258     m_pattern = line_solid;
0259     m_line_pattern = line_solid;
0260     m_marker_style = marker_dot;
0261     m_area_style = area_solid;
0262     m_modeling  = modeling_boxes();
0263     m_light_model = light_model_phong();
0264     m_tick_modeling = tick_modeling_hippo();
0265     m_encoding = encoding_none();
0266     m_smoothing = false;
0267     m_hinting = false;
0268     m_cut = "";
0269     m_painting = painting_uniform;
0270     m_hatching = hatching_none;
0271     m_projection = projection_none;
0272     m_font = "default";
0273     m_multi_node_limit = no_limit();
0274     m_back_shadow = 0;
0275     m_divisions = 510;
0276     m_rotation_steps = 24;
0277     m_spacing = 0.05F;
0278     m_angle = fpi()/4;
0279     m_scale = 1;
0280     m_offset = 0;
0281     m_strip_width = 0;
0282     m_visible = true;
0283     m_bar_offset = 0.25F;
0284     m_bar_width = 0.5F;
0285     m_editable = false;
0286     m_automated = true;
0287     m_options = "";
0288     m_color_mapping = "";
0289     m_enforced = false;
0290     m_translation = vec3f(0,0,0);
0291     m_front_face = winding_ccw;
0292     m_hjust = left;
0293     m_vjust = bottom;
0294     m_coloring = "";
0295     m_title = "";
0296     m_pickable = false;
0297   }
0298 
0299   std::string tos() const{
0300     char ss[40 * 32];
0301     snpf(ss,sizeof(ss),
0302 "color %g %g %g\n\
0303 highlight_color %g %g %g\n\
0304 back_color %g %g %g\n\
0305 width %g\n\
0306 line_width %g\n\
0307 marker_size %g\n\
0308 point_size %g\n\
0309 font_size %g\n\
0310 pattern %x\n\
0311 line_pattern %x\n\
0312 multi_node_limit %d\n\
0313 back_shadow %g\n\
0314 divisions %d\n\
0315 rotation_steps %d\n\
0316 angle %g\n\
0317 scale %g\n\
0318 offset %g\n\
0319 strip_width %g\n\
0320 spacing %g\n\
0321 bar_offset %g\n\
0322 bar_width %g\n\
0323 translation %g %g %g"
0324     ,m_color[0],m_color[1],m_color[2]
0325     ,m_highlight_color[0],m_highlight_color[1],m_highlight_color[2]
0326     ,m_back_color[0],m_back_color[1],m_back_color[2]
0327     ,m_width
0328     ,m_line_width
0329     ,m_marker_size
0330     ,m_point_size
0331     ,m_font_size
0332     ,m_pattern
0333     ,m_line_pattern
0334     ,m_multi_node_limit
0335     ,m_back_shadow
0336     ,m_divisions
0337     ,m_rotation_steps
0338     ,m_angle
0339     ,m_scale
0340     ,m_offset
0341     ,m_strip_width
0342     ,m_spacing
0343     ,m_bar_offset
0344     ,m_bar_width
0345     ,m_translation[0],m_translation[1],m_translation[2]);
0346 
0347     std::string lf("\n");
0348     std::string _s(ss);
0349 
0350     _s += lf;
0351     _s += "smoothing ";
0352     _s += (m_smoothing?"true":"false");
0353 
0354     _s += lf;
0355     _s += "hinting ";
0356     _s += (m_hinting?"true":"false");
0357 
0358     _s += lf;
0359     _s += "enforced ";
0360     _s += (m_enforced?"true":"false");
0361 
0362     _s += lf;
0363     _s += "visible ";
0364     _s += (m_visible?"true":"false");
0365 
0366     _s += lf;
0367     _s += "editable ";
0368     _s += (m_editable?"true":"false");
0369 
0370     _s += lf;
0371     _s += "automated ";
0372     _s += (m_automated?"true":"false");
0373 
0374     _s += lf;
0375     _s += "pickable ";
0376     _s += (m_pickable?"true":"false");
0377 
0378     _s += lf;
0379     _s += "marker_style ";
0380     _s += smarker_style(m_marker_style);
0381 
0382     _s += lf;
0383     _s += "area_style ";
0384     _s += sarea_style(m_area_style);
0385 
0386     _s += lf;
0387     _s += "modeling ";
0388     _s += m_modeling;
0389 
0390     _s += lf;
0391     _s += "coloring ";
0392     _s += m_coloring;
0393 
0394     _s += lf;
0395     _s += "title ";
0396     _s += m_title;
0397 
0398     _s += lf;
0399     _s += "light_model ";
0400     _s += m_light_model;
0401 
0402     _s += lf;
0403     _s += "tick_modeling ";
0404     _s += m_tick_modeling;
0405 
0406     _s += lf;
0407     _s += "encoding ";
0408     _s += m_encoding;
0409 
0410     _s += lf;
0411     _s += "cut ";
0412     _s += m_cut;
0413 
0414     _s += lf;
0415     _s += "painting ";
0416     _s += spainting_policy(m_painting);
0417 
0418     _s += lf;
0419     _s += "hatching ";
0420     _s += shatching_policy(m_hatching);
0421 
0422     _s += lf;
0423     _s += "projection ";
0424     _s += sprojection_type(m_projection);
0425 
0426     _s += lf;
0427     _s += "font ";
0428     _s += m_font;
0429 
0430     if(m_font_modeling==font_outline) {
0431       _s += lf;
0432       _s += "font_modeling ";
0433       _s += s_font_outline();
0434     } else if(m_font_modeling==font_filled)  {
0435       _s += lf;
0436       _s += "font_modeling ";
0437       _s += s_font_filled();
0438     } else if(m_font_modeling==font_pixmap)  {
0439       _s += lf;
0440       _s += "font_modeling ";
0441       _s += s_font_pixmap();
0442     }
0443 
0444     _s += lf;
0445     _s += "options ";
0446     _s += m_options;
0447 
0448     _s += lf;
0449     _s += "color_mapping ";
0450     _s += m_color_mapping;
0451 
0452     _s += lf;
0453     _s += "front_face ";
0454     _s += (m_front_face==winding_ccw?"ccw":"cw");
0455 
0456     _s += lf;
0457     _s += "hjust ";
0458     _s += shjust(m_hjust);
0459 
0460     _s += lf;
0461     _s += "vjust ";
0462     _s += svjust(m_vjust);
0463 
0464     return _s;
0465   }
0466 
0467   void color(const colorf& a_v){m_color = a_v;}
0468   colorf color() const {return m_color;}
0469 
0470   void highlight_color(const colorf& a_v){m_highlight_color = a_v;}
0471   colorf highlight_color() const {return m_highlight_color;}
0472 
0473   void back_color(const colorf& a_v){m_back_color = a_v;}
0474   colorf back_color() const {return m_back_color;}
0475 
0476   void width(float a_v){m_width = a_v;}
0477   float width() const {return m_width;}
0478 
0479   void line_width(float a_v){m_line_width = a_v;}
0480   float line_width() const {return m_line_width;}
0481 
0482   float back_shadow() const {return m_back_shadow;}
0483   void back_shadow(float a_v) {m_back_shadow = a_v;}
0484 
0485   void marker_style(sg::marker_style a_v){m_marker_style = a_v;}
0486   sg::marker_style marker_style() const {return m_marker_style;}
0487 
0488   void marker_size(float a_v){m_marker_size = a_v;}
0489   float marker_size() const {return m_marker_size;}
0490 
0491   void point_size(float a_v){m_point_size = a_v;}
0492   float point_size() const {return m_point_size;}
0493 
0494   void font_size(float a_v){m_font_size = a_v;}
0495   float font_size() const {return m_font_size;}
0496 
0497   void font_modeling(sg::font_modeling a_v){m_font_modeling = a_v;}
0498   sg::font_modeling font_modeling() const {return m_font_modeling;}
0499 
0500   void area_style(sg::area_style a_v){m_area_style = a_v;}
0501   sg::area_style area_style() const {return m_area_style;}
0502 
0503   void modeling(const std::string& a_v){m_modeling  = a_v;}
0504   const std::string& modeling() const {return m_modeling ;}
0505 
0506   void light_model(const std::string& a_v){m_light_model = a_v;}
0507   const std::string& light_model() const {return m_light_model;}
0508 
0509   void tick_modeling(const std::string& a_v){m_tick_modeling = a_v;}
0510   const std::string& tick_modeling() const {return m_tick_modeling;}
0511 
0512   void encoding(const std::string& a_v){m_encoding = a_v;}
0513   const std::string& encoding() const {return m_encoding;}
0514 
0515   void smoothing(bool a_v){m_smoothing = a_v;}
0516   bool smoothing() const {return m_smoothing;}
0517 
0518   void hinting(bool a_v){m_hinting = a_v;}
0519   bool hinting() const {return m_hinting;}
0520 
0521   sg::painting_policy painting() const {return m_painting;}
0522   void painting(sg::painting_policy a_v){m_painting = a_v;}
0523 
0524   sg::hatching_policy hatching() const {return m_hatching;}
0525   void hatching(sg::hatching_policy a_v) {m_hatching = a_v;}
0526 
0527   sg::projection_type projection() const {return m_projection;}
0528   void projection(sg::projection_type a_v){m_projection = a_v;}
0529 
0530   void pattern(lpat a_v){m_pattern = a_v;}
0531   lpat pattern() const {return m_pattern;}
0532 
0533   void line_pattern(lpat a_v){m_line_pattern = a_v;}
0534   lpat line_pattern() const {return m_line_pattern;}
0535 
0536   void font(const std::string& a_v){m_font = a_v;}
0537   const std::string& font() const {return m_font;}
0538 
0539   void divisions(int a_v){m_divisions = a_v;}
0540   int divisions() const {return m_divisions;}
0541 
0542   void rotation_steps(unsigned int a_v){m_rotation_steps = a_v;}
0543   unsigned int rotation_steps() const {return m_rotation_steps;}
0544 
0545   void offset(float a_v){m_offset = a_v;}
0546   float offset() const {return m_offset;}
0547 
0548   void strip_width(float a_v){m_strip_width = a_v;}
0549   float strip_width() const {return m_strip_width;}
0550 
0551   void angle(float a_v){m_angle = a_v;}
0552   float angle() const {return m_angle;}
0553 
0554   void scale(float a_v){m_scale = a_v;}
0555   float scale() const {return m_scale;}
0556 
0557   void bar_offset(float a_v){m_bar_offset = a_v;}
0558   float bar_offset() const {return m_bar_offset;}
0559 
0560   void bar_width(float a_v){m_bar_width = a_v;}
0561   float bar_width() const {return m_bar_width;}
0562 
0563   void multi_node_limit(int a_v){m_multi_node_limit = a_v;}
0564   int multi_node_limit() const {return m_multi_node_limit;}
0565 
0566   void spacing(float a_v){m_spacing = a_v;}
0567   float spacing() const {return m_spacing;}
0568 
0569   void visible(bool a_v){m_visible = a_v;}
0570   bool visible() const{return m_visible;}
0571 
0572   void editable(bool a_v){m_editable = a_v;}
0573   bool editable() const{return m_editable;}
0574 
0575   void automated(bool a_v){m_automated = a_v;}
0576   bool automated() const{return m_automated;}
0577 
0578   void cut(const std::string& a_v){m_cut = a_v;}
0579   const std::string& cut() const {return m_cut;}
0580 
0581   void options(const std::string& a_v){m_options = a_v;}
0582   const std::string& options() const{return m_options;}
0583 
0584   void color_mapping(const std::string& a_v){m_color_mapping = a_v;}
0585   const std::string& color_mapping() const{return m_color_mapping;}
0586 
0587   void enforced(bool a_v){m_enforced = a_v;}
0588   bool enforced() const{return m_enforced;}
0589 
0590   void translation(const vec3f& a_v){m_translation = a_v;}
0591   vec3f translation() const {return m_translation;}
0592 
0593   void front_face(winding_type a_v){m_front_face = a_v;}
0594   winding_type front_face() const {return m_front_face;}
0595 
0596   void hjust(sg::hjust a_v){m_hjust = a_v;}
0597   sg::hjust hjust() const {return m_hjust;}
0598 
0599   void vjust(sg::vjust a_v){m_vjust = a_v;}
0600   sg::vjust vjust() const {return m_vjust;}
0601 
0602   void coloring(const std::string& a_v){m_coloring  = a_v;}
0603   const std::string& coloring() const {return m_coloring;}
0604 
0605   void title(const std::string& a_v){m_title  = a_v;}
0606   const std::string& title() const {return m_title;}
0607 
0608   void pickable(bool a_v){m_pickable  = a_v;}
0609   bool pickable() const {return m_pickable;}
0610 
0611 public:
0612   bool parse(std::ostream& a_out,const cmaps_t& a_cmaps,const std::string& a_s){
0613     // a_s = list of "name value" separated by \n
0614     //::printf("debug : style_parser::parse : \"%s\"\n",a_s.c_str());
0615     std::vector<std::string> lines;
0616     get_lines(a_s,lines);
0617 
0618     tools_vforcit(std::string,lines,it) {
0619       const std::string& line = *it;
0620       if(line.empty()) continue;
0621       if(line=="reset") {
0622         reset();
0623         continue;
0624       }
0625       std::vector<std::string> ws;
0626       words(line," ",false,ws);
0627       size_t wordn = ws.size();
0628       if(!wordn) {
0629         a_out << "style_parser::parse :"
0630               << " in " << sout(a_s)
0631               << " : " << sout(line)
0632               << " has a bad word count (at least two expected)."
0633               << std::endl;
0634         return false;
0635       }
0636       const std::string& word0 = ws[0];
0637       if(word0=="color") {
0638         if(wordn==2) {
0639           const std::string& word1 = ws[1];
0640           if(!find_color(a_cmaps,word1,m_color)) {
0641             a_out << "style_parser::parse :"
0642                   << " in " << sout(a_s)
0643                   << " : " << sout(word1)
0644                   << " not a color."
0645                   << std::endl;
0646             return false;
0647           }
0648         } else if (wordn==4) {
0649           const std::string& rs = ws[1];
0650           float r;
0651           if(!to<float>(rs,r))  {
0652             a_out << "style_parser::parse :"
0653                   << " in " << sout(a_s)
0654                   << " : " << sout(rs)
0655                   << " not a number."
0656                   << std::endl;
0657             return false;
0658           }
0659           const std::string& gs = ws[2];
0660           float g;
0661           if(!to<float>(gs,g))  {
0662             a_out << "style_parser::parse :"
0663                   << " in " << sout(a_s)
0664                   << " : " << sout(gs)
0665                   << " not a number."
0666                   << std::endl;
0667             return false;
0668           }
0669           const std::string& bs = ws[3];
0670           float b;
0671           if(!to<float>(bs,b))  {
0672             a_out << "style_parser::parse :"
0673                   << " in " << sout(a_s)
0674                   << " : " << sout(bs)
0675                   << " not a number."
0676                   << std::endl;
0677             return false;
0678           }
0679           m_color.set_value(r,g,b,1);
0680 
0681         } else if (wordn==5) {
0682           const std::string& rs = ws[1];
0683           float r;
0684           if(!to<float>(rs,r))  {
0685             a_out << "style_parser::parse :"
0686                   << " in " << sout(a_s)
0687                   << " : " << sout(rs)
0688                   << " not a number."
0689                   << std::endl;
0690             return false;
0691           }
0692           const std::string& gs = ws[2];
0693           float g;
0694           if(!to<float>(gs,g))  {
0695             a_out << "style_parser::parse :"
0696                   << " in " << sout(a_s)
0697                   << " : " << sout(gs)
0698                   << " not a number."
0699                   << std::endl;
0700             return false;
0701           }
0702           const std::string& bs = ws[3];
0703           float b;
0704           if(!to<float>(bs,b))  {
0705             a_out << "style_parser::parse :"
0706                   << " in " << sout(a_s)
0707                   << " : " << sout(bs)
0708                   << " not a number."
0709                   << std::endl;
0710             return false;
0711           }
0712           const std::string& as = ws[4];
0713           float a;
0714           if(!to<float>(as,a))  {
0715             a_out << "style_parser::parse :"
0716                   << " in " << sout(a_s)
0717                   << " : " << sout(as)
0718                   << " not a number."
0719                   << std::endl;
0720             return false;
0721           }
0722           m_color.set_value(r,g,b,a);
0723 
0724         } else {
0725           a_out << "style_parser::parse :"
0726                 << " in " << sout(a_s)
0727                 << " : " << sout(line)
0728                 << " has a bad word count (two or four expected)."
0729                 << std::endl;
0730           return false;
0731         }
0732 
0733       } else if(word0=="highlight_color") {
0734         if(wordn==2) {
0735           const std::string& word1 = ws[1];
0736           if(!find_color(a_cmaps,word1,m_highlight_color)) {
0737             a_out << "style_parser::parse :"
0738                   << " in " << sout(a_s)
0739                   << " : " << sout(word1)
0740                   << " not a color."
0741                   << std::endl;
0742             return false;
0743           }
0744         } else if (wordn==4) {
0745           const std::string& rs = ws[1];
0746           float r;
0747           if(!to<float>(rs,r))  {
0748             a_out << "style_parser::parse :"
0749                   << " in " << sout(a_s)
0750                   << " : " << sout(rs)
0751                   << " not a number."
0752                   << std::endl;
0753             return false;
0754           }
0755           const std::string& gs = ws[2];
0756           float g;
0757           if(!to<float>(gs,g))  {
0758             a_out << "style_parser::parse :"
0759                   << " in " << sout(a_s)
0760                   << " : " << sout(gs)
0761                   << " not a number."
0762                   << std::endl;
0763             return false;
0764           }
0765           const std::string& bs = ws[3];
0766           float b;
0767           if(!to<float>(bs,b))  {
0768             a_out << "style_parser::parse :"
0769                   << " in " << sout(a_s)
0770                   << " : " << sout(bs)
0771                   << " not a number."
0772                   << std::endl;
0773             return false;
0774           }
0775           m_highlight_color.set_value(r,g,b,1);
0776 
0777         } else if (wordn==5) {
0778           const std::string& rs = ws[1];
0779           float r;
0780           if(!to<float>(rs,r))  {
0781             a_out << "style_parser::parse :"
0782                   << " in " << sout(a_s)
0783                   << " : " << sout(rs)
0784                   << " not a number."
0785                   << std::endl;
0786             return false;
0787           }
0788           const std::string& gs = ws[2];
0789           float g;
0790           if(!to<float>(gs,g))  {
0791             a_out << "style_parser::parse :"
0792                   << " in " << sout(a_s)
0793                   << " : " << sout(gs)
0794                   << " not a number."
0795                   << std::endl;
0796             return false;
0797           }
0798           const std::string& bs = ws[3];
0799           float b;
0800           if(!to<float>(bs,b))  {
0801             a_out << "style_parser::parse :"
0802                   << " in " << sout(a_s)
0803                   << " : " << sout(bs)
0804                   << " not a number."
0805                   << std::endl;
0806             return false;
0807           }
0808           const std::string& as = ws[4];
0809           float a;
0810           if(!to<float>(as,a))  {
0811             a_out << "style_parser::parse :"
0812                   << " in " << sout(a_s)
0813                   << " : " << sout(as)
0814                   << " not a number."
0815                   << std::endl;
0816             return false;
0817           }
0818           m_highlight_color.set_value(r,g,b,a);
0819 
0820         } else {
0821           a_out << "style_parser::parse :"
0822                 << " in " << sout(a_s)
0823                 << " : " << sout(line)
0824                 << " has a bad word count (two or four expected)."
0825                 << std::endl;
0826           return false;
0827         }
0828 
0829       } else if(word0=="back_color") {
0830         if(wordn==2) {
0831           const std::string& word1 = ws[1];
0832           if(!find_color(a_cmaps,word1,m_back_color)) {
0833             a_out << "style_parser::parse :"
0834                   << " in " << sout(a_s)
0835                   << " : " << sout(word1)
0836                   << " not a color."
0837                   << std::endl;
0838             return false;
0839           }
0840         } else if (wordn==4) {
0841           const std::string& rs = ws[1];
0842           float r;
0843           if(!to<float>(rs,r))  {
0844             a_out << "style_parser::parse :"
0845                   << " in " << sout(a_s)
0846                   << " : " << sout(rs)
0847                   << " not a number."
0848                   << std::endl;
0849             return false;
0850           }
0851           const std::string& gs = ws[2];
0852           float g;
0853           if(!to<float>(gs,g))  {
0854             a_out << "style_parser::parse :"
0855                   << " in " << sout(a_s)
0856                   << " : " << sout(gs)
0857                   << " not a number."
0858                   << std::endl;
0859             return false;
0860           }
0861           const std::string& bs = ws[3];
0862           float b;
0863           if(!to<float>(bs,b))  {
0864             a_out << "style_parser::parse :"
0865                   << " in " << sout(a_s)
0866                   << " : " << sout(bs)
0867                   << " not a number."
0868                   << std::endl;
0869             return false;
0870           }
0871           m_back_color.set_value(r,g,b,1);
0872 
0873         } else if (wordn==5) {
0874           const std::string& rs = ws[1];
0875           float r;
0876           if(!to<float>(rs,r))  {
0877             a_out << "style_parser::parse :"
0878                   << " in " << sout(a_s)
0879                   << " : " << sout(rs)
0880                   << " not a number."
0881                   << std::endl;
0882             return false;
0883           }
0884           const std::string& gs = ws[2];
0885           float g;
0886           if(!to<float>(gs,g))  {
0887             a_out << "style_parser::parse :"
0888                   << " in " << sout(a_s)
0889                   << " : " << sout(gs)
0890                   << " not a number."
0891                   << std::endl;
0892             return false;
0893           }
0894           const std::string& bs = ws[3];
0895           float b;
0896           if(!to<float>(bs,b))  {
0897             a_out << "style_parser::parse :"
0898                   << " in " << sout(a_s)
0899                   << " : " << sout(bs)
0900                   << " not a number."
0901                   << std::endl;
0902             return false;
0903           }
0904           const std::string& as = ws[4];
0905           float a;
0906           if(!to<float>(as,a))  {
0907             a_out << "style_parser::parse :"
0908                   << " in " << sout(a_s)
0909                   << " : " << sout(as)
0910                   << " not a number."
0911                   << std::endl;
0912             return false;
0913           }
0914           m_back_color.set_value(r,g,b,a);
0915 
0916         } else {
0917           a_out << "style_parser::parse :"
0918                 << " in " << sout(a_s)
0919                 << " : " << sout(line)
0920                 << " has a bad word count (two or four expected)."
0921                 << std::endl;
0922           return false;
0923         }
0924 
0925       } else if(word0=="pattern") {
0926         if(!check_2(wordn,a_s,line,a_out)) return false;
0927         const std::string& word1 = ws[1];
0928         unsigned long ul;
0929         if(!sline_pattern(word1,m_pattern)) {
0930           if(!to_ulong(word1,ul)) {
0931             a_out << "style_parser::parse :"
0932                   << " in " << sout(a_s)
0933                   << " : " << sout(word1)
0934                   << " not a line pattern."
0935                   << std::endl;
0936             return false;
0937           }
0938           m_pattern = (lpat)ul;
0939         }
0940 
0941       } else if(word0=="line_pattern") {
0942         if(!check_2(wordn,a_s,line,a_out)) return false;
0943         const std::string& word1 = ws[1];
0944         unsigned long ul;
0945         if(!sline_pattern(word1,m_line_pattern)) {
0946           if(!to_ulong(word1,ul)) {
0947             a_out << "style_parser::parse :"
0948                   << " in " << sout(a_s)
0949                   << " : " << sout(word1)
0950                   << " not a line pattern."
0951                   << std::endl;
0952             return false;
0953           }
0954           m_line_pattern = (lpat)ul;
0955         }
0956       } else if(word0=="marker_style") {
0957         if(!check_2(wordn,a_s,line,a_out)) return false;
0958         const std::string& word1 = ws[1];
0959         if(!smarker_style(word1,m_marker_style)) {
0960           a_out << "style_parser::parse :"
0961                 << " in " << sout(a_s)
0962                 << " : " << sout(word1)
0963                 << " not a marker_style."
0964                 << std::endl;
0965           return false;
0966         }
0967       } else if(word0=="area_style") {
0968         if(!check_2(wordn,a_s,line,a_out)) return false;
0969         const std::string& word1 = ws[1];
0970         if(!sarea_style(word1,m_area_style)) {
0971           a_out << "style_parser::parse :"
0972                 << " in " << sout(a_s)
0973                 << " : " << sout(word1)
0974                 << " not a area_style."
0975                 << std::endl;
0976           return false;
0977         }
0978       } else if(word0=="modeling") {
0979         if(!check_2(wordn,a_s,line,a_out)) return false;
0980         m_modeling  = ws[1];
0981       } else if(word0=="light_model") {
0982         if(!check_2(wordn,a_s,line,a_out)) return false;
0983         m_light_model = ws[1];
0984       } else if(word0=="tick_modeling") {
0985         if(!check_2(wordn,a_s,line,a_out)) return false;
0986         m_tick_modeling = ws[1];
0987       } else if(word0=="encoding") {
0988         if(!check_2(wordn,a_s,line,a_out)) return false;
0989         m_encoding = ws[1];
0990       } else if(word0=="smoothing") {
0991         if(!check_2(wordn,a_s,line,a_out)) return false;
0992         bool value;
0993         if(!check_bool(ws[1],a_s,a_out,value)) return false;
0994         m_smoothing = value;
0995       } else if(word0=="hinting") {
0996         if(!check_2(wordn,a_s,line,a_out)) return false;
0997         bool value;
0998         if(!check_bool(ws[1],a_s,a_out,value)) return false;
0999         m_hinting = value;
1000       } else if(word0=="enforced") {
1001         if(!check_2(wordn,a_s,line,a_out)) return false;
1002         bool value;
1003         if(!check_bool(ws[1],a_s,a_out,value)) return false;
1004         m_enforced = value;
1005       } else if(word0=="cut") {
1006         m_cut = "";
1007         for(unsigned int wordi=1;wordi<wordn;wordi++) {
1008           if(wordi!=1) m_cut += " ";
1009           m_cut += ws[wordi];
1010         }
1011       } else if(word0=="options") {
1012         m_options = "";
1013         for(unsigned int wordi=1;wordi<wordn;wordi++) {
1014           if(wordi!=1) m_options += " ";
1015           m_options += ws[wordi];
1016         }
1017       } else if(word0=="color_mapping") {
1018         m_color_mapping = "";
1019         for(unsigned int wordi=1;wordi<wordn;wordi++) {
1020           if(wordi!=1) m_color_mapping += " ";
1021           m_color_mapping += ws[wordi];
1022         }
1023       } else if(word0=="painting") {
1024         if(!check_2(wordn,a_s,line,a_out)) return false;
1025         if(!spainting_policy(ws[1],m_painting)) {
1026           a_out << "style_parser::parse :"
1027                 << " in " << sout(a_s)
1028                 << " : " << sout(ws[1])
1029                 << " not a painting_policy."
1030                 << std::endl;
1031           return false;
1032         }
1033       } else if(word0=="hatching") {
1034         if(!check_2(wordn,a_s,line,a_out)) return false;
1035         if(!shatching_policy(ws[1],m_hatching)) {
1036           a_out << "style_parser::parse :"
1037                 << " in " << sout(a_s)
1038                 << " : " << sout(ws[1])
1039                 << " not a hatching_policy."
1040                 << std::endl;
1041           return false;
1042         }
1043       } else if(word0=="projection") {
1044         if(!check_2(wordn,a_s,line,a_out)) return false;
1045         if(!sprojection_type(ws[1],m_projection)) {
1046           a_out << "style_parser::parse :"
1047                 << " in " << sout(a_s)
1048                 << " : " << sout(ws[1])
1049                 << " not a projection_type."
1050                 << std::endl;
1051           return false;
1052         }
1053       } else if(word0=="font") {
1054         if(!check_2(wordn,a_s,line,a_out)) return false;
1055         font(ws[1]);
1056       } else if(word0=="width") {
1057         if(!check_2(wordn,a_s,line,a_out)) return false;
1058         float value;
1059         if(!check_float(ws[1],a_s,a_out,value)) return false;
1060         m_width = value;
1061       } else if(word0=="line_width") {
1062         if(!check_2(wordn,a_s,line,a_out)) return false;
1063         float value;
1064         if(!check_float(ws[1],a_s,a_out,value)) return false;
1065         m_line_width = value;
1066       } else if(word0=="marker_size") {
1067         if(!check_2(wordn,a_s,line,a_out)) return false;
1068         float value;
1069         if(!check_float(ws[1],a_s,a_out,value)) return false;
1070         m_marker_size = value;
1071       } else if(word0=="point_size") {
1072         if(!check_2(wordn,a_s,line,a_out)) return false;
1073         float value;
1074         if(!check_float(ws[1],a_s,a_out,value)) return false;
1075         m_point_size = value;
1076       } else if(word0=="font_size") {
1077         if(!check_2(wordn,a_s,line,a_out)) return false;
1078         float value;
1079         if(!check_float(ws[1],a_s,a_out,value)) return false;
1080         m_font_size = value;
1081       } else if(word0=="font_modeling") {
1082         if(!check_2(wordn,a_s,line,a_out)) return false;
1083              if(ws[1]==s_font_outline()) m_font_modeling = font_outline;
1084         else if(ws[1]==s_font_filled())  m_font_modeling = font_filled;
1085         else if(ws[1]==s_font_pixmap())  m_font_modeling = font_pixmap;
1086         else {
1087           a_out << "style_parser::parse :"
1088                 << " in " << sout(a_s)
1089                 << " : " << sout(ws[1])
1090                 << " not a font_modeling."
1091                 << std::endl;
1092           return false;
1093         }
1094       } else if(word0=="back_shadow") {
1095         if(!check_2(wordn,a_s,line,a_out)) return false;
1096         float value;
1097         if(!check_float(ws[1],a_s,a_out,value)) return false;
1098         if(value<0.F) value = 0.F;
1099         m_back_shadow = value;
1100       } else if(word0=="multi_node_limit") {
1101         if(!check_2(wordn,a_s,line,a_out)) return false;
1102         int value = 0;
1103         if(!check_int(ws[1],a_s,a_out,value)) return false;
1104         m_multi_node_limit = value;
1105       } else if(word0=="divisions") {
1106         if(!check_2(wordn,a_s,line,a_out)) return false;
1107         int value = 0;
1108         if(!check_int(ws[1],a_s,a_out,value)) return false;
1109         m_divisions = value;
1110       } else if(word0=="rotation_steps") {
1111         if(!check_2(wordn,a_s,line,a_out)) return false;
1112         unsigned int value;
1113         if(!check_uint(ws[1],a_s,a_out,value)) return false;
1114         m_rotation_steps = value;
1115       } else if(word0=="angle") {
1116         if(!check_2(wordn,a_s,line,a_out)) return false;
1117         float value;
1118         if(!check_float(ws[1],a_s,a_out,value)) return false;
1119         m_angle = value;
1120       } else if(word0=="scale") {
1121         if(!check_2(wordn,a_s,line,a_out)) return false;
1122         float value;
1123         if(!check_float(ws[1],a_s,a_out,value)) return false;
1124         m_scale = value;
1125       } else if(word0=="offset") {
1126         if(!check_2(wordn,a_s,line,a_out)) return false;
1127         float value;
1128         if(!check_float(ws[1],a_s,a_out,value)) return false;
1129         m_offset = value;
1130       } else if(word0=="strip_width") {
1131         if(!check_2(wordn,a_s,line,a_out)) return false;
1132         float value;
1133         if(!check_float(ws[1],a_s,a_out,value)) return false;
1134         m_strip_width = value;
1135       } else if(word0=="spacing") {
1136         if(!check_2(wordn,a_s,line,a_out)) return false;
1137         float value;
1138         if(!check_float(ws[1],a_s,a_out,value)) return false;
1139         m_spacing = value;
1140       } else if(word0=="visible") {
1141         if(!check_2(wordn,a_s,line,a_out)) return false;
1142         bool value;
1143         if(!check_bool(ws[1],a_s,a_out,value)) return false;
1144         m_visible = value;
1145       } else if(word0=="editable") {
1146         if(!check_2(wordn,a_s,line,a_out)) return false;
1147         bool value;
1148         if(!check_bool(ws[1],a_s,a_out,value)) return false;
1149         m_editable = value;
1150       } else if(word0=="pickable") {
1151         if(!check_2(wordn,a_s,line,a_out)) return false;
1152         bool value;
1153         if(!check_bool(ws[1],a_s,a_out,value)) return false;
1154         m_pickable = value;
1155       } else if(word0=="automated") {
1156         if(!check_2(wordn,a_s,line,a_out)) return false;
1157         bool value;
1158         if(!check_bool(ws[1],a_s,a_out,value)) return false;
1159         m_automated = value;
1160       } else if(word0=="bar_offset") {
1161         if(!check_2(wordn,a_s,line,a_out)) return false;
1162         float value;
1163         if(!check_float(ws[1],a_s,a_out,value)) return false;
1164         m_bar_offset = value;
1165       } else if(word0=="bar_width") {
1166         if(!check_2(wordn,a_s,line,a_out)) return false;
1167         float value;
1168         if(!check_float(ws[1],a_s,a_out,value)) return false;
1169         m_bar_width = value;
1170 
1171       } else if(word0=="translation") {
1172         if (wordn==4) {
1173           const std::string& sx = ws[1];
1174           float x;
1175           if(!to<float>(sx,x))  {
1176             a_out << "style_parser::parse :"
1177                   << " in " << sout(a_s)
1178                   << " : " << sout(sx)
1179                   << " not a number."
1180                   << std::endl;
1181             return false;
1182           }
1183           const std::string& sy = ws[2];
1184           float y;
1185           if(!to<float>(sy,y))  {
1186             a_out << "style_parser::parse :"
1187                   << " in " << sout(a_s)
1188                   << " : " << sout(sy)
1189                   << " not a number."
1190                   << std::endl;
1191             return false;
1192           }
1193           const std::string& sz = ws[3];
1194           float z;
1195           if(!to<float>(sz,z))  {
1196             a_out << "style_parser::parse :"
1197                   << " in " << sout(a_s)
1198                   << " : " << sout(sz)
1199                   << " not a number."
1200                   << std::endl;
1201             return false;
1202           }
1203           m_translation.set_value(x,y,z);
1204         } else {
1205           a_out << "style_parser::parse :"
1206                 << " in " << sout(a_s)
1207                 << " has a bad word count (four expected)."
1208                 << std::endl;
1209           return false;
1210         }
1211 
1212       } else if(word0=="front_face") {
1213         if(!check_2(wordn,a_s,line,a_out)) return false;
1214         const std::string& word1 = ws[1];
1215         if(word1=="ccw") {
1216           m_front_face = winding_ccw;
1217         } else if(word1=="cw") {
1218           m_front_face = winding_cw;
1219         } else { //ccw
1220           a_out << "style_parser::parse :"
1221                 << " in " << sout(a_s)
1222                 << " : " << sout(word1)
1223                 << " not a winding type."
1224                 << std::endl;
1225           return false;
1226         }
1227 
1228       } else if(word0=="hjust") {
1229         if(!check_2(wordn,a_s,line,a_out)) return false;
1230         const std::string& word1 = ws[1];
1231         if(!shjust(word1,m_hjust)) {
1232           a_out << "style_parser::parse :"
1233                 << " in " << sout(a_s)
1234                 << " : " << sout(word1)
1235                 << " not a hjust."
1236                 << std::endl;
1237           return false;
1238         }
1239 
1240       } else if(word0=="vjust") {
1241         if(!check_2(wordn,a_s,line,a_out)) return false;
1242         const std::string& word1 = ws[1];
1243         if(!svjust(word1,m_vjust)) {
1244           a_out << "style_parser::parse :"
1245                 << " in " << sout(a_s)
1246                 << " : " << sout(word1)
1247                 << " not a vjust."
1248                 << std::endl;
1249           return false;
1250         }
1251 
1252       } else if(word0=="coloring") {
1253         if(!check_2(wordn,a_s,line,a_out)) return false;
1254         m_coloring  = ws[1];
1255 
1256       } else if(word0=="title") {
1257         if(!check_2(wordn,a_s,line,a_out)) return false;
1258         m_title  = ws[1];
1259 
1260       } else {
1261         a_out << "style_parser::parse :"
1262               << " in " << sout(a_s)
1263               << " : " << sout(word0)
1264               << " bad option."
1265               << std::endl;
1266         return false;
1267       }
1268     }
1269     return true;
1270   }
1271 
1272 protected:
1273   static bool check_2(size_t a_n,
1274                       const std::string& a_s,
1275                       const std::string& a_line,std::ostream& a_out) {
1276     if(a_n!=2) {
1277       a_out << "style_parser::parse :"
1278             << " in " << sout(a_s)
1279             << " : " << sout(a_line)
1280             << " has a bad word count (two expected)."
1281             << std::endl;
1282       return false;
1283     }
1284     return true;
1285   }
1286 
1287   static bool check_bool(const std::string& a_w,
1288                          const std::string& a_s,std::ostream& a_out,bool& a_v){
1289     if(!to(a_w,a_v)){
1290       a_out << "style_parser::parse :"
1291             << " in " << sout(a_s)
1292             << " : " << sout(a_w)
1293             << " not a boolean."
1294             << std::endl;
1295       return false;
1296     }
1297     return true;
1298   }
1299 
1300   static bool check_int(const std::string& a_w,
1301                         const std::string& a_s,std::ostream& a_out,int& a_v) {
1302     if(!to<int>(a_w,a_v)){
1303       a_out << "style_parser::parse :"
1304             << " in " << sout(a_s)
1305             << " : " << sout(a_w)
1306             << " not an int."
1307             << std::endl;
1308       return false;
1309     }
1310     return true;
1311   }
1312 
1313   static bool check_uint(const std::string& a_w,
1314                 const std::string& a_s,std::ostream& a_out,unsigned int& a_v) {
1315     if(!to<unsigned int>(a_w,a_v)){
1316       a_out << "style_parser::parse :"
1317             << " in " << sout(a_s)
1318             << " : " << sout(a_w)
1319             << " not an unsigned int."
1320             << std::endl;
1321       return false;
1322     }
1323     return true;
1324   }
1325 
1326   static bool check_float(const std::string& a_w,
1327                 const std::string& a_s,std::ostream& a_out,float& a_v) {
1328     if(!to<float>(a_w,a_v)){
1329       a_out << "style_parser::parse :"
1330             << " in " << sout(a_s)
1331             << " : " << sout(a_w)
1332             << " not a float."
1333             << std::endl;
1334       return false;
1335     }
1336     return true;
1337   }
1338 
1339 protected:
1340   colorf m_color;
1341   colorf m_highlight_color;
1342   colorf m_back_color;
1343   float m_width;
1344   float m_line_width;
1345   float m_marker_size;
1346   float m_point_size;
1347   float m_font_size;
1348   sg::font_modeling m_font_modeling;
1349   lpat m_pattern;
1350   lpat m_line_pattern;
1351   sg::marker_style m_marker_style;
1352   sg::area_style m_area_style;
1353   std::string m_modeling;
1354   std::string m_light_model;
1355   std::string m_tick_modeling;
1356   std::string m_encoding;
1357   bool m_smoothing;
1358   bool m_hinting;
1359   std::string m_cut;
1360   sg::painting_policy m_painting;
1361   sg::hatching_policy m_hatching;
1362   sg::projection_type m_projection;
1363   std::string m_font;
1364   int m_multi_node_limit; //could be no_limit = -1.
1365   int m_divisions;
1366   unsigned int m_rotation_steps;
1367   float m_back_shadow;
1368   float m_spacing;
1369   float m_angle;
1370   float m_scale;
1371   float m_offset;
1372   float m_strip_width;
1373   bool m_visible;
1374   float m_bar_offset;
1375   float m_bar_width;
1376   bool m_editable;
1377   bool m_automated;
1378   std::string m_options;
1379   std::string m_color_mapping;
1380   bool m_enforced;
1381   vec3f m_translation;
1382   winding_type m_front_face;
1383   sg::hjust m_hjust;
1384   sg::vjust m_vjust;
1385   std::string m_coloring;
1386   std::string m_title;
1387   bool m_pickable;
1388 };
1389 
1390 }}
1391 
1392 #endif