Logo ROOT   6.18/05
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
18class TAttAxis;
19class TAxis;
20class TH1;
21class TPMERegexp;
22class TGLRnrCtx;
23
24
25//==============================================================================
26// TGLAxisPainter
27//==============================================================================
28
30{
31public:
32 typedef std::pair <Float_t, Float_t> Lab_t; // label <pos, value> pair
33 typedef std::vector<Lab_t> LabVec_t;
34 typedef std::pair <Float_t, Int_t> TM_t; // tick-mark <pos, order> pair
35 typedef std::vector<TM_t> TMVec_t; // vector od tick lines
36
37private:
38 TGLAxisPainter(const TGLAxisPainter&); // Not implemented
39 TGLAxisPainter& operator=(const TGLAxisPainter&); // Not implemented
40
41 // Print format derived from attributers.
46
47 // Font derived from axis attributes.
50
51 // Print format.
52 void LabelsLimits(const char *label, Int_t &first, Int_t &last) const;
53 void FormAxisValue(Double_t x, TString &s) const;
54
55protected:
56 TAttAxis *fAttAxis; // Model.
57 Bool_t fUseAxisColors; // Use colors from axes or from GL-rnr-ctx.
58 TGLFont::EMode fFontMode; // To be put into TAttAxis
59 LabVec_t fLabVec; // List of Labels position-value pairs
60 TMVec_t fTMVec; // List of tick-mark position-value pairs
61
62 //
63 // Additional axis attributes required for GL rendering:
64
65 // Orientation
69
70 // Font.
75
76 // Labels options. Allready exist in TAttAxis, but can't be set.
81
82public:
84 virtual ~TGLAxisPainter();
85
86 // GetSets.
87 Int_t GetTMNDim() const { return fTMNDim; }
88 void SetTMNDim(Int_t x) { fTMNDim = x; }
89
90 TGLVector3& RefDir() { return fDir; }
91 TGLVector3& RefTMOff(Int_t i) { return fTMOff[i]; }
92
95
96 // this setter not necessary
101
103
104
106
108 TMVec_t& RefTMVec() { return fTMVec; }
109
112
115
116 // Utility.
117 void SetLabelFont(TGLRnrCtx &rnrCtx, const char* fontName, Int_t pixelSize = 64, Double_t font3DSize = -1);
118 void SetTitleFont(TGLRnrCtx &rnrCtx, const char* fontName, Int_t pixelSize = 64, Double_t font3DSize = -1);
119
120 void SetTextFormat(Double_t min, Double_t max, Double_t binWidth);
121
122 // Renderers.
123 void RnrText (const TString &txt, const TGLVector3 &pos, TGLFont::ETextAlignH_e aH, TGLFont::ETextAlignV_e aV, const TGLFont &font) const;
124 void RnrTitle(const TString &title, TGLVector3 &pos, TGLFont::ETextAlignH_e aH, TGLFont::ETextAlignV_e aV) const;
125 void RnrLabels() const;
126 void RnrLines() const;
127
128 void PaintAxis(TGLRnrCtx& ctx, TAxis* ax);
129
130 ClassDef(TGLAxisPainter, 0); // GL axis painter.
131};
132
133
134//==============================================================================
135// TGLAxisPainterBox
136//==============================================================================
137
139{
140protected:
143
144public:
146 virtual ~TGLAxisPainterBox();
147
148 void SetAxis3DTitlePos(TGLRnrCtx &rnrCtx);
149 void DrawAxis3D(TGLRnrCtx &rnrCtx);
150
151 void PlotStandard(TGLRnrCtx &rnrCtx, TH1* histo, const TGLBoundingBox& bbox);
152
153 ClassDef(TGLAxisPainterBox, 0); // Painter of GL axes for a 3D box.
154};
155
156#endif
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
double Double_t
Definition: RtypesCore.h:55
#define ClassDef(name, id)
Definition: Rtypes.h:326
Manages histogram axis attributes.
Definition: TAttAxis.h:18
Class to manage histogram axis.
Definition: TAxis.h:30
Utility class to paint axis in GL.
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.
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:247
The TH1 histogram class.
Definition: TH1.h:56
Wrapper for PCRE library (Perl Compatible Regular Expressions).
Definition: TPRegexp.h:97
Basic string class.
Definition: TString.h:131
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