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. | |
~TAxis3D () override | |
void | Browse (TBrowser *b) override |
Add all 3 axes to the TBrowser. | |
Int_t | DistancetoPrimitive (Int_t px, Int_t py) override |
Compute distance from point px,py to a line. | |
void | ExecuteEvent (Int_t event, Int_t px, Int_t py) override |
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. | |
char * | GetObjectInfo (Int_t px, Int_t py) const override |
Dummy method returns the const char * to "axis3d". | |
Option_t * | GetOption () const override |
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 () |
TClass * | IsA () const override |
Bool_t | IsFolder () const override |
Returns kTRUE in case object contains browsable objects (like containers or lists of other objects). | |
void | Paint (Option_t *option="") override |
Paint axis over 3D view on the TPad. | |
void | PaintAxis (TGaxis *axis, Float_t ang) |
Draw the axis for TView object. | |
void | SavePrimitive (std::ostream &out, Option_t *option="") override |
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 | Streamer (TBuffer &) override |
Stream an object of class TObject. | |
void | StreamerNVirtual (TBuffer &ClassDef_StreamerNVirtual_b) |
void | UseCurrentStyle () override |
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. | |
void | Clear (Option_t *option="") override |
Set name and title to empty strings (""). | |
TObject * | Clone (const char *newname="") const override |
Make a clone of an object using the Streamer facility. | |
Int_t | Compare (const TObject *obj) const override |
Compare two TNamed objects. | |
void | Copy (TObject &named) const override |
Copy this to obj. | |
virtual void | FillBuffer (char *&buffer) |
Encode TNamed into output buffer. | |
const char * | GetName () const override |
Returns name of object. | |
const char * | GetTitle () const override |
Returns title of object. | |
ULong_t | Hash () const override |
Return hash value for this object. | |
TClass * | IsA () const override |
Bool_t | IsSortable () const override |
void | ls (Option_t *option="") const override |
List TNamed name and title. | |
TNamed & | operator= (const TNamed &rhs) |
TNamed assignment operator. | |
void | Print (Option_t *option="") const override |
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. | |
void | Streamer (TBuffer &) override |
Stream an object of class TObject. | |
void | StreamerNVirtual (TBuffer &ClassDef_StreamerNVirtual_b) |
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 with: gROOT->SetSelectedPad(c1) . | |
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=nullptr) |
Execute method on this object with the given parameter string, e.g. | |
virtual void | Execute (TMethod *method, TObjArray *params, Int_t *error=nullptr) |
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) |
Bool_t | IsDestructed () const |
IsDestructed. | |
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 (the base implementation is no-op). | |
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, void *vp) |
Only called by placement new when throwing an exception. | |
void | operator delete[] (void *ptr) |
Operator delete []. | |
void | operator delete[] (void *ptr, void *vp) |
Only called by placement new[] when throwing an exception. | |
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. | |
void | StreamerNVirtual (TBuffer &ClassDef_StreamerNVirtual_b) |
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=nullptr, Int_t option=0, Int_t bufsize=0) |
Write this object to the current directory. | |
virtual Int_t | Write (const char *name=nullptr, Int_t option=0, Int_t bufsize=0) const |
Write this object to the current directory. | |
Static Public Member Functions | |
static TClass * | Class () |
static const char * | Class_Name () |
static constexpr Version_t | Class_Version () |
static const char * | DeclFileName () |
static TAxis3D * | GetPadAxis (TVirtualPad *pad=nullptr) |
Returns the "pad" Axis3D object pointer if any. | |
static Double_t * | PixeltoXYZ (Double_t px, Double_t py, Double_t *point3D, TView *view=nullptr) |
Convert "screen pixel" coordinates to some center of 3D WC coordinate if view and gPad present. | |
static TAxis3D * | ToggleRulers (TVirtualPad *pad=nullptr) |
Turn ON / OFF the "Ruler", TAxis3D object attached to the current pad. | |
static TAxis3D * | ToggleZoom (TVirtualPad *pad=nullptr) |
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 TNamed | |
static TClass * | Class () |
static const char * | Class_Name () |
static constexpr Version_t | Class_Version () |
static const char * | DeclFileName () |
Static Public Member Functions inherited from TObject | |
static TClass * | Class () |
static const char * | Class_Name () |
static constexpr Version_t | Class_Version () |
static const char * | DeclFileName () |
static Longptr_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 | |
void | Copy (TObject &hnew) const override |
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 = (1ULL << ( 0 )) , kOverwrite = (1ULL << ( 1 )) , kWriteDelete = (1ULL << ( 2 )) } |
enum | EDeprecatedStatusBits { kObjInCanvas = (1ULL << ( 3 )) } |
enum | EStatusBits { kCanDelete = (1ULL << ( 0 )) , kMustCleanup = (1ULL << ( 3 )) , kIsReferenced = (1ULL << ( 4 )) , kHasUUID = (1ULL << ( 5 )) , kCannotPick = (1ULL << ( 6 )) , kNoContextMenu = (1ULL << ( 8 )) , kInvalidObject = (1ULL << ( 13 )) } |
Protected Types inherited from TObject | |
enum | { kOnlyPrepStep = (1ULL << ( 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 543 of file TAxis3D.cxx.
|
overridevirtual |
Add all 3 axes to the TBrowser.
Reimplemented from TObject.
Definition at line 164 of file TAxis3D.cxx.
|
private |
|
static |
|
inlinestaticconstexpr |
|
overrideprotectedvirtual |
|
inlinestatic |
Compute distance from point px,py to a line.
Reimplemented from TObject.
Definition at line 172 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 190 of file TAxis3D.cxx.
Get axis color.
Definition at line 565 of file TAxis3D.cxx.
|
inlinevirtual |
Get label color.
Definition at line 575 of file TAxis3D.cxx.
Get label font.
Definition at line 585 of file TAxis3D.cxx.
Get label offset.
Definition at line 595 of file TAxis3D.cxx.
Get label size.
Definition at line 605 of file TAxis3D.cxx.
|
inlinevirtual |
Get number of divisions.
Definition at line 555 of file TAxis3D.cxx.
Dummy method returns the const char * to "axis3d".
Reimplemented from TObject.
Definition at line 302 of file TAxis3D.cxx.
|
inlineoverridevirtual |
|
static |
Returns the "pad" Axis3D object pointer if any.
Definition at line 721 of file TAxis3D.cxx.
Get tick mark length.
Definition at line 615 of file TAxis3D.cxx.
Get title offset.
Definition at line 625 of file TAxis3D.cxx.
|
protected |
Initialization.
Definition at line 149 of file TAxis3D.cxx.
|
inlineoverridevirtual |
|
inlineoverridevirtual |
|
overridevirtual |
Paint axis over 3D view on the TPad.
Reimplemented from TObject.
Definition at line 310 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 323 of file TAxis3D.cxx.
|
static |
Convert "screen pixel" coordinates to some center of 3D WC coordinate if view and gPad present.
Definition at line 457 of file TAxis3D.cxx.
|
overridevirtual |
Save primitive as a C++ statement(s) on output stream out.
Reimplemented from TObject.
Definition at line 480 of file TAxis3D.cxx.
Set axis color.
Definition at line 651 of file TAxis3D.cxx.
Set axis range.
Definition at line 659 of file TAxis3D.cxx.
Set label color.
Definition at line 672 of file TAxis3D.cxx.
Set label font.
Definition at line 680 of file TAxis3D.cxx.
Set label offset.
Definition at line 688 of file TAxis3D.cxx.
Set label size.
Definition at line 696 of file TAxis3D.cxx.
Set number of divisions.
Definition at line 643 of file TAxis3D.cxx.
|
inlinevirtual |
Set tick mark length.
Definition at line 704 of file TAxis3D.cxx.
Set title offset.
Definition at line 712 of file TAxis3D.cxx.
|
inlinevirtual |
|
inlinevirtual |
|
inlinevirtual |
|
overridevirtual |
|
inline |
|
static |
Turn ON / OFF the "Ruler", TAxis3D object attached to the current pad.
Definition at line 738 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 766 of file TAxis3D.cxx.
|
overridevirtual |
Replace current attributes by current style.
Reimplemented from TObject.
Definition at line 490 of file TAxis3D.cxx.
|
staticprotected |
|
protected |