DataRep.h
Go to the documentation of this file.
1 /* -*- mode: c++ -*- */
2 
14 #ifndef _DataRep_H_
15 #define _DataRep_H_
16 
17 #include "pattern/Observable.h"
18 #include "pattern/Observer.h"
19 
20 #include "axes/AxesType.h"
21 #include "axes/Range.h"
22 
23 #ifdef _MSC_VER
24 #include "datasrcs/TupleCut.h"
25 #endif
26 
27 #include "graphics/Color.h"
28 
29 namespace hippodraw {
30 
31  class AxisModelBase;
32  class Color;
33  class CutRangeRep;
34  class DataSource;
35  class NTuple;
36  class ProjectorBase;
37  class RepBase;
38  class TransformBase;
39  class TupleCut;
40  class ViewBase;
41 
69  : public Observable, public Observer
70 {
71 
72 protected:
73 
76  std::string m_name;
77 
82  std::string m_title;
83 
91 
95 
100 
104 
106  DataRep ( );
107 
109  DataRep ( const DataRep & );
110 
113  void drawCuts ( TransformBase * transform, ViewBase * view );
114 
117  void throwRangeException ();
118 
119  public:
120 
122  virtual ~DataRep();
123 
126  virtual DataRep * clone () = 0;
127 
129  const std::string & name () const;
130 
138  virtual bool hasAxis ( Axes::Type axis ) const;
139 
146  void setTitle ( const std::string & title );
147 
150  const std::string & getTitle () const;
151 
153  virtual void update ( const Observable * );
154 
161  virtual bool hasErrorDisplay ( ) const;
162 
165  virtual bool hasNTupleBindings () const;
166 
173  virtual void setAxisBinding ( const std::string & axis,
174  const std::string & label );
175 
182  virtual
183  void setAxisBindings ( const std::vector < std::string > & bindings );
184 
192  virtual void matrixTranspose ( bool yes );
193 
202  virtual void drawProjectedValues ( TransformBase * transform,
203  ViewBase * view );
204 
207  double getPosRange ( Axes::Type axis );
208 
210  RepBase * getRepresentation () const;
211 
213  const Color & getRepColor () const;
214 
217  bool isDirty () const;
218 
220  bool isErrorDisplayed ( Axes::Type ) const;
221 
228  Range preferredRange ( Axes::Type axis ) const;
229 
231  void setAxisModel ( Axes::Type axis, AxisModelBase * );
232 
235  void setErrorDisplay ( Axes::Type axis, bool );
236 
242  virtual void setPointRep ( RepBase * pointrep );
243 
245  void setRepColor ( const Color & );
246 
248  void setRepSize ( double size );
249 
252  void setRepStyle ( int style );
253 
254 
257  virtual void setDirty ( bool yes = true );
258 
262  void setRange ( Axes::Type axis, bool const_width = true );
263 
264 
266  virtual ProjectorBase * getProjector ( ) const;
267 
272  virtual void setSelected ( bool yes = true );
273 
277  virtual bool isSelected ( ) const;
278 
284  virtual bool acceptFunction ( int number );
285 
288  virtual bool hasZeroRows ( );
289 
292  virtual bool hasZoomY () const;
293 
294 
300  virtual void addValues ( const std::vector < double > & v );
301 
304  virtual const DataSource * getProjectedValues () const;
305 
308  virtual NTuple * getNTupleAfterCuts () const;
309 
313  virtual void fillColumnAfterCuts(const std::string & column,
314  std::vector<double> & columnData) const;
315 
319  NTuple * createNTupleUnderRegion () const;
320 
324  virtual double getMean ( const std::string & axis );
325 
329  virtual double getRMS ( const std::string & axis );
330 
334  bool isAxisBinned ( Axes::Type axis ) const;
335 
337  virtual DataRep * getParentDataRep() const;
338 
340  virtual void setParentDataRep( DataRep * parent_datarep );
341 
347  virtual void update ();
348 
351  virtual void normalizeTo ( const DataRep * target );
352 
356  const Range & setBinWidth ( Axes::Type axis, double width );
357 
360  int getNumberOfEntries () const;
361 
369  virtual bool isTargetable () const;
370 
374  NTuple * createNTuple () const;
375 
379  virtual bool needColorRep() const;
380 
384  bool hasCut () const;
385 
388  void addCut ( const TupleCut & cut );
389 
392  void addCut ();
393 
396  void removeCut ();
397 
400  const std::vector < TupleCut > & getCuts () const;
401 
404  RepBase * getCutRep ();
405 
408  void set ( Color::Value value );
409 
412  void setCutRangeAt ( const Range & range, unsigned int i );
413 
417  void toggleInverted ( unsigned int i );
418 
421  void setEnabled ( unsigned int i, bool yes = true );
422 
428  virtual bool needsMatrixSet () const;
429 
435  virtual bool isImageConvertable () const;
436 
437 };
438 
439 } // namespace hippodraw
440 
441 #endif // _DataRep_H_
#define MDL_HIPPOPLOT_API
Definition: libhippo.h:36
Part of an implementation of the Observable-Observer pattern based on the example in the GOF Patterns...
Definition: Observable.h:39
unsigned int i
std::string m_name
The name of the display as it might be displayed in a GUI.
Definition: DataRep.h:76
DataRep * m_parent_datarep
There are times when a given DataRep results from some operations performed on some other DataRep...
Definition: DataRep.h:99
A transform that transforms coordinates from one coordinate system to another.
Definition: TransformBase.h:35
A derived class of PointRepBase class that draws a representation of a cut range. ...
Definition: CutRangeRep.h:29
column
The column indices for 2 dimension data point tuple.
The class expresses a cut on a DataSource, i.e.
Definition: TupleCut.h:43
Value
A few common colors.
Definition: Color.h:51
RepBase * m_rep
The representation used for drawing each data point in the view.
Definition: DataRep.h:94
return yes
Definition: CanvasView.cxx:883
A Color class for creating the color object following the standard RGB color space.
Definition: Color.h:37
The base class for data representations.
Definition: DataRep.h:68
std::string m_title
The title of the object.
Definition: DataRep.h:82
numeric::array clone(numeric::array arr)
Definition: num_util.cpp:412
Observable class interface.
ViewBase * v
Definition: PlotTable.cxx:104
intp size(numeric::array arr)
Definition: num_util.cpp:296
Color class interface.
CutRangeRep * m_cut_rep
The representation of the cut or highlighted range.
Definition: DataRep.h:103
The AxisModelBase class maintains the Range and scaling of an axis.
Definition: AxisModelBase.h:33
The namespace for axes.
Part of an implementation of the Observable Observer pattern based on the example implementation in t...
Definition: Observer.h:34
A DataSource class implemented with std::vector&lt;double&gt; to store the column data. ...
Definition: NTuple.h:33
The base class for the Projector hierarchy.
Definition: ProjectorBase.h:56
The abstract base class for views.
Definition: ViewBase.h:62
ProjectorBase * m_projector
A projector used to transform data to projected values that will be plotted.
Definition: DataRep.h:90
hippodraw::TupleCut class interface
hippodraw::Range class interface
Expresses a range of values.
Definition: Range.h:33
Type
Axes constants.
Definition: AxesType.h:31
The base class for the point representation hierarchy.
Definition: RepBase.h:45
Observer class interface.
Base class for DataSource.
Definition: DataSource.h:55

Generated for HippoDraw Class Library by doxygen