The 3D axis painter class.
This class provide up to 3 axes 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 axes 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.
One can use a static method to create ruler and attach it to the current gPad
To activate Zoomer one may call
each time one needs move or zoom the image. Then the user can:
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:
The attributes of the created axes are affected by the current style (see TStyle class ) and Set... methods of this class
For example:
will draw all axes and labels with yellow color.
Public Member Functions | |
TAxis3D () | |
Normal constructor. | |
TAxis3D (const TAxis3D &axis) | |
Copy constructor. | |
TAxis3D (Option_t *option) | |
Normal constructor. | |
virtual | ~TAxis3D () |
virtual void | Browse (TBrowser *b) |
Add all 3 axes to the TBrowser. | |
virtual Int_t | DistancetoPrimitive (Int_t px, Int_t py) |
Compute distance from point px,py to a line. | |
virtual void | ExecuteEvent (Int_t event, Int_t px, Int_t py) |
Execute action corresponding to one event. | |
virtual Color_t | GetAxisColor (Option_t *axis="X") const |
Get axis color. | |
virtual void | GetCenter (Axis_t *center) |
virtual Color_t | GetLabelColor (Option_t *axis="X") const |
Get label color. | |
virtual Style_t | GetLabelFont (Option_t *axis="X") const |
Get label font. | |
virtual Float_t | GetLabelOffset (Option_t *axis="X") const |
Get label offset. | |
virtual Float_t | GetLabelSize (Option_t *axis="X") const |
Get label size. | |
virtual void | GetLowEdge (Axis_t *edge) |
virtual Int_t | GetNdivisions (Option_t *axis="X") const |
Get number of divisions. | |
virtual char * | GetObjectInfo (Int_t px, Int_t py) const |
Dummy method returns the const char * to "axis3d". | |
Option_t * | GetOption () const |
virtual Float_t | GetTickLength (Option_t *axis="X") const |
Get tick mark length. | |
virtual Float_t | GetTitleOffset (Option_t *axis="X") const |
Get title offset. | |
virtual TAxis * | GetXaxis () |
virtual TAxis * | GetYaxis () |
virtual TAxis * | GetZaxis () |
virtual Bool_t | IsFolder () const |
Returns kTRUE in case object contains browsable objects (like containers or lists of other objects). | |
virtual 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. | |
virtual void | SavePrimitive (std::ostream &out, Option_t *option="") |
Save primitive as a C++ statement(s) on output stream out. | |
virtual void | SetAxisColor (Color_t color=1, Option_t *axis="*") |
Set axis color. | |
virtual void | SetAxisRange (Double_t xmin, Double_t xmax, Option_t *axis="*") |
Set axis range. | |
virtual void | SetLabelColor (Color_t color=1, Option_t *axis="*") |
Set label color. | |
virtual void | SetLabelFont (Style_t font=62, Option_t *axis="*") |
Set label font. | |
virtual void | SetLabelOffset (Float_t offset=0.005, Option_t *axis="*") |
Set label offset. | |
virtual void | SetLabelSize (Float_t size=0.02, Option_t *axis="*") |
Set label size. | |
virtual void | SetNdivisions (Int_t n=510, Option_t *axis="*") |
Set number of divisions. | |
virtual void | SetOption (Option_t *option=" ") |
virtual void | SetTickLength (Float_t length=0.02, Option_t *axis="*") |
Set tick mark length. | |
virtual void | SetTitleOffset (Float_t offset=1, Option_t *axis="*") |
Set title offset. | |
virtual void | SetXTitle (const char *title) |
virtual void | SetYTitle (const char *title) |
virtual void | SetZTitle (const char *title) |
Bool_t & | StickyZoom () |
void | UseCurrentStyle () |
Replace current attributes by current style. | |
Bool_t & | Zoom () |
Public Member Functions inherited from TNamed | |
TNamed () | |
TNamed (const char *name, const char *title) | |
TNamed (const TNamed &named) | |
TNamed copy ctor. | |
TNamed (const TString &name, const TString &title) | |
virtual | ~TNamed () |
TNamed destructor. | |
virtual void | Clear (Option_t *option="") |
Set name and title to empty strings (""). | |
virtual TObject * | Clone (const char *newname="") const |
Make a clone of an object using the Streamer facility. | |
virtual Int_t | Compare (const TObject *obj) const |
Compare two TNamed objects. | |
virtual void | FillBuffer (char *&buffer) |
Encode TNamed into output buffer. | |
virtual const char * | GetName () const |
Returns name of object. | |
virtual const char * | GetTitle () const |
Returns title of object. | |
virtual ULong_t | Hash () const |
Return hash value for this object. | |
virtual Bool_t | IsSortable () const |
virtual void | ls (Option_t *option="") const |
List TNamed name and title. | |
TNamed & | operator= (const TNamed &rhs) |
TNamed assignment operator. | |
virtual void | Print (Option_t *option="") const |
Print TNamed name and title. | |
virtual void | SetName (const char *name) |
Set the name of the TNamed. | |
virtual void | SetNameTitle (const char *name, const char *title) |
Set all the TNamed parameters (name and title). | |
virtual void | SetTitle (const char *title="") |
Set the title of the TNamed. | |
virtual Int_t | Sizeof () const |
Return size of the TNamed part of the TObject. | |
Public Member Functions inherited from TObject | |
TObject () | |
TObject constructor. | |
TObject (const TObject &object) | |
TObject copy ctor. | |
virtual | ~TObject () |
TObject destructor. | |
void | AbstractMethod (const char *method) const |
Use this method to implement an "abstract" method that you don't want to leave purely abstract. | |
virtual void | AppendPad (Option_t *option="") |
Append graphics object to current pad. | |
ULong_t | CheckedHash () |
Check and record whether this class has a consistent Hash/RecursiveRemove setup (*) and then return the regular Hash value for this object. | |
virtual const char * | ClassName () const |
Returns name of class to which the object belongs. | |
virtual void | Delete (Option_t *option="") |
Delete this object. | |
virtual void | Draw (Option_t *option="") |
Default Draw method for all objects. | |
virtual void | DrawClass () const |
Draw class inheritance tree of the class to which this object belongs. | |
virtual TObject * | DrawClone (Option_t *option="") const |
Draw a clone of this object in the current selected pad for instance with: gROOT->SetSelectedPad(gPad) . | |
virtual void | Dump () const |
Dump contents of object on stdout. | |
virtual void | Error (const char *method, const char *msgfmt,...) const |
Issue error message. | |
virtual void | Execute (const char *method, const char *params, Int_t *error=0) |
Execute method on this object with the given parameter string, e.g. | |
virtual void | Execute (TMethod *method, TObjArray *params, Int_t *error=0) |
Execute method on this object with parameters stored in the TObjArray. | |
virtual void | Fatal (const char *method, const char *msgfmt,...) const |
Issue fatal error message. | |
virtual TObject * | FindObject (const char *name) const |
Must be redefined in derived classes. | |
virtual TObject * | FindObject (const TObject *obj) const |
Must be redefined in derived classes. | |
virtual Option_t * | GetDrawOption () const |
Get option used by the graphics system to draw this object. | |
virtual const char * | GetIconName () const |
Returns mime type name of object. | |
virtual UInt_t | GetUniqueID () const |
Return the unique object id. | |
virtual Bool_t | HandleTimer (TTimer *timer) |
Execute action in response of a timer timing out. | |
Bool_t | HasInconsistentHash () const |
Return true is the type of this object is known to have an inconsistent setup for Hash and RecursiveRemove (i.e. | |
virtual void | Info (const char *method, const char *msgfmt,...) const |
Issue info message. | |
virtual Bool_t | InheritsFrom (const char *classname) const |
Returns kTRUE if object inherits from class "classname". | |
virtual Bool_t | InheritsFrom (const TClass *cl) const |
Returns kTRUE if object inherits from TClass cl. | |
virtual void | Inspect () const |
Dump contents of this object in a graphics canvas. | |
void | InvertBit (UInt_t f) |
virtual Bool_t | IsEqual (const TObject *obj) const |
Default equal comparison (objects are equal if they have the same address in memory). | |
R__ALWAYS_INLINE Bool_t | IsOnHeap () const |
R__ALWAYS_INLINE Bool_t | IsZombie () const |
void | MayNotUse (const char *method) const |
Use this method to signal that a method (defined in a base class) may not be called in a derived class (in principle against good design since a child class should not provide less functionality than its parent, however, sometimes it is necessary). | |
virtual Bool_t | Notify () |
This method must be overridden to handle object notification. | |
void | Obsolete (const char *method, const char *asOfVers, const char *removedFromVers) const |
Use this method to declare a method obsolete. | |
void | operator delete (void *ptr) |
Operator delete. | |
void | operator delete[] (void *ptr) |
Operator delete []. | |
void * | operator new (size_t sz) |
void * | operator new (size_t sz, void *vp) |
void * | operator new[] (size_t sz) |
void * | operator new[] (size_t sz, void *vp) |
TObject & | operator= (const TObject &rhs) |
TObject assignment operator. | |
virtual void | Pop () |
Pop on object drawn in a pad to the top of the display list. | |
virtual Int_t | Read (const char *name) |
Read contents of object with specified name from the current directory. | |
virtual void | RecursiveRemove (TObject *obj) |
Recursively remove this object from a list. | |
void | ResetBit (UInt_t f) |
virtual void | SaveAs (const char *filename="", Option_t *option="") const |
Save this object in the file specified by filename. | |
void | SetBit (UInt_t f) |
void | SetBit (UInt_t f, Bool_t set) |
Set or unset the user status bits as specified in f. | |
virtual void | SetDrawOption (Option_t *option="") |
Set drawing option for object. | |
virtual void | SetUniqueID (UInt_t uid) |
Set the unique object id. | |
virtual void | SysError (const char *method, const char *msgfmt,...) const |
Issue system error message. | |
R__ALWAYS_INLINE Bool_t | TestBit (UInt_t f) const |
Int_t | TestBits (UInt_t f) const |
virtual void | Warning (const char *method, const char *msgfmt,...) const |
Issue warning message. | |
virtual Int_t | Write (const char *name=0, Int_t option=0, Int_t bufsize=0) |
Write this object to the current directory. | |
virtual Int_t | Write (const char *name=0, Int_t option=0, Int_t bufsize=0) const |
Write this object to the current directory. | |
Static Public Member Functions | |
static TAxis3D * | GetPadAxis (TVirtualPad *pad=0) |
Returns the "pad" Axis3D object pointer if any. | |
static 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. | |
static TAxis3D * | ToggleRulers (TVirtualPad *pad=0) |
Turn ON / OFF the "Ruler", TAxis3D object attached to the current pad. | |
static 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") | |
Static Public Member Functions inherited from TObject | |
static Long_t | GetDtorOnly () |
Return destructor only flag. | |
static Bool_t | GetObjectStat () |
Get status of object stat flag. | |
static void | SetDtorOnly (void *obj) |
Set destructor only flag. | |
static void | SetObjectStat (Bool_t stat) |
Turn on/off tracking of objects in the TObjectTable. | |
Protected Member Functions | |
virtual void | Copy (TObject &hnew) const |
Copy axis3d. | |
void | InitSet () |
Initialization. | |
Bool_t | SwitchZoom () |
Protected Member Functions inherited from TObject | |
virtual void | DoError (int level, const char *location, const char *fmt, va_list va) const |
Interface to ErrorHandler (protected). | |
void | MakeZombie () |
Protected Attributes | |
TAxis | fAxis [3] |
TString | fOption |
TAxis * | fSelected |
Bool_t | fStickyZoom |
Bool_t | fZoomMode |
The selected axis to play with. | |
Protected Attributes inherited from TNamed | |
TString | fName |
TString | fTitle |
Static Protected Attributes | |
static const char * | fgRulerName = "axis3druler" |
Private Member Functions | |
Int_t | AxisChoice (Option_t *axis) const |
Return the axis index by its name. | |
void | Build () |
Additional Inherited Members | |
Public Types inherited from TObject | |
enum | { kIsOnHeap = 0x01000000 , kNotDeleted = 0x02000000 , kZombie = 0x04000000 , kInconsistent = 0x08000000 , kBitMask = 0x00ffffff } |
enum | { kSingleKey = BIT(0) , kOverwrite = BIT(1) , kWriteDelete = BIT(2) } |
enum | EDeprecatedStatusBits { kObjInCanvas = BIT(3) } |
enum | EStatusBits { kCanDelete = BIT(0) , kMustCleanup = BIT(3) , kIsReferenced = BIT(4) , kHasUUID = BIT(5) , kCannotPick = BIT(6) , kNoContextMenu = BIT(8) , kInvalidObject = BIT(13) } |
Protected Types inherited from TObject | |
enum | { kOnlyPrepStep = BIT(3) } |
#include <TAxis3D.h>
TAxis3D::TAxis3D | ( | ) |
Normal constructor.
Definition at line 109 of file TAxis3D.cxx.
TAxis3D::TAxis3D | ( | Option_t * | option | ) |
Normal constructor.
Definition at line 120 of file TAxis3D.cxx.
TAxis3D::TAxis3D | ( | const TAxis3D & | axis | ) |
Copy constructor.
Definition at line 131 of file TAxis3D.cxx.
Return the axis index by its name.
Definition at line 542 of file TAxis3D.cxx.
Add all 3 axes to the TBrowser.
Reimplemented from TObject.
Definition at line 163 of file TAxis3D.cxx.
|
private |
Compute distance from point px,py to a line.
Reimplemented from TObject.
Definition at line 171 of file TAxis3D.cxx.
Execute action corresponding to one event.
This member function is called when an axis is clicked with the locator
Reimplemented from TObject.
Definition at line 189 of file TAxis3D.cxx.
Get axis color.
Definition at line 564 of file TAxis3D.cxx.
Get label color.
Definition at line 574 of file TAxis3D.cxx.
Get label font.
Definition at line 584 of file TAxis3D.cxx.
Get label offset.
Definition at line 594 of file TAxis3D.cxx.
Get label size.
Definition at line 604 of file TAxis3D.cxx.
Get number of divisions.
Definition at line 554 of file TAxis3D.cxx.
Dummy method returns the const char * to "axis3d".
Reimplemented from TObject.
Definition at line 301 of file TAxis3D.cxx.
|
inlinevirtual |
|
static |
Returns the "pad" Axis3D object pointer if any.
Definition at line 720 of file TAxis3D.cxx.
Get tick mark length.
Definition at line 614 of file TAxis3D.cxx.
Get title offset.
Definition at line 624 of file TAxis3D.cxx.
|
protected |
Initialization.
Definition at line 148 of file TAxis3D.cxx.
|
inlinevirtual |
Paint axis over 3D view on the TPad.
Reimplemented from TObject.
Definition at line 309 of file TAxis3D.cxx.
Draw the axis for TView object.
The original idea belongs:
void THistPainter::PaintLegoAxis(TGaxis *axis, Double_t ang)
Definition at line 322 of file TAxis3D.cxx.
|
static |
Convert "screen pixel" coordinates to some center of 3D WC coordinate if view and gPad present.
Definition at line 456 of file TAxis3D.cxx.
Save primitive as a C++ statement(s) on output stream out.
Reimplemented from TObject.
Definition at line 479 of file TAxis3D.cxx.
Set axis color.
Definition at line 650 of file TAxis3D.cxx.
Set axis range.
Definition at line 658 of file TAxis3D.cxx.
Set label color.
Definition at line 671 of file TAxis3D.cxx.
Set label font.
Definition at line 679 of file TAxis3D.cxx.
Set label offset.
Definition at line 687 of file TAxis3D.cxx.
Set label size.
Definition at line 695 of file TAxis3D.cxx.
Set number of divisions.
Definition at line 642 of file TAxis3D.cxx.
Set tick mark length.
Definition at line 703 of file TAxis3D.cxx.
Set title offset.
Definition at line 711 of file TAxis3D.cxx.
|
inlinevirtual |
|
inlinevirtual |
|
inlinevirtual |
|
static |
Turn ON / OFF the "Ruler", TAxis3D object attached to the current pad.
Definition at line 737 of file TAxis3D.cxx.
|
static |
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:
Definition at line 765 of file TAxis3D.cxx.
|
virtual |
Replace current attributes by current style.
Reimplemented from TObject.
Definition at line 489 of file TAxis3D.cxx.
|
staticprotected |
|
protected |