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 #include "graphics/Color.h"
00028
00029 namespace hippodraw {
00030
00031 class AxisModelBase;
00032 class Color;
00033 class CutRangeRep;
00034 class DataSource;
00035 class NTuple;
00036 class ProjectorBase;
00037 class RepBase;
00038 class TransformBase;
00039 class TupleCut;
00040 class ViewBase;
00041
00068 class MDL_HIPPOPLOT_API DataRep
00069 : public Observable, public Observer
00070 {
00071
00072 protected:
00073
00076 std::string m_name;
00077
00082 std::string m_title;
00083
00090 ProjectorBase * m_projector;
00091
00094 RepBase * m_rep;
00095
00099 DataRep * m_parent_datarep;
00100
00103 CutRangeRep * m_cut_rep;
00104
00106 DataRep ( );
00107
00109 DataRep ( const DataRep & );
00110
00113 void drawCuts ( TransformBase * transform, ViewBase * view );
00114
00117 void throwRangeException ();
00118
00119 public:
00120
00122 virtual ~DataRep();
00123
00126 virtual DataRep * clone () = 0;
00127
00129 const std::string & name () const;
00130
00138 virtual bool hasAxis ( Axes::Type axis ) const;
00139
00146 void setTitle ( const std::string & title );
00147
00150 const std::string & getTitle () const;
00151
00153 virtual void update ( const Observable * );
00154
00161 virtual bool hasErrorDisplay ( ) const;
00162
00165 virtual bool hasNTupleBindings () const;
00166
00173 virtual void setAxisBinding ( const std::string & axis,
00174 const std::string & label );
00175
00182 virtual
00183 void setAxisBindings ( const std::vector < std::string > & bindings );
00184
00192 virtual void matrixTranspose ( bool yes );
00193
00202 virtual void drawProjectedValues ( TransformBase * transform,
00203 ViewBase * view );
00204
00207 double getPosRange ( Axes::Type axis );
00208
00210 RepBase * getRepresentation () const;
00211
00213 const Color & getRepColor () const;
00214
00217 bool isDirty () const;
00218
00220 bool isErrorDisplayed ( Axes::Type ) const;
00221
00228 Range preferredRange ( Axes::Type axis ) const;
00229
00231 void setAxisModel ( Axes::Type axis, AxisModelBase * );
00232
00235 void setErrorDisplay ( Axes::Type axis, bool );
00236
00242 virtual void setPointRep ( RepBase * pointrep );
00243
00245 void setRepColor ( const Color & );
00246
00248 void setRepSize ( double size );
00249
00252 void setRepStyle ( int style );
00253
00254
00257 virtual void setDirty ( bool yes = true );
00258
00262 void setRange ( Axes::Type axis, bool const_width = true );
00263
00264
00266 virtual ProjectorBase * getProjector ( ) const;
00267
00272 virtual void setSelected ( bool yes = true );
00273
00277 virtual bool isSelected ( ) const;
00278
00284 virtual bool acceptFunction ( int number );
00285
00288 virtual bool hasZeroRows ( );
00289
00292 virtual bool hasZoomY () const;
00293
00294
00300 virtual void addValues ( const std::vector < double > & v );
00301
00304 virtual const DataSource * getProjectedValues () const;
00305
00308 virtual NTuple * getNTupleAfterCuts () const;
00309
00313 virtual void fillColumnAfterCuts(const std::string & column,
00314 std::vector<double> & columnData) const;
00315
00319 NTuple * createNTupleUnderRegion () const;
00320
00324 virtual double getMean ( const std::string & axis );
00325
00329 virtual double getRMS ( const std::string & axis );
00330
00334 bool isAxisBinned ( Axes::Type axis ) const;
00335
00337 virtual DataRep * getParentDataRep() const;
00338
00340 virtual void setParentDataRep( DataRep * parent_datarep );
00341
00347 virtual void update ();
00348
00351 virtual void normalizeTo ( const DataRep * target );
00352
00356 const Range & setBinWidth ( Axes::Type axis, double width );
00357
00360 int getNumberOfEntries () const;
00361
00369 virtual bool isTargetable () const;
00370
00374 NTuple * createNTuple () const;
00375
00379 virtual bool needColorRep() const;
00380
00384 bool hasCut () const;
00385
00388 void addCut ( const TupleCut & cut );
00389
00392 void addCut ();
00393
00396 void removeCut ();
00397
00400 const std::vector < TupleCut > & getCuts () const;
00401
00404 RepBase * getCutRep ();
00405
00408 void set ( Color::Value value );
00409
00412 void setCutRangeAt ( const Range & range, unsigned int i );
00413
00417 void toggleInverted ( unsigned int i );
00418
00421 void setEnabled ( unsigned int i, bool yes = true );
00422
00428 virtual bool needsMatrixSet () const;
00429
00435 virtual bool isImageConvertable () const;
00436
00437 };
00438
00439 }
00440
00441 #endif // _DataRep_H_