OpenMS  2.8.0
Public Member Functions | Protected Attributes | List of all members
Annotation1DVerticalLineItem Class Reference

An annotation item which represents a vertical line and text label on top. More...

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

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

Public Member Functions

 Annotation1DVerticalLineItem (const double x_pos, const QColor &color=QColor("as_before"), const QString &text="")
 
 Annotation1DVerticalLineItem (const double x_center_pos, const double width, const int alpha255=128, const bool dashed_line=false, const QColor &color=QColor("as_before"), const QString &text="")
 
 Annotation1DVerticalLineItem (const Annotation1DVerticalLineItem &rhs)=default
 Copy constructor. More...
 
 ~Annotation1DVerticalLineItem () override=default
 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...
 
void setPosition (const double &x)
 Sets the uppermost position of the line. More...
 
const double & getPosition () const
 Returns the position. More...
 
QRectF getTextRect () const
 size of the painted text (width and height of the rectangle) More...
 
void setTextYOffset (int y_offset)
 offset the text by this much downwards in y-direction (to avoid overlaps etc) 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

double x_ = -1
 The position of the vertical line. More...
 
int y_text_offset_ {0}
 offset in y for the text (to avoid overlaps) More...
 
float width_ = 1
 width of the item (allowing to show a 'band' if > 1) More...
 
float alpha255_ = 128
 transparency 0...255 of the band/line More...
 
bool dashed_ {false}
 is the band/line dashed? More...
 
QColor color_ = Qt::black
 The color of the line; if invalid, the current painter color will be used. 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

- 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...
 
- 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 represents a vertical line and text label on top.

See also
Annotation1DItem

Constructor & Destructor Documentation

◆ Annotation1DVerticalLineItem() [1/3]

Annotation1DVerticalLineItem ( const double  x_pos,
const QColor &  color = QColor("as_before"),
const QString &  text = "" 
)

Constructor for a single vertical line of 1px width.

Parameters
x_posX-coordinate as show on the axis
colorOptional color. If invalid (=default), the current painter color will be used when this is painted
textOptional text displayed next to the line. Can contain '
' which will force multiple lines.

◆ Annotation1DVerticalLineItem() [2/3]

Annotation1DVerticalLineItem ( const double  x_center_pos,
const double  width,
const int  alpha255 = 128,
const bool  dashed_line = false,
const QColor &  color = QColor("as_before"),
const QString &  text = "" 
)

Constructor for a single vertical line of 1px width or a broader line (band) with the given width

Parameters
x_center_posX-coordinate of the center as show on the axis
widthFull width of the band; use 0 or 1 for a 1px line.
alpha255A transparency value from 0 (not visible), to 255 (fully opaque)
dashed_lineShould the line/band be dashed
colorOptional color. If invalid (=default), the current painter color will be used when this is painted
textOptional text displayed next to the line/band. Can contain '
' which will force multiple lines. Text will be plotted at the very top (modify using setTextYOffset())

◆ Annotation1DVerticalLineItem() [3/3]

Copy constructor.

◆ ~Annotation1DVerticalLineItem()

~Annotation1DVerticalLineItem ( )
overridedefault

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.

◆ getPosition()

const double& getPosition ( ) const

Returns the position.

◆ getTextRect()

QRectF getTextRect ( ) const

size of the painted text (width and height of the rectangle)

◆ move()

void move ( const PointType delta)
overridevirtual

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

Implements Annotation1DItem.

◆ setPosition()

void setPosition ( const double &  x)

Sets the uppermost position of the line.

◆ setTextYOffset()

void setTextYOffset ( int  y_offset)

offset the text by this much downwards in y-direction (to avoid overlaps etc)

Member Data Documentation

◆ alpha255_

float alpha255_ = 128
protected

transparency 0...255 of the band/line

◆ color_

QColor color_ = Qt::black
protected

The color of the line; if invalid, the current painter color will be used.

◆ dashed_

bool dashed_ {false}
protected

is the band/line dashed?

◆ width_

float width_ = 1
protected

width of the item (allowing to show a 'band' if > 1)

◆ x_

double x_ = -1
protected

The position of the vertical line.

◆ y_text_offset_

int y_text_offset_ {0}
protected

offset in y for the text (to avoid overlaps)