Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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-2021, 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#include "TNamed.h"
16
17class TCanvas;
18class TArc;
19class TLine;
20class TText;
21class TGraph;
22
23class TColorWheel : public TNamed {
24
25private:
26 Double_t fRmin{0.}; ///<Minimum radius for rectangles
27 Double_t fRmax{0.}; ///<Maximum radius for rectangles
28 Double_t fR0{0.}; ///<Minimum radius for circles
29 Double_t fDr{0.}; ///<Circles radius
30 Double_t fRgray{0.}; ///<Maximum radius of gray circle
31 Double_t fX[15]; ///<X coordinates of the center of circles
32 Double_t fY[15]; ///<Y coordinates of the center of circles
33 TCanvas *fCanvas{nullptr}; ///<! Canvas used to draw the Color Wheel
34 TArc *fArc{nullptr}; ///<! pointer to utility arc
35 TLine *fLine{nullptr}; ///<! pointer to utility line
36 TText *fText{nullptr}; ///<! pointer to utility text
37 TGraph *fGraph{nullptr}; ///<! pointer to utility graph
38
39 TColorWheel(const TColorWheel &) = delete;
40 TColorWheel &operator=(const TColorWheel &) = delete;
41
42protected:
46 void PaintCircle(Int_t coffset,Int_t n,Double_t x, Double_t y, Double_t ang) const;
47 void PaintCircles(Int_t coffset, Double_t angle) const ;
48 void PaintGray() const;
49 void PaintRectangles(Int_t coffset, Double_t angle) const;
50 void Rotate(Double_t x, Double_t y, Double_t &u, Double_t &v, Double_t ang) const;
51
52public:
54 virtual ~TColorWheel();
55 Int_t DistancetoPrimitive(Int_t px, Int_t py) override;
56 void Draw(Option_t *option = "") override;
57 TCanvas *GetCanvas() const { return fCanvas; }
58 virtual Int_t GetColor(Int_t px, Int_t py) const;
59 char *GetObjectInfo(Int_t px, Int_t py) const override;
60 void Paint(Option_t *option = "") override;
61 virtual void SetCanvas(TCanvas *can) { fCanvas = can; }
62
63 ClassDefOverride(TColorWheel,1) //The ROOT Color Wheel
64};
65
66#endif
67
int Int_t
Definition RtypesCore.h:45
const char Option_t
Definition RtypesCore.h:66
#define ClassDefOverride(name, id)
Definition Rtypes.h:341
Option_t Option_t option
Option_t Option_t TPoint TPoint angle
Create an Arc.
Definition TArc.h:26
The Canvas class.
Definition TCanvas.h:23
Draw the ROOT Color Wheel.
Definition TColorWheel.h:23
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.
TCanvas * fCanvas
! Canvas used to draw the Color Wheel
Definition TColorWheel.h:33
TArc * fArc
! pointer to utility arc
Definition TColorWheel.h:34
TLine * fLine
! pointer to utility line
Definition TColorWheel.h:35
Double_t fRgray
Maximum radius of gray circle.
Definition TColorWheel.h:30
TColorWheel(const TColorWheel &)=delete
void PaintCircle(Int_t coffset, Int_t n, Double_t x, Double_t y, Double_t ang) const
Draw one color of type circle.
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.
Double_t fR0
Minimum radius for circles.
Definition TColorWheel.h:28
Double_t fY[15]
Y coordinates of the center of circles.
Definition TColorWheel.h:32
virtual void SetCanvas(TCanvas *can)
Definition TColorWheel.h:61
TColorWheel()
constructor
Int_t InGray(Double_t x, Double_t y) const
Return the color number when the mouse point to the gray circle.
TColorWheel & operator=(const TColorWheel &)=delete
Double_t fX[15]
X coordinates of the center of circles.
Definition TColorWheel.h:31
virtual Int_t GetColor(Int_t px, Int_t py) const
Return the color number pointed by the mouse.
Double_t fRmin
Minimum radius for rectangles.
Definition TColorWheel.h:26
virtual ~TColorWheel()
destructor
TCanvas * GetCanvas() const
Definition TColorWheel.h:57
TText * fText
! pointer to utility text
Definition TColorWheel.h:36
Double_t fRmax
Maximum radius for rectangles.
Definition TColorWheel.h:27
void PaintGray() const
Draw the gray colors + white + black.
char * GetObjectInfo(Int_t px, Int_t py) const override
Return the color number pointed by the mouse.
void Paint(Option_t *option="") override
Paint the color wheel.
void PaintCircles(Int_t coffset, Double_t angle) const
Draw all colors of type circle.
Double_t fDr
Circles radius.
Definition TColorWheel.h:29
void PaintRectangles(Int_t coffset, Double_t angle) const
Draw all colors of type rectangle.
Int_t DistancetoPrimitive(Int_t px, Int_t py) override
always return the color wheel
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.
TGraph * fGraph
! pointer to utility graph
Definition TColorWheel.h:37
A TGraph is an object made of two arrays X and Y with npoints each.
Definition TGraph.h:41
Use the TLine constructor to create a simple line.
Definition TLine.h:22
The TNamed class is the base class for all named ROOT classes.
Definition TNamed.h:29
Base class for several text objects.
Definition TText.h:22
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
const Int_t n
Definition legend1.C:16
th1 Draw()