This file is indexed.

/usr/include/root/TGLPlotPainter.h is in libroot-graf3d-gl-dev 5.34.30-0ubuntu8.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
// @(#)root/gl:$Id$
// Author:  Timur Pocheptsov  14/06/2006

/*************************************************************************
 * Copyright (C) 1995-2004, 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_TGLPlotPainter
#define ROOT_TGLPlotPainter

#include <vector>

#ifndef ROOT_TVirtualGL
#include "TVirtualGL.h"
#endif
#ifndef ROOT_TGLPlotBox
#include "TGLPlotBox.h"
#endif
#ifndef ROOT_TPoint
#include "TPoint.h"
#endif
#ifndef ROOT_TGLUtil
#include "TGLUtil.h"
#endif
#ifndef ROOT_TNamed
#include "TNamed.h"
#endif

class TGLPlotCoordinates;
class TGLPlotCamera;
class TGL5DDataSet;
class TString;
class TColor;
class TAxis;
class TH1;
class TH3;
class TF3;

/*
   Box cut. When attached to a plot, cuts away a part of it.
   Can be moved in a plot's own area in X/Y/Z directions.
*/

class TGLBoxCut {
private:
   Double_t                   fXLength;
   Double_t                   fYLength;
   Double_t                   fZLength;
   TGLVertex3                 fCenter;
   Rgl::Range_t               fXRange;
   Rgl::Range_t               fYRange;
   Rgl::Range_t               fZRange;

   const TGLPlotBox * const   fPlotBox;
   Bool_t                     fActive;
   Double_t                   fFactor;

   TPoint                     fMousePos;

public:
   TGLBoxCut(const TGLPlotBox *plotBox);
   virtual ~TGLBoxCut();

   void   TurnOnOff();
   Bool_t IsActive()const{return fActive;}
   void   SetActive(Bool_t a);

   void   ResetBoxGeometry();
   
   void   SetFactor(Double_t f){fFactor = f;}

   void   DrawBox(Bool_t selectionPass, Int_t selected)const;

   void   StartMovement(Int_t px, Int_t py);
   void   MoveBox(Int_t px, Int_t py, Int_t axisID);

   Bool_t IsInCut(Double_t xMin, Double_t xMax, Double_t yMin, Double_t yMax,
                  Double_t zMin, Double_t zMax)const;

   template<class V>
   Bool_t IsInCut(const V * v) const
   {
      //Check, if box defined by xmin/xmax etc. is in cut.
      if (v[0] >= fXRange.first && v[0] < fXRange.second &&
          v[1] >= fYRange.first && v[1] < fYRange.second &&
          v[2] >= fZRange.first && v[2] < fZRange.second)
         return kTRUE;
      return kFALSE;
   }
   
   Rgl::Range_t GetXRange()const{return fXRange;}
   Rgl::Range_t GetYRange()const{return fYRange;}
   Rgl::Range_t GetZRange()const{return fZRange;}

private:
   void AdjustBox();

   ClassDef(TGLBoxCut, 0)//Cuts away part of a plot.
};

/*
   2D contour for TH3 slicing.
*/

class TGLTH3Slice : public TNamed {
public:
   enum ESliceAxis {kXOZ, kYOZ, kXOY};

private:
   ESliceAxis                fAxisType;
   TAxis                    *fAxis;
   mutable TGLLevelPalette   fPalette;

   const TGLPlotCoordinates *fCoord;
   const TGLPlotBox         *fBox;
   Int_t                     fSliceWidth;

   const TH3                *fHist;
   const TF3                *fF3;

   mutable TGL2DArray<Double_t> fTexCoords;

   mutable Rgl::Range_t         fMinMax;

public:
   TGLTH3Slice(const TString &sliceName,
               const TH3 *hist,
               const TGLPlotCoordinates *coord,
               const TGLPlotBox * box,
               ESliceAxis axis);
   TGLTH3Slice(const TString &sliceName,
               const TH3 *hist, const TF3 *fun,
               const TGLPlotCoordinates *coord,
               const TGLPlotBox * box,
               ESliceAxis axis);

   void   DrawSlice(Double_t pos)const;
   //SetSliceWidth must have "menu" comment.
   void   SetSliceWidth(Int_t width = 1); // *MENU*

   void   SetMinMax(const Rgl::Range_t &newRange)
   {
      fMinMax = newRange;
   }

   const TGLLevelPalette & GetPalette()const
   {
      return fPalette;
   }

private:
   void   PrepareTexCoords(Double_t pos, Int_t sliceBegin, Int_t sliceEnd)const;
   void   FindMinMax(Int_t sliceBegin, Int_t sliceEnd)const;
   Bool_t PreparePalette()const;
   void   DrawSliceTextured(Double_t pos)const;
   void   DrawSliceFrame(Int_t low, Int_t up)const;

   ClassDef(TGLTH3Slice, 0) // TH3 slice
};


/*
   TGLPlotPainter class defines interface to different plot painters.
*/

class TGLPlotPainter;

/*
Object of this class, created on stack in DrawPlot member-functions,
saves modelview matrix, moves plot to (0; 0; 0), and
restores modelview matrix in dtor.
*/

namespace Rgl {

class PlotTranslation {
public:
   PlotTranslation(const TGLPlotPainter *painter);
   ~PlotTranslation();

private:
   const TGLPlotPainter *fPainter;
};

}

class TGLPlotPainter : public TVirtualGLPainter {
   friend class Rgl::PlotTranslation;
private:
   const TColor         *fPadColor;

protected:
   const Float_t        *fPhysicalShapeColor;

   Double_t              fPadPhi;
   Double_t              fPadTheta;
   TH1                  *fHist;
   TAxis                *fXAxis;
   TAxis                *fYAxis;
   TAxis                *fZAxis;

   TGLPlotCoordinates   *fCoord;
   TGLPlotCamera        *fCamera;
   TGLSelectionBuffer    fSelection;
   
   Bool_t                fUpdateSelection;
   Bool_t                fSelectionPass;
   Int_t                 fSelectedPart;
   TPoint                fMousePosition;
   mutable Double_t      fXOZSectionPos;
   mutable Double_t      fYOZSectionPos;
   mutable Double_t      fXOYSectionPos;
   TGLPlotBox            fBackBox;
   TGLBoxCut             fBoxCut;

   std::vector<Double_t> fZLevels;
   Bool_t                fHighColor;

   enum ESelectionBase{
      kHighColorSelectionBase = 7,
      kTrueColorSelectionBase = 10
   };

   Int_t                 fSelectionBase;
   mutable Bool_t        fDrawPalette;
   Bool_t                fDrawAxes;

public:
/*   TGLPlotPainter(TH1 *hist, TGLPlotCamera *camera, TGLPlotCoordinates *coord, Int_t context,
                  Bool_t xoySelectable, Bool_t xozSelectable, Bool_t yozSelectable);
   TGLPlotPainter(TGLPlotCamera *camera, Int_t context);*/
   TGLPlotPainter(TH1 *hist, TGLPlotCamera *camera, TGLPlotCoordinates *coord,
                  Bool_t xoySelectable, Bool_t xozSelectable, Bool_t yozSelectable);
   TGLPlotPainter(TGL5DDataSet *data, TGLPlotCamera *camera, TGLPlotCoordinates *coord);
   TGLPlotPainter(TGLPlotCamera *camera);

   const TGLPlotBox& RefBackBox() const { return fBackBox; }
   void              SetPhysicalShapeColor(const Float_t *rgba)
   {
      fPhysicalShapeColor = rgba;
   }

   virtual void     InitGL()const = 0;
   virtual void     DeInitGL()const = 0;
   virtual void     DrawPlot()const = 0;
   virtual void     Paint();

   //Checks, if mouse cursor is above plot.
   virtual Bool_t   PlotSelected(Int_t px, Int_t py);
   //Init geometry does plot's specific initialization.
   virtual Bool_t   InitGeometry() = 0;

   virtual void     StartPan(Int_t px, Int_t py) = 0;
   //Pan function is already declared in TVirtualGLPainter.

   //Add string option, it can be a digit in "lego" or "surf".
   virtual void     AddOption(const TString &stringOption) = 0;
   //Function to process additional events (key presses, mouse clicks.)
   virtual void     ProcessEvent(Int_t event, Int_t px, Int_t py) = 0;
   //Used by GLpad
   void             SetPadColor(const TColor *color);
   
   virtual void     SetFrameColor(const TColor *frameColor);
   //Camera is external to painter, if zoom was changed, or camera
   //was rotated, selection must be invalidated.
   void             InvalidateSelection();

   enum ECutAxisID {
      kXAxis = 7,
      kYAxis = 8,
      kZAxis = 9
   };

   Bool_t           CutAxisSelected()const{return !fHighColor && fSelectedPart <= kZAxis && fSelectedPart >= kXAxis;}
   
   void SetDrawFrontBox(Bool_t b) {fBackBox.SetDrawFront(b);}
   void SetDrawBackBox(Bool_t b) {fBackBox.SetDrawBack(b);}
   void SetDrawAxes(Bool_t s) {fDrawAxes = s;}
   Bool_t GetDrawAxes() {return fDrawAxes;}

protected:
   const TColor    *GetPadColor()const;
   //
   void             MoveSection(Int_t px, Int_t py);
   void             DrawSections()const;
   virtual void     DrawSectionXOZ()const = 0;
   virtual void     DrawSectionYOZ()const = 0;
   virtual void     DrawSectionXOY()const = 0;

   virtual void     DrawPaletteAxis()const;

   virtual void     ClearBuffers()const;

   void             PrintPlot()const;
   
   //Attention! After one of this methods was called,
   //the GL_MATRIX_MODE could become different from what
   //you had before the call: for example, SaveModelviewMatrix will 
   //change it to GL_MODELVIEW.
   void             SaveModelviewMatrix()const;
   void             SaveProjectionMatrix()const;
   
   void             RestoreModelviewMatrix()const;
   void             RestoreProjectionMatrix()const;

   ClassDef(TGLPlotPainter, 0) //Base for gl plots
};

/*
   Auxiliary class, which holds different
   information about plot's current coordinate system
*/

class TH2Poly;

class TGLPlotCoordinates {
private:
   EGLCoordType    fCoordType;

   Rgl::BinRange_t fXBins;
   Rgl::BinRange_t fYBins;
   Rgl::BinRange_t fZBins;

   Double_t        fXScale;
   Double_t        fYScale;
   Double_t        fZScale;

   Rgl::Range_t    fXRange;
   Rgl::Range_t    fYRange;
   Rgl::Range_t    fZRange;

   Rgl::Range_t    fXRangeScaled;
   Rgl::Range_t    fYRangeScaled;
   Rgl::Range_t    fZRangeScaled;

   Bool_t          fXLog;
   Bool_t          fYLog;
   Bool_t          fZLog;

   Bool_t          fModified;
   Double_t        fFactor;

public:
   TGLPlotCoordinates();
   virtual ~TGLPlotCoordinates();

   void         SetCoordType(EGLCoordType type);
   EGLCoordType GetCoordType()const;

   void   SetXLog(Bool_t xLog);
   Bool_t GetXLog()const;

   void   SetYLog(Bool_t yLog);
   Bool_t GetYLog()const;

   void   SetZLog(Bool_t zLog);
   Bool_t GetZLog()const;

   void   ResetModified();
   Bool_t Modified()const;
   //
   Bool_t SetRanges(const TH1 *hist, Bool_t errors = kFALSE, Bool_t zBins = kFALSE);
   //
   Bool_t SetRanges(TH2Poly *hist);
   //
   Bool_t SetRanges(const TAxis *xAxis, const TAxis *yAxis, const TAxis *zAxis);

   Int_t  GetNXBins()const;
   Int_t  GetNYBins()const;
   Int_t  GetNZBins()const;

   const Rgl::BinRange_t &GetXBins()const;
   const Rgl::BinRange_t &GetYBins()const;
   const Rgl::BinRange_t &GetZBins()const;

   const Rgl::Range_t    &GetXRange()const;
   Double_t               GetXLength()const;
   const Rgl::Range_t    &GetYRange()const;
   Double_t               GetYLength()const;
   const Rgl::Range_t    &GetZRange()const;
   Double_t               GetZLength()const;

   const Rgl::Range_t    &GetXRangeScaled()const;
   const Rgl::Range_t    &GetYRangeScaled()const;
   const Rgl::Range_t    &GetZRangeScaled()const;

   Double_t GetXScale()const{return fXScale;}
   Double_t GetYScale()const{return fYScale;}
   Double_t GetZScale()const{return fZScale;}

   Int_t    GetFirstXBin()const{return fXBins.first;}
   Int_t    GetLastXBin()const{return fXBins.second;}
   Int_t    GetFirstYBin()const{return fYBins.first;}
   Int_t    GetLastYBin()const{return fYBins.second;}
   Int_t    GetFirstZBin()const{return fZBins.first;}
   Int_t    GetLastZBin()const{return fZBins.second;}

   Double_t GetFactor()const;

private:
   Bool_t SetRangesPolar(const TH1 *hist);
   Bool_t SetRangesCylindrical(const TH1 *hist);
   Bool_t SetRangesSpherical(const TH1 *hist);

   Bool_t SetRangesCartesian(const TH1 *hist, Bool_t errors = kFALSE, Bool_t zBins = kFALSE);

   TGLPlotCoordinates(const TGLPlotCoordinates &);
   TGLPlotCoordinates &operator = (const TGLPlotCoordinates &);

   ClassDef(TGLPlotCoordinates, 0)//Auxilary class, holds plot dimensions.
};

class TGLLevelPalette;

namespace Rgl {

void DrawPalette(const TGLPlotCamera *camera, const TGLLevelPalette &palette);
void DrawPalette(const TGLPlotCamera *camera, const TGLLevelPalette &palette,
                 const std::vector<Double_t> &levels);
void DrawPaletteAxis(const TGLPlotCamera *camera, const Range_t &minMax, Bool_t logZ);

//Polygonal histogram (TH2Poly) is slightly stretched along x and y.
extern const Double_t gH2PolyScaleXY;

}

#endif