00001
00013 #ifndef _DisplayController_H_
00014 #define _DisplayController_H_
00015
00016 #include "axes/AxesType.h"
00017
00018 #ifdef _MSC_VER
00019 #include <msdevstudio/MSconfig.h>
00020 #endif
00021
00022 #include "pattern/libhippo.h"
00023
00024 #include <list>
00025 #include <vector>
00026
00027 class AxisModelBase;
00028 class DataRep;
00029 class DataSource;
00030 class LineDataRep;
00031 class NTuple;
00032 class NTupleProjector;
00033 class PlotterBase;
00034 class ProjectorBase;
00035 class Range;
00036 class XYTransform;
00037 class ViewBase;
00038 class ViewFactory;
00039
00040 using std::vector;
00041
00063 class MDL_HIPPOPLOT_API DisplayController
00064 {
00065
00066 private:
00067
00069 static DisplayController * s_instance;
00070
00074 std::string m_null_string;
00075
00078 std::vector< std::string > m_null_vector;
00079
00083 PlotterBase * createPlotter ( const DataRep * rep ) const;
00084
00090 void fixLogIfBinned ( const PlotterBase *, DataRep * rep ) const;
00091
00094 NTupleProjector * getBindingProjector ( const PlotterBase * ) const;
00095
00100 DataRep * getUniqueWithNTupleBindings ( const PlotterBase * plotter );
00101
00103 ProjectorBase * getProjector ( const PlotterBase * display ) const;
00104
00107 bool isCompatible ( const PlotterBase * plotter,
00108 const std::string & reptype ) const;
00109
00116 void setBinner ( const PlotterBase * plotter,
00117 DataRep * rep, hippodraw::Axes::Type axis ) const;
00118
00120 void setBinner ( PlotterBase * plotter,
00121 hippodraw::Axes::Type axis,
00122 AxisModelBase * model );
00123
00128 void setAxisModel ( PlotterBase * plotter,
00129 hippodraw::Axes::Type axis,
00130 const std::string & type );
00131
00133 DisplayController ( const DisplayController & );
00134
00137 DisplayController();
00138
00139 public:
00140
00142 static DisplayController * instance ();
00143
00145 ~DisplayController();
00146
00150 const std::string & getDataSourceName ( const PlotterBase * plotter,
00151 int index );
00152
00154 const std::vector < std::string > & getDisplayTypes () const;
00155
00158 void setValueTransform ( PlotterBase * plotter, int index );
00159
00163 void setValueTransform ( PlotterBase * plotter, int index,
00164 const std::vector < std :: string > & usr_models,
00165 const std::vector < double > & brk_points,
00166 const std::vector < double > & flat_widths,
00167 const std::vector < double > & color_scales);
00168
00171 const std::vector <double> & getValueBrkPt ( PlotterBase * plotter);
00172
00175 void setValueBrkPt ( PlotterBase * plotter,
00176 const std::vector < double > & sv);
00177
00178
00182 int getValueTransformIndex ( PlotterBase * plotter );
00183
00186 const std::vector < std::string > & getValueTransformTypes () const;
00187
00193 bool hasControlPoints ( const PlotterBase * plotter ) const;
00194
00196 const std::vector < std::string > & getTextTypes () const;
00197
00204 PlotterBase *
00205 createDisplay ( const std::string & name );
00206
00213 PlotterBase *
00214 createDisplay ( const std::string & name,
00215 const DataSource & tuple,
00216 const std::vector< std::string > & bindings ) const;
00217
00220 const std::string & getType ( const PlotterBase * plotter,
00221 int index ) const;
00222
00227 int getNumberOfEntries ( const PlotterBase * plotter, int index = 0 ) const;
00228
00234 double getAverage ( const PlotterBase * plotter,
00235 const std::string & axis, int index = 0 ) const;
00236
00242 double getAverage ( const PlotterBase * plotter,
00243 hippodraw::Axes::Type axis, int index = 0 ) const;
00244
00248 double getRMS ( const PlotterBase * plotter,
00249 const std::string & axis, int index = 0 ) const;
00250
00254 double getRMS ( const PlotterBase * plotter,
00255 hippodraw::Axes::Type axis, int index = 0 ) const;
00256
00265 void setRepresentation ( PlotterBase * plotter,
00266 const std::string & point_rep );
00267
00270 unsigned int getRepStyle ( const PlotterBase * plotter ) const;
00271
00274 void addDataRep ( PlotterBase *, DataRep * ) const;
00275
00278 void stackDataRep ( PlotterBase *, DataRep * ) const;
00279
00287 DataRep * addDataRep ( PlotterBase * plotter,
00288 const std::string & name,
00289 const DataSource * ntuple,
00290 const std::vector< std::string > & bindings ) const;
00291
00299 DataRep *
00300 addDataRepStacked ( PlotterBase * plotter,
00301 const std::string & name,
00302 const DataSource * ntuple,
00303 const std::vector < std::string > & bindings ) const;
00304
00307 LineDataRep * addLineRep ( PlotterBase *,
00308 const std::string & axis,
00309 double value );
00310
00313 LineDataRep * addLineRep ( PlotterBase *,
00314 hippodraw::Axes::Type,
00315 double value );
00316
00321 void setErrorDisplayed ( const PlotterBase *,
00322 hippodraw::Axes::Type axis, bool state ) const;
00323
00326 void addTextViewToList ( std::vector < const ViewBase * > & dest,
00327 const std::vector < const ViewBase * > & src );
00329 void removeTextObservers ( const std::vector < const ViewBase * > & views );
00330
00333 DataRep * createTextDataRep ( const std::string & type,
00334 const std::string & text = std::string() );
00335
00341 ViewBase * createTextView ( const ViewFactory * factory,
00342 DataRep * rep,
00343 const std::string & name,
00344 const std::string & text = std::string () );
00345
00352 ViewBase * createTextView ( const ViewFactory * factory,
00353 PlotterBase * plotter,
00354 const std::string & name,
00355 const std::string & text = 0);
00356
00360 PlotterBase * createTextPlotter ( DataRep * datarep,
00361 const std::string & name,
00362 const std::string & text = std::string() );
00363
00368 int activeDataRepIndex ( const PlotterBase * plotter ) const;
00369
00375 DataRep * activeDataRep ( const PlotterBase * plotter ) const;
00376
00381 void setActiveDataRepIndex ( PlotterBase * plotter,
00382 int index );
00383
00386 bool hasNTupleBindings ( const PlotterBase * plotter, int index );
00387
00390 bool areDataSourcesSaved ( const PlotterBase * );
00391
00396 const DataSource * getNTuple ( const PlotterBase * ) const;
00397
00402 DataSource * getNTuple ( const PlotterBase *, int index );
00403
00406 const std::vector < std::string > &
00407 getDataSourceLabels ( const PlotterBase * plotter, int index );
00408
00411 void setNTuple ( PlotterBase * , const NTuple * ) const;
00412
00415 const std::vector < std::string > &
00416 bindingOptions ( const std::string & type );
00417
00420 const std::vector < std::string > &
00421 bindingOptions ( const PlotterBase * plottter, int index );
00422
00426 const std::vector< std::string > &
00427 axisBindings ( const PlotterBase * plotter ) const;
00428
00432 const std::vector< std::string > &
00433 axisBindings ( const PlotterBase * plotter, int index ) const;
00434
00438 void setAxisBinding ( PlotterBase *,
00439 const std::string & axis,
00440 const std::string & label );
00441
00443 void setAxisBindings ( PlotterBase * plotter,
00444 const std::vector< std::string > & labels ) const;
00445
00449 bool isDataValid ( const PlotterBase * ) const;
00450
00454 bool isDataValid ( const DataRep * ) const;
00455
00458 bool getLog ( const PlotterBase * plotter, const std::string & axis ) const;
00459
00462 bool getLog ( const PlotterBase * plotter,
00463 hippodraw::Axes::Type axis ) const;
00464
00469 void setLog ( PlotterBase * plotter,
00470 const std::string & axis,
00471 bool flag );
00472
00481 void setLog ( PlotterBase * plotter,
00482 hippodraw::Axes::Type axis,
00483 bool flag );
00484
00490 void setLog ( PlotterBase * plotter,
00491 hippodraw::Axes::Type axis,
00492 bool flag,
00493 XYTransform * transform );
00494
00496 void setTransform ( PlotterBase * plotter,
00497 const std::string & name );
00498
00500 void setTransform ( PlotterBase * plotter,
00501 const std::string & x,
00502 const std::string & y );
00503
00505 void setTransform ( PlotterBase * plotter,
00506 const std::string & x,
00507 const std::string & y,
00508 const std::string & z );
00509
00511 void remove ( PlotterBase * );
00512
00514 float pointSize ( const PlotterBase * ) const;
00515
00519 bool hasSymbolRep ( const PlotterBase * plotter ) const;
00520
00524 bool hasLineRep ( const PlotterBase * plotter ) const;
00525
00526
00528 void setRepSize ( PlotterBase * plotter, float size );
00529
00532 void setIntervalCount ( const PlotterBase * plotter,
00533 unsigned int count );
00534
00537 void setIntervalEnabled ( const PlotterBase * plotter, bool yes );
00538
00541 void setAllIntervalEnabled ( const PlotterBase * plotter, bool yes );
00542
00544 void setRange ( PlotterBase * plotter,
00545 hippodraw::Axes::Type axis,
00546 const Range & range );
00547
00555 void setBinWidth ( PlotterBase * plotter,
00556 const std::string & axis,
00557 double width );
00558
00570 void setBinWidth ( PlotterBase * plotter,
00571 hippodraw::Axes::Type axis,
00572 double width );
00573
00576 void setBinWidth ( DataRep * datarep,
00577 hippodraw::Axes::Type axis,
00578 double width );
00579
00583 void setBinWidth ( PlotterBase * plotter,
00584 const std::string & axis,
00585 int parm,
00586 bool dragging );
00587
00589 void setOffset ( PlotterBase * plotter,
00590 const std::string & axis,
00591 int parm,
00592 bool dragging );
00593
00595 void setOffset ( PlotterBase * plotter,
00596 hippodraw::Axes::Type axis,
00597 double offset );
00598
00602 bool isAxisBinned ( PlotterBase * display, const std::string & axis );
00603
00609 void createNTuple ( const PlotterBase * plotter );
00610
00611 };
00612
00613 #endif // _DisplayController_H_