00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef ROOT_TGLAxisPainter
00013 #define ROOT_TGLAxisPainter
00014
00015 #include "TGLUtil.h"
00016 #include "TGLFontManager.h"
00017
00018 class TAttAxis;
00019 class TAxis;
00020 class TH1;
00021 class TPMERegexp;
00022 class TGLRnrCtx;
00023
00024
00025
00026
00027
00028
00029 class TGLAxisPainter
00030 {
00031 public:
00032 typedef std::pair <Float_t, Float_t> Lab_t;
00033 typedef std::vector<Lab_t> LabVec_t;
00034 typedef std::pair <Float_t, Int_t> TM_t;
00035 typedef std::vector<TM_t> TMVec_t;
00036
00037 private:
00038 TGLAxisPainter(const TGLAxisPainter&);
00039 TGLAxisPainter& operator=(const TGLAxisPainter&);
00040
00041
00042 Int_t fExp;
00043 Int_t fMaxDigits;
00044 Int_t fDecimals;
00045 TString fFormat;
00046
00047
00048 TGLFont fLabelFont;
00049 TGLFont fTitleFont;
00050
00051
00052 void LabelsLimits(const char *label, Int_t &first, Int_t &last) const;
00053 void FormAxisValue(Double_t x, TString &s) const;
00054
00055 protected:
00056 TAttAxis *fAttAxis;
00057 Bool_t fUseAxisColors;
00058 TGLFont::EMode fFontMode;
00059 LabVec_t fLabVec;
00060 TMVec_t fTMVec;
00061
00062
00063
00064
00065
00066 TGLVector3 fDir;
00067 TGLVector3 fTMOff[3];
00068 Int_t fTMNDim;
00069
00070
00071 Int_t fLabelPixelFontSize;
00072 Double_t fLabel3DFontSize;
00073 Int_t fTitlePixelFontSize;
00074 Double_t fTitle3DFontSize;
00075
00076
00077 TGLFont::ETextAlignH_e fLabelAlignH;
00078 TGLFont::ETextAlignV_e fLabelAlignV;
00079 TGLVector3 fTitlePos;
00080 TPMERegexp *fAllZeroesRE;
00081
00082 public:
00083 TGLAxisPainter();
00084 virtual ~TGLAxisPainter();
00085
00086
00087 Int_t GetTMNDim() const { return fTMNDim; }
00088 void SetTMNDim(Int_t x) { fTMNDim = x; }
00089
00090 TGLVector3& RefDir() { return fDir; }
00091 TGLVector3& RefTMOff(Int_t i) { return fTMOff[i]; }
00092
00093 TGLFont::EMode GetFontMode() const { return fFontMode; }
00094 void SetFontMode(TGLFont::EMode m) { fFontMode=m; }
00095
00096
00097 void SetLabelPixelFontSize(Int_t fs) { fLabelPixelFontSize=fs; }
00098 Int_t GetLabelPixelFontSize() const { return fLabelPixelFontSize; }
00099 void SetTitlePixelFontSize(Int_t fs) { fTitlePixelFontSize=fs; }
00100 Int_t GetTitlePixelFontSize() const { return fTitlePixelFontSize; }
00101
00102 TGLVector3& RefTitlePos() { return fTitlePos; }
00103
00104
00105 void SetLabelAlign(TGLFont::ETextAlignH_e, TGLFont::ETextAlignV_e);
00106
00107 LabVec_t& RefLabVec() { return fLabVec; }
00108 TMVec_t& RefTMVec() { return fTMVec; }
00109
00110 void SetAttAxis(TAttAxis* a) { fAttAxis = a; }
00111 TAttAxis* GetAttAxis() { return fAttAxis; }
00112
00113 void SetUseAxisColors(Bool_t x) { fUseAxisColors = x; }
00114 Bool_t GetUseAxisColors() const { return fUseAxisColors; }
00115
00116
00117 void SetLabelFont(TGLRnrCtx &rnrCtx, const char* fontName, Int_t pixelSize = 64, Double_t font3DSize = -1);
00118 void SetTitleFont(TGLRnrCtx &rnrCtx, const char* fontName, Int_t pixelSize = 64, Double_t font3DSize = -1);
00119
00120 void SetTextFormat(Double_t min, Double_t max, Double_t binWidth);
00121
00122
00123 void RnrText (const TString &txt, const TGLVector3 &pos, TGLFont::ETextAlignH_e aH, TGLFont::ETextAlignV_e aV, const TGLFont &font) const;
00124 void RnrTitle(const TString &title, TGLVector3 &pos, TGLFont::ETextAlignH_e aH, TGLFont::ETextAlignV_e aV) const;
00125 void RnrLabels() const;
00126 void RnrLines() const;
00127
00128 void PaintAxis(TGLRnrCtx& ctx, TAxis* ax);
00129
00130 ClassDef(TGLAxisPainter, 0);
00131 };
00132
00133
00134
00135
00136
00137
00138 class TGLAxisPainterBox : public TGLAxisPainter
00139 {
00140 protected:
00141 TGLVector3 fAxisTitlePos[3];
00142 TAxis* fAxis[3];
00143
00144 public:
00145 TGLAxisPainterBox();
00146 virtual ~TGLAxisPainterBox();
00147
00148 void SetAxis3DTitlePos(TGLRnrCtx &rnrCtx);
00149 void DrawAxis3D(TGLRnrCtx &rnrCtx);
00150
00151 void PlotStandard(TGLRnrCtx &rnrCtx, const TH1* histo, const TGLBoundingBox& bbox);
00152
00153 ClassDef(TGLAxisPainterBox, 0);
00154 };
00155
00156 #endif