Logo ROOT  
Reference Guide
TGLAxisPainter.h
Go to the documentation of this file.
1// @(#)root/gl:$Id$
2// Author: Alja Mrak-Tadel 2009
3
4/*************************************************************************
5* Copyright (C) 1995-2007, 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_TGLAxisPainter
13#define ROOT_TGLAxisPainter
14
15#include "TGLUtil.h"
16#include "TGLFontManager.h"
17
18#include <vector>
19#include <utility>
20
21class TAttAxis;
22class TAxis;
23class TH1;
24class TPMERegexp;
25class TGLRnrCtx;
26
27
28//==============================================================================
29// TGLAxisPainter
30//==============================================================================
31
33{
34public:
35 typedef std::pair <Float_t, Float_t> Lab_t; // label <pos, value> pair
36 typedef std::vector<Lab_t> LabVec_t;
37 typedef std::pair <Float_t, Int_t> TM_t; // tick-mark <pos, order> pair
38 typedef std::vector<TM_t> TMVec_t; // vector od tick lines
39
40private:
41 TGLAxisPainter(const TGLAxisPainter&); // Not implemented
42 TGLAxisPainter& operator=(const TGLAxisPainter&); // Not implemented
43
44 // Print format derived from attributers.
49
50 // Font derived from axis attributes.
53
54 // Print format.
55 void LabelsLimits(const char *label, Int_t &first, Int_t &last) const;
56 void FormAxisValue(Double_t x, TString &s) const;
57
58protected:
59 TAttAxis *fAttAxis; // Model.
60 Bool_t fUseAxisColors; // Use colors from axes or from GL-rnr-ctx.
61 TGLFont::EMode fFontMode; // To be put into TAttAxis
62 LabVec_t fLabVec; // List of Labels position-value pairs
63 TMVec_t fTMVec; // List of tick-mark position-value pairs
64
65 //
66 // Additional axis attributes required for GL rendering:
67
68 // Orientation
72
73 // Font.
78
79 // Labels options. Allready exist in TAttAxis, but can't be set.
84
85public:
87 virtual ~TGLAxisPainter();
88
89 // GetSets.
90 Int_t GetTMNDim() const { return fTMNDim; }
91 void SetTMNDim(Int_t x) { fTMNDim = x; }
92
93 TGLVector3& RefDir() { return fDir; }
94 TGLVector3& RefTMOff(Int_t i) { return fTMOff[i]; }
95
98
99 // this setter not necessary
104
106
107
109
111 TMVec_t& RefTMVec() { return fTMVec; }
112
115
118
119 // Utility.
120 void SetLabelFont(TGLRnrCtx &rnrCtx, const char* fontName, Int_t pixelSize = 64, Double_t font3DSize = -1);
121 void SetTitleFont(TGLRnrCtx &rnrCtx, const char* fontName, Int_t pixelSize = 64, Double_t font3DSize = -1);
122
123 void SetTextFormat(Double_t min, Double_t max, Double_t binWidth);
124
125 // Renderers.
126 void RnrText (const TString &txt, const TGLVector3 &pos, TGLFont::ETextAlignH_e aH, TGLFont::ETextAlignV_e aV, const TGLFont &font) const;
127 void RnrTitle(const TString &title, TGLVector3 &pos, TGLFont::ETextAlignH_e aH, TGLFont::ETextAlignV_e aV) const;
128 void RnrLabels() const;
129 void RnrLines() const;
130
131 void PaintAxis(TGLRnrCtx& ctx, TAxis* ax);
132
133 ClassDef(TGLAxisPainter, 0); // GL axis painter.
134};
135
136
137//==============================================================================
138// TGLAxisPainterBox
139//==============================================================================
140
142{
143protected:
146
147public:
149 virtual ~TGLAxisPainterBox();
150
151 void SetAxis3DTitlePos(TGLRnrCtx &rnrCtx);
152 void DrawAxis3D(TGLRnrCtx &rnrCtx);
153
154 void PlotStandard(TGLRnrCtx &rnrCtx, TH1* histo, const TGLBoundingBox& bbox);
155
156 ClassDef(TGLAxisPainterBox, 0); // Painter of GL axes for a 3D box.
157};
158
159#endif
int Int_t
Definition: RtypesCore.h:45
bool Bool_t
Definition: RtypesCore.h:63
double Double_t
Definition: RtypesCore.h:59
#define ClassDef(name, id)
Definition: Rtypes.h:325
Manages histogram axis attributes.
Definition: TAttAxis.h:18
Class to manage histogram axis.
Definition: TAxis.h:30
Painter class for axes encompassing a 3D box.
void SetAxis3DTitlePos(TGLRnrCtx &rnrCtx)
Get position of axes and titles from projected corners.
void PlotStandard(TGLRnrCtx &rnrCtx, TH1 *histo, const TGLBoundingBox &bbox)
void DrawAxis3D(TGLRnrCtx &rnrCtx)
Draw XYZ axis with bitmap font.
TGLAxisPainterBox()
Constructor.
TGLVector3 fAxisTitlePos[3]
virtual ~TGLAxisPainterBox()
Destructor.
Utility class to paint axis in GL.
void RnrLabels() const
Render label reading prepared list ov value-pos pairs.
void SetLabelFont(TGLRnrCtx &rnrCtx, const char *fontName, Int_t pixelSize=64, Double_t font3DSize=-1)
Set label font derived from TAttAxis.
TPMERegexp * fAllZeroesRE
LabVec_t fLabVec
void LabelsLimits(const char *label, Int_t &first, Int_t &last) const
Find first and last character of a label.
void RnrLines() const
Render axis main line and tick-marks.
TGLVector3 & RefDir()
Int_t fLabelPixelFontSize
TGLFont::ETextAlignV_e fLabelAlignV
TGLFont fTitleFont
Bool_t fUseAxisColors
std::pair< Float_t, Int_t > TM_t
TGLVector3 fTitlePos
void SetLabelAlign(TGLFont::ETextAlignH_e, TGLFont::ETextAlignV_e)
Set label align.
TMVec_t & RefTMVec()
TGLVector3 fTMOff[3]
TGLFont fLabelFont
TAttAxis * fAttAxis
Double_t fLabel3DFontSize
void RnrText(const TString &txt, const TGLVector3 &pos, TGLFont::ETextAlignH_e aH, TGLFont::ETextAlignV_e aV, const TGLFont &font) const
Render text at the given position. Offset depends of text alignment.
TGLVector3 & RefTitlePos()
TGLFont::ETextAlignH_e fLabelAlignH
Int_t fTitlePixelFontSize
TGLAxisPainter & operator=(const TGLAxisPainter &)
std::vector< Lab_t > LabVec_t
std::vector< TM_t > TMVec_t
Int_t GetTitlePixelFontSize() const
LabVec_t & RefLabVec()
void SetTitleFont(TGLRnrCtx &rnrCtx, const char *fontName, Int_t pixelSize=64, Double_t font3DSize=-1)
Set title font derived from TAttAxis.
void FormAxisValue(Double_t x, TString &s) const
Returns formatted text suitable for display of value.
void SetTextFormat(Double_t min, Double_t max, Double_t binWidth)
Construct print format from given primary bin width.
TGLFont::EMode GetFontMode() const
void SetUseAxisColors(Bool_t x)
void SetAttAxis(TAttAxis *a)
void SetLabelPixelFontSize(Int_t fs)
Int_t GetTMNDim() const
TGLAxisPainter(const TGLAxisPainter &)
void RnrTitle(const TString &title, TGLVector3 &pos, TGLFont::ETextAlignH_e aH, TGLFont::ETextAlignV_e aV) const
Draw title at given position.
std::pair< Float_t, Float_t > Lab_t
TAttAxis * GetAttAxis()
void SetTMNDim(Int_t x)
TGLVector3 & RefTMOff(Int_t i)
void SetFontMode(TGLFont::EMode m)
Double_t fTitle3DFontSize
virtual ~TGLAxisPainter()
Destructor.
Int_t GetLabelPixelFontSize() const
Bool_t GetUseAxisColors() const
void PaintAxis(TGLRnrCtx &ctx, TAxis *ax)
GL render TAxis.
TGLVector3 fDir
void SetTitlePixelFontSize(Int_t fs)
TGLFont::EMode fFontMode
Concrete class describing an orientated (free) or axis aligned box of 8 vertices.
A wrapper class for FTFont.
The TGLRnrCtx class aggregates data for a given redering context as needed by various parts of the RO...
Definition: TGLRnrCtx.h:41
3 component (x/y/z) vector class.
Definition: TGLUtil.h:248
TH1 is the base class of all histogram classes in ROOT.
Definition: TH1.h:58
Wrapper for PCRE library (Perl Compatible Regular Expressions).
Definition: TPRegexp.h:97
Basic string class.
Definition: TString.h:136
Double_t x[n]
Definition: legend1.C:17
static constexpr double s
Definition: first.py:1
auto * m
Definition: textangle.C:8
auto * a
Definition: textangle.C:12