TArc.cxx

Go to the documentation of this file.
00001 // @(#)root/graf:$Id: TArc.cxx 20882 2007-11-19 11:31:26Z rdm $
00002 // Author: Rene Brun   16/10/95
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010  *************************************************************************/
00011 
00012 #include "Riostream.h"
00013 #include "TROOT.h"
00014 #include "TArc.h"
00015 #include "TVirtualPad.h"
00016 
00017 ClassImp(TArc)
00018 
00019 //______________________________________________________________________________
00020 //
00021 //  An arc is specified with the position of its centre, its radius
00022 //  a minimum and maximum angle.
00023 //  The attributes of the outline line are given via TAttLine
00024 //  The attributes of the fill area are given via TAttFill
00025 //
00026 
00027 
00028 //______________________________________________________________________________
00029 TArc::TArc(): TEllipse()
00030 {
00031   // Arc  default constructor.
00032 }
00033 
00034 
00035 //______________________________________________________________________________
00036 TArc::TArc(Double_t x1, Double_t y1,Double_t r1,Double_t phimin,Double_t phimax)
00037       :TEllipse(x1,y1,r1,r1,phimin,phimax,0)
00038 {
00039    // Arc  normal constructor.
00040    //
00041    //  x1,y1  : coordinates of centre of arc
00042    //  r1     : arc radius
00043    //  phimin : min and max angle in degrees (default is 0-->360)
00044    //  phimax :
00045    //
00046    //  When a circle sector only is drawn, the lines connecting the center
00047    //  of the arc to the edges are drawn by default. One can specify
00048    //  the drawing option "only" to not draw these lines.
00049 }
00050 
00051 
00052 //______________________________________________________________________________
00053 TArc::TArc(const TArc &arc) : TEllipse(arc)
00054 {
00055    // Copy constructor.
00056 
00057    ((TArc&)arc).Copy(*this);
00058 }
00059 
00060 
00061 //______________________________________________________________________________
00062 TArc::~TArc()
00063 {
00064    // Arc default destructor.
00065 }
00066 
00067 
00068 //______________________________________________________________________________
00069 void TArc::Copy(TObject &arc) const
00070 {
00071    // Copy this arc to arc.
00072 
00073    TEllipse::Copy(arc);
00074 }
00075 
00076 
00077 //______________________________________________________________________________
00078 void TArc::DrawArc(Double_t x1, Double_t y1,Double_t r1,Double_t phimin,Double_t phimax,Option_t *option)
00079 {
00080    // Draw this arc with new coordinates.
00081 
00082    TArc *newarc = new TArc(x1, y1, r1, phimin, phimax);
00083    TAttLine::Copy(*newarc);
00084    TAttFill::Copy(*newarc);
00085    newarc->SetBit(kCanDelete);
00086    newarc->AppendPad(option);
00087 }
00088 
00089 
00090 //______________________________________________________________________________
00091 void TArc::SavePrimitive(ostream &out, Option_t * /*= ""*/)
00092 {
00093    // Save primitive as a C++ statement(s) on output stream out
00094 
00095    out<<"   "<<endl;
00096    if (gROOT->ClassSaved(TArc::Class())) {
00097       out<<"   ";
00098    } else {
00099       out<<"   TArc *";
00100    }
00101    out<<"arc = new TArc("<<fX1<<","<<fY1<<","<<fR1
00102       <<","<<fPhimin<<","<<fPhimax<<");"<<endl;
00103 
00104    SaveFillAttributes(out,"arc",0,1001);
00105    SaveLineAttributes(out,"arc",1,1,1);
00106 
00107    if (GetNoEdges()) out<<"   arc->SetNoEdges();"<<endl;
00108 
00109    out<<"   arc->Draw();"<<endl;
00110 }

Generated on Tue Jul 5 14:14:27 2011 for ROOT_528-00b_version by  doxygen 1.5.1