OpenMS
LayerData1DBase.h
Go to the documentation of this file.
1 // Copyright (c) 2002-present, The OpenMS Team -- EKU Tuebingen, ETH Zurich, and FU Berlin
2 // SPDX-License-Identifier: BSD-3-Clause
3 //
4 // --------------------------------------------------------------------------
5 // $Maintainer: Chris Bielow $
6 // $Authors: Chris Bielow $
7 // --------------------------------------------------------------------------
8 
9 #pragma once
10 
13 
14 class QWidget;
15 
16 namespace OpenMS
17 {
18  class Annotation1DItem;
19 
27  class OPENMS_GUI_DLLAPI LayerData1DBase : public virtual LayerDataBase
28  {
29  public:
30  // rule of 0
31 
36  virtual std::unique_ptr<Painter1DBase> getPainter1D() const = 0;
37 
41  virtual RangeAllType getRange1D() const = 0;
48  virtual RangeAllType getRangeForArea(const RangeAllType partial_range) const = 0;
49 
56  virtual QMenu* getContextMenuAnnotation(Annotation1DItem* annot_item, bool& need_repaint) = 0;
57 
58 
66  virtual Annotation1DItem* addPeakAnnotation(const PeakIndex& peak_index, const QString& text, const QColor& color) = 0;
67 
68 
70  String getDecoratedName() const override;
71 
74  {
75  return annotations_1d_[current_idx_];
76  }
77 
80  {
81  return annotations_1d_[current_idx_];
82  }
83 
85  const Annotations1DContainer& getAnnotations(Size spectrum_index) const
86  {
87  return annotations_1d_[spectrum_index];
88  }
89 
92  {
93  return annotations_1d_[spectrum_index];
94  }
97  {
98  return current_idx_;
99  }
100 
102  void setCurrentIndex(Size index);
103 
105  virtual bool hasIndex(Size index) const = 0;
106 
108  bool flipped = false;
109 
111  std::vector<QColor> peak_colors_1d;
112 
113  protected:
115  Size current_idx_ = 0;
116 
118  std::vector<Annotations1DContainer> annotations_1d_ = std::vector<Annotations1DContainer>(1);
119  };
120 
121 }// namespace OpenMS
122 
An abstract class acting as an interface for the different 1D annotation items.
Definition: Annotation1DItem.h:36
Container for annotations to content of Plot1DCanvas.
Definition: Annotations1DContainer.h:29
Base class for all 1D layers, a special case of LayerData.
Definition: LayerData1DBase.h:28
const Annotations1DContainer & getAnnotations(Size spectrum_index) const
Returns a const reference to the annotations of the spectrum_index's spectrum (1D view)
Definition: LayerData1DBase.h:85
virtual Annotation1DItem * addPeakAnnotation(const PeakIndex &peak_index, const QString &text, const QColor &color)=0
Add a Annotation1DPeakItem to getCurrentAnnotations(). The specific type is determined by the derived...
virtual std::unique_ptr< Painter1DBase > getPainter1D() const =0
Obtain a painter which can draw the layer on a canvas.
virtual bool hasIndex(Size index) const =0
Does the layer have at least index items (e.g. spectra, chroms, etc), so a call to setCurrentIndex() ...
String getDecoratedName() const override
get name augmented with attributes, e.g. '*' if modified
Size getCurrentIndex() const
Get the index of the current spectrum (1D view)
Definition: LayerData1DBase.h:96
virtual RangeAllType getRange1D() const =0
Annotations1DContainer & getCurrentAnnotations()
Returns a mutable reference to the annotations of the current spectrum (1D view)
Definition: LayerData1DBase.h:79
void setCurrentIndex(Size index)
Set the index of the current spectrum (1D view) – and prepares annotations.
const Annotations1DContainer & getCurrentAnnotations() const
Returns a const reference to the annotations of the current spectrum (1D view)
Definition: LayerData1DBase.h:73
virtual RangeAllType getRangeForArea(const RangeAllType partial_range) const =0
Given a partial_range for the current 1D layer (e.g. an m/z range), fill in the other dimensions (usu...
virtual QMenu * getContextMenuAnnotation(Annotation1DItem *annot_item, bool &need_repaint)=0
Get a context menu (with lambda actions included) for this 1D layer, when a Annotation1DItem was righ...
Annotations1DContainer & getAnnotations(Size spectrum_index)
Returns a mutable reference to the annotations of the spectrum_index's spectrum (1D view)
Definition: LayerData1DBase.h:91
std::vector< QColor > peak_colors_1d
Peak colors of the currently shown spectrum.
Definition: LayerData1DBase.h:111
Class that stores the data for one layer.
Definition: LayerDataBase.h:169
A more convenient string class.
Definition: String.h:34
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:97
Main OpenMS namespace.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19
Index of a peak or feature.
Definition: PeakIndex.h:25