#include <shape.h>
Public Member Functions | |
Shape () | |
Constructs an empty shape. | |
virtual | ~Shape () |
virtual SHAPE_TYPE | GetType () const =0 |
Virtual method returning the type of the shape. | |
void | Init (int x, int y) |
Initialize the shape with a given point. | |
virtual const std::string & | GetName () const =0 |
Virtual method returning the name of the shape. | |
int | GetHeight () const |
Returns the height of the shape. | |
int | GetWidth () const |
Returns the width of the shape. | |
int | GetCenterX () const |
Returns the abscissa of the center. | |
int | GetCenterY () const |
Returns the ordinate of the center. | |
virtual double | GetSurface () const =0 |
Virtual method returning the surface of the shape. | |
virtual double | SumValues (Image *pImage)=0 |
Returns the sum of all the pixels' values within the shape. | |
virtual void | Draw (QPainter *p, int fact)=0 |
Draws the shape. | |
virtual void | ModifyEndShape (int lastMousePosition_x, int lastMousePosition_y) |
Updates the coordinates of the end of the shape with those in arguments. | |
virtual bool | Validate () |
Validates the shape update (polygon closing, right ordering of the rectangle coordinates,...) and tests its validity. | |
const BoundingBox & | GetBoundingBox () const |
Returns the rectangle surrounding the shape. | |
void | SetBoundingBox (BoundingBox &bb) |
Assigns a new BoundingBox to this shape. | |
virtual bool | IsInside (int x, int y) const =0 |
Tests if the shape contains a given point. | |
Protected Attributes | |
BoundingBox | m_box |
Smallest BoundingBox containing this shape. |
Definition at line 23 of file shape.h.
virtual SHAPE_TYPE Shape::GetType | ( | ) | const [pure virtual] |
Virtual method returning the type of the shape.
Implemented in Rectangle.
Referenced by WStatistics::UpdateStats().
void Shape::Init | ( | int | x, | |
int | y | |||
) |
Initialize the shape with a given point.
x | : abscissa of the first point | |
y | : ordinate of the first point |
Definition at line 17 of file shape.cpp.
References m_box, and BoundingBox::SetCoord().
Referenced by Visu2D::GenerateShape().
virtual const std::string& Shape::GetName | ( | ) | const [pure virtual] |
Virtual method returning the name of the shape.
Implemented in Rectangle.
int Shape::GetHeight | ( | ) | const |
Returns the height of the shape.
Definition at line 38 of file shape.cpp.
References BoundingBox::GetHeight(), and m_box.
Referenced by Rectangle::GetSurface(), and WStatistics::UpdateStats().
int Shape::GetWidth | ( | ) | const |
Returns the width of the shape.
Definition at line 43 of file shape.cpp.
References BoundingBox::GetWidth(), and m_box.
Referenced by Rectangle::GetSurface(), and WStatistics::UpdateStats().
int Shape::GetCenterX | ( | ) | const |
Returns the abscissa of the center.
Definition at line 48 of file shape.cpp.
References BoundingBox::GetOriginX(), BoundingBox::GetWidth(), and m_box.
Referenced by WStatistics::UpdateStats().
int Shape::GetCenterY | ( | ) | const |
Returns the ordinate of the center.
Definition at line 53 of file shape.cpp.
References BoundingBox::GetHeight(), BoundingBox::GetOriginY(), and m_box.
Referenced by WStatistics::UpdateStats().
virtual double Shape::GetSurface | ( | ) | const [pure virtual] |
Virtual method returning the surface of the shape.
Implemented in Rectangle.
Referenced by Selection::GetSurface(), and WStatistics::UpdateStats().
virtual double Shape::SumValues | ( | Image * | pImage | ) | [pure virtual] |
Returns the sum of all the pixels' values within the shape.
pImage | : pointer to the image data |
Implemented in Rectangle.
Referenced by Selection::SumValues(), and WStatistics::UpdateStats().
virtual void Shape::Draw | ( | QPainter * | p, | |
int | fact | |||
) | [pure virtual] |
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 be drawn) and the visualization scale (graphical representation) |
Implemented in Rectangle.
Referenced by Selection::Draw(), and Visu2D::DrawShapes().
void Shape::ModifyEndShape | ( | int | lastMousePosition_x, | |
int | lastMousePosition_y | |||
) | [virtual] |
Updates the coordinates of the end of the shape with those in arguments.
lastMousePosition_x | Abscissa of the bottom-right corner | |
lastMousePosition_y | Ordinate of the bottom-right corner |
Definition at line 22 of file shape.cpp.
References m_box, BoundingBox::SetEndX(), and BoundingBox::SetEndY().
Referenced by Visu2D::GenerateShape().
bool Shape::Validate | ( | ) | [virtual] |
Validates the shape update (polygon closing, right ordering of the rectangle coordinates,...) and tests its validity.
Definition at line 58 of file shape.cpp.
References BoundingBox::IsEmpty(), m_box, and BoundingBox::Validate().
Referenced by Visu2D::GenerateShape().
const BoundingBox & Shape::GetBoundingBox | ( | ) | const |
void Shape::SetBoundingBox | ( | BoundingBox & | bb | ) |
Assigns a new BoundingBox to this shape.
bb | : new BoundingBox |
Definition at line 33 of file shape.cpp.
References m_box.
virtual bool Shape::IsInside | ( | int | x, | |
int | y | |||
) | const [pure virtual] |
Tests if the shape contains a given point.
x | abscissa of the point | |
y | ordinate of the point |
Implemented in Rectangle.
BoundingBox Shape::m_box [protected] |
Smallest BoundingBox containing this shape.
Definition at line 122 of file shape.h.
Referenced by Rectangle::Draw(), GetBoundingBox(), GetCenterX(), GetCenterY(), GetHeight(), GetWidth(), Init(), Rectangle::IsInside(), ModifyEndShape(), Rectangle::Rectangle(), SetBoundingBox(), Rectangle::SumValues(), and Validate().