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