00001
00002
00014 #ifndef _CompositePlotter_H_
00015 #define _CompositePlotter_H_
00016
00017 #include "axes/AxesType.h"
00018
00019 #include <vector>
00020
00021 namespace hippodraw {
00022
00023 class AxisRepBase;
00024 class AxisModelBase;
00025 class AxisTick;
00026 class BinToColor;
00027 class DataRep;
00028 class Color;
00029 class NTuple;
00030 class ProjectorBase;
00031 class Range;
00032 class Rect;
00033 class RepBase;
00034 class TransformBase;
00035 class TupleCut;
00036 class ViewBase;
00037
00054 class MDL_HIPPOPLOT_API CompositePlotter
00055 {
00056
00057 protected:
00058
00062 CompositePlotter( const CompositePlotter & plotter );
00063
00072 AxisModelBase * m_x_axis;
00073
00078 AxisModelBase * m_y_axis;
00079
00084 AxisModelBase * m_z_axis;
00085
00091 std::string m_x_label;
00092
00095 std::string m_y_label;
00096
00099 std::string m_z_label;
00100
00103 TransformBase * m_transform;
00104
00107 TransformBase * m_fits_transform;
00108
00112 int m_datarep_index;
00113
00116 typedef std::vector < hippodraw::DataRep * > DataRepList_t;
00117
00119 DataRepList_t m_datareps;
00120
00124 bool m_has_autoscaled;
00125
00128 bool m_show_grid;
00129
00132 bool m_box_edge;
00133
00137 bool m_has_z;
00138
00141 bool m_reverse;
00142
00145 bool isDirty () const;
00146
00152 virtual double getZValue ( double x, double y, bool scaled = true ) const;
00153
00155 void push_back ( hippodraw::DataRep * );
00156
00157 virtual void setRangePrivate ( hippodraw::Axes::Type axis,
00158 const Range & range,
00159 bool scaled = false,
00160 bool adjust_width = true );
00161
00162 public:
00163
00166 CompositePlotter ( );
00167
00170 virtual ~CompositePlotter ();
00171
00174 CompositePlotter * clone ();
00175
00181 virtual void setAllAxisModels ();
00182
00186 bool checkAutoScale ();
00187
00193 virtual void autoScale ( );
00194
00197 void autoScale ( hippodraw::Axes::Type axis );
00198
00202 void autoScaleZ ();
00203
00204 virtual void setRange ( hippodraw::Axes::Type, const Range &,
00205 bool scaled, bool adjust_width );
00206
00207 virtual void setNumberOfBins ( hippodraw::Axes::Type axis,
00208 unsigned int number );
00209
00212 virtual void setRepresentation ( RepBase * pointrep );
00213
00216 virtual RepBase * representation ( ) const;
00217
00218 virtual const BinToColor * getValueRep () const;
00219
00223 virtual void setValueRep ( BinToColor * rep );
00224
00226 virtual ProjectorBase * activeProjector () const;
00227
00230 virtual ProjectorBase * getProjector (int i) const;
00231
00233 virtual int getNumDataReps () const;
00234
00237 virtual hippodraw::DataRep * getParentDataRep ( int index ) const;
00238
00240 virtual hippodraw::DataRep * getParentDataRep () const;
00241
00244 virtual void setParentDataRep ( int index, hippodraw::DataRep * parent );
00245
00247 virtual void setParentDataRep ( hippodraw::DataRep * parent );
00248
00249 virtual hippodraw::DataRep * getDataRep ( int index ) const;
00250
00254 virtual hippodraw::DataRep * selectedDataRep () const;
00255
00258 virtual hippodraw::DataRep * mouseSelectedDataRep () const;
00259
00263 virtual void addDataRep ( hippodraw::DataRep * rep );
00264
00268 virtual bool hasNTupleBindings () const;
00269
00273 virtual bool hasZoomY () const;
00274
00275
00282 virtual int setActivePlot( int index, bool redraw );
00283
00289 virtual int activePlotIndex () const;
00290
00293 virtual void removeDataRep ( hippodraw::DataRep * rep );
00294
00297 virtual void setAxisModel ( AxisModelBase * , hippodraw::Axes::Type );
00298
00301 virtual void setAutoRanging ( bool flag );
00302
00305 virtual void setShowGrid ( bool flag );
00306
00309 virtual bool getShowGrid ();
00310
00313 virtual void setBoxEdge( bool flag );
00314
00317 virtual bool getBoxEdge();
00318
00322 virtual void setErrorDisplay ( hippodraw::Axes::Type axis, bool );
00323
00327 virtual bool errorDisplay ( hippodraw::Axes::Type axis ) const;
00328
00329 virtual void matrixTranspose ( bool yes );
00330
00333 virtual void setRepColor ( const Color & );
00334
00338 virtual const Color & repColor () const;
00339
00347 virtual double getBinWidth (hippodraw::Axes::Type axis) const;
00348
00349 virtual void setOffset ( hippodraw::Axes::Type axis, double offset );
00350
00354 virtual void setBinWidth ( hippodraw::Axes::Type axis, double width );
00355
00357 virtual void reset ();
00358
00359 virtual double getOffset (hippodraw::Axes::Type axis) const;
00360
00365 virtual int getNumberOfEntries () const;
00366
00368 virtual double getPosRange ( hippodraw::Axes::Type axis ) const;
00369
00379 virtual void setTransform ( TransformBase * );
00380
00382 virtual void setFitsTransform ( const std::string & );
00383
00384 virtual void toUserXY ( double mx, double my, bool scaled,
00385 double & ux, double & uy ) const;
00386
00391 virtual NTuple * createNTuple () const;
00392
00405 virtual NTuple * createPickTuple ();
00406
00421 virtual void fillPickedPoint ( double mx, double my,
00422 std::vector < double > & picked ) const;
00423
00425 double processReturnValue ( double retval,
00426 hippodraw::Axes::Type axis,
00427 bool scaled ) const;
00428
00434 virtual void addValues ( const std::vector < double > & v );
00435
00436 virtual void update ();
00437
00440 virtual void setAutoTicks ( hippodraw::Axes::Type axis, bool yes );
00441
00442 virtual void setTicks ( hippodraw::Axes::Type axis,
00443 const std::vector < AxisTick > & ticks );
00444
00445 virtual bool isTargetable () const;
00446 virtual hippodraw::DataRep * getTarget () const;
00447 virtual int indexOf ( const hippodraw::DataRep * rep ) const;
00448 virtual bool hasAxis ( hippodraw::Axes::Type axis ) const;
00449
00452 virtual bool isAxisScaled ( hippodraw::Axes::Type axis ) const;
00453
00454 virtual AxisModelBase * getAxisModel ( hippodraw::Axes::Type axis ) const;
00455
00460 virtual void setAutoRanging ( hippodraw::Axes::Type axis, bool flag );
00461
00462 virtual bool isAutoRanging ( hippodraw::Axes::Type axis ) const;
00463
00466 virtual void setReverse ( bool flag );
00467
00468 virtual bool isReverse ( ) const;
00469
00472 virtual void setLowRange ( hippodraw::Axes::Type axis, int parm,
00473 bool dragging );
00474
00477 virtual void setHighRange ( hippodraw::Axes::Type axis, int parm,
00478 bool dragging );
00479
00480 virtual const Range & getRange ( hippodraw::Axes::Type axis,
00481 bool scaled ) const;
00482 virtual void setScaleFactor ( hippodraw::Axes::Type axis, double factor );
00483
00486 virtual void setScaling ( hippodraw::Axes::Type axis, bool on = true );
00487
00492 void setTitle ( const std::string & title );
00493
00498 const std::string & getTitle () const;
00499
00500 virtual void setLabel ( hippodraw::Axes::Type, const std::string & value );
00501 virtual const std::string & getLabel ( hippodraw::Axes::Type ) const;
00502 virtual const std::string &
00503 getInternalLabel ( hippodraw::Axes::Type axis ) const;
00504
00505 virtual TransformBase * getTransform () const;
00506
00507 virtual TransformBase * getFitsTransform () const;
00508
00515 virtual double getAspectRatio () const;
00516
00519 bool hasAutoScaled () const;
00520
00523 virtual void prepareToDraw ();
00524
00527 Rect calcUserRectangle () const;
00528
00531 Rect calcRawRectangle() const;
00532
00538 virtual void drawProjValues( ViewBase * view );
00539
00545 void drawAxisRep ( AxisRepBase * rep, ViewBase * view,
00546 bool do_y, bool do_z );
00547
00550 virtual void checkAxisScaling ();
00551
00554 void setEnableZ ( bool yes );
00555
00558 void setAutoScaled ( bool flag = true );
00559
00561 void autoScale ( AxisModelBase * model, hippodraw::Axes::Type axis );
00562
00566 void fillCutList ( std::vector < const TupleCut * > & cuts ) const;
00567
00571 virtual void setCutRangeAt ( const Range & range, unsigned int index );
00572
00575 virtual void setMinEntries( int entries );
00576
00577
00580 virtual int getMinEntries ();
00581
00586 bool isImageConvertable () const;
00587
00590 double getScaleFactor ( Axes::Type axis ) const;
00591
00592
00593 private:
00594
00598 void toggleBoxEdge(DataRep* datarep);
00599
00600
00601 };
00602
00603 }
00604
00605 #endif // _CompositePlotter_H_