OpenMS  2.7.0
Public Types | Public Member Functions | Protected Attributes | List of all members
Annotation1DCaret Class Reference

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

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

Inheritance diagram for Annotation1DCaret:
[legend]
Collaboration diagram for Annotation1DCaret:
[legend]

Public Types

typedef Annotation1DItem::PointType PointType
 
typedef std::vector< PointTypePositionsType
 
- Public Types inherited from Annotation1DItem
typedef DPosition< 2 > PointType
 Type of the Points. More...
 
typedef float IntensityType
 Intensity type. More...
 
typedef double CoordinateType
 Coordinate type. More...
 

Public Member Functions

 Annotation1DCaret (const PositionsType &poly_positions, const QString &text, const QColor &colour, const QColor &connection_line_color)
 Constructor. More...
 
 Annotation1DCaret (const Annotation1DCaret &rhs)
 Copy constructor. More...
 
 ~Annotation1DCaret () override
 Destructor. More...
 
void ensureWithinDataRange (Plot1DCanvas *const canvas) 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 PointType &delta) override
 Moves the item; behaviour depends on item type and is implemented in the subclasses. More...
 
const PositionsTypegetCaretPositions () const
 Returns the positions of the lines (in MZ / intensity coordinates) More...
 
void setPosition (const PointType &position)
 Sets the position of the label (in MZ / intensity coordinates) More...
 
const PointTypegetPosition () const
 Returns the position of the annotated peak (in MZ / intensity coordinates) More...
 
void setColor (const QColor &color)
 Set the colour of the carets (colour of text must be set using html) More...
 
const QColor & getColor () const
 Returns the colour of the carets. More...
 
void setRichText (const QString &text)
 
- 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_
 
PointType position_
 The position of the label (in MZ/intensity coordinates) More...
 
QColor color_
 The colour of the label. More...
 
QColor connection_line_color_
 The colour 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

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

◆ PositionsType

typedef std::vector<PointType> PositionsType

Constructor & Destructor Documentation

◆ Annotation1DCaret() [1/2]

Annotation1DCaret ( const PositionsType poly_positions,
const QString &  text,
const QColor &  colour,
const QColor &  connection_line_color 
)

Constructor.

◆ Annotation1DCaret() [2/2]

Copy constructor.

◆ ~Annotation1DCaret()

~Annotation1DCaret ( )
override

Destructor.

Member Function Documentation

◆ draw()

void draw ( Plot1DCanvas *const  canvas,
QPainter &  painter,
bool  flipped = false 
)
overridevirtual

Draws the item on painter.

Implements Annotation1DItem.

◆ ensureWithinDataRange()

void ensureWithinDataRange ( Plot1DCanvas *const  canvas)
overridevirtual

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

Implements Annotation1DItem.

◆ getCaretPositions()

const PositionsType& getCaretPositions ( ) const

Returns the positions of the lines (in MZ / intensity coordinates)

◆ getColor()

const QColor& getColor ( ) const

Returns the colour of the carets.

◆ getPosition()

const PointType& getPosition ( ) const

Returns the position of the annotated peak (in MZ / intensity coordinates)

◆ move()

void move ( const PointType delta)
overridevirtual

Moves the item; behaviour depends on item type and is implemented in the subclasses.

Implements Annotation1DItem.

◆ setColor()

void setColor ( const QColor &  color)

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

◆ setPosition()

void setPosition ( const PointType position)

Sets the position of the label (in MZ / intensity coordinates)

◆ setRichText()

void setRichText ( const QString &  text)

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

Member Data Documentation

◆ caret_positions_

PositionsType caret_positions_
protected

The positions of points (in MZ/intensity coordinates) Ensure positions are sorted by m/z when assigning

◆ color_

QColor color_
protected

The colour of the label.

◆ connection_line_color_

QColor connection_line_color_
protected

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

◆ position_

PointType position_
protected

The position of the label (in MZ/intensity coordinates)

◆ st_

QStaticText st_
protected

Holds the (rich) text.