#include <LineProfileTool.h>
It is assumed that on the parent Graph an ImageMarker is selected. During initialization, a pointer to this marker is stored and the selection is removed. The LineProfileTool adds itself as a full-sized child widget to the Graph's canvas, allowing for fast redraws while selection of the line is in progress. Once the line is selected (mouse button is released), the profile is calculate and displayed, a new LineMarker denoting the selected profile line is added to the Graph and the LineProfileTool deletes itself by setting the Graph's active tool to NULL.
Signals | |
void | createTablePlot (const QString &caption, int r, int c, const QString &content) |
void | statusText (const QString &) |
Public Member Functions | |
void | calculateLineProfile (const QPoint &start, const QPoint &end) |
LineProfileTool (Graph *graph, int average_pixels) | |
Standard constructor. | |
Protected Member Functions | |
void | addLineMarker (const QPoint &start, const QPoint &end) |
int | averageImagePixel (const QImage &image, int px, int py, bool moreHorizontal) |
virtual void | mouseMoveEvent (QMouseEvent *e) |
Mouse movements need to be monitored for updating the line during operation. | |
virtual void | mousePressEvent (QMouseEvent *e) |
Pressing the left mouse button starts line selection. | |
virtual void | mouseReleaseEvent (QMouseEvent *e) |
Mouse releases end line selection and cause the profile to be displayed. | |
virtual void | paintEvent (QPaintEvent *e) |
Draw line during operation (replaced by a LineMarker at the end). | |
Private Attributes | |
int | d_average_pixels |
Number of image pixels over which to average. | |
QPoint | d_op_dp |
Difference between current and start position during operation. | |
QPoint | d_op_start |
Mouse position where an operation started. | |
ImageMarker * | d_target |
The image marker to operate on. |
LineProfileTool::LineProfileTool | ( | Graph * | graph, | |
int | average_pixels | |||
) |
Standard constructor.
void LineProfileTool::addLineMarker | ( | const QPoint & | start, | |
const QPoint & | end | |||
) | [protected] |
int LineProfileTool::averageImagePixel | ( | const QImage & | image, | |
int | px, | |||
int | py, | |||
bool | moreHorizontal | |||
) | [protected] |
void LineProfileTool::calculateLineProfile | ( | const QPoint & | start, | |
const QPoint & | end | |||
) |
void LineProfileTool::createTablePlot | ( | const QString & | caption, | |
int | r, | |||
int | c, | |||
const QString & | content | |||
) | [signal] |
void LineProfileTool::mouseMoveEvent | ( | QMouseEvent * | e | ) | [protected, virtual] |
Mouse movements need to be monitored for updating the line during operation.
void LineProfileTool::mousePressEvent | ( | QMouseEvent * | e | ) | [protected, virtual] |
Pressing the left mouse button starts line selection.
Clicks with anything else than the left button are propagated to the parent as usual.
void LineProfileTool::mouseReleaseEvent | ( | QMouseEvent * | e | ) | [protected, virtual] |
Mouse releases end line selection and cause the profile to be displayed.
void LineProfileTool::paintEvent | ( | QPaintEvent * | e | ) | [protected, virtual] |
Draw line during operation (replaced by a LineMarker at the end).
void LineProfileTool::statusText | ( | const QString & | ) | [signal] |
Emitted whenever a new message should be presented to the user.
You don't have to connect to this signal if you alreay specified a reciever during initialization.
int LineProfileTool::d_average_pixels [private] |
Number of image pixels over which to average.
QPoint LineProfileTool::d_op_dp [private] |
Difference between current and start position during operation.
QPoint LineProfileTool::d_op_start [private] |
Mouse position where an operation started.
ImageMarker* LineProfileTool::d_target [private] |
The image marker to operate on.