36 fX1=0; fY1=0; fX2=0; fY2=0;
61 ((
TLine&)line).Copy(*
this);
127 static Int_t d1,d2,px1,px2,py1,py2;
128 static Int_t pxold, pyold, px1old, py1old, px2old, py2old;
129 static Double_t oldX1, oldY1, oldX2, oldY2;
136 if (!
gPad->IsEditable())
return;
169 d1 = abs(px1 - px) + abs(py1-py);
171 px1old = px1; py1old = py1;
176 d2 = abs(px2 - px) + abs(py2-py);
178 px2old = px2; py2old = py2;
185 pxold = px; pyold = py;
195 gVirtualX->DrawLine(px1old, py1old, px2, py2);
207 gVirtualX->DrawLine(px1, py1, px2old, py2old);
218 if (!opaque)
gVirtualX->DrawLine(px1, py1, px2, py2);
219 dx = px-pxold; dy = py-pyold;
220 px1 += dx; py1 += dy; px2 += dx; py2 += dy;
221 if (!opaque)
gVirtualX->DrawLine(px1, py1, px2, py2);
237 gPad->ShowGuidelines(
this, event,
'2',
true);
239 gPad->ShowGuidelines(
this, event,
'3',
true);
242 gPad->ShowGuidelines(
this, event,
'1',
true);
244 gPad->ShowGuidelines(
this, event,
'4',
true);
251 gPad->ShowGuidelines(
this, event,
'4',
true);
253 gPad->ShowGuidelines(
this, event,
'1',
true);
256 gPad->ShowGuidelines(
this, event,
'3',
true);
258 gPad->ShowGuidelines(
this, event,
'2',
true);
262 gPad->ShowGuidelines(
this, event,
'i',
true);
271 if (
gROOT->IsEscaped()) {
291 gPad->ShowGuidelines(
this, event);
294 dpx =
gPad->GetX2() -
gPad->GetX1();
295 dpy =
gPad->GetY2() -
gPad->GetY1();
299 fX1 = (
gPad->AbsPixeltoX(px)-xp1)/dpx;
300 fY1 = (
gPad->AbsPixeltoY(py)-yp1)/dpy;
303 fX2 = (
gPad->AbsPixeltoX(px)-xp1)/dpx;
304 fY2 = (
gPad->AbsPixeltoY(py)-yp1)/dpy;
307 fX1 = (
gPad->AbsPixeltoX(px1)-xp1)/dpx;
308 fY1 = (
gPad->AbsPixeltoY(py1)-yp1)/dpy;
309 fX2 = (
gPad->AbsPixeltoX(px2)-xp1)/dpx;
310 fY2 = (
gPad->AbsPixeltoY(py2)-yp1)/dpy;
338 if (!opaque)
gVirtualX->SetLineColor(-1);
347 event =
gVirtualX->RequestLocator(1,1,px,py);
383 gPad->PaintLine(x1,y1,x2,y2);
392 gPad->PaintLineNDC(u1,v1,u2,v2);
417 out<<
"line = new TLine("<<
fX1<<
","<<
fY1<<
","<<
fX2<<
","<<
fY2 422 out<<
" line->Draw();"<<std::endl;
466 else fX2 =
gPad->AbsPixeltoX(px1-l);
487 else fY2 =
gPad->AbsPixeltoY(py1+l);
495 void TLine::Streamer(
TBuffer &R__b)
505 TObject::Streamer(R__b);
506 TAttLine::Streamer(R__b);
509 R__b >> y1;
fY1 = y1;
511 R__b >> y2;
fY2 = y2;
524 Int_t px1, py1, px2, py2;
531 if (px1>px2) { tmp = px1; px1 = px2; px2 = tmp;}
532 if (py1>py2) { tmp = py1; py1 = py2; py2 = tmp;}
virtual void SetY2(Double_t y2)
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
Execute action corresponding to one event.
virtual Int_t WriteClassBuffer(const TClass *cl, void *pointer)=0
Double_t fX1
X of 1st point.
Bool_t TestBit(UInt_t f) const
virtual void SetBBoxY2(const Int_t y)
Set bottom of BoundingBox to a value (resize in y direction on bottom)
virtual TLine * DrawLine(Double_t x1, Double_t y1, Double_t x2, Double_t y2)
Draw this line with new coordinates.
Buffer base class used for serializing objects.
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
Compute distance from point px,py to a line.
Short_t Min(Short_t a, Short_t b)
Double_t fX2
X of 2nd point.
void SetHorizontal(Bool_t set=kTRUE)
Force the line to be drawn horizontally.
virtual void Modify()
Change current line attributes if necessary.
Bool_t IsVertical()
Check whether this line is to be drawn vertically.
virtual Width_t GetLineWidth() const
Return the line width.
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
if object in a list can be deleted
virtual void AppendPad(Option_t *option="")
Append graphics object to current pad.
virtual void SetBBoxY1(const Int_t y)
Set top of BoundingBox to a value (resize in y direction on top)
virtual Style_t GetLineStyle() const
Return the line style.
Bool_t IsHorizontal()
Check whether this line is to be drawn horizontally.
static const double x2[5]
virtual void PaintLineNDC(Double_t u1, Double_t v1, Double_t u2, Double_t v2)
Draw this line with new coordinates in NDC.
void Copy(TAttLine &attline) const
Copy this line attributes to a new TAttLine.
virtual void Copy(TObject &object) const
Copy this to obj.
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.
static double p2(double t, double a, double b, double c)
virtual void Paint(Option_t *option="")
Paint this line with its current attributes.
virtual void SetBBoxX1(const Int_t x)
Set left hand side of BoundingBox to a value (resize in x direction on left)
virtual void PaintLine(Double_t x1, Double_t y1, Double_t x2, Double_t y2)
Draw this line with new coordinates.
virtual void SetX2(Double_t x2)
virtual void ls(Option_t *option="") const
List this line with its attributes.
virtual TPoint GetBBoxCenter()
Return the center of the BoundingBox as TPoint in pixels.
virtual void SetY1(Double_t y1)
virtual void SetBBoxCenterX(const Int_t x)
Set X coordinate of the center of the BoundingBox.
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save primitive as a C++ statement(s) on output stream out.
Double_t fY1
Y of 1st point.
static void IndentLevel()
Functions used by ls() to indent an object hierarchy.
static double p1(double t, double a, double b)
virtual void SetNDC(Bool_t isNDC=kTRUE)
Set NDC mode on if isNDC = kTRUE, off otherwise.
virtual void Print(Option_t *option="") const
Dump this line with its attributes.
virtual Color_t GetLineColor() const
Return the line color.
virtual void SetX1(Double_t x1)
virtual void SetBBoxX2(const Int_t x)
Set right hand side of BoundingBox to a value (resize in x direction on right)
virtual Int_t ReadClassBuffer(const TClass *cl, void *pointer, const TClass *onfile_class=0)=0
static const double x1[5]
virtual Rectangle_t GetBBox()
Return the bounding Box of the Line.
Int_t DistancetoLine(Int_t px, Int_t py, Double_t xp1, Double_t yp1, Double_t xp2, Double_t yp2)
Compute distance from point px,py to a line.
void SetVertical(Bool_t set=kTRUE)
Force the line to be drawn vertically.
virtual void SetBBoxCenterY(const Int_t y)
Set Y coordinate of the center of the BoundingBox.
virtual TLine * DrawLineNDC(Double_t x1, Double_t y1, Double_t x2, Double_t y2)
Draw this line with new coordinates in NDC.
Mother of all ROOT objects.
void Copy(TObject &line) const
Copy this line to line.
Abstract base class for elements drawn in the editor.
Short_t Max(Short_t a, Short_t b)
Double_t fY2
Y of 2nd point.
Double_t Sqrt(Double_t x)
virtual const char * GetName() const
Returns name of object.
virtual ~TLine()
Line default destructor.
virtual void SetBBoxCenter(const TPoint &p)
Set center of the BoundingBox.
virtual Version_t ReadVersion(UInt_t *start=0, UInt_t *bcnt=0, const TClass *cl=0)=0
TLine()
Line default constructor.