OpenMS
LayerData1DPeak.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-2023.
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 namespace OpenMS
41 {
42 
43  class OPENMS_GUI_DLLAPI LayerData1DPeak : public LayerDataPeak, public LayerData1DBase
44  {
45  public:
47  : LayerDataBase(DT_PEAK)
48  {
49  }
50 
52  {
53  }
54 
55 
56  std::unique_ptr<LayerStoreData> storeVisibleData(const RangeAllType& visible_range, const DataFilters& layer_filters) const override;
57  std::unique_ptr<LayerStoreData> storeFullData() const override;
58 
59  std::unique_ptr<Painter1DBase> getPainter1D() const override;
60 
61  bool hasIndex(Size index) const override
62  {
63  return index < peak_map_->size();
64  }
65 
66  RangeAllType getRangeForArea(const RangeAllType partial_range) const override
67  {
68  const auto& spec = getCurrentSpectrum();
69  auto spec_filtered = SpectrumType();
70  spec_filtered.insert(spec_filtered.begin(), spec.MZBegin(partial_range.getMinMZ()), spec.MZEnd(partial_range.getMaxMZ()));
71  spec_filtered.updateRanges();
72  return RangeAllType().assign(spec_filtered.getRange());
73  }
74 
76  {
77  return LayerDataPeak::getSpectrum(current_idx_);
78  }
79 
80 
81  void updateRanges() override
82  {
84  }
85 
86  RangeAllType getRange1D() const override
87  {
88  return RangeAllType().assign(getCurrentSpectrum().getRange());
89  }
90 
91  // docu in base class
92  QMenu* getContextMenuAnnotation(Annotation1DItem* annot_item, bool& need_repaint) override;
93 
94  PeakIndex findClosestDataPoint(const RangeAllType& area) const override;
95 
96  // docu in base class
97  Annotation1DItem* addPeakAnnotation(const PeakIndex& peak_index, const QString& text, const QColor& color) override;
98 
102 
104  void removePeakAnnotationsFromPeptideHit(const std::vector<Annotation1DItem*>& selected_annotations);
105 
108 
109  protected:
110  };
111 
112 }// namespace OpenMS
An abstract class acting as an interface for the different 1D annotation items.
Definition: Annotation1DItem.h:62
DataFilter array providing some convenience functions.
Definition: DataFilters.h:53
Base class for all 1D layers, a special case of LayerData.
Definition: LayerData1DBase.h:54
Definition: LayerData1DPeak.h:44
LayerData1DPeak()
Definition: LayerData1DPeak.h:46
RangeAllType getRangeForArea(const RangeAllType partial_range) const override
Given a partial_range for the current 1D layer (e.g. an m/z range), fill in the other dimensions (usu...
Definition: LayerData1DPeak.h:66
std::unique_ptr< LayerStoreData > storeFullData() const override
Returns a visitor which contains the the full data of the layer and can write the data to disk in the...
std::unique_ptr< Painter1DBase > getPainter1D() const override
Obtain a painter which can draw the layer on a canvas.
void removePeakAnnotationsFromPeptideHit(const std::vector< Annotation1DItem * > &selected_annotations)
remove peak annotations in the given list from the currently active PeptideHit
QMenu * getContextMenuAnnotation(Annotation1DItem *annot_item, bool &need_repaint) override
Get a context menu (with lambda actions included) for this 1D layer, when a Annotation1DItem was righ...
void updatePeptideHitAnnotations_(PeptideHit &hit)
updates the PeakAnnotations in the current PeptideHit with manually changed annotations
bool hasIndex(Size index) const override
Does the layer have at least index items (e.g. spectra, chroms, etc), so a call to setCurrentIndex() ...
Definition: LayerData1DPeak.h:61
PeakIndex findClosestDataPoint(const RangeAllType &area) const override
Find the closest datapoint within the given range and return a proxy to that datapoint.
std::unique_ptr< LayerStoreData > storeVisibleData(const RangeAllType &visible_range, const DataFilters &layer_filters) const override
Returns a visitor which contains the current visible data and can write the data to disk.
LayerData1DPeak(const LayerDataPeak &base)
Definition: LayerData1DPeak.h:51
void updateRanges() override
Update ranges of the underlying data.
Definition: LayerData1DPeak.h:81
const ExperimentType::SpectrumType & getCurrentSpectrum() const
Definition: LayerData1DPeak.h:75
Annotation1DItem * addPeakAnnotation(const PeakIndex &peak_index, const QString &text, const QColor &color) override
Add a Annotation1DPeakItem to getCurrentAnnotations(). The specific type is determined by the derived...
RangeAllType getRange1D() const override
Definition: LayerData1DPeak.h:86
Class that stores the data for one layer.
Definition: LayerDataBase.h:195
Class that stores the data for one layer of type PeakMap.
Definition: LayerDataPeak.h:55
const ExperimentType::SpectrumType & getSpectrum(Size spectrum_idx) const
Definition: LayerDataPeak.h:101
void updateRanges() override
Update ranges of the underlying data.
Definition: LayerDataPeak.h:80
The representation of a 1D spectrum.
Definition: MSSpectrum.h:70
Representation of a peptide hit.
Definition: PeptideHit.h:57
auto & assign(const RangeManager< RangeBasesOther... > &rhs)
Definition: RangeManager.h:612
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:127
MSSpectrum SpectrumType
Definition: MzDataHandler.h:60
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:48
RangeManager< RangeRT, RangeMZ, RangeIntensity, RangeMobility > RangeAllType
Range which contains all known dimensions.
Definition: RangeManager.h:923
Index of a peak or feature.
Definition: PeakIndex.h:51