private:
Int_t AxisChoice(Option_t* axis) const void Build() protected:
virtual void Copy(TObject& hnew) void InitSet() Bool_t SwitchZoom() public:
TAxis3D TAxis3D() TAxis3D TAxis3D(Option_t* option) TAxis3D TAxis3D(const TAxis3D& axis) virtual void ~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 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) virtual void Streamer(TBuffer& b) void StreamerNVirtual(TBuffer& b) static TAxis3D* ToggleRulers(TVirtualPad* pad = 0) static TAxis3D* ToggleZoom(TVirtualPad* pad = 0) virtual void UseCurrentStyle()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
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.
*-*-*-*-*-*-*Copy this histogram structure to newth1*-*-*-*-*-*-*-*-*-*-*-* *-* =======================================
Add all 3 axices to the TBrowser
*-*-*-*-*-*-*-*-*-*-*Compute distance from point px,py to a line*-*-*-*-*-* *-* =========================================== *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
*-*-*-*-*-*-*-*-*-*-*Execute action corresponding to one event*-*-*-* *-* ========================================= *-* This member function is called when an axis is clicked with the locator *-* *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Dummy method returns the const char * to "axis3d"
Paint axis over 3D view on the TPad
*-*-*-*-*-*-*Draw the axis for TView object *-*-*-*-*-*-*-*-*-* *-* ============================== *-* The original idea belongs: *-* *-* void THistPainter::PaintLegoAxis(TGaxis *axis, Double_t ang) *-*
Convert "screen pixel" coordinates to some center of 3D WC coordinate if view and gPad present
Save primitive as a C++ statement(s) on output stream out
*-*-*-*-*-*Replace current attributes by current style*-*-*-*-* *-* ===========================================
Return the axis index by its name
returns the "pad" Axis3D object pointer if any
Turn ON / OFF the "Ruler", TAxis3D object attached to the current 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"
void Build() Bool_t SwitchZoom() 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) void ~TAxis3D()