OpenMS
LayerData1DPeak.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 namespace OpenMS
15 {
16 
17  class OPENMS_GUI_DLLAPI LayerData1DPeak : public LayerDataPeak, public LayerData1DBase
18  {
19  public:
21  : LayerDataBase(DT_PEAK)
22  {
23  }
24 
26  {
27  }
28 
29 
30  std::unique_ptr<LayerStoreData> storeVisibleData(const RangeAllType& visible_range, const DataFilters& layer_filters) const override;
31  std::unique_ptr<LayerStoreData> storeFullData() const override;
32 
33  std::unique_ptr<Painter1DBase> getPainter1D() const override;
34 
35  bool hasIndex(Size index) const override
36  {
37  return index < peak_map_->size();
38  }
39 
40  RangeAllType getRangeForArea(const RangeAllType partial_range) const override
41  {
42  const auto& spec = getCurrentSpectrum();
43  auto spec_filtered = SpectrumType();
44  spec_filtered.insert(spec_filtered.begin(), spec.MZBegin(partial_range.getMinMZ()), spec.MZEnd(partial_range.getMaxMZ()));
45  spec_filtered.updateRanges();
46  return RangeAllType().assign(spec_filtered.getRange());
47  }
48 
50  {
51  return LayerDataPeak::getSpectrum(current_idx_);
52  }
53 
54 
55  void updateRanges() override
56  {
58  }
59 
60  RangeAllType getRange1D() const override
61  {
62  return RangeAllType().assign(getCurrentSpectrum().getRange());
63  }
64 
65  // docu in base class
66  QMenu* getContextMenuAnnotation(Annotation1DItem* annot_item, bool& need_repaint) override;
67 
68  PeakIndex findClosestDataPoint(const RangeAllType& area) const override;
69 
70  // docu in base class
71  Annotation1DItem* addPeakAnnotation(const PeakIndex& peak_index, const QString& text, const QColor& color) override;
72 
76 
78  void removePeakAnnotationsFromPeptideHit(const std::vector<Annotation1DItem*>& selected_annotations);
79 
82 
83  protected:
84  };
85 
86 }// namespace OpenMS
An abstract class acting as an interface for the different 1D annotation items.
Definition: Annotation1DItem.h:36
DataFilter array providing some convenience functions.
Definition: DataFilters.h:27
Base class for all 1D layers, a special case of LayerData.
Definition: LayerData1DBase.h:28
Definition: LayerData1DPeak.h:18
LayerData1DPeak()
Definition: LayerData1DPeak.h:20
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:40
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:35
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:25
void updateRanges() override
Update ranges of the underlying data.
Definition: LayerData1DPeak.h:55
const ExperimentType::SpectrumType & getCurrentSpectrum() const
Definition: LayerData1DPeak.h:49
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:60
Class that stores the data for one layer.
Definition: LayerDataBase.h:169
Class that stores the data for one layer of type PeakMap.
Definition: LayerDataPeak.h:29
const ExperimentType::SpectrumType & getSpectrum(Size spectrum_idx) const
Definition: LayerDataPeak.h:75
void updateRanges() override
Update ranges of the underlying data.
Definition: LayerDataPeak.h:54
The representation of a 1D spectrum.
Definition: MSSpectrum.h:44
Representation of a peptide hit.
Definition: PeptideHit.h:31
auto & assign(const RangeManager< RangeBasesOther... > &rhs)
Definition: RangeManager.h:593
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:97
MSSpectrum SpectrumType
Definition: MzDataHandler.h:34
Main OpenMS namespace.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19
RangeManager< RangeRT, RangeMZ, RangeIntensity, RangeMobility > RangeAllType
Range which contains all known dimensions.
Definition: RangeManager.h:892
Index of a peak or feature.
Definition: PeakIndex.h:25