OpenMS  3.0.0
LayerData1DBase.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: Chris Bielow $
32 // $Authors: Chris Bielow $
33 // --------------------------------------------------------------------------
34 
35 #pragma once
36 
39 
40 class QWidget;
41 
42 namespace OpenMS
43 {
44  class Annotation1DItem;
45 
53  class OPENMS_GUI_DLLAPI LayerData1DBase : public virtual LayerDataBase
54  {
55  public:
56  // rule of 0
57 
62  virtual std::unique_ptr<Painter1DBase> getPainter1D() const = 0;
63 
67  virtual RangeAllType getRange1D() const = 0;
74  virtual RangeAllType getRangeForArea(const RangeAllType partial_range) const = 0;
75 
82  virtual QMenu* getContextMenuAnnotation(Annotation1DItem* annot_item, bool& need_repaint) = 0;
83 
84 
92  virtual Annotation1DItem* addPeakAnnotation(const PeakIndex& peak_index, const QString& text, const QColor& color) = 0;
93 
94 
96  String getDecoratedName() const override;
97 
100  {
101  return annotations_1d_[current_idx_];
102  }
103 
106  {
107  return annotations_1d_[current_idx_];
108  }
109 
111  const Annotations1DContainer& getAnnotations(Size spectrum_index) const
112  {
113  return annotations_1d_[spectrum_index];
114  }
115 
118  {
119  return annotations_1d_[spectrum_index];
120  }
123  {
124  return current_idx_;
125  }
126 
128  void setCurrentIndex(Size index);
129 
131  virtual bool hasIndex(Size index) const = 0;
132 
134  bool flipped = false;
135 
137  std::vector<QColor> peak_colors_1d;
138 
139  protected:
141  Size current_idx_ = 0;
142 
144  std::vector<Annotations1DContainer> annotations_1d_ = std::vector<Annotations1DContainer>(1);
145  };
146 
147 }// namespace OpenMS
148 
An abstract class acting as an interface for the different 1D annotation items.
Definition: Annotation1DItem.h:61
A more convenient string class.
Definition: String.h:58
const Annotations1DContainer & getCurrentAnnotations() const
Returns a const reference to the annotations of the current spectrum (1D view)
Definition: LayerData1DBase.h:99
Size getCurrentIndex() const
Get the index of the current spectrum (1D view)
Definition: LayerData1DBase.h:122
const Annotations1DContainer & getAnnotations(Size spectrum_index) const
Returns a const reference to the annotations of the spectrum_index&#39;s spectrum (1D view) ...
Definition: LayerData1DBase.h:111
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
Annotations1DContainer & getAnnotations(Size spectrum_index)
Returns a mutable reference to the annotations of the spectrum_index&#39;s spectrum (1D view) ...
Definition: LayerData1DBase.h:117
Base class for all 1D layers, a special case of LayerData.
Definition: LayerData1DBase.h:53
Annotations1DContainer & getCurrentAnnotations()
Returns a mutable reference to the annotations of the current spectrum (1D view)
Definition: LayerData1DBase.h:105
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:127
std::vector< QColor > peak_colors_1d
Peak colors of the currently shown spectrum.
Definition: LayerData1DBase.h:137
Container for annotations to content of Plot1DCanvas.
Definition: Annotations1DContainer.h:53
Class that stores the data for one layer.
Definition: LayerDataBase.h:194
Index of a peak or feature.
Definition: PeakIndex.h:50