ROOT  6.07/01
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 class TAttAxis;
19 class TAxis;
20 class TH1;
21 class TPMERegexp;
22 class TGLRnrCtx;
23 
24 
25 //==============================================================================
26 // TGLAxisPainter
27 //==============================================================================
28 
30 {
31 public:
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 
37 private:
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 
55 protected:
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 
82 public:
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 
93  TGLFont::EMode GetFontMode() const { return fFontMode; }
95 
96  // this setter not necessary
101 
103 
104 
106 
107  LabVec_t& RefLabVec() { return fLabVec; }
108  TMVec_t& RefTMVec() { return fTMVec; }
109 
111  TAttAxis* GetAttAxis() { return fAttAxis; }
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;
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 {
140 protected:
143 
144 public:
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_t GetLabelPixelFontSize() const
The TGLRnrCtx class aggregates data for a given redering context as needed by various parts of the RO...
Definition: TGLRnrCtx.h:40
TGLVector3 fDir
static Vc_ALWAYS_INLINE int_v min(const int_v &x, const int_v &y)
Definition: vector.h:433
void SetUseAxisColors(Bool_t x)
ClassDef(TGLAxisPainter, 0)
void SetTitlePixelFontSize(Int_t fs)
std::vector< TM_t > TMVec_t
void PlotStandard(TGLRnrCtx &rnrCtx, TH1 *histo, const TGLBoundingBox &bbox)
TGLVector3 fTMOff[3]
TH1 * histo
void RnrTitle(const TString &title, TGLVector3 &pos, TGLFont::ETextAlignH_e aH, TGLFont::ETextAlignV_e aV) const
Draw title at given position.
void SetFontMode(TGLFont::EMode m)
void FormAxisValue(Double_t x, TString &s) const
Returns formatted text suitable for display of value.
Basic string class.
Definition: TString.h:137
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
TArc * a
Definition: textangle.C:12
TGLFont fLabelFont
TGLVector3 & RefDir()
Int_t fTitlePixelFontSize
std::pair< Float_t, Int_t > TM_t
Manages histogram axis attributes.
Definition: TAttAxis.h:32
ClassDef(TGLAxisPainterBox, 0)
TGLVector3 fTitlePos
TMVec_t & RefTMVec()
TGLVector3 & RefTMOff(Int_t i)
std::pair< Float_t, Float_t > Lab_t
std::vector< Lab_t > LabVec_t
Double_t x[n]
Definition: legend1.C:17
TGLAxisPainterBox()
Constructor.
Int_t GetTMNDim() const
Bool_t GetUseAxisColors() const
Utility class to paint axis in GL.
TGLVector3 & RefTitlePos()
3 component (x/y/z) vector class.
Definition: TGLUtil.h:250
void PaintAxis(TGLRnrCtx &ctx, TAxis *ax)
GL render TAxis.
Int_t GetTitlePixelFontSize() const
TGLFont fTitleFont
void RnrLabels() const
Render label reading prepared list ov value-pos pairs.
Class to manage histogram axis.
Definition: TAxis.h:36
Int_t fLabelPixelFontSize
TPaveLabel title(3, 27.1, 15, 28.7,"ROOT Environment and Tools")
TGLAxisPainter & operator=(const TGLAxisPainter &)
void RnrLines() const
Render axis main line and tick-marks.
TAttAxis * GetAttAxis()
TPMERegexp * fAllZeroesRE
TGLVector3 fAxisTitlePos[3]
TMarker * m
Definition: textangle.C:8
bool first
Definition: line3Dfit.C:48
void SetLabelAlign(TGLFont::ETextAlignH_e, TGLFont::ETextAlignV_e)
Set label align.
double Double_t
Definition: RtypesCore.h:55
void SetTitleFont(TGLRnrCtx &rnrCtx, const char *fontName, Int_t pixelSize=64, Double_t font3DSize=-1)
Set title font derived from TAttAxis.
virtual ~TGLAxisPainterBox()
Destructor.
The TH1 histogram class.
Definition: TH1.h:80
Double_t fTitle3DFontSize
static Vc_ALWAYS_INLINE int_v max(const int_v &x, const int_v &y)
Definition: vector.h:440
LabVec_t & RefLabVec()
Concrete class describing an orientated (free) or axis aligned box of 8 vertices. ...
Bool_t fUseAxisColors
Wrapper for PCRE library (Perl Compatible Regular Expressions).
Definition: TPRegexp.h:103
TGLFont::EMode GetFontMode() const
void SetLabelPixelFontSize(Int_t fs)
TAttAxis * fAttAxis
void SetAxis3DTitlePos(TGLRnrCtx &rnrCtx)
Get position of axes and titles from projected corners.
LabVec_t fLabVec
void SetLabelFont(TGLRnrCtx &rnrCtx, const char *fontName, Int_t pixelSize=64, Double_t font3DSize=-1)
Set label font derived from TAttAxis.
A wrapper class for FTFont.
void SetTMNDim(Int_t x)
void LabelsLimits(const char *label, Int_t &first, Int_t &last) const
Find first and last character of a label.
void SetTextFormat(Double_t min, Double_t max, Double_t binWidth)
Construct print format from given primary bin width.
TGLFont::EMode fFontMode
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.
Double_t fLabel3DFontSize
virtual ~TGLAxisPainter()
Destructor.
TGLFont::ETextAlignH_e fLabelAlignH
void DrawAxis3D(TGLRnrCtx &rnrCtx)
Draw XYZ axis with bitmap font.
TGLFont::ETextAlignV_e fLabelAlignV
void SetAttAxis(TAttAxis *a)