00001
00002
00014 #ifndef _XyPlotter_H_
00015 #define _XyPlotter_H_
00016
00017 #include "PlotterBase.h"
00018
00019 namespace hippodraw {
00020
00021 class AxisRepBase;
00022 class CompositePlotter;
00023
00044 class MDL_HIPPOPLOT_API XyPlotter : public PlotterBase
00045 {
00046 private:
00047
00049 double m_margin_top;
00050 double m_margin_bottom;
00051 double m_margin_left;
00052 double m_margin_z;
00053
00054
00058 typedef std::vector < CompositePlotter * > PlotterList_t;
00059
00063 PlotterList_t m_plotters;
00064
00067 int m_active_index;
00068
00071 bool view_change_allowed;
00072
00076 std::vector < unsigned int > m_hammer_shape;
00077 std::vector < unsigned int > m_lambert_shape;
00078
00082 void checkAutoScale ();
00083
00087 void prepareToDraw ();
00088
00092 bool m_need_update;
00093
00094
00095 protected:
00096
00099 CompositePlotter * m_plotter;
00100
00104 AxisRepBase * m_axis_rep;
00105
00108 double m_z_ratio;
00109
00112 TupleCut * getCutAt ( unsigned int i );
00113
00114 public:
00115
00117 XyPlotter ( const std::string & name = "XyPlotter" );
00118
00120 XyPlotter ( const XyPlotter & plotter );
00121
00123 virtual ~XyPlotter ();
00124
00127 PlotterBase * clone();
00128
00129
00132 virtual void setEnableZ ( bool yes = true );
00133
00134 virtual void drawIn ( ViewBase * view );
00135
00140 virtual void drawCrossHairs ( ViewBase * view );
00141
00142 virtual NTuple * createNTuple () const;
00143
00146 virtual bool wantsPixmap ( ) const;
00147
00151 void setLabelFont( FontBase* font, Axes::Type axes );
00152
00157 virtual FontBase* labelFont ( Axes::Type axes ) const;
00158
00160 void setTitleFont( FontBase* font );
00161
00165 virtual const FontBase * titleFont ( ) const;
00166
00173 virtual void setActivePlot ( int index, bool redraw );
00174
00177 virtual int activePlotIndex () const;
00178
00182 virtual void addDataRep ( DataRep * rep );
00183
00188 virtual void addDataRepStacked ( DataRep * rep );
00189
00192 virtual void removeDataRep ( DataRep * rep );
00193
00199 virtual void autoScale ( );
00200
00205 virtual void setValueRep ( BinToColor * rep );
00206
00210 virtual void setAutoRanging ( bool flag );
00211
00216 virtual void setAutoRanging ( Axes::Type axis, bool flag );
00217
00220 virtual void setReverse ( bool flag );
00221
00224 virtual void setShowGrid ( bool flag );
00225
00228 virtual bool getShowGrid ();
00229
00232 virtual void setBoxEdge(bool flag);
00233
00236 virtual bool getBoxEdge();
00237
00240 virtual void setTransform ( TransformBase * );
00241
00244 virtual void setFitsTransform ( const std::string & );
00245
00258 virtual NTuple * createPickTuple ();
00259
00274 virtual void fillPickedPointFrom ( double mx, double my,
00275 std::vector < double > & picked ) const;
00276
00279 virtual void setLowRange ( Axes::Type axis, int parm,
00280 bool dragging );
00281
00284 virtual void setHighRange ( Axes::Type axis, int parm,
00285 bool dragging );
00286
00289 virtual void setScaling ( Axes::Type axis, bool on = true );
00290
00297 virtual double getAspectRatio () const;
00298
00299 virtual void update ();
00300
00304 virtual void setRepresentation ( RepBase * pointrep );
00305
00308 virtual RepBase * representation ( ) const;
00309
00313 virtual AxisModelBase * getAxisModel ( Axes::Type axis ) const;
00314
00318 virtual void setAxisModel ( AxisModelBase * , Axes::Type );
00319
00322 virtual void setErrorDisplay ( Axes::Type axis, bool );
00323
00326 virtual bool errorDisplay ( Axes::Type axis ) const;
00327
00330 virtual void setRepColor ( const Color & );
00331
00334 virtual const Color & repColor () const;
00335
00341 virtual void drawProjValues ( ViewBase * view );
00342
00345 bool hasAutoScaled () const;
00346
00350 virtual bool hasNTupleBindings () const;
00351
00355 virtual bool hasZoomY () const;
00356
00359 virtual void checkAxisScaling ();
00360
00363 virtual ProjectorBase * getProjector ( int i ) const;
00364
00367 virtual ProjectorBase * activeProjector () const;
00368
00371 virtual DataRep * getDataRep ( int index ) const;
00372
00375 virtual DataRep * getTarget ( ) const;
00376
00379 bool isTargetable () const;
00380
00384 virtual int getNumDataReps () const;
00385
00388 virtual int indexOf ( const DataRep * ) const;
00389
00392 virtual double getBinWidth ( Axes::Type ) const;
00393
00398 virtual void setBinWidth ( Axes::Type axis, double width );
00399
00401 virtual void reset ( );
00402
00407 virtual const Range & getRange ( Axes::Type axis,
00408 bool scaled ) const;
00409
00412 virtual double getPosRange ( Axes::Type axis ) const;
00413
00417 virtual double getOffset (Axes::Type axis) const;
00418
00421 virtual TransformBase * getTransform () const;
00422
00425 virtual TransformBase * getFitsTransform () const;
00426
00432 virtual void addValues ( const std::vector < double > & v );
00433
00434 virtual const std::string &
00435 getInternalLabel ( Axes::Type axis ) const;
00436
00439 virtual const std::string & getLabel ( Axes::Type ) const;
00440
00443 virtual void setLabel ( Axes::Type, const std::string & value );
00444
00447 virtual int getNumberOfEntries () const;
00448
00451 virtual bool hasAxis ( Axes::Type axis ) const;
00452
00457 virtual const BinToColor * getValueRep () const;
00458
00462 virtual bool isAutoRanging ( Axes::Type axis ) const;
00463
00466 virtual bool isReverse ( ) const;
00467
00472 virtual void matrixTranspose ( bool yes );
00473
00477 virtual DataRep * selectedDataRep () const;
00478
00481 virtual void setAutoTicks ( Axes::Type axis, bool yes );
00482
00485 virtual void setTicks ( Axes::Type axis,
00486 const std::vector < AxisTick > & ticks );
00487
00492 virtual void setNumberOfBins ( Axes::Type axis,
00493 unsigned int number );
00494
00499 virtual void setOffset ( Axes::Type axis, double offset );
00500
00511 virtual void setRange ( Axes::Type axis, const Range & range,
00512 bool scaled = false, bool adjust_width = true );
00513
00517 void fillCutList ( std::vector < const TupleCut * > & cuts ) const;
00518
00521 virtual void setCutRangeAt ( const Range & range, unsigned int i );
00522
00526 virtual Range getCutRange ();
00527
00530 virtual void setCutInverted ( unsigned int i, bool yes = true );
00531
00534 virtual void setCutEnabled ( unsigned int i, bool yes = true );
00535
00536
00537 const std::vector <double> & getZValues();
00538 const std::vector <unsigned int> & getShape();
00539
00541 virtual bool getCutInversion ();
00542
00545 virtual void setMinEntries( int entries );
00546
00549 virtual int getMinEntries ();
00550
00553 virtual void setNeedUpdate(bool isChanged);
00554
00559 virtual bool isImageConvertable () const;
00560
00562 virtual void setTopMargin( double top );
00563 virtual void setBottomMargin( double bottom );
00564 virtual void setLeftMargin( double left );
00565 virtual void setZMargin( double z );
00566
00567 virtual double getTopMargin();
00568 virtual double getBottomMargin();
00569 virtual double getLeftMargin();
00570 virtual double getZMargin();
00571
00574 virtual void setScaleFactor ( Axes::Type axis, double factor );
00575
00578 virtual double getScaleFactor ( Axes::Type axis ) const;
00579
00582 virtual bool isAxisScaled ( Axes::Type axis ) const;
00583
00584 };
00585
00586 }
00587
00588 #endif // _XyPlotter_H_