OpenMS  2.7.0
PlotCanvas.h
Go to the documentation of this file.
1 // --------------------------------------------------------------------------
2 // OpenMS -- Open-Source Mass Spectrometry
3 // --------------------------------------------------------------------------
4 // Copyright The OpenMS Team -- Eberhard Karls University Tuebingen,
5 // ETH Zurich, and Freie Universitaet Berlin 2002-2021.
6 //
7 // This software is released under a three-clause BSD license:
8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above copyright
11 // notice, this list of conditions and the following disclaimer in the
12 // documentation and/or other materials provided with the distribution.
13 // * Neither the name of any author or any participating institution
14 // may be used to endorse or promote products derived from this software
15 // without specific prior written permission.
16 // For a full list of authors, refer to the file AUTHORS.
17 // --------------------------------------------------------------------------
18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 // ARE DISCLAIMED. IN NO EVENT SHALL ANY OF THE AUTHORS OR THE CONTRIBUTING
22 // INSTITUTIONS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
25 // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26 // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
27 // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
28 // ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 //
30 // --------------------------------------------------------------------------
31 // $Maintainer: Timo Sachsenberg $
32 // $Authors: Marc Sturm $
33 // --------------------------------------------------------------------------
34 
35 #pragma once
36 
37 // OpenMS_GUI config
38 #include <OpenMS/VISUAL/OpenMS_GUIConfig.h>
39 
40 //OpenMS
41 #include <OpenMS/CONCEPT/Types.h>
46 
47 //QT
48 #include <QtWidgets>
49 #include <QRubberBand>
50 
51 class QWheelEvent;
52 class QKeyEvent;
53 class QMouseEvent;
54 class QFocusEvent;
55 class QMenu;
56 
57 //STL
58 #include <stack>
59 #include <vector>
60 
61 namespace OpenMS
62 {
63  class PlotWidget;
64 
65 
71  class LayerStack
72  {
73  public:
75  void addLayer(LayerData&& new_layer);
76 
77  const LayerData& getLayer(const Size index) const;
78 
79  LayerData& getLayer(const Size index);
80 
81  const LayerData& getCurrentLayer() const;
82 
84 
86  void setCurrentLayer(Size index);
87 
89 
90  bool empty() const;
91 
93 
94  void removeLayer(Size layer_index);
95 
97 
98  protected:
99  std::vector<LayerData> layers_;
100  private:
102  };
103 
133  class OPENMS_GUI_DLLAPI PlotCanvas :
134  public QWidget,
135  public DefaultParamHandler
136  {
137  Q_OBJECT
138 
139 public:
142 
158 
167 
172 
173 
176  {
179  AM_MEASURE
180  };
181 
184  {
188  IM_LOG
189  };
190 
192 
194  PlotCanvas(const Param & preferences, QWidget * parent = nullptr);
195 
197  ~PlotCanvas() override;
198 
206  inline void setPlotWidget(PlotWidget * widget)
207  {
208  spectrum_widget_ = widget;
209  }
210 
217  inline PlotWidget * getPlotWidget() const
218  {
219  return spectrum_widget_;
220  }
221 
228  inline Int getActionMode() const
229  {
230  return action_mode_;
231  }
232 
241  {
242  return intensity_mode_;
243  }
244 
255  {
256  intensity_mode_ = mod;
257  intensityModeChange_();
258  }
259 
265  inline bool gridLinesShown() const
266  {
267  return show_grid_;
268  }
269 
271  inline const LayerData& getLayer(Size index) const
272  {
273  return layers_.getLayer(index);
274  }
276  inline LayerData& getLayer(Size index)
277  {
278  return layers_.getLayer(index);
279  }
280 
282  inline const LayerData& getCurrentLayer() const
283  {
284  return layers_.getCurrentLayer();
285  }
288  {
289  return layers_.getCurrentLayer();
290  }
291 
293  inline Size getCurrentLayerIndex() const
294  {
295  return layers_.getCurrentLayerIndex();
296  }
297 
300  {
301  return getLayerFlag(layers_.getCurrentLayerIndex(), f);
302  }
303 
305  void setLayerFlag(LayerData::Flags f, bool value)
306  {
307  setLayerFlag(layers_.getCurrentLayerIndex(), f, value);
308  }
309 
311  bool getLayerFlag(Size layer, LayerData::Flags f) const
312  {
313  return layers_.getLayer(layer).flags.test(f);
314  }
315 
317  void setLayerFlag(Size layer, LayerData::Flags f, bool value)
318  {
319  //abort if there are no layers
320  if (layers_.empty()) return;
321 
322  layers_.getLayer(layer).flags.set(f, value);
323  update_buffer_ = true;
324  update();
325  }
326 
327  inline void setLabel(LayerData::LabelType label)
328  {
329  //abort if there are no layers
330  if (layers_.empty()) return;
331  layers_.getCurrentLayer().label = label;
332  update_buffer_ = true;
333  update();
334  }
335 
341  inline const AreaType & getVisibleArea() const
342  {
343  return visible_area_;
344  }
345 
349  virtual void setFilters(const DataFilters & filters);
350 
352  inline bool isMzToXAxis()
353  {
354  return mz_to_x_axis_;
355  }
356 
358  void mzToXAxis(bool mz_to_x_axis);
359 
367  inline Size getLayerCount() const
368  {
369  return layers_.getLayerCount();
370  }
371 
373  virtual void activateLayer(Size layer_index) = 0;
375  virtual void removeLayer(Size layer_index) = 0;
376 
379  {
380  for (Size i = getLayerCount(); i > 0; --i)
381  {
382  removeLayer(i-1);
383  }
384  }
385 
399  bool addLayer(ExperimentSharedPtrType map, ODExperimentSharedPtrType od_map, const String & filename = "");
400 
409  bool addLayer(FeatureMapSharedPtrType map, const String & filename = "");
410 
419  bool addLayer(ConsensusMapSharedPtrType map, const String & filename = "");
421 
430  bool addLayer(std::vector<PeptideIdentification> & peptides,
431  const String & filename = "");
432 
434  inline float getCurrentMinIntensity() const
435  {
436  return layers_.getCurrentLayer().getMinIntensity();
437  }
438 
440  inline float getCurrentMaxIntensity() const
441  {
442  return layers_.getCurrentLayer().getMaxIntensity();
443  }
444 
446  inline float getMinIntensity(Size index) const
447  {
448  return getLayer(index).getMinIntensity();
449  }
450 
452  inline float getMaxIntensity(Size index) const
453  {
454  return getLayer(index).getMaxIntensity();
455  }
456 
458  void setLayerName(Size i, const String & name);
459 
462 
464  inline void setCurrentLayerParameters(const Param& param)
465  {
466  getCurrentLayer().param = param;
467  emit preferencesChange();
468  }
469 
476 
482  double getSnapFactor();
483 
486 
488  virtual void showCurrentLayerPreferences() = 0;
489 
496  virtual void showMetaData(bool modifiable = false, Int index = -1);
497 
503  virtual void saveCurrentLayer(bool visible) = 0;
504 
505 public slots:
506 
513  void changeVisibility(Size i, bool b);
514 
521  void changeLayerFilterState(Size i, bool b);
522 
529  void showGridLines(bool show);
530 
538  void resetZoom(bool repaint = true);
539 
547 
553  virtual void horizontalScrollBarChange(int value);
554 
560  virtual void verticalScrollBarChange(int value);
561 
563  void setAdditionalContextMenu(QMenu * menu);
564 
573 
574 
583 
592 
600  void getVisibleIdentifications(std::vector<PeptideIdentification> & peptides) const;
601 
603  virtual void updateLayer(Size i) = 0;
604 
605 
609  inline void dataToWidgetDistance(double x, double y, QPoint& point)
610  {
611  dataToWidget_(x, y, point);
612  // substract the 'offset'
613  QPoint zero;
614  dataToWidget_(0, 0, zero);
615  point -= zero;
616  }
617 
621  inline PointType widgetToDataDistance(double x, double y)
622  {
623  PointType point = widgetToData_(x, y);
624  // substract the 'offset'
625  PointType zero = widgetToData_(0, 0);
626  point -= zero;
627  return point;
628  }
629 
630 signals:
631 
633  void layerModficationChange(Size layer, bool modified);
634 
637 
640 
647  void visibleAreaChanged(DRange<2> area); //Do not change this to AreaType! QT needs the exact type...
648 
650  void sendCursorStatus(double mz = -1.0, double rt = -1.0);
651 
653  void sendStatusMessage(std::string message, OpenMS::UInt time);
654 
657 
659  void updateVScrollbar(float, float, float, float);
660 
662  void updateHScrollbar(float, float, float, float);
663 
666 
669 
672 
673 protected slots:
674 
677 
678 protected:
679 
681  void drawText_(QPainter & painter, QStringList text);
682 
684  double getIdentificationMZ_(const Size layer_index,
685  const PeptideIdentification & peptide) const;
686 
688  virtual bool finishAdding_() = 0;
689 
692  void popIncompleteLayer_(const QString& error_message = "");
693 
695 
696  void resizeEvent(QResizeEvent * e) override;
697  void wheelEvent(QWheelEvent * e) override;
698  void keyPressEvent(QKeyEvent * e) override;
699  void keyReleaseEvent(QKeyEvent * e) override;
700  void focusOutEvent(QFocusEvent * e) override;
701  void leaveEvent(QEvent * e) override;
702  void enterEvent(QEvent * e) override;
704 
706  virtual void intensityModeChange_();
707 
718  virtual void changeVisibleArea_(const AreaType & new_area, bool repaint = true, bool add_to_stack = false);
719 
725  virtual void recalculateSnapFactor_();
726 
728 
729  virtual void zoom_(int x, int y, bool zoom_in);
732  void zoomBack_();
734  virtual void zoomForward_();
736  void zoomAdd_(const AreaType & area);
738  void zoomClear_();
740 
742 
743  virtual void translateLeft_(Qt::KeyboardModifiers m);
746  virtual void translateRight_(Qt::KeyboardModifiers m);
748  virtual void translateForward_();
750  virtual void translateBackward_();
752 
758  virtual void updateScrollbars_();
759 
769  inline PointType widgetToData_(double x, double y)
770  {
771  if (!isMzToXAxis())
772  {
773  return PointType(
774  visible_area_.minX() + (height() - y) / height() * visible_area_.width(),
775  visible_area_.minY() + x / width() * visible_area_.height()
776  );
777  }
778  else
779  {
780  return PointType(
781  visible_area_.minX() + x / width() * visible_area_.width(),
782  visible_area_.minY() + (height() - y) / height() * visible_area_.height()
783  );
784  }
785  }
786 
788  inline PointType widgetToData_(const QPoint & pos)
789  {
790  return widgetToData_(pos.x(), pos.y());
791  }
792 
801  inline void dataToWidget_(double x, double y, QPoint & point)
802  {
803  if (!isMzToXAxis())
804  {
805 
806 
807  if (intensity_mode_ != PlotCanvas::IM_LOG)
808  {
809  point.setX(int((y - visible_area_.minY()) / visible_area_.height() * width()));
810  }
811  else // IM_LOG
812  {
813  point.setX(int(
814  std::log10((y - visible_area_.minY()) + 1) / std::log10(visible_area_.height() + 1) * width())
815  );
816  }
817 
818  point.setY(height() - int((x - visible_area_.minX()) / visible_area_.width() * height()));
819  }
820  else
821  {
822  point.setX(int((x - visible_area_.minX()) / visible_area_.width() * width()));
823 
824  if (intensity_mode_ != PlotCanvas::IM_LOG)
825  {
826  point.setY(height() - int((y - visible_area_.minY()) / visible_area_.height() * height()));
827  }
828  else // IM_LOG
829  {
830  point.setY(height() - int(
831  std::log10((y - visible_area_.minY()) + 1) / std::log10(visible_area_.height() + 1) * height()
832  ));
833  }
834  }
835  }
836 
838  virtual void paintGridLines_(QPainter & painter);
839 
841  QImage buffer_;
842 
845 
848 
851 
854 
862 
872  void recalculateRanges_(UInt mz_dim, UInt rt_dim, UInt it_dim);
873 
882 
885 
887  std::vector<AreaType> zoom_stack_;
889  std::vector<AreaType>::iterator zoom_pos_;
890 
900  virtual void update_(const char * caller_name);
901 
903  void modificationStatus_(Size layer_index, bool modified);
904 
907 
910 
913 
920 
928  std::vector<double> snap_factors_;
929 
931  QRubberBand rubber_band_;
932 
934  QMenu* context_add_;
935 
938 
943 
946  {
947  std::set<DataProcessing::ProcessingAction> actions;
948  actions.insert(action);
949 
950  DataProcessingPtr p = boost::shared_ptr<DataProcessing>(new DataProcessing);
951  //actions
952  p->setProcessingActions(actions);
953  //software
954  p->getSoftware().setName("PlotCanvas");
955  //version
956  p->getSoftware().setVersion(VersionInfo::getVersion());
957  //time
958  p->setCompletionTime(DateTime::now());
959 
960  for (Size i = 0; i < map.size(); ++i)
961  {
962  map[i].getDataProcessing().push_back(p);
963  }
964  }
965 
966  };
967 }
968 
A container for consensus elements.
Definition: ConsensusMap.h:88
DataFilter array providing some convenience functions.
Definition: DataFilters.h:51
Description of the applied preprocessing steps.
Definition: DataProcessing.h:53
ProcessingAction
Definition: DataProcessing.h:59
static DateTime now()
Returns the current date and time.
A base class for all classes handling default parameters.
Definition: DefaultParamHandler.h:93
A container for features.
Definition: FeatureMap.h:105
An LC-MS feature.
Definition: Feature.h:72
Class that stores the data for one layer.
Definition: LayerData.h:96
boost::shared_ptr< ExperimentType > ExperimentSharedPtrType
SharedPtr on MSExperiment.
Definition: LayerData.h:159
boost::shared_ptr< OnDiscMSExperiment > ODExperimentSharedPtrType
SharedPtr on On-Disc MSExperiment.
Definition: LayerData.h:164
LabelType
Label used in visualization.
Definition: LayerData.h:131
boost::shared_ptr< const ExperimentType > ConstExperimentSharedPtrType
Definition: LayerData.h:161
boost::shared_ptr< ConsensusMap > ConsensusMapSharedPtrType
SharedPtr on consensus features.
Definition: LayerData.h:153
Flags
Flags that determine which information is shown.
Definition: LayerData.h:114
boost::shared_ptr< OSWData > OSWDataSharedPtrType
SharedPtr on OSWData.
Definition: LayerData.h:167
boost::shared_ptr< FeatureMap > FeatureMapSharedPtrType
SharedPtr on feature map.
Definition: LayerData.h:147
Definition: PlotCanvas.h:72
void addLayer(LayerData &&new_layer)
adds a new layer and makes it the current layer
LayerData & getLayer(const Size index)
std::vector< LayerData > layers_
Definition: PlotCanvas.h:99
Size getLayerCount() const
Size getCurrentLayerIndex() const
LayerData & getCurrentLayer()
Size current_layer_
Definition: PlotCanvas.h:101
bool empty() const
const LayerData & getCurrentLayer() const
void removeLayer(Size layer_index)
void setCurrentLayer(Size index)
throws Exception::IndexOverflow unless index is smaller than getLayerCount()
const LayerData & getLayer(const Size index) const
In-Memory representation of a mass spectrometry experiment.
Definition: MSExperiment.h:80
Size size() const
Definition: MSExperiment.h:127
The representation of a 1D spectrum.
Definition: MSSpectrum.h:71
ContainerType::const_iterator ConstIterator
Non-mutable iterator.
Definition: MSSpectrum.h:128
Management and storage of parameters / INI files.
Definition: Param.h:70
A 1-dimensional raw data point or peak.
Definition: Peak1D.h:54
Represents the peptide hits for a spectrum.
Definition: PeptideIdentification.h:65
Base class for visualization canvas classes.
Definition: PlotCanvas.h:136
bool mz_to_x_axis_
Stores the mapping of m/z.
Definition: PlotCanvas.h:853
virtual void translateBackward_()
Translation bound to the 'Down' key.
float getMaxIntensity(Size index) const
Returns the maximum intensity of the layer with index index.
Definition: PlotCanvas.h:452
AreaType visible_area_
Stores the currently visible area.
Definition: PlotCanvas.h:861
float getMinIntensity(Size index) const
Returns the minimum intensity of the layer with index index.
Definition: PlotCanvas.h:446
float getCurrentMinIntensity() const
Returns the minimum intensity of the active layer.
Definition: PlotCanvas.h:434
void addDataProcessing_(PeakMap &map, DataProcessing::ProcessingAction action) const
Data processing setter for peak maps.
Definition: PlotCanvas.h:945
void layerActivated(QWidget *w)
Signal emitted whenever a new layer is activated within the current window.
LayerData::ExperimentType ExperimentType
Main data type (experiment)
Definition: PlotCanvas.h:144
void setLayerName(Size i, const String &name)
Sets the name of layer i.
~PlotCanvas() override
Destructor.
void setVisibleArea(AreaType area)
Sets the visible area.
DRange< 2 > AreaType
Types of Ranges/Areas.
Definition: PlotCanvas.h:171
LayerStack layers_
Layer data.
Definition: PlotCanvas.h:850
std::vector< double > snap_factors_
Intensity scaling factor for 'snap to maximum intensity mode'.
Definition: PlotCanvas.h:928
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/t...
bool addLayer(std::vector< PeptideIdentification > &peptides, const String &filename="")
Add an identification data layer.
PlotCanvas(const Param &preferences, QWidget *parent=nullptr)
Default constructor.
String getLayerName(Size i)
Gets the name of layer i.
LayerData::ExperimentSharedPtrType ExperimentSharedPtrType
Main managed data type (experiment)
Definition: PlotCanvas.h:146
virtual void horizontalScrollBarChange(int value)
Notifies the canvas that the horizontal scrollbar has been moved.
SpectrumType::PeakType PeakType
Peak type.
Definition: PlotCanvas.h:164
QImage buffer_
Buffer that stores the actual peak information.
Definition: PlotCanvas.h:841
PeakIndex selected_peak_
selected peak
Definition: PlotCanvas.h:940
void zoomAdd_(const AreaType &area)
Add a visible area to the zoom stack.
void setIntensityMode(IntensityModes mod)
Sets the intensity mode.
Definition: PlotCanvas.h:254
void recalculateAxes()
Forces recalculation of axis ticks in the connected widget.
Size getLayerCount() const
Returns the number of layers.
Definition: PlotCanvas.h:367
virtual void updateLayer(Size i)=0
Updates layer i when the data in the corresponding file changes.
bool addLayer(ExperimentSharedPtrType map, ODExperimentSharedPtrType od_map, const String &filename="")
Add a peak data layer.
PointType widgetToDataDistance(double x, double y)
compute distance in widget coordinates (unit axis as shown) when moving x/y px in chart coordinates
Definition: PlotCanvas.h:621
bool gridLinesShown() const
Returns if the grid is currently shown.
Definition: PlotCanvas.h:265
SpectrumType::ConstIterator SpectrumConstIteratorType
Spectrum iterator type (iterates over peaks)
Definition: PlotCanvas.h:162
void enterEvent(QEvent *e) override
virtual void updateScrollbars_()
Updates the scroll bars.
void getVisibleConsensusData(ConsensusMapType &map) const
Fills the handed over map with the visible consensus features of the current layer.
Size getCurrentLayerIndex() const
returns the index of the active layer
Definition: PlotCanvas.h:293
bool addLayer(FeatureMapSharedPtrType map, const String &filename="")
Add a feature data layer.
Int getActionMode() const
Returns the action mode.
Definition: PlotCanvas.h:228
void mzToXAxis(bool mz_to_x_axis)
Sets the mapping of m/z to axes.
bool getLayerFlag(LayerData::Flags f) const
returns a layer flag of the current layer
Definition: PlotCanvas.h:299
virtual void activateLayer(Size layer_index)=0
change the active layer (the one that is used for selecting and so on)
LayerData & getCurrentLayer()
returns the layer data of the active layer
Definition: PlotCanvas.h:287
void updateCursor_()
Updates the cursor according to the current action mode.
void drawText_(QPainter &painter, QStringList text)
Draws several lines of text to the upper right corner of the widget.
PointType widgetToData_(const QPoint &pos)
Calls widgetToData_ with x and y position of pos.
Definition: PlotCanvas.h:788
virtual void removeLayer(Size layer_index)=0
removes the layer with index layer_index
LayerData::ConstExperimentSharedPtrType ConstExperimentSharedPtrType
Definition: PlotCanvas.h:147
virtual void verticalScrollBarChange(int value)
Notifies the canvas that the vertical scrollbar has been moved.
void actionModeChange()
Emitted when the action mode changes.
const AreaType & getVisibleArea() const
Returns the currently visible area.
Definition: PlotCanvas.h:341
void sendCursorStatus(double mz=-1.0, double rt=-1.0)
Emitted when the cursor position changes (for displaying e.g. in status bar)
void leaveEvent(QEvent *e) override
void zoomClear_()
Clears the zoom stack and invalidates the current zoom position. After calling this,...
void keyReleaseEvent(QKeyEvent *e) override
void getVisibleFeatureData(FeatureMapType &map) const
Fills the handed over map with the visible features of the current layer.
void recalculateRanges_(UInt mz_dim, UInt rt_dim, UInt it_dim)
Recalculates the overall_data_range_.
void visibleAreaChanged(DRange< 2 > area)
Change of the visible area.
LayerData::ConsensusMapSharedPtrType ConsensusMapSharedPtrType
Main managed data type (consensus features)
Definition: PlotCanvas.h:157
void getVisibleIdentifications(std::vector< PeptideIdentification > &peptides) const
Fills the handed over peptides with the visible peptide identifications of the current layer.
ExperimentType::SpectrumType SpectrumType
Spectrum type.
Definition: PlotCanvas.h:160
IntensityModes intensity_mode_
Stores the used intensity mode function.
Definition: PlotCanvas.h:847
virtual void showMetaData(bool modifiable=false, Int index=-1)
Shows a dialog with the meta data.
void resetZoom(bool repaint=true)
Zooms fully out and resets the zoom stack.
virtual void paintGridLines_(QPainter &painter)
Helper function to paint grid lines.
LayerData::FeatureMapSharedPtrType FeatureMapSharedPtrType
Main managed data type (features)
Definition: PlotCanvas.h:153
virtual void saveCurrentLayer(bool visible)=0
Saves the current layer data.
void keyPressEvent(QKeyEvent *e) override
std::vector< AreaType >::iterator zoom_pos_
The current position in the zoom stack.
Definition: PlotCanvas.h:889
const LayerData & getCurrentLayer() const
returns the layer data of the active layer
Definition: PlotCanvas.h:282
virtual void zoomForward_()
Go forward in zoom history.
void setAdditionalContextMenu(QMenu *menu)
Sets the additional context menu. If not 0, this menu is added to the context menu of the canvas.
void dataToWidgetDistance(double x, double y, QPoint &point)
converts a distance in axis values to pixel values
Definition: PlotCanvas.h:609
void changeVisibility(Size i, bool b)
change the visibility of a layer
double getPercentageFactor()
Returns the percentage factor.
LayerData::ConsensusMapType ConsensusMapType
Main data type (consensus features)
Definition: PlotCanvas.h:155
void updateVScrollbar(float, float, float, float)
Triggers the update of the vertical scrollbar.
void wheelEvent(QWheelEvent *e) override
void focusOutEvent(QFocusEvent *e) override
virtual void changeVisibleArea_(const AreaType &new_area, bool repaint=true, bool add_to_stack=false)
Sets the visible area.
void modificationStatus_(Size layer_index, bool modified)
Takes all actions necessary when the modification status of a layer changes (signals etc....
void setLayerFlag(Size layer, LayerData::Flags f, bool value)
sets a layer flag of the layer layer
Definition: PlotCanvas.h:317
virtual void translateForward_()
Translation bound to the 'Up' key.
DPosition< 2 > PointType
Type of the Points.
Definition: PlotCanvas.h:169
void setLayerFlag(LayerData::Flags f, bool value)
sets a layer flag of the current layer
Definition: PlotCanvas.h:305
bool update_buffer_
Whether to recalculate the data in the buffer when repainting.
Definition: PlotCanvas.h:906
void zoomBack_()
Go backward in zoom history.
IntensityModes
Display modes of intensity.
Definition: PlotCanvas.h:184
@ IM_NONE
Normal mode: f(x)=x.
Definition: PlotCanvas.h:185
@ IM_SNAP
Shows the maximum displayed intensity as if it was the overall maximum intensity.
Definition: PlotCanvas.h:187
@ IM_PERCENTAGE
Shows intensities normalized by layer maximum: f(x)=x/max(x)*100.
Definition: PlotCanvas.h:186
@ IM_LOG
Logarithmic mode.
Definition: PlotCanvas.h:188
float getCurrentMaxIntensity() const
Returns the maximum intensity of the active layer.
Definition: PlotCanvas.h:440
virtual void setFilters(const DataFilters &filters)
Sets the filters applied to the data before drawing (for the current layer)
void changeLayerFilterState(Size i, bool b)
change if the defined data filters are used
LayerData::OSWDataSharedPtrType OSWDataSharedPtrType
Definition: PlotCanvas.h:149
void layerModficationChange(Size layer, bool modified)
Signal emitted whenever the modification status of a layer changes (editing and storing)
virtual void translateRight_(Qt::KeyboardModifiers m)
Translation bound to the 'Right' key.
bool addLayer(ConsensusMapSharedPtrType map, const String &filename="")
Add a consensus feature data layer.
void setCurrentLayerParameters(const Param &param)
Sets the parameters of the current layer.
Definition: PlotCanvas.h:464
void updateHScrollbar(float, float, float, float)
Triggers the update of the horizontal scrollbar.
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 displ...
std::vector< AreaType > zoom_stack_
The zoom stack.
Definition: PlotCanvas.h:887
LayerData::FeatureMapType FeatureMapType
Main data type (features)
Definition: PlotCanvas.h:151
bool show_timing_
Flag that determines if timing data is printed to the command line.
Definition: PlotCanvas.h:937
void setLabel(LayerData::LabelType label)
Definition: PlotCanvas.h:327
QPoint last_mouse_pos_
start position of mouse actions
Definition: PlotCanvas.h:912
bool show_grid_
Stores whether or not to show a grid.
Definition: PlotCanvas.h:884
QMenu * context_add_
External context menu extension.
Definition: PlotCanvas.h:934
PointType widgetToData_(double x, double y)
Convert widget to chart coordinates.
Definition: PlotCanvas.h:769
FeatureMapType::FeatureType FeatureType
Feature type.
Definition: PlotCanvas.h:166
double getSnapFactor()
Returns the first intensity scaling factor for 'snap to maximum intensity mode'.
virtual bool finishAdding_()=0
Method that is called when a new layer has been added.
ActionModes
Mouse action modes.
Definition: PlotCanvas.h:176
@ AM_ZOOM
zoom
Definition: PlotCanvas.h:178
@ AM_TRANSLATE
translate
Definition: PlotCanvas.h:177
virtual void intensityModeChange_()
This method is called whenever the intensity mode changes. Reimplement if you need to react on such c...
bool isMzToXAxis()
Returns the mapping of m/z to axes.
Definition: PlotCanvas.h:352
void popIncompleteLayer_(const QString &error_message="")
bool getLayerFlag(Size layer, LayerData::Flags f) const
returns a layer flag of the layer layer
Definition: PlotCanvas.h:311
void preferencesChange()
Emitted when the layer preferences have changed.
PeakIndex measurement_start_
start peak of measuring mode
Definition: PlotCanvas.h:942
IntensityModes getIntensityMode() const
Returns the intensity mode.
Definition: PlotCanvas.h:240
void dataToWidget_(double x, double y, QPoint &point)
Convert chart to widget coordinates.
Definition: PlotCanvas.h:801
PlotWidget * spectrum_widget_
Back-pointer to the enclosing spectrum widget.
Definition: PlotCanvas.h:909
virtual void showCurrentLayerPreferences()=0
Shows the preferences dialog of the active layer.
ActionModes action_mode_
Stores the current action mode (Pick, Zoom, Translate)
Definition: PlotCanvas.h:844
void resizeEvent(QResizeEvent *e) override
const DRange< 3 > & getDataRange()
Returns the area which encloses all data points.
LayerData::ODExperimentSharedPtrType ODExperimentSharedPtrType
Definition: PlotCanvas.h:148
QRubberBand rubber_band_
Rubber band for selected area.
Definition: PlotCanvas.h:931
void getVisiblePeakData(ExperimentType &map) const
Fills the handed over map with the visible peaks of the current layer.
void changeLegendVisibility()
Toggle axis legend visibility change.
LayerData & getLayer(Size index)
returns the layer data with index index
Definition: PlotCanvas.h:276
void showGridLines(bool show)
Whether or not to show grid lines.
void layerZoomChanged(QWidget *w)
Signal emitted whenever the zoom changed.
const LayerData & getLayer(Size index) const
returns the layer data with index index
Definition: PlotCanvas.h:271
DRange< 3 > overall_data_range_
Stores the data range (m/z, RT and intensity) of all layers.
Definition: PlotCanvas.h:881
virtual void recalculateSnapFactor_()
Recalculates the intensity scaling factor for 'snap to maximum intensity mode'.
void removeLayers()
removes all layers by calling removeLayer() for all layer indices (from highest to lowest)
Definition: PlotCanvas.h:378
PlotWidget * getPlotWidget() const
Returns the spectrum widget.
Definition: PlotCanvas.h:217
double percentage_factor_
Intensity scaling factor for relative scale with multiple layers.
Definition: PlotCanvas.h:919
virtual void update_(const char *caller_name)
Updates the displayed data.
void setPlotWidget(PlotWidget *widget)
Sets the spectrum widget.
Definition: PlotCanvas.h:206
Base class for spectrum widgets.
Definition: PlotWidget.h:83
A more convenient string class.
Definition: String.h:61
static String getVersion()
Return the version number of OpenMS.
int Int
Signed integer type.
Definition: Types.h:102
unsigned int UInt
Unsigned integer type.
Definition: Types.h:94
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:127
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
boost::shared_ptr< DataProcessing > DataProcessingPtr
Definition: DataProcessing.h:135
Index of a peak or feature.
Definition: PeakIndex.h:51