38 #include <OpenMS/VISUAL/OpenMS_GUIConfig.h> 47 #include <QTextDocument> 59 class Annotation1DItem;
150 p.rx() = area.
minX();
154 p.ry() = area.
minY();
217 p.rx() = area.
maxX();
221 p.ry() = area.
maxY();
261 p[(int)
gravity_axis_] = std::numeric_limits<float>::quiet_NaN();
335 constexpr
static double TOP_MARGIN{1.09};
357 const DimBase& getGravityDim()
const;
360 const DimBase& getNonGravityDim()
const;
372 bool addChromLayer(ExperimentSharedPtrType chrom_exp_sptr,
373 ODExperimentSharedPtrType ondisc_sptr,
378 const String& basename_extra);
389 DrawModes getDrawMode()
const;
392 void setDrawMode(DrawModes mode);
395 void showCurrentLayerPreferences()
override;
398 bool flippedLayersExist();
401 void flipLayer(
Size index);
404 bool mirrorModeActive()
const;
407 void setMirrorModeActive(
bool b);
410 void dataToWidget(
const DPosition<2>& peak, QPoint& point,
bool flipped =
false);
415 void dataToWidget(
double x,
double y, QPoint& point,
bool flipped =
false);
428 dataToWidget_(x, y, point);
431 dataToWidget_(0, 0, zero);
456 auto xy_unit = unit_mapper_.map(data_point);
457 pushIntoDataRange(xy_unit, layer_index);
458 unit_mapper_.fromXY(xy_unit, data_point);
469 auto p_range = unit_mapper_.fromXY(xy_unit);
470 const auto all_range = getLayer(layer_index).getRange();
471 p_range.pushInto(all_range);
472 xy_unit = unit_mapper_.mapRange(p_range).minPosition();
476 void setTextBox(
const QString& html);
485 void performAlignment(
Size layer_index_1,
Size layer_index_2,
const Param& param);
488 void resetAlignment();
491 Size getAlignmentSize();
494 double getAlignmentScore()
const;
497 std::vector<std::pair<Size, Size> > getAlignedPeaksIndices();
500 void activateSpectrum(
Size index,
bool repaint =
true);
503 void setCurrentLayerPeakPenStyle(Qt::PenStyle ps);
506 void paint(QPainter* paint_device, QPaintEvent* e);
509 void setDrawInterestingMZs(
bool enable);
512 bool isDrawInterestingMZs()
const;
515 void setIonLadderVisible(
bool show);
518 bool isIonLadderVisible()
const;
531 void showCurrentPeaksAs2D();
534 void showCurrentPeaksAs3D();
537 void showCurrentPeaksAsIonMobility(
const MSSpectrum& spec);
544 void activateLayer(
Size layer_index)
override;
546 void removeLayer(
Size layer_index)
override;
548 void updateLayer(
Size i)
override;
550 void horizontalScrollBarChange(
int value)
override;
555 void currentLayerParamtersChanged_();
570 const auto& xy = visible_area_.getAreaXY();
571 const auto h_px = height();
572 const auto w_px = width();
574 point.setX(
int((x - xy.minX()) / xy.width() * w_px));
578 point.setY(
int((xy.maxY() - y) / xy.height() * h_px));
582 point.setY(h_px -
int(std::log10((y - xy.minY()) + 1) / std::log10(xy.height() + 1) * h_px));
588 dataToWidget_(xy.
getX(), xy.
getY(), point);
594 dataToWidget_(xy.
getX(), xy.
getY(), point);
599 bool finishAdding_()
override;
602 void drawCoordinates_(QPainter& painter,
const PeakIndex& peak);
607 void drawAlignment_(QPainter& painter);
610 void changeVisibleAreaCommon_(
const UnitRange& new_area,
bool repaint,
bool add_to_stack);
613 void changeVisibleArea_(VisibleArea new_area,
bool repaint =
true,
bool add_to_stack =
false)
override;
620 void changeVisibleArea_(
const AreaXYType& new_area,
bool repaint =
true,
bool add_to_stack =
false);
627 void changeVisibleArea_(
const UnitRange& new_area,
bool repaint =
true,
bool add_to_stack =
false);
631 void drawHighlightedPeak_(
Size layer_index,
const PeakIndex& peak, QPainter& painter,
bool draw_elongation =
false);
648 void recalculatePercentageFactor_(
Size layer_index);
660 RangeType& layer_range_1d = overall_data_range_1d_;
661 layer_range_1d.clearRanges();
663 for (
Size layer_index = 0; layer_index < getLayerCount(); ++layer_index)
665 layer_range_1d.extend(getLayer(layer_index).getRange1D());
668 layer_range_1d.scaleBy(1.04);
671 auto& gravity_range = getGravityDim().map(layer_range_1d);
672 gravity_range.setMin(0);
676 layer_range_1d.minSpanIfSingular(1);
680 void updateScrollbars_()
override;
682 void intensityModeChange_()
override;
687 RangeAllType correctGravityAxisOfVisibleArea_(UnitRange area);
691 void paintEvent(QPaintEvent* e)
override;
692 void mousePressEvent(QMouseEvent* e)
override;
693 void mouseReleaseEvent(QMouseEvent* e)
override;
694 void mouseMoveEvent(QMouseEvent* e)
override;
695 void keyPressEvent(QKeyEvent* e)
override;
696 void contextMenuEvent(QContextMenuEvent* e)
override;
700 void zoomForward_()
override;
702 void zoom_(
int x,
int y,
bool zoom_in)
override;
704 void translateLeft_(Qt::KeyboardModifiers m)
override;
706 void translateRight_(Qt::KeyboardModifiers m)
override;
708 void translateForward_()
override;
710 void translateBackward_()
override;
713 void paintGridLines_(QPainter& painter)
override;
719 void addUserLabelAnnotation_(
const QPoint& screen_position);
721 void addLabelAnnotation_(
const QPoint& screen_position,
const QString& label_text);
723 void addUserPeakAnnotation_(
PeakIndex near_peak);
726 void ensureAnnotationsWithinDataRange_();
747 bool mirror_mode_ =
false;
749 bool moving_annotations_ =
false;
751 bool show_alignment_ =
false;
761 double alignment_score_ = 0.0;
763 bool ion_ladder_visible_ =
true;
765 bool draw_interesting_MZs_ =
false;
An abstract class acting as an interface for the different 1D annotation items.
Definition: Annotation1DItem.h:61
void dataToWidget_(const DPosition< 2 > &xy, QPoint &point)
Definition: Plot1DCanvas.h:586
std::vector< Qt::PenStyle > peak_penstyle_
Draw style (for each layer)
Definition: Plot1DCanvas.h:742
Size alignment_layer_1_
Layer index of the first alignment layer.
Definition: Plot1DCanvas.h:753
A more convenient string class.
Definition: String.h:58
std::vector< DrawModes > draw_modes_
Draw modes (for each layer) - sticks or connected lines.
Definition: Plot1DCanvas.h:740
Precursor meta information.
Definition: Precursor.h:58
std::vector< std::pair< Size, Size > > aligned_peaks_indices_
Stores the peak indices of pairs of aligned peaks in both spectra.
Definition: Plot1DCanvas.h:759
CoordinateType maxX() const
Accessor for min_ coordinate maximum.
Definition: DIntervalBase.h:306
Gravitator(DIM axis)
C'tor to apply gravity on any axis.
Definition: Plot1DCanvas.h:77
Canvas for visualization of one or several spectra.
Definition: Plot1DCanvas.h:319
void dataToWidgetDistance(double x, double y, QPoint &point)
converts a distance in axis values to pixel values
Definition: Plot1DCanvas.h:426
DPosition< D > gravitateWith(DPosition< D > p, const DPosition< D > &delta) const
Same as gravitateWith()
Definition: Plot1DCanvas.h:179
Gravitator swap() const
Swap gravity axis (from X to Y, or vice versa)
Definition: Plot1DCanvas.h:134
Definition: Plot1DCanvas.h:329
virtual void recalculateRanges_()
Recalculates the overall_data_range_.
int gravityValue(const QPoint &p) const
Definition: Plot1DCanvas.h:269
boost::shared_ptr< OSWData > OSWDataSharedPtrType
SharedPtr on OSWData.
Definition: LayerDataChrom.h:42
CoordinateType getY() const
Name accessor for the second dimension. Only for DPosition<2>, for visualization. ...
Definition: DPosition.h:175
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
QPoint gravitateMax(QPoint p, const AreaXYType &area) const
Opposite of gravitateMin()
Definition: Plot1DCanvas.h:213
draw data as peak
Definition: Plot1DCanvas.h:384
PointXYType widgetToData(const QPoint &pos)
For convenience - calls widgetToData.
Definition: Plot1DCanvas.h:328
Base class for all 1D layers, a special case of LayerData.
Definition: LayerData1DBase.h:53
void recalculateRanges_() override
Recalculates the overall_data_range_ (by calling PlotCanvas::recalculateRanges_) plus the overall_dat...
Definition: Plot1DCanvas.h:656
CoordinateType getX() const
Name accessor for the first dimension. Only for DPosition<2>, for visualization.
Definition: DPosition.h:168
void setIntensityAsGravity(const DimMapper< 2 > &unit_mapper)
Convenience function, which picks the Intensity dimension from a DimMapper as gravity axis...
Definition: Plot1DCanvas.h:110
The representation of a 1D spectrum.
Definition: MSSpectrum.h:66
DPosition< D > gravitateTo(DPosition< D > p, const DPosition< D > &target) const
Same as gravitateTo()
Definition: Plot1DCanvas.h:205
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:454
virtual void changeVisibleArea_(VisibleArea new_area, bool repaint=true, bool add_to_stack=false)
Sets the visible area.
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:438
QPoint gravitateMin(QPoint p, const AreaXYType &area) const
Definition: Plot1DCanvas.h:146
QPoint measurement_start_point_px_
start point of "ruler" in pixel coordinates for measure mode
Definition: Plot1DCanvas.h:745
const Gravitator & getGravitator() const
Get gravity manipulation object to apply gravity to points.
Definition: Plot1DCanvas.h:524
QPoint gravitateTo(QPoint p, const QPoint &target) const
Definition: Plot1DCanvas.h:190
LabelMode
Label modes (percentage or absolute) of x axis and y axis.
Definition: Plot1DCanvas.h:326
const DimBase & getDim(DIM d) const
obtain unit/name for X/Y/Z dimension.
Definition: DimMapper.h:784
A base class for a dimension which represents a certain unit (e.g. RT or m/z). Derived classes implem...
Definition: DimMapper.h:66
void resetZoom(bool repaint=true) override
Zooms fully out and resets the zoom stack.
Definition: Plot1DCanvas.h:641
int gravityValue(const DPosition< D > &p) const
Definition: Plot1DCanvas.h:287
Logarithmic version of normal mode.
Definition: PlotCanvas.h:207
RangeType overall_data_range_1d_
The data range (m/z, RT and intensity) of the current(!) spec/chrom for all layers.
Definition: Plot1DCanvas.h:737
DPosition< D > gravitateNAN(DPosition< D > p) const
Definition: Plot1DCanvas.h:259
QTextDocument text_box_content_
The text box in the upper left corner with the current data coordinates of the cursor.
Definition: Plot1DCanvas.h:767
auto gravityDiff(const DPosition< D > &start, const DPosition< D > &end) const
Definition: Plot1DCanvas.h:298
CoordinateType minY() const
Accessor for max_ coordinate minimum.
Definition: DIntervalBase.h:300
CoordinateType maxY() const
Accessor for max_ coordinate maximum.
Definition: DIntervalBase.h:312
DIM
Definition: DimMapper.h:626
Painter1D for mobilograms.
Definition: Painter1DBase.h:113
Management and storage of parameters / INI files.
Definition: Param.h:69
Invalid value exception.
Definition: Exception.h:327
In-Memory representation of a mass spectrometry run.
Definition: MSExperiment.h:70
DPosition< D > gravitateZero(DPosition< D > p) const
Definition: Plot1DCanvas.h:248
DIM gravity_axis_
Where are points in the X-Y plane projected onto when drawing lines?
Definition: Plot1DCanvas.h:305
DIM_UNIT getUnit() const
The unit of the dimension.
Definition: DimMapper.h:155
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:127
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:757
CoordinateType minX() const
Accessor for min_ coordinate minimum.
Definition: DIntervalBase.h:294
Definition: Plot1DCanvas.h:330
QPoint dataToWidget_(const DPosition< 2 > &xy)
Definition: Plot1DCanvas.h:591
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:467
DRange< N_DIM > AreaXYType
The Area in X,Y,(Z)... dimension (number of dimensions depends on N_DIM)
Definition: DimMapper.h:822
Size alignment_layer_2_
Layer index of the second alignment layer.
Definition: Plot1DCanvas.h:755
void dataToWidget_(double x, double y, QPoint &point)
Convert chart to widget coordinates.
Definition: Plot1DCanvas.h:568
DIM getGravityAxis() const
Which axis is affected by gravity?
Definition: Plot1DCanvas.h:125
Base class for visualization canvas classes.
Definition: PlotCanvas.h:145
QPoint gravitateWith(QPoint p, const QPoint &delta) const
Definition: Plot1DCanvas.h:164
void setGravityAxis(DIM axis)
Definition: Plot1DCanvas.h:96
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:67
Painter1D for spectra.
Definition: Painter1DBase.h:76
DrawModes
Enumerate all available paint styles.
Definition: Plot1DCanvas.h:382
Painter1D for chromatograms.
Definition: Painter1DBase.h:96
Not implemented exception.
Definition: Exception.h:428
Gravitator(const DimMapper< 2 > &unit_mapper)
Convenience c'tor, which picks the Intensity dimension from a DimMapper as gravity axis...
Definition: Plot1DCanvas.h:86
Index of a peak or feature.
Definition: PeakIndex.h:50
QPoint gravitateZero(QPoint p) const
Definition: Plot1DCanvas.h:230
Gravitator gr_
handles pulling/pushing of points to the edges of the widget
Definition: Plot1DCanvas.h:769