Logo ROOT  
Reference Guide
TPieSlice.cxx
Go to the documentation of this file.
1/*************************************************************************
2 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
3 * All rights reserved. *
4 * *
5 * For the licensing terms see $ROOTSYS/LICENSE. *
6 * For the list of contributors see $ROOTSYS/README/CREDITS. *
7 *************************************************************************/
8
9#include <TPieSlice.h>
10
11#include <TError.h>
12#include <TVirtualPad.h>
13#include <TPie.h>
14
16
17/** \class TPieSlice
18\ingroup BasicGraphics
19
20A slice of a piechart, see the TPie class.
21
22This class describe the property of single
23*/
24
25////////////////////////////////////////////////////////////////////////////////
26/// This is the default constructor, used to create the standard.
27
29{
30 fPie = 0;
31 fValue = 1;
32 fRadiusOffset = 0;
34}
35
36////////////////////////////////////////////////////////////////////////////////
37/// This constructor create a slice with a particular value.
38
39TPieSlice::TPieSlice(const char *name, const char *title,
40 TPie *pie, Double_t val) :
41 TNamed(name, title), TAttFill(), TAttLine()
42{
43 fPie = pie;
44 fValue = val;
45 fRadiusOffset = 0;
47}
48
49////////////////////////////////////////////////////////////////////////////////
50/// Eval if the mouse is over the area associated with this slice.
51
53{
54 Int_t dist = 9999;
55
56 if (fIsActive) {
57 dist = 0;
59 gPad->SetCursor(kHand);
60 }
61
62 return dist;
63}
64
65////////////////////////////////////////////////////////////////////////////////
66/// return the value of the offset in radial direction for this slice.
67
69{
70 return fRadiusOffset;
71}
72
73////////////////////////////////////////////////////////////////////////////////
74/// Return the value of this slice.
75
77{
78 return fValue;
79}
80
81////////////////////////////////////////////////////////////////////////////////
82/// Do nothing.
83
84void TPieSlice::SavePrimitive(std::ostream &/*out*/, Option_t * /*opts*/)
85{
86}
87
88////////////////////////////////////////////////////////////////////////////////
89/// Set the radial offset of this slice.
90
92{
93 fRadiusOffset = val;
94 if (fRadiusOffset<.0) fRadiusOffset = .0;
95}
96
97////////////////////////////////////////////////////////////////////////////////
98/// Set the value for this slice.
99/// Negative values are changed with its absolute value.
100
102{
103 fValue = val;
104 if (fValue<.0) {
105 Warning("SetValue","Invalid negative value. Absolute value taken");
106 fValue *= -1;
107 }
108
110}
@ kHand
Definition: GuiTypes.h:374
int Int_t
Definition: RtypesCore.h:45
const Bool_t kFALSE
Definition: RtypesCore.h:101
double Double_t
Definition: RtypesCore.h:59
const Bool_t kTRUE
Definition: RtypesCore.h:100
const char Option_t
Definition: RtypesCore.h:66
#define ClassImp(name)
Definition: Rtypes.h:364
char name[80]
Definition: TGX11.cxx:110
#define gPad
Definition: TVirtualPad.h:287
Fill Area Attributes class.
Definition: TAttFill.h:19
Line Attributes class.
Definition: TAttLine.h:18
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:29
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
Definition: TObject.cxx:879
A slice of a piechart, see the TPie class.
Definition: TPieSlice.h:18
Double_t fRadiusOffset
offset from the center of the pie
Definition: TPieSlice.h:26
void SavePrimitive(std::ostream &out, Option_t *opts="")
Do nothing.
Definition: TPieSlice.cxx:84
Double_t fValue
value value of this slice
Definition: TPieSlice.h:25
void SetValue(Double_t)
Set the value for this slice.
Definition: TPieSlice.cxx:101
virtual Int_t DistancetoPrimitive(Int_t, Int_t)
Eval if the mouse is over the area associated with this slice.
Definition: TPieSlice.cxx:52
Bool_t fIsActive
! True if is the slice under the mouse pointer
Definition: TPieSlice.h:21
void SetRadiusOffset(Double_t)
Set the radial offset of this slice.
Definition: TPieSlice.cxx:91
TPieSlice()
This is the default constructor, used to create the standard.
Definition: TPieSlice.cxx:28
Double_t GetRadiusOffset()
return the value of the offset in radial direction for this slice.
Definition: TPieSlice.cxx:68
Double_t GetValue()
Return the value of this slice.
Definition: TPieSlice.cxx:76
TPie * fPie
The TPie object that contain this slice.
Definition: TPieSlice.h:24
Draw a Pie Chart,.
Definition: TPie.h:23
void MakeSlices(Bool_t force=kFALSE)
Make the slices.
Definition: TPie.cxx:1407
double dist(Rotation3D const &r1, Rotation3D const &r2)
Definition: 3DDistances.cxx:48