sparkle::Square Class Reference
[Sparkle Library]

Example shape class. More...

#include <square.h>

Inherits sparkle::Shape.

Collaboration diagram for sparkle::Square:

Collaboration graph
[legend]
List of all members.

Public Member Functions

ctors/dtor
 Square (int size=20)
Modifiers
int addNode (double x, double y)
int removeNode (Node *nodeToRemove)
int addEdge (int nodeIndex1, int nodeIndex2)
Getters
Not necessarily const

int numOfNodes () const

Detailed Description

Example shape class.

Example implementation of the shape class to create a simple square. The Square will be created with the first corner at the origin and the rest of the points in a square parallel to the axis in the positive quadrant.


Constructor & Destructor Documentation

Square::Square int  size = 20  ) 
 

Constructor

Parameters:
size Length of the side of the square


Member Function Documentation

int Square::addNode double  x,
double  y
[virtual]
 

Overridden as no nodes can be added to a square after creation

Parameters:
x X-coord
y Y-coord
Returns:
Number of nodes
Attention:
This will have no effect once there are 4 nodes

Reimplemented from sparkle::Shape.

int Square::removeNode Node nodeToRemove  )  [virtual]
 

Overridden as no nodes can be removed from a square after creation

Parameters:
nodeToRemove Node to remove
Returns:
Number of nodes
Attention:
This will have no effect

Reimplemented from sparkle::Shape.

int Square::addEdge int  nodeIndex1,
int  nodeIndex2
[virtual]
 

Overridden as no edges can be added to a square after creation

Parameters:
nodeIndex1 Index of start node
nodeIndex2 Index of end node
Returns:
Number of edges
Attention:
This will have no effect

Reimplemented from sparkle::Shape.

int sparkle::Square::numOfNodes  )  const [inline, virtual]
 

Overridden to speed up slightly

Returns:
Number of nodes in shape

Reimplemented from sparkle::Shape.


Hosted by SourceForge.net Logo Generated on Sat Sep 16 01:51:09 2006 for Sparkle by Doxygen 1.4.6.