Visu2D Class Reference

Class for the image visualization. Allows to graphically represent data as an image. Inherits from QWidget. More...

#include <visu2d.h>

Collaboration diagram for Visu2D:

Collaboration graph
[legend]

List of all members.

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

Imagem_pImage
 Pointer to the graphical data.
QPixmap m_pxScaled
 Pixmap to be displayed.
int m_visuScaleFactor
 Scale factor between the data and the visualization.
Selectionm_selection
 List of shapes displayed in the image.
Shapem_tmpShape
 Temporary shape, being created.
SHAPE_TYPE m_shapeType
 Type of the shape.


Detailed Description

Class for the image visualization. Allows to graphically represent data as an image. Inherits from QWidget.

Definition at line 26 of file visu2d.h.


Constructor & Destructor Documentation

Visu2D::Visu2D ( QWidget *  parent = 0  ) 

Constructs a new class instance.

Parameters:
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 (  ) 

destructor

Definition at line 35 of file visu2d.cpp.

References m_selection, and m_tmpShape.


Member Function Documentation

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().

Here is the caller graph for this function:

void Visu2D::UpdateDataAndPixmap ( Image pIm,
Palette pal 
)

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().

Here is the call graph for this function:

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.

Here is the call graph for this function:

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.

Here is the call graph for this function:

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.

Here is the call graph for this function:

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.

Here is the call graph for this function:

void Visu2D::DrawShapes ( QPainter *  p  )  [private]

Draws the shape.

Parameters:
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().

Here is the call graph for this function:

Here is the caller graph for this function:

void Visu2D::HandleMouse ( int  type,
QMouseEvent *  e 
) [private]

Mouse handling. Depending on the event, executes the according associated action.

Parameters:
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().

Here is the call graph for this function:

Here is the caller graph for this function:

void Visu2D::GenerateShape ( int  type,
int  x,
int  y 
) [private]

Generate a shape.

Parameters:
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().

Here is the call graph for this function:

Here is the caller graph for this function:

void Visu2D::SetTextInfo ( int  x,
int  y 
) [private]

Updates the main window informations.

Parameters:
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().

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

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().

Scale factor between the data and the visualization.

Definition at line 50 of file visu2d.h.

Referenced by DrawShapes(), HandleMouse(), UpdateDataAndPixmap(), and Visu2D().

List of shapes displayed in the image.

Definition at line 53 of file visu2d.h.

Referenced by DrawShapes(), GenerateShape(), ReadSelection(), SaveSelection(), Visu2D(), and ~Visu2D().

Temporary shape, being created.

Definition at line 56 of file visu2d.h.

Referenced by DrawShapes(), GenerateShape(), Visu2D(), and ~Visu2D().

Type of the shape.

Definition at line 59 of file visu2d.h.

Referenced by GenerateShape(), and SetShapeType().


The documentation for this class was generated from the following files:

Generated on Tue Sep 13 10:10:32 2011 for DrawQt by  doxygen 1.5.6