MapMatrixProjector.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 
14 #ifndef _MapMatrixProjector_H_
15 #define _MapMatrixProjector_H_
16 
17 #include "NTupleProjector.h"
18 
19 namespace hippodraw {
20 
29 {
30 
31 private:
32 
34  std::string m_x_label;
35 
38  std::string m_y_label;
39 
44  unsigned int m_cols;
45 
50  unsigned int m_rows;
51 
55  double m_x_step;
56 
60  double m_y_step;
61 
64  double m_x_origin;
65 
68  double m_y_origin;
69 
74 
80  double m_null_value;
81 
87 
88 protected:
89 
91  MapMatrixProjector ( const MapMatrixProjector & projector );
92 
99  virtual void changedNTuple();
100 
102  virtual void addPointReps ();
103 
108  bool inRangeWithZ ( int row, bool flag ) const;
109 
110 public:
111 
114 
117  ProjectorBase * clone();
118 
124  virtual void matrixTranspose ( bool yes );
125 
131  virtual void setNumberOfBins ( hippodraw::Axes::Type axis,
132  unsigned int number );
133 
137  virtual int getNumberOfBins ( hippodraw::Axes::Type axis ) const;
138 
143  virtual const Range & setBinWidth ( hippodraw::Axes::Type axis,
144  double step );
145 
148  virtual double getBinWidth ( hippodraw::Axes::Type axis ) const;
149 
154  virtual void setOffset ( hippodraw::Axes::Type axis, double origin );
155 
158  virtual double getOffset ( hippodraw::Axes::Type axis ) const;
159 
160  virtual void setNTuple ( const DataSource * ntuple );
161 
162  virtual bool inRange ( int row ) const;
163 
166  virtual Range dataRangeOn ( hippodraw::Axes::Type ) const;
167  virtual Range dataRangeOnValue () const;
168  virtual Range valueRange ( ) const;
169  virtual Range preferredRange ( hippodraw::Axes::Type axis ) const;
170 
173  virtual double getPosOn ( hippodraw::Axes::Type axis ) const;
174 
178  const std::string & getXLabel () const;
179 
183  const std::string & getYLabel ( bool flag ) const;
184 
188  const std::string & getZLabel () const;
189 
192  virtual double getZValue ( double x, double y ) const;
193 
195  virtual double getAverage ( hippodraw::Axes::Type axis ) const;
196 
203  inline unsigned int calcColumnIndex ( unsigned int row ) const;
204 
208  inline double calcColumnValue ( unsigned int row ) const;
209 
213  inline unsigned int calcRowIndex ( unsigned int row ) const;
214 
218  inline double calcRowValue ( unsigned int row ) const;
219 
222  inline double getXStep () const;
223 
226  inline double getYStep () const;
227 
228  virtual DataSource * createNTuple () const;
229 
230  virtual void prepareValues ();
231 
235  virtual bool isImageConvertable () const;
236 
237 protected:
238 
239  virtual void fillProjectedValues ( DataSource * ntuple,
240  bool in_range = false ) const;
241 };
242 
243 inline
244 unsigned int
246 calcColumnIndex ( unsigned int row ) const
247 {
248  if ( m_rows == 0 ) return 0;
249 
250  return row / m_rows;
251 }
252 
253 inline
254 double
256 calcColumnValue ( unsigned int row ) const
257 {
258  unsigned int index = calcColumnIndex ( row );
259 
260  return m_x_origin + index * m_x_step + 0.5 * m_x_step;
261 }
262 
263 inline
264 unsigned int
266 calcRowIndex ( unsigned int row ) const
267 {
268  unsigned int column = calcColumnIndex ( row );
269 
270  return row - column * m_rows;
271 }
272 
273 inline
274 double
276 calcRowValue ( unsigned int row ) const
277 {
278  unsigned int index = calcRowIndex ( row );
279 
280  return m_y_origin + index * m_y_step + 0.5 * m_y_step;
281 }
282 
283 inline
284 double
286 getXStep ( ) const
287 {
288  return m_x_step;
289 }
290 
291 inline
292 double
294 getYStep ( ) const
295 {
296  return m_y_step;
297 }
298 
299 } // namespace hippodraw
300 
301 #endif // _MapMatrixProjector_H_
double m_x_step
The step along the X axis.
hippodraw::NTupleProjector class interface
double m_x_origin
The origin along the X axis.
unsigned int m_rows
The number of rows for each column.
std::string m_y_label
The label for the generated y axis.
Type
Axes constants.
Definition: AxesType.h:31
double m_null_value
The value of the null value.
double m_y_step
The step along the Y axis.
Namespace for HippoDraw.
Definition: AxesType.cxx:21
unsigned int m_cols
The number of columns for each row.
double m_y_origin
The origin along the Y axis.
Base class for DataSource.
Definition: DataSource.h:55
bool m_transpose
A flag to indicate if the X-Y matrix should be transposed or not.
A derived class of NTupleProjector that maps 1 DataSource column to a Y axis of two dimensional proje...
double getYStep() const
Returns the size of the step along the Y axis.
#define MDL_HIPPOPLOT_API
Definition: libhippo.h:36
Expresses a range of values.
Definition: Range.h:33
The base class for the Projector hierarchy.
Definition: ProjectorBase.h:56
std::string m_x_label
The label for the generated x axis.
An NTupleProjector is a projector that projects data from an DataSource object.
double m_scale_factor
The scale factor.
unsigned int calcRowIndex(unsigned int row) const
Calculates the index of the row of the matrix, given the row of the NTuple.
double calcRowValue(unsigned int row) const
Calculates the value of the row coordinate given the row of the NTuple.
double calcColumnValue(unsigned int row) const
Calculates the value of the column coordinate given the row of the NTuple.
double getXStep() const
Returns the size of the step along the X axis.
column
The column indices for 2 dimension data point tuple.
numeric::array clone(numeric::array arr)
Definition: num_util.cpp:412
unsigned int calcColumnIndex(unsigned int row) const
Calculates the index of the column of the matrix, given the row of the NTuple.

Generated for HippoDraw Class Library by doxygen