![]() |
OpenMS
|
A peak annotation item. More...
#include <OpenMS/VISUAL/ANNOTATION/Annotation1DPeakItem.h>
Public Member Functions | |
| Annotation1DPeakItem (const DataPoint &peak_position, const QString &text, const QColor &color, int charge=0) | |
| Constructor. | |
| Annotation1DPeakItem (const Annotation1DPeakItem &rhs)=default | |
| Copy constructor. | |
| ~Annotation1DPeakItem () override=default | |
| Destructor. | |
| void | draw (Plot1DCanvas *const canvas, QPainter &painter, bool flipped=false) override |
Draws the item on painter. | |
| 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. | |
| void | setPosition (const DataPoint &position) |
| Sets the position of the label. | |
| const DataPoint & | getPosition () const |
| Returns the position of the label (peak) | |
| const DataPoint & | getPeakPosition () const |
| Returns the position of the annotated peak. | |
| void | ensureWithinDataRange (Plot1DCanvas *const canvas, const int layer_index) override |
| Ensures that the item has coordinates within the visible area of the canvas. | |
| void | setColor (const QColor &color) |
| Set the color of the label. | |
| const QColor & | getColor () const |
| Returns the color of the label. | |
| PeptideHit::PeakAnnotation | toPeakAnnotation () const |
| Convert the 'text()' to a Peptide::PeakAnnotation. | |
| Annotation1DItem * | clone () const override |
| Creates a copy of the item on the heap and returns a pointer. | |
Public Member Functions inherited from Annotation1DItem | |
| virtual | ~Annotation1DItem () |
| Destructor. | |
| const QRectF & | boundingBox () const |
| Returns the current bounding box of this item on the canvas where it has last been drawn. | |
| bool | isSelected () const |
| Returns true if this item is currently selected on the canvas, else false. | |
| void | setSelected (bool selected) |
| Sets whether this item is currently selected on the canvas or not. | |
| void | setText (const QString &text) |
| Sets the text of the item. | |
| const QString & | getText () const |
| Returns the text of the item. | |
| bool | editText () |
Protected Attributes | |
| DataPoint | peak_position_ |
| The position of the anchor (e.g. the Peak1D) | |
| DataPoint | position_ |
| The position of the label (e.g. the Peak1D) | |
| QColor | color_ |
| The color of the label. | |
| int | charge_ = 0 |
| Charge of the annotated peak when its name does not spell one out; 0 if unknown or already named. | |
Protected Attributes inherited from Annotation1DItem | |
| QRectF | bounding_box_ |
| The current bounding box of this item on the canvas where it has last been drawn. | |
| bool | selected_ |
| Determines whether this item is currently selected on the canvas. | |
| QString | text_ |
| The displayed text. | |
Additional Inherited Members | |
Protected Member Functions inherited from Annotation1DItem | |
| Annotation1DItem (const QString &text) | |
| Constructor. | |
| Annotation1DItem (const Annotation1DItem &rhs) | |
| Copy constructor. | |
| void | drawBoundingBox_ (QPainter &painter) |
| Draws the bounding_box_. | |
A peak annotation item.
|
inline |
Constructor.
charge is the charge of the annotated peak for producers that keep it in PeptideHit::PeakAnnotation::charge rather than spelling it out in text. It is drawn next to the ion name but deliberately kept out of text, so that reading the item back yields the name the producer wrote: putting it into the text made every redraw rewrite the stored annotation. Pass 0 (the default) when the text is all there is, as for a plain user label.
| [in] | peak_position | The peak this annotation belongs to |
| [in] | text | The annotation text, i.e. the ion name as the producer wrote it |
| [in] | color | The colour to draw it in |
| [in] | charge | Charge of the peak when text does not spell one out, 0 otherwise |
|
default |
Copy constructor.
|
overridedefault |
Destructor.
|
inlineoverridevirtual |
Creates a copy of the item on the heap and returns a pointer.
Implements Annotation1DItem.
|
inlineoverridevirtual |
Draws the item on painter.
Implements Annotation1DItem.
References DPosition< D, TCoordinateType >::abs(), Annotation1DItem::bounding_box_, Annotation1DPeakItem< DataPoint >::charge_, OpenMS::IonNaming::chargeFromName(), Annotation1DPeakItem< DataPoint >::color_, Plot1DCanvas::dataToWidget(), Annotation1DItem::drawBoundingBox_(), OpenMS::fromQString(), Plot1DCanvas::getGravitator(), PlotCanvas::getMapper(), Annotation1DItem::getText(), Gravitator::gravitateZero(), OpenMS::GUIHelpers::intersectionPoint(), DimMapper< N_DIM >::map(), Annotation1DPeakItem< DataPoint >::peak_position_, Annotation1DPeakItem< DataPoint >::position_, Annotation1DItem::selected_, Gravitator::swap(), Annotation1DItem::text_, and Plot1DCanvas::widgetToDataDistance().
|
inlineoverridevirtual |
Ensures that the item has coordinates within the visible area of the canvas.
Implements Annotation1DItem.
References Annotation1DPeakItem< DataPoint >::position_, and Plot1DCanvas::pushIntoDataRange().
|
inline |
Returns the color of the label.
References Annotation1DPeakItem< DataPoint >::color_.
|
inline |
Returns the position of the annotated peak.
References Annotation1DPeakItem< DataPoint >::peak_position_.
Referenced by Annotation1DPeakItem< DataPoint >::toPeakAnnotation().
|
inline |
Returns the position of the label (peak)
References Annotation1DPeakItem< DataPoint >::position_.
|
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 Annotation1DPeakItem< DataPoint >::position_.
|
inline |
Set the color of the label.
References Annotation1DPeakItem< DataPoint >::color_.
|
inline |
Sets the position of the label.
References Annotation1DPeakItem< DataPoint >::position_.
|
inline |
Convert the 'text()' to a Peptide::PeakAnnotation.
References PeptideHit::PeakAnnotation::annotation, PeptideHit::PeakAnnotation::charge, Annotation1DPeakItem< DataPoint >::charge_, OpenMS::IonNaming::chargeFromName(), OpenMS::fromQString(), Annotation1DPeakItem< DataPoint >::getPeakPosition(), Annotation1DItem::getText(), PeptideHit::PeakAnnotation::intensity, and PeptideHit::PeakAnnotation::mz.
|
protected |
Charge of the annotated peak when its name does not spell one out; 0 if unknown or already named.
Referenced by Annotation1DPeakItem< DataPoint >::draw(), and Annotation1DPeakItem< DataPoint >::toPeakAnnotation().
|
protected |
The color of the label.
Referenced by Annotation1DPeakItem< DataPoint >::draw(), Annotation1DPeakItem< DataPoint >::getColor(), and Annotation1DPeakItem< DataPoint >::setColor().
|
protected |
The position of the anchor (e.g. the Peak1D)
Referenced by Annotation1DPeakItem< DataPoint >::draw(), and Annotation1DPeakItem< DataPoint >::getPeakPosition().
|
protected |
The position of the label (e.g. the Peak1D)
Referenced by Annotation1DPeakItem< DataPoint >::draw(), Annotation1DPeakItem< DataPoint >::ensureWithinDataRange(), Annotation1DPeakItem< DataPoint >::getPosition(), Annotation1DPeakItem< DataPoint >::move(), and Annotation1DPeakItem< DataPoint >::setPosition().