ROOT  6.06/09
Reference Guide
TColorWheel.h
Go to the documentation of this file.
1 // @(#)root/gpad:$Id$
2 // Author: Rene Brun 10/03/2007
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT_TColorWheel
13 #define ROOT_TColorWheel
14 
15 
16 //////////////////////////////////////////////////////////////////////////
17 // //
18 // TColorWheel //
19 // //
20 // Utility class to draw the recommended color palette //
21 // //
22 //////////////////////////////////////////////////////////////////////////
23 
24 #ifndef ROOT_TNamed
25 #include "TNamed.h"
26 #endif
27 
28 class TCanvas;
29 class TArc;
30 class TLine;
31 class TText;
32 class TGraph;
33 
34 class TColorWheel : public TNamed {
35 
36 private:
37  Double_t fRmin; //Minimum radius for rectangles
38  Double_t fRmax; //Maximum radius for rectangles
39  Double_t fR0; //Minimum radius for circles
40  Double_t fDr; //Circles radius
41  Double_t fRgray; //Maximum radius of gray circle
42  Double_t fX[15]; //X coordinates of the center of circles
43  Double_t fY[15]; //Y coordinates of the center of circles
44  TCanvas *fCanvas; //! Canvas used to draw the Color Wheel
45  TArc *fArc; //! pointer to utility arc
46  TLine *fLine; //! pointer to utility line
47  TText *fText; //! pointer to utility text
48  TGraph *fGraph; //! pointer to utility graph
49 
50  TColorWheel(const TColorWheel &org); // no copy, use TObject::Clone()
51  TColorWheel &operator=(const TColorWheel &rhs); // idem
52 
53 protected:
54  Int_t InCircles(Double_t x, Double_t y, Int_t coffset, Double_t angle) const;
55  Int_t InGray(Double_t x, Double_t y) const;
56  Int_t InRectangles(Double_t x, Double_t y, Int_t coffset, Double_t angle) const;
57  void PaintCircle(Int_t coffset,Int_t n,Double_t x, Double_t y, Double_t ang) const;
58  void PaintCircles(Int_t coffset, Double_t angle) const ;
59  void PaintGray() const;
60  void PaintRectangles(Int_t coffset, Double_t angle) const;
61  void Rotate(Double_t x, Double_t y, Double_t &u, Double_t &v, Double_t ang) const;
62 
63 public:
64  TColorWheel();
65  virtual ~TColorWheel();
66  virtual Int_t DistancetoPrimitive(Int_t px, Int_t py);
67  virtual void Draw(Option_t *option="");
68  TCanvas *GetCanvas() const {return fCanvas;}
69  virtual Int_t GetColor(Int_t px, Int_t py) const;
70  virtual char *GetObjectInfo(Int_t px, Int_t py) const;
71  virtual void Paint(Option_t *option="");
72  virtual void SetCanvas(TCanvas *can) {fCanvas = can;}
73 
74  ClassDef(TColorWheel,1) //The ROOT Color Wheel
75 };
76 
77 #endif
78 
Int_t InCircles(Double_t x, Double_t y, Int_t coffset, Double_t angle) const
Return the color number when the mouse point to a circle.
Int_t InGray(Double_t x, Double_t y) const
Return the color number when the mouse point to the gray circle.
Int_t InRectangles(Double_t x, Double_t y, Int_t coffset, Double_t angle) const
Return the color number when the mouse point to a rectangle.
void Rotate(Double_t x, Double_t y, Double_t &u, Double_t &v, Double_t ang) const
Rotate point x,y with an angle=ang.
const char Option_t
Definition: RtypesCore.h:62
void PaintCircles(Int_t coffset, Double_t angle) const
Draw all colors of type circle.
TLine * fLine
pointer to utility arc
Definition: TColorWheel.h:46
Double_t fY[15]
Definition: TColorWheel.h:43
virtual ~TColorWheel()
destructor
Definition: TColorWheel.cxx:97
int Int_t
Definition: RtypesCore.h:41
void PaintRectangles(Int_t coffset, Double_t angle) const
Draw all colors of type rectangle.
Double_t fRgray
Definition: TColorWheel.h:41
void PaintGray() const
Draw the gray colors + white + black.
Double_t x[n]
Definition: legend1.C:17
#define ClassDef(name, id)
Definition: Rtypes.h:254
virtual void Draw(Option_t *option="")
Paint the color wheel.
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:33
virtual void SetCanvas(TCanvas *can)
Definition: TColorWheel.h:72
TCanvas * GetCanvas() const
Definition: TColorWheel.h:68
TColorWheel & operator=(const TColorWheel &rhs)
Base class for several text objects.
Definition: TText.h:42
TCanvas * fCanvas
Definition: TColorWheel.h:44
Create an Arc.
Definition: TArc.h:29
SVector< double, 2 > v
Definition: Dict.h:5
virtual void Paint(Option_t *option="")
Paint the color wheel.
virtual Int_t GetColor(Int_t px, Int_t py) const
Return the color number pointed by the mouse.
Double_t fRmin
Definition: TColorWheel.h:37
A simple line.
Definition: TLine.h:41
virtual char * GetObjectInfo(Int_t px, Int_t py) const
Return the color number pointed by the mouse.
Double_t fRmax
Definition: TColorWheel.h:38
The Canvas class.
Definition: TCanvas.h:48
double Double_t
Definition: RtypesCore.h:55
Double_t y[n]
Definition: legend1.C:17
void PaintCircle(Int_t coffset, Int_t n, Double_t x, Double_t y, Double_t ang) const
Draw one color of type circle.
Double_t fR0
Definition: TColorWheel.h:39
#define org(otri, vertexptr)
Definition: triangle.c:1037
A Graph is a graphics object made of two arrays X and Y with npoints each.
Definition: TGraph.h:53
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
always return the color wheel
TGraph * fGraph
pointer to utility text
Definition: TColorWheel.h:48
Double_t fDr
Definition: TColorWheel.h:40
TArc * fArc
Canvas used to draw the Color Wheel.
Definition: TColorWheel.h:45
const Int_t n
Definition: legend1.C:16
Draw the ROOT Color Wheel.
Definition: TColorWheel.h:34
Double_t fX[15]
Definition: TColorWheel.h:42
TText * fText
pointer to utility line
Definition: TColorWheel.h:47