CFEL - ASG Software Suite  2.5.0
CASS
Public Member Functions | Private Slots | Private Member Functions | Private Attributes | List of all members
jocassview::TwoDViewer Class Reference

a viewer that displays 2d data More...

#include <two_d_viewer.h>

+ Inheritance diagram for jocassview::TwoDViewer:
+ Collaboration diagram for jocassview::TwoDViewer:

Public Member Functions

 TwoDViewer (QString title, QWidget *parent=0)
 constructor More...
 
virtual ~TwoDViewer ()
 destructor More...
 
virtual QList< Data * > data ()
 set the data to display More...
 
virtual QString type () const
 retrieve the type of the data viewer More...
 
virtual void saveData (const QString &filename)
 save the data to file More...
 
virtual void dataChanged ()
 update the plot More...
 
virtual QStringList dataFileSuffixes () const
 suffixes for the data of this viewer More...
 
- Public Member Functions inherited from jocassview::DataViewer
 DataViewer (QString title, QWidget *parent)
 constructor More...
 
virtual ~DataViewer ()
 destructor More...
 
virtual void print () const
 print the plot More...
 
- Public Member Functions inherited from QMainWindow
 TabShape
 
 ToolButtonStyle
 
 QMainWindow (QWidget *parent=0, Qt::WindowFlags flags=0)
 
 addDockWidget (Qt::DockWidgetArea area, QDockWidget *dockwidget)
 
 addDockWidget (Qt::DockWidgetArea area, QDockWidget *dockwidget, Qt::Orientation orientation)
 
 addToolBar (Qt::ToolBarArea area, QToolBar *toolbar)
 
 addToolBar (QToolBar *toolbar)
 
 addToolBar (const QString &title)
 
 addToolBarBreak (Qt::ToolBarArea area=Qt::TopToolBarArea)
 
 centralWidget ()
 
 contextMenuEvent (QContextMenuEvent *event)
 
 DockWidgetArea QMainWindow::corner(Qt::Corner corner)
 
 createPopupMenu ()
 
 DockWidgetArea QMainWindow::dockWidgetArea(QDockWidget *dockwidget)
 
 event (QEvent *event)
 
 iconSizeChanged (const QSize &iconSize)
 
 insertToolBar (QToolBar *before, QToolBar *toolbar)
 
 insertToolBarBreak (QToolBar *before)
 
 menuBar ()
 
 menuWidget ()
 
 removeDockWidget (QDockWidget *dockwidget)
 
 removeToolBar (QToolBar *toolbar)
 
 removeToolBarBreak (QToolBar *before)
 
 restoreDockWidget (QDockWidget *dockwidget)
 
 restoreState (const QByteArray &state, int version=0)
 
 saveState (int version=0)
 
 setCentralWidget (QWidget *widget)
 
 setCorner (Qt::Corner corner, Qt::DockWidgetArea area)
 
 setMenuBar (QMenuBar *menuBar)
 
 setMenuWidget (QWidget *menuBar)
 
 setStatusBar (QStatusBar *statusbar)
 
 setTabPosition (Qt::DockWidgetAreas areas, QTabWidget::TabPosition tabPosition)
 
 splitDockWidget (QDockWidget *first, QDockWidget *second, Qt::Orientation orientation)
 
 statusBar ()
 
 TabPosition QMainWindow::tabPosition(Qt::DockWidgetArea area)
 
 tabifiedDockWidgets (QDockWidget *dockwidget)
 
 tabifyDockWidget (QDockWidget *first, QDockWidget *second)
 
 ToolBarArea QMainWindow::toolBarArea(QToolBar *toolbar)
 
 toolBarBreak (QToolBar *toolbar)
 
 toolButtonStyleChanged (Qt::ToolButtonStyle toolButtonStyle)
 
 data ()
 
 iterator_category
 
 const_iterator ()
 
 const_iterator (const iterator &other)
 
 key ()
 
 value ()
 
 operator!= (const const_iterator &other)
 
 operator* ()
 
 operator+ (int j)
 
 operator++ ()
 
 operator++ (int)
 
 operator+= (int j)
 
 operator- (int j)
 
 operator-- ()
 
 operator-- (int)
 
 operator-= (int j)
 
 operator-& gt;()
 
 operator== (const const_iterator &other)
 
 data ()
 
 iterator_category
 
 iterator ()
 
 key ()
 
 value ()
 
 operator!= (const iterator &other)
 
 operator!= (const const_iterator &other)
 
 operator* ()
 
 operator+ (int j)
 
 operator++ ()
 
 operator++ (int)
 
 operator+= (int j)
 
 operator- (int j)
 
 operator-- ()
 
 operator-- (int)
 
 operator-= (int j)
 
 operator-& gt;()
 
 operator== (const iterator &other)
 
 operator== (const const_iterator &other)
 
 erase (const Key &key)
 
 insert (const Key &key, const T &value, bool overwrite)
 
 remove (iterator it)
 
 replace (const Key &key, const T &value)
 

Private Slots

void replot ()
 replot the data More...
 
void on_load_geomfile_triggered ()
 load the geom file More...
 

Private Member Functions

QwtLinearColorMap * cmap (const int mapId, bool log) const
 retrieve a color id More...
 
QStringList cmaps () const
 return the list of possible colormaps More...
 

Private Attributes

QwtPlotSpectrogram * _spectrogram
 the spectrogram that is used to display the 2d data More...
 
MinMaxControl_zControl
 the z-scale control More...
 
QSpinBox_colorId
 the colorbar control More...
 
QAction_axisTitleControl
 an action to control the legend of curves More...
 
TrackZoomer2D_zoomer
 a zoomer for the 2d view More...
 
QString _geomFile
 the geom file to convert data to lab frame More...
 
bool _lutPresent
 the geom file to convert data to lab frame More...
 
cass::GeometryInfo::lookupTable_t _lut
 the geom file to convert data to lab frame More...
 
cass::Result< float >::shared_pointer _origHist
 the original histogram More...
 
bool _isOriginalData
 flag to tell whether the data is the original data More...
 

Additional Inherited Members

- Signals inherited from jocassview::DataViewer
void viewerClosed (DataViewer *viewer)
 signal emitted when viewer is about to be destroyed More...
 
- Protected Member Functions inherited from jocassview::DataViewer
void closeEvent (QCloseEvent *event)
 react when a close event is send to this viewer More...
 
void moveEvent (QMoveEvent *event)
 receive move events to store the current position to the settings More...
 
void resizeEvent (QResizeEvent *event)
 receive resize events to store the current size to the settings More...
 
- Protected Attributes inherited from jocassview::DataViewer
QwtPlot * _plot
 the plot inside which the data will be displayed More...
 

Detailed Description

a viewer that displays 2d data

Author
Stephan Kassemeyer
Lutz Foucar

Definition at line 35 of file two_d_viewer.h.

Constructor & Destructor Documentation

TwoDViewer::TwoDViewer ( QString  title,
QWidget parent = 0 
)
TwoDViewer::~TwoDViewer ( )
virtual

destructor

Definition at line 133 of file two_d_viewer.cpp.

Member Function Documentation

QwtLinearColorMap * TwoDViewer::cmap ( const int  mapId,
bool  log 
) const
private

retrieve a color id

the colormap needs be created on the heap and a pointer is then passed to the functions who will take over ownership and destroy the allocated space.

In case the mapId is unknown a standart black & white map is returned

Returns
pointer to the requested colormap
Parameters
mapIdthe key of the requested color id
logif true a log scale color map will be returned

Definition at line 361 of file two_d_viewer.cpp.

References map.

Referenced by replot().

QStringList TwoDViewer::cmaps ( ) const
private

return the list of possible colormaps

Returns
list with possible colormap ids

Definition at line 508 of file two_d_viewer.cpp.

QList< Data * > TwoDViewer::data ( )
virtual

set the data to display

Returns
list of data that is viewed by this viewer

Implements jocassview::DataViewer.

Definition at line 138 of file two_d_viewer.cpp.

References _spectrogram, and QList::append().

Referenced by dataChanged(), replot(), saveData(), and TwoDViewer().

void TwoDViewer::dataChanged ( )
virtual

update the plot

check if the zoomer is still valid and replot the plot

check if the data has really been updated, when it should original data

if the data is original, save the original histogram

reset flag

check if the user wants to convert cheetah layout to lab frame

create lookup table from the geom file if its not created yet

  check if the data is different (the bounding box changed) in which case we
  reinitialize the zoomer
  @note the below will be done when zooming into the initial bounding rect
_plot->setAxisScale(QwtPlot::yLeft,_data->boundingRect().top(),_data->boundingRect().bottom());
_plot->setAxisScale(QwtPlot::xBottom,_data->boundingRect().left(),_data->boundingRect().right());

Reimplemented from jocassview::DataViewer.

Definition at line 174 of file two_d_viewer.cpp.

References _geomFile, _isOriginalData, _lut, _lutPresent, _origHist, _spectrogram, _zoomer, cass::Result< T >::begin(), cass::Result< T >::clone(), data(), cass::Result< T >::end(), front, cass::GeometryInfo::generateLookupTable(), QString::isEmpty(), cass::GeometryInfo::lookupTable_t::lut, cass::GeometryInfo::lookupTable_t::max, cass::GeometryInfo::lookupTable_t::min, cass::Result< T >::name(), cass::GeometryInfo::lookupTable_t::nCols, cass::GeometryInfo::lookupTable_t::nRows, replot(), cass::Result< T >::shape(), cass::Result< T >::size(), cass::GeometryInfo::pos_t::x, and cass::GeometryInfo::pos_t::y.

Referenced by on_load_geomfile_triggered().

QStringList TwoDViewer::dataFileSuffixes ( ) const
virtual

suffixes for the data of this viewer

Returns
suffixes for the data of this viewer

Implements jocassview::DataViewer.

Definition at line 238 of file two_d_viewer.cpp.

void TwoDViewer::on_load_geomfile_triggered ( )
privateslot
void TwoDViewer::replot ( )
privateslot

replot the data

Note
we need to new the color bar for both the axis widget and the spectrogram as they take over possesion of the colorbar and delete them when they think appropriate.

get the data from the spectrogram and get the min and max z-values to be displayed

get the colormap to be used

set the colormap and min / max z-value

display the axis titles if requested

replot the plot

save the current settings

Definition at line 245 of file two_d_viewer.cpp.

References _axisTitleControl, _colorId, jocassview::DataViewer::_plot, _spectrogram, _zControl, jocassview::MinMaxControl::autoscale(), QSettings::beginGroup(), cmap(), data(), QSettings::endGroup(), QString::fromStdString(), jocassview::MinMaxControl::log(), jocassview::MinMaxControl::max(), jocassview::MinMaxControl::min(), jocassview::TwoDViewerData::origZInterval(), jocassview::TwoDViewerData::result(), and QSettings::setValue().

Referenced by dataChanged(), and TwoDViewer().

void TwoDViewer::saveData ( const QString filename)
virtual

save the data to file

Parameters
filenamethe file name to save the data to

print a png of the whole widget if requested and the file doesn't exist

let the file handler handle the other formats

Implements jocassview::DataViewer.

Definition at line 150 of file two_d_viewer.cpp.

References data(), QFileInfo::exists(), front, QPixmap::save(), jocassview::FileHandler::saveData(), QFileInfo::suffix(), and QString::toUpper().

QString TwoDViewer::type ( ) const
virtual

retrieve the type of the data viewer

Returns
the type as name

Implements jocassview::DataViewer.

Definition at line 145 of file two_d_viewer.cpp.

Member Data Documentation

QAction* jocassview::TwoDViewer::_axisTitleControl
private

an action to control the legend of curves

Definition at line 118 of file two_d_viewer.h.

Referenced by replot(), and TwoDViewer().

QSpinBox* jocassview::TwoDViewer::_colorId
private

the colorbar control

Definition at line 115 of file two_d_viewer.h.

Referenced by replot(), and TwoDViewer().

QString jocassview::TwoDViewer::_geomFile
private

the geom file to convert data to lab frame

Definition at line 124 of file two_d_viewer.h.

Referenced by dataChanged(), on_load_geomfile_triggered(), and TwoDViewer().

bool jocassview::TwoDViewer::_isOriginalData
private

flag to tell whether the data is the original data

Definition at line 136 of file two_d_viewer.h.

Referenced by dataChanged(), on_load_geomfile_triggered(), and TwoDViewer().

cass::GeometryInfo::lookupTable_t jocassview::TwoDViewer::_lut
private

the geom file to convert data to lab frame

Definition at line 130 of file two_d_viewer.h.

Referenced by dataChanged().

bool jocassview::TwoDViewer::_lutPresent
private

the geom file to convert data to lab frame

Definition at line 127 of file two_d_viewer.h.

Referenced by dataChanged(), on_load_geomfile_triggered(), and TwoDViewer().

cass::Result<float>::shared_pointer jocassview::TwoDViewer::_origHist
private

the original histogram

Definition at line 133 of file two_d_viewer.h.

Referenced by dataChanged().

QwtPlotSpectrogram* jocassview::TwoDViewer::_spectrogram
private

the spectrogram that is used to display the 2d data

Definition at line 109 of file two_d_viewer.h.

Referenced by data(), dataChanged(), replot(), and TwoDViewer().

MinMaxControl* jocassview::TwoDViewer::_zControl
private

the z-scale control

Definition at line 112 of file two_d_viewer.h.

Referenced by replot(), and TwoDViewer().

TrackZoomer2D* jocassview::TwoDViewer::_zoomer
private

a zoomer for the 2d view

Definition at line 121 of file two_d_viewer.h.

Referenced by dataChanged(), on_load_geomfile_triggered(), and TwoDViewer().


The documentation for this class was generated from the following files: