ROOT logo
/*************************************************************************
 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

#include <TPieSlice.h>

#include <Riostream.h>
#include <TError.h>
#include <TROOT.h>
#include <TVirtualPad.h>
#include <TArc.h>
#include <TMath.h>
#include <TStyle.h>
#include <TLatex.h>
#include <TPaveText.h>
#include <TH1.h>

ClassImp(TPieSlice)


//______________________________________________________________________________
//
// A slice of a piechart, see the TPie class.
//
// This class describe the property of single
//


//______________________________________________________________________________
TPieSlice::TPieSlice() : TNamed(), TAttFill(), TAttLine()
{
   // This is the default constructor, used to create the standard.

   fPie = 0;
   fValue = 1;
   fRadiusOffset = 0;
   fIsActive = kFALSE;
}


//______________________________________________________________________________
TPieSlice::TPieSlice(const char *name, const char *title,
                     TPie *pie, Double_t val) :
                     TNamed(name, title), TAttFill(), TAttLine()
{
   // This constructor create a slice with a particular value.

   fPie = pie;
   fValue = val;
   fRadiusOffset = 0;
   fIsActive = kFALSE;
}


//______________________________________________________________________________
Int_t TPieSlice::DistancetoPrimitive(Int_t /*px*/, Int_t /*py*/)
{
   // Eval if the mouse is over the area associated with this slice.

   Int_t dist = 9999;

   if (fIsActive) {
      dist = 0;
      fIsActive = kFALSE;
      gPad->SetCursor(kHand);
   }

   return dist;
}


//______________________________________________________________________________
Double_t TPieSlice::GetRadiusOffset()
{
   // return the value of the offset in radial direction for this slice.

   return fRadiusOffset;
}


//______________________________________________________________________________
Double_t TPieSlice::GetValue()
{
   // Return the value of this slice.

   return fValue;
}


//______________________________________________________________________________
void TPieSlice::SavePrimitive(ostream &/*out*/, Option_t * /*opts*/)
{
   // Do nothing.
}


//______________________________________________________________________________
void TPieSlice::SetRadiusOffset(Double_t val)
{
   // Set the radial offset of this slice.

   fRadiusOffset = val;
   if (fRadiusOffset<.0) fRadiusOffset = .0;
}


//______________________________________________________________________________
void TPieSlice::SetValue(Double_t val)
{
   // Set the value for this slice.
   // Negative values are changed with its absolute value.

   fValue = val;
   if (fValue<.0) {
      Warning("SetValue","Invalid negative value. Absolute value taken");
      fValue *= -1;
   }

   fPie->MakeSlices(kTRUE);
}
 TPieSlice.cxx:1
 TPieSlice.cxx:2
 TPieSlice.cxx:3
 TPieSlice.cxx:4
 TPieSlice.cxx:5
 TPieSlice.cxx:6
 TPieSlice.cxx:7
 TPieSlice.cxx:8
 TPieSlice.cxx:9
 TPieSlice.cxx:10
 TPieSlice.cxx:11
 TPieSlice.cxx:12
 TPieSlice.cxx:13
 TPieSlice.cxx:14
 TPieSlice.cxx:15
 TPieSlice.cxx:16
 TPieSlice.cxx:17
 TPieSlice.cxx:18
 TPieSlice.cxx:19
 TPieSlice.cxx:20
 TPieSlice.cxx:21
 TPieSlice.cxx:22
 TPieSlice.cxx:23
 TPieSlice.cxx:24
 TPieSlice.cxx:25
 TPieSlice.cxx:26
 TPieSlice.cxx:27
 TPieSlice.cxx:28
 TPieSlice.cxx:29
 TPieSlice.cxx:30
 TPieSlice.cxx:31
 TPieSlice.cxx:32
 TPieSlice.cxx:33
 TPieSlice.cxx:34
 TPieSlice.cxx:35
 TPieSlice.cxx:36
 TPieSlice.cxx:37
 TPieSlice.cxx:38
 TPieSlice.cxx:39
 TPieSlice.cxx:40
 TPieSlice.cxx:41
 TPieSlice.cxx:42
 TPieSlice.cxx:43
 TPieSlice.cxx:44
 TPieSlice.cxx:45
 TPieSlice.cxx:46
 TPieSlice.cxx:47
 TPieSlice.cxx:48
 TPieSlice.cxx:49
 TPieSlice.cxx:50
 TPieSlice.cxx:51
 TPieSlice.cxx:52
 TPieSlice.cxx:53
 TPieSlice.cxx:54
 TPieSlice.cxx:55
 TPieSlice.cxx:56
 TPieSlice.cxx:57
 TPieSlice.cxx:58
 TPieSlice.cxx:59
 TPieSlice.cxx:60
 TPieSlice.cxx:61
 TPieSlice.cxx:62
 TPieSlice.cxx:63
 TPieSlice.cxx:64
 TPieSlice.cxx:65
 TPieSlice.cxx:66
 TPieSlice.cxx:67
 TPieSlice.cxx:68
 TPieSlice.cxx:69
 TPieSlice.cxx:70
 TPieSlice.cxx:71
 TPieSlice.cxx:72
 TPieSlice.cxx:73
 TPieSlice.cxx:74
 TPieSlice.cxx:75
 TPieSlice.cxx:76
 TPieSlice.cxx:77
 TPieSlice.cxx:78
 TPieSlice.cxx:79
 TPieSlice.cxx:80
 TPieSlice.cxx:81
 TPieSlice.cxx:82
 TPieSlice.cxx:83
 TPieSlice.cxx:84
 TPieSlice.cxx:85
 TPieSlice.cxx:86
 TPieSlice.cxx:87
 TPieSlice.cxx:88
 TPieSlice.cxx:89
 TPieSlice.cxx:90
 TPieSlice.cxx:91
 TPieSlice.cxx:92
 TPieSlice.cxx:93
 TPieSlice.cxx:94
 TPieSlice.cxx:95
 TPieSlice.cxx:96
 TPieSlice.cxx:97
 TPieSlice.cxx:98
 TPieSlice.cxx:99
 TPieSlice.cxx:100
 TPieSlice.cxx:101
 TPieSlice.cxx:102
 TPieSlice.cxx:103
 TPieSlice.cxx:104
 TPieSlice.cxx:105
 TPieSlice.cxx:106
 TPieSlice.cxx:107
 TPieSlice.cxx:108
 TPieSlice.cxx:109
 TPieSlice.cxx:110
 TPieSlice.cxx:111
 TPieSlice.cxx:112
 TPieSlice.cxx:113
 TPieSlice.cxx:114
 TPieSlice.cxx:115
 TPieSlice.cxx:116
 TPieSlice.cxx:117
 TPieSlice.cxx:118
 TPieSlice.cxx:119
 TPieSlice.cxx:120
 TPieSlice.cxx:121
 TPieSlice.cxx:122
 TPieSlice.cxx:123
 TPieSlice.cxx:124