00001
00002
00014 #ifndef _QtDisplay_H_
00015 #define _QtDisplay_H_
00016
00017 #include "axes/AxesType.h"
00018
00019 #include <boost/python.hpp>
00020
00021 #include <vector>
00022 #include <map>
00023
00024 class PyFunctionRep;
00025 class PyDataRep;
00026 class PyDataSource;
00027 class PlotterBase;
00028 #ifndef BOOST_DEFECT
00029 class FunctionBase;
00030 #endif
00031 class RepBase;
00032 class DataSource;
00033 class NTuple;
00034 class DataRep;
00035 namespace hippodraw
00036 {
00037 class Observer;
00038 }
00039 class QtRootNTuple;
00040
00054 class QtDisplay
00055 {
00056
00057 private:
00058
00061 mutable std::vector< PyDataRep * > m_pyDataReps;
00062
00064 std::map<std::string, std::pair <double, double> > m_ranges;
00065
00067 std::map<std::string, double > m_binWidths;
00068
00073 void createDisplay ( const std::string & type,
00074 const DataSource & nt,
00075 const std::vector < std::string > & bindings );
00076
00077 protected:
00078
00080 PlotterBase * m_plotter;
00081
00083 QtDisplay ();
00084
00085 public:
00086
00089 QtDisplay ( const std::string & type );
00090
00094 QtDisplay ( const std::string & type,
00095 const DataSource & nt,
00096 const std::vector< std::string > & bindings );
00097
00102 QtDisplay ( const std::string & type,
00103 const PyDataSource & nt,
00104 const std::vector< std::string > & bindings );
00105
00110 QtDisplay ( const std::string & type,
00111 const QtRootNTuple & nt,
00112 const std::vector< std::string > & bindings );
00113
00117 QtDisplay ( const std::string & type,
00118 const QtRootNTuple & nt,
00119 const std::vector< std::string > & bindings,
00120 boost::python::list indices );
00121
00125 QtDisplay ( const std::string & type,
00126 boost::python::tuple,
00127 const std::vector < std::string > & bindings );
00128
00132 QtDisplay ( const std::string & type,
00133 boost::python::list,
00134 const std::vector < std::string > & bindings );
00135
00137 QtDisplay (PlotterBase * plotter);
00138
00139 ~QtDisplay();
00140
00142 PlotterBase * display();
00143
00153 void addDataRep ( const std::string & type,
00154 const DataSource * ntuple,
00155 const std::vector < std::string > & bindings );
00156
00160 void addDataRepStacked ( const std::string & type,
00161 const DataSource * ntuple,
00162 const std::vector < std::string > & bindings );
00163
00165 void addDataRep ( PyDataRep * pyRep );
00166
00168 void addDataRep ( PyFunctionRep * pyFuncRep );
00169
00170 #ifndef BOOST_DEFECT
00171
00172 void addFunction ( FunctionBase * function );
00173 #endif
00174
00176 PyDataRep * getDataRep ();
00177
00179 const std::vector<PyDataRep *> &getDataReps () const;
00180
00183 void setTitle ( const std::string & title );
00184
00186 const std::string &getTitle() const;
00187
00190 void setLabel ( const std::string & axis, const std::string & label );
00191
00193 const std::string & getLabel( const std::string &axis) const;
00194
00196 void setNumberOfBins ( const std::string & axis, unsigned int number );
00197
00199 double getBinWidth ( const std::string & axis ) const;
00200
00202 void setBinWidth ( const std::string & axis, double width,
00203 bool save=false );
00204
00207 void setBinWidth ( const std::string & axis, double width );
00208
00210 void setOffset ( const std::string & axis, double offset );
00211
00213 void setRange ( const std::string & axis, double low, double high,
00214 bool save=false );
00215
00218 void setRange ( const std::string & axis, double low, double high );
00219
00221 std::vector<double> getRange ( const std::string & axis );
00222
00227 int saveView ();
00228
00230 void setView ( int index );
00231
00237 int nextView ( bool stepForward = true );
00238
00240 int numViews ();
00241
00243 void deleteView( int index );
00244
00246 int currentView ();
00247
00249 void setAutoRanging ( const std::string & axis, bool flag );
00250
00253 void setLog ( const std::string & axis, int flag );
00254
00256 int getLog ( const std::string & axis );
00257
00259 void setTransform ( const std::string & name );
00260
00263 void setPointRep ( RepBase * rep );
00264
00266 void setContourLevels ( const std::vector<double> &levels );
00267
00270 void setAspectRatio ( double ratio );
00271
00274 void reset();
00275
00277 void addValues ( const std::vector < double > & v );
00278
00280 NTuple * createNTuple () const;
00281
00283 double numberOfEntries () const;
00284
00287 void resize();
00288
00294 int plotterId() const;
00295
00297 void setColorMap ( const std::string & name );
00298
00304 void update ();
00305
00308 void addObserver ( hippodraw::Observer * observer );
00309
00312 void setTicks ( const std::string & axis,
00313 const std::vector < double > & values,
00314 const std::vector < std::string > & labels );
00315
00318 void setAutoTicks ( const std::string & axis, bool yes );
00319
00321 void unlock();
00322
00323 #ifdef HAVE_NUMARRAY
00324
00327 PyDataSource * createDataArray() const;
00328
00329 #endif
00330
00331 };
00332
00333 #endif // _QtDisplay_H_