OpenMS
Annotation1DCaret< DataPoint > Class Template Reference

An annotation item which paints a set of carets on the canvas. More...

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

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

Public Types

typedef std::vector< DataPoint > PositionsType
 
using PointType = DataPoint
 

Public Member Functions

 Annotation1DCaret (const PositionsType &caret_positions, const QString &text, const QColor &color, const QColor &connection_line_color)
 Constructor. More...
 
 Annotation1DCaret (const Annotation1DCaret &rhs)=default
 Copy constructor. More...
 
 ~Annotation1DCaret () override=default
 Destructor. 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 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...
 
const PositionsTypegetCaretPositions () const
 Returns the positions of the lines (in unit coordinates) More...
 
void setPosition (const DataPoint &position)
 Sets the position of the label (in unit coordinates) More...
 
const DataPoint & getPosition () const
 Returns the position of the annotated peak (in unit coordinates) More...
 
void setColor (const QColor &color)
 Set the color of the carets (color of text must be set using html) More...
 
const QColor & getColor () const
 Returns the color of the carets. More...
 
void setRichText (const QString &text)
 
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

PositionsType caret_positions_
 
DataPoint position_
 The position of the label (in unit coordinates) More...
 
QColor color_
 The color of the label. More...
 
QColor connection_line_color_
 The color of the (optional) dashed line connecting peak and label. More...
 
QStaticText st_
 Holds the (rich) text. 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::Annotation1DCaret< DataPoint >

An annotation item which paints a set of carets on the canvas.

Most useful to visualize (theoretical) isotope distributions (one caret per isotope position). Additionally, a text annotation can be provided.

See also
Annotation1DItem

Member Typedef Documentation

◆ PointType

using PointType = DataPoint

◆ PositionsType

typedef std::vector<DataPoint> PositionsType

Constructor & Destructor Documentation

◆ Annotation1DCaret() [1/2]

Annotation1DCaret ( const PositionsType caret_positions,
const QString &  text,
const QColor &  color,
const QColor &  connection_line_color 
)
inline

◆ Annotation1DCaret() [2/2]

Annotation1DCaret ( const Annotation1DCaret< DataPoint > &  rhs)
default

Copy constructor.

◆ ~Annotation1DCaret()

~Annotation1DCaret ( )
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 Annotation1DCaret< DataPoint >::Annotation1DCaret().

◆ 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 Annotation1DCaret< DataPoint >::position_, and Plot1DCanvas::pushIntoDataRange().

◆ getCaretPositions()

const PositionsType& getCaretPositions ( ) const
inline

Returns the positions of the lines (in unit coordinates)

References Annotation1DCaret< DataPoint >::caret_positions_.

◆ getColor()

const QColor& getColor ( ) const
inline

Returns the color of the carets.

References Annotation1DCaret< DataPoint >::color_.

◆ getPosition()

const DataPoint& getPosition ( ) const
inline

Returns the position of the annotated peak (in unit coordinates)

References Annotation1DCaret< 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 Annotation1DCaret< DataPoint >::position_.

◆ setColor()

void setColor ( const QColor &  color)
inline

Set the color of the carets (color of text must be set using html)

References Annotation1DCaret< DataPoint >::color_.

◆ setPosition()

void setPosition ( const DataPoint &  position)
inline

Sets the position of the label (in unit coordinates)

References Annotation1DCaret< DataPoint >::position_.

◆ setRichText()

void setRichText ( const QString &  text)
inline

The text to display (optional). Rendered using QStaticText, so HTML formatting is allowed.

References Annotation1DCaret< DataPoint >::st_, and Annotation1DItem::text_.

Member Data Documentation

◆ caret_positions_

PositionsType caret_positions_
protected

The positions of points (in unit coordinates) Ensure positions are sorted by m/z axis (or equivalent) when assigning

Referenced by Annotation1DCaret< DataPoint >::draw(), and Annotation1DCaret< DataPoint >::getCaretPositions().

◆ color_

◆ connection_line_color_

QColor connection_line_color_
protected

The color of the (optional) dashed line connecting peak and label.

◆ position_

◆ st_