PolyShape
This class captures the abstraction of a closed polygon shape. The
class constructor defines the first node (vertex) of the shape. The PolyShape
maintains a "current" point that can be changed by relative, navigational
methods - Up, Down, Left, and Right - which
move the "current" point in the indicated direction. When the Mark
method is invoked, the "current" point is added as the next nodes (vertex)
in the shape. The Draw method draws in a specified Canvas
the closed polygon corresponding to the set of nodes (vertices). The polygon
is closed in that the last node (vertex) is assumed to be connected to
the first node (vertex).
[ Index | Source
| Summary | Member Functions ]
Quick Index
Class Summary
class PolyShape
{
public:
-
PolyShape(int x,
int y);
-
void Up (int amount);
-
void Down (int amount);
-
void Left (int amount);
-
void Right(int amount);
-
void Mark();
-
void Draw(Canvas&
canvas);
-
~PolyShape();
}; // PolyShape
Back to the top of PolyShape
PolyShape(int x, int y);
Initialize the first node (vertex) and "current" point of the PolyShape
with the specified x and y coordinates.
-
x : the x coordinate of the first point and the initial current
point.
-
y : the y coordinate of the first point and the initial current
point.
PolyShape(int x, int y);
Back to the top of PolyShape
void Up (int amount);
Move the "current" point toward the top edge of the display area by the
specified amount. Distances are measured in pixels.
-
amount: the amount to move the "current" point.
void Up (int amount);
Back to the top of PolyShape
void Down (int amount);
Move the "current" point toward the botton edge of the display area by
the specified amount. Distances are measured in pixels.
-
amount: the amount to move the "current" point.
void Down (int amount);
Back to the top of PolyShape
void Left (int amount);
Move the "current" point toward the left edge of the display area by the
specified amount. Distances are measured in pixels.
-
amount: the amount to move the "current" point.
void Left (int amount);
Back to the top of PolyShape
void Right(int amount);
Move the "current" point toward the right edge of the display area by the
specified amount. Distances are measured in pixels.
-
amount: the amount to move the "current" point.
void Right(int amount);
Back to the top of PolyShape
void Mark();
Add the "current" point as the next node (vertex) of closed polygon.
void Mark();
Back to the top of PolyShape
void Draw(Canvas& canvas);
Draw the closed polygon described by the nodes of the PolyShape. The PolyShape
is drawn by drawing line segments connecting successive pairs of nodes
(vertices) defined in the PolyShape. The PolyShape drawing is closed by
drawing a line from the last node (vertex) to the first node (vertex).
The drawing is done in the specified Canvas.
-
canvas : the Canvas in which the PolyShape
will be drawn
void Draw(Canvas& canvas);
Back to the top of PolyShape
~PolyShape();
Reclaim the resources associated with the PolyShape when the PolyShape
object is destructed. The resources include the list of nodex (vertices)
and their supporting data structure components.
~PolyShape();
Back to the top of PolyShape
Member Functions
-
public:
-
void Up (int amount);
-
void Down (int amount);
-
void Left (int amount);
-
void Right(int amount);
-
void Mark();
-
void Draw(Canvas&
canvas);
Back to the top of PolyShape
Generated from source by the Cocoon
utilities on Thu Apr 02 12:40:35 1998 .
Report problems to jkotula@unimax.com