OpenMS
Annotation1DPeakItem< DataPoint > Class Template Reference

A peak annotation item. More...

#include <OpenMS/VISUAL/ANNOTATION/Annotation1DPeakItem.h>

Inheritance diagram for Annotation1DPeakItem< DataPoint >:
[legend]
Collaboration diagram for Annotation1DPeakItem< DataPoint >:
[legend]

Public Member Functions

 Annotation1DPeakItem (const DataPoint &peak_position, const QString &text, const QColor &color)
 Constructor. More...
 
 Annotation1DPeakItem (const Annotation1DPeakItem &rhs)=default
 Copy constructor. More...
 
 ~Annotation1DPeakItem () override=default
 Destructor. More...
 
void draw (Plot1DCanvas *const canvas, QPainter &painter, bool flipped=false) override
 Draws the item on painter. More...
 
void move (const PointXYType delta, const Gravitator &, const DimMapper< 2 > &dim_mapper) override
 Moves the item on the drawing canvas; behavior depends on item type and is implemented in the subclasses. More...
 
void setPosition (const DataPoint &position)
 Sets the position of the label. More...
 
const DataPoint & getPosition () const
 Returns the position of the label (peak) More...
 
const DataPoint & getPeakPosition () const
 Returns the position of the annotated peak. More...
 
void ensureWithinDataRange (Plot1DCanvas *const canvas, const int layer_index) override
 Ensures that the item has coordinates within the visible area of the canvas. More...
 
void setColor (const QColor &color)
 Set the color of the label. More...
 
const QColor & getColor () const
 Returns the color of the label. More...
 
PeptideHit::PeakAnnotation toPeakAnnotation () const
 Convert the 'text()' to a Peptide::PeakAnnotation. More...
 
Annotation1DItemclone () const override
 Creates a copy of the item on the heap and returns a pointer. More...
 
- Public Member Functions inherited from Annotation1DItem
virtual ~Annotation1DItem ()
 Destructor. More...
 
const QRectF & boundingBox () const
 Returns the current bounding box of this item on the canvas where it has last been drawn. More...
 
bool isSelected () const
 Returns true if this item is currently selected on the canvas, else false. More...
 
void setSelected (bool selected)
 Sets whether this item is currently selected on the canvas or not. More...
 
void setText (const QString &text)
 Sets the text of the item. More...
 
const QString & getText () const
 Returns the text of the item. More...
 
bool editText ()
 

Protected Attributes

DataPoint peak_position_
 The position of the anchor (e.g. the Peak1D) More...
 
DataPoint position_
 The position of the label (e.g. the Peak1D) More...
 
QColor color_
 The color of the label. More...
 
- Protected Attributes inherited from Annotation1DItem
QRectF bounding_box_
 The current bounding box of this item on the canvas where it has last been drawn. More...
 
bool selected_
 Determines whether this item is currently selected on the canvas. More...
 
QString text_
 The displayed text. More...
 

Additional Inherited Members

- Protected Member Functions inherited from Annotation1DItem
 Annotation1DItem (const QString &text)
 Constructor. More...
 
 Annotation1DItem (const Annotation1DItem &rhs)
 Copy constructor. More...
 
void drawBoundingBox_ (QPainter &painter)
 Draws the bounding_box_. More...
 

Detailed Description

template<class DataPoint>
class OpenMS::Annotation1DPeakItem< DataPoint >

A peak annotation item.

See also
Annotation1DItem

Constructor & Destructor Documentation

◆ Annotation1DPeakItem() [1/2]

Annotation1DPeakItem ( const DataPoint &  peak_position,
const QString &  text,
const QColor &  color 
)
inline

Constructor.

Referenced by Annotation1DPeakItem< DataPoint >::clone().

◆ Annotation1DPeakItem() [2/2]

Annotation1DPeakItem ( const Annotation1DPeakItem< DataPoint > &  rhs)
default

Copy constructor.

◆ ~Annotation1DPeakItem()

~Annotation1DPeakItem ( )
overridedefault

Destructor.

Member Function Documentation

◆ clone()

Annotation1DItem* clone ( ) const
inlineoverridevirtual

Creates a copy of the item on the heap and returns a pointer.

Implements Annotation1DItem.

References Annotation1DPeakItem< DataPoint >::Annotation1DPeakItem().

◆ draw()

◆ ensureWithinDataRange()

void ensureWithinDataRange ( Plot1DCanvas *const  canvas,
const int  layer_index 
)
inlineoverridevirtual

Ensures that the item has coordinates within the visible area of the canvas.

Implements Annotation1DItem.

References Annotation1DPeakItem< DataPoint >::position_, and Plot1DCanvas::pushIntoDataRange().

◆ getColor()

const QColor& getColor ( ) const
inline

Returns the color of the label.

References Annotation1DPeakItem< DataPoint >::color_.

◆ getPeakPosition()

const DataPoint& getPeakPosition ( ) const
inline

Returns the position of the annotated peak.

References Annotation1DPeakItem< DataPoint >::peak_position_.

Referenced by Annotation1DPeakItem< DataPoint >::toPeakAnnotation().

◆ getPosition()

const DataPoint& getPosition ( ) const
inline

Returns the position of the label (peak)

References Annotation1DPeakItem< DataPoint >::position_.

◆ move()

void move ( const PointXYType  delta,
const Gravitator gr,
const DimMapper< 2 > &  dim_mapper 
)
inlineoverridevirtual

Moves the item on the drawing canvas; behavior depends on item type and is implemented in the subclasses.

Implements Annotation1DItem.

References DimMapper< N_DIM >::fromXY(), DimMapper< N_DIM >::map(), and Annotation1DPeakItem< DataPoint >::position_.

◆ setColor()

void setColor ( const QColor &  color)
inline

Set the color of the label.

References Annotation1DPeakItem< DataPoint >::color_.

◆ setPosition()

void setPosition ( const DataPoint &  position)
inline

Sets the position of the label.

References Annotation1DPeakItem< DataPoint >::position_.

◆ toPeakAnnotation()

Member Data Documentation

◆ color_

◆ peak_position_

DataPoint peak_position_
protected

◆ position_