ROOT   6.14/05 Reference Guide
TArc.cxx
Go to the documentation of this file.
1 // @(#)root/graf:$Id$
2 // Author: Rene Brun 16/10/95
3
4 /*************************************************************************
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. * 9 * For the list of contributors see$ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11
12 #include "Riostream.h"
13 #include "TROOT.h"
14 #include "TArc.h"
16
17 ClassImp(TArc);
18
19 /** \class TArc
20 \ingroup BasicGraphics
21
22 Create an Arc.
23
24 An arc is specified with the position of its centre, its radius a minimum and
25 maximum angle. The attributes of the outline line are given via TAttLine. The
26 attributes of the fill area are given via TAttFill
27 */
28
29 ////////////////////////////////////////////////////////////////////////////////
30 /// Arc default constructor.
31
33 {
34 }
35
36 ////////////////////////////////////////////////////////////////////////////////
37 /// Arc normal constructor.
38 ///
39 /// \param[in] x1,y1 coordinates of centre of arc
40 /// \param[in] r1 arc radius
41 /// \param[in] phimin min angle in degrees (default is 0-->360)
42 /// \param[in] phimax max angle in degrees (default is 0-->360)
43 ///
44 /// When a circle sector only is drawn, the lines connecting the center
45 /// of the arc to the edges are drawn by default. One can specify
46 /// the drawing option "only" to not draw these lines.
47
49  :TEllipse(x1,y1,r1,r1,phimin,phimax,0)
50 {
51 }
52
53 ////////////////////////////////////////////////////////////////////////////////
54 /// Copy constructor.
55
56 TArc::TArc(const TArc &arc) : TEllipse(arc)
57 {
58  ((TArc&)arc).Copy(*this);
59 }
60
61 ////////////////////////////////////////////////////////////////////////////////
62 /// Arc default destructor.
63
65 {
66 }
67
68 ////////////////////////////////////////////////////////////////////////////////
69 /// Copy this arc to arc.
70
71 void TArc::Copy(TObject &arc) const
72 {
73  TEllipse::Copy(arc);
74 }
75
76 ////////////////////////////////////////////////////////////////////////////////
77 /// Draw this arc with new coordinates.
78
79 void TArc::DrawArc(Double_t x1, Double_t y1,Double_t r1,Double_t phimin,Double_t phimax,Option_t *option)
80 {
81  TArc *newarc = new TArc(x1, y1, r1, phimin, phimax);
82  TAttLine::Copy(*newarc);
83  TAttFill::Copy(*newarc);
84  newarc->SetBit(kCanDelete);
86 }
87
88 ////////////////////////////////////////////////////////////////////////////////
89 /// Save primitive as a C++ statement(s) on output stream out
90
91 void TArc::SavePrimitive(std::ostream &out, Option_t * /*= ""*/)
92 {
93  out<<" "<<std::endl;
94  if (gROOT->ClassSaved(TArc::Class())) {
95  out<<" ";
96  } else {
97  out<<" TArc *";
98  }
99  out<<"arc = new TArc("<<fX1<<","<<fY1<<","<<fR1
100  <<","<<fPhimin<<","<<fPhimax<<");"<<std::endl;
101
102  SaveFillAttributes(out,"arc",0,1001);
103  SaveLineAttributes(out,"arc",1,1,1);
104
105  if (GetNoEdges()) out<<" arc->SetNoEdges();"<<std::endl;
106
107  out<<" arc->Draw();"<<std::endl;
108 }
virtual void DrawArc(Double_t x1, Double_t y1, Double_t radius, Double_t phimin=0, Double_t phimax=360, Option_t *option="")
Draw this arc with new coordinates.
Definition: TArc.cxx:79
Double_t fX1
X coordinate of centre.
Definition: TEllipse.h:27
const char Option_t
Definition: RtypesCore.h:62
Double_t fY1
Y coordinate of centre.
Definition: TEllipse.h:28
#define gROOT
Definition: TROOT.h:410
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition: TObject.cxx:694
if object in a list can be deleted
Definition: TObject.h:58
Append graphics object to current pad.
Definition: TObject.cxx:105
virtual ~TArc()
Arc default destructor.
Definition: TArc.cxx:64
void Class()
Definition: Class.C:29
void Copy(TAttLine &attline) const
Copy this line attributes to a new TAttLine.
Definition: TAttLine.cxx:164
virtual void SaveLineAttributes(std::ostream &out, const char *name, Int_t coldef=1, Int_t stydef=1, Int_t widdef=1)
Save line attributes as C++ statement(s) on output stream out.
Definition: TAttLine.cxx:262
void Copy(TObject &arc) const
Copy this arc to arc.
Definition: TArc.cxx:71
Double_t fR1
Definition: TEllipse.h:29
Double_t fPhimax
Maximum angle (degrees)
Definition: TEllipse.h:32
Create an Arc.
Definition: TArc.h:28
virtual void SaveFillAttributes(std::ostream &out, const char *name, Int_t coldef=1, Int_t stydef=1001)
Save fill attributes as C++ statement(s) on output stream out.
Definition: TAttFill.cxx:233
static const double x1[5]
#define ClassImp(name)
Definition: Rtypes.h:359
double Double_t
Definition: RtypesCore.h:55
Draw Ellipses.
Definition: TEllipse.h:24
Mother of all ROOT objects.
Definition: TObject.h:37
void Copy(TObject &ellipse) const
Copy this ellipse to ellipse.
Definition: TEllipse.cxx:108
Bool_t GetNoEdges() const
Return kTRUE if kNoEdges bit is set, kFALSE otherwise.
Definition: TEllipse.cxx:609
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save primitive as a C++ statement(s) on output stream out.
Definition: TArc.cxx:91
Double_t fPhimin
Minimum angle (degrees)
Definition: TEllipse.h:31
TArc()
Arc default constructor.
Definition: TArc.cxx:32
void Copy(TAttFill &attfill) const
Copy this fill attributes to a new TAttFill.
Definition: TAttFill.cxx:201