43 #include <QtGui/QColor>
44 #include <QStaticText>
57 template <
class DataPo
int>
86 void draw(
Plot1DCanvas*
const canvas, QPainter& painter,
bool flipped =
false)
override
92 QPoint position_widget, caret_position_widget;
97 canvas->
dataToWidget(xy_1stcaret, caret_position_widget, flipped);
115 vertical_shift *= -1;
137 if ((position_widget - caret_position_widget).manhattanLength() > 2)
143 painter.setPen(Qt::DashLine);
144 painter.drawLine(caret_position_widget, border_point);
An annotation item which paints a set of carets on the canvas.
Definition: Annotation1DCaret.h:60
std::vector< DataPoint > PositionsType
Definition: Annotation1DCaret.h:62
const QColor & getColor() const
Returns the color of the carets.
Definition: Annotation1DCaret.h:190
Annotation1DItem * clone() const override
Creates a copy of the item on the heap and returns a pointer.
Definition: Annotation1DCaret.h:204
DataPoint PointType
Definition: Annotation1DCaret.h:63
~Annotation1DCaret() override=default
Destructor.
const DataPoint & getPosition() const
Returns the position of the annotated peak (in unit coordinates)
Definition: Annotation1DCaret.h:179
void draw(Plot1DCanvas *const canvas, QPainter &painter, bool flipped=false) override
Draws the item on painter.
Definition: Annotation1DCaret.h:86
QColor color_
The color of the label.
Definition: Annotation1DCaret.h:218
void ensureWithinDataRange(Plot1DCanvas *const canvas, const int layer_index) override
Ensures that the item has coordinates within the visible area of the canvas.
Definition: Annotation1DCaret.h:79
void setColor(const QColor &color)
Set the color of the carets (color of text must be set using html)
Definition: Annotation1DCaret.h:185
QStaticText st_
Holds the (rich) text.
Definition: Annotation1DCaret.h:224
void setPosition(const DataPoint &position)
Sets the position of the label (in unit coordinates)
Definition: Annotation1DCaret.h:174
Annotation1DCaret(const Annotation1DCaret &rhs)=default
Copy constructor.
void setRichText(const QString &text)
Definition: Annotation1DCaret.h:197
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 subclas...
Definition: Annotation1DCaret.h:160
QColor connection_line_color_
The color of the (optional) dashed line connecting peak and label.
Definition: Annotation1DCaret.h:221
DataPoint position_
The position of the label (in unit coordinates)
Definition: Annotation1DCaret.h:215
PositionsType caret_positions_
Definition: Annotation1DCaret.h:212
Annotation1DCaret(const PositionsType &caret_positions, const QString &text, const QColor &color, const QColor &connection_line_color)
Constructor.
Definition: Annotation1DCaret.h:66
const PositionsType & getCaretPositions() const
Returns the positions of the lines (in unit coordinates)
Definition: Annotation1DCaret.h:168
An abstract class acting as an interface for the different 1D annotation items.
Definition: Annotation1DItem.h:62
QRectF bounding_box_
The current bounding box of this item on the canvas where it has last been drawn.
Definition: Annotation1DItem.h:109
QString text_
The displayed text.
Definition: Annotation1DItem.h:115
void drawBoundingBox_(QPainter &painter)
Draws the bounding_box_.
bool selected_
Determines whether this item is currently selected on the canvas.
Definition: Annotation1DItem.h:112
void fromXY(const DRange< N_DIM > &in, RangeManager< Ranges... > &output) const
Definition: DimMapper.h:735
Point map(const T &data) const
convert an OpenMS datatype (such as Feature) to an N_DIM-dimensional point
Definition: DimMapper.h:699
Manipulates X or Y component of points in the X-Y plane, by assuming one axis (either X or Y axis) ha...
Definition: Plot1DCanvas.h:68
static void drawCaret(const QPoint &position, QPainter *painter, const int size=8)
draw a caret '^' at position, using a certain size (= width) of the caret
Canvas for visualization of one or several spectra.
Definition: Plot1DCanvas.h:321
void dataToWidget(const DPosition< 2 > &peak, QPoint &point, bool flipped=false)
For convenience - calls dataToWidget.
void pushIntoDataRange(T &data_point, const int layer_index)
Pushes a data point back into the valid data range of the current layer area. Useful for annotation i...
Definition: Plot1DCanvas.h:454
const DimMapper< 2 > & getMapper() const
Get Mapper to translate between values for axis (X/Y) and units (m/z, RT, intensity,...
QPointF intersectionPoint(const QRectF &rect, const QPointF &p)
Find the point on a rectangle where a ray/line from a point p to its center would intersect at.
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:48