OpenMS
Annotation1DItem Class Referenceabstract

An abstract class acting as an interface for the different 1D annotation items. More...

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

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

Public Member Functions

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 ()
 
virtual void ensureWithinDataRange (Plot1DCanvas *const canvas, const int layer_index)=0
 Ensures that the item has coordinates within the visible area of the canvas. More...
 
virtual void draw (Plot1DCanvas *const canvas, QPainter &painter, bool flipped=false)=0
 Draws the item on painter. More...
 
virtual void move (const PointXYType delta, const Gravitator &gr, const DimMapper< 2 > &dim_mapper)=0
 Moves the item on the drawing canvas; behavior depends on item type and is implemented in the subclasses. More...
 
virtual Annotation1DItemclone () const =0
 Creates a copy of the item on the heap and returns a pointer. More...
 

Protected Member Functions

 Annotation1DItem (const QString &text)
 Constructor. More...
 
 Annotation1DItem (const Annotation1DItem &rhs)
 Copy constructor. More...
 
void drawBoundingBox_ (QPainter &painter)
 Draws the bounding_box_. More...
 

Protected Attributes

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...
 

Detailed Description

An abstract class acting as an interface for the different 1D annotation items.

This is an abstract polymorphic class which acts as an interface between its subclasses and all containers and methods that contain or handle Annotation1DItem objects.

If you want to add new kinds of annotation items, inherit this class, implement the pure virtual methods, and add everything else the item should have or be capable of.

Constructor & Destructor Documentation

◆ ~Annotation1DItem()

virtual ~Annotation1DItem ( )
virtual

Destructor.

◆ Annotation1DItem() [1/2]

Annotation1DItem ( const QString &  text)
protected

Constructor.

◆ Annotation1DItem() [2/2]

Annotation1DItem ( const Annotation1DItem rhs)
protected

Copy constructor.

Member Function Documentation

◆ boundingBox()

const QRectF& boundingBox ( ) const

Returns the current bounding box of this item on the canvas where it has last been drawn.

◆ clone()

virtual Annotation1DItem* clone ( ) const
pure virtual

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

Implemented in Annotation1DVerticalLineItem, Annotation1DTextItem, Annotation1DPeakItem< DataPoint >, Annotation1DDistanceItem, and Annotation1DCaret< DataPoint >.

◆ draw()

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

◆ drawBoundingBox_()

void drawBoundingBox_ ( QPainter &  painter)
protected

◆ editText()

bool editText ( )

open a GUI input field and let the user edit the text If the text was changed, true is returned; otherwise false.

◆ ensureWithinDataRange()

virtual void ensureWithinDataRange ( Plot1DCanvas *const  canvas,
const int  layer_index 
)
pure virtual

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

Implemented in Annotation1DVerticalLineItem, Annotation1DTextItem, Annotation1DPeakItem< DataPoint >, Annotation1DDistanceItem, and Annotation1DCaret< DataPoint >.

◆ getText()

const QString& getText ( ) const

◆ isSelected()

bool isSelected ( ) const

Returns true if this item is currently selected on the canvas, else false.

◆ move()

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

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

Implemented in Annotation1DVerticalLineItem, Annotation1DTextItem, Annotation1DDistanceItem, Annotation1DPeakItem< DataPoint >, and Annotation1DCaret< DataPoint >.

◆ setSelected()

void setSelected ( bool  selected)

Sets whether this item is currently selected on the canvas or not.

◆ setText()

void setText ( const QString &  text)

Sets the text of the item.

Member Data Documentation

◆ bounding_box_

QRectF bounding_box_
protected

The current bounding box of this item on the canvas where it has last been drawn.

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

◆ selected_

bool selected_
protected

Determines whether this item is currently selected on the canvas.

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

◆ text_

QString text_
protected