ROOT logo
ROOT » GRAF3D » G3D » TAxis3D

class TAxis3D: public TNamed

   The 3D axis painter class


  This class provide up to 3 axice to any 3D ROOT plot and
  "ZOOM" service.
  ExecuteEvent() method does provide zooming and moving a projection
  3D object within TPad client area. With Zoom mode on the user can access
  TAxis3D context menu and set /change the attributes of axice all together
  or separately.

  To add the 3D rulers to any 3D view one has to create
  an instance of this class and Draw it.

   TAxis3D rulers;
   rulers.Draw();

  One can use a static method to create ruler and attach it to the current gPad

   TAxis3D::ToggleRulers(); // Brings the 3D axice up
   TAxis3D::ToggleRulers(); // next calls remove the rulers from the TPad etc

   To activate Zoomer one may call

   TAxis3D::ToggleZoom();

  each time one needs move or zoom the image. Then the user can:
    -  move:
 

    -  zoom:
 

  its 3D view with <left-mouse button> press / move.
  The "Zoom" deactivates itself just the user release the <left-mouse button>

  To change attributes of the rulers attached to the current Pad, one may
  query its pointer first:

  TAxis3D *axis = TAxis3D::GetPadAxis(); // Ask axis pointer
  if (axis) {
    TAxis3D::ToggleRulers()     // To pop axice down
    axis->SetLabelColor(kBlue); // Paint the axice labels with blue color
    axis->SetAxisColor(kRed);   // Paint the axice itself with blue color
    TAxis3D::ToggleRulers()     // To pop axice up
  }

 The attributes of the created axice are affected by the current style
 (see TStyle class ) and Set... methods of this class

  For example:

   gStyle->SetAxisColor(kYellow,"X");
   gStyle->SetAxisColor(kYellow,"Y");
   gStyle->SetAxisColor(kYellow,"Z");

   gStyle->SetLabelColor(kYellow,"X");
   gStyle->SetLabelColor(kYellow,"Y");
   gStyle->SetLabelColor(kYellow,"Z");

   TAxis3D::ToggleRulers();
   TAxis3D::ToggleRulers();

  will draw all axice and labels with yellow color.

Function Members (Methods)

public:
TAxis3D()
TAxis3D(Option_t* option)
TAxis3D(const TAxis3D& axis)
virtual~TAxis3D()
voidTObject::AbstractMethod(const char* method) const
virtual voidTObject::AppendPad(Option_t* option = "")
virtual voidBrowse(TBrowser* b)
static TClass*Class()
virtual const char*TObject::ClassName() const
virtual voidTNamed::Clear(Option_t* option = "")
virtual TObject*TNamed::Clone(const char* newname = "") const
virtual Int_tTNamed::Compare(const TObject* obj) const
virtual voidTObject::Delete(Option_t* option = "")MENU
virtual Int_tDistancetoPrimitive(Int_t px, Int_t py)
virtual voidTObject::Draw(Option_t* option = "")
virtual voidTObject::DrawClass() constMENU
virtual TObject*TObject::DrawClone(Option_t* option = "") constMENU
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 voidExecuteEvent(Int_t event, Int_t px, Int_t py)
virtual voidTObject::Fatal(const char* method, const char* msgfmt) const
virtual voidTNamed::FillBuffer(char*& buffer)
virtual TObject*TObject::FindObject(const char* name) const
virtual TObject*TObject::FindObject(const TObject* obj) const
virtual Color_tGetAxisColor(Option_t* axis = "X") const
virtual voidGetCenter(Axis_t* center)
virtual Option_t*TObject::GetDrawOption() const
static Long_tTObject::GetDtorOnly()
virtual const char*TObject::GetIconName() const
virtual Color_tGetLabelColor(Option_t* axis = "X") const
virtual Style_tGetLabelFont(Option_t* axis = "X") const
virtual Float_tGetLabelOffset(Option_t* axis = "X") const
virtual Float_tGetLabelSize(Option_t* axis = "X") const
virtual voidGetLowEdge(Axis_t* edge)
virtual const char*TNamed::GetName() const
virtual Int_tGetNdivisions(Option_t* axis = "X") const
virtual char*GetObjectInfo(Int_t px, Int_t py) const
static Bool_tTObject::GetObjectStat()
virtual Option_t*GetOption() const
static TAxis3D*GetPadAxis(TVirtualPad* pad = 0)
virtual Float_tGetTickLength(Option_t* axis = "X") const
virtual const char*TNamed::GetTitle() const
virtual Float_tGetTitleOffset(Option_t* axis = "X") const
virtual UInt_tTObject::GetUniqueID() const
virtual TAxis*GetXaxis()
virtual TAxis*GetYaxis()
virtual TAxis*GetZaxis()
virtual Bool_tTObject::HandleTimer(TTimer* timer)
virtual ULong_tTNamed::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_tIsFolder() const
Bool_tTObject::IsOnHeap() const
virtual Bool_tTNamed::IsSortable() const
Bool_tTObject::IsZombie() const
virtual voidTNamed::ls(Option_t* option = "") const
voidTObject::MayNotUse(const char* method) const
virtual Bool_tTObject::Notify()
static voidTObject::operator delete(void* ptr)
static voidTObject::operator delete(void* ptr, void* vp)
static voidTObject::operator delete[](void* ptr)
static 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)
TNamed&TNamed::operator=(const TNamed& rhs)
virtual voidPaint(Option_t* option = "")
voidPaintAxis(TGaxis* axis, Float_t ang)
static Double_t*PixeltoXYZ(Double_t px, Double_t py, Double_t* point3D, TView* view = 0)
virtual voidTObject::Pop()
virtual voidTNamed::Print(Option_t* option = "") const
virtual Int_tTObject::Read(const char* name)
virtual voidTObject::RecursiveRemove(TObject* obj)
voidTObject::ResetBit(UInt_t f)
virtual voidTObject::SaveAs(const char* filename = "", Option_t* option = "") constMENU
virtual voidSavePrimitive(ostream& out, Option_t* option = "")
virtual voidSetAxisColor(Color_t color = 1, Option_t* axis = "*")MENU
virtual voidSetAxisRange(Double_t xmin, Double_t xmax, Option_t* axis = "*")
voidTObject::SetBit(UInt_t f)
voidTObject::SetBit(UInt_t f, Bool_t set)
virtual voidTObject::SetDrawOption(Option_t* option = "")MENU
static voidTObject::SetDtorOnly(void* obj)
virtual voidSetLabelColor(Color_t color = 1, Option_t* axis = "*")MENU
virtual voidSetLabelFont(Style_t font = 62, Option_t* axis = "*")MENU
virtual voidSetLabelOffset(Float_t offset = 0.005, Option_t* axis = "*")MENU
virtual voidSetLabelSize(Float_t size = 0.02, Option_t* axis = "*")MENU
virtual voidTNamed::SetName(const char* name)MENU
virtual voidTNamed::SetNameTitle(const char* name, const char* title)
virtual voidSetNdivisions(Int_t n = 510, Option_t* axis = "*")MENU
static voidTObject::SetObjectStat(Bool_t stat)
virtual voidSetOption(Option_t* option = " ")
virtual voidSetTickLength(Float_t length = 0.02, Option_t* axis = "*")MENU
virtual voidTNamed::SetTitle(const char* title = "")MENU
virtual voidSetTitleOffset(Float_t offset = 1, Option_t* axis = "*")MENU
virtual voidTObject::SetUniqueID(UInt_t uid)
virtual voidSetXTitle(const char* title)MENU
virtual voidSetYTitle(const char* title)MENU
virtual voidSetZTitle(const char* title)MENU
virtual voidShowMembers(TMemberInspector& insp)
virtual Int_tTNamed::Sizeof() const
Bool_t&StickyZoom()
virtual voidStreamer(TBuffer& b)
voidStreamerNVirtual(TBuffer& b)
virtual voidTObject::SysError(const char* method, const char* msgfmt) const
Bool_tTObject::TestBit(UInt_t f) const
Int_tTObject::TestBits(UInt_t f) const
static TAxis3D*ToggleRulers(TVirtualPad* pad = 0)
static TAxis3D*ToggleZoom(TVirtualPad* pad = 0)
virtual voidUseCurrentStyle()
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
Bool_t&Zoom()
protected:
virtual voidCopy(TObject& hnew) const
virtual voidTObject::DoError(int level, const char* location, const char* fmt, va_list va) const
voidInitSet()
voidTObject::MakeZombie()
Bool_tSwitchZoom()
private:
Int_tAxisChoice(Option_t* axis) const
voidBuild()

Data Members

protected:
TAxisfAxis[3]X/Y/Z axis
TStringTNamed::fNameobject identifier
TStringfOptionOptions (is not use yet)
TAxis*fSelected! The selected axis to play with
Bool_tfStickyZoomStickyZoom mode: zoom will not be disabled after zooming attempt if true
TStringTNamed::fTitleobject title
Bool_tfZoomModeZoom mode for the entire parent TPad
static const char*fgRulerNameThe default object name

Class Charts

Inheritance Inherited Members Includes Libraries
Class Charts

Function documentation

TAxis3D()
 Normal constructor.
TAxis3D(Option_t* option)
 Normal constructor.
TAxis3D(const TAxis3D& axis)
 Copy  constructor.
void Copy(TObject& hnew) const
 Copy axis3d
void InitSet()
 Initialization.
void Browse(TBrowser* b)
 Add all 3 axes to the TBrowser
Int_t DistancetoPrimitive(Int_t px, Int_t py)
 Compute distance from point px,py to a line.
void ExecuteEvent(Int_t event, Int_t px, Int_t py)
 Execute action corresponding to one event.

 This member function is called when an axis is clicked with the locator
char * GetObjectInfo(Int_t px, Int_t py) const
  Dummy method
  returns the const char * to "axis3d"
void Paint(Option_t* option = "")
 Paint axis over 3D view on the TPad
void PaintAxis(TGaxis* axis, Float_t ang)
 Draw the axis for TView object.

 The original idea belongs:

 void THistPainter::PaintLegoAxis(TGaxis *axis, Double_t ang)
Double_t * PixeltoXYZ(Double_t px, Double_t py, Double_t* point3D, TView* view = 0)
 Convert "screen pixel" coordinates to some center of 3D WC coordinate
 if view and gPad present
void SavePrimitive(ostream& out, Option_t* option = "")
 Save primitive as a C++ statement(s) on output stream out
void UseCurrentStyle()
 Replace current attributes by current style.
Int_t AxisChoice(Option_t* axis) const
 Return the axis index by its name
Int_t GetNdivisions(Option_t* axis = "X") const
 Get number of divisions.
Color_t GetAxisColor(Option_t* axis = "X") const
 Get axis color.
Color_t GetLabelColor(Option_t* axis = "X") const
 Get label color.
Style_t GetLabelFont(Option_t* axis = "X") const
 Get label font.
Float_t GetLabelOffset(Option_t* axis = "X") const
 Get label offset.
Float_t GetLabelSize(Option_t* axis = "X") const
 Get label size.
Float_t GetTickLength(Option_t* axis = "X") const
 Get tick mark length.
Float_t GetTitleOffset(Option_t* axis = "X") const
 Get title offset.
void SetNdivisions(Int_t n = 510, Option_t* axis = "*")
 Set number of divisions.
void SetAxisColor(Color_t color = 1, Option_t* axis = "*")
 Set axis color.
void SetAxisRange(Double_t xmin, Double_t xmax, Option_t* axis = "*")
 Set axis range.
void SetLabelColor(Color_t color = 1, Option_t* axis = "*")
 Set label color.
void SetLabelFont(Style_t font = 62, Option_t* axis = "*")
 Set label font.
void SetLabelOffset(Float_t offset = 0.005, Option_t* axis = "*")
 Set label offset.
void SetLabelSize(Float_t size = 0.02, Option_t* axis = "*")
 Set label size.
void SetTickLength(Float_t length = 0.02, Option_t* axis = "*")
 Set tick mark length.
void SetTitleOffset(Float_t offset = 1, Option_t* axis = "*")
 Set title offset.
TAxis3D * GetPadAxis(TVirtualPad* pad = 0)
 Returns the "pad" Axis3D object pointer if any.
TAxis3D * ToggleRulers(TVirtualPad* pad = 0)
 Turn ON / OFF the "Ruler", TAxis3D object attached
 to the current pad
TAxis3D * ToggleZoom(TVirtualPad* pad = 0)
 Turn ON / OFF the "Ruler" and "zoom mode" of the TAxis3D object attached
 to the current pad (if pad = 0; gPad is used "by default")

 User is given a chance to either:
  1.  move the center of the 3D scene at the cursor position
  2.  zoom view with mouse "drugging" the bounder rectangle with "left" mouse
  3.  Change the axuce attributes via TContextMenu with "righ mouse button click"
Bool_t SwitchZoom()
{Bool_t s = fZoomMode; fZoomMode = !fZoomMode; return s;}
void Build()
virtual ~TAxis3D()
{;}
Bool_t & StickyZoom()
{return fStickyZoom;}
Bool_t & Zoom()
{return fZoomMode;}
void GetCenter(Axis_t* center)
{fAxis[0].GetCenter(center);}
void GetLowEdge(Axis_t* edge)
{fAxis[0].GetLowEdge(edge);}
Option_t * GetOption() const
{return fOption.Data();}
TAxis * GetXaxis()
{return &fAxis[0];}
TAxis * GetYaxis()
{return &fAxis[1];}
TAxis * GetZaxis()
{return &fAxis[2];}
Bool_t IsFolder() const
{ return kTRUE;}
void SetOption(Option_t* option = " ")
{fOption = option;}
void SetXTitle(const char* title)
{fAxis[0].SetTitle(title);}
void SetYTitle(const char* title)
{fAxis[1].SetTitle(title);}
void SetZTitle(const char* title)
{fAxis[2].SetTitle(title);}