20 TString TArrow::fgDefaultOption =
">";
47 fAngle = fgDefaultAngle;
99 fAngle = fgDefaultAngle;
124 if (option && strlen(option)) opt = option;
143 if (size <= 0) size = 0.05;
144 const char* opt = option;
146 if (!opt || !opt[0]) opt =
"|>";
162 if (option && strlen(option)) opt = option;
184 Int_t ix1,iy1,ix2,iy2;
188 gPad->GetPadPar(x1p,y1p,x2p,y2p);
189 ix1 = (
Int_t)(iw*x1p);
190 iy1 = (
Int_t)(ih*y1p);
191 ix2 = (
Int_t)(iw*x2p);
192 iy2 = (
Int_t)(ih*y2p);
204 gPad->GetRange(rx1,ry1,rx2,ry2);
205 Double_t rx = (x2ndc-x1ndc)/(rx2-rx1);
206 Double_t ry = (y2ndc-y1ndc)/(ry2-ry1);
209 Double_t x1n, y1n, x2n, y2n, xm, ym;
210 x1n = rx*(x1-rx1)+x1ndc;
211 x2n = rx*(x2-rx1)+x1ndc;
212 y1n = ry*(y1-ry1)+y1ndc;
213 y2n = ry*(y2-ry1)+y1ndc;
224 cosT = (x2n-x1n)/length;
225 sinT = (y2n-y1n)/length;
233 x1ar[0] = x1n-sinT*dSize;
234 y1ar[0] = y1n+cosT*dSize;
235 x1ar[1] = x1n+sinT*dSize;
236 y1ar[1] = y1n-cosT*dSize;
238 for (i=0; i<2; i++) {
239 x1ar[i] = (1/rx)*(x1ar[i]-x1ndc)+rx1;
240 y1ar[i] = (1/ry)*(y1ar[i]-y1ndc)+ry1;
242 gPad->PaintLine(x1ar[0],y1ar[0],x1ar[1],y1ar[1]);
246 x2ar[0] = x2n-sinT*dSize;
247 y2ar[0] = y2n+cosT*dSize;
248 x2ar[1] = x2n+sinT*dSize;
249 y2ar[1] = y2n-cosT*dSize;
251 for (i=0; i<2; i++) {
252 x2ar[i] = (1/rx)*(x2ar[i]-x1ndc)+rx1;
253 y2ar[i] = (1/ry)*(y2ar[i]-y1ndc)+ry1;
255 gPad->PaintLine(x2ar[0],y2ar[0],x2ar[1],y2ar[1]);
256 opt(opt.
Length()-1) =
' ';
265 x2h = xm + cosT*rSize/2;
266 y2h = ym + sinT*rSize/2;
269 x1h = xm - cosT*rSize/2;
270 y1h = ym - sinT*rSize/2;
275 x2ar[0] = x2h - rSize*cosT - sinT*dSize;
276 y2ar[0] = y2h - rSize*sinT + cosT*dSize;
279 x2ar[2] = x2h - rSize*cosT + sinT*dSize;
280 y2ar[2] = y2h - rSize*sinT - cosT*dSize;
286 x1ar[0] = x1h + rSize*cosT + sinT*dSize;
287 y1ar[0] = y1h + rSize*sinT - cosT*dSize;
290 x1ar[2] = x1h + rSize*cosT - sinT*dSize;
291 y1ar[2] = y1h + rSize*sinT + cosT*dSize;
298 x2n = x2n-cosT*rSize;
299 y2n = y2n-sinT*rSize;
302 x1n = x1n+cosT*rSize;
303 y1n = y1n+sinT*rSize;
305 x1n = (1/rx)*(x1n-x1ndc)+rx1;
306 y1n = (1/ry)*(y1n-y1ndc)+ry1;
307 x2n = (1/rx)*(x2n-x1ndc)+rx1;
308 y2n = (1/ry)*(y2n-y1ndc)+ry1;
309 gPad->PaintLine(x1n,y1n,x2n,y2n);
314 for (i=0; i<4; i++) {
315 x2ar[i] = (1/rx)*(x2ar[i]-x1ndc)+rx1;
316 y2ar[i] = (1/ry)*(y2ar[i]-y1ndc)+ry1;
320 gPad->PaintFillArea(3,x2ar,y2ar);
321 gPad->PaintPolyLine(4,x2ar,y2ar);
323 gPad->PaintPolyLine(4,x2ar,y2ar);
326 gPad->PaintPolyLine(3,x2ar,y2ar);
331 for (i=0; i<4; i++) {
332 x1ar[i] = (1/rx)*(x1ar[i]-x1ndc)+rx1;
333 y1ar[i] = (1/ry)*(y1ar[i]-y1ndc)+ry1;
337 gPad->PaintFillArea(3,x1ar,y1ar);
338 gPad->PaintPolyLine(4,x1ar,y1ar);
340 gPad->PaintPolyLine(4,x1ar,y1ar);
343 gPad->PaintPolyLine(3,x1ar,y1ar);
360 out<<
"arrow = new TArrow("<<
fX1<<
","<<
fY1<<
","<<
fX2<<
","<<
fY2
367 out <<
" arrow->SetAngle(" <<
GetAngle() <<
");" << std::endl;
370 out<<
" arrow->Draw();"<<std::endl;
virtual void Paint(Option_t *option="")
Paint this arrow with its current attributes.
static Float_t GetDefaultAngle()
Get default angle.
Option_t * GetOption() const
virtual void DrawArrow(Double_t x1, Double_t y1, Double_t x2, Double_t y2, Float_t arrowsize=0, Option_t *option="")
Draw this arrow with new coordinates.
void Copy(TAttLine &attline) const
Copy this line attributes to a new TAttLine.
void Copy(TAttFill &attfill) const
Copy this fill attributes to a new TAttFill.
Short_t Min(Short_t a, Short_t b)
void ToLower()
Change string to lower-case.
static void SetDefaultAngle(Float_t Angle)
Set default angle.
virtual void Modify()
Change current line attributes if necessary.
static TString fgDefaultOption
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
static Float_t fgDefaultArrowSize
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
virtual void AppendPad(Option_t *option="")
Append graphics object to current pad.
const char * Data() const
static const double x2[5]
Fill Area Attributes class.
static Float_t GetDefaultArrowSize()
Get default arrow size.
virtual Option_t * GetDrawOption() const
Get option used by the graphics system to draw this object.
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.
virtual void Draw(Option_t *option="")
Draw this arrow with its current attributes.
virtual void Modify()
Change current fill area attributes if necessary.
static void SetDefaultOption(Option_t *Option)
Set default option.
void Copy(TObject &arrow) const
Copy this arrow to arrow.
static void SetDefaultArrowSize(Float_t ArrowSize)
Set default arrow sive.
Bool_t EndsWith(const char *pat, ECaseCompare cmp=kExact) const
Return true if string ends with the specified string.
Double_t length(const TVector2 &v)
virtual void SetFillColor(Color_t fcolor)
virtual Color_t GetFillColor() const
static Float_t fgDefaultAngle
virtual void PaintArrow(Double_t x1, Double_t y1, Double_t x2, Double_t y2, Float_t arrowsize=0.05, Option_t *option=">")
Draw this arrow.
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 Color_t GetLineColor() const
static const double x1[5]
void Copy(TObject &line) const
Copy this line to line.
Mother of all ROOT objects.
static Option_t * GetDefaultOption()
Get default option.
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save primitive as a C++ statement(s) on output stream out.
Double_t Sqrt(Double_t x)
Draw all kinds of Arrows.
Double_t Angle(const TVector2 &v1, const TVector2 &v2)
virtual ~TArrow()
Arrow default destructor.
virtual void SetAngle(Float_t angle=60)