iRoCS Toolbox  1.1.0
OrthoViewPlaneGL.hh
Go to the documentation of this file.
1 /**************************************************************************
2  *
3  * This file belongs to the iRoCS Toolbox.
4  *
5  * Copyright (C) 2015 Thorsten Falk
6  *
7  * Image Analysis Lab, University of Freiburg, Germany
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 3 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software Foundation,
21  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22  *
23  **************************************************************************/
24 
25 #ifndef ORTHOVIEWPLANEGL_HH
26 #define ORTHOVIEWPLANEGL_HH
27 
28 #ifdef HAVE_CONFIG_H
29 #include <config.hh>
30 #endif
31 
32 #include <blitz/array.h>
33 
34 class QGLWidget;
35 class QMouseEvent;
36 class QWheelEvent;
37 
38 class OrthoViewWidget;
39 
40 class OrthoViewPlaneGL : public QGLWidget
41 {
42 
43  Q_OBJECT
44 
45 public:
46 
48  const blitz::TinyVector<int,2>& dimensions,
49  QWidget* parent = 0);
51 
52  void clearData();
53  void addData(const blitz::Array<blitz::TinyVector<float,3>,2>& data);
54 
55 signals:
56 
57  void mouseMoved(ptrdiff_t x, ptrdiff_t y);
58  void mouseWheelMoved(ptrdiff_t z);
59  void crosshairDragged(ptrdiff_t x, ptrdiff_t y);
60  void hLineDragged(ptrdiff_t x);
61  void vLineDragged(ptrdiff_t y);
62  void positionSelected(
63  ptrdiff_t x, ptrdiff_t y,
64  Qt::MouseButton button, Qt::KeyboardModifiers modifiers);
65 
66 private:
67 
68  double elSizeZoom(int dim) const;
69  double zoom() const;
70  ptrdiff_t pos(int dim) const;
71 
72  void initializeGL();
73  void resizeGL(int w, int h);
74  void paintGL();
75 
76  void mouseMoveEvent(QMouseEvent* e);
77  void mousePressEvent(QMouseEvent* e);
78  void mouseReleaseEvent(QMouseEvent* e);
79  void wheelEvent(QWheelEvent* e);
80 
81  OrthoViewWidget* p_orthoView;
82  blitz::Array<blitz::TinyVector<float,3>,2> _data;
83  blitz::TinyVector<int,2> _dimensions;
84  GLuint _texture;
85 
86  bool _dragVertical, _dragHorizontal, _isDragging;
87 
88 };
89 
90 #endif
void vLineDragged(ptrdiff_t y)
void positionSelected(ptrdiff_t x, ptrdiff_t y, Qt::MouseButton button, Qt::KeyboardModifiers modifiers)
void crosshairDragged(ptrdiff_t x, ptrdiff_t y)
void mouseWheelMoved(ptrdiff_t z)
void addData(const blitz::Array< blitz::TinyVector< float, 3 >, 2 > &data)
void hLineDragged(ptrdiff_t x)
OrthoViewPlaneGL(OrthoViewWidget *orthoView, const blitz::TinyVector< int, 2 > &dimensions, QWidget *parent=0)
void mouseMoved(ptrdiff_t x, ptrdiff_t y)