GSI Object Oriented Online Offline (Go4)  GO4-6.3.0
TGo4Marker.h
Go to the documentation of this file.
1 // $Id$
2 //-----------------------------------------------------------------------
3 // The GSI Online Offline Object Oriented (Go4) Project
4 // Experiment Data Processing at EE department, GSI
5 //-----------------------------------------------------------------------
6 // Copyright (C) 2000- GSI Helmholtzzentrum fuer Schwerionenforschung GmbH
7 // Planckstr. 1, 64291 Darmstadt, Germany
8 // Contact: http://go4.gsi.de
9 //-----------------------------------------------------------------------
10 // This software can be used under the license agreements as stated
11 // in Go4License.txt file which is part of the distribution.
12 //-----------------------------------------------------------------------
13 
14 #ifndef TGO4MARKER_H
15 #define TGO4MARKER_H
16 
17 #include "TMarker.h"
18 #include "TString.h"
19 
20 class TGo4MarkerPainter;
21 class TH1;
22 class TVirtualPad;
23 
32 class TGo4Marker : public TMarker {
33 
34 public:
35  TGo4Marker();
36  TGo4Marker(Double_t x, Double_t y, Int_t style);
37  virtual ~TGo4Marker();
38 
41  void Print(Option_t *opt = "") const override;
42 
44  void Paint(Option_t *opt = "") override;
45 
47  void Draw(Option_t *opt = "") override;
48 
50  virtual void UnDraw(Option_t *opt = "");
51 
53  void Pop() override;
54 
56  void ExecuteEvent(Int_t event, Int_t px, Int_t py) override;
57 
60 
61  void DeletePainter();
62 
63  void SetVisible(Bool_t on) { fbVisible = on; }
64  Bool_t IsVisible() const { return fbVisible; }
65  virtual void SetName(const char *name) { fxName = name; } // *MENU*
66  // void DeleteMarker(); // *MENU*
67 
69  void SetToBin(Int_t xbin, Int_t ybin = 0); // *MENU*
70  void SetLabelDraw(Bool_t on) { fbHasLabel = on; } // // *TOGGLE* *GETTER=HasLabel
71  Bool_t HasLabel() const { return fbHasLabel; }
72  void SetLineDraw(Bool_t on) { fbHasConnector = on; } // *TOGGLE* *GETTER=HasConnector
73  Bool_t HasConnector() const { return fbHasConnector; }
74  void SetXDraw(Bool_t on) { fbXDraw = on; } // *TOGGLE* *GETTER=IsXDraw
75  Bool_t IsXDraw() const { return fbXDraw; }
76  void SetYDraw(Bool_t on) { fbYDraw = on; } // *TOGGLE* *GETTER=IsYDraw
77  Bool_t IsYDraw() const { return fbYDraw; }
78  void SetXbinDraw(Bool_t on) { fbXbinDraw = on; } // *TOGGLE* *GETTER=IsXbinDraw
79  Bool_t IsXbinDraw() const { return fbXbinDraw; }
80  void SetYbinDraw(Bool_t on) { fbYbinDraw = on; } // *TOGGLE* *GETTER=IsYbinDraw
81  Bool_t IsYbinDraw() const { return fbYbinDraw; }
82  void SetContDraw(Bool_t on) { fbContDraw = on; } // *TOGGLE* *GETTER=IsContDraw
83  Bool_t IsContDraw() const { return fbContDraw; }
84 
85  const char *GetNumFormat() const { return fxNumFormat.Data(); }
86  void SetNumFormat(const char *fmt="%.4E"){ fxNumFormat = fmt; }// *MENU*
87 
89  void SaveLabelStyle(); // *MENU*
90 
92  void ResetLabel(); // *MENU*
93 
95  void InitLabelStyle();
96 
97  void SetHistogram(TH1 *histo);
98  TH1 *GetHistogram() const { return fxHisto; }
99 
101  const char *GetName() const override { return fxName.Data(); }
102 
103  void SetXY(Double_t x, Double_t y)
104  {
105  SetX(x);
106  SetY(y);
107  }
108 
110  Int_t GetXbin() const;
112  Int_t GetYbin() const;
114  Int_t GetCont() const;
116  Double_t GetLabelX() const;
118  Double_t GetLabelY() const;
119 
120  static Int_t GetInstances();
121 
122  TVirtualPad *GetDrawPad() const { return fxDrawPad; }
123 
125  Bool_t CheckDrawPad() const;
127  Bool_t CheckHistogram() const;
128 
130  static Bool_t fgbHASLABEL;
131 
133  static Bool_t fgbHASCONNECTOR;
134 
136  static Bool_t fgbXDRAW;
137 
139  static Bool_t fgbYDRAW;
140 
142  static Bool_t fgbXBINDRAW;
143 
145  static Bool_t fgbYBINDRAW;
146 
148  static Bool_t fgbCONTDRAW;
149 
151  static TString fgxNUMFORMAT;
152 
153  static void SetGlobalStyle(Bool_t HASLABEL, Bool_t HASCONNECTOR, Bool_t XDRAW, Bool_t YDRAW,
154  Bool_t XBINDRAW,Bool_t YBINDRAW,Bool_t CONTDRAW, const char *NUMFORMAT);
155 
156  static void GetGlobalStyle(Bool_t &HASLABEL, Bool_t &HASCONNECTOR, Bool_t &XDRAW, Bool_t &YDRAW,
157  Bool_t &XBINDRAW, Bool_t &YBINDRAW, Bool_t &CONTDRAW, TString &NUMFORMAT);
158 
159 protected:
160 
165 
166  void SetPainted(Bool_t on) { fbIsPainted=on; }
167  Bool_t IsPainted() const { return fbIsPainted; }
168 
169  void SetDrawPad(TVirtualPad *pad);
170 
171 
172 private:
173 
175  TString fxName;
176 
179  Bool_t fbIsPainted{kFALSE};
180 
182  Bool_t fbVisible{kTRUE};
183 
185  Bool_t fbHasLabel{kTRUE};
186 
188  Bool_t fbHasConnector{kTRUE};
189 
191  Bool_t fbXDraw{kTRUE};
192 
194  Bool_t fbYDraw{kTRUE};
195 
197  Bool_t fbXbinDraw{kTRUE};
198 
200  Bool_t fbYbinDraw{kTRUE};
201 
203  Bool_t fbContDraw{kTRUE};
204 
206  TString fxNumFormat;
207 
209  TH1 *fxHisto{nullptr};
210 
213  TVirtualPad *fxDrawPad{nullptr};
214 
216  static UInt_t fguInstanceCounter;
217 
218  ClassDefOverride(TGo4Marker,1)
219 };
220 
221 #endif //TGO4MARKER_H
222 
TString fxNumFormat
Definition: TGo4Marker.h:206
void SetDrawPad(TVirtualPad *pad)
Definition: TGo4Marker.cxx:64
static Bool_t fgbHASCONNECTOR
Definition: TGo4Marker.h:133
Bool_t fbVisible
Definition: TGo4Marker.h:182
void SetLabelDraw(Bool_t on)
Definition: TGo4Marker.h:70
void SetXbinDraw(Bool_t on)
Definition: TGo4Marker.h:78
Int_t GetYbin() const
Definition: TGo4Marker.cxx:173
static Bool_t fgbCONTDRAW
Definition: TGo4Marker.h:148
Bool_t IsYbinDraw() const
Definition: TGo4Marker.h:81
void SetYbinDraw(Bool_t on)
Definition: TGo4Marker.h:80
void ResetLabel()
Definition: TGo4Marker.cxx:285
void SetToBin(Int_t xbin, Int_t ybin=0)
Definition: TGo4Marker.cxx:149
Int_t GetCont() const
Definition: TGo4Marker.cxx:180
Bool_t fbXbinDraw
Definition: TGo4Marker.h:197
void SetXDraw(Bool_t on)
Definition: TGo4Marker.h:74
static Int_t GetInstances()
Definition: TGo4Marker.cxx:36
Bool_t HasLabel() const
Definition: TGo4Marker.h:71
Bool_t CheckDrawPad() const
Definition: TGo4Marker.cxx:69
void SetHistogram(TH1 *histo)
Definition: TGo4Marker.cxx:74
void SetNumFormat(const char *fmt="%.4E")
Definition: TGo4Marker.h:86
Bool_t IsYDraw() const
Definition: TGo4Marker.h:77
static Bool_t fgbXDRAW
Definition: TGo4Marker.h:136
void SaveLabelStyle()
Definition: TGo4Marker.cxx:233
static Bool_t fgbYBINDRAW
Definition: TGo4Marker.h:145
virtual void SetName(const char *name)
Definition: TGo4Marker.h:65
void SetPainted(Bool_t on)
Definition: TGo4Marker.h:166
Double_t GetLabelX() const
Definition: TGo4Marker.cxx:188
Bool_t IsPainted() const
Definition: TGo4Marker.h:167
static void SetGlobalStyle(Bool_t HASLABEL, Bool_t HASCONNECTOR, Bool_t XDRAW, Bool_t YDRAW, Bool_t XBINDRAW, Bool_t YBINDRAW, Bool_t CONTDRAW, const char *NUMFORMAT)
Definition: TGo4Marker.cxx:257
virtual TGo4MarkerPainter * CreatePainter()
Definition: TGo4Marker.cxx:142
Double_t GetLabelY() const
Definition: TGo4Marker.cxx:197
TGo4MarkerPainter * fxPainter
Definition: TGo4Marker.h:164
const char * GetName() const override
Definition: TGo4Marker.h:101
TH1 * fxHisto
Definition: TGo4Marker.h:209
void Paint(Option_t *opt="") override
Definition: TGo4Marker.cxx:85
Int_t GetXbin() const
Definition: TGo4Marker.cxx:166
void DeletePainter()
Definition: TGo4Marker.cxx:293
Bool_t fbYbinDraw
Definition: TGo4Marker.h:200
void SetContDraw(Bool_t on)
Definition: TGo4Marker.h:82
Bool_t fbContDraw
Definition: TGo4Marker.h:203
virtual void UnDraw(Option_t *opt="")
Definition: TGo4Marker.cxx:115
Bool_t IsXbinDraw() const
Definition: TGo4Marker.h:79
void Print(Option_t *opt="") const override
Definition: TGo4Marker.cxx:210
static Bool_t fgbYDRAW
Definition: TGo4Marker.h:139
Bool_t HasConnector() const
Definition: TGo4Marker.h:73
TVirtualPad * GetDrawPad() const
Definition: TGo4Marker.h:122
Bool_t fbXDraw
Definition: TGo4Marker.h:191
void SetVisible(Bool_t on)
Definition: TGo4Marker.h:63
Bool_t IsXDraw() const
Definition: TGo4Marker.h:75
static UInt_t fguInstanceCounter
Definition: TGo4Marker.h:216
Bool_t fbHasConnector
Definition: TGo4Marker.h:188
void SetXY(Double_t x, Double_t y)
Definition: TGo4Marker.h:103
static Bool_t fgbXBINDRAW
Definition: TGo4Marker.h:142
Bool_t IsVisible() const
Definition: TGo4Marker.h:64
static TString fgxNUMFORMAT
Definition: TGo4Marker.h:151
static Bool_t fgbHASLABEL
Definition: TGo4Marker.h:130
TH1 * GetHistogram() const
Definition: TGo4Marker.h:98
static void GetGlobalStyle(Bool_t &HASLABEL, Bool_t &HASCONNECTOR, Bool_t &XDRAW, Bool_t &YDRAW, Bool_t &XBINDRAW, Bool_t &YBINDRAW, Bool_t &CONTDRAW, TString &NUMFORMAT)
Definition: TGo4Marker.cxx:271
Bool_t fbHasLabel
Definition: TGo4Marker.h:185
const char * GetNumFormat() const
Definition: TGo4Marker.h:85
void SetLineDraw(Bool_t on)
Definition: TGo4Marker.h:72
TString fxName
Definition: TGo4Marker.h:175
TVirtualPad * fxDrawPad
Definition: TGo4Marker.h:213
Bool_t CheckHistogram() const
Definition: TGo4Marker.cxx:79
void SetYDraw(Bool_t on)
Definition: TGo4Marker.h:76
void InitLabelStyle()
Definition: TGo4Marker.cxx:245
void Pop() override
Definition: TGo4Marker.cxx:125
void Draw(Option_t *opt="") override
Definition: TGo4Marker.cxx:101
void ExecuteEvent(Int_t event, Int_t px, Int_t py) override
Definition: TGo4Marker.cxx:131
Bool_t fbIsPainted
Definition: TGo4Marker.h:179
Bool_t IsContDraw() const
Definition: TGo4Marker.h:83
Bool_t fbYDraw
Definition: TGo4Marker.h:194
virtual ~TGo4Marker()
Definition: TGo4Marker.cxx:57