00001
00002
00014 #ifndef _DataRep_H_
00015 #define _DataRep_H_
00016
00017 #include "pattern/Observable.h"
00018 #include "pattern/Observer.h"
00019
00020 #include "axes/AxesType.h"
00021 #include "axes/Range.h"
00022
00023 #ifdef _MSC_VER
00024 #include "datasrcs/TupleCut.h"
00025 #endif
00026
00027 class AxisModelBase;
00028 class Color;
00029 class DataSource;
00030 class NTuple;
00031 class ProjectorBase;
00032 class RepBase;
00033 class TransformBase;
00034 class TupleCut;
00035 class ViewBase;
00036
00060 class MDL_HIPPOPLOT_API DataRep : public Observable, public hippodraw::Observer
00061 {
00062
00063 protected:
00064
00067 std::string m_name;
00068
00073 std::string m_title;
00074
00081 ProjectorBase * m_projector;
00082
00085 RepBase * m_rep;
00086
00090 DataRep * m_parent_datarep;
00091
00094 RepBase * m_cut_rep;
00095
00098 typedef std::vector < TupleCut > CutList_t;
00099
00103 CutList_t m_cut_list;
00104
00105
00107 DataRep ( );
00108
00110 DataRep ( const DataRep & );
00111
00114 void drawCuts ( TransformBase * transform, ViewBase * view );
00115
00118 void throwRangeException ();
00119
00120 public:
00121
00123 virtual ~DataRep();
00124
00127 virtual DataRep * clone () = 0;
00128
00130 const std::string & name () const;
00131
00139 virtual bool hasAxis ( hippodraw::Axes::Type axis ) const;
00140
00147 void setTitle ( const std::string & title );
00148
00151 const std::string & getTitle () const;
00152
00154 virtual void update ( const Observable * );
00155
00162 virtual bool hasErrorDisplay ( ) const;
00163
00166 virtual bool hasNTupleBindings () const;
00167
00174 virtual void setAxisBinding ( const std::string & axis,
00175 const std::string & label );
00176
00183 virtual
00184 void setAxisBindings ( const std::vector < std::string > & bindings );
00185
00193 virtual void matrixTranspose ( bool yes );
00194
00203 virtual void drawProjectedValues ( TransformBase * transform,
00204 ViewBase * view );
00205
00208 double getPosRange ( hippodraw::Axes::Type axis );
00209
00211 RepBase * getRepresentation () const;
00212
00214 const Color & getRepColor () const;
00215
00218 bool isDirty () const;
00219
00221 bool isErrorDisplayed ( hippodraw::Axes::Type ) const;
00222
00229 Range preferredRange ( hippodraw::Axes::Type axis );
00230
00232 void setAxisModel ( hippodraw::Axes::Type axis, AxisModelBase * );
00233
00236 void setErrorDisplay ( hippodraw::Axes::Type axis, bool );
00237
00243 virtual void setRepresentation ( RepBase * pointrep );
00244
00246 void setRepColor ( const Color & );
00247
00249 void setRepSize ( float size );
00250
00253 void setRepStyle ( int style );
00254
00255
00258 virtual void setDirty ( bool yes = true );
00259
00263 void setRange ( hippodraw::Axes::Type axis, bool const_width = true );
00264
00265
00267 virtual ProjectorBase * getProjector ( ) const;
00268
00273 virtual void setSelected ( bool yes = true );
00274
00278 virtual bool isSelected ( ) const;
00279
00285 virtual bool acceptFunction ( int number );
00286
00289 virtual bool hasZeroRows ( );
00290
00293 virtual bool hasZoomY () const;
00294
00295
00301 virtual void addValues ( const std::vector < double > & v );
00302
00305 virtual const DataSource * getProjectedValues () const;
00306
00309 virtual NTuple * getNTupleAfterCuts () const;
00310
00314 virtual double getMean ( const std::string & axis );
00315
00319 virtual double getRMS ( const std::string & axis );
00320
00324 bool isAxisBinned ( hippodraw::Axes::Type axis ) const;
00325
00327 virtual DataRep * getParentDataRep();
00328
00330 virtual void setParentDataRep( DataRep * parent_datarep );
00331
00337 virtual void update ();
00338
00341 virtual void normalizeTo ( const DataRep * target );
00342
00346 void setBinWidth ( hippodraw::Axes::Type axis, double width );
00347
00350 int getNumberOfEntries () const;
00351
00359 virtual bool isTargetable () const;
00360
00364 NTuple * createNTuple () const;
00365
00369 virtual bool needColorRep() const;
00370
00373 bool hasCut () const;
00374
00377 const std::vector < TupleCut > & getCuts () const;
00378
00381 RepBase * getCutRep ();
00382
00385 void setCutRep ( RepBase * rep );
00386
00389 void setCutRangeAt ( const Range & range, unsigned int i );
00390
00394 void toggleInverted ( unsigned int i );
00395
00398 void setEnabled ( unsigned int i, bool yes = true );
00399
00400 };
00401
00402 #endif // _DataRep_H_