00001
00002
00014 #ifndef _QtDisplay_H_
00015 #define _QtDisplay_H_
00016
00017 #include "axes/AxesType.h"
00018
00019 #include <vector>
00020 #include <map>
00021
00022 namespace boost {
00023 namespace python {
00024 class list;
00025 class tuple;
00026 }
00027 }
00028
00029 namespace hippodraw {
00030
00031 class DataRep;
00032 class Observer;
00033 class PyFunctionRep;
00034 class PyDataRep;
00035 class PyDataSource;
00036 class PyFunctionRep;
00037 class PlotterBase;
00038 #ifndef BOOST_DEFECT
00039 class FunctionBase;
00040 #endif
00041 class RepBase;
00042 class DataSource;
00043 class NTuple;
00044 class PyNTuple;
00045 class QtRootNTuple;
00046
00071 class QtDisplay
00072 {
00073
00074 private:
00075
00078 mutable std::vector< PyDataRep * > m_pyDataReps;
00079
00081 std::map<std::string, std::pair <double, double> > m_ranges;
00082
00084 std::map<std::string, double > m_binWidths;
00085
00090 void createDisplay ( const std::string & type,
00091 const DataSource & nt,
00092 const std::vector < std::string > & bindings );
00093
00094 protected:
00095
00097 PlotterBase * m_plotter;
00098
00100 QtDisplay ();
00101
00102 public:
00103
00106 QtDisplay ( const std::string & type );
00107
00110 QtDisplay ( PyFunctionRep * rep );
00111
00115 QtDisplay ( const std::string & type,
00116 const DataSource & nt,
00117 const std::vector< std::string > & bindings );
00118
00123 QtDisplay ( const std::string & type,
00124 const PyDataSource & nt,
00125 const std::vector< std::string > & bindings );
00126
00131 QtDisplay ( const std::string & type,
00132 const QtRootNTuple & nt,
00133 const std::vector< std::string > & bindings );
00134
00138 QtDisplay ( const std::string & type,
00139 const QtRootNTuple & nt,
00140 const std::vector< std::string > & bindings,
00141 boost::python::list indices );
00142
00146 QtDisplay ( const std::string & type,
00147 boost::python::tuple,
00148 const std::vector < std::string > & bindings );
00149
00153 QtDisplay ( const std::string & type,
00154 boost::python::list,
00155 const std::vector < std::string > & bindings );
00156
00158 QtDisplay (PlotterBase * plotter);
00159
00160 ~QtDisplay();
00161
00163 PlotterBase * display();
00164
00174 void addDataRep ( const std::string & type,
00175 const DataSource * ntuple,
00176 const std::vector < std::string > & bindings );
00177
00181 void addDataRepStacked ( const std::string & type,
00182 const DataSource * ntuple,
00183 const std::vector < std::string > & bindings );
00184
00186 void addDataRep ( PyDataRep * pyRep );
00187
00189 void addDataRep ( PyFunctionRep * pyFuncRep );
00190
00191 #ifndef BOOST_DEFECT
00192
00193 void addFunction ( FunctionBase * function );
00194 #endif
00195
00197 PyDataRep * getDataRep ();
00198
00200 const std::vector<PyDataRep *> &getDataReps () const;
00201
00204 void setTitle ( const std::string & title );
00205
00207 const std::string &getTitle() const;
00208
00211 void setLabel ( const std::string & axis, const std::string & label );
00212
00214 const std::string & getLabel( const std::string &axis) const;
00215
00217 void setNumberOfBins ( const std::string & axis, unsigned int number );
00218
00220 double getBinWidth ( const std::string & axis ) const;
00221
00223 void setBinWidth ( const std::string & axis, double width,
00224 bool save=false );
00225
00228 void setBinWidth ( const std::string & axis, double width );
00229
00231 void setOffset ( const std::string & axis, double offset );
00232
00234 void setRange ( const std::string & axis, double low, double high,
00235 bool save=false );
00236
00239 void setRange ( const std::string & axis, double low, double high );
00240
00242 std::vector<double> getRange ( const std::string & axis );
00243
00248 int saveView ();
00249
00251 void setView ( int index );
00252
00258 int nextView ( bool stepForward = true );
00259
00261 int numViews ();
00262
00264 void deleteView( int index );
00265
00267 int currentView ();
00268
00270 void setAutoRanging ( const std::string & axis, bool flag );
00271
00274 void setLog ( const std::string & axis, int flag );
00275
00277 int getLog ( const std::string & axis );
00278
00280 void setTransform ( const std::string & name );
00281
00284 void setPointRep ( RepBase * rep );
00285
00287 void setContourLevels ( const std::vector<double> &levels );
00288
00291 void setAspectRatio ( double ratio );
00292
00295 void reset();
00296
00298 void addValues ( const std::vector < double > & v );
00299
00302 PyNTuple * createNTuple () const;
00303
00305 double numberOfEntries () const;
00306
00309 void resize();
00310
00316 int plotterId() const;
00317
00319 void setColorMap ( const std::string & name );
00320
00326 void update ();
00327
00330 void addObserver ( hippodraw::Observer * observer );
00331
00334 void setTicks ( const std::string & axis,
00335 const std::vector < double > & values,
00336 const std::vector < std::string > & labels );
00337
00340 void setAutoTicks ( const std::string & axis, bool yes );
00341
00343 void unlock();
00344
00349 void applyCut ( QtDisplay * cut );
00350
00356 void applyCuts ( const std::vector < QtDisplay * > & cuts );
00357
00358
00361 PyDataSource * createDataArray() const;
00362
00363 };
00364
00365 }
00366
00367 #endif // _QtDisplay_H_