DisplayController.h

Go to the documentation of this file.
00001 /* -*- mode: c++ -*- */
00013 #ifndef _DisplayController_H_
00014 #define _DisplayController_H_
00015 
00016 #include "axes/AxesType.h"
00017 
00018 #ifdef _MSC_VER
00019 #include <msdevstudio/MSconfig.h>
00020 #endif
00021 
00022 #include <list>
00023 #include <vector>
00024 
00025 namespace hippodraw {
00026 
00027 class AxisModelBase;
00028 class DataRep;
00029 class DataSource;
00030 class LineDataRep;
00031 class NTuple;
00032 class NTupleProjector;
00033 class PlotterBase;
00034 class ProjectorBase;
00035 class Range;
00036 class XYTransform;
00037 class ViewBase;
00038 class ViewFactory;
00039 
00040 using std::vector;
00041 
00063 class MDL_HIPPOPLOT_API DisplayController
00064 {
00065 
00066 private:
00067 
00069   static DisplayController * s_instance;
00070 
00074   std::string m_null_string;
00075 
00078   std::vector< std::string > m_null_vector;
00079 
00083   PlotterBase * createPlotter ( const hippodraw::DataRep * rep ) const;
00084 
00090   void fixLogIfBinned ( const PlotterBase *, hippodraw::DataRep * rep ) const;
00091 
00094   NTupleProjector * getBindingProjector ( const PlotterBase * ) const;
00095 
00100   hippodraw::DataRep * 
00101   getUniqueWithNTupleBindings ( const PlotterBase * plotter );
00102 
00104   ProjectorBase * getProjector ( const PlotterBase * display ) const;
00105 
00108   bool isCompatible ( const PlotterBase * plotter,
00109                       const std::string & type ) const;
00110 
00117   void setBinner ( const PlotterBase * plotter, 
00118                    DataRep * rep,
00119                    Axes::Type axis ) const;
00120 
00122   void setBinner ( PlotterBase * plotter,
00123                    Axes::Type axis );
00124 
00129   void setAxisModel ( PlotterBase * plotter,
00130                       Axes::Type axis,
00131                       const std::string & type );
00132 
00134   void setAxisModelWithoutSetBin ( PlotterBase * plotter,
00135                       Axes::Type axis,
00136                       const std::string & type );
00146   void setBinWidth ( PlotterBase * plotter,
00147                      Axes::Type axis,
00148                      double width );
00149 
00151   DisplayController ( const DisplayController & );
00152 
00155   DisplayController();
00156 
00157 public:
00158 
00160   static DisplayController * instance ();
00161 
00163   ~DisplayController();
00164 
00168   const std::string & getDataSourceName ( const PlotterBase * plotter,
00169                                           int index );
00170 
00172   const std::vector < std::string > & getDisplayTypes () const;
00173 
00176   void setValueTransform ( PlotterBase * plotter, const std::string & name );
00177 
00180   void setValueTransform ( PlotterBase * plotter, int index );
00181    
00184   void addValueTransform ( const std::string & name,
00185                            const std::vector < double > & ctrl_points );
00186   
00192   bool removeValueTransform ( const std::string & name );
00193   
00198   void saveValueCtrlPts( PlotterBase *plotter,
00199                          const std::vector <double> & sv);
00200 
00201  
00205   const std::vector <double> &  getValueCtrlPts ( const PlotterBase * plotter);
00206  
00209   void setValueCtrlPts ( PlotterBase * plotter,
00210                          const std::vector < double > &  sv);
00211  
00212  
00216   int getValueTransformIndex ( PlotterBase * plotter );
00217 
00220   const std::vector < std::string > & getValueTransformTypes () const;
00221 
00227   bool hasControlPoints ( const PlotterBase * plotter ) const;
00228 
00231   bool isUserDefinedValueTransform ( const PlotterBase * plotter ) const;
00232 
00234   const std::vector < std::string > & getTextTypes () const;
00235 
00242   PlotterBase * 
00243   createDisplay ( const std::string & name );
00244 
00251   PlotterBase * createDisplay ( hippodraw::DataRep * rep );
00252 
00259   PlotterBase * 
00260   createDisplay ( const std::string & name,
00261                   const DataSource & tuple,
00262                   const std::vector< std::string > & bindings ) const;
00263 
00264   NTuple *
00265   createNTupleDiff ( PlotterBase * plotter );
00266 
00270   PlotterBase * createDifferenceDisplay ( PlotterBase * plotter ) ;
00271 
00274   const std::string & getType ( const PlotterBase * plotter,
00275                                 int index ) const;
00276 
00281   int getNumberOfEntries ( const PlotterBase * plotter, int index = 0 ) const;
00282 
00286   int getUnderflow ( const PlotterBase * plotter, int index = 0 ) const;
00287 
00291   int getOverflow ( const PlotterBase * plotter, int index = 0 ) const;
00292   
00298   double getAverage ( const PlotterBase * plotter, 
00299                       const std::string & axis, int index = 0 ) const;
00300 
00306   double getAverage ( const PlotterBase * plotter, 
00307                       Axes::Type axis, int index = 0 ) const;
00308 
00312   double getRMS ( const PlotterBase * plotter, 
00313                   const std::string & axis, int index = 0 ) const;
00314 
00318   double getRMS ( const PlotterBase * plotter, 
00319                   Axes::Type axis, int index = 0 ) const;
00320 
00329   void setPointRep ( PlotterBase * plotter,
00330                      const std::string & point_rep );
00331 
00334   unsigned int getRepStyle ( const PlotterBase * plotter ) const;
00335 
00338   void addDataRep ( PlotterBase *, hippodraw::DataRep * ) const;
00339 
00342   void stackDataRep ( PlotterBase *, hippodraw::DataRep * ) const;
00343 
00351   hippodraw::DataRep *
00352   addDataRep ( PlotterBase * plotter,
00353                const std::string & name,
00354                const DataSource * source,
00355                const std::vector< std::string > & bindings ) const;
00356 
00364   hippodraw::DataRep * 
00365   addDataRepStacked ( PlotterBase * plotter,
00366                       const std::string & name,
00367                       const DataSource * source,
00368                       const std::vector < std::string > & bindings ) const;
00369 
00372   LineDataRep * addLineRep ( PlotterBase *, 
00373                              const std::string & axis, 
00374                              double value );
00375 
00378   LineDataRep * addLineRep ( PlotterBase *, 
00379                              Axes::Type, 
00380                              double value );
00381 
00386   void setErrorDisplayed ( const PlotterBase *, 
00387                            Axes::Type axis, bool state ) const;
00388 
00392   void addTextViewToList ( std::vector < const ViewBase * > & destination,
00393                            const std::vector < const ViewBase * > & source );
00394 
00396   void removeTextObservers ( const std::vector < const ViewBase * > & views );
00397 
00400   hippodraw::DataRep *
00401   createTextDataRep ( const std::string & type,
00402                       const std::string & text = std::string() );
00403   
00409   ViewBase * createTextView ( const ViewFactory * factory,
00410                               hippodraw::DataRep * rep,
00411                               const std::string & name,
00412                               const std::string & text = std::string () );
00413 
00420   ViewBase * createTextView ( const ViewFactory * factory,
00421                               PlotterBase * plotter,
00422                               const std::string & name,
00423                               const std::string & text = 0);
00424 
00428   PlotterBase * createTextPlotter ( hippodraw::DataRep * datarep,
00429                                     const std::string & name,
00430                                     const std::string & text = std::string() );
00431   
00436   int activeDataRepIndex ( const PlotterBase * plotter ) const;
00437 
00443   hippodraw::DataRep *  activeDataRep ( const PlotterBase * plotter ) const;
00444 
00449   void setActiveDataRepIndex ( PlotterBase * plotter,
00450                                int index );
00451 
00454   bool hasNTupleBindings ( const PlotterBase * plotter, int index );
00455 
00458   bool areDataSourcesSaved ( const PlotterBase * );
00459 
00464   DataSource * getDataSource ( const PlotterBase * plotter );
00465 
00470   DataSource * getDataSource ( const PlotterBase *, int index );
00471 
00474   const std::vector < std::string > & 
00475   getDataSourceLabels ( const PlotterBase * plotter, int index );
00476 
00479   void setNTuple ( PlotterBase * , const NTuple * ) const;
00480 
00483   const std::vector < std::string > &
00484   bindingOptions ( const std::string & type );
00485 
00488   const std::vector < std::string > & 
00489   bindingOptions ( const PlotterBase * plottter, int index );
00490 
00494   const std::vector< std::string > & 
00495   axisBindings ( const PlotterBase * plotter ) const;
00496 
00500   const std::vector< std::string > & 
00501   axisBindings ( const PlotterBase * plotter, int index ) const;
00502 
00506   void setAxisBinding ( PlotterBase *, 
00507                         const std::string & axis,
00508                         const std::string & label );
00509 
00511   void setAxisBindings ( PlotterBase * plotter,
00512                          const std::vector< std::string > & labels ) const;
00513 
00517   bool isDataValid ( const PlotterBase * ) const;
00518 
00522   bool isDataValid ( const hippodraw::DataRep * ) const;
00523 
00526   bool getLog ( const PlotterBase * plotter, const std::string & axis ) const;
00527 
00530   bool getLog ( const PlotterBase * plotter, 
00531                 Axes::Type axis ) const;
00532 
00537   void setLog ( PlotterBase * plotter,
00538                 const std::string & axis, 
00539                 bool flag );
00540 
00549   void setLog ( PlotterBase * plotter,
00550                 Axes::Type axis, 
00551                 bool flag );
00552 
00558   void setLog ( PlotterBase * plotter,
00559                 Axes::Type axis,
00560                 bool flag,
00561                 XYTransform * transform );
00562 
00566   void setTransformAxis ( PlotterBase * plotter,
00567                           const std::string & x,
00568                           const std::string & y);
00569 
00571   void setTransform ( PlotterBase * plotter,
00572                       const std::string & name );
00573 
00575   void setTransform ( PlotterBase * plotter,
00576                       const std::string & x,
00577                       const std::string & y );
00578 
00580   void setTransform ( PlotterBase * plotter,
00581                       const std::string & x,
00582                       const std::string & y,
00583                       const std::string & z );
00584 
00586   void remove ( PlotterBase * );
00587 
00589   float pointSize ( const PlotterBase * ) const;
00590 
00594   bool hasSymbolRep ( const PlotterBase * plotter ) const;
00595 
00599   bool hasLineRep ( const PlotterBase * plotter ) const;
00600 
00601 
00603   void setRepSize ( PlotterBase * plotter, float size );
00604 
00607   void setIntervalCount ( const PlotterBase * plotter, 
00608                           unsigned int count );
00609 
00612   void setIntervalEnabled ( const PlotterBase * plotter, bool yes );
00613 
00616   void setAllIntervalEnabled ( const PlotterBase * plotter, bool yes );
00617 
00619   void setRange ( PlotterBase * plotter,
00620                   Axes::Type axis, 
00621                   const Range & range );
00622 
00630   void setBinWidth ( PlotterBase * plotter,
00631                      const std::string & axis,
00632                      double width );
00633 
00636   void setBinWidth ( DataRep * datarep,
00637                      Axes::Type axis,
00638                      double width );
00639 
00641   void setOffset ( PlotterBase * plotter,
00642                    const std::string & axis,
00643                    int parm,
00644                    bool dragging );
00645 
00647   void setOffset ( PlotterBase * plotter,
00648                    Axes::Type axis,
00649                    double offset );
00650 
00654   bool isAxisBinned ( PlotterBase * display, const std::string & axis );
00655 
00661   void createNTuple ( const PlotterBase * plotter );
00662 
00663 };
00664 
00665 } // namespace hippodraw
00666 
00667 #endif // _DisplayController_H_

Generated for HippoDraw Class Library by doxygen