OpenMS
LayerData1DChrom.h
Go to the documentation of this file.
1 // Copyright (c) 2002-2023, 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  class OPENMS_GUI_DLLAPI LayerData1DChrom : public LayerDataChrom, public LayerData1DBase
17  {
18  public:
19  LayerData1DChrom() : LayerDataBase(DT_CHROMATOGRAM)
20  {
21  }
22 
24  {
25  }
26 
27  std::unique_ptr<LayerStoreData> storeVisibleData(const RangeAllType& visible_range, const DataFilters& layer_filters) const override;
28  std::unique_ptr<LayerStoreData> storeFullData() const override;
29 
30  std::unique_ptr<Painter1DBase> getPainter1D() const override;
31 
32  bool hasIndex(Size index) const override
33  {
34  return index < chromatogram_map_->getNrChromatograms();
35  }
36 
37  RangeAllType getRangeForArea(const RangeAllType partial_range) const override
38  {
39  const auto& chrom = getCurrentChrom();
40  auto chrom_filtered = MSExperiment::ChromatogramType();
41  chrom_filtered.insert(chrom_filtered.begin(), chrom.RTBegin(partial_range.getMinRT()), chrom.RTEnd(partial_range.getMaxRT()));
42  chrom_filtered.updateRanges();
43  return RangeAllType().assign(chrom_filtered.getRange());
44  }
45 
46  RangeAllType getRange1D() const override
47  {
48  return RangeAllType().assign(getCurrentChrom().getRange());
49  }
50 
52  {
53  return getChromatogram(current_idx_);
54  }
55 
56  void updateRanges() override
57  {
59  }
60 
61  RangeAllType getRange() const override
62  {
63  // do NOT change the behaviour of getRange() for 1D, since we want the full RT range across all chroms
64  // when scrolling in the list of chroms
65  return LayerDataChrom::getRange();
66  }
67 
68  // docu in base class
69  QMenu* getContextMenuAnnotation(Annotation1DItem* annot_item, bool& need_repaint) override;
70 
71  PeakIndex findClosestDataPoint(const RangeAllType& area) const override;
72 
73  // docu in base class
74  Annotation1DItem* addPeakAnnotation(const PeakIndex& peak_index, const QString& text, const QColor& color) override;
75 
76  protected:
78  //ExperimentType::SpectrumType cached_spectrum_;
79  };
80 
81 } // 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: LayerData1DChrom.h:17
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: LayerData1DChrom.h:37
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.
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...
RangeAllType getRange() const override
Definition: LayerData1DChrom.h:61
LayerData1DChrom(const LayerDataChrom &base)
Definition: LayerData1DChrom.h:23
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: LayerData1DChrom.h:32
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.
LayerData1DChrom()
Definition: LayerData1DChrom.h:19
void updateRanges() override
Update ranges of the underlying data.
Definition: LayerData1DChrom.h:56
const ExperimentType::ChromatogramType & getCurrentChrom() const
Definition: LayerData1DChrom.h:51
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: LayerData1DChrom.h:46
Class that stores the data for one layer.
Definition: LayerDataBase.h:169
Class that stores the data for one layer of type Chromatogram.
Definition: LayerDataChrom.h:24
RangeAllType getRange() const override
Definition: LayerDataChrom.h:50
void updateRanges() override
Update ranges of the underlying data.
Definition: LayerDataChrom.h:45
The representation of a chromatogram.
Definition: MSChromatogram.h:31
MSChromatogram ChromatogramType
Chromatogram type.
Definition: MSExperiment.h:69
auto & assign(const RangeManager< RangeBasesOther... > &rhs)
Definition: RangeManager.h:586
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:101
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:22
RangeManager< RangeRT, RangeMZ, RangeIntensity, RangeMobility > RangeAllType
Range which contains all known dimensions.
Definition: RangeManager.h:897
Index of a peak or feature.
Definition: PeakIndex.h:25