GammaWare  Head Version for release 0.9
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Link.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2004 by Olivier Stezowski *
3  * stezow(AT)ipnl.in2p3.fr *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * along with this program; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19  ***************************************************************************/
20 
23 #ifndef Gw_Link
24 #define Gw_Link
25 #define GW_LINK_H Gw_Link
26 
27 #ifndef ROOT_TBox
28 #include <TBox.h>
29 #endif
30 #ifndef ROOT_TPolyLine
31 #include <TPolyLine.h>
32 #endif
33 #ifndef ROOT_TSeqCollection
34 #include <TSeqCollection.h>
35 #endif
36 
37 #include "GwLogMessage.h"
38 
39 #ifndef GW_LEVEL_H
40 #include "Level.h"
41 #endif
42 
43 #ifndef GW_MEASURE_H
44 #include "Measure.h"
45 #endif
46 
47 #define MAX_LINK_LABEL 2
48 
49 namespace Gw {
50 
65 class Link : public TPolyLine
66 {
67 
68 public:
69 
70  static Color_t GetDefaultColor() { return fgDefaultColor; }
71  static Float_t GetDefaultLabelSize() { return fgDefaultLabelSize; }
72  static Color_t GetDefaultLabelColor() { return fgDefaultLabelColor; }
73 
74  static void SetDefaultColor(Color_t color) { fgDefaultColor = color; }
75  static void SetDefaultLabelSize(Float_t size) { fgDefaultLabelSize = size; }
76  static void SetDefaultLabelColor(Color_t color) { fgDefaultLabelColor = color; }
77 
78  static void EnableMove() { fgMovable = true; }
79  static void DisableMove() { fgMovable = false; }
80  static Bool_t IsMovable() { return fgMovable == true; }
81 
82 private:
83  static Color_t fgDefaultColor; // default color (black)
84  static Bool_t fgMovable; // graphically movable
85 
86  static Color_t fgDefaultLabelColor; // default text color
87  static Float_t fgDefaultLabelSize; // default text size
88 
89 private:
90 
91  Double_t fgMinWidth;
92  Double_t fgMaxArrow;
93  Double_t fgProArrow;
94 
95 
96  TString fVisLabel; // To know if a label should be drawn ok not
97  TString fPosLabel; // To know the position of label 0:left; 1:center; 2:right
98 
99  TLatex fLabel0; // Some labels associated with this link
100  TLatex fLabel1; // Some labels associated with this link
101  TLatex fLabel2; // Some labels associated with this link
102  TBox fBox1; // box underlying label2 onto the link
103 
104 protected:
105  Int_t fArrowStyle; //Define arrowStyle : 0 ==> Def value
106 
107  mutable LogMessage fLog;
108 
109  Level *fInitial; // initial level
110  Level *fFinal; // final level
111 
112  Bool_t fIsSelected; // graphically selected
113  Bool_t fIsVisible; // flag to know whether the link is visible
114  Bool_t fIsModified; // flag to know whether the link has been modified
115 
116  static const Short_t fgkMaxLinkLabel; // max number of labels
117 
118 protected:
119  Measure<Float_t> fStrength; // strength that binds the two levels
120  Measure<Float_t> fTau; // characteritic time to ge from one level to the other one
121 
122 
123  Bool_t fIsAmbiguous; //Flag to know if a link is validated or ambiguous
124 
125 public:
126  Link();
127  Link(const Link &);
128  Link& operator=(const Link &);
129  virtual ~Link();
130 
132  virtual Int_t GetArrowStyle() {return fArrowStyle;}
133  virtual void SetArrowStyle(Int_t style) {fArrowStyle = style; SetPoints(GetX()[0]+(GetX()[2]-(GetX()[0]))/2.,GetX()[5]);} //*MENU*
134  virtual void SetVertical(){SetPoints((GetX()[5]+GetX()[1])/2.,(GetX()[5]+GetX()[1])/2.);} //*MENU*
135  virtual void SetAmbiguous(Bool_t isambiguous = true); //*MENU*
136  virtual Bool_t IsAmbiguous(){return fIsAmbiguous;}
137  virtual void RefreshPoints() {SetPoints(GetX()[0]+(GetX()[2]-(GetX()[0]))/2.,GetX()[5]);}
138 
140  virtual void SetPoints();
141  virtual void SetPoints(Double_t xi, Double_t xf);
142  virtual void SetBasicStylePoints(Double_t xi, Double_t xf);
143  virtual void SetAdvancedStylePoints(Double_t xi, Double_t xf);
144 
146  virtual void UpdatePoints();
147 
149  virtual Measure<Float_t> & GetTau() { return fTau; }
151  virtual Measure<Float_t> & GetStrength() { return fStrength; }
152 
154  virtual Level * SetFL(Level *final) { Level *tmp = fFinal; fFinal = final; return tmp; }
156  virtual Level * SetIL(Level *initial) { Level *tmp = fInitial; fInitial = initial; return tmp; }
158  virtual Level * GetIL() { return fInitial; }
160  virtual Level * GetFL() { return fFinal; }
161 
162  virtual Level * GetIL() const { return fInitial; }
164  virtual Level * GetFL() const { return fFinal; }
165 
167 
171  virtual Int_t DoCascade(TSeqCollection &/*col*/, Option_t */*opt*/ = "")
172  {
173  return 0;
174  }
175 
177  virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py);
178 
179 
181 
188  virtual void SetVisLabel(const char *); //*MENU*
189 
191  virtual void SetLabels(const char *l0, const char *l1, const char *l2) ; // *MENU* *ARGS={l0=>fLabel0,l1=>fLabel1,l2=>fLabel2}
192 
194  virtual void SetLabelsSize(Float_t size);
195 
197  virtual void SetLabelsColor(Color_t color);
198 
199 
201  virtual const char * GetVisLabel() { return fVisLabel.Data(); }
202 
204  virtual TLatex& GetLabel(Int_t);
205 
207  virtual const char* GetLabel0() { return fLabel0.GetTitle(); }
208  virtual const char* GetLabel1() { return fLabel1.GetTitle(); }
209  virtual const char* GetLabel2() { return fLabel2.GetTitle(); }
210 
212  virtual void SetLabel(const char *, Int_t);
213 
215  virtual void SetDefaultLabels();
216 
218  virtual void Selected() {fIsSelected = true;}
219 
221  virtual void DeSelected() {fIsSelected = false;}
222 
224  virtual Bool_t IsSelected() {return fIsSelected;}
225 
227  virtual void SetVisible() {fIsVisible = true;}
228 
230  virtual void SetUnvisible() {fIsVisible = false;}
231 
233  virtual Bool_t IsVisible() {return fIsVisible;}
234 
236  virtual void SetModified() {fIsModified = true;}
237 
239  virtual void SetUnmdified() {fIsModified = false;}
240 
242  virtual Bool_t IsModified() {return fIsModified;}
243 
245  virtual void Draw(Option_t* option = "");
246  virtual void Paint(Option_t* option = "");
247 
249  virtual void ls(Option_t* /*option*/ = "") const { return; }
250 
252  void Delete(const Option_t* /*opt*/ = "") { return; }
253 
255  Bool_t IsSortable() const { return kTRUE; }
256 
257  virtual Int_t Compare(const TObject* obj) const;
258 
260  ClassDef(Link,5); // a Link binds two levels
261 };
262 // inline members
263 }
264 
265 #endif
Base class for a Log message.
Definition: GwLogMessage.h:94
template that defines a general Measure
header file for GwLogMessage.cpp
header file for a general Level
const Int_t size
Definition: BenchIO.C:24
Base class describing a general level.
Definition: Level.h:53