OpenMS
Loading...
Searching...
No Matches
Plot1DCanvas.h
Go to the documentation of this file.
1// Copyright (c) 2002-present, OpenMS Inc. -- EKU Tuebingen, ETH Zurich, and FU Berlin
2// SPDX-License-Identifier: BSD-3-Clause
3//
4// --------------------------------------------------------------------------
5// $Maintainer: Timo Sachsenberg$
6// $Authors: Marc Sturm, Timo Sachsenberg, Chris Bielow $
7// --------------------------------------------------------------------------
8
9#pragma once
10
11// OpenMS_GUI config
12#include <OpenMS/VISUAL/OpenMS_GUIConfig.h>
13
14// OpenMS
20
21// QT
22#include <QTextDocument>
23#include <QPoint>
24
25// STL
26#include <vector>
27#include <utility>
28
29// QT
30class QAction;
31
32namespace OpenMS
33{
34 class Annotation1DItem;
35
43 {
44 public:
45
47
53 {
54 setGravityAxis(axis);
55 }
56
61 Gravitator(const DimMapper<2>& unit_mapper)
62 {
63 setIntensityAsGravity(unit_mapper);
64 }
65
72 {
73 if (axis != DIM::X && axis != DIM::Y)
74 {
75 throw Exception::InvalidValue(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, "Not a valid axis for 1D plotting",StringUtils::toStr((int)axis));
76 }
77 gravity_axis_ = axis;
78 }
79
85 void setIntensityAsGravity(const DimMapper<2>& unit_mapper)
86 {
87 if (unit_mapper.getDim(DIM::X).getUnit() == DIM_UNIT::INT)
88 {
90 }
91 if (unit_mapper.getDim(DIM::Y).getUnit() == DIM_UNIT::INT)
92 {
94 }
96 throw Exception::NotImplemented(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION);
97 }
98
101 {
102 return gravity_axis_;
103 }
104
110 {
111 auto r = *this;
112 r.setGravityAxis( (r.getGravityAxis() == DIM::X) ? DIM::Y : DIM::X);
113 return r;
114 }
115
121 QPoint gravitateMin(QPoint p, const AreaXYType& area) const
122 {
123 if (gravity_axis_ == DIM::X)
124 {
125 p.rx() = area.minX();
126 }
127 else if (gravity_axis_ == DIM::Y)
128 {
129 p.ry() = area.minY();
130 }
131 return p;
132 }
133
139 QPoint gravitateWith(QPoint p, const QPoint& delta) const
140 {
141 if (gravity_axis_ == DIM::X)
142 {
143 p.rx() += delta.x();
144 }
145 else if (gravity_axis_ == DIM::Y)
146 {
147 p.ry() += delta.y();
148 }
149 return p;
150 }
151
153 template<UInt D>
155 {
156 p[(int)gravity_axis_] += delta[(int)gravity_axis_];
157 return p;
158 }
159
165 QPoint gravitateTo(QPoint p, const QPoint& target) const
166 {
167 if (gravity_axis_ == DIM::X)
168 {
169 p.rx() = target.x();
170 }
171 else if (gravity_axis_ == DIM::Y)
172 {
173 p.ry() = target.y();
174 }
175 return p;
176 }
177
179 template<UInt D>
181 {
182 p[(int)gravity_axis_] = target[(int)gravity_axis_];
183 return p;
184 }
185
186
188 QPoint gravitateMax(QPoint p, const AreaXYType& area) const
189 {
190 if (gravity_axis_ == DIM::X)
191 {
192 p.rx() = area.maxX();
193 }
194 else if (gravity_axis_ == DIM::Y)
195 {
196 p.ry() = area.maxY();
197 }
198 return p;
199 }
200
205 QPoint gravitateZero(QPoint p) const
206 {
207 if (gravity_axis_ == DIM::X)
208 {
209 p.rx() = 0;
210 }
211 else if (gravity_axis_ == DIM::Y)
212 {
213 p.ry() = 0;
214 }
215 return p;
216 }
217
222 template<UInt D>
224 {
225 p[(int)gravity_axis_] = 0;
226 return p;
227 }
228
233 template<UInt D>
235 {
236 p[(int)gravity_axis_] = std::numeric_limits<float>::quiet_NaN();
237 return p;
238 }
239
244 int gravityValue(const QPoint& p) const
245 {
246 if (gravity_axis_ == DIM::X)
247 {
248 return p.x();
249 }
250 else if (gravity_axis_ == DIM::Y)
251 {
252 return p.y();
253 }
254 // never reached, but make compilers happy
255 return 0;
256 }
261 template<UInt D>
262 auto gravityValue(const DPosition<D>& p) const
263 {
264 return p[(int)gravity_axis_];
265 }
266
272 template<UInt D>
273 auto gravityDiff(const DPosition<D>& start, const DPosition<D>& end) const
274 {
275 return end[(int)gravity_axis_] - start[(int)gravity_axis_];
276 }
277
278 private:
281 };
282
294 class OPENMS_GUI_DLLAPI Plot1DCanvas :
295 public PlotCanvas
296 {
297 Q_OBJECT
298
299public:
308
310 constexpr static double TOP_MARGIN{1.09};
311
313 Plot1DCanvas(const Param& preferences, const DIM gravity_axis = DIM::Y, QWidget* parent = nullptr);
315 ~Plot1DCanvas() override;
316
319 const LayerData1DBase& getLayer(Size index) const;
323
330
332 const DimBase& getGravityDim() const;
333
335 const DimBase& getNonGravityDim() const;
336
348 ODExperimentSharedPtrType ondisc_sptr,
349 OSWDataSharedPtrType chrom_annotation,
350 const int index,
351 const std::string& filename,
352 const std::string& basename,
353 const std::string& basename_extra);
354
355
358 {
360 DM_CONNECTEDLINES
361 };
362
365
368
369 // Docu in base class
371
374
376 void flipLayer(Size index);
377
379 bool mirrorModeActive() const;
380
383
385 void dataToWidget(const DPosition<2>& peak, QPoint& point, bool flipped = false);
387 void dataToWidget(const DPosition<2>& xy_point, DPosition<2>& point, bool flipped);
388
390 void dataToWidget(double x, double y, QPoint& point, bool flipped = false);
391
393 PointXYType widgetToData(const QPoint& pos);
394
396 PointXYType widgetToData(double x, double y);
397
401 inline void dataToWidgetDistance(double x, double y, QPoint& point)
402 {
403 dataToWidget_(x, y, point);
404 // subtract the 'offset'
405 QPoint zero;
406 dataToWidget_(0, 0, zero);
407 point -= zero;
408 }
409
413 inline PointXYType widgetToDataDistance(double x, double y)
414 {
415 PointXYType point = Plot1DCanvas::widgetToData(x, y); // call the 1D version, otherwise intensity&mirror modes will not be honored
416 // subtract the 'offset'
417 PointXYType zero = Plot1DCanvas::widgetToData(0, 0); // call the 1D version, otherwise intensity&mirror modes will not be honored
418 point -= zero;
419 return point;
420 }
421
423 virtual const RangeType& getDataRange() const override
424 {
425 return overall_data_range_1d_;
426 }
427
434 template <class T>
435 void pushIntoDataRange(T& data_point, const int layer_index)
436 { // note: if this is needed for anything other than the 1D Canvas, you need to make sure to call the correct widgetToData/ etc functions --- they work a bit different, depending on Canvas
437 auto xy_unit = unit_mapper_.map(data_point); // datatype to xy
438 pushIntoDataRange(xy_unit, layer_index);
439 unit_mapper_.fromXY(xy_unit, data_point); // xy to datatype
440 }
441
447 //template<> // specialization does not compile when declared within the class on GCC -- even though it should; but I'm not moving it outside! :)
448 void pushIntoDataRange(PointXYType& xy_unit, const int layer_index)
449 { // note: if this is needed for anything other than the 1D Canvas, you need to make sure to call the correct widgetToData/ etc functions --- they work a bit different, depending on Canvas
450 auto p_range = unit_mapper_.fromXY(xy_unit);
451 const auto all_range = getLayer(layer_index).getRange();
452 p_range.pushInto(all_range);
453 xy_unit = unit_mapper_.mapRange(p_range).minPosition();
454 }
455
457 void setTextBox(const QString& html);
458
460
462 Annotation1DItem* addPeakAnnotation(const PeakIndex& peak_index, const QString& text, const QColor& color);
463
466 void performAlignment(Size layer_index_1, Size layer_index_2, const Param& param);
467
470
473
475 double getAlignmentScore() const;
476
478 std::vector<std::pair<Size, Size> > getAlignedPeaksIndices();
479
481 void activateSpectrum(Size index, bool repaint = true);
482
484 void setCurrentLayerPeakPenStyle(Qt::PenStyle ps);
485
487 void paint(QPainter* paint_device, QPaintEvent* e);
488
490 void setDrawInterestingMZs(bool enable);
491
494
497
500
501 // Show/hide ion ladder on top right corner (Identification view)
502 void setIonLadderVisible(bool show);
503
504 // Returns true if ion ladder is visible
505 bool isIonLadderVisible() const;
506
512 {
513 return gr_;
514 }
515
516signals:
519
522
525
527 void showCurrentPeaksAsDIA(const Precursor& pc, const MSExperiment& exp);
528
529public slots:
530 // Docu in base class
531 void activateLayer(Size layer_index) override;
532 // Docu in base class
533 void removeLayer(Size layer_index) override;
534 // Docu in base class
535 void updateLayer(Size i) override;
536 // Docu in base class
537 void horizontalScrollBarChange(int value) override;
538
539protected slots:
540
543
544protected:
545
546
555 void dataToWidget_(double x, double y, QPoint& point)
556 {
557 const auto& xy = visible_area_.getAreaXY();
558 const auto h_px = height();
559 const auto w_px = width();
560
561 point.setX(int((x - xy.minX()) / xy.width() * w_px));
562
563 if (intensity_mode_ != PlotCanvas::IM_LOG)
564 {
565 point.setY(int((xy.maxY() - y) / xy.height() * h_px));
566 }
567 else // IM_LOG
568 {
569 point.setY(h_px - int(std::log10((y - xy.minY()) + 1) / std::log10(xy.height() + 1) * h_px));
570 }
571 }
572
573 void dataToWidget_(const DPosition<2>& xy, QPoint& point)
574 {
575 dataToWidget_(xy.getX(), xy.getY(), point);
576 }
577
578 QPoint dataToWidget_(const DPosition<2>& xy)
579 {
580 QPoint point;
581 dataToWidget_(xy.getX(), xy.getY(), point);
582 return point;
583 }
584
585 // Docu in base class
586 bool finishAdding_() override;
587
589 void drawCoordinates_(QPainter& painter, const PeakIndex& peak);
591 void drawDeltas_(QPainter& painter, const PeakIndex& start, const PeakIndex& end);
592
594 void drawAlignment_(QPainter& painter);
595
597 void changeVisibleArea1D_(const UnitRange& new_area, bool repaint, bool add_to_stack);
598
599 // Docu in base class
600 void changeVisibleArea_(VisibleArea new_area, bool repaint = true, bool add_to_stack = false) override;
601
607 void changeVisibleArea_(const AreaXYType& new_area, bool repaint = true, bool add_to_stack = false);
608
614 void changeVisibleArea_(const UnitRange& new_area, bool repaint = true, bool add_to_stack = false);
615
616
618 void drawHighlightedPeak_(Size layer_index, const PeakIndex& peak, QPainter& painter, bool draw_elongation = false);
619
620
628 void resetZoom(bool repaint = true) override
629 {
630 zoomClear_();
631 PlotCanvas::changeVisibleArea_(visible_area_.cloneWith(overall_data_range_1d_), repaint, true);
632 }
633
636
643 void recalculateRanges_() override
644 {
645 PlotCanvas::recalculateRanges_(); // for: overall_data_range_
646 // the same thing for: overall_data_range_1d_
647 RangeType& layer_range_1d = overall_data_range_1d_;
648 layer_range_1d.clearRanges();
649
650 for (Size layer_index = 0; layer_index < getLayerCount(); ++layer_index)
651 {
652 layer_range_1d.extend(getLayer(layer_index).getRange1D());
653 }
654 // add 4% margin (2% left, 2% right) to all dimensions, except the current gravity axes's minimum (usually intensity)
655 layer_range_1d.scaleBy(1.04);
656
657 // set minimum intensity to 0 (avoid negative intensities and show full height of peaks in case their common minimum is large)
658 auto& gravity_range = getGravityDim().map(layer_range_1d);
659 gravity_range.setMin(0);
660
661 // make sure that each dimension is not a single point (axis widget won't like that)
662 // (this needs to be the last command to ensure this property holds when leaving the function!)
663 layer_range_1d.minSpanIfSingular(1);
664 }
665
666 // Docu in base class
667 void updateScrollbars_() override;
668 // Docu in base class
669 void intensityModeChange_() override;
670
671
675
678 void paintEvent(QPaintEvent* e) override;
679 void mousePressEvent(QMouseEvent* e) override;
680 void mouseReleaseEvent(QMouseEvent* e) override;
681 void mouseMoveEvent(QMouseEvent* e) override;
682 void keyPressEvent(QKeyEvent* e) override;
683 void contextMenuEvent(QContextMenuEvent* e) override;
685
686 // docu in base class
687 void zoomForward_() override;
688 // docu in base class
689 void zoom_(int x, int y, bool zoom_in) override;
690 // docu in base class
691 void translateLeft_(Qt::KeyboardModifiers m) override;
692 // docu in base class
693 void translateRight_(Qt::KeyboardModifiers m) override;
694 // docu in base class
695 void translateForward_() override;
696 // docu in base class
697 void translateBackward_() override;
698
699 // docu in base class
700 void paintGridLines_(QPainter& painter) override;
701
709
712
714 void addUserLabelAnnotation_(const QPoint& screen_position);
716 void addLabelAnnotation_(const QPoint& screen_position, const QString& label_text);
719
722
723 friend class Painter1DChrom;
724 friend class Painter1DPeak;
726
730
733
735 std::vector<DrawModes> draw_modes_;
737 std::vector<Qt::PenStyle> peak_penstyle_;
738
742 bool mirror_mode_ = false;
744 bool moving_annotations_ = false;
746 bool show_alignment_ = false;
752 std::vector<std::pair<double, double> > aligned_peaks_mz_delta_;
754 std::vector<std::pair<Size, Size> > aligned_peaks_indices_;
756 double alignment_score_ = 0.0;
758 bool ion_ladder_visible_ = true;
760 bool draw_interesting_MZs_ = false;
762 IsobaricQuantitationMethod::MethodType tmt_method_type_ {IsobaricQuantitationMethod::MethodType::UNKNOWN};
765 std::vector<Annotation1DItem*> tmt_annotation_items_;
768 Size tmt_annotation_spectrum_idx_ = 0;
770 QTextDocument text_box_content_;
773 };
774
775
776
777
778} // namespace OpenMS
779
An abstract class acting as an interface for the different 1D annotation items.
Definition Annotation1DItem.h:36
DRange< N_DIM > AreaXYType
The Area in X,Y,(Z)... dimension (number of dimensions depends on N_DIM)
Definition DimMapper.h:848
Representation of a coordinate in D-dimensional space.
Definition DPosition.h:32
CoordinateType getY() const
Name accessor for the second dimension. Only for DPosition<2>, for visualization.
Definition DPosition.h:147
CoordinateType getX() const
Name accessor for the first dimension. Only for DPosition<2>, for visualization.
Definition DPosition.h:140
A base class for a dimension which represents a certain unit (e.g. RT or m/z). Derived classes implem...
Definition DimMapper.h:41
DIM_UNIT getUnit() const
The unit of the dimension.
Definition DimMapper.h:129
Allows dynamical switching (at runtime) between a dimension (RT, m/z, int, IM, etc) and X,...
Definition DimMapper.h:662
const DimBase & getDim(DIM d) const
obtain unit/name for X/Y/Z dimension.
Definition DimMapper.h:801
Invalid value exception.
Definition Exception.h:306
Not implemented exception.
Definition Exception.h:400
Manipulates X or Y component of points in the X-Y plane, by assuming one axis (either X or Y axis) ha...
Definition Plot1DCanvas.h:43
DIM gravity_axis_
Where are points in the X-Y plane projected onto when drawing lines?
Definition Plot1DCanvas.h:280
QPoint gravitateWith(QPoint p, const QPoint &delta) const
Definition Plot1DCanvas.h:139
void setIntensityAsGravity(const DimMapper< 2 > &unit_mapper)
Convenience function, which picks the Intensity dimension from a DimMapper as gravity axis.
Definition Plot1DCanvas.h:85
QPoint gravitateMin(QPoint p, const AreaXYType &area) const
Definition Plot1DCanvas.h:121
void setGravityAxis(DIM axis)
Definition Plot1DCanvas.h:71
int gravityValue(const QPoint &p) const
Definition Plot1DCanvas.h:244
QPoint gravitateZero(QPoint p) const
Definition Plot1DCanvas.h:205
auto gravityValue(const DPosition< D > &p) const
Definition Plot1DCanvas.h:262
QPoint gravitateTo(QPoint p, const QPoint &target) const
Definition Plot1DCanvas.h:165
QPoint gravitateMax(QPoint p, const AreaXYType &area) const
Opposite of gravitateMin()
Definition Plot1DCanvas.h:188
DPosition< D > gravitateWith(DPosition< D > p, const DPosition< D > &delta) const
Same as gravitateWith()
Definition Plot1DCanvas.h:154
DPosition< D > gravitateNAN(DPosition< D > p) const
Definition Plot1DCanvas.h:234
Gravitator swap() const
Swap gravity axis (from X to Y, or vice versa)
Definition Plot1DCanvas.h:109
Gravitator(const DimMapper< 2 > &unit_mapper)
Convenience c'tor, which picks the Intensity dimension from a DimMapper as gravity axis.
Definition Plot1DCanvas.h:61
DPosition< D > gravitateZero(DPosition< D > p) const
Definition Plot1DCanvas.h:223
auto gravityDiff(const DPosition< D > &start, const DPosition< D > &end) const
Definition Plot1DCanvas.h:273
DPosition< D > gravitateTo(DPosition< D > p, const DPosition< D > &target) const
Same as gravitateTo()
Definition Plot1DCanvas.h:180
Gravitator(DIM axis)
C'tor to apply gravity on any axis.
Definition Plot1DCanvas.h:52
DIM getGravityAxis() const
Which axis is affected by gravity?
Definition Plot1DCanvas.h:100
CoordinateType minX() const
Accessor for min_ coordinate minimum.
Definition DIntervalBase.h:268
CoordinateType maxX() const
Accessor for min_ coordinate maximum.
Definition DIntervalBase.h:280
CoordinateType maxY() const
Accessor for max_ coordinate maximum.
Definition DIntervalBase.h:286
CoordinateType minY() const
Accessor for max_ coordinate minimum.
Definition DIntervalBase.h:274
MethodType
Identifies a concrete isobaric quantitation method. UNKNOWN is used as a sentinel (disabled/none).
Definition IsobaricQuantitationMethod.h:40
Base class for all 1D layers, a special case of LayerData.
Definition LayerData1DBase.h:28
In-Memory representation of a mass spectrometry run.
Definition MSExperiment.h:49
The representation of a 1D spectrum.
Definition MSSpectrum.h:44
Painter1D for chromatograms.
Definition Painter1DBase.h:71
Painter1D for mobilograms.
Definition Painter1DBase.h:88
Painter1D for spectra.
Definition Painter1DBase.h:51
Management and storage of parameters / INI files.
Definition Param.h:46
Canvas for visualization of one or several spectra.
Definition Plot1DCanvas.h:296
void dataToWidget(const DPosition< 2 > &xy_point, DPosition< 2 > &point, bool flipped)
For convenience - calls dataToWidget.
void translateForward_() override
Translation bound to the 'Up' key.
void recalculatePercentageFactor_(Size layer_index)
Recalculates the current scale factor based on the specified layer (= 1.0 if intensity mode !...
PointXYType widgetToData(double x, double y)
Calls PlotCanvas::widgetToData_(), takes mirror mode into account.
RangeAllType correctGravityAxisOfVisibleArea_(UnitRange area)
~Plot1DCanvas() override
Destructor.
void drawCoordinates_(QPainter &painter, const PeakIndex &peak)
Draws the coordinates (or coordinate deltas) to the widget's upper left corner.
std::vector< std::pair< double, double > > aligned_peaks_mz_delta_
Stores the alignment as MZ values of pairs of aligned peaks in both spectra.
Definition Plot1DCanvas.h:752
void addUserPeakAnnotation_(PeakIndex near_peak)
Shows dialog and calls addPeakAnnotation_.
const DimBase & getGravityDim() const
Get the dimension on which gravity is currently acting upon (usually it's the Y axis' unit)
void dataToWidget(const DPosition< 2 > &peak, QPoint &point, bool flipped=false)
For convenience - calls dataToWidget.
void zoomForward_() override
Go forward in zoom history.
bool finishAdding_() override
Method that is called when a new layer has been added.
void dataToWidget(double x, double y, QPoint &point, bool flipped=false)
Calls PlotCanvas::dataToWidget_(), takes mirror mode into account.
void setTMTAnnotationMethod(IsobaricQuantitationMethod::MethodType method)
Enable TMT reporter-ion annotation overlay for the given method (MethodType::UNKNOWN = disabled).
void removeLayer(Size layer_index) override
void changeVisibleArea1D_(const UnitRange &new_area, bool repaint, bool add_to_stack)
internal method, called before calling parent function PlotCanvas::changeVisibleArea_
void mousePressEvent(QMouseEvent *e) override
void setDrawInterestingMZs(bool enable)
interesting (e.g., high-intensity) get live annotated with m/s's
DrawModes getDrawMode() const
Returns the draw mode of the current layer.
LabelMode
Label modes (percentage or absolute) of x axis and y axis.
Definition Plot1DCanvas.h:302
@ LM_XPERCENT_YABSOLUTE
Definition Plot1DCanvas.h:304
@ LM_XABSOLUTE_YPERCENT
Definition Plot1DCanvas.h:305
@ LM_XABSOLUTE_YABSOLUTE
Definition Plot1DCanvas.h:303
void horizontalScrollBarChange(int value) override
void setCurrentLayerPeakPenStyle(Qt::PenStyle ps)
Set's the Qt PenStyle of the active layer.
bool addChromLayer(ExperimentSharedPtrType chrom_exp_sptr, ODExperimentSharedPtrType ondisc_sptr, OSWDataSharedPtrType chrom_annotation, const int index, const std::string &filename, const std::string &basename, const std::string &basename_extra)
void mouseMoveEvent(QMouseEvent *e) override
std::vector< DrawModes > draw_modes_
Draw modes (for each layer) - sticks or connected lines.
Definition Plot1DCanvas.h:735
void setMirrorModeActive(bool b)
Sets whether this widget is currently in mirror mode.
void resetZoom(bool repaint=true) override
Zooms fully out and resets the zoom stack.
Definition Plot1DCanvas.h:628
void mouseReleaseEvent(QMouseEvent *e) override
void dataToWidget_(const DPosition< 2 > &xy, QPoint &point)
Definition Plot1DCanvas.h:573
void currentLayerParamtersChanged_()
Reacts on changed layer parameters.
bool isIonLadderVisible() const
PeakIndex findPeakAtPosition_(QPoint)
Find peak next to the given position.
Annotation1DItem * addPeakAnnotation(const PeakIndex &peak_index, const QString &text, const QColor &color)
--— Annotations
void changeVisibleArea_(const UnitRange &new_area, bool repaint=true, bool add_to_stack=false)
Changes visible area interval.
std::vector< Annotation1DItem * > tmt_annotation_items_
Definition Plot1DCanvas.h:765
void keyPressEvent(QKeyEvent *e) override
void activateSpectrum(Size index, bool repaint=true)
Sets current spectrum index of current layer to index.
void showCurrentPeaksAs2D()
Requests to display all spectra in 2D plot.
void showCurrentPeaksAsIonMobility(const MSSpectrum &spec)
Requests to display this spectrum (=frame) in ion mobility plot.
void updateScrollbars_() override
Updates the scroll bars.
void dataToWidgetDistance(double x, double y, QPoint &point)
converts a distance in axis values to pixel values
Definition Plot1DCanvas.h:401
DrawModes
Enumerate all available paint styles.
Definition Plot1DCanvas.h:358
@ DM_PEAKS
draw data as peak
Definition Plot1DCanvas.h:359
void showCurrentLayerPreferences() override
Shows the preferences dialog of the active layer.
void translateLeft_(Qt::KeyboardModifiers m) override
Translation bound to the 'Left' key.
bool mirrorModeActive() const
Returns whether this widget is currently in mirror mode.
void setIonLadderVisible(bool show)
void drawHighlightedPeak_(Size layer_index, const PeakIndex &peak, QPainter &painter, bool draw_elongation=false)
Draws a highlighted peak; if draw_elongation is true, the elongation line is drawn (for measuring)
void setTextBox(const QString &html)
Display a static text box on the top right.
void drawDeltas_(QPainter &painter, const PeakIndex &start, const PeakIndex &end)
Draws the coordinates (or coordinate deltas) to the widget's upper left corner.
const LayerData1DBase & getCurrentLayer() const
IsobaricQuantitationMethod::MethodType getTMTAnnotationMethod() const
Returns the currently active TMT annotation method (UNKNOWN = disabled).
void flipLayer(Size index)
Flips the layer with index up/downwards.
void performAlignment(Size layer_index_1, Size layer_index_2, const Param &param)
bool isDrawInterestingMZs() const
Return true if interesting m/s are annotated.
std::vector< std::pair< Size, Size > > aligned_peaks_indices_
Stores the peak indices of pairs of aligned peaks in both spectra.
Definition Plot1DCanvas.h:754
LayerData1DBase & getLayer(Size index)
std::vector< Qt::PenStyle > peak_penstyle_
Draw style (for each layer)
Definition Plot1DCanvas.h:737
void addLabelAnnotation_(const QPoint &screen_position, const QString &label_text)
Adds an annotation item at the given screen position.
void paint(QPainter *paint_device, QPaintEvent *e)
Actual painting takes place here.
void intensityModeChange_() override
This method is called whenever the intensity mode changes. Reimplement if you need to react on such c...
double getAlignmentScore() const
Returns the score of the alignment.
QPoint measurement_start_point_px_
start point of "ruler" in pixel coordinates for measure mode
Definition Plot1DCanvas.h:740
void activateLayer(Size layer_index) override
void changeVisibleArea_(const AreaXYType &new_area, bool repaint=true, bool add_to_stack=false)
Changes visible area interval.
void translateRight_(Qt::KeyboardModifiers m) override
Translation bound to the 'Right' key.
void showCurrentPeaksAsDIA(const Precursor &pc, const MSExperiment &exp)
Requests to display all spectra as DIA.
void updateLayer(Size i) override
void updateTMTAnnotations_()
(Re-)compute TMT reporter-ion annotations for the current spectrum.
void pushIntoDataRange(T &data_point, const int layer_index)
Pushes a data point back into the valid data range of the current layer area. Useful for annotation i...
Definition Plot1DCanvas.h:435
void contextMenuEvent(QContextMenuEvent *e) override
void addUserLabelAnnotation_(const QPoint &screen_position)
Shows dialog and calls addLabelAnnotation_.
void setDrawMode(DrawModes mode)
Sets draw mode of the current layer.
Plot1DCanvas(const Param &preferences, const DIM gravity_axis=DIM::Y, QWidget *parent=nullptr)
Default constructor.
QTextDocument text_box_content_
The text box in the upper left corner with the current data coordinates of the cursor.
Definition Plot1DCanvas.h:770
void showCurrentPeaksAs3D()
Requests to display all spectra in 3D plot.
void drawAlignment_(QPainter &painter)
Draws the alignment on painter.
void removeTMTAnnotations_()
Remove all annotation items previously added by TMT mode.
void zoom_(int x, int y, bool zoom_in) override
Zooms such that screen point x, y would still point to the same data point.
void changeVisibleArea_(VisibleArea new_area, bool repaint=true, bool add_to_stack=false) override
Sets the visible area.
const Gravitator & getGravitator() const
Get gravity manipulation object to apply gravity to points.
Definition Plot1DCanvas.h:511
const DimBase & getNonGravityDim() const
Get the dimension on which gravity is currently not acting upon (the orthogonal axis; usually it's th...
void paintGridLines_(QPainter &painter) override
Helper function to paint grid lines.
void dataToWidget_(double x, double y, QPoint &point)
Convert chart to widget coordinates.
Definition Plot1DCanvas.h:555
PointXYType widgetToData(const QPoint &pos)
For convenience - calls widgetToData.
void recalculateRanges_() override
Recalculates the overall_data_range_ (by calling PlotCanvas::recalculateRanges_) plus the overall_dat...
Definition Plot1DCanvas.h:643
void ensureAnnotationsWithinDataRange_()
Ensure that all annotations are within data range.
PointXYType widgetToDataDistance(double x, double y)
compute distance in data coordinates (unit axis as shown) when moving x/y pixel in chart/widget coord...
Definition Plot1DCanvas.h:413
RangeType overall_data_range_1d_
The data range (m/z, RT and intensity) of the current(!) spec/chrom for all layers.
Definition Plot1DCanvas.h:732
std::vector< std::pair< Size, Size > > getAlignedPeaksIndices()
Returns aligned_peaks_indices_.
Size alignment_layer_1_
Layer index of the first alignment layer.
Definition Plot1DCanvas.h:748
LayerData1DBase & getCurrentLayer()
QPoint dataToWidget_(const DPosition< 2 > &xy)
Definition Plot1DCanvas.h:578
void translateBackward_() override
Translation bound to the 'Down' key.
Size getAlignmentSize()
Returns the number of aligned pairs of peaks.
Size alignment_layer_2_
Layer index of the second alignment layer.
Definition Plot1DCanvas.h:750
void pushIntoDataRange(PointXYType &xy_unit, const int layer_index)
Pushes a data point back into the valid data range of the current layer area. Useful for annotation i...
Definition Plot1DCanvas.h:448
virtual const RangeType & getDataRange() const override
overload to call the 1D version (which has min-intensity of '0')
Definition Plot1DCanvas.h:423
const LayerData1DBase & getLayer(Size index) const
Gravitator gr_
handles pulling/pushing of points to the edges of the widget
Definition Plot1DCanvas.h:772
void paintEvent(QPaintEvent *e) override
bool flippedLayersExist()
Returns whether flipped layers exist or not.
void resetAlignment()
Resets alignment_.
Base class for visualization canvas classes.
Definition PlotCanvas.h:120
Area< 2 >::AreaXYType AreaXYType
The range of data shown on the X and Y axis (unit depends on runtime config)
Definition PlotCanvas.h:152
LayerDataBase::ExperimentSharedPtrType ExperimentSharedPtrType
Main managed data type (experiment)
Definition PlotCanvas.h:130
LayerDataBase::ODExperimentSharedPtrType ODExperimentSharedPtrType
Definition PlotCanvas.h:132
Precursor meta information.
Definition Precursor.h:37
void scaleBy(const double factor)
calls RangeBase::scale() for each dimension
Definition RangeManager.h:657
void minSpanIfSingular(const double min_span)
If any dimension is a single point, e.g. min==max, then extend this dimension by min_span / 2 on eith...
Definition RangeManager.h:670
void clearRanges()
Resets all ranges.
Definition RangeManager.h:816
void extend(const RangeManager< RangeBasesOther... > &rhs)
Definition RangeManager.h:648
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition Types.h:97
std::string toStr(int i)
Definition StringUtils.h:257
Main OpenMS namespace.
Definition openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19
std::shared_ptr< OSWData > OSWDataSharedPtrType
SharedPtr on OSWData.
Definition LayerDataChrom.h:16
DIM
Definition DimMapper.h:644
@ INT
intensity
Index of a peak or feature.
Definition PeakIndex.h:25