Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TEllipse.h
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#ifndef ROOT_TEllipse
13#define ROOT_TEllipse
14
15
16#include "TObject.h"
17#include "TAttLine.h"
18#include "TAttFill.h"
19#include "TAttBBox2D.h"
20#include <vector>
21
22class TPoint;
23
24class TEllipse : public TObject, public TAttLine, public TAttFill, public TAttBBox2D {
25
26protected:
27 Double_t fX1; ///< X coordinate of centre
28 Double_t fY1; ///< Y coordinate of centre
29 Double_t fR1; ///< first radius
30 Double_t fR2; ///< second radius
31 Double_t fPhimin; ///< Minimum angle (degrees)
32 Double_t fPhimax; ///< Maximum angle (degrees)
33 Double_t fTheta; ///< Rotation angle (degrees)
34
35 Bool_t FillPoints(TVirtualPad &pad, std::vector<Double_t> &x, std::vector<Double_t> &y,
37
38public:
39 // TEllipse status bits
40 enum {
41 kNoEdges = BIT(9) // don't draw lines connecting center to edges
42 };
43 TEllipse();
46 ~TEllipse() override;
47 void Copy(TObject &ellipse) const override;
48 Int_t DistancetoPrimitive(Int_t px, Int_t py) override;
49 void Draw(Option_t *option="") override;
51 void ExecuteEvent(Int_t event, Int_t px, Int_t py) override;
53 Double_t GetX1() const {return fX1;}
54 Double_t GetY1() const {return fY1;}
55 Double_t GetR1() const {return fR1;}
56 Double_t GetR2() const {return fR2;}
57 Double_t GetPhimin() const {return fPhimin;}
58 Double_t GetPhimax() const {return fPhimax;}
59 Double_t GetTheta() const {return fTheta;}
60 Bool_t GetNoEdges() const;
61 void ls(Option_t *option="") const override;
62 void Paint(Option_t *option="") override;
64 void Print(Option_t *option="") const override;
65 void SavePrimitive(std::ostream &out, Option_t *option = "") override;
66 virtual void SetNoEdges(Bool_t noEdges=kTRUE); // *TOGGLE* *GETTER=GetNoEdges
67 virtual void SetPhimin(Double_t phi=0) {fPhimin=phi;} // *MENU*
68 virtual void SetPhimax(Double_t phi=360) {fPhimax=phi;} // *MENU*
69 virtual void SetR1(Double_t r1) {fR1=r1;} // *MENU*
70 virtual void SetR2(Double_t r2) {fR2=r2;} // *MENU*
71 virtual void SetTheta(Double_t theta=0) {fTheta=theta;} // *MENU*
72 virtual void SetX1(Double_t x1) {fX1=x1;} // *MENU*
73 virtual void SetY1(Double_t y1) {fY1=y1;} // *MENU*
74 Rectangle_t GetBBox() override;
75 TPoint GetBBoxCenter() override;
76 void SetBBoxCenterX(const Int_t x) override;
77 void SetBBoxCenterY(const Int_t y) override;
78 void SetBBoxX1(const Int_t x) override;
79 void SetBBoxX2(const Int_t x) override;
80 void SetBBoxY1(const Int_t y) override;
81 void SetBBoxY2(const Int_t y) override;
82
83 ClassDefOverride(TEllipse,3) //An ellipse
84};
85
86#endif
bool Bool_t
Boolean (0=false, 1=true) (bool)
Definition RtypesCore.h:77
int Int_t
Signed integer 4 bytes (int)
Definition RtypesCore.h:59
double Double_t
Double 8 bytes.
Definition RtypesCore.h:73
constexpr Bool_t kTRUE
Definition RtypesCore.h:107
const char Option_t
Option string (const char)
Definition RtypesCore.h:80
#define BIT(n)
Definition Rtypes.h:91
#define ClassDefOverride(name, id)
Definition Rtypes.h:348
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t option
Option_t Option_t TPoint TPoint const char x1
Option_t Option_t TPoint TPoint const char y1
Abstract base class for elements drawn in the editor.
Definition TAttBBox2D.h:19
Fill Area Attributes class.
Definition TAttFill.h:21
Line Attributes class.
Definition TAttLine.h:21
Draw Ellipses.
Definition TEllipse.h:24
virtual void SetR1(Double_t r1)
Definition TEllipse.h:69
void ls(Option_t *option="") const override
List this ellipse with its attributes.
Definition TEllipse.cxx:390
virtual void SetX1(Double_t x1)
Definition TEllipse.h:72
virtual void PaintEllipse(Double_t x1, Double_t y1, Double_t r1, Double_t r2, Double_t phimin, Double_t phimax, Double_t theta, Option_t *option="")
Draw this ellipse with new coordinates.
Definition TEllipse.cxx:449
void SetBBoxCenterY(const Int_t y) override
Set Y coordinate of the center of the Ellipse.
Definition TEllipse.cxx:593
Double_t GetTheta() const
Definition TEllipse.h:59
void ExecuteEvent(Int_t event, Int_t px, Int_t py) override
Execute action corresponding to one event.
Definition TEllipse.cxx:201
void SetBBoxY1(const Int_t y) override
Set top of BoundingBox to a value (resize in y direction on top)
Definition TEllipse.cxx:627
void SetBBoxX1(const Int_t x) override
Set left hand side of BoundingBox to a value (resize in x direction on left)
Definition TEllipse.cxx:602
Double_t GetPhimax() const
Definition TEllipse.h:58
void SetBBoxY2(const Int_t y) override
Set bottom of BoundingBox to a value (resize in y direction on bottom)
Definition TEllipse.cxx:640
Double_t GetX1() const
Definition TEllipse.h:53
Double_t fPhimax
Maximum angle (degrees)
Definition TEllipse.h:32
Double_t GetPhimin() const
Definition TEllipse.h:57
Int_t DistancetoPrimitive(Int_t px, Int_t py) override
Compute distance from point px,py to an ellipse.
Definition TEllipse.cxx:133
virtual void SetPhimax(Double_t phi=360)
Definition TEllipse.h:68
Double_t fX1
X coordinate of centre.
Definition TEllipse.h:27
void SetBBoxX2(const Int_t x) override
Set right hand side of BoundingBox to a value (resize in x direction on right)
Definition TEllipse.cxx:615
Bool_t GetNoEdges() const
Return kTRUE if kNoEdges bit is set, kFALSE otherwise.
Definition TEllipse.cxx:505
Rectangle_t GetBBox() override
Return the bounding Box of the Ellipse, currently not taking into account the rotating angle.
Definition TEllipse.cxx:557
void Paint(Option_t *option="") override
Paint this ellipse with its current attributes.
Definition TEllipse.cxx:399
Double_t fY1
Y coordinate of centre.
Definition TEllipse.h:28
Double_t fTheta
Rotation angle (degrees)
Definition TEllipse.h:33
virtual void SetPhimin(Double_t phi=0)
Definition TEllipse.h:67
Int_t IsInside(Double_t x, Double_t y) const
Return 1 if the point (x,y) is inside the polygon defined by the ellipse 0 otherwise.
Definition TEllipse.cxx:359
void SetBBoxCenterX(const Int_t x) override
Set X coordinate of the center of the Ellipse.
Definition TEllipse.cxx:585
Bool_t FillPoints(TVirtualPad &pad, std::vector< Double_t > &x, std::vector< Double_t > &y, Double_t x1, Double_t y1, Double_t r1, Double_t r2, Double_t phimin, Double_t phimax, Double_t theta)
Fill points which can be used for the painting Return true if full 360 ellipse is created.
Definition TEllipse.cxx:408
virtual void SetY1(Double_t y1)
Definition TEllipse.h:73
~TEllipse() override
Ellipse default destructor.
Definition TEllipse.cxx:87
Double_t fR2
second radius
Definition TEllipse.h:30
Double_t GetR2() const
Definition TEllipse.h:56
virtual void SetNoEdges(Bool_t noEdges=kTRUE)
if noEdges = kTRUE the lines connecting the center to the edges will not be drawn.
Definition TEllipse.cxx:515
void Copy(TObject &ellipse) const override
Copy this ellipse to ellipse.
Definition TEllipse.cxx:110
Double_t GetR1() const
Definition TEllipse.h:55
Double_t fPhimin
Minimum angle (degrees)
Definition TEllipse.h:31
Double_t GetY1() const
Definition TEllipse.h:54
TPoint GetBBoxCenter() override
Return the center of the Ellipse as TPoint in pixels.
Definition TEllipse.cxx:572
TEllipse()
Ellipse default constructor.
Definition TEllipse.cxx:57
Double_t fR1
first radius
Definition TEllipse.h:29
@ kNoEdges
Definition TEllipse.h:41
virtual TEllipse * DrawEllipse(Double_t x1, Double_t y1, Double_t r1, Double_t r2, Double_t phimin, Double_t phimax, Double_t theta, Option_t *option="")
Draw this ellipse with new coordinates.
Definition TEllipse.cxx:177
virtual void SetR2(Double_t r2)
Definition TEllipse.h:70
void Print(Option_t *option="") const override
Dump this ellipse with its attributes.
Definition TEllipse.cxx:475
virtual void SetTheta(Double_t theta=0)
Definition TEllipse.h:71
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save primitive as a C++ statement(s) on output stream out.
Definition TEllipse.cxx:487
Mother of all ROOT objects.
Definition TObject.h:42
TVirtualPad is an abstract base class for the Pad and Canvas classes.
Definition TVirtualPad.h:51
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
Rectangle structure (maps to the X11 XRectangle structure)
Definition GuiTypes.h:362
th1 Draw()