Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

XyPlotter.cxx

Go to the documentation of this file.
00001 
00012 #ifdef HAVE_CONFIG_H
00013 #include "config.h"
00014 #else
00015 #ifdef _MSC_VER
00016 #include "msdevstudio/MSconfig.h"
00017 #endif
00018 #endif
00019 
00020 #include "XyPlotter.h"
00021 
00022 #include "CompositePlotter.h"
00023 
00024 #include "axes/AxisModelBase.h"
00025 #include "datareps/DataRep.h"
00026 #include "datasrcs/NTuple.h"
00027 #include "datasrcs/TupleCut.h"
00028 
00029 #include "graphics/ViewBase.h"
00030 
00031 #include "projectors/ProjectorBase.h"
00032 #include "reps/AxisRep2D.h"
00033 #include "reps/AxisRepColor.h"
00034 #include "reps/RepBase.h"
00035 
00036 #include <cassert>
00037 
00038 using namespace hippodraw;
00039 
00040 #ifdef ITERATOR_MEMBER_DEFECT
00041 using namespace std;
00042 #else
00043 using std::list;
00044 using std::string;
00045 using std::vector;
00046 #endif
00047 
00048 XyPlotter::XyPlotter (  const std::string & name  )
00049   : PlotterBase ( name )
00050 {
00051   m_plotter = new CompositePlotter ();
00052   m_plotters.push_back ( m_plotter );
00053   m_axis_rep = new AxisRep2D ();
00054 }
00055 
00056 XyPlotter::XyPlotter ( const XyPlotter & plotter )
00057   : PlotterBase ( plotter )
00058 {
00059   m_plotter = plotter.m_plotter -> clone ();
00060   m_plotters.push_back ( m_plotter );
00061   m_axis_rep = new AxisRep2D ();
00062   m_plotter -> setAllAxisModels ();
00063 }
00064 
00065 XyPlotter::~XyPlotter()
00066 {
00067   PlotterList_t ::iterator first = m_plotters.begin();
00068   while ( first != m_plotters.end () ) {
00069     delete *first++;
00070   }
00071   delete m_axis_rep;
00072 }
00073 
00074 PlotterBase * XyPlotter::clone()
00075 {
00076   return new XyPlotter( *this );
00077 }
00078 
00079 void
00080 XyPlotter::
00081 checkAutoScale ()
00082 {
00083   PlotterList_t::size_type size = m_plotters.size ();
00084 
00085   bool yes = false;
00086   for ( PlotterList_t::size_type i = 0; i < size; i++ ) {
00087     CompositePlotter * plotter = m_plotters [ i ];
00088     bool y = plotter -> checkAutoScale ();
00089     yes |= y;
00090   }
00091 
00092   if ( yes ) {
00093     CompositePlotter * plotter = m_plotters.front ();
00094     AxisModelBase * model = plotter -> getAxisModel ( Axes::X );
00095     model -> setEmpty ();
00096     for ( PlotterList_t::size_type i = 0; i < size; i++ ) {
00097       plotter = m_plotters [ i ];
00098       plotter -> autoScale ( model, Axes::X );
00099       plotter -> autoScale ( Axes::Y );
00100       if ( plotter -> hasAxis ( Axes::Z ) &&
00101            plotter -> isAutoRanging ( Axes::Z ) ) {
00102         plotter -> autoScale ( Axes::Z );
00103       }
00104       plotter -> setAutoScaled (  true );
00105     }
00106   }
00107 }
00108 
00109 void
00110 XyPlotter::
00111 prepareMarginRect ( ViewBase * view )
00112 {
00113   const HippoRectangle draw = view->getDrawRect();
00114   float width = draw.getWidth();
00115   float height = draw.getHeight();
00116     
00117   float marginXMin = width / 5.0f;
00118   float marginXMax = width * 9.0 / 10.0;
00119   float marginYMin = height * 5.0 / 6.0;
00120   float marginYMax = height / 8.0;
00121 
00122   if ( hasAxis ( Axes::Z ) == true ) {
00123     // For the color bar.
00124     marginYMin -= ( marginYMin - marginYMax ) * 0.1; 
00125   }
00126 
00127   float marginWidth  = marginXMax - marginXMin + 1.0;
00128   float marginHeight = marginYMin - marginYMax + 1.0;
00129   
00130   double aspect_ratio = getAspectRatio ();
00131   view -> initPlot( aspect_ratio ); 
00132 
00133   if ( aspect_ratio > 0.0 ) {
00134     marginHeight = marginWidth / aspect_ratio;
00135   }
00136   
00137   m_margin_rect.setRect( marginXMin, height - marginYMin,
00138                          marginWidth, marginHeight ); // taken from C code
00139 
00140 }
00141 
00142 void
00143 XyPlotter::
00144 prepareToDraw ( )
00145 {
00146   PlotterList_t::size_type size = m_plotters.size ();
00147 
00148   for ( PlotterList_t::size_type i = 0; i < size; i++ ) {
00149     CompositePlotter * plotter = m_plotters [ i ];
00150     plotter -> prepareToDraw ();
00151   }
00152 
00153 }
00154 
00155 void XyPlotter::drawIn ( ViewBase * view )
00156 {
00157   checkAutoScale ();
00158   prepareToDraw ();
00159   prepareMarginRect ( view );
00160 
00161   drawProjValues ( view );
00162 
00163   m_axis_rep->beginPlot ( *view );
00164   bool do_y = m_plotters.size() == 1;
00165   if ( m_active_index >= 0 ) do_y |= true;
00166   m_user_rect = m_plotter -> calcUserRectangle ();
00167   calcAxisRatios ( m_plotter );
00168   m_plotter -> drawAxisRep ( m_axis_rep, view, do_y, true );
00169 
00170   /* Draws last because it uses a larger font. */
00171   m_axis_rep->drawTitle( *view, ( m_title == "%t" ) ?
00172                          getTitle () : m_title );
00173 }
00174 
00175 void
00176 XyPlotter::
00177 drawCrossHairs ( ViewBase * view )
00178 {
00179   TransformBase * transform = getTransform ();
00180 
00181   m_axis_rep->drawCrossHairs ( m_crossX, m_crossY, *transform, *view );
00182 }
00183 
00184 float XyPlotter::userToMarginColor ( double c ) const
00185 {
00186   return m_margin_rect.getX () + ( c - m_user_rect.getZ () ) * m_z_ratio;
00187 }
00188 
00189 NTuple *
00190 XyPlotter::
00191 createNTuple () const
00192 {
00193   NTuple * ntuple = m_plotter -> createNTuple ();
00194 
00195   const string & label_x = getLabel ( Axes::X );
00196   ntuple -> setLabelAt ( label_x, 0 );
00197   if ( m_plotter -> hasAxis ( Axes::Z ) ) {
00198     const string & label_y = getLabel ( Axes::Y );
00199     ntuple -> setLabelAt ( label_y, 1 );
00200     const string & label_z = getLabel ( Axes::Z );
00201     ntuple -> setLabelAt ( label_z, 2 );
00202   }
00203   else {
00204     ProjectorBase * projector = activeProjector ();
00205     const string & label_y = projector -> getYLabel ( true );
00206     ntuple -> setLabelAt ( label_y, 1 );
00207   }
00208   return ntuple;
00209 }
00210 
00211 bool
00212 XyPlotter::
00213 wantsPixmap ( ) const
00214 {
00215   return m_plotter -> hasAxis ( Axes::Z );
00216 }
00217 
00218 void
00219 XyPlotter::
00220 setEnableZ ( bool yes )
00221 {
00222   m_plotter -> setEnableZ ( yes );
00223 
00224   assert ( m_axis_rep );
00225   delete m_axis_rep;
00226   m_axis_rep = new AxisRepColor ();
00227 }
00228 
00229 void
00230 XyPlotter::
00231 setLabelFont ( FontBase* font, hippodraw::Axes::Type axes )
00232 {
00233   if( axes == hippodraw::Axes::X )
00234     m_axis_rep -> setXLabelFont( font );
00235   else if( axes == hippodraw::Axes::Y )
00236     m_axis_rep -> setYLabelFont( font );
00237   else if( axes == hippodraw::Axes::Z )
00238     m_axis_rep -> setZLabelFont( font );
00239 }
00240 
00241 FontBase*
00242 XyPlotter::
00243 labelFont ( hippodraw::Axes::Type axes ) const
00244 {
00245   if( axes == hippodraw::Axes::X )
00246     return m_axis_rep -> xLabelFont();
00247   else if( axes == hippodraw::Axes::Y )
00248     return m_axis_rep -> yLabelFont();
00249   else if( axes == hippodraw::Axes::Z )
00250     return m_axis_rep -> zLabelFont();
00251 
00252   return 0;
00253 }
00254 
00255 
00256 void
00257 XyPlotter::
00258 setTitleFont( FontBase* font )
00259 {
00260   m_axis_rep -> setTitleFont( font );
00261 }
00262         
00263 
00264 const FontBase *
00265 XyPlotter::
00266 titleFont( ) const
00267 {
00268   return m_axis_rep -> titleFont();
00269 }
00270 
00271 void
00272 XyPlotter::
00273 setActivePlot ( int index, bool redraw )
00274 {
00275   m_active_index = index;
00276   bool done = false;
00277   PlotterList_t::iterator first = m_plotters.begin();
00278   while ( first != m_plotters.end () ) {
00279     CompositePlotter * plotter = *first++;
00280     if ( index < 0 ) {
00281       plotter -> setActivePlot ( -1, redraw );
00282       continue;
00283     }
00284     else {
00285       int num = plotter -> getNumDataReps ();
00286       if ( index < num && 
00287            done == false ) {
00288         plotter -> setActivePlot ( index, redraw );
00289         m_plotter = plotter;
00290         done = true;
00291       }
00292       else {
00293         plotter -> setActivePlot ( -2, redraw );
00294         index -= num;
00295       }
00296     }
00297   }
00298 
00299 }
00300 
00301 int
00302 XyPlotter::
00303 activePlotIndex () const
00304 {
00305   return m_active_index;
00306 }
00307 
00308 void
00309 XyPlotter::
00310 addDataRep ( DataRep * rep )
00311 {
00312   m_plotter -> addDataRep ( rep );
00313   rep -> addObserver ( this );
00314 
00315   int number = m_plotter -> getNumDataReps ();
00316   if ( number == 1 ) m_active_index = 0;
00317   else m_active_index = -1;
00318 
00319   notifyObservers ();
00320 }
00321 
00322 void
00323 XyPlotter::
00324 addDataRepStacked ( DataRep * rep )
00325 {
00326   m_plotter = new CompositePlotter ();
00327   m_plotters.push_back ( m_plotter );
00328   addDataRep ( rep );
00329 
00330   CompositePlotter * plotter = m_plotters.front ();
00331   AxisModelBase * model = plotter -> getAxisModel ( Axes::X );
00332   m_plotter -> setAxisModel ( model, Axes::X );
00333 
00334   m_active_index = -1;
00335 
00336   notifyObservers ();
00337 }
00338 
00339 void
00340 XyPlotter::
00341 removeDataRep ( DataRep * rep )
00342 {
00343   m_plotter -> removeDataRep ( rep );
00344   notifyObservers ();
00345 }
00346 
00347 void
00348 XyPlotter::
00349 autoScale ()
00350 {
00351   m_plotter -> autoScale ();
00352   notifyObservers ();
00353 }
00354 
00355 void
00356 XyPlotter::
00357 setValueRep ( BinToColor * rep )
00358 {
00359   m_plotter -> setValueRep ( rep );
00360   notifyObservers ();
00361 }
00362 
00363 void
00364 XyPlotter::
00365 setAutoRanging ( bool flag )
00366 {
00367   m_plotter -> setAutoRanging ( flag );
00368   if ( flag == true ) notifyObservers ();
00369 }
00370 
00371 void
00372 XyPlotter::
00373 setAutoRanging ( hippodraw::Axes::Type axis, bool flag )
00374 {
00375   m_plotter -> setAutoRanging ( axis, flag );
00376   if ( flag == true ) notifyObservers ();
00377 }
00378 
00379 void
00380 XyPlotter::
00381 setTransform ( TransformBase * transform )
00382 {
00383   m_plotter -> setTransform ( transform );
00384   notifyObservers ();
00385 }
00386 
00387 float
00388 XyPlotter::
00389 userToMarginX ( double x ) const
00390 {
00391   return m_margin_rect.getX () + ( x - m_user_rect.getX () ) * m_x_ratio;
00392 }
00393 
00394 float
00395 XyPlotter::
00396 userToMarginY ( double y ) const
00397 {
00398   return m_margin_rect.getY () + ( y - m_user_rect.getY () ) * m_y_ratio;
00399 }
00400 
00401 float
00402 XyPlotter::
00403 userToInvertedMarginY ( double y ) const
00404 {
00405   return m_margin_rect.getY () 
00406     + m_margin_rect.getHeight ()
00407     - ( y - m_user_rect.getY () ) * m_y_ratio;
00408 }
00409 
00410 double 
00411 XyPlotter::
00412 marginToUserX ( double x ) const
00413 {
00414   return m_user_rect.getX() + ( x - m_margin_rect.getX() ) / m_x_ratio;
00415 }
00416 
00417 double
00418 XyPlotter::
00419 marginToUserY ( double y ) const
00420 {
00421   return m_user_rect.getY() + ( y - m_margin_rect.getY() ) / m_y_ratio;
00422 }
00423 
00424 double
00425 XyPlotter::
00426 marginToInvertedUserY ( double y ) const
00427 {
00428   return m_user_rect.getY() + 
00429     ( m_margin_rect.getY() + m_margin_rect.getHeight() - y ) / m_y_ratio;  
00430 }
00431 
00432 void
00433 XyPlotter::
00434 marginToUserXY ( double mx, double my, bool scaled,
00435                  double & ux, double & uy ) const
00436 {
00437   double x = marginToUserX ( mx );
00438   double y = marginToUserY ( my );
00439   m_plotter -> toUserXY ( x, y, scaled, ux, uy );
00440 }
00441 
00442 NTuple *
00443 XyPlotter::
00444 createPickTuple ()
00445 {
00446   NTuple * ntuple =  m_plotter -> createPickTuple ();
00447 
00448   string name ( "Pick table for " );
00449   const string & title = getTitle ();
00450   name += title;
00451   ntuple -> setName ( name );
00452   ntuple -> setTitle ( name );
00453 
00454   return ntuple;
00455 }
00456 
00457 void
00458 XyPlotter::
00459 fillPickedPoint ( double mx, double my, 
00460                   std::vector < double > & picked ) const
00461 {
00462   double x = marginToUserX ( mx );
00463   double y = marginToInvertedUserY ( my );
00464 
00465   m_plotter -> fillPickedPoint ( x, y, picked );
00466 }
00467 
00468 void
00469 XyPlotter::
00470 setLowRange ( hippodraw::Axes::Type  type,
00471               int parm, bool dragging )
00472 {
00473   m_plotter -> setLowRange ( type, parm, dragging );
00474   notifyObservers ();
00475 }
00476 
00477 void
00478 XyPlotter::
00479 setHighRange ( hippodraw::Axes::Type type,
00480                int parm, bool dragging )
00481 {
00482   m_plotter -> setHighRange ( type, parm, dragging );
00483   notifyObservers ();
00484 }
00485 
00486 void
00487 XyPlotter::
00488 setScaling ( hippodraw::Axes::Type axis, bool on )
00489 {
00490   m_plotter -> setScaling ( axis, on );
00491   notifyObservers ();
00492 }
00493 
00494 double
00495 XyPlotter::
00496 getAspectRatio () const
00497 {
00498   double ratio = m_aspect_ratio;
00499   PlotterList_t::size_type size = m_plotters.size ();
00500   if ( ratio == 0.0 ) {
00501     for ( PlotterList_t::size_type i = 0; i < size; i++ ) {
00502       CompositePlotter * plotter = m_plotters [ i ];
00503       double r = plotter -> getAspectRatio ();
00504 
00505       if ( r != 0.0 ) {
00506         ratio = r;
00507         break;
00508       }
00509     }
00510   }
00511 
00512   return ratio;
00513 }
00514 
00515 void
00516 XyPlotter::
00517 update ()
00518 {
00519   m_plotter -> update ();
00520 }
00521 
00522 void
00523 XyPlotter::
00524 setRepresentation ( RepBase * rep )
00525 {
00526   m_plotter -> setRepresentation ( rep );
00527 }
00528 
00529 RepBase *
00530 XyPlotter::
00531 representation () const
00532 {
00533   return m_plotter -> representation ();
00534 }
00535 
00536 AxisModelBase *
00537 XyPlotter::
00538 getAxisModel ( hippodraw::Axes::Type axis ) const
00539 {
00540   return m_plotter -> getAxisModel ( axis );
00541 }
00542 
00543 void
00544 XyPlotter::
00545 setAxisModel ( AxisModelBase * model, hippodraw::Axes::Type axis )
00546 {
00547   m_plotter -> setAxisModel ( model, axis );
00548 }
00549 
00550 void
00551 XyPlotter::
00552 setErrorDisplay ( hippodraw::Axes::Type axis, bool yes )
00553 {
00554   m_plotter -> setErrorDisplay ( axis, yes );
00555 }
00556 
00557 bool
00558 XyPlotter::
00559 errorDisplay ( hippodraw::Axes::Type axis ) const
00560 {
00561   return m_plotter -> errorDisplay ( axis );
00562 }
00563 
00564 void
00565 XyPlotter::
00566 setRepColor ( const Color & color )
00567 {
00568   m_plotter -> setRepColor ( color );
00569 }
00570 
00571 const Color &
00572 XyPlotter::
00573 repColor () const
00574 {
00575   return m_plotter -> repColor ();
00576 }
00577 
00578 void
00579 XyPlotter::
00580 calcAxisRatios ( const CompositePlotter * plotter )
00581 {
00582   m_user_rect = plotter -> calcUserRectangle ( );
00583 
00584   m_x_ratio = m_margin_rect.getWidth ()  / m_user_rect.getWidth ();
00585   m_y_ratio = m_margin_rect.getHeight () / m_user_rect.getHeight ();
00586   if ( m_plotter -> hasAxis ( Axes::Z ) ) {
00587     m_z_ratio = m_margin_rect.getWidth ()  / m_user_rect.getDepth ();
00588   }
00589 }
00590 
00591 void
00592 XyPlotter::
00593 drawProjValues ( ViewBase * view )
00594 {
00595   PlotterList_t::iterator first = m_plotters.begin();
00596 
00597   while ( first != m_plotters.end () ) {
00598     CompositePlotter * plotter = *first++;
00599     calcAxisRatios ( plotter );
00600     plotter -> drawProjValues ( view );
00601   }
00602 }
00603 
00604 bool
00605 XyPlotter::
00606 hasAutoScaled () const
00607 {
00608   return m_plotter -> hasAutoScaled ();
00609 }
00610 
00611 bool
00612 XyPlotter::
00613 hasZoomY () const
00614 {
00615   int retVal = 1;
00616   
00617   for ( unsigned int i = 0; i < m_plotters.size () ; i++ )
00618     {
00619       retVal = retVal * ( m_plotters[i] -> hasZoomY () ); 
00620     }
00621   return retVal != 0;
00622 }
00623 
00624 bool
00625 XyPlotter::
00626 hasNTupleBindings () const
00627 {
00628   return m_plotter -> hasNTupleBindings ();
00629 }
00630 
00631 void
00632 XyPlotter::
00633 checkAxisScaling ( )
00634 {
00635   m_plotter -> checkAxisScaling ();
00636 }
00637 
00638 ProjectorBase *
00639 XyPlotter::
00640 getProjector ( int i ) const
00641 {
00642   const DataRep * rep = getDataRep ( i );
00643 
00644   return rep -> getProjector ();
00645 }
00646 
00647 ProjectorBase *
00648 XyPlotter::
00649 activeProjector () const
00650 {
00651   return m_plotter -> activeProjector ();
00652 }
00653 
00654 DataRep *
00655 XyPlotter::
00656 getDataRep ( int index ) const
00657 {
00658   DataRep * rep = 0;
00659   PlotterList_t::const_iterator first = m_plotters.begin ();
00660   while ( first != m_plotters.end () ) {
00661     CompositePlotter * plotter = *first++;
00662     int num = plotter -> getNumDataReps ();
00663     if ( index < num ) {
00664       rep = plotter -> getDataRep ( index );
00665       break;
00666     }
00667     index -= num;
00668   }
00669 
00670   return rep;
00671 }
00672 
00673 DataRep *
00674 XyPlotter::
00675 getTarget () const
00676 {
00677   DataRep * rep = 0;
00678 
00679   if ( m_active_index >= 0 ) {
00680     rep = getDataRep ( m_active_index );
00681   }
00682   else {
00683     PlotterList_t::const_iterator first = m_plotters.begin();
00684     while ( first != m_plotters.end() ) {
00685       const CompositePlotter * plotter = *first++;
00686       int number = plotter -> getNumDataReps ();
00687       for ( int i = 0; i < number; i++ ) {
00688         DataRep * r = plotter -> getDataRep ( i );
00689         if ( r -> isTargetable () ) {
00690           rep = r;
00691           break;
00692         }
00693       }
00694       if ( rep != 0 ) break;
00695     }
00696   }
00697 
00698   return rep;
00699 }
00700 
00701 int
00702 XyPlotter::
00703 getNumDataReps () const
00704 {
00705   int number = 0;
00706   PlotterList_t::const_iterator first = m_plotters.begin();
00707 
00708   while ( first != m_plotters.end() ) {
00709     CompositePlotter * plotter = *first++;
00710     number += plotter -> getNumDataReps ();
00711   }
00712 
00713   return number;
00714 }
00715 
00716 bool
00717 XyPlotter::
00718 isTargetable () const
00719 {
00720   bool yes = false;
00721 
00722   if ( m_active_index >= 0 ) {
00723     const DataRep * rep = getDataRep ( m_active_index );
00724     assert ( rep != 0 );
00725     yes = rep -> isTargetable ();
00726   }
00727   else {
00728     int count = 0;
00729     PlotterList_t::const_iterator first = m_plotters.begin();
00730     while ( first != m_plotters.end() ) {
00731       const CompositePlotter * plotter = *first++;
00732       int number = plotter -> getNumDataReps ();
00733       for ( int i = 0; i < number; i++ ) {
00734         const DataRep * rep = plotter -> getDataRep ( i );
00735         if ( rep -> isTargetable () ) count++;
00736       }
00737     }
00738     yes = count == 1;
00739   }
00740 
00741   return yes;
00742 }
00743 
00744 int
00745 XyPlotter::
00746 indexOf ( const DataRep * rep ) const
00747 {
00748   int index = 0;
00749   PlotterList_t::const_iterator first = m_plotters.begin ();
00750   while ( first != m_plotters.end () ) {
00751     const CompositePlotter * plotter = *first++;
00752     int num = plotter -> getNumDataReps ();
00753     int i = plotter -> indexOf ( rep );
00754     if ( i >= 0 ) {
00755       index += i;
00756       break;
00757     }
00758     index += num;
00759   }
00760 
00761   return index;
00762 }
00763 
00764 double
00765 XyPlotter::
00766 getBinWidth ( hippodraw::Axes::Type axis ) const
00767 {
00768   return m_plotter -> getBinWidth ( axis );
00769 }
00770 
00771 void
00772 XyPlotter::
00773 setBinWidth ( hippodraw::Axes::Type axis, double width )
00774 {
00775   m_plotter -> setBinWidth ( axis, width );
00776 }
00777 
00778 void
00779 XyPlotter::
00780 reset ( )
00781 {
00782   m_plotter -> reset ( );
00783 }
00784 
00785 
00786 const Range &
00787 XyPlotter::
00788 getRange ( hippodraw::Axes::Type axis, bool scaled ) const
00789 {
00790   return m_plotter -> getRange ( axis, scaled );
00791 }
00792 
00793 void
00794 XyPlotter::
00795 setRange ( hippodraw::Axes::Type axis, const Range & range,
00796            bool scaled, bool adjust_width )
00797 {
00798   m_plotter -> setRange ( axis, range, scaled, adjust_width );
00799 }
00800 
00801 double
00802 XyPlotter::
00803 getOffset ( hippodraw::Axes::Type axis ) const
00804 {
00805   return m_plotter -> getOffset ( axis );
00806 }
00807 
00808 TransformBase *
00809 XyPlotter::
00810 getTransform () const
00811 {
00812   return m_plotter -> getTransform ();
00813 }
00814 
00815 void
00816 XyPlotter::
00817 addValues ( const std::vector < double > & v )
00818 {
00819   m_plotter -> addValues ( v );
00820 }
00821 
00822 const string &
00823 XyPlotter::
00824 getInternalLabel ( hippodraw::Axes::Type axis ) const
00825 {
00826   return m_plotter -> getInternalLabel ( axis );
00827 }
00828 
00829 const string &
00830 XyPlotter::
00831 getLabel ( hippodraw::Axes::Type axis ) const
00832 {
00833   return m_plotter -> getLabel ( axis );
00834 }
00835 
00836 void
00837 XyPlotter::
00838 setLabel ( hippodraw::Axes::Type axis, const std::string & value )
00839 {
00840   m_plotter -> setLabel ( axis, value );
00841   notifyObservers ();
00842 }
00843 
00844 int
00845 XyPlotter::
00846 getNumberOfEntries () const
00847 {
00848   return m_plotter -> getNumberOfEntries ();
00849 }
00850 
00851 double
00852 XyPlotter::
00853 getPosRange ( hippodraw::Axes::Type axis ) const
00854 {
00855   return m_plotter -> getPosRange ( axis );
00856 }
00857 
00858 bool
00859 XyPlotter::
00860 hasAxis ( hippodraw::Axes::Type axis ) const
00861 {
00862   bool yes = false;
00863   PlotterList_t::const_iterator first = m_plotters.begin ();
00864 
00865   while ( first != m_plotters.end () ) {
00866     CompositePlotter * plotter = *first++;
00867     yes |= plotter -> hasAxis ( axis );
00868   }
00869 
00870   return yes;
00871 }
00872 
00873 const BinToColor *
00874 XyPlotter::
00875 getValueRep () const
00876 {
00877   return m_plotter -> getValueRep ();
00878 }
00879 
00880 bool
00881 XyPlotter::
00882 isAutoRanging ( hippodraw::Axes::Type axis ) const
00883 {
00884   return m_plotter -> isAutoRanging ( axis );
00885 }
00886 
00887 void
00888 XyPlotter::
00889 matrixTranspose ( bool yes )
00890 {
00891   m_plotter -> matrixTranspose ( yes );
00892 }
00893 
00894 DataRep *
00895 XyPlotter::
00896 selectedDataRep () const
00897 {
00898   return m_plotter -> selectedDataRep ();
00899 }
00900 
00901 void
00902 XyPlotter::
00903 setAutoTicks ( hippodraw::Axes::Type axis, bool yes )
00904 {
00905   m_plotter -> setAutoTicks ( axis, yes );
00906 }
00907 
00908 void
00909 XyPlotter::
00910 setTicks ( hippodraw::Axes::Type axis, const std::vector < AxisTick > & ticks )
00911 {
00912   m_plotter -> setTicks ( axis, ticks );
00913 }
00914 
00915 void
00916 XyPlotter::
00917 setNumberOfBins ( hippodraw::Axes::Type axis, unsigned int number )
00918 {
00919   m_plotter -> setNumberOfBins ( axis, number );
00920 }
00921 
00922 void
00923 XyPlotter::
00924 setOffset ( hippodraw::Axes::Type axis, double offset )
00925 {
00926   m_plotter -> setOffset ( axis, offset );
00927 }
00928 
00929 void
00930 XyPlotter::
00931 fillCutList ( vector < const TupleCut * > & cuts ) const
00932 {
00933   PlotterList_t::const_iterator first = m_plotters.begin();
00934   while ( first != m_plotters.end () ) {
00935     const CompositePlotter * plotter = *first++;
00936     plotter -> fillCutList ( cuts );
00937   }
00938 }
00939 
00940 TupleCut *
00941 XyPlotter::
00942 getCutAt ( unsigned int i )
00943 {
00944   vector < const TupleCut * > cuts;
00945   fillCutList ( cuts );
00946   TupleCut * cut = const_cast < TupleCut * > ( cuts[i] );
00947 
00948   return cut;
00949 }
00950 
00951 void
00952 XyPlotter::
00953 setCutRangeAt ( const Range & range, unsigned int i )
00954 {
00955   TupleCut * cut = getCutAt ( i );
00956   cut -> setRange ( range );
00957 
00958   DataRep * rep = getDataRep ( 0 );
00959   rep -> setDirty ();
00960 
00961   notifyObservers ();
00962 }
00963 
00964 void
00965 XyPlotter::
00966 setCutInverted ( unsigned int i, bool yes )
00967 {
00968   TupleCut * cut = getCutAt ( i );
00969   cut -> setInversion ( yes );
00970 
00971   DataRep * rep = getDataRep ( 0 );
00972   rep -> setDirty ();
00973 
00974   notifyObservers ();
00975 }
00976 
00977 void
00978 XyPlotter::
00979 setCutEnabled ( unsigned int i, bool yes )
00980 {
00981   TupleCut * cut = getCutAt ( i );
00982   cut -> setEnabled ( yes );
00983   DataRep * rep = getDataRep ( 0 );
00984   rep -> setDirty ();
00985 
00986   notifyObservers ();
00987 }

Generated for HippoDraw-1.14.8.5 by doxygen 1.4.3