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 
20 A slice of a piechart, see the TPie class.
21 
22 This 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;
33  fIsActive = kFALSE;
34 }
35 
36 ////////////////////////////////////////////////////////////////////////////////
37 /// This constructor create a slice with a particular value.
38 
39 TPieSlice::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;
46  fIsActive = kFALSE;
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;
58  fIsActive = kFALSE;
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 
84 void 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 }
TPieSlice::GetValue
Double_t GetValue()
Return the value of this slice.
Definition: TPieSlice.cxx:76
TPie.h
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:91
TPieSlice::GetRadiusOffset
Double_t GetRadiusOffset()
return the value of the offset in radial direction for this slice.
Definition: TPieSlice.cxx:68
ClassImp
#define ClassImp(name)
Definition: Rtypes.h:364
TPieSlice::DistancetoPrimitive
virtual Int_t DistancetoPrimitive(Int_t, Int_t)
Eval if the mouse is over the area associated with this slice.
Definition: TPieSlice.cxx:52
TPieSlice::fPie
TPie * fPie
The TPie object that contain this slice.
Definition: TPieSlice.h:24
TPie
Definition: TPie.h:23
TPieSlice::SavePrimitive
void SavePrimitive(std::ostream &out, Option_t *opts="")
Do nothing.
Definition: TPieSlice.cxx:84
TPieSlice::fIsActive
Bool_t fIsActive
! True if is the slice under the mouse pointer
Definition: TPieSlice.h:21
ROOT::Math::gv_detail::dist
double dist(Rotation3D const &r1, Rotation3D const &r2)
Definition: 3DDistances.cxx:63
Option_t
const typedef char Option_t
Definition: RtypesCore.h:66
TAttLine
Definition: TAttLine.h:18
TPie::MakeSlices
void MakeSlices(Bool_t force=kFALSE)
Make the slices.
Definition: TPie.cxx:1408
TPieSlice.h
TNamed
Definition: TNamed.h:29
TPieSlice
Definition: TPieSlice.h:18
kFALSE
const Bool_t kFALSE
Definition: RtypesCore.h:92
TPieSlice::SetValue
void SetValue(Double_t)
Set the value for this slice.
Definition: TPieSlice.cxx:101
TVirtualPad.h
TObject::Warning
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
Definition: TObject.cxx:876
kHand
@ kHand
Definition: GuiTypes.h:373
TPieSlice::SetRadiusOffset
void SetRadiusOffset(Double_t)
Set the radial offset of this slice.
Definition: TPieSlice.cxx:91
Double_t
double Double_t
Definition: RtypesCore.h:59
name
char name[80]
Definition: TGX11.cxx:110
gPad
#define gPad
Definition: TVirtualPad.h:287
TPieSlice::fValue
Double_t fValue
value value of this slice
Definition: TPieSlice.h:25
TAttFill
Definition: TAttFill.h:19
TPieSlice::TPieSlice
TPieSlice()
This is the default constructor, used to create the standard.
Definition: TPieSlice.cxx:28
int
TPieSlice::fRadiusOffset
Double_t fRadiusOffset
offset from the center of the pie
Definition: TPieSlice.h:26
TError.h