TColorWheel.h

Go to the documentation of this file.
00001 // @(#)root/gpad:$Id: TColorWheel.h 20882 2007-11-19 11:31:26Z rdm $
00002 // Author: Rene Brun   10/03/2007
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010  *************************************************************************/
00011 
00012 #ifndef ROOT_TColorWheel
00013 #define ROOT_TColorWheel
00014 
00015 
00016 //////////////////////////////////////////////////////////////////////////
00017 //                                                                      //
00018 // TColorWheel                                                          //
00019 //                                                                      //
00020 //  Utility class to draw the recommended color palette                 //
00021 //                                                                      //
00022 //////////////////////////////////////////////////////////////////////////
00023 
00024 #ifndef ROOT_TNamed
00025 #include "TNamed.h"
00026 #endif
00027 
00028 class TCanvas;
00029 class TArc;
00030 class TLine;
00031 class TText;
00032 class TGraph;
00033 
00034 class TColorWheel : public TNamed {
00035 
00036 private:
00037    Double_t  fRmin;     //Minimum radius for rectangles
00038    Double_t  fRmax;     //Maximum radius for rectangles
00039    Double_t  fR0;       //Minimum radius for circles
00040    Double_t  fDr;       //Circles radius
00041    Double_t  fRgray;    //Maximum radius of gray circle
00042    Double_t  fX[15];    //X coordinates of the center of circles
00043    Double_t  fY[15];    //Y coordinates of the center of circles
00044    TCanvas  *fCanvas;   //! Canvas used to draw the Color Wheel
00045    TArc     *fArc;      //! pointer to utility arc
00046    TLine    *fLine;     //! pointer to utility line
00047    TText    *fText;     //! pointer to utility text
00048    TGraph   *fGraph;    //! pointer to utility graph
00049       
00050    TColorWheel(const TColorWheel &org);             // no copy, use TObject::Clone()
00051    TColorWheel &operator=(const TColorWheel &rhs);  // idem
00052 
00053 protected:
00054    Int_t InCircles(Double_t x, Double_t y, Int_t coffset, Double_t angle) const;
00055    Int_t InGray(Double_t x, Double_t y) const;
00056    Int_t InRectangles(Double_t x, Double_t y, Int_t coffset, Double_t angle) const;
00057    void  PaintCircle(Int_t coffset,Int_t n,Double_t x, Double_t y, Double_t ang) const;
00058    void  PaintCircles(Int_t coffset, Double_t angle) const ;
00059    void  PaintGray() const;
00060    void  PaintRectangles(Int_t coffset, Double_t angle) const; 
00061    void  Rotate(Double_t x, Double_t y, Double_t &u, Double_t &v, Double_t ang) const;
00062 
00063 public:
00064    TColorWheel();
00065    virtual  ~TColorWheel();
00066    virtual  Int_t DistancetoPrimitive(Int_t px, Int_t py);
00067    virtual  void  Draw(Option_t *option="");
00068    TCanvas *GetCanvas() const {return fCanvas;}
00069    virtual  Int_t GetColor(Int_t px, Int_t py) const;
00070    virtual  char *GetObjectInfo(Int_t px, Int_t py) const;
00071    virtual  void  Paint(Option_t *option="");
00072    virtual  void  SetCanvas(TCanvas *can) {fCanvas = can;}
00073 
00074    ClassDef(TColorWheel,1)  //The ROOT Color Wheel
00075 };
00076 
00077 #endif
00078 

Generated on Tue Jul 5 14:13:55 2011 for ROOT_528-00b_version by  doxygen 1.5.1