25 #ifndef DATA_VIEWER_PANEL_BASE_HH_
26 #define DATA_VIEWER_PANEL_BASE_HH_
32 #include <boost/shared_ptr.hpp>
51 #include <QRubberBand>
53 namespace ost {
namespace img {
namespace gui {
69 virtual void paintEvent(QPaintEvent* event);
70 virtual void resizeEvent(QResizeEvent* event);
71 virtual void wheelEvent (QWheelEvent* event);
72 virtual void mousePressEvent(QMouseEvent* event);
73 virtual void mouseReleaseEvent(QMouseEvent* event);
74 virtual void mouseMoveEvent(QMouseEvent* event);
75 virtual void keyPressEvent(QKeyEvent * event);
80 virtual void ObserverUpdate();
81 virtual void ObserverUpdate(
const Extent& e);
82 virtual void ObserverUpdate(
const Point& p);
83 virtual void ObserverRelease();
89 void UpdateView(
bool update_raster_image=
true);
90 void UpdateView(
const QRect& rect,
bool update_raster_image=
true);
103 Extent GetSelection()
const;
106 void SetSelection(
const Extent& extent);
109 Point WinToPoint(
int mx,
int my)
const;
110 Point WinToPoint(
const QPoint& p)
const;
113 geom::Vec2 WinToFracPoint(
const QPoint& p)
const;
114 geom::Vec2 WinToFracPoint(
int mx,
int my)
const;
115 geom::Vec2 WinToFracPointCenter(
const QPoint& p)
const;
116 geom::Vec2 WinToFracPointCenter(
int mx,
int my)
const;
119 QPoint PointToWin(
const Point& p)
const;
121 QPoint FracPointToWin(
const geom::Vec2& p)
const;
123 QPoint FracPointToWinCenter(
const geom::Vec2& p)
const;
126 bool IsWithin(
const QPoint& p)
const;
129 Real GetZoomScale()
const;
132 void SetZoomScale(
Real zoom);
142 void SetDefaultCursor(
const QCursor& c);
143 void SetDefaultCursor(
int id);
146 void SetCursor(
const QCursor& c);
147 void SetCursor(
int id);
150 void SetDisplayPixelValues(
bool show);
164 void SetFastLowMagnificationDrawing(
bool flag);
165 bool GetFastLowMagnificationDrawing();
166 void SetFastHighMagnificationDrawing(
bool flag);
167 bool GetFastHighMagnificationDrawing();
172 void HideClickedPosition();
173 void ShowClickedPosition(
bool show);
174 bool ClickedPositionIsVisible();
177 Real GetDataMin()
const;
178 Real GetDataMax()
const;
179 bool GetInvert()
const;
180 void SetInvert(
bool invert);
181 Real GetGamma()
const;
182 void SetGamma(
Real gamma);
183 void SetViewerMin(
Real min);
184 Real GetViewerMin()
const;
185 void SetViewerMax(
Real max);
186 Real GetViewerMax()
const;
187 void UpdateNormalizer(
Real min,
Real max,
Real gamma,
bool invert);
189 void SetSlab(
int slab);
190 void SetSelectionMode(
int mode);
191 int GetSelectionMode();
192 void SetAntialiasing(
bool f);
193 bool GetAntialiasing()
const;
201 void zoomed(
int zoomlevel);
202 void selected(
const Extent& selection);
204 void slabChanged(
int slab);
212 void toggle_phase_color();
215 void toggle_invert();
216 void toggle_display_pixels();
217 void toggle_show_click_pos();
226 void toggle_fast_low_mag();
227 void toggle_fast_high_mag();
228 void toggle_antialiasing();
239 QRubberBand* rubberband_;
242 bool update_raster_image_;
243 Real offset_x_, offset_y_;
246 bool show_clicked_position_;
253 bool display_pixel_values_;
257 int right_press_x_,right_press_y_;
262 std::map<int, QCursor> cursors_;
264 bool use_update_extent_;
271 QAction* phase_toggle_action_;
272 QAction* invert_toggle_action_;
273 QAction* show_click_pos_toggle_action_;
274 QAction* fast_low_mag_toggle_action_;
275 QAction* fast_high_mag_toggle_action_;
276 QAction* display_pixel_toggle_action_;
277 QAction* antialiasing_toggle_action_;
280 void move(
int dx,
int dy);
285 void draw_extent(QPainter& p);
286 void draw_pixel_values(QPainter& p);
287 void update_min_max();
288 void update_rubberband_from_selection_();
geom::Vec2 GetMousePosition()
bool GetDisplayPixelValues()
boost::shared_ptr< ViewerNormalizer > ViewerNormalizerPtr
#define DLLEXPORT_OST_GUI
T Extract(const info::InfoGroup &g, const String &n)
Convenience function to extract a value from an item.
Defines lower and upper valid indices.
Three dimensional vector class, using Real precision.
RasterImage::Mode GetColorMode()
Abstract base class of data observer.
Manage shared instances of images.
class encapsulating 1D to 3D point