25 #ifndef DATA_VIEWER_PANEL_BASE_HH_
26 #define DATA_VIEWER_PANEL_BASE_HH_
29 #include <boost/shared_ptr.hpp>
48 #include <QRubberBand>
50 namespace ost {
namespace img {
namespace gui {
62 virtual void SetData(
const Data& d);
66 virtual void paintEvent(QPaintEvent* event);
67 virtual void resizeEvent(QResizeEvent* event);
68 virtual void wheelEvent (QWheelEvent* event);
69 virtual void mousePressEvent(QMouseEvent* event);
70 virtual void mouseReleaseEvent(QMouseEvent* event);
71 virtual void mouseMoveEvent(QMouseEvent* event);
72 virtual void keyPressEvent(QKeyEvent * event);
79 virtual void ObserverUpdate();
80 virtual void ObserverUpdate(
const Extent& e);
81 virtual void ObserverUpdate(
const Point& p);
82 virtual void ObserverRelease();
88 void UpdateView(
bool update_raster_image=
true);
89 void UpdateView(
const QRect& rect,
bool update_raster_image=
true);
102 Extent GetSelection()
const;
105 void SetSelection(
const Extent& extent);
108 Point WinToPoint(
int mx,
int my)
const;
109 Point WinToPoint(
const QPoint& p)
const;
112 geom::Vec2 WinToFracPoint(
const QPoint& p)
const;
113 geom::Vec2 WinToFracPoint(
int mx,
int my)
const;
114 geom::Vec2 WinToFracPointCenter(
const QPoint& p)
const;
115 geom::Vec2 WinToFracPointCenter(
int mx,
int my)
const;
118 QPoint PointToWin(
const Point& p)
const;
120 QPoint FracPointToWin(
const geom::Vec2& p)
const;
122 QPoint FracPointToWinCenter(
const geom::Vec2& p)
const;
125 bool IsWithin(
const QPoint& p)
const;
128 Real GetZoomScale()
const;
131 void SetZoomScale(
Real zoom);
141 void SetDefaultCursor(
const QCursor& c);
142 void SetDefaultCursor(
int id);
145 void SetCursor(
const QCursor& c);
146 void SetCursor(
int id);
149 void SetDisplayPixelValues(
bool show);
171 void HideClickedPosition();
172 void ShowClickedPosition(
bool show);
173 bool ClickedPositionIsVisible();
176 Real GetDataMin()
const;
177 Real GetDataMax()
const;
178 bool GetInvert()
const;
179 void SetInvert(
bool invert);
180 Real GetGamma()
const;
181 void SetGamma(
Real gamma);
182 void SetViewerMin(
Real min);
183 Real GetViewerMin()
const;
184 void SetViewerMax(
Real max);
185 Real GetViewerMax()
const;
186 void UpdateNormalizer(
Real min,
Real max,
Real gamma,
bool invert);
188 void SetSlab(
int slab);
189 void SetSelectionMode(
int mode);
190 int GetSelectionMode();
191 void SetAntialiasing(
bool f);
192 bool GetAntialiasing()
const;
200 void zoomed(
int zoomlevel);
201 void selected(
const Extent& selection);
203 void slabChanged(
int slab);
217 QRubberBand* rubberband_;
220 bool update_raster_image_;
221 Real offset_x_, offset_y_;
224 bool show_clicked_position_;
231 bool display_pixel_values_;
235 int right_press_x_,right_press_y_;
240 std::map<int, QCursor> cursors_;
242 bool use_update_extent_;
250 void move(
int dx,
int dy);
255 void draw_extent(QPainter& p);
256 void draw_pixel_values(QPainter& p);
257 void update_min_max();
258 void update_rubberband_from_selection_();