Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages
Public Types | Public Slots | Signals | Public Member Functions | Public Attributes | Protected Slots | Protected Member Functions | Protected Attributes | Friends | List of all members
Spectrum3DCanvas Class Reference

Canvas for 3D-visualization of peak map data. More...

#include <OpenMS/VISUAL/Spectrum3DCanvas.h>

Inheritance diagram for Spectrum3DCanvas:
SpectrumCanvas QWidget DefaultParamHandler

Public Types

enum  ShadeModes { SHADE_FLAT = 0, SHADE_SMOOTH = 1 }
 Different shade modes. More...
 
- Public Types inherited from SpectrumCanvas
enum  ActionModes { AM_TRANSLATE, AM_ZOOM, AM_MEASURE }
 Mouse action modes. More...
 
enum  IntensityModes { IM_NONE, IM_PERCENTAGE, IM_SNAP, IM_LOG }
 Display modes of intensity. More...
 
typedef LayerData::ExperimentType ExperimentType
 Main data type (experiment) More...
 
typedef LayerData::ExperimentSharedPtrType ExperimentSharedPtrType
 Main managed data type (experiment) More...
 
typedef LayerData::FeatureMapType FeatureMapType
 Main data type (features) More...
 
typedef LayerData::FeatureMapSharedPtrType FeatureMapSharedPtrType
 Main managed data type (features) More...
 
typedef LayerData::ConsensusMapType ConsensusMapType
 Main data type (consensus features) More...
 
typedef LayerData::ConsensusMapSharedPtrType ConsensusMapSharedPtrType
 Main managed data type (consensus features) More...
 
typedef ExperimentType::SpectrumType SpectrumType
 Spectrum type. More...
 
typedef SpectrumType::ConstIterator SpectrumConstIteratorType
 Spectrum iterator type (iterates over peaks) More...
 
typedef SpectrumType::PeakType PeakType
 Peak type. More...
 
typedef FeatureMapType::FeatureType FeatureType
 Feature type. More...
 
typedef DPosition< 2 > PointType
 Type of the Points. More...
 
typedef DRange< 2 > AreaType
 Types of Ranges/Areas. More...
 

Public Slots

void activateLayer (Size layer_index)
 
void removeLayer (Size layer_index)
 
virtual void updateLayer (Size i)
 
virtual void intensityModeChange_ ()
 
- Public Slots inherited from SpectrumCanvas
void changeVisibility (Size i, bool b)
 change the visibility of a layer More...
 
void changeLayerFilterState (Size i, bool b)
 change if the defined data filters are used More...
 
void showGridLines (bool show)
 Whether or not to show grid lines. More...
 
void resetZoom (bool repaint=true)
 Zooms fully out and resets the zoom stack. More...
 
void setVisibleArea (AreaType area)
 Sets the visible area. More...
 
virtual void horizontalScrollBarChange (int value)
 Notifies the canvas that the horizontal scrollbar has been moved. More...
 
virtual void verticalScrollBarChange (int value)
 Notifies the canvas that the vertical scrollbar has been moved. More...
 
void setAdditionalContextMenu (QMenu *menu)
 Sets the additional context menu. If not 0, this menu is added to the context menu of the canvas. More...
 
void getVisiblePeakData (ExperimentType &map) const
 Fills the handed over map with the visible peaks of the current layer. More...
 
void getVisibleFeatureData (FeatureMapType &map) const
 Fills the handed over map with the visible features of the current layer. More...
 
void getVisibleConsensusData (ConsensusMapType &map) const
 Fills the handed over map with the visible consensus features of the current layer. More...
 
void getVisibleIdentifications (std::vector< PeptideIdentification > &peptides) const
 Fills the handed over peptides with the visible peptide identifications of the current layer. More...
 
virtual void updateLayer (Size i)=0
 Updates layer i when the data in the corresponding file changes. More...
 

Signals

void showCurrentPeaksAs2D ()
 Requests to display all spectra in 2D plot. More...
 
- Signals inherited from SpectrumCanvas
void layerModficationChange (Size layer, bool modified)
 Signal emitted whenever the modification status of a layer changes (editing and storing) More...
 
void layerActivated (QWidget *w)
 Signal emitted whenever a new layer is activated within the current window. More...
 
void layerZoomChanged (QWidget *w)
 Signal emitted whenever the zoom changed. More...
 
void visibleAreaChanged (DRange< 2 > area)
 Change of the visible area. More...
 
void sendCursorStatus (double mz=-1.0, double rt=-1.0)
 Emitted when the cursor position changes (for displaying e.g. in status bar) More...
 
void sendStatusMessage (std::string message, OpenMS::UInt time)
 Emits a status message that should be displayed for time ms. If time is 0 the message should be displayed until the next message is emitted. More...
 
void recalculateAxes ()
 Forces recalculation of axis ticks in the connected widget. More...
 
void updateVScrollbar (float, float, float, float)
 Triggers the update of the vertical scrollbar. More...
 
void updateHScrollbar (float, float, float, float)
 Triggers the update of the horizontal scrollbar. More...
 
void changeLegendVisibility ()
 Toggle axis legend visibility change. More...
 
void actionModeChange ()
 Emitted when the action mode changes. More...
 
void preferencesChange ()
 Emitted when the layer preferences have changed. More...
 

Public Member Functions

 Spectrum3DCanvas (const Param &preferences, QWidget *parent=0)
 Constructor. More...
 
virtual ~Spectrum3DCanvas ()
 Destructor. More...
 
Spectrum3DOpenGLCanvasopenglwidget ()
 returns the Spectrum3DOpenGLcanvas More...
 
bool isLegendShown () const
 Returns if the legend is shown. More...
 
void showLegend (bool)
 Shows/hides the legend. More...
 
virtual void showCurrentLayerPreferences ()
 Shows the preferences dialog of the active layer. More...
 
virtual void saveCurrentLayer (bool visible)
 Saves the current layer data. More...
 
Reimplemented Qt events
void resizeEvent (QResizeEvent *e)
 
void contextMenuEvent (QContextMenuEvent *e)
 
- Public Member Functions inherited from SpectrumCanvas
 SpectrumCanvas (const Param &preferences, QWidget *parent=0)
 Default constructor. More...
 
virtual ~SpectrumCanvas ()
 Destructor. More...
 
void setSpectrumWidget (SpectrumWidget *widget)
 Sets the spectrum widget. More...
 
SpectrumWidgetgetSpectrumWidget () const
 Returns the spectrum widget. More...
 
Int getActionMode () const
 Returns the action mode. More...
 
IntensityModes getIntensityMode () const
 Returns the intensity mode. More...
 
void setIntensityMode (IntensityModes mod)
 Sets the intensity mode. More...
 
bool gridLinesShown () const
 Returns if the grid is currently shown. More...
 
const LayerDatagetLayer (Size index) const
 returns the layer data with index index More...
 
const LayerDatagetCurrentLayer () const
 returns the layer data of the active layer More...
 
Size getCurrentLayerIndex () const
 returns the index of the active layer More...
 
LayerDatagetCurrentLayer ()
 returns the layer data of the active layer More...
 
bool getLayerFlag (LayerData::Flags f) const
 returns a layer flag of the current layer More...
 
void setLayerFlag (LayerData::Flags f, bool value)
 sets a layer flag of the current layer More...
 
bool getLayerFlag (Size layer, LayerData::Flags f) const
 returns a layer flag of the layer layer More...
 
void setLayerFlag (Size layer, LayerData::Flags f, bool value)
 sets a layer flag of the layer layer More...
 
void setLabel (LayerData::LabelType label)
 
const AreaTypegetVisibleArea () const
 Returns the currently visible area. More...
 
virtual void setFilters (const DataFilters &filters)
 Sets the filters applied to the data before drawing (for the current layer) More...
 
bool isMzToXAxis ()
 Returns the mapping of m/z to axes. More...
 
void mzToXAxis (bool mz_to_x_axis)
 Sets the mapping of m/z to axes. More...
 
bool addLayer (std::vector< PeptideIdentification > &peptides, const String &filename="")
 Add an identification data layer. More...
 
float getCurrentMinIntensity () const
 Returns the minimum intensity of the active layer. More...
 
float getCurrentMaxIntensity () const
 Returns the maximum intensity of the active layer. More...
 
float getMinIntensity (Size index) const
 Returns the minimum intensity of the layer with index index. More...
 
float getMaxIntensity (Size index) const
 Returns the maximum intensity of the layer with index index. More...
 
void setLayerName (Size i, const String &name)
 Sets the name of layer i. More...
 
String getLayerName (Size i)
 Gets the name of layer i. More...
 
void setCurrentLayerParameters (const Param &param)
 Sets the parameters of the current layer. More...
 
const DRange< 3 > & getDataRange ()
 Returns the area which encloses all data points. More...
 
double getSnapFactor ()
 Returns the first intensity scaling factor for 'snap to maximum intensity mode'. More...
 
double getPercentageFactor ()
 Returns the percentage factor. More...
 
virtual void showMetaData (bool modifiable=false, Int index=-1)
 Shows a dialog with the meta data. More...
 
Size getLayerCount () const
 Returns the number of layers. More...
 
Size activeLayerIndex () const
 Returns the index of the active layer. More...
 
virtual void activateLayer (Size layer_index)=0
 change the active layer (the one that is used for selecting and so on) More...
 
virtual void removeLayer (Size layer_index)=0
 removes the layer with index layer_index More...
 
bool addLayer (ExperimentSharedPtrType map, const String &filename="")
 Add a peak data layer. More...
 
bool addLayer (FeatureMapSharedPtrType map, const String &filename="")
 Add a feature data layer. More...
 
bool addLayer (ConsensusMapSharedPtrType map, const String &filename="")
 Add a consensus feature data layer. More...
 
- Public Member Functions inherited from DefaultParamHandler
 DefaultParamHandler (const String &name)
 Constructor with name that is displayed in error messages. More...
 
 DefaultParamHandler (const DefaultParamHandler &rhs)
 Copy constructor. More...
 
virtual ~DefaultParamHandler ()
 Destructor. More...
 
virtual DefaultParamHandleroperator= (const DefaultParamHandler &rhs)
 Assignment operator. More...
 
virtual bool operator== (const DefaultParamHandler &rhs) const
 Equality operator. More...
 
void setParameters (const Param &param)
 Sets the parameters. More...
 
const ParamgetParameters () const
 Non-mutable access to the parameters. More...
 
const ParamgetDefaults () const
 Non-mutable access to the default parameters. More...
 
const StringgetName () const
 Non-mutable access to the name. More...
 
void setName (const String &name)
 Mutable access to the name. More...
 
const std::vector< String > & getSubsections () const
 Non-mutable access to the registered subsections. More...
 

Public Attributes

Spectrum3DOpenGLCanvasopenglcanvas_
 pointer to the SpectrumOpenGLCanvas implementation More...
 

Protected Slots

void currentLayerParamtersChanged_ ()
 Reacts on changed layer parameters. More...
 
- Protected Slots inherited from SpectrumCanvas
void updateCursor_ ()
 Updates the cursor according to the current action mode. More...
 

Protected Member Functions

bool finishAdding_ ()
 Method that is called when a new layer has been added. More...
 
virtual void update_ (const char *caller_name=0)
 Updates the displayed data. More...
 
virtual void translateLeft_ (Qt::KeyboardModifiers m)
 Translation bound to the 'Left' key. More...
 
virtual void translateRight_ (Qt::KeyboardModifiers m)
 Translation bound to the 'Right' key. More...
 
virtual void translateForward_ ()
 Translation bound to the 'Up' key. More...
 
virtual void translateBackward_ ()
 Translation bound to the 'Down' key. More...
 
- Protected Member Functions inherited from SpectrumCanvas
void drawText_ (QPainter &painter, QStringList text)
 Draws several lines of text to the upper right corner of the widget. More...
 
double getIdentificationMZ_ (const Size layer_index, const PeptideIdentification &peptide) const
 Returns the m/z value of an identification depending on the m/z source of the layer (precursor mass/theoretical peptide mass) More...
 
LayerDatagetLayer_ (Size index)
 Returns the layer with index index. More...
 
LayerDatagetCurrentLayer_ ()
 Returns the currently active layer. More...
 
ExperimentSharedPtrType currentPeakData_ ()
 Returns the currently active layer (mutable) More...
 
virtual void intensityModeChange_ ()
 This method is called whenever the intensity mode changes. Reimplement if you need to react on such changes. More...
 
virtual void changeVisibleArea_ (const AreaType &new_area, bool repaint=true, bool add_to_stack=false)
 Sets the visible area. More...
 
virtual void recalculateSnapFactor_ ()
 Recalculates the intensity scaling factor for 'snap to maximum intensity mode'. More...
 
virtual void updateScrollbars_ ()
 Updates the scroll bars. More...
 
PointType widgetToData_ (double x, double y)
 Convert widget to chart coordinates. More...
 
PointType widgetToData_ (const QPoint &pos)
 Calls widgetToData_ with x and y position of pos. More...
 
void dataToWidget_ (double x, double y, QPoint &point)
 Convert chart to widget coordinates. More...
 
virtual void paintGridLines_ (QPainter &painter)
 Helper function to paint grid lines. More...
 
void recalculateRanges_ (UInt mz_dim, UInt rt_dim, UInt it_dim)
 Recalculates the overall_data_range_. More...
 
void modificationStatus_ (Size layer_index, bool modified)
 Takes all actions necessary when the modification status of a layer changes (signals etc.) More...
 
void adjustBuffer_ ()
 Changes the size of the paint buffer to the currently required size. More...
 
void addDataProcessing_ (PeakMap &map, DataProcessing::ProcessingAction action) const
 Data processing setter for peak maps. More...
 
void resizeEvent (QResizeEvent *e)
 
void wheelEvent (QWheelEvent *e)
 
void keyPressEvent (QKeyEvent *e)
 
void keyReleaseEvent (QKeyEvent *e)
 
void focusOutEvent (QFocusEvent *e)
 
void leaveEvent (QEvent *e)
 
void enterEvent (QEvent *e)
 
virtual void zoom_ (int x, int y, bool zoom_in)
 Zooms such that screen point x, y would still point to the same data point. More...
 
void zoomBack_ ()
 Go backward in zoom history. More...
 
virtual void zoomForward_ ()
 Go forward in zoom history. More...
 
void zoomAdd_ (const AreaType &area)
 Add a visible area to the zoom stack. More...
 
void zoomClear_ ()
 Clears the zoom stack and invalidates the current zoom position. After calling this, a valid zoom position has to be added immediately. More...
 
- Protected Member Functions inherited from DefaultParamHandler
virtual void updateMembers_ ()
 This method is used to update extra member variables at the end of the setParameters() method. More...
 
void defaultsToParam_ ()
 Updates the parameters after the defaults have been set in the constructor. More...
 

Protected Attributes

bool legend_shown_
 whether the legend is shown or not More...
 
MultiGradient linear_gradient_
 stores the linear color gradient for non-log modes More...
 
- Protected Attributes inherited from SpectrumCanvas
QImage buffer_
 Buffer that stores the actual peak information. More...
 
ActionModes action_mode_
 Stores the current action mode (Pick, Zoom, Translate) More...
 
IntensityModes intensity_mode_
 Stores the used intensity mode function. More...
 
std::vector< LayerDatalayers_
 Layer data. More...
 
bool mz_to_x_axis_
 Stores the mapping of m/z. More...
 
AreaType visible_area_
 Stores the currently visible area. More...
 
DRange< 3 > overall_data_range_
 Stores the data range (m/z, RT and intensity) of all layers. More...
 
bool show_grid_
 Stores whether or not to show a grid. More...
 
std::vector< AreaTypezoom_stack_
 The zoom stack. More...
 
std::vector< AreaType >::iterator zoom_pos_
 The current position in the zoom stack. More...
 
bool update_buffer_
 Whether to recalculate the data in the buffer when repainting. More...
 
Size current_layer_
 Stores the index of the currently active layer. More...
 
SpectrumWidgetspectrum_widget_
 Back-pointer to the enclosing spectrum widget. More...
 
QPoint last_mouse_pos_
 start position of mouse actions More...
 
double percentage_factor_
 Intensity scaling factor for relative scale with multiple layers. More...
 
std::vector< doublesnap_factors_
 Intensity scaling factor for 'snap to maximum intensity mode'. More...
 
QRubberBand rubber_band_
 Rubber band for selected area. More...
 
QMenu * context_add_
 External context menu extension. More...
 
bool show_timing_
 Flag that determines if timing data is printed to the command line. More...
 
PeakIndex selected_peak_
 selected peak More...
 
PeakIndex measurement_start_
 start peak of measuring mode More...
 
- Protected Attributes inherited from DefaultParamHandler
Param param_
 Container for current parameters. More...
 
Param defaults_
 Container for default parameters. This member should be filled in the constructor of derived classes! More...
 
std::vector< Stringsubsections_
 Container for registered subsections. This member should be filled in the constructor of derived classes! More...
 
String error_name_
 Name that is displayed in error messages during the parameter checking. More...
 
bool check_defaults_
 If this member is set to false no checking if parameters in done;. More...
 
bool warn_empty_defaults_
 If this member is set to false no warning is emitted when defaults are empty;. More...
 

Friends

class Spectrum3DOpenGLCanvas
 

Detailed Description

Canvas for 3D-visualization of peak map data.

The Spectrum3DCanvas uses the helper class Spectrum3DOpenGLCanvas for the actual 3D rendering. Deriving Spectrum3DCanvas directly from QGLWidget is not possible due to the "Deadly Diamond" shape of inheritance.

Spectrum3DWidget.png
Parameters of this class are:

NameTypeDefaultRestrictionsDescription
default_path string.  Default path for loading/storing data.
background_color string@#ffffff  Background color
dot:shade_mode int1 min: 0 max: 1Shade mode: single-color ('flat') or gradient peaks ('smooth').
dot:gradient stringLinear|0,@#ffea00;6,@#ff0000;14,@#aa00ff;23,@#5500ff;100,@#000000  Peak color gradient.
dot:interpolation_steps int1000 min: 1 max: 1000Interpolation steps for peak color gradient precalculation.
dot:line_width int2 min: 1 max: 99Line width for peaks.

Note:

Member Enumeration Documentation

◆ ShadeModes

enum ShadeModes

Different shade modes.

Enumerator
SHADE_FLAT 
SHADE_SMOOTH 

Constructor & Destructor Documentation

◆ Spectrum3DCanvas()

Spectrum3DCanvas ( const Param preferences,
QWidget parent = 0 
)

Constructor.

◆ ~Spectrum3DCanvas()

virtual ~Spectrum3DCanvas ( )
virtual

Destructor.

Member Function Documentation

◆ activateLayer

void activateLayer ( Size  layer_index)
slot

◆ contextMenuEvent()

void contextMenuEvent ( QContextMenuEvent *  e)

◆ currentLayerParamtersChanged_

void currentLayerParamtersChanged_ ( )
protectedslot

Reacts on changed layer parameters.

◆ finishAdding_()

bool finishAdding_ ( )
protectedvirtual

Method that is called when a new layer has been added.

Implements SpectrumCanvas.

◆ intensityModeChange_

virtual void intensityModeChange_ ( )
virtualslot

◆ isLegendShown()

bool isLegendShown ( ) const

Returns if the legend is shown.

◆ openglwidget()

Spectrum3DOpenGLCanvas* openglwidget ( )

returns the Spectrum3DOpenGLcanvas

◆ removeLayer

void removeLayer ( Size  layer_index)
slot

◆ resizeEvent()

void resizeEvent ( QResizeEvent *  e)

◆ saveCurrentLayer()

virtual void saveCurrentLayer ( bool  visible)
virtual

Saves the current layer data.

Parameters
visibleIf true, only the visible data is stored. Otherwise the whole data is stored.

Implements SpectrumCanvas.

◆ showCurrentLayerPreferences()

virtual void showCurrentLayerPreferences ( )
virtual

Shows the preferences dialog of the active layer.

Implements SpectrumCanvas.

◆ showCurrentPeaksAs2D

void showCurrentPeaksAs2D ( )
signal

Requests to display all spectra in 2D plot.

◆ showLegend()

void showLegend ( bool  )

Shows/hides the legend.

◆ translateBackward_()

virtual void translateBackward_ ( )
protectedvirtual

Translation bound to the 'Down' key.

Reimplemented from SpectrumCanvas.

◆ translateForward_()

virtual void translateForward_ ( )
protectedvirtual

Translation bound to the 'Up' key.

Reimplemented from SpectrumCanvas.

◆ translateLeft_()

virtual void translateLeft_ ( Qt::KeyboardModifiers  m)
protectedvirtual

Translation bound to the 'Left' key.

Reimplemented from SpectrumCanvas.

◆ translateRight_()

virtual void translateRight_ ( Qt::KeyboardModifiers  m)
protectedvirtual

Translation bound to the 'Right' key.

Reimplemented from SpectrumCanvas.

◆ update_()

virtual void update_ ( const char *  caller_name = 0)
protectedvirtual

Updates the displayed data.

The default implementation calls QWidget::update().

This method is reimplemented in the 3D view to update the OpenGL widget.

Parameters
caller_nameName of the calling function (use OPENMS_PRETTY_FUNCTION).

Reimplemented from SpectrumCanvas.

◆ updateLayer

virtual void updateLayer ( Size  i)
virtualslot

Friends And Related Function Documentation

◆ Spectrum3DOpenGLCanvas

friend class Spectrum3DOpenGLCanvas
friend

Member Data Documentation

◆ legend_shown_

bool legend_shown_
protected

whether the legend is shown or not

◆ linear_gradient_

MultiGradient linear_gradient_
protected

stores the linear color gradient for non-log modes

◆ openglcanvas_

Spectrum3DOpenGLCanvas* openglcanvas_

pointer to the SpectrumOpenGLCanvas implementation


OpenMS / TOPP release 2.3.0 Documentation generated on Tue Jan 9 2018 18:22:13 using doxygen 1.8.13