ROOT logo
// @(#)root/gpad:$Id: TColorWheel.h 20882 2007-11-19 11:31:26Z rdm $
// Author: Rene Brun   10/03/2007

/*************************************************************************
 * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

#ifndef ROOT_TColorWheel
#define ROOT_TColorWheel


//////////////////////////////////////////////////////////////////////////
//                                                                      //
// TColorWheel                                                          //
//                                                                      //
//  Utility class to draw the recommended color palette                 //
//                                                                      //
//////////////////////////////////////////////////////////////////////////

#ifndef ROOT_TNamed
#include "TNamed.h"
#endif

class TCanvas;
class TArc;
class TLine;
class TText;
class TGraph;

class TColorWheel : public TNamed {

private:
   Double_t  fRmin;     //Minimum radius for rectangles
   Double_t  fRmax;     //Maximum radius for rectangles
   Double_t  fR0;       //Minimum radius for circles
   Double_t  fDr;       //Circles radius
   Double_t  fRgray;    //Maximum radius of gray circle
   Double_t  fX[15];    //X coordinates of the center of circles
   Double_t  fY[15];    //Y coordinates of the center of circles
   TCanvas  *fCanvas;   //! Canvas used to draw the Color Wheel
   TArc     *fArc;      //! pointer to utility arc
   TLine    *fLine;     //! pointer to utility line
   TText    *fText;     //! pointer to utility text
   TGraph   *fGraph;    //! pointer to utility graph
      
   TColorWheel(const TColorWheel &org);             // no copy, use TObject::Clone()
   TColorWheel &operator=(const TColorWheel &rhs);  // idem

protected:
   Int_t InCircles(Double_t x, Double_t y, Int_t coffset, Double_t angle) const;
   Int_t InGray(Double_t x, Double_t y) const;
   Int_t InRectangles(Double_t x, Double_t y, Int_t coffset, Double_t angle) const;
   void  PaintCircle(Int_t coffset,Int_t n,Double_t x, Double_t y, Double_t ang) const;
   void  PaintCircles(Int_t coffset, Double_t angle) const ;
   void  PaintGray() const;
   void  PaintRectangles(Int_t coffset, Double_t angle) const; 
   void  Rotate(Double_t x, Double_t y, Double_t &u, Double_t &v, Double_t ang) const;

public:
   TColorWheel();
   virtual  ~TColorWheel();
   virtual  Int_t DistancetoPrimitive(Int_t px, Int_t py);
   virtual  void  Draw(Option_t *option="");
   TCanvas *GetCanvas() const {return fCanvas;}
   virtual  Int_t GetColor(Int_t px, Int_t py) const;
   virtual  char *GetObjectInfo(Int_t px, Int_t py) const;
   virtual  void  Paint(Option_t *option="");
   virtual  void  SetCanvas(TCanvas *can) {fCanvas = can;}

   ClassDef(TColorWheel,1)  //The ROOT Color Wheel
};

#endif

 TColorWheel.h:1
 TColorWheel.h:2
 TColorWheel.h:3
 TColorWheel.h:4
 TColorWheel.h:5
 TColorWheel.h:6
 TColorWheel.h:7
 TColorWheel.h:8
 TColorWheel.h:9
 TColorWheel.h:10
 TColorWheel.h:11
 TColorWheel.h:12
 TColorWheel.h:13
 TColorWheel.h:14
 TColorWheel.h:15
 TColorWheel.h:16
 TColorWheel.h:17
 TColorWheel.h:18
 TColorWheel.h:19
 TColorWheel.h:20
 TColorWheel.h:21
 TColorWheel.h:22
 TColorWheel.h:23
 TColorWheel.h:24
 TColorWheel.h:25
 TColorWheel.h:26
 TColorWheel.h:27
 TColorWheel.h:28
 TColorWheel.h:29
 TColorWheel.h:30
 TColorWheel.h:31
 TColorWheel.h:32
 TColorWheel.h:33
 TColorWheel.h:34
 TColorWheel.h:35
 TColorWheel.h:36
 TColorWheel.h:37
 TColorWheel.h:38
 TColorWheel.h:39
 TColorWheel.h:40
 TColorWheel.h:41
 TColorWheel.h:42
 TColorWheel.h:43
 TColorWheel.h:44
 TColorWheel.h:45
 TColorWheel.h:46
 TColorWheel.h:47
 TColorWheel.h:48
 TColorWheel.h:49
 TColorWheel.h:50
 TColorWheel.h:51
 TColorWheel.h:52
 TColorWheel.h:53
 TColorWheel.h:54
 TColorWheel.h:55
 TColorWheel.h:56
 TColorWheel.h:57
 TColorWheel.h:58
 TColorWheel.h:59
 TColorWheel.h:60
 TColorWheel.h:61
 TColorWheel.h:62
 TColorWheel.h:63
 TColorWheel.h:64
 TColorWheel.h:65
 TColorWheel.h:66
 TColorWheel.h:67
 TColorWheel.h:68
 TColorWheel.h:69
 TColorWheel.h:70
 TColorWheel.h:71
 TColorWheel.h:72
 TColorWheel.h:73
 TColorWheel.h:74
 TColorWheel.h:75
 TColorWheel.h:76
 TColorWheel.h:77
 TColorWheel.h:78