library: libGraf3d #include "TAxis3D.h"

# TAxis3D

class description - source file - inheritance tree (.pdf)

## class TAxis3D : public TNamed

| Inheritance Chart:
`TObject`
| <- | `TNamed`
| <- | `TAxis3D` |

        private:

          Int_t AxisChoice(Option_t* axis) const
           void Build()

        protected:

          virtual void Copy(TObject& hnew) const
                  void InitSet()
                Bool_t SwitchZoom()

        public:

                            TAxis3D()
                            TAxis3D(Option_t* option)
                            TAxis3D(const TAxis3D& axis)
                    virtual ~TAxis3D()
               virtual void Browse(TBrowser* b)
             static TClass* Class()
              virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
               virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
            virtual Color_t GetAxisColor(Option_t* axis = "X") const
               virtual void GetCenter(Axis_t* center)
            virtual Color_t GetLabelColor(Option_t* axis = "X") const
            virtual Style_t GetLabelFont(Option_t* axis = "X") const
            virtual Float_t GetLabelOffset(Option_t* axis = "X") const
            virtual Float_t GetLabelSize(Option_t* axis = "X") const
               virtual void GetLowEdge(Axis_t* edge)
              virtual Int_t GetNdivisions(Option_t* axis = "X") const
              virtual char* GetObjectInfo(Int_t px, Int_t py) const
          virtual Option_t* GetOption() const
            static TAxis3D* GetPadAxis(TVirtualPad* pad = 0)
            virtual Float_t GetTickLength(Option_t* axis = "X") const
            virtual Float_t GetTitleOffset(Option_t* axis = "X") const
             virtual TAxis* GetXaxis()
             virtual TAxis* GetYaxis()
             virtual TAxis* GetZaxis()
            virtual TClass* IsA() const
             virtual Bool_t IsFolder() const
                   TAxis3D& operator=(const TAxis3D&)
               virtual void Paint(Option_t* option = "")
                       void PaintAxis(TGaxis* axis, Float_t ang)
           static Double_t* PixeltoXYZ(Double_t px, Double_t py, Double_t* point3D, TView* view = 0)
               virtual void SavePrimitive(ofstream& out, Option_t* option)
               virtual void SetAxisColor(Color_t color = 1, Option_t* axis = "*")
               virtual void SetAxisRange(Double_t xmin, Double_t xmax, Option_t* axis = "*")
               virtual void SetLabelColor(Color_t color = 1, Option_t* axis = "*")
               virtual void SetLabelFont(Style_t font = 62, Option_t* axis = "*")
               virtual void SetLabelOffset(Float_t offset = 0.005, Option_t* axis = "*")
               virtual void SetLabelSize(Float_t size = 0.02, Option_t* axis = "*")
               virtual void SetNdivisions(Int_t n = 510, Option_t* axis = "*")
               virtual void SetOption(Option_t* option = " ")
               virtual void SetTickLength(Float_t length = 0.02, Option_t* axis = "*")
               virtual void SetTitleOffset(Float_t offset = 1, Option_t* axis = "*")
               virtual void SetXTitle(const char* title)
               virtual void SetYTitle(const char* title)
               virtual void SetZTitle(const char* title)
               virtual void ShowMembers(TMemberInspector& insp, char* parent)
                    Bool_t& StickyZoom()
               virtual void Streamer(TBuffer& b)
                       void StreamerNVirtual(TBuffer& b)
            static TAxis3D* ToggleRulers(TVirtualPad* pad = 0)
            static TAxis3D* ToggleZoom(TVirtualPad* pad = 0)
               virtual void UseCurrentStyle()
                    Bool_t& Zoom()

### Data Members

        protected:

                         TAxis fAxis[3]     X/Y/Z axis
                       TString fOption      Options (is not use yet)
          static const Char_t* rulerName    The default object name
                        TAxis* fSelected    !  The selected axis to play with
                        Bool_t fZoomMode    Zoom mode for the entire parent TPad
                        Bool_t fStickyZoom  StickyZoom mode:  zoom will not be disabled    after zooming attempt if true

## Class Description

       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.

TAxis3D() : TNamed(TAxis3D::rulerName,"ruler")

TAxis3D(Option_t *) : TNamed(TAxis3D::rulerName,"ruler")

TAxis3D(const TAxis3D &axis) : TNamed(axis)

void Copy(TObject &obj) const

    *-*-*-*-*-*-*Copy this histogram structure to newth1*-*-*-*-*-*-*-*-*-*-*-*
    *-*          =======================================

void InitSet()

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 , Int_t ) const

      Dummy method
      returns the const char * to "axis3d"

void Paint(Option_t *)

     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)

     Convert "screen pixel" coordinates to some center of 3D WC coordinate
     if view and gPad present

void SavePrimitive(ofstream &out, Option_t *)

     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) const

Color_t GetAxisColor( Option_t *axis) const

Color_t GetLabelColor( Option_t *axis) const

Style_t GetLabelFont( Option_t *axis) const

Float_t GetLabelOffset( Option_t *axis) const

Float_t GetLabelSize( Option_t *axis) const

Float_t GetTickLength( Option_t *axis) const

Float_t GetTitleOffset( Option_t *axis) const

void SetNdivisions(Int_t n, Option_t *axis)

void SetAxisColor(Color_t color, Option_t *axis)

void SetAxisRange(Double_t xmin, Double_t xmax, Option_t *axis)

void SetLabelColor(Color_t color, Option_t *axis)

void SetLabelFont(Style_t font, Option_t *axis)

void SetLabelOffset(Float_t offset, Option_t *axis)

void SetLabelSize(Float_t size, Option_t *axis)

void SetTickLength(Float_t length, Option_t *axis)

void SetTitleOffset(Float_t offset, Option_t *axis)

TAxis3D* GetPadAxis(TVirtualPad *pad)

     returns the "pad" Axis3D object pointer if any

TAxis3D* ToggleRulers(TVirtualPad *pad)

     Turn ON / OFF the "Ruler", TAxis3D object attached
     to the current pad

TAxis3D* ToggleZoom(TVirtualPad *pad)

     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"

### Inline Functions

                   void ~TAxis3D()
                   void Build()
                 Bool_t SwitchZoom()
                Bool_t& StickyZoom()
                Bool_t& Zoom()
                   void GetCenter(Axis_t* center)
                   void GetLowEdge(Axis_t* edge)
              Option_t* GetOption() const
                 TAxis* GetXaxis()
                 TAxis* GetYaxis()
                 TAxis* GetZaxis()
                 Bool_t IsFolder() const
                   void SetOption(Option_t* option = " ")
                   void SetXTitle(const char* title)
                   void SetYTitle(const char* title)
                   void SetZTitle(const char* title)
                TClass* Class()
                TClass* IsA() const
                   void ShowMembers(TMemberInspector& insp, char* parent)
                   void Streamer(TBuffer& b)
                   void StreamerNVirtual(TBuffer& b)
               TAxis3D& operator=(const TAxis3D&)

Author: Valery Fine(fine@mail.cern.ch) 07/01/2000
Last update: root/g3d:$Name: $:$Id: TAxis3D.cxx,v 1.15 2003/07/12 08:08:37 brun Exp $