CFEL - ASG Software Suite  2.5.0
CASS
two_d_viewer.h
Go to the documentation of this file.
1 // Copyright (C) 2013 Lutz Foucar
2 
3 /**
4  * @file two_d_viewer.h contains the viewer for 2d data
5  *
6  * @author Lutz Foucar
7  */
8 
9 #ifndef _TWODVIEWER_
10 #define _TWODVIEWER_
11 
12 #include <QtCore/QMap>
13 
14 #include "data_viewer.h"
15 #include "result.hpp"
16 #include "geom_parser.h"
17 
18 class QwtPlot;
19 class QwtLinearColorMap;
20 class QwtPlotSpectrogram;
21 class QSpinBox;
22 class QStringList;
23 
24 
25 namespace jocassview
26 {
27 class MinMaxControl;
28 class TrackZoomer2D;
29 
30 /** a viewer that displays 2d data
31  *
32  * @author Stephan Kassemeyer
33  * @author Lutz Foucar
34  */
35 class TwoDViewer : public DataViewer
36 {
37  Q_OBJECT
38 
39 public:
40  /** constructor
41  *
42  * @param title the title of this viewer
43  * @param parent The parent of this
44  */
45  TwoDViewer(QString title, QWidget *parent=0);
46 
47  /** destructor */
48  virtual ~TwoDViewer();
49 
50  /** set the data to display
51  *
52  * @return list of data that is viewed by this viewer
53  */
54  virtual QList<Data*> data();
55 
56  /** retrieve the type of the data viewer
57  *
58  * @return the type as name
59  */
60  virtual QString type() const;
61 
62  /** save the data to file
63  *
64  * @param filename the file name to save the data to
65  */
66  virtual void saveData(const QString &filename);
67 
68  /** update the plot
69  *
70  * check if the zoomer is still valid and replot the plot
71  */
72  virtual void dataChanged();
73 
74  /** suffixes for the data of this viewer
75  *
76  * @return suffixes for the data of this viewer
77  */
78  virtual QStringList dataFileSuffixes() const;
79 
80 private slots:
81  /** replot the data */
82  void replot();
83 
84  /** load the geom file */
86 
87 private:
88  /** retrieve a color id
89  *
90  * the colormap needs be created on the heap and a pointer is then passed to
91  * the functions who will take over ownership and destroy the allocated space.
92  *
93  * In case the mapId is unknown a standart black & white map is returned
94  *
95  * @return pointer to the requested colormap
96  * @param mapId the key of the requested color id
97  * @param log if true a log scale color map will be returned
98  */
99  QwtLinearColorMap* cmap(const int mapId, bool log) const;
100 
101  /** return the list of possible colormaps
102  *
103  * @return list with possible colormap ids
104  */
105  QStringList cmaps()const;
106 
107 private:
108  /** the spectrogram that is used to display the 2d data */
109  QwtPlotSpectrogram * _spectrogram;
110 
111  /** the z-scale control */
113 
114  /** the colorbar control */
116 
117  /** an action to control the legend of curves */
119 
120  /** a zoomer for the 2d view */
122 
123  /** the geom file to convert data to lab frame */
125 
126  /** the geom file to convert data to lab frame */
128 
129  /** the geom file to convert data to lab frame */
131 
132  /** the original histogram */
134 
135  /** flag to tell whether the data is the original data */
137 };
138 }//end namespace jocassview
139 
140 #endif
TrackZoomer2D * _zoomer
a zoomer for the 2d view
Definition: two_d_viewer.h:121
QwtPlotSpectrogram * _spectrogram
the spectrogram that is used to display the 2d data
Definition: two_d_viewer.h:109
base class for viewers
Definition: data_viewer.h:37
virtual void dataChanged()
update the plot
contains the base class for all data viewers
std::tr1::shared_ptr< self_type > shared_pointer
a shared pointer of this class
Definition: result.hpp:323
QString _geomFile
the geom file to convert data to lab frame
Definition: two_d_viewer.h:124
virtual QString type() const
retrieve the type of the data viewer
virtual QList< Data * > data()
set the data to display
void replot()
replot the data
result classes
widget to control the min and max values
virtual void saveData(const QString &filename)
save the data to file
MinMaxControl * _zControl
the z-scale control
Definition: two_d_viewer.h:112
virtual ~TwoDViewer()
destructor
void on_load_geomfile_triggered()
load the geom file
cass::GeometryInfo::lookupTable_t _lut
the geom file to convert data to lab frame
Definition: two_d_viewer.h:130
QwtLinearColorMap * cmap(const int mapId, bool log) const
retrieve a color id
TwoDViewer(QString title, QWidget *parent=0)
constructor
cass::Result< float >::shared_pointer _origHist
the original histogram
Definition: two_d_viewer.h:133
class to parse and retrieve info from geom files.
bool _isOriginalData
flag to tell whether the data is the original data
Definition: two_d_viewer.h:136
QSpinBox * _colorId
the colorbar control
Definition: two_d_viewer.h:115
a viewer that displays 2d data
Definition: two_d_viewer.h:35
combine info needed for the lookuptable
Definition: geom_parser.h:32
QAction * _axisTitleControl
an action to control the legend of curves
Definition: two_d_viewer.h:118
QStringList cmaps() const
return the list of possible colormaps
class that allows to zoom in a 2d view with tracking information
bool _lutPresent
the geom file to convert data to lab frame
Definition: two_d_viewer.h:127
virtual QStringList dataFileSuffixes() const
suffixes for the data of this viewer