JG ROOT Tools libraries  version 5.0 - august 2014
RContour.hh
Go to the documentation of this file.
1 //======================================================================
2 /*! \file RContour.hh
3  *
4  * Include file for class RContour
5  */
6 //======================================================================
7 
8 #ifndef R_CONTOUR_HH
9 #define R_CONTOUR_HH
10 
11 #include "RContourBase.hh"
12 #include "GNamed.hh"
13 
14 #include <TAttLine.h>
15 #include <TList.h>
16 
17 #define RCONTOUR_ID "CONTOUR: " ///< Contour identifier in file
18 #define RCONTOUR_NONAME "unnamed " ///< Default contour name
19 
20 //======================================================================
21 /*! \class RContour
22  *
23  * This class defines contour via a pointer to contour properties.
24  */
25 class RContour: virtual public GNamed
26 {
27  //------------------------------------------------------------
28  /*! \object_doc{RContour} */
30  //------------------------------------------------------------
31 
32  public:
33 
34  ///< Contour types identifiers
35  enum CTypes
36  {
37  typeGate = 0,
38  typeEllipse = 10,
39  typeCircle = 11,
40  typePolygon = 20,
41  typeUndefined = -1
42  };
43 
44  protected:
45  RContourBase * contour_ptr; ///< Pointer to contour properties
46  u_int status_flag; ///< Status bit pattern
47 
48  TList * object_list; ///< Pointer to ROOT graphical objects for display
49  TAttLine line_att; ///< Line attributes for display
50 
51  //------------------------------------------------------------
52  // Constructors / affectation / destructor
53  public:
54  RContour ( const string & ct_name = RCONTOUR_NONAME );
55  RContour ( const string & ct_name, const RContourBase & ct_base );
56  RContour ( const string & ct_name, RContourBase * ct_base );
57  RContour ( const RContour & ct, const string &ct_name );
58  RContour ( const RContour & ct );
59 
60  RContour & operator = ( const RContour & ct );
61  RContour & operator = ( const RContourBase & ct_base );
62 
63  virtual ~RContour ( );
64 
65  //------------------------------------------------------------
66  // Static contour creation functions
67 
68  // functions allocating a new contour
69  static RContour * NewContourGate ( const string & ct_name, const Double_t x1, const Double_t x2 );
70 
71  static RContour * NewContourPolygon ( const string & ct_name, const UInt_t n, const RPoint2D *pts );
72  static RContour * NewContourPolygon ( const string & ct_name, const UInt_t n, const Double_t x[], const Double_t y[] );
73 
74  static RContour * NewContourCircle ( const string & ct_name, const RPoint2D ctr, const Double_t r );
75  static RContour * NewContourCircle ( const string & ct_name, const Double_t xc, const Double_t yc, const Double_t r );
76 
77  static RContour * NewContourEllipse ( const string & ct_name, const Double_t a, const Double_t b );
78  static RContour * NewContourEllipse ( const string & ct_name, const RPoint2D ctr, const Double_t a, const Double_t b );
79  static RContour * NewContourEllipse ( const string & ct_name, const Double_t a, const Double_t b, const Double_t angle );
80  static RContour * NewContourEllipse ( const string & ct_name, const RPoint2D ctr, const Double_t a, const Double_t b, const Double_t angle );
81  static RContour * NewContourEllipse ( const string & ct_name, const RPoint2D ctr, const RVector2D xa, const RVector2D yb );
82 
83  // functions defining a contour (for affectation)
84  static RContour ContourGate ( const string & ct_name, const Double_t x1, const Double_t x2 );
85 
86  static RContour ContourPolygon ( const string & ct_name, const UInt_t n, const RPoint2D *pts );
87  static RContour ContourPolygon ( const string & ct_name, const UInt_t n, const Double_t x[], const Double_t y[] );
88 
89  static RContour ContourCircle ( const string & ct_name, const RPoint2D ctr, const Double_t r );
90  static RContour ContourCircle ( const string & ct_name, const Double_t xc, const Double_t yc, const Double_t r );
91 
92  static RContour ContourEllipse ( const string & ct_name, const Double_t a, const Double_t b );
93  static RContour ContourEllipse ( const string & ct_name, const RPoint2D ctr, const Double_t a, const Double_t b );
94  static RContour ContourEllipse ( const string & ct_name, const Double_t a, const Double_t b, const Double_t angle );
95  static RContour ContourEllipse ( const string & ct_name, const RPoint2D ctr, const Double_t a, const Double_t b, const Double_t angle );
96  static RContour ContourEllipse ( const string & ct_name, const RPoint2D ctr, const RVector2D xa, const RVector2D yb );
97 
98  //------------------------------------------------------------
99  virtual u_int GetStatusFlag ( ) const; // inline
100  virtual u_int GetStatusBits ( u_int flags ) const; // inline
101  virtual void SetStatusBits ( u_int flags, bool status = true ); // inline
102 
103  //------------------------------------------------------------
104  // Functions from contour parameters classes
105  virtual bool CheckPoint ( const RPoint2D &p ) const; // inline
106  virtual bool CheckValue ( const Double_t val ) const; // inline
107  virtual Int_t Dimension ( ) const; // inline
108  virtual Int_t Type ( ) const; // inline
109  virtual string TypeName ( ) const; // inline
110 
111  virtual void Rename ( const string & ct_name ); // inline
112 
113  //------------------------------------------------------------
114  virtual void SetFlipAxis ( const bool flip = true ); // inline
115  virtual bool GetFlipAxis ( ) const; // inline
116 
117  virtual TAttLine GetLineAtt ( ) const; // inline
118  virtual void SetLineAtt ( const TAttLine l_att );
119  virtual void SetLineAtt ( Color_t c, Style_t s = 1, Width_t w = 1 ); // inline
120  virtual void Draw ( );
121  virtual void DrawCopy ( );
122 
123  // objects for display
124  virtual void DeleteObjectList ( );
125  virtual void CreateObjectList ( );
126  virtual TList * GetObjectList ( ) const;
127  virtual Int_t GetObjectNum ( ) const;
128  virtual TObject * GetObject ( const Int_t n ) const;
129 
130  const RContourBase * ContourBase ( ) const;
132 
133  //------------------------------------------------------------
134  // Read / write functions
135 
136  virtual bool Write ( ostream &os ) const;
137  virtual bool Write ( FILE *fptr ) const;
138 
139  virtual bool Read ( istream &is );
140  virtual bool Read ( FILE *fptr );
141 
142 
143  public:
144  //------------------------------------------------------------
145  /*! For ROOT dictionary.*/
146  ClassDef(RContour,0);
147 };
148 
149 //----------------------------------------------------------------------
150 // Inline functions
151 #include "icc/RContour.icc"
152 
153 //======================================================================
154 #endif
virtual u_int GetStatusFlag() const
Definition: RContour.icc:23
static RContour ContourEllipse(const string &ct_name, const Double_t a, const Double_t b)
Definition: RContour.cpp:371
TList * object_list
Pointer to ROOT graphical objects for display.
Definition: RContour.hh:48
ClassDef(RContour, 0)
virtual bool GetFlipAxis() const
Definition: RContour.icc:68
RContour(const string &ct_name="unnamed ")
Definition: RContour.cpp:18
static RContour ContourCircle(const string &ct_name, const RPoint2D ctr, const Double_t r)
Definition: RContour.cpp:349
#define RCONTOUR_NONAME
Default contour name.
Definition: RContour.hh:18
virtual Int_t Type() const
Definition: RContour.icc:13
const RContourBase * ContourBase() const
Definition: RContour.icc:84
virtual u_int GetStatusBits(u_int flags) const
Definition: RContour.icc:29
virtual TList * GetObjectList() const
Definition: RContour.icc:92
virtual void Rename(const string &ct_name)
Definition: RContour.icc:107
virtual void Draw()
Definition: RContour.cpp:503
RContourBase * contour_ptr
Pointer to contour properties.
Definition: RContour.hh:45
virtual void SetFlipAxis(const bool flip=true)
Definition: RContour.icc:64
virtual TAttLine GetLineAtt() const
Definition: RContour.icc:72
static RContour * NewContourEllipse(const string &ct_name, const Double_t a, const Double_t b)
Definition: RContour.cpp:242
static RContour ContourPolygon(const string &ct_name, const UInt_t n, const RPoint2D *pts)
Definition: RContour.cpp:327
CTypes
&lt; Contour types identifiers
Definition: RContour.hh:35
static RContour * NewContourPolygon(const string &ct_name, const UInt_t n, const RPoint2D *pts)
Definition: RContour.cpp:190
virtual void CreateObjectList()
Definition: RContour.cpp:450
virtual Int_t GetObjectNum() const
Definition: RContour.icc:96
virtual bool Read(istream &is)
Definition: RContour.cpp:579
Definition: RVector2D.hh:26
static RContour * NewContourCircle(const string &ct_name, const RPoint2D ctr, const Double_t r)
Definition: RContour.cpp:216
virtual TObject * GetObject(const Int_t n) const
Definition: RContour.icc:100
GObject(RContour)
virtual ~RContour()
Definition: RContour.cpp:162
RContour & operator=(const RContour &ct)
Definition: RContour.cpp:113
virtual void SetStatusBits(u_int flags, bool status=true)
Definition: RContour.icc:36
virtual void DeleteObjectList()
Definition: RContour.cpp:430
virtual string TypeName() const
Definition: RContour.icc:17
virtual void DrawCopy()
Definition: RContour.cpp:518
virtual bool CheckValue(const Double_t val) const
Definition: RContour.icc:56
virtual Int_t Dimension() const
Definition: RContour.icc:9
static RContour * NewContourGate(const string &ct_name, const Double_t x1, const Double_t x2)
Definition: RContour.cpp:178
virtual bool CheckPoint(const RPoint2D &p) const
Definition: RContour.icc:49
static RContour ContourGate(const string &ct_name, const Double_t x1, const Double_t x2)
Definition: RContour.cpp:317
TAttLine line_att
Line attributes for display.
Definition: RContour.hh:49
u_int status_flag
Status bit pattern.
Definition: RContour.hh:46
Definition: RContourBase.hh:19
virtual void SetLineAtt(const TAttLine l_att)
Definition: RContour.cpp:483
virtual bool Write(ostream &os) const
Definition: RContour.cpp:540
Definition: RContour.hh:25