ROOT   Reference Guide
Searching...
No Matches
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 "TROOT.h"
13#include "TArc.h"
14
15#include <iostream>
16
18
19/** \class TArc
20\ingroup BasicGraphics
21
22Create an Arc.
23
24An arc is specified with the position of its centre, its radius a minimum and
25maximum angle. The attributes of the outline line are given via TAttLine. The
26attributes 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
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
56TArc::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
71void 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);
86}
87
88////////////////////////////////////////////////////////////////////////////////
89/// Save primitive as a C++ statement(s) on output stream out
90
91void 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}
static const double x1[5]
double Double_t
Definition RtypesCore.h:59
const char Option_t
Definition RtypesCore.h:66
#define ClassImp(name)
Definition Rtypes.h:364
#define gROOT
Definition TROOT.h:406
Create an Arc.
Definition TArc.h:26
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save primitive as a C++ statement(s) on output stream out.
Definition TArc.cxx:91
virtual ~TArc()
Arc default destructor.
Definition TArc.cxx:64
TArc()
Arc default constructor.
Definition TArc.cxx:32
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
void Copy(TObject &arc) const
Copy this arc to arc.
Definition TArc.cxx:71
void Copy(TAttFill &attfill) const
Copy this fill attributes to a new TAttFill.
Definition TAttFill.cxx:202
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:234
void Copy(TAttLine &attline) const
Copy this line attributes to a new TAttLine.
Definition TAttLine.cxx:172
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:270
Draw Ellipses.
Definition TEllipse.h:23
void Copy(TObject &ellipse) const
Copy this ellipse to ellipse.
Definition TEllipse.cxx:110
Double_t fPhimax
Maximum angle (degrees)
Definition TEllipse.h:31
Double_t fX1
X coordinate of centre.
Definition TEllipse.h:26
Bool_t GetNoEdges() const
Return kTRUE if kNoEdges bit is set, kFALSE otherwise.
Definition TEllipse.cxx:611
Double_t fY1
Y coordinate of centre.
Definition TEllipse.h:27
Double_t fPhimin
Minimum angle (degrees)
Definition TEllipse.h:30
Double_t fR1