Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

/Go4StatusBase/TGo4Picture.h

Go to the documentation of this file.
00001 //---------------------------------------------------------------
00002 //        Go4 Release Package v2.10-5 (build 21005) 
00003 //                      03-Nov-2005
00004 //---------------------------------------------------------------
00005 //       The GSI Online Offline Object Oriented (Go4) Project
00006 //       Experiment Data Processing at DVEE department, GSI
00007 //---------------------------------------------------------------
00008 //
00009 //Copyright (C) 2000- Gesellschaft f. Schwerionenforschung, GSI
00010 //                    Planckstr. 1, 64291 Darmstadt, Germany
00011 //Contact:            http://go4.gsi.de
00012 //----------------------------------------------------------------
00013 //This software can be used under the license agreements as stated
00014 //in Go4License.txt file which is part of the distribution.
00015 //----------------------------------------------------------------
00016 #ifndef TGO4PICTURE_H
00017 #define TGO4PICTURE_H
00018 
00019 #include "Gtypes.h"
00020 
00021 #include "TNamed.h"
00022 #include "TArrayL.h"
00023 #include "TArrayF.h"
00024 #include "TFolder.h"
00025 #include "TH1.h"
00026 #include "THStack.h"
00027 #include "TGraph.h"
00028 
00029 
00030 class TVirtualPad;
00031 class TObjArray;
00032 
00033 class TAttLine;
00034 class TAttFill;
00035 class TAttMarker;
00036 class TStyle;
00037 class TString;
00038 
00039 class TAxis;
00040 
00041 class TGo4Picture : public TNamed {
00042    public:
00043       enum Indexes { UndefIndex = -2, PictureIndex = -1 };
00044 
00045       TGo4Picture();
00046       TGo4Picture(const char* name, const char* title, Int_t ndivy = 1, Int_t ndivx = 1);
00047       virtual ~TGo4Picture();
00048 
00049 
00050       // ====== USER FUNCTIONS to setup picture =====================
00051 
00052       void SetDrawHeader(Bool_t draw = kTRUE);
00053       Bool_t IsDrawHeader();
00054 
00055       // division on subpictures
00056 
00057       void SetDivision(Int_t ndivy, Int_t ndivx);
00058       Int_t GetDivX() { return fiNDivX; }
00059       Int_t GetDivY() { return fiNDivY; }
00060       Bool_t IsDivided() { return (GetDivX()!=1) || (GetDivY()!=1); }
00061 
00062       TGo4Picture& operator()(int posy, int posx) { return *Pic(posy,posx); }
00063       TGo4Picture* Pic(Int_t posy, Int_t posx);
00064       TGo4Picture* FindPic(Int_t posy, Int_t posx);
00065 
00066       // GOOSY style of picture division
00067 
00068       void SetLinesDivision(Int_t numlines, const Int_t* numbers);
00069       void SetLinesDivision(Int_t numlines, Int_t n0=1, Int_t n1=1, Int_t n2=1, Int_t n3=1, Int_t n4=1,
00070                                             Int_t n5=1, Int_t n6=1, Int_t n7=1, Int_t n8=1, Int_t n9=1);
00071       TGo4Picture* LPic(Int_t nline, Int_t ncol);
00072 
00073       // add histogram (name) to picture or subpicture
00074       void AddH1(TH1* histo, Option_t* DrawOption = 0);
00075       void AddH1(Int_t posy, Int_t posx, TH1* histo, Option_t* DrawOption = 0);
00076 
00077       // add stack (name) to picture or subpicture
00078       void AddHStack(THStack* st, Option_t* DrawOption = 0);
00079       void AddHStack(Int_t posy, Int_t posx, THStack* st, Option_t* DrawOption = 0);
00080 
00081       // add TGraph object (name) to picture
00082       void AddGraph(TGraph* gr, Option_t* DrawOption = 0);
00083       void AddGraph(Int_t posy, Int_t posx, TGraph* gr, Option_t* DrawOption = 0);
00084 
00085       // add condition (name) to picture or subpicture
00086       void AddCondition(TNamed* cond = 0);
00087       void AddCondition(Int_t posy, Int_t posx, TNamed* cond = 0);
00088 
00089       // clear names of any objects (include histos and conditions) from subpicture (may be recursive)
00090       void ClearObjNames(Bool_t recursive = kFALSE);
00091 
00092       // sets viewable range for X and Y axis
00093       void SetRangeX(Double_t min, Double_t max);
00094       Bool_t GetRangeX(Double_t& min, Double_t& max);
00095       void ClearRangeX();
00096       void SetRangeY(Double_t min, Double_t max);
00097       Bool_t GetRangeY(Double_t& min, Double_t& max);
00098       void ClearRangeY();
00099 
00100       // set logarithmic scale for selected axis
00101       void SetLogScale(Int_t nscale = 0, Int_t zn = 1);
00102       Int_t GetLogScale(Int_t nscale = 0);
00103       void GetLogScales(TVirtualPad* pad);
00104       void ClearLogScales();
00105 
00106       // select index from object list, to which followinf options will be applied
00107       void SetSelectedIndex(Int_t index = PictureIndex) { fiLastIndex = index; }
00108 
00109       // sets line attributes
00110       void SetLineAtt(Color_t color, Style_t style, Width_t width, Int_t index = UndefIndex);
00111       void SetLineAtt(TAttLine* line, Int_t index = UndefIndex);
00112       void GetLineAtt(TAttLine* line, Int_t index = UndefIndex);
00113       void ClearLineAtt(Int_t index = UndefIndex);
00114 
00115       // sets fill attributes
00116       void SetFillAtt(Color_t color, Style_t style, Int_t index = UndefIndex);
00117       void SetFillAtt(TAttFill* fill, Int_t index = UndefIndex);
00118       void GetFillAtt(TAttFill* fill, Int_t index = UndefIndex);
00119       void ClearFillAtt(Int_t index = UndefIndex);
00120 
00121       // set marker attributes
00122       void SetMarkerAtt(Color_t color, Size_t size, Style_t style, Int_t index = UndefIndex);
00123       void SetMarkerAtt(TAttMarker* marker, Int_t index = UndefIndex);
00124       void GetMarkerAtt(TAttMarker* marker, Int_t index = UndefIndex);
00125       void ClearMarkerAtt(Int_t index = UndefIndex);
00126 
00127       // set string draw options
00128       void SetDrawOption(Option_t* option, Int_t index = UndefIndex);
00129       Option_t* GetDrawOption(Int_t index = UndefIndex);
00130 
00131       // set draw style (Go4GUI index like)
00132       void SetHistDrawStyle(Int_t zn, Int_t index = UndefIndex);
00133       void SetHistErrorStyle(Int_t zn, Int_t index = UndefIndex);
00134       void SetHistCoordStyle(Int_t zn, Int_t index = UndefIndex);
00135       Int_t GetHistDrawStyle(Int_t index = UndefIndex);
00136       Int_t GetHistErrorStyle(Int_t index = UndefIndex);
00137       Int_t GetHistCoordStyle(Int_t index = UndefIndex);
00138       void ClearHistStyles(Int_t index = UndefIndex);
00139 
00140 
00141 
00142 
00143       virtual void Draw(Option_t* option = "");     //  *MENU*
00144 
00145       virtual void Clear(Option_t* option = "");    //  *MENU*
00146 
00147       virtual void Print(Option_t* option = "") const;    //  *MENU*
00148 
00149 
00150       // ====== end of USER FUNCTIONS ========================
00151 
00152 
00153       // add name of any object, which should be drawn in picture or subpcture
00154       void AddObjName(const char* name, Option_t* DrawOption = 0);
00155       void AddObjName(Int_t posy, Int_t posx, const char* name, Option_t* DrawOption = 0);
00156 
00157       // adds object and it's name of provided objects
00158       void AddObject(TObject* obj, Option_t* DrawOption = 0);
00159       void AddObject(Int_t posy, Int_t posx, TObject* obj, Option_t* DrawOption = 0);
00160 
00161 
00162       void Reset();
00163 
00164       TVirtualPad* DrawHeader(TVirtualPad* pad);
00165 
00166 
00167       // move content from source picture
00168       void UpdateFrom(TGo4Picture* source, TClass* selectedobjclass = 0);
00169 
00170       // move only content from source picture
00171       // should be unusefull while picture content only reference to data
00172       void UpdateObjectsContentFrom(TGo4Picture* source, TVirtualPad* pad = 0);
00173 
00174       // use this function to locate objects from folder
00175       // this objects can be drawn (via draw method) or transfer via socket
00176       void LocateObjectsFrom(TFolder* folder);
00177 
00178 
00179       void CapturePadData(TVirtualPad* pad, bool takeprop = false);
00180 
00181       Int_t GetNumObjNames();
00182       const char* GetObjName(Int_t n);
00183       Bool_t IsObjNames();
00184 
00185       void AddObjectDirectly(TObject* obj, Option_t* DrawOption = 0);
00186       void AddObjectDirectly(Int_t posy, Int_t posx, TObject* obj, Option_t* DrawOption = 0);
00187       void ClearObjects(Bool_t recursive = kFALSE);
00188       Int_t GetNumObjects();
00189       TObject* GetObject(Int_t n);
00190       TObject* FindObject(const char* name);
00191 
00192       // set style object
00193       void SetStyle(TStyle* style, Int_t index = UndefIndex);
00194       TStyle* FindStyle(Int_t index = UndefIndex);
00195       TStyle* GetStyle(Int_t index = UndefIndex);
00196 
00197       void SetObjectsOwnership(Bool_t ownership);
00198 
00199       Bool_t AppendHistStylesToString(TString* str, Int_t index = UndefIndex);
00200 
00201    protected:
00202       TGo4Picture(TGo4Picture& picture);
00203       void AddSubPicture(TGo4Picture* pic);
00204 
00205       Int_t GetObjAttIndex(TObject* obj);
00206 
00207       void DrawPictureObjects(TVirtualPad* pad);
00208 
00209       void SetPosition(Int_t posy, Int_t posx);
00210       Bool_t CheckPosition(Int_t posy, Int_t posx);
00211 
00212       Int_t FindOptPos(Short_t index, Short_t typ);
00213       Int_t ExtendOptPos(Short_t index, Short_t typ);
00214 
00215       void SetOption(Short_t index, Short_t typ, Long_t value);
00216       Bool_t GetOption(Short_t index, Short_t typ, Long_t& value);
00217 
00218       void SetOptionF(Short_t index, Short_t typ, Float_t value);
00219       Bool_t GetOptionF(Short_t index, Short_t typ, Float_t& value);
00220 
00221       void SetOptionD(Short_t index, Short_t typ, Double_t value);
00222       Bool_t GetOptionD(Short_t index, Short_t typ, Double_t& value);
00223 
00224       void SetObjOption(Short_t index, Short_t typ, TObject* obj);
00225       TObject* GetObjOption(Short_t index, Short_t typ);
00226 
00227       void SetStrOption(Short_t index, Short_t typ, const char* value);
00228       const char* GetStrOption(Short_t index, Short_t typ);
00229 
00230       void ClearOption(Short_t index, Short_t typ);
00231       void ClearOption(Int_t pos);
00232       void ClearAllOptions(Short_t index = UndefIndex);
00233 
00234       TAxis* FindAxis(TVirtualPad* pad, Int_t num);
00235 
00236       void CheckIndex(Int_t& index);
00237 
00238       void DrawPic(TVirtualPad* pad);
00239 
00240       void PrintPic(int shift);
00241 
00242    private:
00243       Int_t fiNDivX;
00244       Int_t fiNDivY;
00245 
00246       Int_t fiPosX;
00247       Int_t fiPosY;
00248 
00249       TObjArray* fxNames;
00250 
00251       TObjArray* fxObjects;
00252 
00253       TObjArray* fxSubPictures;
00254 
00255       Int_t fiOptSize;
00256       TArrayL fxOptIndex;
00257       TArrayL fxOptValue;
00258       TObjArray* fxOptObjects;
00259 
00260       Int_t fiLastIndex;        
00261 
00262    ClassDef(TGo4Picture,1)
00263 };
00264 
00265 #endif //TGO4PICTURE_H
00266 
00267 
00268 
00269 //----------------------------END OF GO4 SOURCE FILE ---------------------

Generated on Tue Nov 8 10:56:05 2005 for Go4-v2.10-5 by doxygen1.2.15