36 #ifndef OPENMS_VISUAL_SPECTRUMCANVAS_H 
   37 #define OPENMS_VISUAL_SPECTRUMCANVAS_H 
   47 #include <QtGui/QWidget> 
   48 #include <QtGui/QRubberBand> 
  166       spectrum_widget_ = widget;
 
  177       return spectrum_widget_;
 
  200       return intensity_mode_;
 
  214       intensity_mode_ = mod;
 
  215       intensityModeChange_();
 
  231       OPENMS_PRECONDITION(index < layers_.size(), 
"SpectrumCanvas::getLayer(index) index overflow");
 
  232       return layers_[index];
 
  238       OPENMS_PRECONDITION(current_layer_ < layers_.size(), 
"SpectrumCanvas::getCurrentLayer() index overflow");
 
  239       return layers_[current_layer_];
 
  245       return current_layer_;
 
  251       OPENMS_PRECONDITION(current_layer_ < layers_.size(), 
"SpectrumCanvas::getCurrentLayer() index overflow");
 
  252       return layers_[current_layer_];
 
  258       return getLayerFlag(current_layer_, f);
 
  264       setLayerFlag(current_layer_, f, value);
 
  270       OPENMS_PRECONDITION(layer < layers_.size(), 
"SpectrumCanvas::getLayerFlag() index overflow");
 
  271       return layers_[layer].flags.test(f);
 
  278       if (layers_.empty()) 
return;
 
  280       OPENMS_PRECONDITION(layer < layers_.size(), 
"SpectrumCanvas::setLayerFlag() index overflow");
 
  282       layers_[layer].flags.set(f, value);
 
  283       update_buffer_ = 
true;
 
  290       if (layers_.empty()) 
return;
 
  292       OPENMS_PRECONDITION(current_layer_ < layers_.size(), 
"SpectrumCanvas::setLabel() index overflow");
 
  293       layers_[current_layer_].label = label;
 
  295       update_buffer_ = 
true;
 
  306       return visible_area_;
 
  312     virtual void setFilters(
const DataFilters & filters);
 
  317       return mz_to_x_axis_;
 
  321     void mzToXAxis(
bool mz_to_x_axis);
 
  329     inline Size getLayerCount()
 const 
  332       return layers_.size();
 
  336     Size activeLayerIndex() 
const;
 
  338     virtual void activateLayer(
Size layer_index) = 0;
 
  340     virtual void removeLayer(
Size layer_index) = 0;
 
  351     bool addLayer(ExperimentSharedPtrType map, 
const String & filename = 
"");
 
  361     bool addLayer(FeatureMapSharedPtrType map, 
const String & filename = 
"");
 
  371     bool addLayer(ConsensusMapSharedPtrType map, 
const String & filename = 
"");
 
  382     bool addLayer(std::vector<PeptideIdentification> & peptides,
 
  383                   const String & filename = 
"");
 
  390         return getCurrentLayer().getPeakData()->getMinInt();
 
  394         return getCurrentLayer().getFeatureMap()->getMinInt();
 
  398         return getCurrentLayer().getConsensusMap()->getMinInt();
 
  407         return getCurrentLayer().getPeakData()->getMaxInt();
 
  411         return getCurrentLayer().getFeatureMap()->getMaxInt();
 
  415         return getCurrentLayer().getConsensusMap()->getMaxInt();
 
  424         return getLayer(index).getPeakData()->getMinInt();
 
  428         return getLayer(index).getFeatureMap()->getMinInt();
 
  432         return getLayer(index).getConsensusMap()->getMinInt();
 
  441         return getLayer(index).getPeakData()->getMaxInt();
 
  445         return getLayer(index).getFeatureMap()->getMaxInt();
 
  449         return getLayer(index).getConsensusMap()->getMaxInt();
 
  454     void setLayerName(
Size i, 
const String & name);
 
  462       getCurrentLayer_().param = param;
 
  463       emit preferencesChange();
 
  484     virtual void showCurrentLayerPreferences() = 0;
 
  492     virtual void showMetaData(
bool modifiable = 
false, 
Int index = -1);
 
  499     virtual void saveCurrentLayer(
bool visible) = 0;
 
  509     void changeVisibility(
Size i, 
bool b);
 
  517     void changeLayerFilterState(
Size i, 
bool b);
 
  525     void showGridLines(
bool show);
 
  534     void resetZoom(
bool repaint = 
true);
 
  542     void setVisibleArea(AreaType area);
 
  549     virtual void horizontalScrollBarChange(
int value);
 
  556     virtual void verticalScrollBarChange(
int value);
 
  559     void setAdditionalContextMenu(QMenu * menu);
 
  568     void getVisiblePeakData(ExperimentType & map) 
const;
 
  578     void getVisibleFeatureData(FeatureMapType & map) 
const;
 
  587     void getVisibleConsensusData(ConsensusMapType & map) 
const;
 
  596     void getVisibleIdentifications(std::vector<PeptideIdentification> & peptides) 
const;
 
  599     virtual void updateLayer(
Size i) = 0;
 
  604     void layerModficationChange(
Size layer, 
bool modified);
 
  607     void layerActivated(
QWidget * w);
 
  610     void layerZoomChanged(
QWidget * w);
 
  621     void sendCursorStatus(
double mz = -1.0, 
double rt = -1.0);
 
  624     void sendStatusMessage(std::string message, 
OpenMS::UInt time);
 
  627     void recalculateAxes();
 
  630     void updateVScrollbar(
float, 
float, 
float, 
float);
 
  633     void updateHScrollbar(
float, 
float, 
float, 
float);
 
  636     void changeLegendVisibility();
 
  639     void actionModeChange();
 
  642     void preferencesChange();
 
  647     void updateCursor_();
 
  652     void drawText_(QPainter & painter, QStringList text);
 
  659     virtual bool finishAdding_() = 0;
 
  664       OPENMS_PRECONDITION(index < layers_.size(), 
"SpectrumCanvas::getLayer_(index) index overflow");
 
  665       return layers_[index];
 
  671       return getLayer_(current_layer_);
 
  677       return getCurrentLayer_().getPeakData();
 
  682     void resizeEvent(QResizeEvent * e);
 
  683     void wheelEvent(QWheelEvent * e);
 
  684     void keyPressEvent(QKeyEvent * e);
 
  685     void keyReleaseEvent(QKeyEvent * e);
 
  686     void focusOutEvent(QFocusEvent * e);
 
  687     void leaveEvent(QEvent * e);
 
  688     void enterEvent(QEvent * e);
 
  692     virtual void intensityModeChange_();
 
  704     virtual void changeVisibleArea_(
const AreaType & new_area, 
bool repaint = 
true, 
bool add_to_stack = 
false);
 
  711     virtual void recalculateSnapFactor_();
 
  715     virtual void zoom_(
int x, 
int y, 
bool zoom_in);
 
  720     virtual void zoomForward_();
 
  722     void zoomAdd_(
const AreaType & area);
 
  729     virtual void translateLeft_();
 
  732     virtual void translateRight_();
 
  734     virtual void translateForward_();
 
  736     virtual void translateBackward_();
 
  744     virtual void updateScrollbars_();
 
  760                  visible_area_.minX() + (height() - y) / height()  * visible_area_.width(),
 
  761                  visible_area_.minY() + x  / width() * visible_area_.height()
 
  767                  visible_area_.minX() + x / width() * visible_area_.width(),
 
  768                  visible_area_.minY() + (height() - y) / height() * visible_area_.height()
 
  776       return widgetToData_(pos.x(), pos.y());
 
  795           point.setX(
int((y - visible_area_.minY()) / visible_area_.height() * width()));
 
  800                        std::log10((y - visible_area_.minY()) + 1) / std::log10(visible_area_.height() + 1) * width())
 
  804         point.setY(height() - 
int((x - visible_area_.minX()) / visible_area_.width() * height()));
 
  808         point.setX(
int((x - visible_area_.minX()) / visible_area_.width() * width()));
 
  812           point.setY(height() - 
int((y - visible_area_.minY()) / visible_area_.height() * height()));
 
  816           point.setY(height() - 
int(
 
  817                        std::log10((y - visible_area_.minY()) + 1) / std::log10(visible_area_.height() + 1) * height()
 
  824     virtual void paintGridLines_(QPainter & painter);
 
  858     void recalculateRanges_(
UInt mz_dim, 
UInt rt_dim, 
UInt it_dim);
 
  886     virtual void update_(
const char * caller_name);
 
  889     void modificationStatus_(
Size layer_index, 
bool modified);
 
  898     void adjustBuffer_();
 
  935     template <
typename PeakType>
 
  938       std::set<DataProcessing::ProcessingAction> actions;
 
  939       actions.insert(action);
 
  951       for (
Size i = 0; i < map.
size(); ++i)
 
  953         map[i].getDataProcessing().push_back(p);
 
Flags
Flags that determine which information is shown. 
Definition: LayerData.h:75
Descripton of the applied preprocessing steps. 
Definition: DataProcessing.h:51
bool show_grid_
Stores whether or not to show a grid. 
Definition: SpectrumCanvas.h:870
bool update_buffer_
Whether to recalculate the data in the buffer when repainting. 
Definition: SpectrumCanvas.h:892
LayerData::ExperimentSharedPtrType ExperimentSharedPtrType
Main managed data type (experiment) 
Definition: SpectrumCanvas.h:107
LayerData::FeatureMapType FeatureMapType
Main data type (features) 
Definition: SpectrumCanvas.h:109
std::vector< DoubleReal > snap_factors_
Intensity scaling factor for 'snap to maximum intensity mode'. 
Definition: SpectrumCanvas.h:918
Real getMaxIntensity(Size index) const 
Returns the maximum intensity of the layer with index index. 
Definition: SpectrumCanvas.h:437
std::vector< AreaType >::iterator zoom_pos_
The current position in the zoom stack. 
Definition: SpectrumCanvas.h:875
float Real
Real type. 
Definition: Types.h:109
Real getCurrentMaxIntensity() const 
Returns the maximum intensity of the active layer. 
Definition: SpectrumCanvas.h:403
SpectrumType::ConstIterator SpectrumConstIteratorType
Spectrum iterator type (iterates over peaks) 
Definition: SpectrumCanvas.h:120
A more convenient string class. 
Definition: String.h:56
bool getLayerFlag(Size layer, LayerData::Flags f) const 
returns a layer flag of the layer layer 
Definition: SpectrumCanvas.h:268
DPosition< 2 > PointType
Type of the Points. 
Definition: SpectrumCanvas.h:127
Shows intensities normalized by layer maximum: f(x)=x/max(x)*100. 
Definition: SpectrumCanvas.h:144
Size size() const 
Definition: MSExperiment.h:117
bool show_timing_
Flag that determines if timimg data is printed to the command line. 
Definition: SpectrumCanvas.h:927
const LayerData & getLayer(Size index) const 
returns the layer data with index index 
Definition: SpectrumCanvas.h:229
std::vector< LayerData > layers_
Layer data. 
Definition: SpectrumCanvas.h:836
PointType widgetToData_(const QPoint &pos)
Calls widgetToData_ with x and y position of pos. 
Definition: SpectrumCanvas.h:774
LayerData & getLayer_(Size index)
Returns the layer with index index. 
Definition: SpectrumCanvas.h:662
LayerData::ConsensusMapType ConsensusMapType
Main data type (consensus features) 
Definition: SpectrumCanvas.h:113
QImage buffer_
Buffer that stores the actual peak information. 
Definition: SpectrumCanvas.h:827
A container for features. 
Definition: FeatureMap.h:111
#define OPENMS_PRECONDITION(condition, message)
Precondition macro. 
Definition: Macros.h:107
DRange< 3 > overall_data_range_
Stores the data range (m/z, RT and intensity) of all layers. 
Definition: SpectrumCanvas.h:867
ActionModes
Mouse action modes. 
Definition: SpectrumCanvas.h:133
LayerData::ConsensusMapSharedPtrType ConsensusMapSharedPtrType
Main managed data type (consensus features) 
Definition: SpectrumCanvas.h:115
ContainerType::const_iterator ConstIterator
Non-mutable iterator. 
Definition: MSSpectrum.h:125
bool mz_to_x_axis_
Stores the mapping of m/z. 
Definition: SpectrumCanvas.h:839
Base class for visualization canvas classes. 
Definition: SpectrumCanvas.h:94
void setProcessingActions(const std::set< ProcessingAction > &actions)
sets the description of the applied processing 
A container for consensus elements. 
Definition: ConsensusMap.h:60
Int getIntensityMode() const 
Returns the intensity mode. 
Definition: SpectrumCanvas.h:198
Real getMinIntensity(Size index) const 
Returns the minimum intensity of the layer with index index. 
Definition: SpectrumCanvas.h:420
Size getCurrentLayerIndex() const 
returns the index of the active layer 
Definition: SpectrumCanvas.h:243
void setLabel(LayerData::LabelType label)
Definition: SpectrumCanvas.h:287
zoom 
Definition: SpectrumCanvas.h:136
PointType widgetToData_(DoubleReal x, DoubleReal y)
Convert widget to chart coordinates. 
Definition: SpectrumCanvas.h:755
SpectrumType::PeakType PeakType
Peak type. 
Definition: SpectrumCanvas.h:122
void setSpectrumWidget(SpectrumWidget *widget)
Sets the spectrum widget. 
Definition: SpectrumCanvas.h:164
boost::shared_ptr< ExperimentType > ExperimentSharedPtrType
SharedPtr on MSExperiment. 
Definition: LayerData.h:120
Chromatogram data. 
Definition: LayerData.h:69
PeakIndex selected_peak_
selected peak 
Definition: SpectrumCanvas.h:930
void setLayerFlag(LayerData::Flags f, bool value)
sets a layer flag of the current layer 
Definition: SpectrumCanvas.h:262
Shows the maximum displayed intensity as if it was the overall maximum intensity. ...
Definition: SpectrumCanvas.h:145
Size current_layer_
Stores the index of the currently active layer. 
Definition: SpectrumCanvas.h:895
void setCompletionTime(const DateTime &completion_time)
sets the time of completition taking a DateTime object 
ExperimentSharedPtrType currentPeakData_()
Returns the currently active layer (mutable) 
Definition: SpectrumCanvas.h:675
const AreaType & getVisibleArea() const 
Returns the currently visible area. 
Definition: SpectrumCanvas.h:304
LayerData & getCurrentLayer_()
Returns the currently active layer. 
Definition: SpectrumCanvas.h:669
PeakIndex measurement_start_
start peak of measuring mode 
Definition: SpectrumCanvas.h:932
Feature data. 
Definition: LayerData.h:67
bool gridLinesShown() const 
Returns if the grid is currently shown. 
Definition: SpectrumCanvas.h:223
void setIntensityMode(IntensityModes mod)
Sets the intensity mode. 
Definition: SpectrumCanvas.h:212
ProcessingAction
Definition: DataProcessing.h:58
bool getLayerFlag(LayerData::Flags f) const 
returns a layer flag of the current layer 
Definition: SpectrumCanvas.h:256
SpectrumWidget * spectrum_widget_
Back-pointer to the enclosing spectrum widget. 
Definition: SpectrumCanvas.h:901
Real getCurrentMinIntensity() const 
Returns the minimum intensity of the active layer. 
Definition: SpectrumCanvas.h:386
boost::shared_ptr< ConsensusMap > ConsensusMapSharedPtrType
SharedPtr on consensus features. 
Definition: LayerData.h:114
bool isMzToXAxis()
Returns the mapping of m/z to axes. 
Definition: SpectrumCanvas.h:315
LayerData & getCurrentLayer()
returns the layer data of the active layer 
Definition: SpectrumCanvas.h:249
SpectrumWidget * getSpectrumWidget() const 
Returns the spectrum widget. 
Definition: SpectrumCanvas.h:175
const Software & getSoftware() const 
returns a const reference to the software used for processing 
void addDataProcessing_(MSExperiment< PeakType > &map, DataProcessing::ProcessingAction action) const 
Data processing setter for peak maps. 
Definition: SpectrumCanvas.h:936
boost::shared_ptr< FeatureMap<> > FeatureMapSharedPtrType
SharedPtr on feature map. 
Definition: LayerData.h:108
void setVersion(const String &version)
sets the software version 
Logarithmic mode. 
Definition: SpectrumCanvas.h:146
PeakType PeakType
Peak type. 
Definition: MSSpectrum.h:107
void setCurrentLayerParameters(const Param ¶m)
Sets the parameters of the current layer. 
Definition: SpectrumCanvas.h:460
Management and storage of parameters / INI files. 
Definition: Param.h:69
void setLayerFlag(Size layer, LayerData::Flags f, bool value)
sets a layer flag of the layer layer 
Definition: SpectrumCanvas.h:275
Representation of a mass spectrometry experiment. 
Definition: MSExperiment.h:68
QRubberBand rubber_band_
Rubber band for selected area. 
Definition: SpectrumCanvas.h:921
double percentage_factor_
Intensity scaling factor for relative scale with multiple layers. 
Definition: SpectrumCanvas.h:911
Normal mode: f(x)=x. 
Definition: SpectrumCanvas.h:143
void dataToWidget_(DoubleReal x, DoubleReal y, QPoint &point)
Convert chart to widget coordinates. 
Definition: SpectrumCanvas.h:787
static String getVersion()
Return the version number of OpenMS. 
DRange< 2 > AreaType
Types of Ranges/Areas. 
Definition: SpectrumCanvas.h:129
LayerData::FeatureMapSharedPtrType FeatureMapSharedPtrType
Main managed data type (features) 
Definition: SpectrumCanvas.h:111
QMenu * context_add_
External context menu extension. 
Definition: SpectrumCanvas.h:924
Int getActionMode() const 
Returns the action mode. 
Definition: SpectrumCanvas.h:186
size_t Size
Size type e.g. used as variable which can hold result of size() 
Definition: Types.h:144
FeatureMapType::FeatureType FeatureType
Feature type. 
Definition: SpectrumCanvas.h:124
translate 
Definition: SpectrumCanvas.h:135
LabelType
Label used in visualization. 
Definition: LayerData.h:91
IntensityModes intensity_mode_
Stores the used intensity mode function. 
Definition: SpectrumCanvas.h:833
Spectrum profile or centroided data. 
Definition: LayerData.h:66
A base class for all classes handling default parameters. 
Definition: DefaultParamHandler.h:90
IntensityModes
Display modes of intensity. 
Definition: SpectrumCanvas.h:141
static DateTime now()
Returns the current date and time. 
DataFilter array providing some convenience functions. 
Definition: DataFilters.h:53
void setName(const String &name)
sets the name of the software 
LayerData::ExperimentType ExperimentType
Main data type (experiment) 
Definition: SpectrumCanvas.h:105
ActionModes action_mode_
Stores the current action mode (Pick, Zoom, Translate) 
Definition: SpectrumCanvas.h:830
AreaType visible_area_
Stores the currently visible area. 
Definition: SpectrumCanvas.h:847
std::vector< AreaType > zoom_stack_
The zoom stack. 
Definition: SpectrumCanvas.h:873
int Int
Signed integer type. 
Definition: Types.h:100
Class that stores the data for one layer. 
Definition: LayerData.h:58
Index of a peak or feature. 
Definition: PeakIndex.h:51
QPoint last_mouse_pos_
start position of mouse actions 
Definition: SpectrumCanvas.h:904
Represents the peptide hits for a spectrum. 
Definition: PeptideIdentification.h:63
ExperimentType::SpectrumType SpectrumType
Spectrum type. 
Definition: SpectrumCanvas.h:118
const LayerData & getCurrentLayer() const 
returns the layer data of the active layer 
Definition: SpectrumCanvas.h:236