ROOT » GRAF2D » GRAF » TArrow

class TArrow: public TLine, public TAttFill


TArrow : to draw all kinds of arrows

The different arrow's formats are explained in TArrow::TArrow. The picture below gives some examples.

Once an arrow is drawn on the screen:

  • One can click on one of the edges and move this edge.
  • One can click on any other arrow part to move the entire arrow.
output of html602/MACRO_TArrow_1.gif
//Draw arrows
//Author: Rene Brun
{
   c1 = new TCanvas("c1");
   c1->Range(0,0,1,1);

   TPaveLabel par(0.1,0.8,0.9,0.95,"Examples of various arrow formats");
   par.SetFillColor(42);
   par.Draw();

   TArrow ar1(0.1,0.1,0.1,0.7);
   ar1.Draw();
   TArrow ar2(0.2,0.1,0.2,0.7,0.05,"|>");
   ar2.SetAngle(40);
   ar2.SetLineWidth(2);
   ar2.Draw();
   TArrow ar3(0.3,0.1,0.3,0.7,0.05,"<|>");
   ar3.SetAngle(40);
   ar3.SetLineWidth(2);
   ar3.Draw();
   TArrow ar4(0.46,0.7,0.82,0.42,0.07,"|>");
   ar4.SetAngle(60);
   ar4.SetLineWidth(2);
   ar4.SetFillColor(2);
   ar4.Draw();
   TArrow ar5(0.4,0.25,0.95,0.25,0.15,"<|>");
   ar5.SetAngle(60);
   ar5.SetLineWidth(4);
   ar5.SetLineColor(4);
   ar5.SetFillStyle(3008);
   ar5.SetFillColor(2);
   ar5.Draw();
   return c1;
}
 

Function Members (Methods)

public:
virtual~TArrow()
voidTObject::AbstractMethod(const char* method) const
virtual voidTObject::AppendPad(Option_t* option = "")
virtual voidTObject::Browse(TBrowser* b)
static TClass*Class()
virtual const char*TObject::ClassName() const
virtual voidTObject::Clear(Option_t* = "")
virtual TObject*TObject::Clone(const char* newname = "") const
virtual Int_tTObject::Compare(const TObject* obj) const
virtual voidCopy(TObject& arrow) const
virtual voidTObject::Delete(Option_t* option = "")MENU
Int_tTAttLine::DistancetoLine(Int_t px, Int_t py, Double_t xp1, Double_t yp1, Double_t xp2, Double_t yp2)
virtual Int_tTLine::DistancetoPrimitive(Int_t px, Int_t py)
virtual voidDraw(Option_t* option = "")
virtual voidDrawArrow(Double_t x1, Double_t y1, Double_t x2, Double_t y2, Float_t arrowsize = 0, Option_t* option = "")
virtual voidTObject::DrawClass() constMENU
virtual TObject*TObject::DrawClone(Option_t* option = "") constMENU
virtual TLine*TLine::DrawLine(Double_t x1, Double_t y1, Double_t x2, Double_t y2)
virtual TLine*TLine::DrawLineNDC(Double_t x1, Double_t y1, Double_t x2, Double_t y2)
virtual voidTObject::Dump() constMENU
virtual voidTObject::Error(const char* method, const char* msgfmt) const
virtual voidTObject::Execute(const char* method, const char* params, Int_t* error = 0)
virtual voidTObject::Execute(TMethod* method, TObjArray* params, Int_t* error = 0)
virtual voidTLine::ExecuteEvent(Int_t event, Int_t px, Int_t py)
virtual voidTObject::Fatal(const char* method, const char* msgfmt) const
virtual TObject*TObject::FindObject(const char* name) const
virtual TObject*TObject::FindObject(const TObject* obj) const
Float_tGetAngle() const
Float_tGetArrowSize() const
virtual Rectangle_tTLine::GetBBox()
virtual TPointTLine::GetBBoxCenter()
static Float_tGetDefaultAngle()
static Float_tGetDefaultArrowSize()
static Option_t*GetDefaultOption()
virtual Option_t*TObject::GetDrawOption() const
static Long_tTObject::GetDtorOnly()
virtual Color_tTAttFill::GetFillColor() const
virtual Style_tTAttFill::GetFillStyle() const
virtual const char*TObject::GetIconName() const
virtual Color_tTAttLine::GetLineColor() const
virtual Style_tTAttLine::GetLineStyle() const
virtual Width_tTAttLine::GetLineWidth() const
virtual const char*TObject::GetName() const
virtual char*TObject::GetObjectInfo(Int_t px, Int_t py) const
static Bool_tTObject::GetObjectStat()
virtual Option_t*GetOption() const
virtual const char*TObject::GetTitle() const
virtual UInt_tTObject::GetUniqueID() const
Double_tTLine::GetX1() const
Double_tTLine::GetX2() const
Double_tTLine::GetY1() const
Double_tTLine::GetY2() const
virtual Bool_tTObject::HandleTimer(TTimer* timer)
virtual ULong_tTObject::Hash() const
virtual voidTObject::Info(const char* method, const char* msgfmt) const
virtual Bool_tTObject::InheritsFrom(const char* classname) const
virtual Bool_tTObject::InheritsFrom(const TClass* cl) const
virtual voidTObject::Inspect() constMENU
voidTObject::InvertBit(UInt_t f)
virtual TClass*IsA() const
virtual Bool_tTObject::IsEqual(const TObject* obj) const
virtual Bool_tTObject::IsFolder() const
Bool_tTLine::IsHorizontal()
Bool_tTObject::IsOnHeap() const
virtual Bool_tTObject::IsSortable() const
virtual Bool_tTAttFill::IsTransparent() const
Bool_tTLine::IsVertical()
Bool_tTObject::IsZombie() const
virtual voidTLine::ls(Option_t* option = "") const
voidTObject::MayNotUse(const char* method) const
virtual voidTAttLine::Modify()
virtual Bool_tTObject::Notify()
voidTObject::Obsolete(const char* method, const char* asOfVers, const char* removedFromVers) const
voidTObject::operator delete(void* ptr)
voidTObject::operator delete(void* ptr, void* vp)
voidTObject::operator delete[](void* ptr)
voidTObject::operator delete[](void* ptr, void* vp)
void*TObject::operator new(size_t sz)
void*TObject::operator new(size_t sz, void* vp)
void*TObject::operator new[](size_t sz)
void*TObject::operator new[](size_t sz, void* vp)
TArrow&operator=(const TArrow&)
virtual voidPaint(Option_t* option = "")
virtual voidPaintArrow(Double_t x1, Double_t y1, Double_t x2, Double_t y2, Float_t arrowsize = 0.050000000000000003, Option_t* option = ">")
virtual voidTLine::PaintLine(Double_t x1, Double_t y1, Double_t x2, Double_t y2)
virtual voidTLine::PaintLineNDC(Double_t u1, Double_t v1, Double_t u2, Double_t v2)
virtual voidTObject::Pop()
virtual voidTLine::Print(Option_t* option = "") const
virtual Int_tTObject::Read(const char* name)
virtual voidTObject::RecursiveRemove(TObject* obj)
virtual voidTAttFill::ResetAttFill(Option_t* option = "")
virtual voidTAttLine::ResetAttLine(Option_t* option = "")
voidTObject::ResetBit(UInt_t f)
virtual voidTObject::SaveAs(const char* filename = "", Option_t* option = "") constMENU
virtual voidTAttFill::SaveFillAttributes(ostream& out, const char* name, Int_t coldef = 1, Int_t stydef = 1001)
virtual voidTAttLine::SaveLineAttributes(ostream& out, const char* name, Int_t coldef = 1, Int_t stydef = 1, Int_t widdef = 1)
virtual voidSavePrimitive(ostream& out, Option_t* option = "")
virtual voidSetAngle(Float_t angle = 60)MENU
virtual voidSetArrowSize(Float_t arrowsize = 0.050000000000000003)MENU
virtual voidTLine::SetBBoxCenter(const TPoint& p)
virtual voidTLine::SetBBoxCenterX(const Int_t x)
virtual voidTLine::SetBBoxCenterY(const Int_t y)
virtual voidTLine::SetBBoxX1(const Int_t x)
virtual voidTLine::SetBBoxX2(const Int_t x)
virtual voidTLine::SetBBoxY1(const Int_t y)
virtual voidTLine::SetBBoxY2(const Int_t y)
voidTObject::SetBit(UInt_t f)
voidTObject::SetBit(UInt_t f, Bool_t set)
static voidSetDefaultAngle(Float_t Angle)
static voidSetDefaultArrowSize(Float_t ArrowSize)
static voidSetDefaultOption(Option_t* Option)
virtual voidTObject::SetDrawOption(Option_t* option = "")MENU
static voidTObject::SetDtorOnly(void* obj)
virtual voidTAttFill::SetFillAttributes()MENU
virtual voidTAttFill::SetFillColor(Color_t fcolor)
virtual voidTAttFill::SetFillColorAlpha(Color_t fcolor, Float_t falpha)
virtual voidTAttFill::SetFillStyle(Style_t fstyle)
voidTLine::SetHorizontal(Bool_t set = kTRUE)TOGGLE GETTER
virtual voidTAttLine::SetLineAttributes()MENU
virtual voidTAttLine::SetLineColor(Color_t lcolor)
virtual voidTAttLine::SetLineColorAlpha(Color_t lcolor, Float_t lalpha)
virtual voidTAttLine::SetLineStyle(Style_t lstyle)
virtual voidTAttLine::SetLineWidth(Width_t lwidth)
virtual voidTLine::SetNDC(Bool_t isNDC = kTRUE)
static voidTObject::SetObjectStat(Bool_t stat)
virtual voidSetOption(Option_t* option = ">")
virtual voidTObject::SetUniqueID(UInt_t uid)
voidTLine::SetVertical(Bool_t set = kTRUE)TOGGLE GETTER
virtual voidTLine::SetX1(Double_t x1)
virtual voidTLine::SetX2(Double_t x2)
virtual voidTLine::SetY1(Double_t y1)
virtual voidTLine::SetY2(Double_t y2)
virtual voidShowMembers(TMemberInspector& insp) const
virtual voidStreamer(TBuffer&)
voidStreamerNVirtual(TBuffer& ClassDef_StreamerNVirtual_b)
virtual voidTObject::SysError(const char* method, const char* msgfmt) const
TArrow()
TArrow(const TArrow& arrow)
TArrow(Double_t x1, Double_t y1, Double_t x2, Double_t y2, Float_t arrowsize = 0.050000000000000003, Option_t* option = ">")
Bool_tTObject::TestBit(UInt_t f) const
Int_tTObject::TestBits(UInt_t f) const
virtual voidTObject::UseCurrentStyle()
virtual voidTObject::Warning(const char* method, const char* msgfmt) const
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0)
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0) const
protected:
virtual voidTObject::DoError(int level, const char* location, const char* fmt, va_list va) const
voidTObject::MakeZombie()

Data Members

public:
static TObject::(anonymous)TObject::kBitMask
static TObject::EStatusBitsTObject::kCanDelete
static TObject::EStatusBitsTObject::kCannotPick
static TObject::EStatusBitsTObject::kHasUUID
static TLine::(anonymous)TLine::kHorizontal
static TObject::EStatusBitsTObject::kInvalidObject
static TObject::(anonymous)TObject::kIsOnHeap
static TObject::EStatusBitsTObject::kIsReferenced
static TLine::(anonymous)TLine::kLineNDC
static TObject::EStatusBitsTObject::kMustCleanup
static TObject::EStatusBitsTObject::kNoContextMenu
static TObject::(anonymous)TObject::kNotDeleted
static TObject::EStatusBitsTObject::kObjInCanvas
static TObject::(anonymous)TObject::kOverwrite
static TObject::(anonymous)TObject::kSingleKey
static TLine::(anonymous)TLine::kVertical
static TObject::(anonymous)TObject::kWriteDelete
static TObject::(anonymous)TObject::kZombie
protected:
Float_tfAngleArrow opening angle (degrees)
Float_tfArrowSizeArrow Size
Color_tTAttFill::fFillColorfill area color
Style_tTAttFill::fFillStylefill area style
Color_tTAttLine::fLineColorline color
Style_tTAttLine::fLineStyleline style
Width_tTAttLine::fLineWidthline width
TStringfOptionArrow shapes
Double_tTLine::fX1X of 1st point
Double_tTLine::fX2X of 2nd point
Double_tTLine::fY1Y of 1st point
Double_tTLine::fY2Y of 2nd point
static Float_tfgDefaultAngledefault Arrow opening angle (degrees)
static Float_tfgDefaultArrowSizedefault Arrow Size
static TStringfgDefaultOptiondefault Arrow shapes

Class Charts

Inheritance Inherited Members Includes Libraries
Class Charts

Function documentation

TArrow()
 Arrow default constructor.
TArrow(Double_t x1, Double_t y1, Double_t x2, Double_t y2, Float_t arrowsize = 0.050000000000000003, Option_t* option = ">")
 Arrow normal constructor.

 Define an arrow between points x1,y1 and x2,y2
 the arrowsize is in percentage of the pad height
 Opening angle between the two sides of the arrow is fAngle (60 degrees)

  option = ">"      -------->
  option = "|->"    |------->
  option = "<"      <--------
  option = "<-|"    <-------|
  option = "->-"    ---->----
  option = "-<-"    ----<----
  option = "-|>-"   ---|>----
  option = "<>"     <------->
  option = "<|>"    <|-----|>  arrow defined by a triangle

  Note:
  - If FillColor == 0 draw open triangle else  draw full triangle with fillcolor
    default is filled with LineColor
  - "Begin" and "end" bars can be combined with any other options.
~TArrow()
 Arrow default destructor.
TArrow(const TArrow& arrow)
 Copy constructor.
void Copy(TObject& arrow) const
 Copy this arrow to arrow.
void Draw(Option_t* option = "")
 Draw this arrow with its current attributes.
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.

 if arrowsize is <= 0, arrowsize will be the current arrow size
 if option="", option will be the current arrow option
void Paint(Option_t* option = "")
 Paint this arrow with its current attributes.
void PaintArrow(Double_t x1, Double_t y1, Double_t x2, Double_t y2, Float_t arrowsize = 0.050000000000000003, Option_t* option = ">")
 Draw this arrow


                             +
                             |.
                             | .
                             |  .
     +-----------------------|---+------------------+
  (x1,y1)                    |  .                (x2,y2)
                             | .
                             |.
                             +
void SavePrimitive(ostream& out, Option_t* option = "")
 Save primitive as a C++ statement(s) on output stream out
void SetDefaultAngle(Float_t Angle)
 Set default angle.
void SetDefaultArrowSize(Float_t ArrowSize)
 Set default arrow sive.
void SetDefaultOption(Option_t* Option)
 Set default option.
Float_t GetDefaultAngle()
 Get default angle.
Float_t GetDefaultArrowSize()
 Get default arrow size.
Option_t * GetDefaultOption()
 Get default option.
Float_t GetAngle() const
{return fAngle;}
Float_t GetArrowSize() const
{return fArrowSize;}
Option_t * GetOption() const
{ return fOption.Data();}
void SetAngle(Float_t angle = 60)
{fAngle=angle;}
void SetArrowSize(Float_t arrowsize = 0.050000000000000003)
{fArrowSize=arrowsize;}
void SetOption(Option_t* option = ">")
{ fOption = option;}