Rectangle Class Reference

The rectangle is stored in the BoundingBox of the Shape class. More...

#include <rectangle.h>

Inheritance diagram for Rectangle:

Inheritance graph
[legend]
Collaboration diagram for Rectangle:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 Rectangle ()
 Constructs a Rectangle w/o initializing it.
virtual ~Rectangle ()
 Rectangle (BoundingBox &b)
 Constructs a rectangle from another one.
bool IsInside (int x, int y) const
 Tests if a point (x, y) falls inside this rectangle.
virtual SHAPE_TYPE GetType () const
 Returns the type of the Shape.
virtual const std::string & GetName () const
 Returns the name of the Shape.
double SumValues (Image *pImage)
 Computes the sum of all pixels' values withing the rectangle.
double GetSurface () const
 Computes the area of the rectangle.
virtual void Draw (QPainter *p, int fact)
 Draw the rectangle in the image.


Detailed Description

The rectangle is stored in the BoundingBox of the Shape class.

Definition at line 19 of file rectangle.h.


Constructor & Destructor Documentation

Rectangle::Rectangle (  ) 

Constructs a Rectangle w/o initializing it.

Definition at line 11 of file rectangle.cpp.

Rectangle::~Rectangle (  )  [virtual]

Definition at line 20 of file rectangle.cpp.

Rectangle::Rectangle ( BoundingBox b  ) 

Constructs a rectangle from another one.

Parameters:
b BoundingBox from which to create this rectangle

Definition at line 15 of file rectangle.cpp.

References Shape::m_box.


Member Function Documentation

bool Rectangle::IsInside ( int  x,
int  y 
) const [virtual]

Tests if a point (x, y) falls inside this rectangle.

Parameters:
x,y :point to be tested
Returns:
true if the point is inside, false otherwise

Implements Shape.

Definition at line 57 of file rectangle.cpp.

References BoundingBox::IsInside(), and Shape::m_box.

Here is the call graph for this function:

SHAPE_TYPE Rectangle::GetType (  )  const [virtual]

Returns the type of the Shape.

Returns:
RECTANGLE

Implements Shape.

Definition at line 24 of file rectangle.cpp.

References RECTANGLE.

const std::string & Rectangle::GetName (  )  const [virtual]

Returns the name of the Shape.

Implements Shape.

Definition at line 28 of file rectangle.cpp.

double Rectangle::SumValues ( Image pImage  )  [virtual]

Computes the sum of all pixels' values withing the rectangle.

Parameters:
pImage : pointer to the data
Returns:
the sum

Implements Shape.

Definition at line 41 of file rectangle.cpp.

References Image::GetData(), BoundingBox::GetEndX(), BoundingBox::GetEndY(), BoundingBox::GetOriginX(), BoundingBox::GetOriginY(), and Shape::m_box.

Here is the call graph for this function:

double Rectangle::GetSurface (  )  const [virtual]

Computes the area of the rectangle.

Returns:
the surface, in pixels

Implements Shape.

Definition at line 52 of file rectangle.cpp.

References Shape::GetHeight(), and Shape::GetWidth().

Here is the call graph for this function:

void Rectangle::Draw ( QPainter *  p,
int  fact 
) [virtual]

Draw the rectangle in the image.

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

Implements Shape.

Definition at line 33 of file rectangle.cpp.

References BoundingBox::GetHeight(), BoundingBox::GetOriginX(), BoundingBox::GetOriginY(), BoundingBox::GetWidth(), and Shape::m_box.

Here is the call graph for this function:


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

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