#include <visu2d.h>
Public Slots | |
void | SaveSelection () |
Saves the visualized shapes in a file. | |
void | ReadSelection () |
Reads and loads shapes from a file. | |
Signals | |
void | UpdateInfoBar (const QString &) |
This signal is emitted by SetTextInfo for every mouse movement. | |
void | UpdateStats (Selection *) |
This signal is emitted when the displayed stats are not valid anymore. (here, this is because the shape has changed, but that signal could also have been emitted if the data changed). | |
Public Member Functions | |
Visu2D (QWidget *parent=0) | |
Constructs a new class instance. | |
~Visu2D () | |
destructor | |
void | SetShapeType (SHAPE_TYPE type) |
Sets the selected shape's type. | |
void | UpdateDataAndPixmap (Image *pIm, Palette *pal) |
Initialize the pixmap from data and palette. | |
Private Member Functions | |
void | paintEvent (QPaintEvent *p) |
Receives the 'paint' events from the widget. | |
void | mouseMoveEvent (QMouseEvent *e) |
Method called for each mouse movement in the visualization. | |
void | mousePressEvent (QMouseEvent *e) |
Method called whenever a mouse-button is pressed. | |
void | mouseReleaseEvent (QMouseEvent *e) |
Method called whenever a mouse-button is released. | |
void | DrawShapes (QPainter *p) |
Draws the shape. | |
void | HandleMouse (int type, QMouseEvent *e) |
Mouse handling. Depending on the event, executes the according associated action. | |
void | GenerateShape (int type, int x, int y) |
Generate a shape. | |
void | SetTextInfo (int x, int y) |
Updates the main window informations. | |
Private Attributes | |
Image * | m_pImage |
Pointer to the graphical data. | |
QPixmap | m_pxScaled |
Pixmap to be displayed. | |
int | m_visuScaleFactor |
Scale factor between the data and the visualization. | |
Selection * | m_selection |
List of shapes displayed in the image. | |
Shape * | m_tmpShape |
Temporary shape, being created. | |
SHAPE_TYPE | m_shapeType |
Type of the shape. |
Definition at line 26 of file visu2d.h.
Visu2D::Visu2D | ( | QWidget * | parent = 0 |
) |
Constructs a new class instance.
parent | : the parent object for this widget (ie: the widget holding this widget) |
Definition at line 21 of file visu2d.cpp.
References m_pImage, m_selection, m_tmpShape, and m_visuScaleFactor.
Visu2D::~Visu2D | ( | ) |
void Visu2D::UpdateInfoBar | ( | const QString & | _t1 | ) | [signal] |
This signal is emitted by SetTextInfo for every mouse movement.
Definition at line 91 of file moc_visu2d.cpp.
Referenced by SetTextInfo().
void Visu2D::UpdateStats | ( | Selection * | _t1 | ) | [signal] |
This signal is emitted when the displayed stats are not valid anymore. (here, this is because the shape has changed, but that signal could also have been emitted if the data changed).
Definition at line 98 of file moc_visu2d.cpp.
Referenced by GenerateShape().
void Visu2D::SaveSelection | ( | ) | [slot] |
Saves the visualized shapes in a file.
Definition at line 211 of file visu2d.cpp.
References m_selection.
void Visu2D::ReadSelection | ( | ) | [slot] |
Reads and loads shapes from a file.
Definition at line 222 of file visu2d.cpp.
References m_selection.
void Visu2D::SetShapeType | ( | SHAPE_TYPE | type | ) |
Sets the selected shape's type.
Definition at line 66 of file visu2d.cpp.
References m_shapeType.
Referenced by WFrame::InitToolBar(), and WFrame::SetType().
Initialize the pixmap from data and palette.
Definition at line 71 of file visu2d.cpp.
References Palette::DataToIndex(), Palette::GetColor(), Image::GetData(), Image::GetSizeX(), Image::GetSizeY(), m_pImage, m_pxScaled, m_visuScaleFactor, and NB_COLORS.
Referenced by WFrame::ReadImage(), and WFrame::UpdateColorMap().
void Visu2D::paintEvent | ( | QPaintEvent * | p | ) | [private] |
Receives the 'paint' events from the widget.
Definition at line 47 of file visu2d.cpp.
References DrawShapes(), and m_pxScaled.
void Visu2D::mouseMoveEvent | ( | QMouseEvent * | e | ) | [private] |
Method called for each mouse movement in the visualization.
Definition at line 120 of file visu2d.cpp.
References HandleMouse(), and MOVE.
void Visu2D::mousePressEvent | ( | QMouseEvent * | e | ) | [private] |
Method called whenever a mouse-button is pressed.
Definition at line 125 of file visu2d.cpp.
References HandleMouse(), and PRESS.
void Visu2D::mouseReleaseEvent | ( | QMouseEvent * | e | ) | [private] |
Method called whenever a mouse-button is released.
Definition at line 130 of file visu2d.cpp.
References HandleMouse(), and RELEASE.
void Visu2D::DrawShapes | ( | QPainter * | p | ) | [private] |
Draws the shape.
p | : low-level Qt object allowing to draw and/or display a pixmap in a QWidget |
Definition at line 54 of file visu2d.cpp.
References Shape::Draw(), Selection::Draw(), m_selection, m_tmpShape, and m_visuScaleFactor.
Referenced by paintEvent().
void Visu2D::HandleMouse | ( | int | type, | |
QMouseEvent * | e | |||
) | [private] |
Mouse handling. Depending on the event, executes the according associated action.
type,: | type of the event "PRESS | MOVE | RELEASE" | |
e | : triggered event |
Definition at line 135 of file visu2d.cpp.
References GenerateShape(), Image::IsPointInside(), m_pImage, m_visuScaleFactor, and SetTextInfo().
Referenced by mouseMoveEvent(), mousePressEvent(), and mouseReleaseEvent().
void Visu2D::GenerateShape | ( | int | type, | |
int | x, | |||
int | y | |||
) | [private] |
Generate a shape.
type,: | type of the event "PRESS | MOVE | RELEASE" | |
x,y | : event coordinates |
Definition at line 171 of file visu2d.cpp.
References Selection::AllocateShape(), Selection::HandleNewShape(), Shape::Init(), m_selection, m_shapeType, m_tmpShape, Shape::ModifyEndShape(), MOVE, PRESS, RELEASE, UpdateStats(), and Shape::Validate().
Referenced by HandleMouse().
void Visu2D::SetTextInfo | ( | int | x, | |
int | y | |||
) | [private] |
Updates the main window informations.
x,y | : coordinates of the clicked point |
Definition at line 159 of file visu2d.cpp.
References Image::GetData(), Image::IsPointInside(), m_pImage, and UpdateInfoBar().
Referenced by HandleMouse().
Image* Visu2D::m_pImage [private] |
Pointer to the graphical data.
Definition at line 44 of file visu2d.h.
Referenced by HandleMouse(), SetTextInfo(), UpdateDataAndPixmap(), and Visu2D().
QPixmap Visu2D::m_pxScaled [private] |
Pixmap to be displayed.
Definition at line 47 of file visu2d.h.
Referenced by paintEvent(), and UpdateDataAndPixmap().
int Visu2D::m_visuScaleFactor [private] |
Scale factor between the data and the visualization.
Definition at line 50 of file visu2d.h.
Referenced by DrawShapes(), HandleMouse(), UpdateDataAndPixmap(), and Visu2D().
Selection* Visu2D::m_selection [private] |
List of shapes displayed in the image.
Definition at line 53 of file visu2d.h.
Referenced by DrawShapes(), GenerateShape(), ReadSelection(), SaveSelection(), Visu2D(), and ~Visu2D().
Shape* Visu2D::m_tmpShape [private] |
Temporary shape, being created.
Definition at line 56 of file visu2d.h.
Referenced by DrawShapes(), GenerateShape(), Visu2D(), and ~Visu2D().
SHAPE_TYPE Visu2D::m_shapeType [private] |
Type of the shape.
Definition at line 59 of file visu2d.h.
Referenced by GenerateShape(), and SetShapeType().