#include <selection.h>
Public Member Functions | |
Selection () | |
Constructs a selection, initializing the current shape. | |
virtual | ~Selection () |
Shape * | AllocateShape (SHAPE_TYPE type) |
Allocate a new empty shape. Beware: the call to this method should be followed by a call to Init(x,y) to initialize the first point. | |
void | HandleNewShape (Shape *s) |
Store a new shape, replacing the previous one. | |
Shape * | GetShape () |
Returns a pointer to the currently held shape. | |
void | Draw (QPainter *p, int fact) |
Draws the shape. | |
double | SumValues (Image *pData) |
Computes and returs the sum of the pixels' values in the displayed shape. | |
double | GetSurface () |
returns the sum of the surfaces of the shape(s) being displayed. | |
bool | Save (std::ofstream &of) |
Saves the coordinates of the displayed shapes in the stream of. | |
bool | Read (std::ifstream &ifs) |
Reads the coordinates of the shapes saved in the input stream and displays them on screen. | |
Private Attributes | |
Shape * | m_shape |
Pointer to the Shape held by the Selection. |
Definition at line 25 of file selection.h.
Selection::Selection | ( | ) |
Constructs a selection, initializing the current shape.
Definition at line 15 of file selection.cpp.
References m_shape.
Selection::~Selection | ( | ) | [virtual] |
Definition at line 21 of file selection.cpp.
Shape * Selection::AllocateShape | ( | SHAPE_TYPE | type | ) |
Allocate a new empty shape. Beware: the call to this method should be followed by a call to Init(x,y) to initialize the first point.
type,: | type of the new shape. |
Definition at line 25 of file selection.cpp.
References RECTANGLE.
Referenced by Visu2D::GenerateShape().
void Selection::HandleNewShape | ( | Shape * | s | ) |
Store a new shape, replacing the previous one.
s | new shape to handle in the selection |
Definition at line 40 of file selection.cpp.
References m_shape.
Referenced by Visu2D::GenerateShape().
Shape * Selection::GetShape | ( | ) |
Returns a pointer to the currently held shape.
Definition at line 49 of file selection.cpp.
References m_shape.
Referenced by WStatistics::UpdateStats().
void Selection::Draw | ( | QPainter * | p, | |
int | fact | |||
) |
Draws the shape.
p | : low-level Qt object allowing to draw and/or display a pixmap in a QWidget | |
fact | : ratio between the data scale (shapes to draw) and the visualization scale (graphical representation) |
Definition at line 69 of file selection.cpp.
References Shape::Draw(), and m_shape.
Referenced by Visu2D::DrawShapes().
double Selection::SumValues | ( | Image * | pData | ) |
Computes and returs the sum of the pixels' values in the displayed shape.
Definition at line 59 of file selection.cpp.
References m_shape, and Shape::SumValues().
Referenced by WStatistics::UpdateStats().
double Selection::GetSurface | ( | ) |
returns the sum of the surfaces of the shape(s) being displayed.
Definition at line 76 of file selection.cpp.
References Shape::GetSurface(), and m_shape.
Referenced by WStatistics::UpdateStats().
bool Selection::Save | ( | std::ofstream & | of | ) |
Saves the coordinates of the displayed shapes in the stream of.
of | data stream in which to save data |
Definition at line 85 of file selection.cpp.
bool Selection::Read | ( | std::ifstream & | ifs | ) |
Reads the coordinates of the shapes saved in the input stream and displays them on screen.
ifs | input stream to read from. |
Definition at line 90 of file selection.cpp.
Shape* Selection::m_shape [private] |
Pointer to the Shape held by the Selection.
Definition at line 36 of file selection.h.
Referenced by Draw(), GetShape(), GetSurface(), HandleNewShape(), Selection(), and SumValues().