Geant4 Cross Reference |
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_plottables 4 #ifndef tools_sg_plottables 5 #define tools_sg_plottables 5 #define tools_sg_plottables 6 6 7 #include "plottable" 7 #include "plottable" 8 #include "enums" 8 #include "enums" 9 9 10 namespace tools { 10 namespace tools { 11 namespace sg { 11 namespace sg { 12 12 13 class bins1D : public virtual plottable { 13 class bins1D : public virtual plottable { 14 public: 14 public: 15 TOOLS_SCLASS(tools::sg::bins1D) 15 TOOLS_SCLASS(tools::sg::bins1D) 16 public: 16 public: 17 virtual void* cast(const std::string& a_clas 17 virtual void* cast(const std::string& a_class) const { 18 if(void* p = cmp_cast<bins1D>(this,a_class 18 if(void* p = cmp_cast<bins1D>(this,a_class)) {return p;} 19 return plottable::cast(a_class); 19 return plottable::cast(a_class); 20 } 20 } 21 public: 21 public: 22 virtual ~bins1D(){} 22 virtual ~bins1D(){} 23 public: 23 public: 24 virtual void bins_Sw_range(float&,float&,boo 24 virtual void bins_Sw_range(float&,float&,bool) const = 0; 25 public: 25 public: 26 // axis : 26 // axis : 27 virtual unsigned int bins() const = 0; 27 virtual unsigned int bins() const = 0; 28 virtual float axis_min() const = 0; 28 virtual float axis_min() const = 0; 29 virtual float axis_max() const = 0; 29 virtual float axis_max() const = 0; 30 // bins on axis : 30 // bins on axis : 31 virtual float bin_lower_edge(int) const = 0; 31 virtual float bin_lower_edge(int) const = 0; 32 virtual float bin_upper_edge(int) const = 0; 32 virtual float bin_upper_edge(int) const = 0; 33 // bins : 33 // bins : 34 virtual bool has_entries_per_bin() const = 0 34 virtual bool has_entries_per_bin() const = 0; 35 virtual unsigned int bin_entries(int) const 35 virtual unsigned int bin_entries(int) const = 0; 36 virtual float bin_Sw(int) const = 0; 36 virtual float bin_Sw(int) const = 0; 37 virtual float bin_error(int) const = 0; 37 virtual float bin_error(int) const = 0; 38 public: 38 public: 39 virtual bool is_profile() const = 0; 39 virtual bool is_profile() const = 0; 40 }; 40 }; 41 41 42 class bins2D : public virtual plottable { 42 class bins2D : public virtual plottable { 43 public: 43 public: 44 TOOLS_SCLASS(tools::sg::bins2D) 44 TOOLS_SCLASS(tools::sg::bins2D) 45 public: 45 public: 46 virtual void* cast(const std::string& a_clas 46 virtual void* cast(const std::string& a_class) const { 47 if(void* p = cmp_cast<bins2D>(this,a_class 47 if(void* p = cmp_cast<bins2D>(this,a_class)) {return p;} 48 return plottable::cast(a_class); 48 return plottable::cast(a_class); 49 } 49 } 50 public: 50 public: 51 virtual ~bins2D(){} 51 virtual ~bins2D(){} 52 public: 52 public: 53 virtual void bins_Sw_range(float&,float&,boo 53 virtual void bins_Sw_range(float&,float&,bool) const = 0; 54 public: 54 public: 55 // x axis : 55 // x axis : 56 virtual unsigned int x_bins() const = 0; 56 virtual unsigned int x_bins() const = 0; 57 virtual float x_axis_min() const = 0; 57 virtual float x_axis_min() const = 0; 58 virtual float x_axis_max() const = 0; 58 virtual float x_axis_max() const = 0; 59 // y axis : 59 // y axis : 60 virtual unsigned int y_bins() const = 0; 60 virtual unsigned int y_bins() const = 0; 61 virtual float y_axis_min() const = 0; 61 virtual float y_axis_min() const = 0; 62 virtual float y_axis_max() const = 0; 62 virtual float y_axis_max() const = 0; 63 // bins on x axis : 63 // bins on x axis : 64 virtual float bin_lower_edge_x(int) const = 64 virtual float bin_lower_edge_x(int) const = 0; 65 virtual float bin_upper_edge_x(int) const = 65 virtual float bin_upper_edge_x(int) const = 0; 66 // bins on y axis : 66 // bins on y axis : 67 virtual float bin_lower_edge_y(int) const = 67 virtual float bin_lower_edge_y(int) const = 0; 68 virtual float bin_upper_edge_y(int) const = 68 virtual float bin_upper_edge_y(int) const = 0; 69 // bins : 69 // bins : 70 virtual bool has_entries_per_bin() const = 0 70 virtual bool has_entries_per_bin() const = 0; 71 virtual unsigned int bin_entries(int,int) co 71 virtual unsigned int bin_entries(int,int) const = 0; 72 virtual float bin_Sw(int,int) const = 0; 72 virtual float bin_Sw(int,int) const = 0; 73 virtual float bin_error(int,int) const = 0; 73 virtual float bin_error(int,int) const = 0; 74 }; 74 }; 75 75 76 class func1D : public virtual plottable { 76 class func1D : public virtual plottable { 77 public: 77 public: 78 TOOLS_SCLASS(tools::sg::func1D) 78 TOOLS_SCLASS(tools::sg::func1D) 79 public: 79 public: 80 virtual void* cast(const std::string& a_clas 80 virtual void* cast(const std::string& a_class) const { 81 if(void* p = cmp_cast<func1D>(this,a_class 81 if(void* p = cmp_cast<func1D>(this,a_class)) {return p;} 82 return plottable::cast(a_class); 82 return plottable::cast(a_class); 83 } 83 } 84 public: 84 public: 85 virtual ~func1D(){} 85 virtual ~func1D(){} 86 public: 86 public: 87 virtual bool value(float,float&) const = 0; 87 virtual bool value(float,float&) const = 0; 88 virtual unsigned int x_steps() const = 0; 88 virtual unsigned int x_steps() const = 0; 89 virtual float x_min() const = 0; 89 virtual float x_min() const = 0; 90 virtual float x_max() const = 0; 90 virtual float x_max() const = 0; 91 }; 91 }; 92 92 93 class func2D : public virtual plottable { 93 class func2D : public virtual plottable { 94 public: 94 public: 95 TOOLS_SCLASS(tools::sg::func2D) 95 TOOLS_SCLASS(tools::sg::func2D) 96 public: 96 public: 97 virtual void* cast(const std::string& a_clas 97 virtual void* cast(const std::string& a_class) const { 98 if(void* p = cmp_cast<func2D>(this,a_class 98 if(void* p = cmp_cast<func2D>(this,a_class)) {return p;} 99 return plottable::cast(a_class); 99 return plottable::cast(a_class); 100 } 100 } 101 public: 101 public: 102 virtual ~func2D(){} 102 virtual ~func2D(){} 103 public: 103 public: 104 virtual bool value(float,float,float&) const 104 virtual bool value(float,float,float&) const = 0; 105 virtual unsigned int x_steps() const = 0; 105 virtual unsigned int x_steps() const = 0; 106 virtual float x_min() const = 0; 106 virtual float x_min() const = 0; 107 virtual float x_max() const = 0; 107 virtual float x_max() const = 0; 108 virtual unsigned int y_steps() const = 0; 108 virtual unsigned int y_steps() const = 0; 109 virtual float y_min() const = 0; 109 virtual float y_min() const = 0; 110 virtual float y_max() const = 0; 110 virtual float y_max() const = 0; 111 /* 111 /* 112 //For "inside" functions : 112 //For "inside" functions : 113 virtual unsigned int number_of_points() cons 113 virtual unsigned int number_of_points() const = 0; 114 virtual bool ith_point(int,float&,float&,boo 114 virtual bool ith_point(int,float&,float&,bool&) const = 0; 115 virtual bool set_ith_point(int,float,float) 115 virtual bool set_ith_point(int,float,float) = 0; 116 virtual bool dragger_update_points() const = 116 virtual bool dragger_update_points() const = 0; 117 */ 117 */ 118 }; 118 }; 119 119 120 class points2D : public virtual plottable { 120 class points2D : public virtual plottable { 121 public: 121 public: 122 TOOLS_SCLASS(tools::sg::points2D) 122 TOOLS_SCLASS(tools::sg::points2D) 123 public: 123 public: 124 virtual void* cast(const std::string& a_clas 124 virtual void* cast(const std::string& a_class) const { 125 if(void* p = cmp_cast<points2D>(this,a_cla 125 if(void* p = cmp_cast<points2D>(this,a_class)) {return p;} 126 return plottable::cast(a_class); 126 return plottable::cast(a_class); 127 } 127 } 128 public: 128 public: 129 virtual ~points2D(){} 129 virtual ~points2D(){} 130 public: 130 public: 131 virtual float x_axis_min() const = 0; 131 virtual float x_axis_min() const = 0; 132 virtual float x_axis_max() const = 0; 132 virtual float x_axis_max() const = 0; 133 virtual float y_axis_min() const = 0; 133 virtual float y_axis_min() const = 0; 134 virtual float y_axis_max() const = 0; 134 virtual float y_axis_max() const = 0; 135 135 136 virtual unsigned int points() const = 0; 136 virtual unsigned int points() const = 0; 137 virtual bool ith_point(unsigned int,float&,f 137 virtual bool ith_point(unsigned int,float&,float&) const = 0; 138 }; 138 }; 139 139 140 class points3D : public virtual plottable { 140 class points3D : public virtual plottable { 141 public: 141 public: 142 TOOLS_SCLASS(tools::sg::points3D) 142 TOOLS_SCLASS(tools::sg::points3D) 143 public: 143 public: 144 virtual void* cast(const std::string& a_clas 144 virtual void* cast(const std::string& a_class) const { 145 if(void* p = cmp_cast<points3D>(this,a_cla 145 if(void* p = cmp_cast<points3D>(this,a_class)) {return p;} 146 return plottable::cast(a_class); 146 return plottable::cast(a_class); 147 } 147 } 148 public: 148 public: 149 virtual ~points3D(){} 149 virtual ~points3D(){} 150 public: 150 public: 151 virtual float x_axis_min() const = 0; 151 virtual float x_axis_min() const = 0; 152 virtual float x_axis_max() const = 0; 152 virtual float x_axis_max() const = 0; 153 virtual float y_axis_min() const = 0; 153 virtual float y_axis_min() const = 0; 154 virtual float y_axis_max() const = 0; 154 virtual float y_axis_max() const = 0; 155 virtual float z_axis_min() const = 0; 155 virtual float z_axis_min() const = 0; 156 virtual float z_axis_max() const = 0; 156 virtual float z_axis_max() const = 0; 157 157 158 virtual unsigned int points() const = 0; 158 virtual unsigned int points() const = 0; 159 virtual bool ith_point(unsigned int,float&,f 159 virtual bool ith_point(unsigned int,float&,float&,float&) const = 0; 160 }; 160 }; 161 161 162 inline const std::string& s_tools_sg_fit2plot( 162 inline const std::string& s_tools_sg_fit2plot() { 163 static const std::string s_v("tools::sg::fit 163 static const std::string s_v("tools::sg::fit2plot"); 164 return s_v; 164 return s_v; 165 } 165 } 166 166 167 }} 167 }} 168 168 169 ////////////////////////////////////////////// 169 //////////////////////////////////////////////////////////////////////////////// 170 /// primitives : ///////////////////////////// 170 /// primitives : /////////////////////////////////////////////////////////////// 171 ////////////////////////////////////////////// 171 //////////////////////////////////////////////////////////////////////////////// 172 #include "../colorf" 172 #include "../colorf" 173 173 174 namespace tools { 174 namespace tools { 175 namespace sg { 175 namespace sg { 176 176 177 class plottable_text : public virtual plotprim 177 class plottable_text : public virtual plotprim { 178 typedef plotprim parent; 178 typedef plotprim parent; 179 public: 179 public: 180 TOOLS_SCLASS(plottable_text) 180 TOOLS_SCLASS(plottable_text) 181 public: //tools::sg::plotprim 181 public: //tools::sg::plotprim 182 virtual void* cast(const std::string& a_clas 182 virtual void* cast(const std::string& a_class) const { 183 if(void* p = cmp_cast<plottable_text>(this 183 if(void* p = cmp_cast<plottable_text>(this,a_class)) {return p;} 184 return 0; 184 return 0; 185 } 185 } 186 virtual plotprim* copy() const {return new p 186 virtual plotprim* copy() const {return new plottable_text(*this);} 187 public: 187 public: 188 enum text_mode { 188 enum text_mode { 189 text_as_it, 189 text_as_it, 190 text_enforce_width, 190 text_enforce_width, 191 text_enforce_height 191 text_enforce_height 192 }; 192 }; 193 public: 193 public: 194 plottable_text(const std::string& a_TEXT,flo 194 plottable_text(const std::string& a_TEXT,float a_X,float a_Y, 195 float a_SIZE,text_mode a_text 195 float a_SIZE,text_mode a_text_mode, 196 /* 196 /* 197 float a_ANGLE = 0, 197 float a_ANGLE = 0, 198 char a_HJUST = 'L',char a_VJU 198 char a_HJUST = 'L',char a_VJUST = 'B', 199 const std::string& a_FONT = " 199 const std::string& a_FONT = "Hershey",const colorf& a_TXCI = colorf(0,0,0,1), 200 float a_SCALE = 1,bool a_SMOO 200 float a_SCALE = 1,bool a_SMOOTHING = false,bool a_HINTING = false,float a_line_width = 1, 201 font_modeling a_font_modeling 201 font_modeling a_font_modeling = font_filled 202 */ 202 */ 203 float a_ANGLE, 203 float a_ANGLE, 204 char a_HJUST,char a_VJUST, 204 char a_HJUST,char a_VJUST, 205 const std::string& a_FONT,con 205 const std::string& a_FONT,const colorf& a_TXCI, 206 float a_SCALE,bool a_SMOOTHIN 206 float a_SCALE,bool a_SMOOTHING,bool a_HINTING,float a_line_width, 207 font_modeling a_font_modeling 207 font_modeling a_font_modeling 208 ) 208 ) 209 :m_TEXT(a_TEXT),m_X(a_X),m_Y(a_Y) 209 :m_TEXT(a_TEXT),m_X(a_X),m_Y(a_Y) 210 ,m_SIZE(a_SIZE),m_text_mode(a_text_mode) 210 ,m_SIZE(a_SIZE),m_text_mode(a_text_mode) 211 ,m_ANGLE(a_ANGLE) 211 ,m_ANGLE(a_ANGLE) 212 ,m_HJUST(a_HJUST) 212 ,m_HJUST(a_HJUST) 213 ,m_VJUST(a_VJUST) 213 ,m_VJUST(a_VJUST) 214 ,m_FONT(a_FONT),m_TXCI(a_TXCI) 214 ,m_FONT(a_FONT),m_TXCI(a_TXCI) 215 ,m_SCALE(a_SCALE),m_SMOOTHING(a_SMOOTHING),m 215 ,m_SCALE(a_SCALE),m_SMOOTHING(a_SMOOTHING),m_HINTING(a_HINTING),m_line_width(a_line_width) 216 ,m_font_modeling(a_font_modeling) 216 ,m_font_modeling(a_font_modeling) 217 {} 217 {} 218 public: 218 public: 219 plottable_text(const plottable_text& a_from) 219 plottable_text(const plottable_text& a_from) 220 :parent(a_from) 220 :parent(a_from) 221 ,m_TEXT(a_from.m_TEXT) 221 ,m_TEXT(a_from.m_TEXT) 222 ,m_X(a_from.m_X),m_Y(a_from.m_Y) 222 ,m_X(a_from.m_X),m_Y(a_from.m_Y) 223 ,m_SIZE(a_from.m_SIZE),m_text_mode(a_from.m_ 223 ,m_SIZE(a_from.m_SIZE),m_text_mode(a_from.m_text_mode) 224 ,m_ANGLE(a_from.m_ANGLE) 224 ,m_ANGLE(a_from.m_ANGLE) 225 ,m_HJUST(a_from.m_HJUST) 225 ,m_HJUST(a_from.m_HJUST) 226 ,m_VJUST(a_from.m_VJUST) 226 ,m_VJUST(a_from.m_VJUST) 227 ,m_FONT(a_from.m_FONT),m_TXCI(a_from.m_TXCI) 227 ,m_FONT(a_from.m_FONT),m_TXCI(a_from.m_TXCI) 228 ,m_SCALE(a_from.m_SCALE),m_SMOOTHING(a_from. 228 ,m_SCALE(a_from.m_SCALE),m_SMOOTHING(a_from.m_SMOOTHING),m_HINTING(a_from.m_HINTING),m_line_width(a_from.m_line_width) 229 ,m_font_modeling(a_from.m_font_modeling) 229 ,m_font_modeling(a_from.m_font_modeling) 230 {} 230 {} 231 plottable_text& operator=(const plottable_te 231 plottable_text& operator=(const plottable_text& a_from) { 232 m_TEXT = a_from.m_TEXT; 232 m_TEXT = a_from.m_TEXT; 233 m_X = a_from.m_X; 233 m_X = a_from.m_X; 234 m_Y = a_from.m_Y; 234 m_Y = a_from.m_Y; 235 m_SIZE = a_from.m_SIZE; 235 m_SIZE = a_from.m_SIZE; 236 m_text_mode = a_from.m_text_mode; 236 m_text_mode = a_from.m_text_mode; 237 m_ANGLE = a_from.m_ANGLE; 237 m_ANGLE = a_from.m_ANGLE; 238 m_HJUST = a_from.m_HJUST; 238 m_HJUST = a_from.m_HJUST; 239 m_VJUST = a_from.m_VJUST; 239 m_VJUST = a_from.m_VJUST; 240 m_FONT = a_from.m_FONT; 240 m_FONT = a_from.m_FONT; 241 m_TXCI = a_from.m_TXCI; 241 m_TXCI = a_from.m_TXCI; 242 m_SCALE = a_from.m_SCALE; 242 m_SCALE = a_from.m_SCALE; 243 m_SMOOTHING = a_from.m_SMOOTHING; 243 m_SMOOTHING = a_from.m_SMOOTHING; 244 m_HINTING = a_from.m_HINTING; 244 m_HINTING = a_from.m_HINTING; 245 m_line_width = a_from.m_line_width; 245 m_line_width = a_from.m_line_width; 246 m_font_modeling = a_from.m_font_modeling; 246 m_font_modeling = a_from.m_font_modeling; 247 return *this; 247 return *this; 248 } 248 } 249 public: 249 public: 250 std::string m_TEXT; 250 std::string m_TEXT; 251 float m_X; 251 float m_X; 252 float m_Y; 252 float m_Y; 253 float m_SIZE; 253 float m_SIZE; 254 text_mode m_text_mode; 254 text_mode m_text_mode; 255 float m_ANGLE; 255 float m_ANGLE; 256 char m_HJUST; 256 char m_HJUST; 257 char m_VJUST; 257 char m_VJUST; 258 std::string m_FONT; 258 std::string m_FONT; 259 colorf m_TXCI; 259 colorf m_TXCI; 260 float m_SCALE; 260 float m_SCALE; 261 bool m_SMOOTHING; 261 bool m_SMOOTHING; 262 bool m_HINTING; 262 bool m_HINTING; 263 float m_line_width; //used if font is hershe 263 float m_line_width; //used if font is hershey. 264 font_modeling m_font_modeling; 264 font_modeling m_font_modeling; 265 }; 265 }; 266 266 267 class plottable_box : public virtual plotprim 267 class plottable_box : public virtual plotprim { 268 typedef plotprim parent; 268 typedef plotprim parent; 269 public: 269 public: 270 TOOLS_SCLASS(plottable_box) 270 TOOLS_SCLASS(plottable_box) 271 public: //tools::sg::plotprim 271 public: //tools::sg::plotprim 272 virtual void* cast(const std::string& a_clas 272 virtual void* cast(const std::string& a_class) const { 273 if(void* p = cmp_cast<plottable_box>(this, 273 if(void* p = cmp_cast<plottable_box>(this,a_class)) {return p;} 274 return 0; 274 return 0; 275 } 275 } 276 virtual plotprim* copy() const {return new p 276 virtual plotprim* copy() const {return new plottable_box(*this);} 277 public: 277 public: 278 enum fill_area_style { 278 enum fill_area_style { 279 HOLLOW = 0, 279 HOLLOW = 0, 280 SOLID = 1, 280 SOLID = 1, 281 PATTERN = 2, 281 PATTERN = 2, 282 HATCHED = 3 282 HATCHED = 3 283 }; 283 }; 284 public: 284 public: 285 plottable_box(float a_X1,float a_Y1,float a_ 285 plottable_box(float a_X1,float a_Y1,float a_X2,float a_Y2, 286 fill_area_style a_FAIS,const c 286 fill_area_style a_FAIS,const colorf& a_FACI, 287 int a_FASI, 287 int a_FASI, 288 bool a_BORD,const colorf& a_PL 288 bool a_BORD,const colorf& a_PLCI,float a_LWID) 289 :m_X1(a_X1),m_Y1(a_Y1),m_X2(a_X2),m_Y2(a_Y2) 289 :m_X1(a_X1),m_Y1(a_Y1),m_X2(a_X2),m_Y2(a_Y2) 290 ,m_FAIS(a_FAIS),m_FACI(a_FACI),m_FASI(a_FASI 290 ,m_FAIS(a_FAIS),m_FACI(a_FACI),m_FASI(a_FASI),m_BORD(a_BORD),m_PLCI(a_PLCI),m_LWID(a_LWID) 291 {} 291 {} 292 public: 292 public: 293 plottable_box(const plottable_box& a_from) 293 plottable_box(const plottable_box& a_from) 294 :parent(a_from) 294 :parent(a_from) 295 ,m_X1(a_from.m_X1),m_Y1(a_from.m_Y1) 295 ,m_X1(a_from.m_X1),m_Y1(a_from.m_Y1) 296 ,m_X2(a_from.m_X2),m_Y2(a_from.m_Y2) 296 ,m_X2(a_from.m_X2),m_Y2(a_from.m_Y2) 297 ,m_FAIS(a_from.m_FAIS),m_FACI(a_from.m_FACI) 297 ,m_FAIS(a_from.m_FAIS),m_FACI(a_from.m_FACI),m_FASI(a_from.m_FASI),m_BORD(a_from.m_BORD),m_PLCI(a_from.m_PLCI) 298 ,m_LWID(a_from.m_LWID) 298 ,m_LWID(a_from.m_LWID) 299 {} 299 {} 300 plottable_box& operator=(const plottable_box 300 plottable_box& operator=(const plottable_box& a_from) { 301 m_X1 = a_from.m_X1; 301 m_X1 = a_from.m_X1; 302 m_Y1 = a_from.m_Y1; 302 m_Y1 = a_from.m_Y1; 303 m_X2 = a_from.m_X2; 303 m_X2 = a_from.m_X2; 304 m_Y2 = a_from.m_Y2; 304 m_Y2 = a_from.m_Y2; 305 m_FAIS = a_from.m_FAIS; 305 m_FAIS = a_from.m_FAIS; 306 m_FACI = a_from.m_FACI; 306 m_FACI = a_from.m_FACI; 307 m_FASI = a_from.m_FASI; 307 m_FASI = a_from.m_FASI; 308 m_BORD = a_from.m_BORD; 308 m_BORD = a_from.m_BORD; 309 m_PLCI = a_from.m_PLCI; 309 m_PLCI = a_from.m_PLCI; 310 m_LWID = a_from.m_LWID; 310 m_LWID = a_from.m_LWID; 311 return *this; 311 return *this; 312 } 312 } 313 public: 313 public: 314 float m_X1; 314 float m_X1; 315 float m_Y1; 315 float m_Y1; 316 float m_X2; 316 float m_X2; 317 float m_Y2; 317 float m_Y2; 318 fill_area_style m_FAIS; 318 fill_area_style m_FAIS; 319 colorf m_FACI; 319 colorf m_FACI; 320 int m_FASI; 320 int m_FASI; 321 bool m_BORD; 321 bool m_BORD; 322 colorf m_PLCI; 322 colorf m_PLCI; 323 float m_LWID; 323 float m_LWID; 324 }; 324 }; 325 325 326 class plottable_ellipse : public virtual plotp 326 class plottable_ellipse : public virtual plotprim { 327 typedef plotprim parent; 327 typedef plotprim parent; 328 public: 328 public: 329 TOOLS_SCLASS(plottable_ellipse) 329 TOOLS_SCLASS(plottable_ellipse) 330 public: //tools::sg::plotprim 330 public: //tools::sg::plotprim 331 virtual void* cast(const std::string& a_clas 331 virtual void* cast(const std::string& a_class) const { 332 if(void* p = cmp_cast<plottable_ellipse>(t 332 if(void* p = cmp_cast<plottable_ellipse>(this,a_class)) {return p;} 333 return 0; 333 return 0; 334 } 334 } 335 virtual plotprim* copy() const {return new p 335 virtual plotprim* copy() const {return new plottable_ellipse(*this);} 336 public: 336 public: 337 enum fill_area_style { 337 enum fill_area_style { 338 HOLLOW = 0, 338 HOLLOW = 0, 339 SOLID = 1, 339 SOLID = 1, 340 PATTERN = 2, 340 PATTERN = 2, 341 HATCHED = 3 341 HATCHED = 3 342 }; 342 }; 343 public: 343 public: 344 plottable_ellipse(float a_X,float a_Y,float 344 plottable_ellipse(float a_X,float a_Y,float a_R1,float a_R2, 345 fill_area_style a_FAIS,const c 345 fill_area_style a_FAIS,const colorf& a_FACI, 346 int a_FASI, 346 int a_FASI, 347 bool a_BORD,const colorf& a_PL 347 bool a_BORD,const colorf& a_PLCI,float a_LWID) 348 :m_X(a_X),m_Y(a_Y),m_R1(a_R1),m_R2(a_R2) 348 :m_X(a_X),m_Y(a_Y),m_R1(a_R1),m_R2(a_R2) 349 ,m_FAIS(a_FAIS),m_FACI(a_FACI),m_FASI(a_FASI 349 ,m_FAIS(a_FAIS),m_FACI(a_FACI),m_FASI(a_FASI),m_BORD(a_BORD),m_PLCI(a_PLCI),m_LWID(a_LWID) 350 {} 350 {} 351 public: 351 public: 352 plottable_ellipse(const plottable_ellipse& a 352 plottable_ellipse(const plottable_ellipse& a_from) 353 :parent(a_from) 353 :parent(a_from) 354 ,m_X(a_from.m_X),m_Y(a_from.m_Y) 354 ,m_X(a_from.m_X),m_Y(a_from.m_Y) 355 ,m_R1(a_from.m_R1),m_R2(a_from.m_R2) 355 ,m_R1(a_from.m_R1),m_R2(a_from.m_R2) 356 ,m_FAIS(a_from.m_FAIS),m_FACI(a_from.m_FACI) 356 ,m_FAIS(a_from.m_FAIS),m_FACI(a_from.m_FACI),m_FASI(a_from.m_FASI),m_BORD(a_from.m_BORD),m_PLCI(a_from.m_PLCI) 357 ,m_LWID(a_from.m_LWID) 357 ,m_LWID(a_from.m_LWID) 358 {} 358 {} 359 plottable_ellipse& operator=(const plottable 359 plottable_ellipse& operator=(const plottable_ellipse& a_from) { 360 m_X = a_from.m_X; 360 m_X = a_from.m_X; 361 m_Y = a_from.m_Y; 361 m_Y = a_from.m_Y; 362 m_R1 = a_from.m_R1; 362 m_R1 = a_from.m_R1; 363 m_R2 = a_from.m_R2; 363 m_R2 = a_from.m_R2; 364 m_FAIS = a_from.m_FAIS; 364 m_FAIS = a_from.m_FAIS; 365 m_FACI = a_from.m_FACI; 365 m_FACI = a_from.m_FACI; 366 m_FASI = a_from.m_FASI; 366 m_FASI = a_from.m_FASI; 367 m_BORD = a_from.m_BORD; 367 m_BORD = a_from.m_BORD; 368 m_PLCI = a_from.m_PLCI; 368 m_PLCI = a_from.m_PLCI; 369 m_LWID = a_from.m_LWID; 369 m_LWID = a_from.m_LWID; 370 return *this; 370 return *this; 371 } 371 } 372 public: 372 public: 373 float m_X; 373 float m_X; 374 float m_Y; 374 float m_Y; 375 float m_R1; 375 float m_R1; 376 float m_R2; 376 float m_R2; 377 fill_area_style m_FAIS; 377 fill_area_style m_FAIS; 378 colorf m_FACI; 378 colorf m_FACI; 379 int m_FASI; 379 int m_FASI; 380 bool m_BORD; 380 bool m_BORD; 381 colorf m_PLCI; 381 colorf m_PLCI; 382 float m_LWID; 382 float m_LWID; 383 }; 383 }; 384 384 385 }} 385 }} 386 386 387 #include "../img" 387 #include "../img" 388 #include "../typedefs" 388 #include "../typedefs" 389 389 390 namespace tools { 390 namespace tools { 391 namespace sg { 391 namespace sg { 392 392 393 class plottable_img : public virtual plotprim 393 class plottable_img : public virtual plotprim { 394 typedef plotprim parent; 394 typedef plotprim parent; 395 public: 395 public: 396 TOOLS_SCLASS(plottable_img) 396 TOOLS_SCLASS(plottable_img) 397 public: //tools::sg::plotprim 397 public: //tools::sg::plotprim 398 virtual void* cast(const std::string& a_clas 398 virtual void* cast(const std::string& a_class) const { 399 if(void* p = cmp_cast<plottable_img>(this, 399 if(void* p = cmp_cast<plottable_img>(this,a_class)) {return p;} 400 return 0; 400 return 0; 401 } 401 } 402 virtual plotprim* copy() const {return new p 402 virtual plotprim* copy() const {return new plottable_img(*this);} 403 public: 403 public: 404 plottable_img(const img<byte>& a_img,float a 404 plottable_img(const img<byte>& a_img,float a_X,float a_Y,float a_WIDTH,float a_HEIGHT,float a_THETA,float a_PHI) 405 :m_img(a_img) 405 :m_img(a_img) 406 ,m_X(a_X),m_Y(a_Y) 406 ,m_X(a_X),m_Y(a_Y) 407 ,m_WIDTH(a_WIDTH),m_HEIGHT(a_HEIGHT),m_THETA 407 ,m_WIDTH(a_WIDTH),m_HEIGHT(a_HEIGHT),m_THETA(a_THETA),m_PHI(a_PHI) 408 {} 408 {} 409 public: 409 public: 410 plottable_img(const plottable_img& a_from) 410 plottable_img(const plottable_img& a_from) 411 :parent(a_from) 411 :parent(a_from) 412 ,m_img(a_from.m_img) 412 ,m_img(a_from.m_img) 413 ,m_X(a_from.m_X),m_Y(a_from.m_Y) 413 ,m_X(a_from.m_X),m_Y(a_from.m_Y) 414 ,m_WIDTH(a_from.m_WIDTH),m_HEIGHT(a_from.m_H 414 ,m_WIDTH(a_from.m_WIDTH),m_HEIGHT(a_from.m_HEIGHT),m_THETA(a_from.m_THETA),m_PHI(a_from.m_PHI) 415 {} 415 {} 416 plottable_img& operator=(const plottable_img 416 plottable_img& operator=(const plottable_img& a_from) { 417 m_img = a_from.m_img; 417 m_img = a_from.m_img; 418 m_X = a_from.m_X; 418 m_X = a_from.m_X; 419 m_Y = a_from.m_Y; 419 m_Y = a_from.m_Y; 420 m_WIDTH = a_from.m_WIDTH; 420 m_WIDTH = a_from.m_WIDTH; 421 m_HEIGHT = a_from.m_HEIGHT; 421 m_HEIGHT = a_from.m_HEIGHT; 422 m_THETA = a_from.m_THETA; 422 m_THETA = a_from.m_THETA; 423 m_PHI = a_from.m_PHI; 423 m_PHI = a_from.m_PHI; 424 return *this; 424 return *this; 425 } 425 } 426 public: 426 public: 427 img<byte> m_img; 427 img<byte> m_img; 428 float m_X; 428 float m_X; 429 float m_Y; 429 float m_Y; 430 float m_WIDTH; 430 float m_WIDTH; 431 float m_HEIGHT; 431 float m_HEIGHT; 432 float m_THETA; 432 float m_THETA; 433 float m_PHI; 433 float m_PHI; 434 }; 434 }; 435 435 436 }} 436 }} 437 437 438 438 439 #endif 439 #endif