OpenStructure
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
data_viewer.hh
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 // This file is part of the OpenStructure project <www.openstructure.org>
3 //
4 // Copyright (C) 2008-2011 by the OpenStructure authors
5 // Copyright (C) 2003-2010 by the IPLT authors
6 //
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License as published by the Free
9 // Software Foundation; either version 3.0 of the License, or (at your option)
10 // any later version.
11 // This library is distributed in the hope that it will be useful, but WITHOUT
12 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
14 // details.
15 //
16 // You should have received a copy of the GNU Lesser General Public License
17 // along with this library; if not, write to the Free Software Foundation, Inc.,
18 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 //------------------------------------------------------------------------------
20 
21 /*
22  Authors: Ansgar Philippsen, Andreas Schenk
23 */
24 
25 #ifndef IMG_GUI_DATA_VIEWER_H
26 #define IMG_GUI_DATA_VIEWER_H
27 
28 #include <map>
29 
30 #include <ost/base.hh>
31 #include <ost/img/data.hh>
32 #include <ost/img/data_observer.hh>
33 #include <ost/img/alg/norm.hh>
34 
35 #include <ost/gui/main_window.hh>
36 
37 #include "overlay_base_fw.hh"
38 #include "overlay_manager_fw.hh"
39 #include "overlay_manager_gui.hh"
40 #include "argand.hh"
41 #include "info_panel.hh"
42 #include "fft_panel.hh"
43 #include <ost/gui/module_config.hh>
44 
45 //fw decl
46 class QLabel;
47 
48 namespace ost {
49 
50 namespace gui {
51 class GostyApp;
52 } //ns
53 
54 namespace img { namespace gui {
55 
56 //fw decl
57 class DataViewerPanel;
58 
61 {
62  Q_OBJECT;
63 
64  friend class ost::gui::GostyApp; // for creation
65 
66 public:
67  virtual ~DataViewer();
68 
70  void SetData(const Data& data);
71 
73  NormalizerPtr GetNormalizer() const;
74 
76  void Renormalize();
77 
78  void Recenter();
79 
81  Extent GetSelection() const;
82 
84  void SetSelection(const Extent& selection);
85 
87  void SetName(const String& name);
88 
90  int AddOverlay(const OverlayPtr& ov, bool make_active=true);
91 
93  void ClearOverlays();
94 
96  OverlayManagerPtr GetOverlayManager() const;
97 
99  virtual void OnPanelMouseEvent(QMouseEvent* e);
100 
102  void SetAntialiasing(bool f);
103 
105  virtual bool eventFilter(QObject * object, QEvent *event);
106 
108  void SetSlab(int slab);
110  int GetSlab() const;
111 
113  void SetZoomScale(Real zoomscale);
115  Real GetZoomScale() const;
116 
118  void SetViewerMin(Real min);
120  Real GetViewerMin() const;
121 
123  void SetViewerMax(Real max);
125  Real GetViewerMax() const;
126 
128  void SetGamma(Real gamma);
130  Real GetGamma() const;
131 
133  void SetInvert(bool invert);
135  bool GetInvert() const;
136 
138  void SetOffset(const geom::Vec2& offset);
140  geom::Vec2 GetOffset() const;
141 
142 signals:
143  void released();
144 
145 public slots:
147  void UpdateView();
148 
149  void OnSlabChange(int slab);
150  void OnZoomChange(int zoomlevel);
151 
152  protected:
154  DataViewer(QWidget* p, const Data& data, const QString& name="");
155 
156  private:
157  // inhibit coping and assignement
158  DataViewer(const DataViewer& v);
159 
160  DataViewer& operator=(const DataViewer& v) {return *this;}
161 
162  QString name_;
163  DataViewerPanel* panel_;
164 
165  OverlayManagerPtr ov_manager_;
166  OverlayManagerGUI* ov_manager_gui_;
167 
168  InfoPanel* info_;
169  Argand* argand_;
170  FFTPanel* fft_;
171 
172  QLabel* zoomlabel_;
173  QLabel* slablabel_;
174  QPoint lastmouse_;
175 
176  void build(const Data& data);
177 
178  void build_menu();
179 };
180 
181 }}} //ns
182 
183 #endif