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 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /externals/g4tools/include/tools/sg/line_style (Version 11.3.0) and /externals/g4tools/include/tools/sg/line_style (Version 11.2)


  1 // Copyright (C) 2010, Guy Barrand. All rights      1 // Copyright (C) 2010, Guy Barrand. All rights reserved.
  2 // See the file tools.license for terms.            2 // See the file tools.license for terms.
  3                                                     3 
  4 #ifndef tools_sg_line_style                         4 #ifndef tools_sg_line_style
  5 #define tools_sg_line_style                         5 #define tools_sg_line_style
  6                                                     6 
  7 #include "../lina/vec3f"                            7 #include "../lina/vec3f"
  8                                                     8 
  9 #include "sf_vec"                                   9 #include "sf_vec"
 10 #include "node"                                    10 #include "node"
 11 #include "enums"                                   11 #include "enums"
 12 #include "style_parser"                            12 #include "style_parser"
 13                                                    13 
 14 namespace tools {                                  14 namespace tools {
 15 namespace sg {                                     15 namespace sg {
 16                                                    16 
 17 class line_style : public node {                   17 class line_style : public node {
 18   TOOLS_NODE(line_style,tools::sg::line_style,     18   TOOLS_NODE(line_style,tools::sg::line_style,node)
 19 public:                                            19 public:
 20   sf<bool> visible;                                20   sf<bool> visible;
 21   sf_vec<colorf,float> color;                      21   sf_vec<colorf,float> color;
 22   sf<float> width;                                 22   sf<float> width;
 23   sf<lpat> pattern;                                23   sf<lpat> pattern;
 24 public:                                            24 public:
 25   virtual const desc_fields& node_desc_fields(     25   virtual const desc_fields& node_desc_fields() const {
 26     TOOLS_FIELD_DESC_NODE_CLASS(tools::sg::lin     26     TOOLS_FIELD_DESC_NODE_CLASS(tools::sg::line_style)
 27     static const desc_fields s_v(parent::node_     27     static const desc_fields s_v(parent::node_desc_fields(),4, //WARNING : take care of count.
 28       TOOLS_ARG_FIELD_DESC(visible),               28       TOOLS_ARG_FIELD_DESC(visible),
 29       TOOLS_ARG_FIELD_DESC(color),                 29       TOOLS_ARG_FIELD_DESC(color),
 30       TOOLS_ARG_FIELD_DESC(width),                 30       TOOLS_ARG_FIELD_DESC(width),
 31       TOOLS_ARG_FIELD_DESC(pattern)                31       TOOLS_ARG_FIELD_DESC(pattern)
 32     );                                             32     );
 33     return s_v;                                    33     return s_v;
 34   }                                                34   }
 35 private:                                           35 private:
 36   void add_fields(){                               36   void add_fields(){
 37     add_field(&visible);                           37     add_field(&visible);
 38     add_field(&color);                             38     add_field(&color);
 39     add_field(&width);                             39     add_field(&width);
 40     add_field(&pattern);                           40     add_field(&pattern);
 41   }                                                41   }
 42 public:                                            42 public:
 43   line_style()                                     43   line_style()
 44   :parent()                                        44   :parent()
 45   ,visible(true)                                   45   ,visible(true)
 46   ,color(colorf_black())                           46   ,color(colorf_black())
 47   ,width(1)                                        47   ,width(1)
 48   ,pattern(line_solid)                             48   ,pattern(line_solid)
 49   {                                                49   {
 50     add_fields();                                  50     add_fields();
 51   }                                                51   }
 52   virtual ~line_style(){}                          52   virtual ~line_style(){}
 53 public:                                            53 public:
 54   line_style(const line_style& a_from)             54   line_style(const line_style& a_from)
 55   :parent(a_from)                                  55   :parent(a_from)
 56   ,visible(a_from.visible)                         56   ,visible(a_from.visible)
 57   ,color(a_from.color)                             57   ,color(a_from.color)
 58   ,width(a_from.width)                             58   ,width(a_from.width)
 59   ,pattern(a_from.pattern)                         59   ,pattern(a_from.pattern)
 60   {                                                60   {
 61     add_fields();                                  61     add_fields();
 62   }                                                62   }
 63   line_style& operator=(const line_style& a_fr     63   line_style& operator=(const line_style& a_from){
 64     parent::operator=(a_from);                     64     parent::operator=(a_from);
 65                                                    65 
 66     visible = a_from.visible;                      66     visible = a_from.visible;
 67     color = a_from.color;                          67     color = a_from.color;
 68     width = a_from.width;                          68     width = a_from.width;
 69     pattern = a_from.pattern;                      69     pattern = a_from.pattern;
 70     return *this;                                  70     return *this;
 71   }                                                71   }
 72 public:                                            72 public:
 73   bool from_string(std::ostream& a_out,const c     73   bool from_string(std::ostream& a_out,const cmaps_t& a_cmaps,const std::string& a_s){
 74     style_parser sp;                               74     style_parser sp;
 75                                                    75 
 76     sp.visible(visible.value());                   76     sp.visible(visible.value());
 77     sp.color(color.value());                       77     sp.color(color.value());
 78   //sp.transparency(transparency.value());         78   //sp.transparency(transparency.value());
 79     sp.width(width.value());                       79     sp.width(width.value());
 80     sp.pattern(pattern.value());                   80     sp.pattern(pattern.value());
 81                                                    81 
 82     if(!sp.parse(a_out,a_cmaps,a_s)) {             82     if(!sp.parse(a_out,a_cmaps,a_s)) {
 83       a_out << "tools::sg::line_style::from_st     83       a_out << "tools::sg::line_style::from_string :"
 84             << " parse failed."                    84             << " parse failed."
 85             << std::endl;                          85             << std::endl;
 86       return false;                                86       return false;
 87     }                                              87     }
 88                                                    88 
 89     visible.value(sp.visible());                   89     visible.value(sp.visible());
 90     color.value(sp.color());                       90     color.value(sp.color());
 91   //transparency.value(sp.transparency());         91   //transparency.value(sp.transparency());
 92     width.value(sp.width());                       92     width.value(sp.width());
 93     pattern.value(sp.pattern());                   93     pattern.value(sp.pattern());
 94                                                    94 
 95     return true;                                   95     return true;
 96   }                                                96   }
 97                                                    97 
 98 };                                                 98 };
 99                                                    99 
100 }}                                                100 }}
101                                                   101 
102 #endif                                            102 #endif