Belle II Software  release-05-01-25
DisplayDrawingAreaHough.h
1 //-----------------------------------------------------------------------------
2 // $Id$
3 //-----------------------------------------------------------------------------
4 // Filename : DisplayDrawingAreaHough.h
5 // Section : TRG CDC
6 // Owner : Yoshihito Iwasaki
7 // Email : yoshihito.iwasaki@kek.jp
8 //-----------------------------------------------------------------------------
9 // Description : A class to display CDC trigger objects.
10 //-----------------------------------------------------------------------------
11 // $Log$
12 //-----------------------------------------------------------------------------
13 
14 #ifdef TRGCDC_DISPLAY
15 
16 #ifndef TRGCDCDisplayDrawingAreaHough_FLAG_
17 #define TRGCDCDisplayDrawingAreaHough_FLAG_
18 
19 #include "trg/cdc/DisplayDrawingArea.h"
20 
21 #ifdef TRGCDC_SHORT_NAMES
22 #define TCDDAreaHough TRGCDCDisplayDrawingAreaHough
23 #endif
24 
25 namespace Belle2 {
31  class TRGCDCDisplay;
32  class TRGCDCHoughPlane;
33 
35  class TRGCDCDisplayDrawingAreaHough : public TRGCDCDisplayDrawingArea {
36 
37  public:
38 
40  TRGCDCDisplayDrawingAreaHough(TRGCDCDisplay&, int size);
41 
43  virtual ~TRGCDCDisplayDrawingAreaHough();
44 
45  double scale(double);
46  double scale(void) const;
47  void resetPosition(void) override;
48  bool wireName(void) const;
49  bool wireName(bool);
50  bool oldCDC(void) const;
51  bool oldCDC(bool);
52 
53  void clear(void) override;
54 
55  virtual bool on_expose_event(GdkEventExpose*) override;
56  virtual bool on_button_press_event(GdkEventButton*) override;
57 
58  void append(const TRGCDCHoughPlane* const);
59 
60  private:
61  virtual void on_realize() override;
62  void draw(void);
63 
65  int xT(double x) const;
66  int yT(double y) const;
67  int xR(double x) const;
68  int yR(double y) const;
69 
71  int toY(int y) const;
72 
74  int drawCell(unsigned xCell, unsigned yCell);
75 
77  int drawRegion(const std::vector<unsigned>& region);
78 
79  private:
80  double _scale;
81  double _scaleX;
82  double _scaleY;
83  bool _wireName;
84  bool _oldCDC;
85  double _x, _y;
86  const TRGCDCHoughPlane* _hp;
87 
88  Glib::RefPtr<Gdk::Window> _window;
89  int _winx, _winy, _winw, _winh, _wind;
90 
91  Glib::RefPtr<Gdk::GC> _gc;
92  Gdk::Color _blue, _red, _green, _black, _white, _gray, _yellow;
93  Gdk::Color _gray0, _gray1, _gray2, _gray3;
94  };
95 
96 //-----------------------------------------------------------------------------
97 
98  inline
99  double
100  TRGCDCDisplayDrawingAreaHough::scale(double a)
101  {
102  return _scale = a;
103  }
104 
105  inline
106  double
107  TRGCDCDisplayDrawingAreaHough::scale(void) const
108  {
109  return _scale;
110  }
111 
112  inline
113  bool
114  TRGCDCDisplayDrawingAreaHough::wireName(void) const
115  {
116  return _wireName;
117  }
118 
119  inline
120  bool
121  TRGCDCDisplayDrawingAreaHough::wireName(bool a)
122  {
123  return _wireName = a;
124  }
125 
126  inline
127  int
128  TRGCDCDisplayDrawingAreaHough::toY(int a) const
129  {
130  return - a + _winh;
131  }
132 
133  inline
134  void
135  TRGCDCDisplayDrawingAreaHough::clear(void)
136  {
137  _hp = 0;
138  }
139 
140  inline
141  void
142  TRGCDCDisplayDrawingAreaHough::append(const TRGCDCHoughPlane* const hp)
143  {
144  _hp = hp;
145  on_expose_event((GdkEventExpose*) NULL);
146  }
147 
149 } // namespace Belle2
150 
151 #endif // TRGCDCDisplayDrawingAreaHough_FLAG_
152 #endif
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19