g4tools  5.4.0
plots
Go to the documentation of this file.
1 // Copyright (C) 2010, Guy Barrand. All rights reserved.
2 // See the file tools.license for terms.
3 
4 #ifndef tools_sg_plots
5 #define tools_sg_plots
6 
7 #include "_switch"
8 //#include "head_light"
9 #include "matrix"
10 
11 #include "plotter"
12 
13 namespace tools {
14 namespace sg {
15 
16 class plots : public node {
18 public:
21  sf<unsigned int> cols; //must never be 0.
22  sf<unsigned int> rows; //must never be 0.
23  sf<bool> view_border; //current plotter border
24  sf<float> plotter_scale; //scale factor applied to each plotter.
25 
32 
33  // for gopaw :
40 public:
41  virtual const desc_fields& node_desc_fields() const {
43  static const desc_fields s_v(parent::node_desc_fields(),18, //WARNING : take care of count.
62  );
63  return s_v;
64  }
65  virtual bool touched() {
66  if(parent::touched()) return true;
67 
68  if(m_sep.empty()) return true;
69  if(m_extras.size()!=m_extras_sep.size()) return true;
70 
71  //{size_t _number = m_sep.size();
72  // for(size_t index=0;index<_number;index++) {
73  // separator* sep = (separator*)m_sep[index];
74  // plotter* _plotter = (plotter*)(*sep)[PLOTTER()];
75  // if(_plotter->shape.touched()) return true;
76  // }}
77 
78  return false;
79  }
80 private:
81  void add_fields(){
82  add_field(&width);
83  add_field(&height);
84  add_field(&cols);
85  add_field(&rows);
100  }
101 private:
102  static unsigned int MATRIX() {return 0;}
103  static unsigned int BORDER() {return 1;}
104  static unsigned int PLOTTER() {return 2;}
105  //static unsigned int TSF() {return xxx;}
106  //static unsigned int LIGHT() {return xxx;}
107 
108  typedef std::vector<plottable*> ptbs_t;
109  typedef std::vector<node*> todels_t;
110  typedef std::vector<plotprim*> prims_t;
111 public:
112 /*
113  class updater {
114  public:
115  virtual void update(plots&,size_t) = 0;
116  virtual updater* copy() const = 0;
117  public:
118  virtual ~updater(){}
119  };
120 */
121 public:
122  virtual void render(render_action& a_action) {
124  m_group.render(a_action);
125  }
126  virtual void pick(pick_action& a_action) {
128  nodekit_pick(a_action,m_group,this);
129  //m_group.pick(a_action);
130  }
131  virtual void search(search_action& a_action) {
133  parent::search(a_action);
134  if(a_action.done()) return;
135  if(a_action.do_path()) a_action.path_push(this);
136  m_group.search(a_action);
137  if(a_action.done()) return;
138  if(a_action.do_path()) a_action.path_pop();
139  }
140  virtual void bbox(bbox_action& a_action) {
142  m_group.bbox(a_action);
143  }
144 
145  virtual void event(event_action& a_action) {
147  m_group.event(a_action);
148  if(a_action.done()) return;
149  }
150  virtual bool write(write_action& a_action) {
152  return m_group.write(a_action);
153  }
154 public:
155  plots(const base_freetype& a_ttf)
156  :parent()
157  ,width(1)
158  ,height(1)
159  ,cols(1)
160  ,rows(1)
161  ,view_border(true)
162  ,plotter_scale(1)
163  ,border_visible(false)
164  ,border_width(0)
165  ,border_height(0)
166  ,border_z(0)
167  ,border_scale(1)
168  ,border_color(colorf_grey())
169  ,left_margin(0)
170  ,right_margin(0)
171  ,top_margin(0)
172  ,bottom_margin(0)
174  ,vertical_spacing(0)
175 
176  ,m_ttf(a_ttf)
177  ,m_current(0)
178  ,m_extras()
179  //,m_updater(0)
180  ,m_old_cols(0)
181  ,m_old_rows(0)
182  {
183  add_fields();
184  init_sg();
185  }
186  virtual ~plots() {
187  //delete m_updater;
188  }
189 public:
190  plots(const plots& a_from)
191  :parent(a_from)
192  ,width(a_from.width)
193  ,height(a_from.height)
194  ,cols(a_from.cols)
195  ,rows(a_from.rows)
196  ,view_border(a_from.view_border)
199  ,border_width(a_from.border_width)
201  ,border_z(a_from.border_z)
202  ,border_scale(a_from.border_scale)
203  ,border_color(a_from.border_color)
204  ,left_margin(a_from.left_margin)
205  ,right_margin(a_from.right_margin)
206  ,top_margin(a_from.top_margin)
210 
211  ,m_ttf(a_from.m_ttf)
212  ,m_current(a_from.m_current)
213  ,m_extras(a_from.m_extras)
214  //,m_updater(0)
215  ,m_old_cols(0)
216  ,m_old_rows(0)
217  ,m_origins(a_from.m_origins)
218  ,m_sizes(a_from.m_sizes)
221  {
222  add_fields();
223  init_sg();
224  //m_updater = a_from.m_updater?a_from.m_updater->copy():0;
225  if(!copy_plotters(a_from)) {}
226  }
227  plots& operator=(const plots& a_from){
228  parent::operator=(a_from);
229  if(&a_from==this) return *this;
230 
231  width = a_from.width;
232  height = a_from.height;
233 
234  cols = a_from.cols;
235  rows = a_from.rows;
236  view_border = a_from.view_border;
237  plotter_scale = a_from.plotter_scale;
238 
240  border_width = a_from.border_width;
241  border_height = a_from.border_height;
242  border_z = a_from.border_z;
243  border_scale = a_from.border_scale;
244  border_color = a_from.border_color;
245 
246  left_margin = a_from.left_margin;
247  right_margin = a_from.right_margin;
248  top_margin = a_from.top_margin;
249  bottom_margin = a_from.bottom_margin;
252 
253  m_old_cols = 0;
254  m_old_rows = 0;
255  m_origins = a_from.m_origins;
256  m_sizes = a_from.m_sizes;
259 
260  m_current = a_from.m_current;
261  m_extras = a_from.m_extras;
262 
263  if(!copy_plotters(a_from)) {}
264 
265  return *this;
266  }
267 public:
268  unsigned int number() const {return cols*rows;}
269  unsigned int current_index() const {return m_current;}
270 
271  void adjust_size(unsigned int a_ww,unsigned int a_wh) {
272  if(!a_ww||!a_wh) return;
273  float aspect = float(a_ww)/float(a_wh);
274  width = height * aspect;
275  }
276 
277  //void enforce_update() { //used in geant4 plotting.
278  // update_sg();
279  // reset_touched();
280  //}
281 
282  const base_freetype& ttf() const {return m_ttf;}
283 public:
284 /*
285  void set_updater(updater* a_updater) {
286  //WARNING : we take ownership of a_updater
287  delete m_updater;
288  m_updater = a_updater;
289  }
290 */
291  void clear() {
293  {size_t _number = m_sep.size();
294  for(size_t index=0;index<_number;index++) {
295  separator* sep = (separator*)m_sep[index];
296  plotter* _plotter = (plotter*)(*sep)[PLOTTER()];
297  _plotter->clear();
298  }}
300  separator* sep = (*it).m_sep;
301  plotter* _plotter = (plotter*)(*sep)[PLOTTER()];
302  _plotter->clear();
303  }
304  }
305 
306  bool has_data() {
308  {size_t _number = m_sep.size();
309  for(size_t index=0;index<_number;index++) {
310  separator* sep = (separator*)m_sep[index];
311  plotter* _plotter = (plotter*)(*sep)[PLOTTER()];
312  if(_plotter->plottables().size()) return true;
313  }}
315  separator* sep = (*it).m_sep;
316  plotter* _plotter = (plotter*)(*sep)[PLOTTER()];
317  if(_plotter->plottables().size()) return true;
318  }
319  return false;
320  }
321 
322  void touch_plotters() { //used in exlib/geant4/session.
324  {size_t _number = m_sep.size();
325  for(size_t index=0;index<_number;index++) {
326  separator* sep = (separator*)m_sep[index];
327  plotter* _plotter = (plotter*)(*sep)[PLOTTER()];
328  _plotter->touch();
329  }}
331  separator* sep = (*it).m_sep;
332  plotter* _plotter = (plotter*)(*sep)[PLOTTER()];
333  _plotter->touch();
334  }
335  }
336 
337  void next() {
339  size_t _number = m_sep.size();
340  if(m_current>=(uint32(_number)-1)) {
341  m_current = 0;
342  } else {
343  m_current++;
344  }
346  }
347 
348  bool set_current_plotter(unsigned int a_index) {
350  if(a_index>=m_sep.size()) return false;
351  m_current = a_index;
353  return true;
354  }
355 
356  bool set_current(plotter* a_plotter) { //for popup.
358  size_t _number = m_sep.size();
359  for(size_t index=0;index<_number;index++) {
360  separator* sep = (separator*)m_sep[index];
361  plotter* _plotter = (plotter*)(*sep)[PLOTTER()];
362  if(_plotter==a_plotter) {
363  m_current = uint32(index);
365  return true;
366  }
367  }
368  return false;
369  }
370 
371 // torche* current_torche() {
372 // update_if_touched();
373 // separator* sep = (separator*)m_sep[m_current];
374 // return safe_cast<node,torche>(*((*sep)[LIGHT()]));
375 // }
376 
377 /*
378  matrix* current_tsf() {
379  plotter& _plotter = current_plotter();
380  if(_plotter.shape.value()==plotter::xyz) {
381  return &(_plotter.tsf());
382  } else {
383  update_if_touched();
384  separator* sep = (separator*)m_sep[m_current];
385  return safe_cast<node,matrix>(*((*sep)[TSF()]));
386  }
387  }
388 */
389 
393  return *((plotter*)(*sep)[PLOTTER()]);
394  }
395  plotter* find_plotter(unsigned int a_index) {
397  if(a_index>=m_sep.size()) return 0;
398  separator* sep = (separator*)m_sep[a_index];
399  return (plotter*)(*sep)[PLOTTER()];
400  }
401 
402 /*
403  bool find_plotter(unsigned int a_ww,unsigned int a_wh,
404  float a_x,float a_y,
405  unsigned int& a_index) {
406  update_if_touched();
407 
408  a_index = 0;
409 
410  if(!a_ww) return false;
411  if(!a_wh) return false;
412 
413  float aspect = float(a_ww)/float(a_wh);
414 
415  // one plotter in pixels :
416  unsigned int rw = (unsigned int)(float(a_ww)/float(cols.value()));
417  unsigned int rh = (unsigned int)(float(a_wh)/float(rows.value()));
418  float ra = float(rw)/float(rh);
419 
420  // all window wc :
421  float wh_wc = 1;
422  float ww_wc = wh_wc * aspect;
423 
424  // plotter size in window wc :
425  float rh_wc = wh_wc/rows;
426  float rw_wc = rh_wc*ra;
427 
428  unsigned int _number = m_sep.size();
429  for(unsigned int index=0;index<_number;index++) {
430  unsigned int row = index/cols;
431  unsigned int col = index-cols*row;
432 
433  float x = -ww_wc*0.5f + col * rw_wc + rw_wc * 0.5f;
434  float y = wh_wc*0.5f - row * rh_wc - rh_wc * 0.5f;
435 
436  if( ((x-rw_wc*0.5f)<a_x)&&(a_x<(x+rw_wc*0.5f)) &&
437  ((y-rh_wc*0.5f)<a_y)&&(a_y<(y+rh_wc*0.5f)) ){
438  a_index = index;
439  return true;
440  }
441  }
442 
443  return false;
444  }
445 */
446 
447  void set_regions(unsigned int a_cols = 1,unsigned int a_rows = 1,bool a_transfer = false) {
448  unsigned int oldn = cols*rows;
449 
450  std::vector<ptbs_t> ptbss;
451  std::vector<prims_t> primss;
452  std::vector<todels_t> tdlss;
453  std::vector<plotter> pls;
454 
455  if(a_transfer) {
456  ptbss.resize(oldn);
457  primss.resize(oldn);
458  tdlss.resize(oldn);
459  pls.resize(oldn,plotter(m_ttf));
460  for(unsigned int index=0;index<oldn;index++) {
461  plotter* p = find_plotter(index);
462  p->transfer_plottables(ptbss[index]);
463  p->transfer_primitives(primss[index]);
464  p->transfer_todels(tdlss[index]);
465  pls[index] = *p; //to copy styles.
466  }
467  }
468 
469  cols = a_cols?a_cols:1;
470  rows = a_rows?a_rows:1;
471  if(view_border.value()) {view_border = (number()==1?false:true);}
472  update_sg();
474  clear();
475  if(a_transfer) {
476  //fill new plotters with old data :
477  unsigned int num = min_of(oldn,cols*rows);
478  for(unsigned int index=0;index<num;index++) {
479  plotter* p = find_plotter(index);
480  p->copy_style(pls[index]); //it must not touch p width, height, depth.
481 
482  {const ptbs_t& ptbs = ptbss[index];
483  tools_vforcit(plottable*,ptbs,it) p->add_plottable(*it);}
484  {const prims_t& prims = primss[index];
485  tools_vforcit(plotprim*,prims,it) p->add_primitive(*it);}
486  {const todels_t& todels = tdlss[index];
487  tools_vforcit(node*,todels,it) p->add_node_todel(*it);}
488  }
489  }
490  reset_touched();
491  }
492 
493  void current_to_one() {
494  ptbs_t ptbs;current_plotter().transfer_plottables(ptbs);
495  prims_t prims;current_plotter().transfer_primitives(prims);
496  todels_t tdls;current_plotter().transfer_todels(tdls);
497  plotter pl = current_plotter(); //to copy styles.
498 
499  set_regions(1,1,false);
500 
501  plotter& p = current_plotter();
502  p.copy_style(pl); //copy styles.
503 
504  {tools_vforcit(plottable*,ptbs,it) p.add_plottable(*it);}
505  {tools_vforcit(plotprim*,prims,it) p.add_primitive(*it);}
506  {tools_vforcit(node*,tdls,it) p.add_node_todel(*it);}
507 
508  }
509 
510  void plotters(std::vector<plotter*>& a_vec) { //a_vec do NOT get ownership of sg::plotter objects. Use in G4Analysis.
511  a_vec.clear();
513  size_t _number = m_sep.size();
514  for(size_t index=0;index<_number;index++) {
515  separator* sep = (separator*)m_sep[index];
516  plotter* _plotter = (plotter*)(*sep)[PLOTTER()];
517  a_vec.push_back(_plotter);
518  }
519  }
520 
524  void set_line_width(float a_line_width) {
526  size_t _number = m_sep.size();
527  for(size_t index=0;index<_number;index++) {
528  separator* sep = (separator*)m_sep[index];
529  plotter* _plotter = (plotter*)(*sep)[PLOTTER()];
530 
531  _plotter->bins_style(0).line_width = a_line_width;
532  _plotter->inner_frame_style().line_width = a_line_width;
533  _plotter->grid_style().line_width = a_line_width;
534  _plotter->x_axis().line_style().width = a_line_width;
535  _plotter->x_axis().ticks_style().width = a_line_width;
536  _plotter->y_axis().line_style().width = a_line_width;
537  _plotter->y_axis().ticks_style().width = a_line_width;
538  _plotter->z_axis().line_style().width = a_line_width;
539  _plotter->z_axis().ticks_style().width = a_line_width;
540  _plotter->colormap_axis().line_style().width = a_line_width;
541  _plotter->colormap_axis().ticks_style().width = a_line_width;
542 
543  // needed if font is hershey :
544  _plotter->title_style().line_width = a_line_width;
545  _plotter->infos_style().line_width = a_line_width;
546  _plotter->title_box_style().line_width = a_line_width;
547 
548  _plotter->x_axis().labels_style().line_width = a_line_width;
549  _plotter->x_axis().mag_style().line_width = a_line_width;
550  _plotter->x_axis().title_style().line_width = a_line_width;
551 
552  _plotter->y_axis().labels_style().line_width = a_line_width;
553  _plotter->y_axis().mag_style().line_width = a_line_width;
554  _plotter->y_axis().title_style().line_width = a_line_width;
555 
556  _plotter->z_axis().labels_style().line_width = a_line_width;
557  _plotter->z_axis().mag_style().line_width = a_line_width;
558  _plotter->z_axis().title_style().line_width = a_line_width;
559 
560  _plotter->colormap_axis().labels_style().line_width = a_line_width;
561  _plotter->colormap_axis().mag_style().line_width = a_line_width;
562  _plotter->colormap_axis().title_style().line_width = a_line_width;
563  }
564  }
565 
566 /*
567  void set_border_style() {
568  update_if_touched();
569  size_t _number = m_sep.size();
570  for(size_t index=0;index<_number;index++) {
571  separator* sep = (separator*)m_sep[index];
572  plotter* _plotter = (plotter*)(*sep)[PLOTTER()];
573  _plotter->background_style().visible = true;
574  _plotter->background_style().color = colorf_black();
575  _plotter->background_style().line_width = 0.003;
576  }
577  border_visible = true;
578  }
579 */
580 
581  void set_grids_visibility(bool a_visible = false) {
583  size_t _number = m_sep.size();
584  for(size_t index=0;index<_number;index++) {
585  separator* sep = (separator*)m_sep[index];
586  plotter* _plotter = (plotter*)(*sep)[PLOTTER()];
587  _plotter->grid_style().visible = a_visible;
588  }
589  border_visible = true;
590  }
591 
592  void adjust_scales(float a_plotter_scale = 1) {
593  // Rescale some plotter parameters (for example margins) according to the number of plots.
594  // We assume that these parameters had been set previously according to one plot per page.
595  // Then this function must be applied after all the styles had been applied (because
596  // a plotting style may set these parameters).
597 
598  float ww_wc = width.value();
599  float wh_wc = height.value();
600  float rw_wc = ww_wc/cols.value();
601  float rh_wc = wh_wc/rows.value();
602 
603  float cooking = 1.2f; //if increased the data area is diminished.
604 
605  float wfac = (rw_wc/ww_wc)*cooking;
606  float hfac = (rh_wc/wh_wc)*cooking;
607 
608  float label_cooking = 1.6f; //if increased the labels are bigger.
609 
610  if((cols.value()>=4)&&(cols.value()>rows.value())) label_cooking = 0.9f;
611 
612  float title_cooking = 1.1f; //extra title cooking.
613 
614  plotter_scale = a_plotter_scale;
615 
617  {size_t _number = m_sep.size();
618  for(size_t index=0;index<_number;index++) {
619  separator* sep = (separator*)m_sep[index];
620  plotter* _plotter = (plotter*)(*sep)[PLOTTER()];
621 
622  _plotter->left_margin = _plotter->left_margin * wfac;
623  _plotter->right_margin = _plotter->right_margin * wfac;
624  _plotter->bottom_margin = _plotter->bottom_margin * hfac;
625  _plotter->top_margin = _plotter->top_margin * hfac;
626 
627  _plotter->x_axis().tick_length = _plotter->x_axis().tick_length * wfac;
628  _plotter->y_axis().tick_length = _plotter->y_axis().tick_length * hfac;
629 
630  _plotter->title_to_axis = _plotter->title_to_axis * hfac;
631  _plotter->title_height = _plotter->title_height * hfac * title_cooking;
632 
633  _plotter->x_axis().label_height = _plotter->x_axis().label_height * hfac * label_cooking;
634  _plotter->y_axis().label_height = _plotter->y_axis().label_height * hfac * label_cooking;
635  }}
636  }
637 
638  //gopaw:
639  void configure_grid_PAW(unsigned int a_ww,unsigned int a_wh) {
640 
641  m_origins.clear();
642  m_sizes.clear();
643 
644  float wvp = float(a_ww); //pixels.
645  float hvp = float(a_wh); //pixels.
646  if( (wvp<=0)||(hvp<=0)||(width.value()<=0)||(height.value()<=0) ) return;
647 
648  unsigned int _cols = cols.value();
649  unsigned int _rows = rows.value();
650  if((!_cols)||(!_rows)) return;
651 
652  float wdata = (width.value()-left_margin.value()-right_margin.value()-(_cols-1)*horizontal_spacing.value())/_cols;
653  float hdata = (height.value()-bottom_margin.value()-top_margin.value()-(_rows-1)*vertical_spacing.value())/_rows;
654 
655  if((wdata<=0)||(hdata<=0)) return;
656 
657 /*
658  // wpix = w * wvp pixels
659  // hpix = h * hvp pixels
660  // wpix/hpix = cst = (w * wvp) / (h * hvp) = width / height
661  float h,w,xo,yo;
662  h = w = xo = yo = 0;
663  float waspect = wvp/hvp;
664  float paspect = width.value()/height.value();
665  if(waspect>=paspect) {
666  h = 1;
667  w = paspect * h * (hvp/wvp);
668  xo = (1-w)/2;
669  yo = 0;
670  } else {
671  w = 1;
672  h = w * (wvp/hvp)/paspect;
673  xo = 0;
674  yo = (1-h)/2;
675  }
676  float xfac = w / width.value();
677  float yfac = h / height.value();
678 */
679 
680  unsigned int _num = number();
681  for(unsigned int iregion=0;iregion<_num;iregion++) {
682  //iregion = col + row * cols
683  unsigned int row = iregion/_cols;
684  unsigned int col = iregion - row * _cols;
685 
686  float wr,hr,x,y,lm,rm,bm,tm;
687  wr = hr = x = y = 0;
688  lm = rm = bm = tm = 0;
689 
690  if(_cols==1) {
691  wr = width.value();
692  x = 0;
693  lm = left_margin.value();
694  rm = right_margin.value();
695  } else {
696  float wrl = left_margin.value()+wdata+horizontal_spacing.value()/2;
697  float wrr = right_margin.value()+wdata+horizontal_spacing.value()/2;
698  float wri = wdata+horizontal_spacing.value();
699  if(col==0) {
700  wr = wrl;
701  x = 0;
702  lm = left_margin.value();
703  rm = horizontal_spacing.value()/2;
704  } else if(col==(_cols-1)) {
705  wr = wrr;
706  x = width.value() - wrr;
707  lm = horizontal_spacing.value()/2;
708  rm = right_margin.value();
709  } else {
710  wr = wri;
711  x = wrl + (col-1) * wri;
712  lm = horizontal_spacing.value()/2;
713  rm = horizontal_spacing.value()/2;
714  }
715  }
716 
717  if(_rows==1) {
718  hr = height.value();
719  y = 0;
720  tm = top_margin.value();
721  bm = bottom_margin.value();
722  } else {
723  float hrt = top_margin.value()+hdata+vertical_spacing.value()/2; //top
724  float hrb = bottom_margin.value()+hdata+vertical_spacing.value()/2; //bottom
725  float hri = hdata+vertical_spacing.value();
726  if(row==0) { //top row.
727  hr = hrt;
728  y = height.value()-hrt;
729  tm = top_margin.value();
730  bm = vertical_spacing.value()/2;
731  } else if(row==(_rows-1)) {
732  hr = hrb;
733  y = 0;
734  tm = vertical_spacing.value()/2;
735  bm = bottom_margin.value();
736  } else {
737  hr = hri;
738  y = height.value()- (hrt + row * hri);
739  tm = vertical_spacing.value()/2;
740  bm = vertical_spacing.value()/2;
741  }
742  }
743 
744  //m_origins.push_back(vec2f(xo/xfac+x,yo/yfac+y));
745  m_origins.push_back(vec2f(x,y));
746  m_sizes.push_back(vec2f(wr,hr));
747 
748  separator* sep = (separator*)m_sep[iregion];
749  plotter* _plotter = (plotter*)(*sep)[PLOTTER()];
750 
751  //_plotter->width = wr;
752  _plotter->left_margin = lm;
753  _plotter->right_margin = rm;
754 
755  //_plotter->height = hr;
756  _plotter->top_margin = tm;
757  _plotter->bottom_margin = bm;
758 
759  // ignore margins and spacings :
760  //float wr = w/_cols;
761  //float hr = h/_rows;
762  //float x = xo + col * wr;
763  //float y = yo + (rows-1-row) * hr;
764  //viewportRegion->setPositionPercent(x,y);
765  //viewportRegion->setSizePercent(wr,hr);
766 
767  }
768  }
769 
770  void configure_extras_PAW(unsigned int a_ww,unsigned int a_wh) {
771 
772  m_extras_origins.clear();
773  m_extras_sizes.clear();
774 
775  float wvp = float(a_ww); //pixels.
776  float hvp = float(a_wh); //pixels.
777  if( (wvp<=0)||(hvp<=0)||(width.value()<=0)||(height.value()<=0) ) return;
778 
780  const extra& _extra = *it;
781 
782  unsigned int _cols = _extra.m_cols;
783  unsigned int _rows = _extra.m_rows;
784  if((!_cols)||(!_rows)) continue;
785 
786  float wdata = (width.value()-left_margin.value()-right_margin.value()-(_cols-1)*horizontal_spacing.value())/_cols;
787  float hdata = (height.value()-bottom_margin.value()-top_margin.value()-(_rows-1)*vertical_spacing.value())/_rows;
788 
789  if((wdata<=0)||(hdata<=0)) continue;
790 
791  unsigned int iregion = _extra.m_index;
792  unsigned int row = iregion/_cols;
793  unsigned int col = iregion - row * _cols;
794 
795  float wr,hr,x,y,lm,rm,bm,tm;
796  wr = hr = x = y = 0;
797  lm = rm = bm = tm = 0;
798 
799  if(_cols==1) {
800  wr = width.value();
801  x = 0;
802  lm = left_margin.value();
803  rm = right_margin.value();
804  } else {
805  float wrl = left_margin.value()+wdata+horizontal_spacing.value()/2;
806  float wrr = right_margin.value()+wdata+horizontal_spacing.value()/2;
807  float wri = wdata+horizontal_spacing.value();
808  if(col==0) {
809  wr = wrl;
810  x = 0;
811  lm = left_margin.value();
812  rm = horizontal_spacing.value()/2;
813  } else if(col==(_cols-1)) {
814  wr = wrr;
815  x = width.value() - wrr;
816  lm = horizontal_spacing.value()/2;
817  rm = right_margin.value();
818  } else {
819  wr = wri;
820  x = wrl + (col-1) * wri;
821  lm = horizontal_spacing.value()/2;
822  rm = horizontal_spacing.value()/2;
823  }
824  }
825 
826  if(_rows==1) {
827  hr = height.value();
828  y = 0;
829  tm = top_margin.value();
830  bm = bottom_margin.value();
831  } else {
832  float hrt = top_margin.value()+hdata+vertical_spacing.value()/2; //top
833  float hrb = bottom_margin.value()+hdata+vertical_spacing.value()/2; //bottom
834  float hri = hdata+vertical_spacing.value();
835  if(row==0) { //top row.
836  hr = hrt;
837  y = height.value()-hrt;
838  tm = top_margin.value();
839  bm = vertical_spacing.value()/2;
840  } else if(row==(_rows-1)) {
841  hr = hrb;
842  y = 0;
843  tm = vertical_spacing.value()/2;
844  bm = bottom_margin.value();
845  } else {
846  hr = hri;
847  y = height.value()- (hrt + row * hri);
848  tm = vertical_spacing.value()/2;
849  bm = vertical_spacing.value()/2;
850  }
851  }
852 
853  //m_extras_origins.push_back(vec2f(xo/xfac+x,yo/yfac+y));
854  m_extras_origins.push_back(vec2f(x,y));
855  m_extras_sizes.push_back(vec2f(wr,hr));
856 
857  separator* sep = _extra.m_sep;
858  plotter* _plotter = (plotter*)(*sep)[PLOTTER()];
859 
860  //_plotter->width = wr;
861  _plotter->left_margin = lm;
862  _plotter->right_margin = rm;
863 
864  //_plotter->height = hr;
865  _plotter->top_margin = tm;
866  _plotter->bottom_margin = bm;
867 
868  // ignore margins and spacings :
869  //float wr = w/_cols;
870  //float hr = h/_rows;
871  //float x = xo + col * wr;
872  //float y = yo + (rows-1-row) * hr;
873  //viewportRegion->setPositionPercent(x,y);
874  //viewportRegion->setSizePercent(wr,hr);
875 
876  } //tools_vforcit
877  }
878  void configure_PAW(unsigned int a_ww,unsigned int a_wh) {
879  configure_grid_PAW(a_ww,a_wh);
880  configure_extras_PAW(a_ww,a_wh);
881  touch();
883  }
887 
888  //gopaw:
889  void delete_extras() {
891  m_extras.clear();
892  }
893 
894  plotter* create_extra_plotter(unsigned int a_cols,unsigned int a_rows,unsigned int a_index) {
895  // Create a plotter with size and position as if in a grid of a_colsxa_rows and at position a_index.
896  // The index numbering being for example for a grid of 3x2 :
897  // 0 1 2
898  // 3 4 5
899  m_extras.push_back(extra(a_cols,a_rows,a_index));
901  separator* sep = m_extras.back().m_sep;
902  return (plotter*)(*sep)[PLOTTER()];
903  }
905  if(m_extras.empty()) return 0;
906  separator* sep = m_extras.back().m_sep;
907  return (plotter*)(*sep)[PLOTTER()];
908  }
909 public:
910  void init_sg() { // used also in gopaw::base_viewer::clean_gstos().
911  m_group.clear();
912  m_sep.clear();
915  m_group.add(new noderef(m_sep));
918  }
919  void clear_sg() { //used in GL_plots_viewer.
920  m_group.clear();
921  m_sep.clear();
924  }
925 protected:
927  if(touched()) {
928  update_sg();
929  reset_touched();
930  }
931  }
932  void update_sg(){
933 
934  if(m_sep.empty()||(cols.value()!=m_old_cols)||(rows.value()!=m_old_rows)){
935 
936  m_old_cols = cols;
937  m_old_rows = rows;
938 
939  m_sep.clear();
940 
941  unsigned int index = 0;
942  for(unsigned int irow=0;irow<rows;irow++) {
943  for(unsigned int icol=0;icol<cols;icol++) {
944  separator* sep = new separator;
945  m_sep.add(sep);
946 
947  sep->add(new sg::matrix); //MATRIX()
948 
949  //head_light* light = new head_light;
950  //light->direction = vec3f(1,-1,-10);
951  //light->on = false;
952  //sep->add(light); //LIGHT()
953 
954  _switch* border = new _switch;
955  sep->add(border); //BORDER()
956 
957  //matrix* tsf = new matrix;
958  //sep->add(tsf); //TSF()
959 
960  sep->add(new plotter(m_ttf)); //PLOTTER()
961 
962  index++;
963  }
964  }
965 
966  if(m_current>=m_sep.size()) m_current = 0;
967  }
968 
970  update_border();
971 
972  if((width.value()>0)&&(height.value()>0)) {
973  size_t _number = m_sep.size();
974 
975  bool configure = (m_origins.size()==_number)&&(m_sizes.size()==_number)?true:false;
976 
977  // all window wc :
978  float ww_wc = width;
979  float wh_wc = height;
980 
981  // plotter size in window wc :
982  //float rw_wc = ww_wc/cols;
983  //float rh_wc = wh_wc/rows;
984 
985  for(size_t index=0;index<_number;index++) {
986  separator* sep = (separator*)m_sep[index];
987  set_plotter_layout(*sep,index,configure,cols.value(),rows.value(),
988  ww_wc,wh_wc,m_origins,m_sizes,plotter_scale.value());
989  }
990  }
991 
992  update_extras();
993  }
994 
995  bool copy_plotters(const plots& a_from) {
997  if(m_sep.size()==a_from.m_sep.size()) {
998  size_t _number = m_sep.size();
999  for(size_t index=0;index<_number;index++) {
1000  separator* _from_sep = (separator*)a_from.m_sep[index];
1001  matrix* _from_matrix = (matrix*)(*_from_sep)[MATRIX()];
1002  //_switch* _border = (_switch*)(*_sep)[BORDER()];
1003  plotter* _from_plotter = (plotter*)(*_from_sep)[PLOTTER()];
1004 
1005  separator* _sep = (separator*)m_sep[index];
1006  matrix* _matrix = (matrix*)(*_sep)[MATRIX()];
1007  plotter* _plotter = (plotter*)(*_sep)[PLOTTER()];
1008 
1009  _matrix->operator=(*_from_matrix);
1010  _plotter->operator=(*_from_plotter);
1011  }
1012  }
1013  if(m_extras_sep.size()==a_from.m_extras_sep.size()) {
1014  size_t _number = m_extras_sep.size();
1015  for(size_t index=0;index<_number;index++) {
1016  separator* _from_sep = (separator*)a_from.m_extras_sep[index];
1017  matrix* _from_matrix = (matrix*)(*_from_sep)[MATRIX()];
1018  plotter* _from_plotter = (plotter*)(*_from_sep)[PLOTTER()];
1019 
1020  separator* _sep = (separator*)m_extras_sep[index];
1021  matrix* _matrix = (matrix*)(*_sep)[MATRIX()];
1022  plotter* _plotter = (plotter*)(*_sep)[PLOTTER()];
1023 
1024  _matrix->operator=(*_from_matrix);
1025  _plotter->operator=(*_from_plotter);
1026  }
1027  }
1028  return true;
1029  }
1030 
1031  static void create_plotter_border(_switch& a_parent,float a_w,float a_h) {
1032  a_parent.clear();
1033 
1034  group* sep = new group;
1035  a_parent.add(sep);
1036 
1037  a_parent.add(new group()); //empty
1038 
1039  rgba* mat = new rgba();
1040  mat->color = colorf_red();
1041  sep->add(mat);
1042 
1043  draw_style* ds = new draw_style;
1044  ds->style = draw_lines;
1045  ds->line_width = 4;
1046  sep->add(ds);
1047 
1048  vertices* vtxs = new vertices;
1049  vtxs->mode = gl::line_strip();
1050  sep->add(vtxs);
1051 
1052  float dw = a_w*0.5f;
1053  float dh = a_h*0.5f;
1054  vtxs->add(-dw,-dh,0);
1055  vtxs->add( dw,-dh,0);
1056  vtxs->add( dw, dh,0);
1057  vtxs->add(-dw, dh,0);
1058  vtxs->add(-dw,-dh,0);
1059  }
1060 
1062  size_t _number = m_sep.size();
1063  for(size_t index=0;index<_number;index++) {
1064  separator* sep = (separator*)m_sep[index];
1065  _switch* _border = (_switch*)(*sep)[BORDER()];
1066  if(index==m_current) {
1067  _border->which = view_border.value()?0:1;
1068  //if(m_updater) m_updater->update(*this,index);
1069  } else {
1070  _border->which = 1;
1071  }
1072  }
1073  }
1074 
1075  void update_border() {
1076  m_border_sep.clear();
1077 
1078  if(!border_visible.value()) return;
1079 
1080  if(width.value()<=0) return;
1081  if(height.value()<=0) return;
1082  if(border_width.value()<=0) return;
1083  if(border_height.value()<=0) return;
1084 
1085  // border_scale could be used as an offscreen (inzb_[ps,png,jpeg], gl2s_pdf)
1086  // cooking to avoid seeing a one pixel line at some side (in general left)
1087  // coming from the border.
1088  if(border_scale.value()!=1) {
1089  matrix* _m = new matrix;
1091  m_border_sep.add(_m);
1092  }
1093 
1094  float bw = border_width;
1095  float bh = border_height;
1096 
1097  // do it with four externals back_area.
1098 
1099  float zz = border_z.value();
1100 
1101  // top :
1102  {separator* sep = new separator;
1103  m_border_sep.add(sep);
1104 
1105  float wba = width+2*bw;
1106  float hba = bh;
1107  float x = 0;
1108  float y = height*0.5f+bh*0.5f;
1109 
1110  matrix* _m = new matrix;
1111  _m->set_translate(x,y,zz);
1112  sep->add(_m);
1113 
1114  back_area* b = new back_area;
1115  b->border_visible = false;
1116  b->color = border_color;
1117  b->width = wba;
1118  b->height = hba;
1119  sep->add(b);}
1120 
1121  // bottom :
1122  {separator* sep = new separator;
1123  m_border_sep.add(sep);
1124 
1125  float wba = width+2*bw;
1126  float hba = bh;
1127  float x = 0;
1128  float y = -height*0.5f-bh*0.5f;
1129 
1130  matrix* _m = new matrix;
1131  _m->set_translate(x,y,zz);
1132  sep->add(_m);
1133 
1134  back_area* b = new back_area;
1135  b->border_visible = false;
1136  b->color = border_color;
1137  b->width = wba;
1138  b->height = hba;
1139  sep->add(b);}
1140 
1141  // left :
1142  {separator* sep = new separator;
1143  m_border_sep.add(sep);
1144 
1145  float wba = bw;
1146  float hba = height+2*bh;
1147  float x = -width*0.5f-bw*0.5f;
1148  float y = 0;
1149 
1150  matrix* _m = new matrix;
1151  _m->set_translate(x,y,zz);
1152  sep->add(_m);
1153 
1154  back_area* b = new back_area;
1155  b->border_visible = false;
1156  b->color = border_color;
1157  b->width = wba;
1158  b->height = hba;
1159  sep->add(b);}
1160 
1161  // right :
1162  {separator* sep = new separator;
1163  m_border_sep.add(sep);
1164 
1165  float wba = bw;
1166  float hba = height+2*bh;
1167  float x = width*0.5f+bw*0.5f;
1168  float y = 0;
1169 
1170  matrix* _m = new matrix;
1171  _m->set_translate(x,y,zz);
1172  sep->add(_m);
1173 
1174  back_area* b = new back_area;
1175  b->border_visible = false;
1176  b->color = border_color;
1177  b->width = wba;
1178  b->height = hba;
1179  sep->add(b);}
1180 
1181  }
1182 protected:
1183  class extra {
1184  public:
1185  extra(unsigned int a_cols,unsigned int a_rows,unsigned int a_index)
1186  :m_cols(a_cols),m_rows(a_rows),m_index(a_index),m_sep(0){}
1187  virtual ~extra(){}
1188  public:
1189  extra(const extra& a_from):m_cols(a_from.m_cols),m_rows(a_from.m_rows),m_index(a_from.m_index),m_sep(0){}
1190  extra& operator=(const extra& a_from) {
1191  m_cols = a_from.m_cols;
1192  m_rows = a_from.m_rows;
1193  m_index = a_from.m_index;
1194  m_sep = a_from.m_sep;
1195  return *this;
1196  }
1197  public:
1198  unsigned int m_cols;
1199  unsigned int m_rows;
1200  unsigned int m_index;
1202  };
1203 
1204  void update_extras() {
1205  if(m_extras.size()!=m_extras_sep.size()) {
1206  m_extras_sep.clear();
1207  tools_vforit(extra,m_extras,it) { // same sg layout than grid plotters.
1208  separator* sep = new separator;
1209  m_extras_sep.add(sep);
1210  (*it).m_sep = sep; //*it does not get ownership.
1211 
1212  sep->add(new sg::matrix); //MATRIX()
1213 
1214  //head_light* light = new head_light;
1215  //light->direction = vec3f(1,-1,-10);
1216  //light->on = false;
1217  //sep->add(light); //LIGHT()
1218 
1219  _switch* border = new _switch;
1220  sep->add(border); //BORDER()
1221 
1222  //matrix* tsf = new matrix;
1223  //sep->add(tsf); //TSF()
1224 
1225  sep->add(new plotter(m_ttf)); //PLOTTER()
1226  }
1227  }
1228 
1229  if(width.value()<=0) return;
1230  if(height.value()<=0) return;
1231 
1232  // all window wc :
1233  float ww_wc = width;
1234  float wh_wc = height;
1235 
1236  size_t _number = m_extras.size();
1237 
1238  bool configure = (m_extras_origins.size()==_number)&&(m_extras_sizes.size()==_number)?true:false;
1239 
1241  const extra& _extra = *it;
1242  unsigned int index = _extra.m_index;
1243  if(index>=(m_extras_sep.size())) index = 0;
1244 
1245  separator* sep = _extra.m_sep;
1246  set_plotter_layout(*sep,index,configure,_extra.m_cols,_extra.m_rows,
1248  }
1249 
1250  }
1251 protected:
1252  static void set_plotter_layout(separator& a_sep,size_t a_index,bool a_configure,
1253  unsigned int a_cols,unsigned int a_rows,
1254  float a_ww_wc,float a_wh_wc,
1255  const std::vector<vec2f>& a_origins,const std::vector<vec2f>& a_sizes,float a_scale) {
1256  size_t row = a_index/a_cols;
1257  size_t col = a_index-a_cols*row;
1258 
1259  float rw_wc = a_ww_wc/a_cols;
1260  float rh_wc = a_wh_wc/a_rows;
1261 
1262  matrix* _matrix = (matrix*)(a_sep)[MATRIX()];
1263  plotter* _plotter = (plotter*)(a_sep)[PLOTTER()];
1264 
1265  if(a_configure) {
1266  _plotter->width = a_sizes[a_index].x();
1267  _plotter->height = a_sizes[a_index].y();
1268  float x = -a_ww_wc*0.5f + a_origins[a_index].x() + _plotter->width*0.5f;
1269  float y = -a_wh_wc*0.5f + a_origins[a_index].y() + _plotter->height*0.5f;
1270  _matrix->set_translate(x,y,0);
1271  } else {
1272  float x = -a_ww_wc*0.5f + col * rw_wc + rw_wc * 0.5f;
1273  float y = a_wh_wc*0.5f - row * rh_wc - rh_wc * 0.5f;
1274  _matrix->set_translate(x,y,0);
1275  }
1276  _matrix->mul_scale(a_scale,a_scale,1); //applied first.
1277 
1278  {_switch* _border = (_switch*)(a_sep)[BORDER()];
1279  create_plotter_border(*_border,rw_wc,rh_wc);
1280  //_border->which = view_border.value()?(a_index==m_current?0:1):1;
1281  _border->which = 1;
1282  }
1283 
1284  if(_plotter->shape.value()==plotter::xy) {
1285  _plotter->depth = min_of(rw_wc,rh_wc);
1286  } else {
1287  //if((rw_wc/rh_wc)>=1.0f) {
1288  // _plotter->depth = rh_wc;
1289  //} else {
1290  // _plotter->depth = rh_wc;
1291  //}
1292  _plotter->depth = rh_wc;
1293  }
1294 
1295  if(a_configure) {
1296  } else {
1297  if(_plotter->shape.value()==plotter::xy) {
1298  _plotter->width = rw_wc;
1299  _plotter->height = rh_wc;
1300  } else {
1301  if((rw_wc/rh_wc)>=1.0f) {
1302  _plotter->width = rh_wc;
1303  _plotter->height = rh_wc;
1304  } else {
1305  _plotter->width = rw_wc;
1306  _plotter->height = rw_wc;
1307  }
1308  }
1309  }
1310  }
1311 protected:
1313 
1318  unsigned int m_current;
1319 
1320  std::vector<extra> m_extras;
1321 
1322  //updater* m_updater;
1323  unsigned int m_old_cols;
1324  unsigned int m_old_rows;
1325 
1326  std::vector<vec2f> m_origins;
1327  std::vector<vec2f> m_sizes;
1328  std::vector<vec2f> m_extras_origins;
1329  std::vector<vec2f> m_extras_sizes;
1330 
1331 };
1332 
1333 }}
1334 
1335 #endif
tools::sg::plotter::copy_style
void copy_style(const plotter &a_from)
Definition: plotter:403
tools::sg::plots::touched
virtual bool touched()
Definition: plots:65
tools::sg::plots::touch_plotters
void touch_plotters()
Definition: plots:322
tools::sg::plots::set_line_width
void set_line_width(float a_line_width)
Definition: plots:524
plotter
tools::sg::style::visible
sf< bool > visible
Definition: style:53
tools::sg::plots::adjust_size
void adjust_size(unsigned int a_ww, unsigned int a_wh)
Definition: plots:271
tools::sg::plotter::title_to_axis
sf< float > title_to_axis
Definition: plotter:70
tools::vec2f
Definition: vec2f:13
tools::sg::plotter::clear
void clear()
Definition: plotter:1674
tools::sg::plots::ttf
const base_freetype & ttf() const
Definition: plots:282
tools::sg::group::search
virtual void search(search_action &a_action)
Definition: group:51
tools::sg::plotter::z_axis
const sg::axis & z_axis() const
Definition: plotter:1699
tools::sg::plots::border_visible
sf< bool > border_visible
Definition: plots:26
tools::sg::plotter::add_node_todel
void add_node_todel(node *a_node)
Definition: plotter:1670
tools::sg::plots::m_current
unsigned int m_current
Definition: plots:1318
tools::sg::plots::create_extra_plotter
plotter * create_extra_plotter(unsigned int a_cols, unsigned int a_rows, unsigned int a_index)
Definition: plots:894
tools::sg::plots::plots
plots(const plots &a_from)
Definition: plots:190
tools::sg::vertices::mode
sf< gl::mode_t > mode
Definition: vertices:26
tools::sg::plots::m_group
group m_group
Definition: plots:1314
tools::sg::plotter::y_axis
const sg::axis & y_axis() const
Definition: plotter:1696
tools::sg::plots::update_sg
void update_sg()
Definition: plots:932
tools::sg::plots::border_scale
sf< float > border_scale
Definition: plots:30
tools::sg::plots::extra::~extra
virtual ~extra()
Definition: plots:1187
tools::sg::group::bbox
virtual void bbox(bbox_action &a_action)
Definition: group:42
tools::sg::plotter::plottables
const std::vector< plottable * > & plottables() const
Definition: plotter:1613
tools::sg::plotter::transfer_plottables
void transfer_plottables(std::vector< plottable * > &a_to)
Definition: plotter:1627
tools::sg::plots::m_old_cols
unsigned int m_old_cols
Definition: plots:1323
tools::sg::plots::set_plotter_layout
static void set_plotter_layout(separator &a_sep, size_t a_index, bool a_configure, unsigned int a_cols, unsigned int a_rows, float a_ww_wc, float a_wh_wc, const std::vector< vec2f > &a_origins, const std::vector< vec2f > &a_sizes, float a_scale)
Definition: plots:1252
tools::sg::group::event
virtual void event(event_action &a_action)
Definition: group:45
tools::sg::event_action
Definition: event_action:14
tools::sg::plots::operator=
plots & operator=(const plots &a_from)
Definition: plots:227
tools::sg::draw_style::line_width
sf< float > line_width
Definition: draw_style:22
tools::sg::plottable
Definition: plottable:15
tools::sg::line_style::width
sf< float > width
Definition: line_style:22
tools::sg::text_style::line_width
sf< float > line_width
Definition: text_style:44
tools::sg::plots::find_plotter
plotter * find_plotter(unsigned int a_index)
Definition: plots:395
tools::sg::plots::current_plotter
plotter & current_plotter()
Definition: plots:390
tools::sg::plotter::shape
sf_enum< shape_type > shape
Definition: plotter:153
tools::sg::plotter::xy
@ xy
Definition: plotter:150
tools::sg::node
Definition: node:28
tools::sg::plots::bottom_margin
sf< float > bottom_margin
Definition: plots:37
tools::sg::plotter::bins_style
style & bins_style(size_t a_index)
Definition: plotter:1713
tools::sg::bbox_action
Definition: bbox_action:15
tools::sg::group::size
size_t size() const
Definition: group:243
tools::sg::matrix::set_translate
void set_translate(float a_x, float a_y, float a_z)
Definition: matrix:90
TOOLS_NODE
#define TOOLS_NODE(a__class, a__sclass, a__parent)
Definition: node:324
tools::sg::search_action::done
bool done() const
Definition: search_action:68
tools::sg::plots::horizontal_spacing
sf< float > horizontal_spacing
Definition: plots:38
tools::sg::write_action
Definition: write_action:21
tools::sg::plots::bbox
virtual void bbox(bbox_action &a_action)
Definition: plots:140
tools::sg::rgba
Definition: rgba:16
tools::sg::group
Definition: group:21
tools::sg::group::write
virtual bool write(write_action &a_action)
Definition: group:67
tools::sg::plotter::left_margin
sf< float > left_margin
Definition: plotter:60
tools::sg::plots::extra::m_rows
unsigned int m_rows
Definition: plots:1199
tools::sg::plotter::add_primitive
void add_primitive(plotprim *a_prim)
Definition: plotter:1651
tools::sg::base_freetype
Definition: base_freetype:16
tools::sg::plotprim
Definition: plottable:40
tools::sg::group::empty
bool empty() const
Definition: group:244
tools::gl::line_strip
mode_t line_strip()
Definition: glprims:19
tools::sg::draw_style
Definition: draw_style:18
tools::sg::search_action::path_push
void path_push(sg::node *a_v)
Definition: search_action:90
tools::sg::plots::height
sf< float > height
Definition: plots:20
tools::sg::plots::pick
virtual void pick(pick_action &a_action)
Definition: plots:126
tools::sg::desc_fields
Definition: field_desc:148
tools::sg::plots::next
void next()
Definition: plots:337
tools::sg::plots::search
virtual void search(search_action &a_action)
Definition: plots:131
matrix
tools::sg::plots::m_sep
separator m_sep
Definition: plots:1315
tools::sg::axis::labels_style
text_style & labels_style()
Definition: axis:334
tools::sg::pick_action
Definition: pick_action:59
tools::sg::plotter::colormap_axis
const sg::axis & colormap_axis() const
Definition: plotter:1702
tools::sg::plotter::infos_style
text_style & infos_style()
Definition: plotter:1710
tools::sg::plots::configure_extras_PAW
void configure_extras_PAW(unsigned int a_ww, unsigned int a_wh)
Definition: plots:770
tools::sg::plots::m_border_sep
separator m_border_sep
Definition: plots:1316
tools::sg::axis::label_height
sf< float > label_height
Definition: axis:62
tools::sg::plots::extra::m_sep
separator * m_sep
Definition: plots:1201
tools::sg::plots::view_border
sf< bool > view_border
Definition: plots:23
tools::sg::plots
Definition: plots:16
tools::sg::nodekit_pick
void nodekit_pick(pick_action &a_action, node &a_sg, node *a_node)
Definition: nodekit:13
tools::sg::plotter
Definition: plotter:45
tools::sg::plots::set_regions
void set_regions(unsigned int a_cols=1, unsigned int a_rows=1, bool a_transfer=false)
Definition: plots:447
tools::sg::group::render
virtual void render(render_action &a_action)
Definition: group:24
tools::sg::sf_vec
Definition: sf_vec:15
tools::sg::matrix::set_scale
void set_scale(float a_x, float a_y, float a_z)
Definition: matrix:93
tools::sg::back_area::color
sf_vec< colorf, float > color
Definition: back_area:33
tools::sg::plotter::transfer_todels
void transfer_todels(std::vector< node * > &a_to)
Definition: plotter:1667
tools::sg::plots::configure_grid_PAW
void configure_grid_PAW(unsigned int a_ww, unsigned int a_wh)
Definition: plots:639
tools::sg::plots::plotters
void plotters(std::vector< plotter * > &a_vec)
Definition: plots:510
tools::sg::plots::border_z
sf< float > border_z
Definition: plots:29
tools::sg::axis::title_style
text_style & title_style()
Definition: axis:335
tools::sg::plots::border_height
sf< float > border_height
Definition: plots:28
tools::sg::search_action::do_path
bool do_path() const
Definition: search_action:98
tools::sg::axis::ticks_style
sg::line_style & ticks_style()
Definition: axis:333
tools::sg::plots::top_margin
sf< float > top_margin
Definition: plots:36
tools::sg::search_action::path_pop
void path_pop()
Definition: search_action:91
tools::sg::plots::left_margin
sf< float > left_margin
Definition: plots:34
tools::sg::plotter::width
sf< float > width
Definition: plotter:58
tools::sg::plots::event
virtual void event(event_action &a_action)
Definition: plots:145
tools::sg::group::add
void add(node *a_node)
Definition: group:96
tools::sg::plots::current_to_one
void current_to_one()
Definition: plots:493
tools::sg::plots::extra::m_cols
unsigned int m_cols
Definition: plots:1198
tools::sg::plots::write
virtual bool write(write_action &a_action)
Definition: plots:150
tools::sg::plots::width
sf< float > width
Definition: plots:19
tools::sg::plots::m_old_rows
unsigned int m_old_rows
Definition: plots:1324
tools::sg::search_action
Definition: search_action:19
tools::sg::axis::tick_length
sf< float > tick_length
Definition: axis:44
tools::sg::back_area::height
sf< float > height
Definition: back_area:31
tools::sg::plots::render
virtual void render(render_action &a_action)
Definition: plots:122
tools_vforit
#define tools_vforit(a__T, a__v, a__it)
Definition: forit:13
tools::sg::render_action
Definition: render_action:24
tools::sg::plots::plotter_scale
sf< float > plotter_scale
Definition: plots:24
tools::sg::separator
Definition: separator:15
tools::sg::plots::last_extra_plotter
plotter * last_extra_plotter() const
Definition: plots:904
tools::sg::plots::extra::extra
extra(unsigned int a_cols, unsigned int a_rows, unsigned int a_index)
Definition: plots:1185
tools::sg::plots::m_origins
std::vector< vec2f > m_origins
Definition: plots:1326
tools::sg::back_area::border_visible
sf< bool > border_visible
Definition: back_area:38
tools::sg::_switch
Definition: _switch:15
tools::sg::plotter::title_box_style
text_style & title_box_style()
Definition: plotter:1711
tools::sg::plotter::title_style
text_style & title_style()
Definition: plotter:1705
tools
inlined C code : ///////////////////////////////////
Definition: aida_ntuple:26
tools::sg::event_action::done
bool done() const
Definition: event_action:50
tools::sg::plotter::transfer_primitives
void transfer_primitives(std::vector< plotprim * > &a_to)
Definition: plotter:1653
tools::sg::plots::copy_plotters
bool copy_plotters(const plots &a_from)
Definition: plots:995
tools::sg::node::add_field
void add_field(field *a_field)
Definition: node:128
tools::sg::plots::update_extras
void update_extras()
Definition: plots:1204
tools::sg::plotter::title_height
sf< float > title_height
Definition: plotter:71
tools::sg::matrix
Definition: matrix:19
tools::sg::plots::m_extras
std::vector< extra > m_extras
Definition: plots:1320
tools::sg::plotter::height
sf< float > height
Definition: plotter:59
tools::sg::plots::set_current_plotter
bool set_current_plotter(unsigned int a_index)
Definition: plots:348
tools::sg::plots::m_extras_origins
std::vector< vec2f > m_extras_origins
Definition: plots:1328
tools::sg::plots::extra::m_index
unsigned int m_index
Definition: plots:1200
tools::sg::plots::init_sg
void init_sg()
Definition: plots:910
tools::sg::plotter::top_margin
sf< float > top_margin
Definition: plotter:63
TOOLS_FIELD_DESC_NODE_CLASS
#define TOOLS_FIELD_DESC_NODE_CLASS(a__class)
Definition: field:68
tools::mat
Definition: mat:19
tools::sg::plots::set_current
bool set_current(plotter *a_plotter)
Definition: plots:356
tools::sg::plots::extra::operator=
extra & operator=(const extra &a_from)
Definition: plots:1190
tools::sg::back_area
Definition: back_area:19
tools::sg::plots::~plots
virtual ~plots()
Definition: plots:186
tools::sg::group::clear
void clear()
Definition: group:235
tools::sg::style::line_width
sf< float > line_width
Definition: style:25
tools::sg::noderef
Definition: noderef:14
tools::sg::plots::current_index
unsigned int current_index() const
Definition: plots:269
tools::sg::plotter::inner_frame_style
style & inner_frame_style()
Definition: plotter:1708
tools::sg::plots::plots
plots(const base_freetype &a_ttf)
Definition: plots:155
tools::sg::plots::node_desc_fields
virtual const desc_fields & node_desc_fields() const
Definition: plots:41
tools::sg::plots::m_extras_sizes
std::vector< vec2f > m_extras_sizes
Definition: plots:1329
tools::sg::plots::clear
void clear()
Definition: plots:291
tools::sg::bsf::value
T & value()
Definition: bsf:98
tools::sg::plots::configure_PAW
void configure_PAW(unsigned int a_ww, unsigned int a_wh)
Definition: plots:878
tools::sg::plots::m_ttf
const base_freetype & m_ttf
Definition: plots:1312
tools::sg::plots::update_if_touched
void update_if_touched()
Definition: plots:926
tools::sg::plots::update_border
void update_border()
Definition: plots:1075
tools::sg::plotter::depth
sf< float > depth
Definition: plotter:65
tools::sg::axis::line_style
sg::line_style & line_style()
Definition: axis:332
tools::sg::plots::set_grids_visibility
void set_grids_visibility(bool a_visible=false)
Definition: plots:581
tools::sg::plots::m_extras_sep
separator m_extras_sep
Definition: plots:1317
tools::sep
const std::string & sep()
Definition: sep:11
tools::sg::back_area::width
sf< float > width
Definition: back_area:30
tools::sg::axis::mag_style
text_style & mag_style()
Definition: axis:336
tools::sg::matrix::mul_scale
void mul_scale(float a_x, float a_y, float a_z)
Definition: matrix:104
tools_vforcit
#define tools_vforcit(a__T, a__v, a__it)
Definition: forit:7
tools::sg::plots::delete_extras
void delete_extras()
Definition: plots:889
tools::sg::plotter::add_plottable
void add_plottable(plottable *a_p)
Definition: plotter:1615
tools::sg::plots::border_width
sf< float > border_width
Definition: plots:27
tools::sg::plots::m_sizes
std::vector< vec2f > m_sizes
Definition: plots:1327
tools::sg::plotter::x_axis
const sg::axis & x_axis() const
Definition: plotter:1693
tools::sg::plotter::right_margin
sf< float > right_margin
Definition: plotter:61
tools::min_of
T min_of(const T &a, const T &b)
Definition: mnmx:17
tools::sg::draw_style::style
sf_enum< draw_type > style
Definition: draw_style:21
tools::sg::_switch::which
sf< int > which
Definition: _switch:18
tools::sg::plots::extra::extra
extra(const extra &a_from)
Definition: plots:1189
tools::uint32
unsigned int uint32
Definition: typedefs:71
tools::sg::plots::adjust_scales
void adjust_scales(float a_plotter_scale=1)
Definition: plots:592
tools::sg::plots::border_color
sf_vec< colorf, float > border_color
Definition: plots:31
tools::sg::plotter::grid_style
style & grid_style()
Definition: plotter:1709
tools::sg::plots::rows
sf< unsigned int > rows
Definition: plots:22
tools::sg::plots::number
unsigned int number() const
Definition: plots:268
tools::sg::plotter::bottom_margin
sf< float > bottom_margin
Definition: plotter:62
tools::sg::plots::clear_sg
void clear_sg()
Definition: plots:919
tools::sg::draw_lines
@ draw_lines
Definition: enums:192
tools::sg::vertices::add
void add(const VEC &a_v)
Definition: vertices:155
tools::sg::plots::vertical_spacing
sf< float > vertical_spacing
Definition: plots:39
tools::sg::sf< float >
tools::sg::plots::right_margin
sf< float > right_margin
Definition: plots:35
tools::sg::node::touch
void touch()
Definition: node:233
TOOLS_ARG_FIELD_DESC
#define TOOLS_ARG_FIELD_DESC(a__field)
Definition: field:71
tools::sg::plots::has_data
bool has_data()
Definition: plots:306
tools::sg::node::reset_touched
virtual void reset_touched()
Definition: node:102
tools::sg::plots::extra
Definition: plots:1183
_switch
tools::sg::plots::cols
sf< unsigned int > cols
Definition: plots:21
tools::sg::plots::create_plotter_border
static void create_plotter_border(_switch &a_parent, float a_w, float a_h)
Definition: plots:1031
tools::sg::vertices
Definition: vertices:22
tools::sg::plots::update_current_border
void update_current_border()
Definition: plots:1061