104 ellipse.TEllipse::Copy(*
this);
135 if (!
gPad)
return 9999;
151 if (dx == 0 || r1 == 0 || r2 == 0)
return 9999;
159 if (distr > distp) dist = 0;
161 if (
TMath::Abs(distr-distp)/(r1+r2) < 0.01) dist = 0;
209 static Int_t px1,py1,npe,r1,r2,sav1,sav2;
210 const Int_t kMinSize = 25;
212 static Bool_t pTop, pL, pR, pBot, pINSIDE;
213 static Int_t pTx,pTy,pLx,pLy,pRx,pRy,pBx,pBy;
215 static Int_t pxold, pyold;
216 static Int_t sig,impair;
218 static Double_t oldX1, oldY1, oldR1, oldR2;
222 if (!
gPad->IsEditable())
return;
239 x[i] =
gPad->XtoAbsPixel(
fX1 + dx*ct - dy*st);
240 y[i] =
gPad->YtoAbsPixel(
fY1 + dx*st + dy*ct);
267 gVirtualX->DrawLine(pRx+4, py1+4, pRx-4, py1+4);
268 gVirtualX->DrawLine(pRx-4, py1+4, pRx-4, py1-4);
269 gVirtualX->DrawLine(pRx-4, py1-4, pRx+4, py1-4);
270 gVirtualX->DrawLine(pRx+4, py1-4, pRx+4, py1+4);
271 gVirtualX->DrawLine(pLx+4, py1+4, pLx-4, py1+4);
272 gVirtualX->DrawLine(pLx-4, py1+4, pLx-4, py1-4);
273 gVirtualX->DrawLine(pLx-4, py1-4, pLx+4, py1-4);
274 gVirtualX->DrawLine(pLx+4, py1-4, pLx+4, py1+4);
275 gVirtualX->DrawLine(px1+4, pBy+4, px1-4, pBy+4);
276 gVirtualX->DrawLine(px1-4, pBy+4, px1-4, pBy-4);
277 gVirtualX->DrawLine(px1-4, pBy-4, px1+4, pBy-4);
278 gVirtualX->DrawLine(px1+4, pBy-4, px1+4, pBy+4);
279 gVirtualX->DrawLine(px1+4, pTy+4, px1-4, pTy+4);
280 gVirtualX->DrawLine(px1-4, pTy+4, px1-4, pTy-4);
281 gVirtualX->DrawLine(px1-4, pTy-4, px1+4, pTy-4);
282 gVirtualX->DrawLine(px1+4, pTy-4, px1+4, pTy+4);
285 sdx = this->
GetX1()-
gPad->AbsPixeltoX(px);
286 sdy = this->
GetY1()-
gPad->AbsPixeltoY(py);
299 pTop = pL = pR = pBot = pINSIDE =
kFALSE;
324 pxold = px; pyold = py;
332 gVirtualX->DrawLine(pRx+4, py1+4, pRx-4, py1+4);
333 gVirtualX->DrawLine(pRx-4, py1+4, pRx-4, py1-4);
334 gVirtualX->DrawLine(pRx-4, py1-4, pRx+4, py1-4);
335 gVirtualX->DrawLine(pRx+4, py1-4, pRx+4, py1+4);
336 gVirtualX->DrawLine(pLx+4, py1+4, pLx-4, py1+4);
337 gVirtualX->DrawLine(pLx-4, py1+4, pLx-4, py1-4);
338 gVirtualX->DrawLine(pLx-4, py1-4, pLx+4, py1-4);
339 gVirtualX->DrawLine(pLx+4, py1-4, pLx+4, py1+4);
340 gVirtualX->DrawLine(px1+4, pBy+4, px1-4, pBy+4);
341 gVirtualX->DrawLine(px1-4, pBy+4, px1-4, pBy-4);
342 gVirtualX->DrawLine(px1-4, pBy-4, px1+4, pBy-4);
343 gVirtualX->DrawLine(px1+4, pBy-4, px1+4, pBy+4);
344 gVirtualX->DrawLine(px1+4, pTy+4, px1-4, pTy+4);
345 gVirtualX->DrawLine(px1-4, pTy+4, px1-4, pTy-4);
346 gVirtualX->DrawLine(px1-4, pTy-4, px1+4, pTy-4);
347 gVirtualX->DrawLine(px1+4, pTy-4, px1+4, pTy+4);
348 for (i=0;i<npe;i++)
gVirtualX->DrawLine(
x[i],
y[i],
x[i+1],
y[i+1]);
353 py1 += (py - pyold)/2;
354 r2 -= (py - pyold)/2;
356 if (py-pyold>0) sig=+1;
358 if (impair==2) { impair = 0; py1 += sig; r2 -= sig;}
359 if (py1 > pBy-kMinSize) {py1 = sav1; r2 = sav2; py = pyold;}
364 py1 += (py - pyold)/2;
365 r2 += (py - pyold)/2;
367 if (py-pyold>0) sig=+1;
369 if (impair==2) { impair = 0; py1 += sig; r2 += sig;}
370 if (py1 < pTy+kMinSize) {py1 = sav1; r2 = sav2; py = pyold;}
375 px1 += (px - pxold)/2;
376 r1 -= (px - pxold)/2;
378 if (px-pxold>0) sig=+1;
380 if (impair==2) { impair = 0; px1 += sig; r1 -= sig;}
381 if (px1 > pRx-kMinSize) {px1 = sav1; r1 = sav2; px = pxold;}
386 px1 += (px - pxold)/2;
387 r1 += (px - pxold)/2;
389 if (px-pxold>0) sig=+1;
391 if (impair==2) { impair = 0; px1 += sig; r1 += sig;}
392 if (px1 < pLx+kMinSize) {px1 = sav1; r1 = sav2; px = pxold;}
394 if (pTop || pBot || pL || pR) {
403 x[i] = px1 +
Int_t(dx*ct - dy*st);
404 y[i] = py1 +
Int_t(dx*st + dy*ct);
428 if (pTop)
gPad->ShowGuidelines(
this,
event,
't',
true);
429 if (pBot)
gPad->ShowGuidelines(
this,
event,
'b',
true);
430 if (pL)
gPad->ShowGuidelines(
this,
event,
'l',
true);
431 if (pR)
gPad->ShowGuidelines(
this,
event,
'r',
true);
438 dpx = px-pxold; dpy = py-pyold;
439 px1 += dpx; py1 += dpy;
440 for (i=0;i<=npe;i++) {
x[i] += dpx;
y[i] += dpy;}
441 for (i=0;i<npe;i++)
gVirtualX->DrawLine(
x[i],
y[i],
x[i+1],
y[i+1]);
446 gPad->ShowGuidelines(
this,
event,
'i',
true);
458 gVirtualX->DrawLine(pRx+4, py1+4, pRx-4, py1+4);
459 gVirtualX->DrawLine(pRx-4, py1+4, pRx-4, py1-4);
460 gVirtualX->DrawLine(pRx-4, py1-4, pRx+4, py1-4);
461 gVirtualX->DrawLine(pRx+4, py1-4, pRx+4, py1+4);
462 gVirtualX->DrawLine(pLx+4, py1+4, pLx-4, py1+4);
463 gVirtualX->DrawLine(pLx-4, py1+4, pLx-4, py1-4);
464 gVirtualX->DrawLine(pLx-4, py1-4, pLx+4, py1-4);
465 gVirtualX->DrawLine(pLx+4, py1-4, pLx+4, py1+4);
466 gVirtualX->DrawLine(px1+4, pBy+4, px1-4, pBy+4);
467 gVirtualX->DrawLine(px1-4, pBy+4, px1-4, pBy-4);
468 gVirtualX->DrawLine(px1-4, pBy-4, px1+4, pBy-4);
469 gVirtualX->DrawLine(px1+4, pBy-4, px1+4, pBy+4);
470 gVirtualX->DrawLine(px1+4, pTy+4, px1-4, pTy+4);
471 gVirtualX->DrawLine(px1-4, pTy+4, px1-4, pTy-4);
472 gVirtualX->DrawLine(px1-4, pTy-4, px1+4, pTy-4);
473 gVirtualX->DrawLine(px1+4, pTy-4, px1+4, pTy+4);
480 if (
gROOT->IsEscaped()) {
498 fBy =
gPad->AbsPixeltoY(py1+r2);
499 fTy =
gPad->AbsPixeltoY(py1-r2);
500 fLx =
gPad->AbsPixeltoX(px1+r1);
501 fRx =
gPad->AbsPixeltoX(px1-r1);
552 for (
Int_t i=0;i<=
n;i++) {
556 x[i] =
gPad->XtoPad(
x1 + dx*ct - dy*st);
557 y[i] =
gPad->YtoPad(
y1 + dx*st + dy*ct);
561 if (phi2-phi1 >= 360 ) {
572 else gPad->PaintPolyLine(
n+3,
x,
y);
582 printf(
"Ellipse: X1=%f Y1=%f R1=%f R2=%f",
fX1,
fY1,
fR1,
fR2);
600 out<<
"ellipse = new TEllipse("<<
fX1<<
","<<
fY1<<
","<<
fR1<<
","<<
fR2
606 if (
GetNoEdges()) out<<
" ellipse->SetNoEdges();"<<std::endl;
608 out<<
" ellipse->Draw();"<<std::endl;
649 R__b >> r1;
fR1 = r1;
650 R__b >> r2;
fR2 = r2;
651 R__b >> phimin;
fPhimin = phimin;
652 R__b >> phimax;
fPhimax = phimax;
653 R__b >> theta;
fTheta = theta;
669 if (!
gPad)
return BBox;
670 if (!
gPad)
return (BBox);
684 if (!
gPad)
return (
p);
685 if (!
gPad)
return (
p);
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t np
Option_t Option_t TPoint TPoint const char x2
Option_t Option_t TPoint TPoint const char x1
Option_t Option_t TPoint TPoint angle
Option_t Option_t TPoint TPoint const char y2
Option_t Option_t TPoint TPoint const char y1
Abstract base class for elements drawn in the editor.
Fill Area Attributes class.
virtual void Streamer(TBuffer &)
virtual Color_t GetFillColor() const
Return the fill area color.
void Copy(TAttFill &attfill) const
Copy this fill attributes to a new TAttFill.
virtual Style_t GetFillStyle() const
Return the fill area style.
virtual void Modify()
Change current fill area attributes if necessary.
virtual void SaveFillAttributes(std::ostream &out, const char *name, Int_t coldef=1, Int_t stydef=1001)
Save fill attributes as C++ statement(s) on output stream out.
virtual void Streamer(TBuffer &)
virtual Color_t GetLineColor() const
Return the line color.
virtual Width_t GetLineWidth() const
Return the line width.
virtual Style_t GetLineStyle() const
Return the line style.
virtual void Modify()
Change current line attributes if necessary.
void Copy(TAttLine &attline) const
Copy this line attributes to a new TAttLine.
virtual void SaveLineAttributes(std::ostream &out, const char *name, Int_t coldef=1, Int_t stydef=1, Int_t widdef=1)
Save line attributes as C++ statement(s) on output stream out.
Buffer base class used for serializing objects.
virtual Version_t ReadVersion(UInt_t *start=nullptr, UInt_t *bcnt=nullptr, const TClass *cl=nullptr)=0
virtual Int_t CheckByteCount(UInt_t startpos, UInt_t bcnt, const TClass *clss)=0
virtual Int_t ReadClassBuffer(const TClass *cl, void *pointer, const TClass *onfile_class=nullptr)=0
virtual Int_t WriteClassBuffer(const TClass *cl, void *pointer)=0
TClass * IsA() const override
virtual void SetR1(Double_t r1)
void ls(Option_t *option="") const override
List this ellipse with its attributes.
virtual void SetX1(Double_t x1)
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.
void SetBBoxCenterY(const Int_t y) override
Set Y coordinate of the center of the Ellipse.
Double_t GetTheta() const
void ExecuteEvent(Int_t event, Int_t px, Int_t py) override
Execute action corresponding to one event.
void SetBBoxY1(const Int_t y) override
Set top of BoundingBox to a value (resize in y direction on top)
void SetBBoxX1(const Int_t x) override
Set left hand side of BoundingBox to a value (resize in x direction on left)
void SetBBoxY2(const Int_t y) override
Set bottom of BoundingBox to a value (resize in y direction on bottom)
Double_t fPhimax
Maximum angle (degrees)
Int_t DistancetoPrimitive(Int_t px, Int_t py) override
Compute distance from point px,py to an ellipse.
Double_t fX1
X coordinate of centre.
void SetBBoxX2(const Int_t x) override
Set right hand side of BoundingBox to a value (resize in x direction on right)
Bool_t GetNoEdges() const
Return kTRUE if kNoEdges bit is set, kFALSE otherwise.
void Draw(Option_t *option="") override
Draw this ellipse with its current attributes.
Rectangle_t GetBBox() override
Return the bounding Box of the Ellipse, currently not taking into account the rotating angle.
void Paint(Option_t *option="") override
Paint this ellipse with its current attributes.
Double_t fY1
Y coordinate of centre.
Double_t fTheta
Rotation angle (degrees)
void SetBBoxCenter(const TPoint &p) override
Set center of the Ellipse.
void SetBBoxCenterX(const Int_t x) override
Set X coordinate of the center of the Ellipse.
virtual void SetY1(Double_t y1)
~TEllipse() override
Ellipse default destructor.
Double_t fR2
second radius
void Streamer(TBuffer &) override
Stream an object of class TEllipse.
virtual void SetNoEdges(Bool_t noEdges=kTRUE)
if noEdges = kTRUE the lines connecting the center to the edges will not be drawn.
void Copy(TObject &ellipse) const override
Copy this ellipse to ellipse.
Double_t fPhimin
Minimum angle (degrees)
TPoint GetBBoxCenter() override
Return the center of the Ellipse as TPoint in pixels.
TEllipse()
Ellipse default constructor.
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.
virtual void SetR2(Double_t r2)
void Print(Option_t *option="") const override
Dump this ellipse with its attributes.
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save primitive as a C++ statement(s) on output stream out.
Mother of all ROOT objects.
virtual const char * GetName() const
Returns name of object.
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
virtual void Streamer(TBuffer &)
Stream an object of class TObject.
virtual void AppendPad(Option_t *option="")
Append graphics object to current pad.
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
virtual void Copy(TObject &object) const
Copy this to obj.
@ kCanDelete
if object in a list can be deleted
static void IndentLevel()
Functions used by ls() to indent an object hierarchy.
void ToLower()
Change string to lower-case.
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Short_t Max(Short_t a, Short_t b)
Returns the largest of a and b.
Double_t Sqrt(Double_t x)
Returns the square root of x.
Short_t Min(Short_t a, Short_t b)
Returns the smallest of a and b.
Double_t Cos(Double_t)
Returns the cosine of an angle of x radians.
Double_t Sin(Double_t)
Returns the sine of an angle of x radians.
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.
Rectangle structure (maps to the X11 XRectangle structure)