forked from root-project/root
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TGL5DPainter.h
148 lines (115 loc) · 4.66 KB
/
TGL5DPainter.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
// @(#)root/gl:$Id$
// Author: Timur Pocheptsov 28/07/2009
/*************************************************************************
* Copyright (C) 1995-2009, Rene Brun and Fons Rademakers. *
* All rights reserved. *
* *
* For the licensing terms see $ROOTSYS/LICENSE. *
* For the list of contributors see $ROOTSYS/README/CREDITS. *
*************************************************************************/
#ifndef ROOT_TGL5DPainter
#define ROOT_TGL5DPainter
#include <vector>
#include <list>
#ifndef ROOT_TGLMarchingCubes
#include "TGLMarchingCubes.h"
#endif
#ifndef ROOT_TGLPlotPainter
#include "TGLPlotPainter.h"
#endif
#ifndef ROOT_TGLIsoMesh
#include "TGLIsoMesh.h"
#endif
#ifndef ROOT_TKDEFGT
#include "TKDEFGT.h"
#endif
#ifndef ROOT_TGLUtil
#include "TGLUtil.h"
#endif
class TGLPlotCamera;
class TGL5DDataSet;
//
//Painter to draw TGL5DDataSet ("gl5d" option for TTree).
//
class TGL5DPainter : public TGLPlotPainter {
public:
enum EDefaults {
kNContours = 4,
kNLowPts = 50
};
typedef Rgl::Mc::TIsoMesh<Float_t> Mesh_t;
//Iso surface.
struct Surf_t {
Surf_t()
: f4D(0.), fRange(0.), fShowCloud(kFALSE), fHide(kFALSE),
fColor(0), fHighlight(kFALSE), fAlpha(100)
{
}
Mesh_t fMesh; //Mesh.
Double_t f4D; //Iso-level.
Double_t fRange; //Selection critera (f4D +- fRange).
Bool_t fShowCloud;//Show/Hide original cloud.
Bool_t fHide; //Show/Hide surface.
Color_t fColor; //Color.
std::vector<Double_t> fPreds; //Predictions for 5-th variable.
Bool_t fHighlight;//If surface was selected via GUI - highlight it.
Int_t fAlpha; //Opacity percentage of a surface.
};
typedef std::list<Surf_t> SurfList_t;
typedef SurfList_t::iterator SurfIter_t;
typedef SurfList_t::const_iterator ConstSurfIter_t;
private:
TKDEFGT fKDE; //Density estimator.
Rgl::Mc::TMeshBuilder<TKDEFGT, Float_t> fMeshBuilder; //Mesh builder.
const Surf_t fDummy; //Empty surface (for effective insertion into list).
Bool_t fInit; //Geometry was set.
SurfList_t fIsos; //List of iso-surfaces.
TGL5DDataSet *fData; //Dataset to visualize.
typedef std::vector<Double_t>::size_type size_type;
Rgl::Range_t fV5PredictedRange; //For future.
Rgl::Range_t fV5SliderRange; //For future.
Bool_t fShowSlider; //For future.
Double_t fAlpha; //Parameter to define selection range.
Int_t fNContours; //Number of "pre-defined" contours.
public:
TGL5DPainter(TGL5DDataSet *data, TGLPlotCamera *camera, TGLPlotCoordinates *coord);
//Add new iso for selected value of v4. +- range
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);
void AddSurface(Double_t v4);
void RemoveSurface(SurfIter_t surf);
//TGLPlotPainter final-overriders.
char *GetPlotInfo(Int_t px, Int_t py);
Bool_t InitGeometry();
void StartPan(Int_t px, Int_t py);
void Pan(Int_t px, Int_t py);
void AddOption(const TString &option);
void ProcessEvent(Int_t event, Int_t px, Int_t py);
//Methods for ged.
void ShowBoxCut(Bool_t show) {fBoxCut.SetActive(show);}
Bool_t IsBoxCutShown()const{return fBoxCut.IsActive();}
void SetAlpha(Double_t newAlpha);
Double_t GetAlpha()const{return fAlpha;}
void SetNContours(Int_t num);
Int_t GetNContours()const{return fNContours;}
void ResetGeometryRanges();
SurfIter_t SurfacesBegin();
SurfIter_t SurfacesEnd();
private:
//TGLPlotPainter final-overriders.
void InitGL()const;
void DeInitGL()const;
void DrawPlot()const;
//Empty overriders.
void DrawSectionXOZ()const{}
void DrawSectionYOZ()const{}
void DrawSectionXOY()const{}
//Auxiliary functions.
void SetSurfaceColor(ConstSurfIter_t surf)const;
void DrawCloud()const;
void DrawSubCloud(Double_t v4, Double_t range, Color_t ci)const;
void DrawMesh(ConstSurfIter_t surf)const;
TGL5DPainter(const TGL5DPainter &);
TGL5DPainter &operator = (const TGL5DPainter &);
};
#endif