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 
00019 namespace hippodraw {
00020 
00028 class MDL_HIPPOPLOT_API MapMatrixProjector : public NTupleProjector
00029 {
00030 
00031 private:
00032 
00034   std::string m_x_label;
00035 
00038   std::string m_y_label;
00039 
00044   unsigned int m_cols;
00045 
00050   unsigned int m_rows;
00051 
00055   double m_x_step;
00056 
00060   double m_y_step;
00061 
00064   double m_x_origin;
00065 
00068   double m_y_origin;
00069 
00073   double m_scale_factor;
00074 
00080   double m_null_value;
00081 
00086   bool m_transpose;
00087 
00088 protected:
00089 
00091   MapMatrixProjector ( const MapMatrixProjector & projector );
00092 
00099   virtual void changedNTuple();
00100 
00102   virtual void addPointReps ();
00103 
00108   bool inRangeWithZ ( int row, bool flag ) const;
00109 
00110 public:
00111 
00113   MapMatrixProjector();
00114 
00117   ProjectorBase * clone();
00118 
00124   virtual void matrixTranspose ( bool yes );
00125 
00131   virtual void setNumberOfBins ( hippodraw::Axes::Type axis, 
00132                                  unsigned int number );
00133 
00137   virtual int getNumberOfBins ( hippodraw::Axes::Type axis ) const;
00138 
00143   virtual const Range &  setBinWidth ( hippodraw::Axes::Type axis,
00144                                        double step );
00145 
00148   virtual double getBinWidth ( hippodraw::Axes::Type axis ) const;
00149 
00154   virtual void setOffset ( hippodraw::Axes::Type axis, double origin );
00155 
00158   virtual double getOffset ( hippodraw::Axes::Type axis ) const;
00159 
00160   virtual void setNTuple ( const DataSource * ntuple );
00161 
00162   virtual bool inRange ( int row ) const;
00163 
00166   virtual Range dataRangeOn ( hippodraw::Axes::Type ) const;
00167   virtual Range dataRangeOnValue () const;
00168   virtual Range valueRange ( ) const;
00169   virtual Range preferredRange ( hippodraw::Axes::Type axis ) const;
00170 
00173   virtual double getPosOn ( hippodraw::Axes::Type axis ) const;
00174 
00178   const std::string & getXLabel () const;
00179 
00183   const std::string & getYLabel ( bool flag ) const;
00184 
00188   const std::string & getZLabel () const;
00189 
00192   virtual double getZValue ( double x, double y ) const;
00193 
00195   virtual double getAverage ( hippodraw::Axes::Type axis ) const;
00196 
00203   inline unsigned int calcColumnIndex ( unsigned int row ) const;
00204 
00208   inline double calcColumnValue ( unsigned int row ) const;
00209 
00213   inline unsigned int calcRowIndex ( unsigned int row ) const;
00214 
00218   inline double calcRowValue ( unsigned int row ) const;
00219 
00222   inline double getXStep () const;
00223 
00226   inline double getYStep () const;
00227 
00228   virtual DataSource * createNTuple () const;
00229 
00230   virtual void prepareValues ();
00231 
00235   virtual bool isImageConvertable () const;
00236 
00237 protected:
00238 
00239   virtual void fillProjectedValues ( DataSource * ntuple, 
00240                                      bool in_range = false ) const;
00241 };
00242 
00243 inline
00244 unsigned int
00245 MapMatrixProjector::
00246 calcColumnIndex ( unsigned int row ) const
00247 {
00248   if ( m_rows == 0 ) return 0;
00249 
00250   return row / m_rows;
00251 }
00252 
00253 inline
00254 double
00255 MapMatrixProjector::
00256 calcColumnValue ( unsigned int row ) const
00257 {
00258   unsigned int index = calcColumnIndex ( row );
00259 
00260   return m_x_origin + index * m_x_step + 0.5 * m_x_step;
00261 }
00262 
00263 inline
00264 unsigned int
00265 MapMatrixProjector::
00266 calcRowIndex ( unsigned int row ) const
00267 {
00268   unsigned int column = calcColumnIndex ( row );
00269 
00270   return row - column * m_rows;
00271 }
00272 
00273 inline
00274 double
00275 MapMatrixProjector::
00276 calcRowValue ( unsigned int row ) const
00277 {
00278   unsigned int index = calcRowIndex ( row );
00279 
00280   return m_y_origin + index * m_y_step + 0.5 * m_y_step;
00281 }
00282 
00283 inline
00284 double
00285 MapMatrixProjector::
00286 getXStep ( ) const
00287 {
00288   return m_x_step;
00289 }
00290 
00291 inline
00292 double
00293 MapMatrixProjector::
00294 getYStep ( ) const
00295 {
00296   return m_y_step;
00297 }
00298 
00299 } // namespace hippodraw
00300 
00301 #endif // _MapMatrixProjector_H_

Generated for HippoDraw Class Library by doxygen