XyPlotter.cxx
Go to the documentation of this file.
1 
12 #ifdef _MSC_VER
13 #include "msdevstudio/MSconfig.h"
14 #endif
15 
16 #include "XyPlotter.h"
17 
18 #include "CompositePlotter.h"
19 
20 #include "axes/AxisModelBase.h"
21 #include "datareps/DataRep.h"
22 #include "datasrcs/NTuple.h"
23 #include "datasrcs/TupleCut.h"
24 
25 #include "graphics/ViewBase.h"
26 
29 #include "reps/AxisRep2D.h"
30 #include "reps/AxisRepColor.h"
31 #include "reps/RepBase.h"
32 
33 #include <cassert>
34 
35 #ifdef ITERATOR_MEMBER_DEFECT
36 using namespace std;
37 #else
38 using std::list;
39 using std::string;
40 using std::vector;
41 #endif
42 
43 using namespace hippodraw;
44 
45 XyPlotter::XyPlotter ( const std::string & name )
46  : PlotterBase ( name )
47 {
48  m_plotter = new CompositePlotter ();
49  m_plotters.push_back ( m_plotter );
50  m_axis_rep = new AxisRep2D ();
51  view_change_allowed = true;
52 
53  m_margin_top = 0.0;
54  m_margin_bottom = 0.0;
55  m_margin_left = 0.0;
56  m_margin_z = 0.0;
57 
58  m_hammer_shape.reserve(3);
59  m_hammer_shape.push_back(360);
60  m_hammer_shape.push_back(180);
61  m_hammer_shape.push_back(2);
62 
63 
64  m_lambert_shape.reserve(3);
65  m_lambert_shape.push_back(256);
66  m_lambert_shape.push_back(256);
67  m_lambert_shape.push_back(2);
68 
69  m_need_update = false;
70 }
71 
72 XyPlotter::XyPlotter ( const XyPlotter & plotter )
73  : PlotterBase ( plotter )
74 {
75  m_plotter = plotter.m_plotter -> clone ();
76  m_plotters.push_back ( m_plotter );
77  m_axis_rep = new AxisRep2D ();
78  m_plotter -> setAllAxisModels ();
79  view_change_allowed = true;
80 
81  m_margin_top = plotter.m_margin_top;
83  m_margin_left = plotter.m_margin_left;
84  m_margin_z = plotter.m_margin_z;
85 
88 
89  m_need_update = plotter.m_need_update;
90 }
91 
93 {
94  PlotterList_t ::iterator first = m_plotters.begin();
95  AxisModelBase * model = (*first) -> getAxisModel ( Axes::X );
96  while ( first != m_plotters.end () ) {
97  delete *first++;
98  }
99  delete model;
100  delete m_axis_rep;
101 }
102 
104 {
105  return new XyPlotter( *this );
106 }
107 
108 void
111 {
112  PlotterList_t::size_type size = m_plotters.size ();
113 
114  bool yes = false;
115  for ( PlotterList_t::size_type i = 0; i < size; i++ ) {
116  CompositePlotter * plotter = m_plotters [ i ];
117  bool y = plotter -> checkAutoScale ();
118  yes |= y;
119  }
120 
121  if ( yes ) {
122  CompositePlotter * plotter = m_plotters.front ();
123  AxisModelBase * model = plotter -> getAxisModel ( Axes::X );
124  model -> setEmpty ();
125  for ( PlotterList_t::size_type i = 0; i < size; i++ ) {
126  plotter = m_plotters [ i ];
127  plotter -> autoScale ( model, Axes::X );
128  plotter -> autoScale ( Axes::Y );
129  if ( plotter -> hasAxis ( Axes::Z ) &&
130  plotter -> isAutoRanging ( Axes::Z ) ) {
131  plotter -> autoScale ( Axes::Z );
132  }
133  plotter -> setAutoScaled ( true );
134  }
135  }
136 }
137 
138 void
141 {
142  checkAutoScale ();
143 
144  PlotterList_t::size_type size = m_plotters.size ();
145 
146  for ( PlotterList_t::size_type i = 0; i < size; i++ ) {
147  m_plotter = m_plotters [ i ];
148  m_plotter -> prepareToDraw ();
149  }
150 }
151 
153 {
154  // m_need_update is set by inspector. update the draw rect of the view.
155  if (m_need_update) {
156  view->updateDrawRect();
157  m_need_update = false;
158  }
159 
160  // Draw values before drawing axis.
161  drawProjValues ( view );
162 
163  m_axis_rep->beginPlot ( *view );
164  bool do_y = m_plotters.size() == 1;
165  if ( m_active_index >= 0 ) do_y |= true;
166  m_user_rect = m_plotter -> calcUserRectangle ();
167  m_raw_rect = m_plotter -> calcRawRectangle();
168 
169  if ( getNumDataReps () != 0 ) {
170  /* Draws last because it uses a larger font. */
171  m_axis_rep->drawTitle( *view, ( m_title == "%t" ) ?
172  getTitle () : m_title );
173 
174  }
175  m_plotter -> drawAxisRep ( m_axis_rep, view, do_y, true );
176 
177 
178 }
179 
180 void
183 {
184  TransformBase * transform = getTransform ();
185 
186  m_axis_rep->drawCrossHairs ( m_crossX, m_crossY, *transform, *view );
187 }
188 
189 NTuple *
191 createNTuple () const
192 {
193  NTuple * ntuple = m_plotter -> createNTuple ();
194 
195  const string & label_x = getLabel ( Axes::X );
196  ntuple -> setLabelAt ( label_x, 0 );
197  if ( m_plotter -> hasAxis ( Axes::Z ) ) {
198  const string & label_y = getLabel ( Axes::Y );
199  ntuple -> setLabelAt ( label_y, 1 );
200  const string & label_z = getLabel ( Axes::Z );
201  ntuple -> setLabelAt ( label_z, 2 );
202  }
203  else {
204  ProjectorBase * projector = activeProjector ();
205  const string & label_y = projector -> getYLabel ( true );
206  ntuple -> setLabelAt ( label_y, 1 );
207  }
208  return ntuple;
209 }
210 
211 bool
213 wantsPixmap ( ) const
214 {
215  return m_plotter -> hasAxis ( Axes::Z );
216 }
217 
218 void
220 setEnableZ ( bool yes )
221 {
222  m_plotter -> setEnableZ ( yes );
223 
224  assert ( m_axis_rep );
225  delete m_axis_rep;
226  m_axis_rep = new AxisRepColor ();
227 }
228 
229 void
232 {
233  if( axes == hippodraw::Axes::X )
234  m_axis_rep -> setXLabelFont( font );
235  else if( axes == hippodraw::Axes::Y )
236  m_axis_rep -> setYLabelFont( font );
237  else if( axes == hippodraw::Axes::Z )
238  m_axis_rep -> setZLabelFont( font );
239 }
240 
241 FontBase*
244 {
245  if( axes == hippodraw::Axes::X )
246  return m_axis_rep -> xLabelFont();
247  else if( axes == hippodraw::Axes::Y )
248  return m_axis_rep -> yLabelFont();
249  else if( axes == hippodraw::Axes::Z )
250  return m_axis_rep -> zLabelFont();
251 
252  return 0;
253 }
254 
255 
256 void
259 {
260  m_axis_rep -> setTitleFont( font );
261 }
262 
263 
264 const FontBase *
266 titleFont( ) const
267 {
268  return m_axis_rep -> titleFont();
269 }
270 
271 void
273 setActivePlot ( int index, bool redraw )
274 {
276  bool done = false;
277  PlotterList_t::iterator first = m_plotters.begin();
278  while ( first != m_plotters.end () ) {
279  CompositePlotter * plotter = *first++;
280  if ( index < 0 ) {
281  plotter -> setActivePlot ( -1, redraw );
282  continue;
283  }
284  else {
285  int num = plotter -> getNumDataReps ();
286  if ( index < num &&
287  done == false ) {
288  plotter -> setActivePlot ( index, redraw );
289  m_plotter = plotter;
290  done = true;
291  }
292  else {
293  plotter -> setActivePlot ( -2, redraw );
294  index -= num;
295  }
296  }
297  }
298 
299 }
300 
301 int
304 {
305  return m_active_index;
306 }
307 
308 void
311 {
312  m_plotter -> addDataRep ( rep );
313  rep -> addObserver ( this );
314 
315  unsigned int number = m_plotter -> getNumDataReps ();
316  if ( number == 1 ) {
317  m_active_index = 0;
318  }
319  else {
320  m_active_index = -1;
321  }
322  autoScale ();
323 
324  notifyObservers ();
325 }
326 
327 void
330 {
331  m_plotter = new CompositePlotter ();
332  m_plotters.push_back ( m_plotter );
333  addDataRep ( rep );
334 
335  CompositePlotter * plotter = m_plotters.front ();
336  AxisModelBase * model = plotter -> getAxisModel ( Axes::X );
337  m_plotter -> setAxisModel ( model, Axes::X );
338 
339  m_active_index = -1;
340 
341  setAutoRanging ( true );
342  autoScale ();
343 
344  notifyObservers ();
345 }
346 
347 void
350 {
351  PlotterList_t::iterator ip = m_plotters.begin();
352  while ( ip != m_plotters.end() ) {
353  CompositePlotter * plotter = *ip;
354  plotter -> removeDataRep ( rep ); // does nothing if not there
355  int number = plotter -> getNumDataReps ();
356  if ( number == 0 ) {
357  delete *ip;
358  m_plotters.erase ( ip );
359  break;
360  }
361  ip++;
362  }
363  notifyObservers ();
364 }
365 
366 void
369 {
370  m_plotter -> autoScale ();
371  notifyObservers ();
372 }
373 
374 void
377 {
378  m_plotter -> setValueRep ( rep );
379  notifyObservers ();
380 }
381 
382 void
384 setAutoRanging ( bool flag )
385 {
386  m_plotter -> setAutoRanging ( flag );
387  if ( flag == true ) notifyObservers ();
388 }
389 
390 void
392 setReverse ( bool flag )
393 {
394  m_plotter -> setReverse ( flag );
395  notifyObservers ();
396 }
397 
398 
399 void
402 {
403  m_plotter -> setAutoRanging ( axis, flag );
404  if ( flag == true ) notifyObservers ();
405 }
406 
407 void
410 {
411  for ( PlotterList_t::size_type i = 0; i < m_plotters.size(); i ++ ) {
412  CompositePlotter * plotter = m_plotters[i];
413  plotter -> setTransform ( transform );
414  }
415 
416  notifyObservers ();
417 }
418 
419 NTuple *
422 {
423  NTuple * ntuple = m_plotter -> createPickTuple ();
424 
425  string name ( "Pick table for " );
426  const string & title = getTitle ();
427  name += title;
428  ntuple -> setName ( name );
429  ntuple -> setTitle ( name );
430 
431  return ntuple;
432 }
433 
434 void
436 fillPickedPointFrom ( double mx, double my,
437  std::vector < double > & picked ) const
438 {
439  m_plotter -> fillPickedPoint ( mx, my, picked );
440 }
441 
442 void
445  int parm, bool dragging )
446 {
447  m_plotter -> setLowRange ( type, parm, dragging );
448  notifyObservers ();
449 }
450 
451 void
454  int parm, bool dragging )
455 {
456  m_plotter -> setHighRange ( type, parm, dragging );
457  notifyObservers ();
458 }
459 
460 void
463 {
464  m_plotter -> setScaling ( axis, on );
465  notifyObservers ();
466 }
467 
468 double
471 {
472  double ratio = m_aspect_ratio;
473  PlotterList_t::size_type size = m_plotters.size ();
474  if ( ratio == 0.0 ) {
475  for ( PlotterList_t::size_type i = 0; i < size; i++ ) {
476  CompositePlotter * plotter = m_plotters [ i ];
477  double r = plotter -> getAspectRatio ();
478 
479  if ( r != 0.0 ) {
480  ratio = r;
481  break;
482  }
483  }
484  }
485 
486  return ratio;
487 }
488 
489 void
492 {
493  m_plotter -> update ();
494 }
495 
496 void
499 {
500  m_plotter -> setRepresentation ( rep );
501 }
502 
503 RepBase *
506 {
507  return m_plotter -> representation ();
508 }
509 
513 {
514  return m_plotter -> getAxisModel ( axis );
515 }
516 
517 void
520 {
521  m_plotter -> setAxisModel ( model, axis );
522 }
523 
524 void
527 {
528  m_plotter -> setErrorDisplay ( axis, yes );
529 }
530 
531 bool
534 {
535  return m_plotter -> errorDisplay ( axis );
536 }
537 
538 void
540 setRepColor ( const Color & color )
541 {
542  m_plotter -> setRepColor ( color );
543 }
544 
545 const Color &
547 repColor () const
548 {
549  int index = activePlotIndex ();
550  if ( index < 0 ) index = 0;
551  DataRep * rep = getDataRep ( index );
552 
553  return rep -> getRepColor ();
554 }
555 
556 void
559 {
560  PlotterList_t::iterator first = m_plotters.begin();
561 
562  while ( first != m_plotters.end () ) {
563  m_plotter = *first++;
564  m_user_rect = m_plotter -> calcUserRectangle ( );
565  m_raw_rect = m_plotter -> calcRawRectangle();
566  m_plotter -> drawProjValues ( view );
567  }
568 }
569 
570 bool
573 {
574  return m_plotter -> hasAutoScaled ();
575 }
576 
577 bool
579 hasZoomY () const
580 {
581  bool retVal = true;
582 
583  for ( unsigned int i = 0; i < m_plotters.size () ; i++ )
584  {
585  retVal = retVal &= ( m_plotters[i] -> hasZoomY () );
586  }
587  return retVal != 0;
588 }
589 
590 bool
593 {
594  return m_plotter -> hasNTupleBindings ();
595 }
596 
597 void
600 {
602 }
603 
606 getProjector ( int i ) const
607 {
608  const DataRep * rep = getDataRep ( i );
609 
610  return rep -> getProjector ();
611 }
612 
616 {
617  return m_plotter -> activeProjector ();
618 }
619 
620 DataRep *
622 getDataRep ( int index ) const
623 {
624  DataRep * rep = 0;
625  PlotterList_t::const_iterator first = m_plotters.begin ();
626  while ( first != m_plotters.end () ) {
627  CompositePlotter * plotter = *first++;
628  int num = plotter -> getNumDataReps ();
629  if ( index < num ) {
630  rep = plotter -> getDataRep ( index );
631  break;
632  }
633  index -= num;
634  }
635 
636  return rep;
637 }
638 
639 DataRep *
641 getTarget () const
642 {
643  DataRep * rep = 0;
644 
645  if ( m_active_index >= 0 ) {
646  rep = getDataRep ( m_active_index );
647  }
648  else {
649  PlotterList_t::const_iterator first = m_plotters.begin();
650  while ( first != m_plotters.end() ) {
651  const CompositePlotter * plotter = *first++;
652  int number = plotter -> getNumDataReps ();
653  for ( int i = 0; i < number; i++ ) {
654  DataRep * r = plotter -> getDataRep ( i );
655  if ( r -> isTargetable () ) {
656  rep = r;
657  break;
658  }
659  }
660  if ( rep != 0 ) break;
661  }
662  }
663 
664  return rep;
665 }
666 
667 int
670 {
671  int number = 0;
672  PlotterList_t::const_iterator first = m_plotters.begin();
673 
674  while ( first != m_plotters.end() ) {
675  CompositePlotter * plotter = *first++;
676  number += plotter -> getNumDataReps ();
677  }
678 
679  return number;
680 }
681 
682 bool
684 isTargetable () const
685 {
686  bool yes = false;
687 
688  if ( m_active_index >= 0 ) {
689  const DataRep * rep = getDataRep ( m_active_index );
690  assert ( rep != 0 );
691  yes = rep -> isTargetable ();
692  }
693  else {
694  int count = 0;
695  PlotterList_t::const_iterator first = m_plotters.begin();
696  while ( first != m_plotters.end() ) {
697  const CompositePlotter * plotter = *first++;
698  int number = plotter -> getNumDataReps ();
699  for ( int i = 0; i < number; i++ ) {
700  const DataRep * rep = plotter -> getDataRep ( i );
701  if ( rep != 0 && rep -> isTargetable () ) count++;
702  }
703  }
704  yes = count == 1;
705  }
706 
707  return yes;
708 }
709 
710 int
712 indexOf ( const DataRep * rep ) const
713 {
714  int index = 0;
715  PlotterList_t::const_iterator first = m_plotters.begin ();
716  while ( first != m_plotters.end () ) {
717  const CompositePlotter * plotter = *first++;
718  int num = plotter -> getNumDataReps ();
719  int i = plotter -> indexOf ( rep );
720  if ( i >= 0 ) {
721  index += i;
722  break;
723  }
724  index += num;
725  }
726 
727  return index;
728 }
729 
730 double
733 {
734  return m_plotter -> getBinWidth ( axis );
735 }
736 
737 void
739 setBinWidth ( hippodraw::Axes::Type axis, double width )
740 {
741  int index = activePlotIndex ();
742 
743  if ( index < 0 ) {
744  PlotterList_t::iterator first = m_plotters.begin ();
745  while ( first != m_plotters.end () ) {
746  CompositePlotter * plotter = *first++;
747  plotter -> setBinWidth ( axis, width );
748  }
749  }
750  else {
751  Range cur_range = getRange (axis, false );
752  DataRep * rep = getDataRep ( index );
753  const Range & range = rep -> setBinWidth ( axis, width );
754  cur_range.setUnion ( range );
755  setRange ( axis, cur_range, false, false );
756  }
757 }
758 
759 void
761 reset ( )
762 {
763  m_plotter -> reset ( );
764 }
765 
766 const Range &
768 getRange ( hippodraw::Axes::Type axis, bool scaled ) const
769 {
770  return m_plotter -> getRange ( axis, scaled );
771 }
772 
773 void
775 setRange ( hippodraw::Axes::Type axis, const Range & range,
776  bool scaled, bool adjust_width )
777 {
778  m_plotter -> setRange ( axis, range, scaled, adjust_width );
779 }
780 
781 double
784 {
785  return m_plotter -> getOffset ( axis );
786 }
787 
790 getTransform () const
791 {
792  return m_plotter -> getTransform ();
793 }
794 
795 void
797 addValues ( const std::vector < double > & v )
798 {
799  m_plotter -> addValues ( v );
800 }
801 
802 const string &
805 {
806  return m_plotter -> getInternalLabel ( axis );
807 }
808 
809 const string &
812 {
813  return m_plotter -> getLabel ( axis );
814 }
815 
816 void
818 setLabel ( hippodraw::Axes::Type axis, const std::string & value )
819 {
820  m_plotter -> setLabel ( axis, value );
821  notifyObservers ();
822 }
823 
824 int
827 {
828  return m_plotter -> getNumberOfEntries ();
829 }
830 
831 double
834 {
835  return m_plotter -> getPosRange ( axis );
836 }
837 
838 bool
841 {
842  bool yes = false;
843  PlotterList_t::const_iterator first = m_plotters.begin ();
844 
845  while ( first != m_plotters.end () ) {
846  CompositePlotter * plotter = *first++;
847  yes |= plotter -> hasAxis ( axis );
848  }
849 
850  return yes;
851 }
852 
853 const BinToColor *
855 getValueRep () const
856 {
857  return m_plotter -> getValueRep ();
858 }
859 
860 bool
863 {
864  return m_plotter -> isAutoRanging ( axis );
865 }
866 
867 bool
869 isReverse ( ) const
870 {
871  return m_plotter -> isReverse ( );
872 }
873 
874 
875 void
878 {
879  m_plotter -> matrixTranspose ( yes );
880 }
881 
882 DataRep *
885 {
886  return m_plotter -> selectedDataRep ();
887 }
888 
889 void
892 {
893  m_plotter -> setAutoTicks ( axis, yes );
894 }
895 
896 void
898 setTicks ( hippodraw::Axes::Type axis, const std::vector < AxisTick > & ticks )
899 {
900  m_plotter -> setTicks ( axis, ticks );
901 }
902 
903 void
905 setNumberOfBins ( hippodraw::Axes::Type axis, unsigned int number )
906 {
907  m_plotter -> setNumberOfBins ( axis, number );
908 }
909 
910 void
912 setOffset ( hippodraw::Axes::Type axis, double offset )
913 {
914  m_plotter -> setOffset ( axis, offset );
915 }
916 
917 void
919 fillCutList ( std::vector < const TupleCut * > & cuts ) const
920 {
921  PlotterList_t::const_iterator first = m_plotters.begin();
922  while ( first != m_plotters.end () ) {
923  const CompositePlotter * plotter = *first++;
924  plotter -> fillCutList ( cuts );
925  }
926 }
927 
928 TupleCut *
930 getCutAt ( unsigned int i )
931 {
932  vector < const TupleCut * > cuts;
933  fillCutList ( cuts );
934  TupleCut * cut = const_cast < TupleCut * > ( cuts[i] );
935 
936  return cut;
937 }
938 
939 void
941 setCutRangeAt ( const Range & range, unsigned int i )
942 {
943  TupleCut * cut = getCutAt ( i );
944  cut -> setRange ( range );
945 
946  DataRep * rep = getDataRep ( 0 );
947  rep -> setDirty ();
948 
949  notifyObservers ();
950 }
951 
952 Range
955 {
956  TupleCut * cut = getCutAt ( 0 );
957  Range range = cut -> getRange ();
958 
959  return range;
960 }
961 
962 
963 
964 
965 void
967 setCutInverted ( unsigned int i, bool yes )
968 {
969  TupleCut * cut = getCutAt ( i );
970  cut -> setInversion ( yes );
971 
972  DataRep * rep = getDataRep ( 0 );
973  rep -> setDirty ();
974 
975  notifyObservers ();
976 }
977 
978 void
980 setCutEnabled ( unsigned int i, bool yes )
981 {
982  TupleCut * cut = getCutAt ( i );
983  cut -> setEnabled ( yes );
984  DataRep * rep = getDataRep ( 0 );
985  rep -> setDirty ();
986 
987  notifyObservers ();
988 }
989 
990 
991 const std::vector <double> &
994 {
995  TransformBase * transform = getTransform ();
996  ProjectorBase * proj = activeProjector ();
997 
998  const BinaryTransform * bt
999  = dynamic_cast <const BinaryTransform *> ( transform );
1000 
1001  if ( bt->isPeriodic() )
1002  {
1003  return ( proj -> getZAfterTransform (transform) );
1004  }
1005  else
1006  {
1007  return ( proj -> getZValues() );
1008  }
1009 
1010 }
1011 
1012 
1013 
1014 const std::vector < unsigned int > &
1017 {
1018  TransformBase * transform = getTransform ();
1019  ProjectorBase * proj = activeProjector ();
1020 
1021  const BinaryTransform * bt
1022  = dynamic_cast < const BinaryTransform * > ( transform );
1023 
1024  // Hammer or lambert
1025  if ( bt -> isPeriodic() )
1026  {
1027  if ( bt->aspectRatio() == 1.0 ) return m_lambert_shape;
1028  else return m_hammer_shape;
1029  }
1030  else
1031  {
1032  return ( proj -> getShape() );
1033  }
1034 }
1035 
1037 {
1038  TupleCut * cut = getCutAt ( 0 );
1039  return cut-> getInversion ();
1040 }
1041 
1042 void XyPlotter::setBoxEdge(bool flag)
1043 {
1044  m_plotter -> setBoxEdge(flag);
1045  notifyObservers ();
1046 }
1047 
1049 {
1050  return m_plotter->getBoxEdge();
1051 }
1052 
1053 
1054 void XyPlotter::setShowGrid( bool flag )
1055 {
1056  m_plotter -> setShowGrid ( flag );
1057  notifyObservers ();
1058 }
1059 
1061 {
1062  return m_plotter -> getShowGrid ();
1063 }
1064 
1065 
1066 void
1068 setFitsTransform ( const std::string & transform )
1069 {
1070  m_plotter -> setFitsTransform ( transform );
1071 }
1072 
1073 TransformBase *
1076 {
1077  return m_plotter -> getFitsTransform ();
1078 }
1079 
1080 void
1082 setMinEntries ( int entries )
1083 {
1084  m_plotter -> setMinEntries(entries);
1085 }
1086 
1087 int
1090 {
1091  return m_plotter -> getMinEntries ();
1092 }
1093 
1094 void
1096 setNeedUpdate( bool isChanged )
1097 {
1098  m_need_update = isChanged;
1099 }
1100 
1101 bool
1104 {
1105  bool yes = false;
1106  if ( m_plotters.size() == 1 ) {
1107  yes = m_plotters.front() -> isImageConvertable ();
1108  }
1109 
1110  return yes;
1111 }
1112 
1113 void
1115 setTopMargin( double top )
1116 {
1117  m_margin_top=top;
1118 }
1119 
1120 void
1122 setZMargin( double z )
1123 {
1124  m_margin_z = z;
1125 }
1126 
1127 void
1129 setBottomMargin(double bottom)
1130 {
1131  m_margin_bottom=bottom;
1132 }
1133 
1134 void
1136 setLeftMargin(double left)
1137 {
1138  m_margin_left=left;
1139 }
1140 
1141 double
1144 {
1145  return m_margin_top;
1146 }
1147 
1148 double
1151 {
1152  return m_margin_z;
1153 }
1154 
1155 
1156 double
1159 {
1160  return m_margin_bottom;
1161 }
1162 
1163 double
1166 {
1167  return m_margin_left;
1168 }
1169 
1170 void
1172 setScaleFactor ( hippodraw::Axes::Type axis, double factor )
1173 {
1174  m_plotter -> setScaleFactor ( axis, factor );
1175 }
1176 
1177 double
1180 {
1181  return m_plotter -> getScaleFactor ( axis );
1182 }
1183 
1184 bool
1187 {
1188  return m_plotter -> isAxisScaled ( axis );
1189 }
void checkAutoScale()
Checks if auto scaling is required and does an auto scale on contained plotters as needed...
Definition: XyPlotter.cxx:110
The class for the 2D axes drawing.
Definition: AxisRep2D.h:39
virtual int getNumberOfEntries() const
Returns the number of entries in the contained DataRep.
Definition: XyPlotter.cxx:826
virtual void removeDataRep(DataRep *rep)
Removes the DataRep object from the plotter.
Definition: XyPlotter.cxx:349
unsigned int i
A Plotter class that plots points in 2 dimensions and option a third dimension in color...
Definition: XyPlotter.h:44
virtual void drawCrossHairs(ViewBase *view)
Draws cross-hairs.
Definition: XyPlotter.cxx:182
virtual void setAutoTicks(Axes::Type axis, bool yes)
Sets automatic generation of axis ticks.
Definition: XyPlotter.cxx:891
virtual const Range & getRange(Axes::Type axis, bool scaled) const
Returns the range on the specified axis.
Definition: XyPlotter.cxx:768
void setTitleFont(FontBase *font)
Set the font to be used to override the default while drawing title.
Definition: XyPlotter.cxx:258
virtual RepBase * representation() const
Returns the representation used by the plotter.
Definition: XyPlotter.cxx:505
virtual bool errorDisplay(Axes::Type axis) const
Returns the state of error bar display on specified axis.
Definition: XyPlotter.cxx:533
virtual void notifyObservers() const
Notifies Observer objects of a change.
Definition: Observable.cxx:93
void fillCutList(std::vector< const TupleCut * > &cuts) const
Fills the cuts vector with the TupleCuts contained by the DataRep objects.
Definition: XyPlotter.cxx:919
virtual void drawIn(ViewBase *view)
Starts the drawing in view view.
Definition: XyPlotter.cxx:152
virtual FontBase * labelFont(Axes::Type axes) const
What font is being used to override the default while drawing axis label.
Definition: XyPlotter.cxx:243
virtual bool wantsPixmap() const
Returns true.
Definition: XyPlotter.cxx:213
A transform that transforms coordinates from one coordinate system to another.
Definition: TransformBase.h:35
XyPlotter(const std::string &name="XyPlotter")
The default constructor.
Definition: XyPlotter.cxx:45
virtual void setLeftMargin(double left)
Definition: XyPlotter.cxx:1136
virtual bool getShowGrid()
Gets the show-grid flag to update Inspector.
Definition: XyPlotter.cxx:1060
virtual int activePlotIndex() const
Returns the index of the active DataRep object.
Definition: XyPlotter.cxx:303
virtual TransformBase * getFitsTransform() const
Returns the fits transform object.
Definition: XyPlotter.cxx:1075
The base class for the value to the color transformation.
Definition: BinToColor.h:30
virtual void setBinWidth(Axes::Type axis, double width)
Sets the bin width.
Definition: XyPlotter.cxx:739
PlotterBase * clone()
The clone function returns an object of its own kind which is a copy of this object at this moment...
Definition: XyPlotter.cxx:103
Rect m_raw_rect
The raw rectangle before transform.
Definition: PlotterBase.h:102
virtual bool hasAxis(Axes::Type axis) const
Returns true if the plotter has an axis of specified type.
Definition: XyPlotter.cxx:840
hippodraw::PeriodicBinaryTransform class interface
virtual void setCutRangeAt(const Range &range, unsigned int i)
Sets the Range of the TupleCut object indexed by i.
Definition: XyPlotter.cxx:941
double m_margin_bottom
Definition: XyPlotter.h:50
virtual void setRange(Axes::Type axis, const Range &range, bool scaled=false, bool adjust_width=true)
Sets the range on the specified axis.
Definition: XyPlotter.cxx:775
void setLabelFont(FontBase *font, Axes::Type axes)
Set the font to be used to override the default while drawing axis label.
Definition: XyPlotter.cxx:231
void setTitle(const std::string &title)
Sets the title to be displayed.
void beginPlot(ViewBase &view)
Every class which draws has its beginPlot function.
hippodraw::DataRep class interface.
virtual void drawTitle(ViewBase &view, const std::string &title)
Draws the title.
virtual const std::string & getLabel(Axes::Type) const
Returns the label for the specified axis.
Definition: XyPlotter.cxx:811
virtual DataRep * selectedDataRep() const
Returns the selected DataRep.
Definition: XyPlotter.cxx:884
AxisRepBase * m_axis_rep
The axes model graphical representation.
Definition: XyPlotter.h:104
virtual void setRepresentation(RepBase *pointrep)
Sets the representation.
Definition: XyPlotter.cxx:498
virtual void setScaling(Axes::Type axis, bool on=true)
Sets the scaling attribute of the AxisModelBase object.
Definition: XyPlotter.cxx:462
virtual double getZMargin()
Definition: XyPlotter.cxx:1150
virtual NTuple * createNTuple() const
Creates an DataSource representation of the plotted data.
Definition: XyPlotter.cxx:191
virtual bool getCutInversion()
Get the inversion state of the cut.
Definition: XyPlotter.cxx:1036
The class expresses a cut on a DataSource, i.e.
Definition: TupleCut.h:43
virtual double getAspectRatio() const
Returns the aspect ratio.
Definition: XyPlotter.cxx:470
virtual void setTicks(Axes::Type axis, const std::vector< AxisTick > &ticks)
Sets the ticks for the specified axis.
Definition: XyPlotter.cxx:898
virtual bool getBoxEdge()
Gets the box edge flag to update Inspector.
Definition: XyPlotter.cxx:1048
virtual double getLeftMargin()
Definition: XyPlotter.cxx:1165
return rep
Definition: Inspector.cxx:3843
virtual double getPosRange(Axes::Type axis) const
Returns the smallest positive number from the data.
Definition: XyPlotter.cxx:833
std::vector< unsigned int > m_hammer_shape
Default shape for XyPlotter is 360*180 or 256*256.
Definition: XyPlotter.h:76
virtual void update()
Updates the plotter.
Definition: XyPlotter.cxx:491
virtual Range getCutRange()
Gets the object of current XyPlotter is a TupleCut object, get the range of it.
Definition: XyPlotter.cxx:954
virtual ProjectorBase * activeProjector() const
Returns the active projector.
Definition: XyPlotter.cxx:615
const std::vector< double > & getZValues()
Returns all Z values.
Definition: XyPlotter.cxx:993
std::vector< unsigned int > m_lambert_shape
Definition: XyPlotter.h:77
virtual void drawCrossHairs(double x, double y, TransformBase &transform, ViewBase &view)
Draws the cross hairs after transformation.
double m_margin_top
Additional margin set by user in the plotter.
Definition: XyPlotter.h:49
const std::string & getTitle() const
Gets the title to be displayed.
bool m_need_update
Flag to indicat that the drawrect and marginrect need to be updated.
Definition: XyPlotter.h:92
virtual DataRep * getTarget() const
Returns the selected DataRep.
Definition: XyPlotter.cxx:641
return yes
Definition: CanvasView.cxx:883
A abstract base class for font handling.
Definition: FontBase.h:32
A Color class for creating the color object following the standard RGB color space.
Definition: Color.h:37
virtual TransformBase * getTransform() const
Returns the transform object used by the plotter.
Definition: XyPlotter.cxx:790
virtual void matrixTranspose(bool yes)
Transpose the X and Y axis of matrix representation.
Definition: XyPlotter.cxx:877
The class for the 2D axes drawing with color.
Definition: AxisRepColor.h:38
virtual int indexOf(const DataRep *) const
Returns the index of the selected DataRep object.
Definition: XyPlotter.cxx:712
hippodraw::NTuple class interface.
virtual void setRepColor(const Color &)
Sets the representation&#39;s color.
Definition: XyPlotter.cxx:540
The base class for the PlotterBase hierarchy.
Definition: PlotterBase.h:55
virtual double getBinWidth(Axes::Type) const
Returns the bins with of the target DataRep object.
Definition: XyPlotter.cxx:732
virtual void setLowRange(Axes::Type axis, int parm, bool dragging)
Sets the low end of the Range of data displayed.
Definition: XyPlotter.cxx:444
virtual void reset()
Resets the bins.
Definition: XyPlotter.cxx:761
bool hasAutoScaled() const
Returns true if the axes have already been auto-scaled.
Definition: XyPlotter.cxx:572
PyArray_TYPES type(numeric::array arr)
Definition: num_util.cpp:249
The base class for data representations.
Definition: DataRep.h:68
virtual void setAxisModel(AxisModelBase *, Axes::Type)
Sets the AxisModel on the specified axis.
Definition: XyPlotter.cxx:519
CompositePlotter * m_plotter
The currently active plotter that draws the data points.
Definition: XyPlotter.h:99
virtual AxisModelBase * getAxisModel(Axes::Type axis) const
Returns the AxisModelBase derived class for the specified axis.
Definition: XyPlotter.cxx:512
virtual void setNumberOfBins(Axes::Type axis, unsigned int number)
Sets the number of bins.
Definition: XyPlotter.cxx:905
virtual void setCutInverted(unsigned int i, bool yes=true)
Sets the TupleCut object indexed by i to be inverted.
Definition: XyPlotter.cxx:967
virtual void addValues(const std::vector< double > &v)
Adds data values to the plot.
Definition: XyPlotter.cxx:797
ViewBase * v
Definition: PlotTable.cxx:104
virtual const std::string & getInternalLabel(Axes::Type axis) const
Returns the internal label.
Definition: XyPlotter.cxx:804
virtual bool hasZoomY() const
Returns true if the plotter has zoom feature on the Y axis otherwise it returns false.
Definition: XyPlotter.cxx:579
virtual void setLabel(Axes::Type, const std::string &value)
Sets the label of the specified axis to value.
Definition: XyPlotter.cxx:818
intp size(numeric::array arr)
Definition: num_util.cpp:296
virtual void setFitsTransform(const std::string &)
Sets the fits transform object.
Definition: XyPlotter.cxx:1068
virtual void setTransform(TransformBase *)
Sets the transform object and redraws.
Definition: XyPlotter.cxx:409
The AxisModelBase class maintains the Range and scaling of an axis.
Definition: AxisModelBase.h:33
virtual double getTopMargin()
Definition: XyPlotter.cxx:1143
virtual void setShowGrid(bool flag)
Sets the show-grid flag to flag.
Definition: XyPlotter.cxx:1054
virtual void setCutEnabled(unsigned int i, bool yes=true)
Sets the TupleCut object index by i to be enabled.
Definition: XyPlotter.cxx:980
hippodraw::ProjectorBase class interface.
virtual void addDataRepStacked(DataRep *rep)
Adds the DataRep object to the plotter.
Definition: XyPlotter.cxx:329
hippodraw::CompositePlotter class interface
std::string m_title
The main label; the title of the plot.
Definition: PlotterBase.h:86
hippodraw::RepBase class interface
virtual bool isReverse() const
Returns true if reverse is enabled, otherwise returns false.
Definition: XyPlotter.cxx:869
const std::string & name() const
Returns the name of the plotter.
Definition: PlotterBase.cxx:83
virtual bool isAutoRanging(Axes::Type axis) const
Returns true if auto-ranging is enabled, otherwise returns false.
Definition: XyPlotter.cxx:862
double m_crossX
The x position of the cross hair.
Definition: PlotterBase.h:89
Rect m_user_rect
The abstract data space.
Definition: PlotterBase.h:98
const std::vector< unsigned int > & getShape()
Definition: XyPlotter.cxx:1016
A DataSource class implemented with std::vector&lt;double&gt; to store the column data. ...
Definition: NTuple.h:33
The base class for the Projector hierarchy.
Definition: ProjectorBase.h:56
virtual void setNeedUpdate(bool isChanged)
Set the m_need_update flag, called by inspector.
Definition: XyPlotter.cxx:1096
virtual const Color & repColor() const
Returns the color used for the representation.
Definition: XyPlotter.cxx:547
The abstract base class for views.
Definition: ViewBase.h:62
virtual void setActivePlot(int index, bool redraw)
Sets the active plot.
Definition: XyPlotter.cxx:273
hippodraw::AxisRepColor class interface
hippodraw::TupleCut class interface
virtual void setReverse(bool flag)
Sets the reverse status for the X axis to flag.
Definition: XyPlotter.cxx:392
virtual double getOffset(Axes::Type axis) const
Returns the offset on designated axis, similarly to getBinWidth.
Definition: XyPlotter.cxx:783
virtual void setHighRange(Axes::Type axis, int parm, bool dragging)
Sets the high end of the Range of data displayed.
Definition: XyPlotter.cxx:453
virtual void setTopMargin(double top)
Set and get additional margin on top,bottom,left of the plotter.
Definition: XyPlotter.cxx:1115
hippodraw::AxisModelBase class interface
double m_aspect_ratio
The aspect ratio.
Definition: PlotterBase.h:74
virtual const BinToColor * getValueRep() const
Returns the value to color representation.
Definition: XyPlotter.cxx:855
virtual void checkAxisScaling()
Check if Axis needs to be scaled or not.
Definition: XyPlotter.cxx:599
bool view_change_allowed
Flag to indicate if the view size of the plot can be changed.
Definition: XyPlotter.h:71
virtual void updateDrawRect()
Update the drawing Rectangle in the devices coordinate system.
Definition: ViewBase.cxx:105
A transform that transforms coordinates from one 2D coordinate system to another. ...
virtual void setZMargin(double z)
Definition: XyPlotter.cxx:1122
hippodraw::XyPlotter class interface
virtual void drawProjValues(ViewBase *view)
Draws the projected values.
Definition: XyPlotter.cxx:558
virtual bool isAxisScaled(Axes::Type axis) const
Returns true if specified axis is being scaled.
Definition: XyPlotter.cxx:1186
virtual void setValueRep(BinToColor *rep)
Sets the object that will do the value to color transform, if any.
Definition: XyPlotter.cxx:376
virtual ~XyPlotter()
The destructor.
Definition: XyPlotter.cxx:92
virtual void setBottomMargin(double bottom)
Definition: XyPlotter.cxx:1129
double m_crossY
The y position of the cross hair.
Definition: PlotterBase.h:92
virtual ProjectorBase * getProjector(int i) const
Returns the i-th projector.
Definition: XyPlotter.cxx:606
virtual int getMinEntries()
Get the minimum entries/bin.
Definition: XyPlotter.cxx:1089
virtual bool getBoxEdge()
Gets the box edge status to update the inspector.
virtual void setEnableZ(bool yes=true)
Sets the display of the Z axis on.
Definition: XyPlotter.cxx:220
void setUnion(const Range &range)
Forms the union with the range range.
Definition: Range.cxx:170
virtual const FontBase * titleFont() const
What font is being used to override the default while drawing title of plot.
Definition: XyPlotter.cxx:266
int m_active_index
Index to the active plotter.
Definition: XyPlotter.h:67
Expresses a range of values.
Definition: Range.h:33
return index
Definition: PickTable.cxx:182
virtual int getNumDataReps() const
Returns the number of DataRep objects contained by the plotter.
Definition: XyPlotter.cxx:669
virtual double getBottomMargin()
Definition: XyPlotter.cxx:1158
hippodraw::AxisRep2D class interface
virtual NTuple * createPickTuple()
Creates a NTuple for a PickTable.
Definition: XyPlotter.cxx:421
PlotterList_t m_plotters
The list of CompositePlotter objects contained by this plotter.
Definition: XyPlotter.h:63
virtual void setAutoRanging(bool flag)
Sets the auto-ranging status for all axes to flag.
Definition: XyPlotter.cxx:384
void prepareToDraw()
Prepares for drawing.
Definition: XyPlotter.cxx:140
virtual bool hasNTupleBindings() const
Returns true if the selected DataRep object has bindings to a DataSource, otherwise returns false...
Definition: XyPlotter.cxx:592
virtual void fillPickedPointFrom(double mx, double my, std::vector< double > &picked) const
Fills the picked data point.
Definition: XyPlotter.cxx:436
bool isTargetable() const
Returns true if receiving object is target-able.
Definition: XyPlotter.cxx:684
virtual void setMinEntries(int entries)
Set the minimum entries/bin.
Definition: XyPlotter.cxx:1082
TupleCut * getCutAt(unsigned int i)
Returns the TupleCut object at position i.
Definition: XyPlotter.cxx:930
virtual double aspectRatio() const
Returns the aspect ratio.
void addObserver(Observer *)
Adds an Observer to the Observer list.
Definition: Observable.cxx:52
virtual void setBoxEdge(bool flag)
Sets the box-edge flag to flag.
Definition: XyPlotter.cxx:1042
virtual void setOffset(Axes::Type axis, double offset)
Sets the offset.
Definition: XyPlotter.cxx:912
virtual bool isImageConvertable() const
Returns true if contents of the plotter is convertable to an image.
Definition: XyPlotter.cxx:1103
bool isPeriodic() const
Sets whether this transform is periodic.
hippodraw::ViewBase class interface
virtual DataRep * getDataRep(int index) const
Returns the DataRep object at index.
Definition: XyPlotter.cxx:622
virtual void setScaleFactor(Axes::Type axis, double factor)
Sets a scale factor on specified axis.
Definition: XyPlotter.cxx:1172
virtual double getScaleFactor(Axes::Type axis) const
Returns the scale factor on the specified axis.
Definition: XyPlotter.cxx:1179
Type
Axes constants.
Definition: AxesType.h:31
The base class for the point representation hierarchy.
Definition: RepBase.h:45
virtual void setErrorDisplay(Axes::Type axis, bool)
Sets the display of the error bars on or off.
Definition: XyPlotter.cxx:526
A class for containing one or more DataRep objects in a single composite plot.
virtual void autoScale()
Sets the Range on each axis that has the auto range flag set to include all the data.
Definition: XyPlotter.cxx:368
virtual void addDataRep(DataRep *rep)
Adds the DataRep object to the plotter.
Definition: XyPlotter.cxx:310

Generated for HippoDraw Class Library by doxygen