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

MapMatrixProjector.h

Go to the documentation of this file.
00001 /* -*- c++ -*- */
00002 
00014 #ifndef _MapMatrixProjector_H_
00015 #define _MapMatrixProjector_H_
00016 
00017 #include "NTupleProjector.h"
00018 
00029 class MDL_HIPPOPLOT_API MapMatrixProjector : public NTupleProjector
00030 {
00031 
00032 private:
00033 
00035   std::string m_x_label;
00036 
00039   std::string m_y_label;
00040 
00045   unsigned int m_cols;
00046 
00051   unsigned int m_rows;
00052 
00056   double m_x_step;
00057 
00061   double m_y_step;
00062 
00065   double m_x_origin;
00066 
00069   double m_y_origin;
00070 
00074   double m_scale_factor;
00075 
00081   double m_null_value;
00082 
00087   bool m_transpose;
00088 
00089 protected:
00090 
00092   MapMatrixProjector ( const MapMatrixProjector & projector );
00093 
00100   virtual void changedNTuple();
00101 
00103   virtual void addPointReps ();
00104 
00105 public:
00106 
00108   MapMatrixProjector();
00109 
00111   ~MapMatrixProjector();
00112 
00115   ProjectorBase * clone();
00116 
00122   virtual void matrixTranspose ( bool yes );
00123 
00129   virtual void setNumberOfBins ( hippodraw::Axes::Type axis, 
00130                                  unsigned int number );
00131 
00135   virtual int getNumberOfBins ( hippodraw::Axes::Type axis ) const;
00136 
00141   virtual void setBinWidth ( hippodraw::Axes::Type axis, double step );
00142 
00145   virtual double getBinWidth ( hippodraw::Axes::Type axis ) const;
00146 
00151   virtual void setOffset ( hippodraw::Axes::Type axis, double origin );
00152 
00155   virtual double getOffset ( hippodraw::Axes::Type axis ) const;
00156 
00157   virtual void setNTuple ( const DataSource * ntuple );
00158 
00159   virtual bool inRange ( int row ) const;
00160 
00163   virtual Range dataRangeOn ( hippodraw::Axes::Type ) const;
00164   virtual Range valueRange ( ) const;
00165 
00168   virtual double getPosOn ( hippodraw::Axes::Type axis ) const;
00169 
00173   const std::string & getXLabel () const;
00174 
00178   const std::string & getYLabel ( bool flag ) const;
00179 
00183   const std::string & getZLabel () const;
00184 
00187   virtual double getZValue ( double x, double y ) const;
00188 
00190   virtual double getAverage ( hippodraw::Axes::Type axis ) const;
00191 
00198   inline unsigned int calcColumnIndex ( unsigned int row ) const;
00199 
00203   inline double calcColumnValue ( unsigned int row ) const;
00204 
00208   inline unsigned int calcRowIndex ( unsigned int row ) const;
00209 
00213   inline double calcRowValue ( unsigned int row ) const;
00214 
00217   inline double getXStep () const;
00218 
00221   inline double getYStep () const;
00222 
00223   virtual DataSource * createNTuple () const;
00224 
00225   virtual void prepareValues ();
00226 
00227 
00228 protected:
00229 
00230   virtual void fillProjectedValues ( DataSource * ntuple, 
00231                                      bool in_range = false ) const;
00232   virtual void fillDataSource ( DataSource * ntuple, 
00233                                 bool in_range = false ) const;
00234 
00235 };
00236 
00237 inline
00238 unsigned int
00239 MapMatrixProjector::
00240 calcColumnIndex ( unsigned int row ) const
00241 {
00242   if ( m_rows == 0 ) return 0;
00243 
00244   return row / m_rows;
00245 }
00246 
00247 inline
00248 double
00249 MapMatrixProjector::
00250 calcColumnValue ( unsigned int row ) const
00251 {
00252   unsigned int index = calcColumnIndex ( row );
00253 
00254   return m_x_origin + index * m_x_step + 0.5 * m_x_step;
00255 }
00256 
00257 inline
00258 unsigned int
00259 MapMatrixProjector::
00260 calcRowIndex ( unsigned int row ) const
00261 {
00262   unsigned int column = calcColumnIndex ( row );
00263 
00264   return row - column * m_rows;
00265 }
00266 
00267 inline
00268 double
00269 MapMatrixProjector::
00270 calcRowValue ( unsigned int row ) const
00271 {
00272   unsigned int index = calcRowIndex ( row );
00273 
00274   return m_y_origin + index * m_y_step + 0.5 * m_y_step;
00275 }
00276 
00277 inline
00278 double
00279 MapMatrixProjector::
00280 getXStep ( ) const
00281 {
00282   return m_x_step;
00283 }
00284 
00285 inline
00286 double
00287 MapMatrixProjector::
00288 getYStep ( ) const
00289 {
00290   return m_y_step;
00291 }
00292 
00293 #endif // _MapMatrixProjector_H_

Generated for HippoDraw-1.14.8.5 by doxygen 1.4.3