Logo ROOT  
Reference Guide
 
Loading...
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/*************************************************************************
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 "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
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
56TArc::TArc(const TArc &arc) : TEllipse(arc)
57{
58 arc.TArc::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);
85 newarc->AppendPad(option);
86 return newarc;
87}
88
89////////////////////////////////////////////////////////////////////////////////
90/// Save primitive as a C++ statement(s) on output stream out
91
92void TArc::SavePrimitive(std::ostream &out, Option_t * /*= ""*/)
93{
94 out<<" "<<std::endl;
95 if (gROOT->ClassSaved(TArc::Class())) {
96 out<<" ";
97 } else {
98 out<<" TArc *";
99 }
100 out<<"arc = new TArc("<<fX1<<","<<fY1<<","<<fR1
101 <<","<<fPhimin<<","<<fPhimax<<");"<<std::endl;
102
103 SaveFillAttributes(out,"arc",0,1001);
104 SaveLineAttributes(out,"arc",1,1,1);
105
106 if (GetNoEdges()) out<<" arc->SetNoEdges();"<<std::endl;
107
108 out<<" arc->Draw();"<<std::endl;
109}
const char Option_t
Definition RtypesCore.h:66
#define ClassImp(name)
Definition Rtypes.h:382
Option_t Option_t option
Option_t Option_t TPoint TPoint const char x1
Option_t Option_t TPoint TPoint const char y1
#define gROOT
Definition TROOT.h:406
Create an Arc.
Definition TArc.h:26
~TArc() override
Arc default destructor.
Definition TArc.cxx:64
static TClass * Class()
TArc()
Arc default constructor.
Definition TArc.cxx:32
virtual TArc * 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 override
Copy this arc to arc.
Definition TArc.cxx:71
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save primitive as a C++ statement(s) on output stream out.
Definition TArc.cxx:92
void Copy(TAttFill &attfill) const
Copy this fill attributes to a new TAttFill.
Definition TAttFill.cxx:207
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:239
void Copy(TAttLine &attline) const
Copy this line attributes to a new TAttLine.
Definition TAttLine.cxx:177
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:275
Draw Ellipses.
Definition TEllipse.h:23
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:646
Double_t fY1
Y coordinate of centre.
Definition TEllipse.h:27
void Copy(TObject &ellipse) const override
Copy this ellipse to ellipse.
Definition TEllipse.cxx:110
Double_t fPhimin
Minimum angle (degrees)
Definition TEllipse.h:30
Double_t fR1
first radius
Definition TEllipse.h:28
Mother of all ROOT objects.
Definition TObject.h:41
virtual void AppendPad(Option_t *option="")
Append graphics object to current pad.
Definition TObject.cxx:202
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition TObject.cxx:798
@ kCanDelete
if object in a list can be deleted
Definition TObject.h:62