Logo ROOT  
Reference Guide
TGL5DPainter.h
Go to the documentation of this file.
1// @(#)root/gl:$Id$
2// Author: Timur Pocheptsov 28/07/2009
3
4/*************************************************************************
5 * Copyright (C) 1995-2009, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12#ifndef ROOT_TGL5DPainter
13#define ROOT_TGL5DPainter
14
15#include <vector>
16#include <list>
17
18#include "TGLMarchingCubes.h"
19#include "TGLPlotPainter.h"
20#include "TGLIsoMesh.h"
21#include "TKDEFGT.h"
22#include "TGLUtil.h"
23
24
25class TGLPlotCamera;
26class TGL5DDataSet;
27
28//
29//Painter to draw TGL5DDataSet ("gl5d" option for TTree).
30//
31
33public:
34 enum EDefaults {
36 kNLowPts = 50
37 };
38
40
41 //Iso surface.
42 struct Surf_t {
44 : f4D(0.), fRange(0.), fShowCloud(kFALSE), fHide(kFALSE),
46 {
47 }
48
49 Mesh_t fMesh; //Mesh.
50 Double_t f4D; //Iso-level.
51 Double_t fRange; //Selection critera (f4D +- fRange).
52 Bool_t fShowCloud;//Show/Hide original cloud.
53 Bool_t fHide; //Show/Hide surface.
54 Color_t fColor; //Color.
55 std::vector<Double_t> fPreds; //Predictions for 5-th variable.
56 Bool_t fHighlight;//If surface was selected via GUI - highlight it.
57 Int_t fAlpha; //Opacity percentage of a surface.
58 };
59
60 typedef std::list<Surf_t> SurfList_t;
61 typedef SurfList_t::iterator SurfIter_t;
62 typedef SurfList_t::const_iterator ConstSurfIter_t;
63
64private:
65 TKDEFGT fKDE; //Density estimator.
67
68 const Surf_t fDummy; //Empty surface (for effective insertion into list).
69 Bool_t fInit; //Geometry was set.
70
71 SurfList_t fIsos; //List of iso-surfaces.
72 TGL5DDataSet *fData; //Dataset to visualize.
73
74 typedef std::vector<Double_t>::size_type size_type;
75
78 Bool_t fShowSlider; //For future.
79
80 Double_t fAlpha; //Parameter to define selection range.
81 Int_t fNContours; //Number of "pre-defined" contours.
82
83public:
85
86 //Add new iso for selected value of v4. +- range
88 Double_t range = 1e-3, Int_t lowNumOfPoints = kNLowPts);
89
91 void RemoveSurface(SurfIter_t surf);
92
93 //TGLPlotPainter final-overriders.
94 char *GetPlotInfo(Int_t px, Int_t py);
96 void StartPan(Int_t px, Int_t py);
97 void Pan(Int_t px, Int_t py);
98 void AddOption(const TString &option);
99 void ProcessEvent(Int_t event, Int_t px, Int_t py);
100
101 //Methods for ged.
102 void ShowBoxCut(Bool_t show) {fBoxCut.SetActive(show);}
104
105 void SetAlpha(Double_t newAlpha);
106 Double_t GetAlpha()const{return fAlpha;}
107
108 void SetNContours(Int_t num);
110
111 void ResetGeometryRanges();
112
115
116private:
117 //TGLPlotPainter final-overriders.
118 void InitGL()const;
119 void DeInitGL()const;
120
121 void DrawPlot()const;
122
123 //Empty overriders.
124 void DrawSectionXOZ()const{}
125 void DrawSectionYOZ()const{}
126 void DrawSectionXOY()const{}
127
128 //Auxiliary functions.
129 void SetSurfaceColor(ConstSurfIter_t surf)const;
130 void DrawCloud()const;
131 void DrawSubCloud(Double_t v4, Double_t range, Color_t ci)const;
132 void DrawMesh(ConstSurfIter_t surf)const;
133
136};
137
138#endif
#define e(i)
Definition: RSha256.hxx:103
int Int_t
Definition: RtypesCore.h:41
const Bool_t kFALSE
Definition: RtypesCore.h:88
bool Bool_t
Definition: RtypesCore.h:59
double Double_t
Definition: RtypesCore.h:55
short Color_t
Definition: RtypesCore.h:79
TGL5DPainter implements "gl5d" option for TTree::Draw.
Definition: TGL5DPainter.h:32
void ShowBoxCut(Bool_t show)
Definition: TGL5DPainter.h:102
void StartPan(Int_t px, Int_t py)
User clicks right mouse button (in a pad).
void SetSurfaceColor(ConstSurfIter_t surf) const
Set the color for iso-surface.
Bool_t IsBoxCutShown() const
Definition: TGL5DPainter.h:103
Bool_t fShowSlider
Definition: TGL5DPainter.h:78
void DrawMesh(ConstSurfIter_t surf) const
Draw one iso-surface.
SurfList_t fIsos
Definition: TGL5DPainter.h:71
TGL5DPainter & operator=(const TGL5DPainter &)
TGL5DPainter(const TGL5DPainter &)
void SetNContours(Int_t num)
Set the number of predefined contours.
void ResetGeometryRanges()
No need to create or delete meshes, number of meshes (iso-levels) are the same, but meshes must be re...
SurfList_t::iterator SurfIter_t
Definition: TGL5DPainter.h:61
SurfIter_t SurfacesBegin()
std::list::begin.
std::list< Surf_t > SurfList_t
Definition: TGL5DPainter.h:60
Rgl::Range_t fV5SliderRange
Definition: TGL5DPainter.h:77
void RemoveSurface(SurfIter_t surf)
Remove iso-surface.
Rgl::Mc::TMeshBuilder< TKDEFGT, Float_t > fMeshBuilder
Definition: TGL5DPainter.h:66
SurfIter_t SurfacesEnd()
std::list::end.
char * GetPlotInfo(Int_t px, Int_t py)
Return info for plot part under cursor.
void DrawSectionYOZ() const
Definition: TGL5DPainter.h:125
void DrawSectionXOY() const
Definition: TGL5DPainter.h:126
Double_t GetAlpha() const
Definition: TGL5DPainter.h:106
void DeInitGL() const
Return some gl states to original values.
void SetAlpha(Double_t newAlpha)
Set selection range parameter.
Rgl::Range_t fV5PredictedRange
Definition: TGL5DPainter.h:76
void DrawSectionXOZ() const
Definition: TGL5DPainter.h:124
void DrawCloud() const
Draw full cloud of points.
SurfIter_t AddSurface(Double_t v4, Color_t ci, Double_t isoVal=1., Double_t sigma=1., Double_t range=1e-3, Int_t lowNumOfPoints=kNLowPts)
Try to add new iso-surface.
SurfList_t::const_iterator ConstSurfIter_t
Definition: TGL5DPainter.h:62
void AddOption(const TString &option)
No additional options for TGL5DPainter.
Int_t fNContours
Definition: TGL5DPainter.h:81
Int_t GetNContours() const
Definition: TGL5DPainter.h:109
Rgl::Mc::TIsoMesh< Float_t > Mesh_t
Definition: TGL5DPainter.h:39
TKDEFGT fKDE
Definition: TGL5DPainter.h:65
void DrawSubCloud(Double_t v4, Double_t range, Color_t ci) const
Draw cloud for selected iso-surface.
Double_t fAlpha
Definition: TGL5DPainter.h:80
void Pan(Int_t px, Int_t py)
Mouse events handler.
void DrawPlot() const
Draw a set of meshes.
TGL5DPainter(TGL5DDataSet *data, TGLPlotCamera *camera, TGLPlotCoordinates *coord)
Constructor.
std::vector< Double_t >::size_type size_type
Definition: TGL5DPainter.h:74
TGL5DDataSet * fData
Definition: TGL5DPainter.h:72
void ProcessEvent(Int_t event, Int_t px, Int_t py)
void InitGL() const
Initialize OpenGL state variables.
Bool_t fInit
Definition: TGL5DPainter.h:69
const Surf_t fDummy
Definition: TGL5DPainter.h:68
Bool_t InitGeometry()
Create mesh.
Bool_t IsActive() const
void SetActive(Bool_t a)
Turn the box cut on/off.
Camera for TGLPlotPainter and sub-classes.
Definition: TGLPlotCamera.h:22
Helper class for plot-painters holding information about axis ranges, numbers of bins and flags if ce...
Base class for plot-painters that provide GL rendering of various 2D and 3D histograms,...
TGLBoxCut fBoxCut
Basic string class.
Definition: TString.h:131
const Double_t sigma
std::pair< Double_t, Double_t > Range_t
Definition: TGLUtil.h:1194
std::vector< Double_t > fPreds
Definition: TGL5DPainter.h:55