Logo ROOT   6.08/07
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 #ifndef ROOT_TNamed
17 #include "TNamed.h"
18 #endif
19 
20 class TCanvas;
21 class TArc;
22 class TLine;
23 class TText;
24 class TGraph;
25 
26 class TColorWheel : public TNamed {
27 
28 private:
29  Double_t fRmin; ///<Minimum radius for rectangles
30  Double_t fRmax; ///<Maximum radius for rectangles
31  Double_t fR0; ///<Minimum radius for circles
32  Double_t fDr; ///<Circles radius
33  Double_t fRgray; ///<Maximum radius of gray circle
34  Double_t fX[15]; ///<X coordinates of the center of circles
35  Double_t fY[15]; ///<Y coordinates of the center of circles
36  TCanvas *fCanvas; ///<! Canvas used to draw the Color Wheel
37  TArc *fArc; ///<! pointer to utility arc
38  TLine *fLine; ///<! pointer to utility line
39  TText *fText; ///<! pointer to utility text
40  TGraph *fGraph; ///<! pointer to utility graph
41 
42  TColorWheel(const TColorWheel &org); // no copy, use TObject::Clone()
43  TColorWheel &operator=(const TColorWheel &rhs); // idem
44 
45 protected:
46  Int_t InCircles(Double_t x, Double_t y, Int_t coffset, Double_t angle) const;
47  Int_t InGray(Double_t x, Double_t y) const;
48  Int_t InRectangles(Double_t x, Double_t y, Int_t coffset, Double_t angle) const;
49  void PaintCircle(Int_t coffset,Int_t n,Double_t x, Double_t y, Double_t ang) const;
50  void PaintCircles(Int_t coffset, Double_t angle) const ;
51  void PaintGray() const;
52  void PaintRectangles(Int_t coffset, Double_t angle) const;
53  void Rotate(Double_t x, Double_t y, Double_t &u, Double_t &v, Double_t ang) const;
54 
55 public:
56  TColorWheel();
57  virtual ~TColorWheel();
58  virtual Int_t DistancetoPrimitive(Int_t px, Int_t py);
59  virtual void Draw(Option_t *option="");
60  TCanvas *GetCanvas() const {return fCanvas;}
61  virtual Int_t GetColor(Int_t px, Int_t py) const;
62  virtual char *GetObjectInfo(Int_t px, Int_t py) const;
63  virtual void Paint(Option_t *option="");
64  virtual void SetCanvas(TCanvas *can) {fCanvas = can;}
65 
66  ClassDef(TColorWheel,1) //The ROOT Color Wheel
67 };
68 
69 #endif
70 
virtual char * GetObjectInfo(Int_t px, Int_t py) const
Return the color number pointed by the mouse.
const char Option_t
Definition: RtypesCore.h:62
TLine * fLine
! pointer to utility line
Definition: TColorWheel.h:38
Double_t fY[15]
Y coordinates of the center of circles.
Definition: TColorWheel.h:35
void PaintGray() const
Draw the gray colors + white + black.
virtual ~TColorWheel()
destructor
Definition: TColorWheel.cxx:97
int Int_t
Definition: RtypesCore.h:41
Int_t InGray(Double_t x, Double_t y) const
Return the color number when the mouse point to the gray circle.
Double_t fRgray
Maximum radius of gray circle.
Definition: TColorWheel.h:33
Double_t x[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.
#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:64
TColorWheel & operator=(const TColorWheel &rhs)
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.
Base class for several text objects.
Definition: TText.h:33
TCanvas * fCanvas
! Canvas used to draw the Color Wheel
Definition: TColorWheel.h:36
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.
Create an Arc.
Definition: TArc.h:29
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.
SVector< double, 2 > v
Definition: Dict.h:5
void PaintRectangles(Int_t coffset, Double_t angle) const
Draw all colors of type rectangle.
void PaintCircles(Int_t coffset, Double_t angle) const
Draw all colors of type circle.
virtual void Paint(Option_t *option="")
Paint the color wheel.
Double_t fRmin
Minimum radius for rectangles.
Definition: TColorWheel.h:29
A simple line.
Definition: TLine.h:33
virtual Int_t GetColor(Int_t px, Int_t py) const
Return the color number pointed by the mouse.
Double_t fRmax
Maximum radius for rectangles.
Definition: TColorWheel.h:30
The Canvas class.
Definition: TCanvas.h:41
double Double_t
Definition: RtypesCore.h:55
Double_t y[n]
Definition: legend1.C:17
Double_t fR0
Minimum radius for circles.
Definition: TColorWheel.h:31
#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 graph
Definition: TColorWheel.h:40
Double_t fDr
Circles radius.
Definition: TColorWheel.h:32
TArc * fArc
! pointer to utility arc
Definition: TColorWheel.h:37
TCanvas * GetCanvas() const
Definition: TColorWheel.h:60
const Int_t n
Definition: legend1.C:16
Draw the ROOT Color Wheel.
Definition: TColorWheel.h:26
Double_t fX[15]
X coordinates of the center of circles.
Definition: TColorWheel.h:34
TColorWheel()
constructor
Definition: TColorWheel.cxx:63
TText * fText
! pointer to utility text
Definition: TColorWheel.h:39