TSpectrum2Painter.h

Go to the documentation of this file.
00001 // @(#)root/spectrumpainter:$Id: TSpectrum2Painter.h,v 1.0
00002 // Author: Miroslav Morhac 29/09/06
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010  *************************************************************************/
00011 
00012 #ifndef ROOT_TSpectrum2Painter
00013 #define ROOT_TSpectrum2Painter
00014 
00015 
00016 #ifndef ROOT_TNamed
00017 #include "TNamed.h"
00018 #endif
00019 
00020 class TH2;
00021 class TLine;
00022 class TColor;
00023 
00024 //////////////////////////////////////////////////////////////////////////
00025 //                                                                      //
00026 // TSpectrum2Painter Algorithms                                         //
00027 //                                                                      //
00028 // 3D graphics representations package.                                 //
00029 //                                                                      //
00030 //////////////////////////////////////////////////////////////////////////
00031 
00032 class TSpectrum2Painter: public TNamed {
00033 
00034 public:
00035    TSpectrum2Painter(TH2* h2, Int_t bs);
00036    virtual ~TSpectrum2Painter();
00037 
00038    void GetAngles(Int_t &alpha,Int_t &beta,Int_t &view);
00039    void GetBezier(Int_t &bezier);
00040    void GetChanGrid(Int_t &enable,Int_t &color);
00041    void GetChanMarks(Int_t &enable,Int_t &color,Int_t &width,Int_t &height,Int_t &style);
00042    void GetColorAlgorithm(Int_t &colorAlgorithm);
00043    void GetColorIncrements(Double_t &r,Double_t &g,Double_t &b);
00044    void GetContourWidth(Int_t &width);
00045    void GetDisplayMode(Int_t &modeGroup,Int_t &displayMode);
00046    void GetLightHeightWeight(Double_t &weight);
00047    void GetLightPosition(Int_t &x,Int_t &y,Int_t &z);
00048    void GetNodes(Int_t &nodesx,Int_t &nodesy);
00049    void GetPenAttr(Int_t &color, Int_t &style, Int_t &width);
00050    void GetShading(Int_t &shading,Int_t &shadow);
00051    void GetZScale(Int_t &scale);
00052    void Paint(Option_t *option);
00053    void SetAngles(Int_t alpha,Int_t beta,Int_t view);
00054    void SetBezier(Int_t bezier);
00055    void SetChanGrid(Int_t enable,Int_t color);
00056    void SetChanMarks(Int_t enable,Int_t color,Int_t width,Int_t height,Int_t style);
00057    void SetColorAlgorithm(Int_t colorAlgorithm);
00058    void SetColorIncrements(Double_t r,Double_t g,Double_t b);
00059    void SetContourWidth(Int_t width);
00060    void SetDisplayMode(Int_t modeGroup,Int_t displayMode);
00061    void SetLightHeightWeight(Double_t weight);
00062    void SetLightPosition(Int_t x,Int_t y,Int_t z);
00063    void SetNodes(Int_t nodesx,Int_t nodesy);
00064    void SetPenAttr(Int_t color,Int_t style,Int_t width);
00065    void SetShading(Int_t shading,Int_t shadow);
00066    void SetZScale(Int_t scale);
00067 
00068    static void PaintSpectrum(TH2* h2, Option_t *option="",Int_t bs=1600);
00069 
00070    enum {
00071       kModeGroupSimple=0,
00072       kModeGroupHeight=1,
00073       kModeGroupLight=2,
00074       kModeGroupLightHeight=3,
00075       kDisplayModePoints=1,
00076       kDisplayModeGrid=2,
00077       kDisplayModeContours=3,
00078       kDisplayModeBars=4,
00079       kDisplayModeLinesX=5,
00080       kDisplayModeLinesY=6,
00081       kDisplayModeBarsX=7,
00082       kDisplayModeBarsY=8,
00083       kDisplayModeNeedles=9,
00084       kDisplayModeSurface=10,
00085       kDisplayModeTriangles=11,
00086       kZScaleLinear=0,
00087       kZScaleLog=1,
00088       kZScaleSqrt=2,
00089       kColorAlgRgbSmooth=0,
00090       kColorAlgRgbModulo=1,
00091       kColorAlgCmySmooth=2,
00092       kColorAlgCmyModulo=3,
00093       kColorAlgCieSmooth=4,
00094       kColorAlgCieModulo=5,
00095       kColorAlgYiqSmooth=6,
00096       kColorAlgYiqModulo=7,
00097       kColorAlgHvsSmooth=8,
00098       kColorAlgHvsModulo=9,
00099       kShadowsNotPainted=0,
00100       kShadowsPainted=1,
00101       kNotShaded=0,
00102       kShaded=1,
00103       kNoBezierInterpol=0,
00104       kBezierInterpol=1,
00105       kPenStyleSolid=1,
00106       kPenStyleDash=2,
00107       kPenStyleDot=3,
00108       kPenStyleDashDot=4,
00109       kChannelMarksNotDrawn=0,
00110       kChannelMarksDrawn=1,
00111       kChannelMarksStyleDot=1,
00112       kChannelMarksStyleCross=2,
00113       kChannelMarksStyleStar=3,
00114       kChannelMarksStyleRectangle=4,
00115       kChannelMarksStyleX=5,
00116       kChannelMarksStyleDiamond=6,
00117       kChannelMarksStyleTriangle=7,
00118       kChannelGridNotDrawn=0,
00119       kChannelGridDrawn=1
00120   };
00121 
00122 protected:
00123    TH2      *fH2;            //pointer to 2D histogram TH2
00124    Int_t     fXmin;          //x-starting channel of spectrum
00125    Int_t     fXmax;          //x-end channel of spectrum
00126    Int_t     fYmin;          //y-starting channel of spectrum
00127    Int_t     fYmax;          //y-end channel of spectrum
00128    Double_t  fZmin;          //base counts
00129    Double_t  fZmax;          //counts full scale
00130    Int_t     fBx1;           //positon of picture on Canvas, min x
00131    Int_t     fBx2;           //positon of picture on Canvas, max x
00132    Int_t     fBy1;           //positon of picture on Canvas, min y
00133    Int_t     fBy2;           //positon of picture on Canvas, max y
00134    Int_t     fPenColor;      //color of spectrum
00135    Int_t     fPenDash;       //style of pen
00136    Int_t     fPenWidth;      //width of line
00137    Int_t     fModeGroup;     //display mode algorithm group (simple modes-kModeGroupSimple, modes with shading according to light-kModeGroupLight, modes with shading according to channels counts-kModeGroupHeight, modes of combination of shading according to light and to channels counts-kModeGroupLightHeight)
00138    Int_t     fDisplayMode;   //spectrum display mode (points, grid, contours, bars, x_lines, y_lines, bars_x, bars_y, needles, surface, triangles)
00139    Int_t     fZscale;        //z scale (linear, log, sqrt)
00140    Int_t     fNodesx;        //number of nodes in x dimension of grid
00141    Int_t     fNodesy;        //number of nodes in y dimension of grid
00142    Int_t     fContWidth;     //width between contours, applies only for contours display mode
00143    Int_t     fAlpha;         //angles of display,alfa+beta must be less or equal to 90, alpha- angle between base line of Canvas and right lower edge of picture base plane
00144    Int_t     fBeta;          //angle between base line of Canvas and left lower edge of picture base plane
00145    Int_t     fViewAngle;     //rotation angle of the view, it can be 0, 90, 180, 270 degrees
00146    Int_t     fLevels;        //# of color levels for rainbowed display modes, it does not apply for simple display modes algorithm group
00147    Double_t  fRainbow1Step;  //determines the first component  step for neighbouring color levels, applies only for rainbowed display modes, it does not apply for simple display modes algorithm group
00148    Double_t  fRainbow2Step;  //determines the second component  step for neighbouring color levels, applies only for rainbowed display modes, it does not apply for simple display modes algorithm group
00149    Double_t  fRainbow3Step;  //determines the third component  step for neighbouring color levels, applies only for rainbowed display modes, it does not apply for simple display modes algorithm group
00150    Int_t     fColorAlg;      //applies only for rainbowed display modes (rgb smooth alorithm, rgb modulo color component, cmy smooth alorithm, cmy modulo color component, cie smooth alorithm, cie modulo color component, yiq smooth alorithm, yiq modulo color component, hsv smooth alorithm, hsv modulo color component, it does not apply for simple display modes algorithm group
00151    Double_t  fLHweight;      //weight between shading according to fictive light source and according to channels counts, applies only for kModeGroupLightHeight modes group
00152    Int_t     fXlight;        //x position of fictive light source, applies only for rainbowed display modes with shading according to light
00153    Int_t     fYlight;        //y position of fictive light source, applies only for rainbowed display modes with shading according to light
00154    Int_t     fZlight;        //z position of fictive light source, applies only for rainbowed display modes with shading according to light
00155    Int_t     fShadow;        //determines whether shadow will be drawn (no shadow, shadow), for rainbowed display modes with shading according to light
00156    Int_t     fShading;       //determines whether the picture will shaded, smoothed (no shading, shading), for rainbowed display modes only
00157    Int_t     fBezier;        //determines Bezier interpolation (applies only for simple display modes group for grid, x_lines, y_lines display modes)
00158    Int_t     fChanmarkEnDis; //decides whether the channel marks are shown
00159    Int_t     fChanmarkStyle; //style of channel marks
00160    Int_t     fChanmarkWidth; //width of channel marks
00161    Int_t     fChanmarkHeight;//height of channel marks
00162    Int_t     fChanmarkColor; //color of channel marks
00163    Int_t     fChanlineEnDis; //decides whether the channel lines (grid) are shown
00164    Int_t     fChanlineColor; //color of channel lines (grid)
00165 
00166    //auxiliary variables,transformation coeffitients for internal use only
00167    Double_t  fKx;
00168    Double_t  fKy;
00169    Double_t  fMxx;
00170    Double_t  fMxy;
00171    Double_t  fMyx;
00172    Double_t  fMyy;
00173    Double_t  fTxx;
00174    Double_t  fTxy;
00175    Double_t  fTyx;
00176    Double_t  fTyy;
00177    Double_t  fTyz;
00178    Double_t  fVx;
00179    Double_t  fVy;
00180    Double_t  fNuSli;
00181 
00182    //auxiliary internal variables, working place
00183    Double_t  fZ,fZeq,fGbezx,fGbezy,fDxspline,fDyspline,fZPresetValue;
00184    Int_t     fXt,fYt,fXs,fYs,fXe,fYe,fLine;
00185    Short_t  *fEnvelope;                 //!
00186    Short_t  *fEnvelopeContour;          //!
00187    TColor   *fNewColor;                 //!
00188    Int_t     fMaximumXScreenResolution; //!buffers' size
00189    Int_t     fNewColorIndex;
00190    Int_t     fBzX[4];
00191    Int_t     fBzY[4];
00192 
00193    Int_t    BezC(Int_t i);
00194    Double_t BezierBlend(Int_t i,Double_t bezf);
00195    void     BezierSmoothing(Double_t bezf);
00196    Double_t ColorCalculation(Double_t dx1,Double_t dy1,Double_t z1,Double_t dx2,Double_t dy2,Double_t z2,Double_t dx3,Double_t dy3,Double_t z3);//calculation of new color
00197    void     ColorModel(unsigned ui,unsigned ui1,unsigned ui2,unsigned ui3);//calculation of color according to chosen algorithm
00198    void     CopyEnvelope(Double_t xr,Double_t xs,Double_t yr,Double_t ys);
00199    void     DrawMarker(Int_t x,Int_t y,Int_t w,Int_t h,Int_t type);
00200    void     Envelope(Int_t x1,Int_t y1,Int_t x2,Int_t y2);
00201    void     EnvelopeBars(Int_t x1,Int_t y1,Int_t x2,Int_t y2);
00202    Double_t ShadowColorCalculation(Double_t xtaz,Double_t ytaz,Double_t ztaz,Double_t shad_noise);//shadow color
00203    void     Slice(Double_t xr,Double_t yr,Double_t xs,Double_t ys,TLine *line);
00204    void     Transform(Int_t it,Int_t jt,Int_t zmt);//transform function
00205 
00206 public:
00207    ClassDef(TSpectrum2Painter,0)   //TSpectrum 3d graphics package
00208 };
00209 
00210 #endif

Generated on Tue Jul 5 14:24:40 2011 for ROOT_528-00b_version by  doxygen 1.5.1