17 #include <QtGui/QColor>
18 #include <QStaticText>
31 template <
class DataPo
int>
60 void draw(
Plot1DCanvas*
const canvas, QPainter& painter,
bool flipped =
false)
override
66 QPoint position_widget, caret_position_widget;
71 canvas->
dataToWidget(xy_1stcaret, caret_position_widget, flipped);
111 if ((position_widget - caret_position_widget).manhattanLength() > 2)
117 painter.setPen(Qt::DashLine);
118 painter.drawLine(caret_position_widget, border_point);
An annotation item which paints a set of carets on the canvas.
Definition: Annotation1DCaret.h:34
std::vector< DataPoint > PositionsType
Definition: Annotation1DCaret.h:36
const QColor & getColor() const
Returns the color of the carets.
Definition: Annotation1DCaret.h:164
Annotation1DItem * clone() const override
Creates a copy of the item on the heap and returns a pointer.
Definition: Annotation1DCaret.h:178
DataPoint PointType
Definition: Annotation1DCaret.h:37
~Annotation1DCaret() override=default
Destructor.
const DataPoint & getPosition() const
Returns the position of the annotated peak (in unit coordinates)
Definition: Annotation1DCaret.h:153
void draw(Plot1DCanvas *const canvas, QPainter &painter, bool flipped=false) override
Draws the item on painter.
Definition: Annotation1DCaret.h:60
QColor color_
The color of the label.
Definition: Annotation1DCaret.h:192
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:53
void setColor(const QColor &color)
Set the color of the carets (color of text must be set using html)
Definition: Annotation1DCaret.h:159
QStaticText st_
Holds the (rich) text.
Definition: Annotation1DCaret.h:198
void setPosition(const DataPoint &position)
Sets the position of the label (in unit coordinates)
Definition: Annotation1DCaret.h:148
Annotation1DCaret(const Annotation1DCaret &rhs)=default
Copy constructor.
void setRichText(const QString &text)
Definition: Annotation1DCaret.h:171
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:134
QColor connection_line_color_
The color of the (optional) dashed line connecting peak and label.
Definition: Annotation1DCaret.h:195
DataPoint position_
The position of the label (in unit coordinates)
Definition: Annotation1DCaret.h:189
PositionsType caret_positions_
Definition: Annotation1DCaret.h:186
Annotation1DCaret(const PositionsType &caret_positions, const QString &text, const QColor &color, const QColor &connection_line_color)
Constructor.
Definition: Annotation1DCaret.h:40
const PositionsType & getCaretPositions() const
Returns the positions of the lines (in unit coordinates)
Definition: Annotation1DCaret.h:142
An abstract class acting as an interface for the different 1D annotation items.
Definition: Annotation1DItem.h:36
QRectF bounding_box_
The current bounding box of this item on the canvas where it has last been drawn.
Definition: Annotation1DItem.h:83
QString text_
The displayed text.
Definition: Annotation1DItem.h:89
void drawBoundingBox_(QPainter &painter)
Draws the bounding_box_.
bool selected_
Determines whether this item is currently selected on the canvas.
Definition: Annotation1DItem.h:86
void fromXY(const DRange< N_DIM > &in, RangeManager< Ranges... > &output) const
Definition: DimMapper.h:709
Point map(const T &data) const
convert an OpenMS datatype (such as Feature) to an N_DIM-dimensional point
Definition: DimMapper.h:673
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:42
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:295
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:434
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: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19