forked from root-project/root
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TArc.cxx
113 lines (85 loc) · 3.18 KB
/
TArc.cxx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
// @(#)root/graf:$Id$
// Author: Rene Brun 16/10/95
/*************************************************************************
* 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 "Riostream.h"
#include "TROOT.h"
#include "TArc.h"
#include "TVirtualPad.h"
ClassImp(TArc)
//______________________________________________________________________________
//
// An arc is specified with the position of its centre, its radius
// a minimum and maximum angle.
// The attributes of the outline line are given via TAttLine
// The attributes of the fill area are given via TAttFill
//
////////////////////////////////////////////////////////////////////////////////
/// Arc default constructor.
TArc::TArc(): TEllipse()
{
}
////////////////////////////////////////////////////////////////////////////////
/// Arc normal constructor.
///
/// x1,y1 : coordinates of centre of arc
/// r1 : arc radius
/// phimin : min and max angle in degrees (default is 0-->360)
/// phimax :
///
/// When a circle sector only is drawn, the lines connecting the center
/// of the arc to the edges are drawn by default. One can specify
/// the drawing option "only" to not draw these lines.
TArc::TArc(Double_t x1, Double_t y1,Double_t r1,Double_t phimin,Double_t phimax)
:TEllipse(x1,y1,r1,r1,phimin,phimax,0)
{
}
////////////////////////////////////////////////////////////////////////////////
/// Copy constructor.
TArc::TArc(const TArc &arc) : TEllipse(arc)
{
((TArc&)arc).Copy(*this);
}
////////////////////////////////////////////////////////////////////////////////
/// Arc default destructor.
TArc::~TArc()
{
}
////////////////////////////////////////////////////////////////////////////////
/// Copy this arc to arc.
void TArc::Copy(TObject &arc) const
{
TEllipse::Copy(arc);
}
////////////////////////////////////////////////////////////////////////////////
/// Draw this arc with new coordinates.
void TArc::DrawArc(Double_t x1, Double_t y1,Double_t r1,Double_t phimin,Double_t phimax,Option_t *option)
{
TArc *newarc = new TArc(x1, y1, r1, phimin, phimax);
TAttLine::Copy(*newarc);
TAttFill::Copy(*newarc);
newarc->SetBit(kCanDelete);
newarc->AppendPad(option);
}
////////////////////////////////////////////////////////////////////////////////
/// Save primitive as a C++ statement(s) on output stream out
void TArc::SavePrimitive(std::ostream &out, Option_t * /*= ""*/)
{
out<<" "<<std::endl;
if (gROOT->ClassSaved(TArc::Class())) {
out<<" ";
} else {
out<<" TArc *";
}
out<<"arc = new TArc("<<fX1<<","<<fY1<<","<<fR1
<<","<<fPhimin<<","<<fPhimax<<");"<<std::endl;
SaveFillAttributes(out,"arc",0,1001);
SaveLineAttributes(out,"arc",1,1,1);
if (GetNoEdges()) out<<" arc->SetNoEdges();"<<std::endl;
out<<" arc->Draw();"<<std::endl;
}