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 "TArc.h"
13#include "TString.h"
14
15#include <iostream>
16
17
18/** \class TArc
19\ingroup BasicGraphics
20
21Create an Arc.
22
23An arc is specified with the position of its centre, its radius a minimum and
24maximum angle. The attributes of the outline line are given via TAttLine. The
25attributes of the fill area are given via TAttFill
26*/
27
28////////////////////////////////////////////////////////////////////////////////
29/// Arc default constructor.
30
32{
33}
34
35////////////////////////////////////////////////////////////////////////////////
36/// Arc normal constructor.
37///
38/// \param[in] x1,y1 coordinates of centre of arc
39/// \param[in] r1 arc radius
40/// \param[in] phimin min angle in degrees (default is 0-->360)
41/// \param[in] phimax max angle in degrees (default is 0-->360)
42///
43/// When a circle sector only is drawn, the lines connecting the center
44/// of the arc to the edges are drawn by default. One can specify
45/// the drawing option "only" to not draw these lines.
46
48 :TEllipse(x1,y1,r1,r1,phimin,phimax,0)
49{
50}
51
52////////////////////////////////////////////////////////////////////////////////
53/// Copy constructor.
54
55TArc::TArc(const TArc &arc) : TEllipse(arc)
56{
57 arc.TArc::Copy(*this);
58}
59
60////////////////////////////////////////////////////////////////////////////////
61/// Arc default destructor.
62
64{
65}
66
67////////////////////////////////////////////////////////////////////////////////
68/// Copy this arc to arc.
69
70void TArc::Copy(TObject &arc) const
71{
72 TEllipse::Copy(arc);
73}
74
75////////////////////////////////////////////////////////////////////////////////
76/// Draw this arc with new coordinates.
77
79{
80 TArc *newarc = new TArc(x1, y1, r1, phimin, phimax);
81 TAttLine::Copy(*newarc);
82 TAttFill::Copy(*newarc);
83 newarc->SetBit(kCanDelete);
84 newarc->AppendPad(option);
85 return newarc;
86}
87
88////////////////////////////////////////////////////////////////////////////////
89/// Save primitive as a C++ statement(s) on output stream out
90
91void TArc::SavePrimitive(std::ostream &out, Option_t *option)
92{
93 SavePrimitiveConstructor(out, Class(), "arc",
94 TString::Format("%g, %g, %g, %g, %g", fX1, fY1, fR1, fPhimin, fPhimax));
95
96 SaveFillAttributes(out, "arc", 0, 1001);
97 SaveLineAttributes(out, "arc", 1, 1, 1);
98
99 if (GetNoEdges())
100 out << " arc->SetNoEdges();\n";
101
102 SavePrimitiveDraw(out, "arc", option);
103}
double Double_t
Double 8 bytes.
Definition RtypesCore.h:73
const char Option_t
Option string (const char).
Definition RtypesCore.h:80
~TArc() override
Arc default destructor.
Definition TArc.cxx:63
static TClass * Class()
TArc()
Arc default constructor.
Definition TArc.cxx:31
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:78
void Copy(TObject &arc) const override
Copy this arc to arc.
Definition TArc.cxx:70
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save primitive as a C++ statement(s) on output stream out.
Definition TArc.cxx:91
void Copy(TAttFill &attfill) const
virtual void SaveFillAttributes(std::ostream &out, const char *name, Int_t coldef=1, Int_t stydef=1001)
virtual void SaveLineAttributes(std::ostream &out, const char *name, Int_t coldef=1, Int_t stydef=1, Int_t widdef=1)
void Copy(TAttLine &attline) const
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
Double_t fY1
Y coordinate of centre.
Definition TEllipse.h:27
void Copy(TObject &ellipse) const override
Copy this to obj.
Double_t fPhimin
Minimum angle (degrees).
Definition TEllipse.h:30
Double_t fR1
first radius
Definition TEllipse.h:28
virtual void AppendPad(Option_t *option="")
Append graphics object to current pad.
Definition TObject.cxx:204
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition TObject.cxx:888
static void SavePrimitiveDraw(std::ostream &out, const char *variable_name, Option_t *option=nullptr)
Save invocation of primitive Draw() method Skipped if option contains "nodraw" string.
Definition TObject.cxx:845
TObject()
TObject constructor.
Definition TObject.h:259
static void SavePrimitiveConstructor(std::ostream &out, TClass *cl, const char *variable_name, const char *constructor_agrs="", Bool_t empty_line=kTRUE)
Save object constructor in the output stream "out".
Definition TObject.cxx:777
@ kCanDelete
if object in a list can be deleted
Definition TObject.h:71
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
Definition TString.cxx:2385