ROOT  6.06/09
Reference Guide
TArc.cxx
Go to the documentation of this file.
1 // @(#)root/graf:$Id$
2 // Author: Rene Brun 16/10/95
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2000, 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 #include "Riostream.h"
13 #include "TROOT.h"
14 #include "TArc.h"
15 #include "TVirtualPad.h"
16 
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 
32 TArc::TArc(): TEllipse()
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 
80 {
81  TArc *newarc = new TArc(x1, y1, r1, phimin, phimax);
82  TAttLine::Copy(*newarc);
83  TAttFill::Copy(*newarc);
84  newarc->SetBit(kCanDelete);
85  newarc->AppendPad(option);
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
Definition: TEllipse.h:47
const char Option_t
Definition: RtypesCore.h:62
Double_t fY1
Definition: TEllipse.h:48
void Copy(TAttLine &attline) const
Copy this line attributes to a new TAttLine.
Definition: TAttLine.cxx:159
#define gROOT
Definition: TROOT.h:340
void Copy(TAttFill &attfill) const
Copy this fill attributes to a new TAttFill.
Definition: TAttFill.cxx:197
void Copy(TObject &arc) const
Copy this arc to arc.
Definition: TArc.cxx:71
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition: TObject.cxx:732
virtual void AppendPad(Option_t *option="")
Append graphics object to current pad.
Definition: TObject.cxx:164
virtual ~TArc()
Arc default destructor.
Definition: TArc.cxx:64
void Class()
Definition: Class.C:29
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:257
char * out
Definition: TBase64.cxx:29
Double_t fR1
Definition: TEllipse.h:49
Double_t fPhimax
Definition: TEllipse.h:52
Create an Arc.
Definition: TArc.h:29
unsigned int r1[N_CITIES]
Definition: simanTSP.cxx:321
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:229
static const double x1[5]
#define ClassImp(name)
Definition: Rtypes.h:279
double Double_t
Definition: RtypesCore.h:55
Draw Ellipses.
Definition: TEllipse.h:44
Bool_t GetNoEdges() const
Return kTRUE if kNoEdges bit is set, kFALSE otherwise.
Definition: TEllipse.cxx:610
Mother of all ROOT objects.
Definition: TObject.h:58
void Copy(TObject &ellipse) const
Copy this ellipse to ellipse.
Definition: TEllipse.cxx:109
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
Definition: TEllipse.h:51