OpenMS  2.7.0
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
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 Types

typedef DPosition< 2 > PointType
 Type of the Points. More...
 
typedef float IntensityType
 Intensity type. More...
 
typedef double CoordinateType
 Coordinate type. More...
 

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)=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 PointType &delta)=0
 Moves the item; behaviour depends on item type and is implemented in the subclasses. 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.

Member Typedef Documentation

◆ CoordinateType

typedef double CoordinateType

Coordinate type.

◆ IntensityType

typedef float IntensityType

Intensity type.

◆ PointType

typedef DPosition<2> PointType

Type of the Points.

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.

◆ draw()

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

◆ drawBoundingBox_()

void drawBoundingBox_ ( QPainter &  painter)
protected

Draws the bounding_box_.

◆ 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)
pure virtual

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

Implemented in Annotation1DVerticalLineItem, Annotation1DTextItem, Annotation1DPeakItem, Annotation1DDistanceItem, and Annotation1DCaret.

◆ getText()

const QString& getText ( ) const

Returns the text of the item.

◆ isSelected()

bool isSelected ( ) const

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

◆ move()

virtual void move ( const PointType delta)
pure virtual

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

Implemented in Annotation1DVerticalLineItem, Annotation1DTextItem, Annotation1DDistanceItem, Annotation1DCaret, and Annotation1DPeakItem.

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

◆ selected_

bool selected_
protected

Determines whether this item is currently selected on the canvas.

◆ text_

QString text_
protected

The displayed text.