ROOT
6.06/09
Reference Guide
|
The histogram painter class using OpenGL.
Histograms are, by default, drawn via the THistPainter
class. TGLHistPainter
allows to paint them using the OpenGL 3D graphics library. The plotting options provided by TGLHistPainter
start with GL
keyword.
The following types of plots are provided:
TGLLegoPainter
)The supported options are:
"GLLEGO" :
Draw a lego plot."GLLEGO2" :
Bins with color levels."GLLEGO3" :
Cylindrical bars.Lego painter in cartesian supports logarithmic scales for X, Y, Z. In polar only Z axis can be logarithmic, in cylindrical only Y (if you see what it means).
TF2
and TH2
with "GLSURF"
options) - (TGLSurfacePainter
)The supported options are:
"GLSURF" :
Draw a surface."GLSURF1" :
Surface with color levels"GLSURF2" :
The same as "GLSURF1"
but without polygon outlines."GLSURF3" :
Color level projection on top of plot (works only in cartesian coordinate system)."GLSURF4" :
Same as "GLSURF"
but without polygon outlines.The surface painting in cartesian coordinates supports logarithmic scales along X, Y, Z axis. In polar coordinates only the Z axis can be logarithmic, in cylindrical coordinates only the Y axis.
SURF
and LEGO
- Coordinate systems:The supported options are:
" " :
Default, cartesian coordinates system."POL" :
Polar coordinates system."CYL" :
Cylindrical coordinates system."SPH" :
Spherical coordinates system.TH3
as boxes (spheres) - (TGLBoxPainter
)The supported options are:
"GLBOX" :
TH3 as a set of boxes, size of box is proportional to bin content."GLBOX1":
the same as "glbox", but spheres are drawn instead of boxes.TH3
as iso-surface(s) - (TGLIsoPainter
)The supported option is:
"GLISO" :
TH3 is drawn using iso-surfaces.TH3
as color boxes - (TGLVoxelPainter
)The supported option is:
"GLCOL" :
TH3 is drawn using semi-transparent colored boxes. See $ROOTSYS/tutorials/gl/glvox1.C
.TF3
(implicit function) - (TGLTF3Painter
)The supported option is:
"GLTF3" :
Draw a TF3
.TGLParametricPlot
)$ROOTSYS/tutorials/gl/glparametric.C
shows how to create parametric equations and visualize the surface.
All the interactions are implemented via standard methods DistancetoPrimitive
and ExecuteEvent
. That's why all the interactions with the OpenGL plots are possible i only when the mouse cursor is in the plot's area (the plot's area is the part of a the pad occupied by gl-produced picture). If the mouse cursor is not above gl-picture, the standard pad interaction is performed.
Different parts of the plot can be selected:
When the plot is selected, it can be rotated by pressing and holding the left mouse button and move the cursor.
Mouse wheel or 'j'
, 'J'
, 'k'
, 'K'
keys.
The selected plot can be moved in a pad's area by pressing and holding the left mouse button and the shift key.
Surface, iso, box, TF3 and parametric painters support box cut by pressing the 'c'
or 'C'
key when the mouse cursor is in a plot's area. That will display a transparent box, cutting away part of the surface (or boxes) in order to show internal part of plot. This box can be moved inside the plot's area (the full size of the box is equal to the plot's surrounding box) by selecting one of the box cut axes and pressing the left mouse button to move it.
Currently, all gl-plots support some form of slicing. When back plane is selected (and if it's highlighted in green) you can press and hold left mouse button and shift key and move this back plane inside plot's area, creating the slice. During this "slicing" plot becomes semi-transparent. To remove all slices (and projected curves for surfaces)
"GLSURF"
The surface profile is displayed on the slicing plane. The profile projection is drawn on the back plane by pressing 'p'
or 'P'
key.
The contour plot is drawn on the slicing plane. For TF3
the color scheme can be changed by pressing 's'
or 'S'
.
The contour plot corresponding to slice plane position is drawn in real time.
Slicing is similar to "GLBOX"
option.
No slicing. Additional keys: 's'
or 'S'
to change color scheme - about 20 color schemes supported ('s'
for "scheme"); 'l'
or 'L'
to increase number of polygons ('l'
for "level" of details), 'w'
or 'W'
to show outlines ('w'
for "wireframe").
Definition at line 46 of file TGLHistPainter.h.
Public Member Functions | |
TGLHistPainter (TH1 *hist) | |
TGLHistPainter (TGLParametricEquation *equation) | |
This ctor creates gl-parametric plot's painter. More... | |
TGLHistPainter (TGL5DDataSet *data) | |
This ctor creates plot painter for TGL5DDataSet. More... | |
TGLHistPainter (TGLTH3Composition *comp) | |
This ctor creates plot painter for TGL5DDataSet. More... | |
Int_t | DistancetoPrimitive (Int_t px, Int_t py) |
Selects plot or axis. More... | |
void | DrawPanel () |
Default implementation is OK This function is called from a context menu after right click on a plot's area. More... | |
void | ExecuteEvent (Int_t event, Int_t px, Int_t py) |
Execute event. More... | |
TList * | GetContourList (Double_t contour) const |
Get contour list. More... | |
char * | GetObjectInfo (Int_t px, Int_t py) const |
Overrides TObject::GetObjectInfo. More... | |
TList * | GetStack () const |
Get stack. More... | |
Bool_t | IsInside (Int_t x, Int_t y) |
Returns kTRUE if the cell ix, iy is inside one of the graphical cuts. More... | |
Bool_t | IsInside (Double_t x, Double_t y) |
Returns kTRUE if the cell x, y is inside one of the graphical cuts. More... | |
void | Paint (Option_t *option) |
Final-overrider for TObject::Paint. More... | |
void | PaintStat (Int_t dostat, TF1 *fit) |
Paint statistics. More... | |
void | ProcessMessage (const char *message, const TObject *obj) |
Process message. More... | |
void | SetHistogram (TH1 *hist) |
Set histogram. More... | |
void | SetStack (TList *stack) |
Set stack. More... | |
Int_t | MakeCuts (char *cutsOpt) |
Make cuts. More... | |
void | SetShowProjection (const char *option, Int_t nbins) |
Set show projection. More... | |
TGLPlotPainter * | GetRealPainter () |
Public Member Functions inherited from TVirtualHistPainter | |
TVirtualHistPainter () | |
virtual | ~TVirtualHistPainter () |
Public Member Functions inherited from TObject | |
TObject () | |
TObject (const TObject &object) | |
TObject copy ctor. More... | |
TObject & | operator= (const TObject &rhs) |
TObject assignment operator. More... | |
virtual | ~TObject () |
TObject destructor. More... | |
virtual void | AppendPad (Option_t *option="") |
Append graphics object to current pad. More... | |
virtual void | Browse (TBrowser *b) |
Browse object. May be overridden for another default action. More... | |
virtual const char * | ClassName () const |
Returns name of class to which the object belongs. More... | |
virtual void | Clear (Option_t *="") |
virtual TObject * | Clone (const char *newname="") const |
Make a clone of an object using the Streamer facility. More... | |
virtual Int_t | Compare (const TObject *obj) const |
Compare abstract method. More... | |
virtual void | Copy (TObject &object) const |
Copy this to obj. More... | |
virtual void | Delete (Option_t *option="") |
Delete this object. More... | |
virtual void | Draw (Option_t *option="") |
Default Draw method for all objects. More... | |
virtual void | DrawClass () const |
Draw class inheritance tree of the class to which this object belongs. More... | |
virtual TObject * | DrawClone (Option_t *option="") const |
Draw a clone of this object in the current pad. More... | |
virtual void | Dump () const |
Dump contents of object on stdout. More... | |
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. More... | |
virtual void | Execute (TMethod *method, TObjArray *params, Int_t *error=0) |
Execute method on this object with parameters stored in the TObjArray. More... | |
virtual TObject * | FindObject (const char *name) const |
Must be redefined in derived classes. More... | |
virtual TObject * | FindObject (const TObject *obj) const |
Must be redefined in derived classes. More... | |
virtual Option_t * | GetDrawOption () const |
Get option used by the graphics system to draw this object. More... | |
virtual UInt_t | GetUniqueID () const |
Return the unique object id. More... | |
virtual const char * | GetName () const |
Returns name of object. More... | |
virtual const char * | GetIconName () const |
Returns mime type name of object. More... | |
virtual Option_t * | GetOption () const |
virtual const char * | GetTitle () const |
Returns title of object. More... | |
virtual Bool_t | HandleTimer (TTimer *timer) |
Execute action in response of a timer timing out. More... | |
virtual ULong_t | Hash () const |
Return hash value for this object. More... | |
virtual Bool_t | InheritsFrom (const char *classname) const |
Returns kTRUE if object inherits from class "classname". More... | |
virtual Bool_t | InheritsFrom (const TClass *cl) const |
Returns kTRUE if object inherits from TClass cl. More... | |
virtual void | Inspect () const |
Dump contents of this object in a graphics canvas. More... | |
virtual Bool_t | IsFolder () const |
Returns kTRUE in case object contains browsable objects (like containers or lists of other objects). More... | |
virtual Bool_t | IsEqual (const TObject *obj) const |
Default equal comparison (objects are equal if they have the same address in memory). More... | |
virtual Bool_t | IsSortable () const |
Bool_t | IsOnHeap () const |
Bool_t | IsZombie () const |
virtual Bool_t | Notify () |
This method must be overridden to handle object notification. More... | |
virtual void | ls (Option_t *option="") const |
The ls function lists the contents of a class on stdout. More... | |
virtual void | Pop () |
Pop on object drawn in a pad to the top of the display list. More... | |
virtual void | Print (Option_t *option="") const |
This method must be overridden when a class wants to print itself. More... | |
virtual Int_t | Read (const char *name) |
Read contents of object with specified name from the current directory. More... | |
virtual void | RecursiveRemove (TObject *obj) |
Recursively remove this object from a list. More... | |
virtual void | SaveAs (const char *filename="", Option_t *option="") const |
Save this object in the file specified by filename. More... | |
virtual void | SavePrimitive (std::ostream &out, Option_t *option="") |
Save a primitive as a C++ statement(s) on output stream "out". More... | |
virtual void | SetDrawOption (Option_t *option="") |
Set drawing option for object. More... | |
virtual void | SetUniqueID (UInt_t uid) |
Set the unique object id. More... | |
virtual void | UseCurrentStyle () |
Set current style settings in this object This function is called when either TCanvas::UseCurrentStyle or TROOT::ForceStyle have been invoked. More... | |
virtual Int_t | Write (const char *name=0, Int_t option=0, Int_t bufsize=0) |
Write this object to the current directory. More... | |
virtual Int_t | Write (const char *name=0, Int_t option=0, Int_t bufsize=0) const |
Write this object to the current directory. More... | |
void * | operator new (size_t sz) |
void * | operator new[] (size_t sz) |
void * | operator new (size_t sz, void *vp) |
void * | operator new[] (size_t sz, void *vp) |
void | operator delete (void *ptr) |
Operator delete. More... | |
void | operator delete[] (void *ptr) |
Operator delete []. More... | |
void | SetBit (UInt_t f, Bool_t set) |
Set or unset the user status bits as specified in f. More... | |
void | SetBit (UInt_t f) |
void | ResetBit (UInt_t f) |
Bool_t | TestBit (UInt_t f) const |
Int_t | TestBits (UInt_t f) const |
void | InvertBit (UInt_t f) |
virtual void | Info (const char *method, const char *msgfmt,...) const |
Issue info message. More... | |
virtual void | Warning (const char *method, const char *msgfmt,...) const |
Issue warning message. More... | |
virtual void | Error (const char *method, const char *msgfmt,...) const |
Issue error message. More... | |
virtual void | SysError (const char *method, const char *msgfmt,...) const |
Issue system error message. More... | |
virtual void | Fatal (const char *method, const char *msgfmt,...) const |
Issue fatal error message. More... | |
void | AbstractMethod (const char *method) const |
Use this method to implement an "abstract" method that you don't want to leave purely abstract. More... | |
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). More... | |
void | Obsolete (const char *method, const char *asOfVers, const char *removedFromVers) const |
Use this method to declare a method obsolete. More... | |
Private Member Functions | |
PlotOption_t | ParsePaintOption (const TString &option) const |
In principle, we can have several conflicting options: "lego surf pol sph", surfbb: surf, fb, bb. More... | |
void | CreatePainter (const PlotOption_t &parsed, const TString &option) |
Create painter. More... | |
void | PadToViewport (Bool_t selectionPass=kFALSE) |
TGLHistPainter (const TGLHistPainter &) | |
TGLHistPainter & | operator= (const TGLHistPainter &) |
Private Attributes | |
std::auto_ptr< TVirtualHistPainter > | fDefaultPainter |
std::auto_ptr< TGLPlotPainter > | fGLPainter |
TGLParametricEquation * | fEq |
TH1 * | fHist |
TF3 * | fF3 |
TList * | fStack |
EGLPlotType | fPlotType |
TGLPlotCamera | fCamera |
TGLPlotCoordinates | fCoord |
Additional Inherited Members | |
Public Types inherited from TObject | |
enum | EStatusBits { kCanDelete = BIT(0), kMustCleanup = BIT(3), kObjInCanvas = BIT(3), kIsReferenced = BIT(4), kHasUUID = BIT(5), kCannotPick = BIT(6), kNoContextMenu = BIT(8), kInvalidObject = BIT(13) } |
enum | { kIsOnHeap = 0x01000000, kNotDeleted = 0x02000000, kZombie = 0x04000000, kBitMask = 0x00ffffff } |
enum | { kSingleKey = BIT(0), kOverwrite = BIT(1), kWriteDelete = BIT(2) } |
Static Public Member Functions inherited from TVirtualHistPainter | |
static TVirtualHistPainter * | HistPainter (TH1 *obj) |
static void | SetPainter (const char *painter) |
Static function to set an alternative histogram painter. More... | |
Static Public Member Functions inherited from TObject | |
static Long_t | GetDtorOnly () |
Return destructor only flag. More... | |
static void | SetDtorOnly (void *obj) |
Set destructor only flag. More... | |
static Bool_t | GetObjectStat () |
Get status of object stat flag. More... | |
static void | SetObjectStat (Bool_t stat) |
Turn on/off tracking of objects in the TObjectTable. More... | |
Protected Member Functions inherited from TObject | |
void | MakeZombie () |
virtual void | DoError (int level, const char *location, const char *fmt, va_list va) const |
Interface to ErrorHandler (protected). More... | |
#include <TGLHistPainter.h>
TGLHistPainter::TGLHistPainter | ( | TH1 * | hist | ) |
TGLHistPainter::TGLHistPainter | ( | TGLParametricEquation * | equation | ) |
This ctor creates gl-parametric plot's painter.
Definition at line 216 of file TGLHistPainter.cxx.
TGLHistPainter::TGLHistPainter | ( | TGL5DDataSet * | data | ) |
This ctor creates plot painter for TGL5DDataSet.
Definition at line 229 of file TGLHistPainter.cxx.
TGLHistPainter::TGLHistPainter | ( | TGLTH3Composition * | comp | ) |
This ctor creates plot painter for TGL5DDataSet.
Definition at line 242 of file TGLHistPainter.cxx.
|
private |
Selects plot or axis.
9999 is the magic number, ROOT's classes use in DistancetoPrimitive.
Implements TVirtualHistPainter.
Definition at line 256 of file TGLHistPainter.cxx.
|
virtual |
Default implementation is OK This function is called from a context menu after right click on a plot's area.
Opens window ("panel") with several controls.
Implements TVirtualHistPainter.
Definition at line 297 of file TGLHistPainter.cxx.
Execute event.
Events are: mouse events in a plot's area, key presses (while mouse cursor is in plot's area). "Event execution" means one of the following actions:
Implements TVirtualHistPainter.
Definition at line 314 of file TGLHistPainter.cxx.
Get contour list.
I do not use this function. Contours are implemented in a completely different way by gl-painters.
Implements TVirtualHistPainter.
Definition at line 440 of file TGLHistPainter.cxx.
Overrides TObject::GetObjectInfo.
For lego info is: bin numbers (i, j), bin content. For TF2 info is: x,y,z 3d surface-point for 2d screen-point under cursor (this can work incorrectly now, because of wrong code in TF2). For TF3 no info now. For box info is: bin numbers (i, j, k), bin content.
Implements TVirtualHistPainter.
Definition at line 453 of file TGLHistPainter.cxx.
|
inline |
Definition at line 85 of file TGLHistPainter.h.
|
virtual |
Returns kTRUE if the cell ix, iy is inside one of the graphical cuts.
I do not use this function anywhere, this is a "default implementation".
Implements TVirtualHistPainter.
Definition at line 483 of file TGLHistPainter.cxx.
Returns kTRUE if the cell x, y is inside one of the graphical cuts.
I do not use this function anywhere, this is a "default implementation".
Implements TVirtualHistPainter.
Definition at line 495 of file TGLHistPainter.cxx.
|
virtual |
|
private |
Definition at line 748 of file TGLHistPainter.cxx.
Referenced by DistancetoPrimitive(), ExecuteEvent(), and Paint().
Final-overrider for TObject::Paint.
Implements TVirtualHistPainter.
Definition at line 572 of file TGLHistPainter.cxx.
Paint statistics.
This does not work on windows.
Implements TVirtualHistPainter.
Definition at line 507 of file TGLHistPainter.cxx.
|
private |
In principle, we can have several conflicting options: "lego surf pol sph", surfbb: surf, fb, bb.
but only one will be selected, which one - depends on parsing order in this function.
Definition at line 645 of file TGLHistPainter.cxx.
Referenced by Paint().
Set show projection.
Implements TVirtualHistPainter.
Definition at line 741 of file TGLHistPainter.cxx.
|
private |
Definition at line 59 of file TGLHistPainter.h.
Referenced by CreatePainter(), ExecuteEvent(), PadToViewport(), and TGLHistPainter().
|
private |
Definition at line 60 of file TGLHistPainter.h.
Referenced by CreatePainter(), and TGLHistPainter().
|
private |
Definition at line 50 of file TGLHistPainter.h.
Referenced by DistancetoPrimitive(), DrawPanel(), ExecuteEvent(), GetContourList(), GetObjectInfo(), IsInside(), MakeCuts(), Paint(), PaintStat(), ProcessMessage(), SetHistogram(), SetShowProjection(), and SetStack().
|
private |
Definition at line 54 of file TGLHistPainter.h.
|
private |
Definition at line 56 of file TGLHistPainter.h.
Referenced by CreatePainter(), and ProcessMessage().
|
private |
Definition at line 52 of file TGLHistPainter.h.
Referenced by CreatePainter(), DistancetoPrimitive(), ExecuteEvent(), GetObjectInfo(), PadToViewport(), Paint(), and TGLHistPainter().
|
private |
Definition at line 55 of file TGLHistPainter.h.
Referenced by CreatePainter(), and SetHistogram().
|
private |
Definition at line 58 of file TGLHistPainter.h.
Referenced by CreatePainter(), DistancetoPrimitive(), ExecuteEvent(), GetObjectInfo(), IsInside(), MakeCuts(), and Paint().
|
private |
Definition at line 57 of file TGLHistPainter.h.
Referenced by GetStack(), ParsePaintOption(), and SetStack().