Assignment #11, COP-3337
This assignment asks you to do a single-document interface (SDI)
program that demonstrates the use of a menu and
some primitive drawing.
The most interesting part is that you will use recursion
to draw a pretty space-filling curve.
Here is a demo.
Depending on how many pixels your terminal has, you may
need to enlarge the window that the executable runs in to see
the entire picture.
Specifications
You should not have a toolbar.
Your menubar should look like the demo, with a File,
Draw, and Help top-level menu, and the appropriate submenus.
The Ruler
The function
void DrawRuler( CDC *pDC, int Left, int Right, int MidHeight );
draws a ruler starting at xcoordinate Left and
finishing at Right.
The midpoint of the ruler is draw with height MidHeight,
and then the rest of the ruler is draw by two recursive calls,
using a smaller midpoint height.
My demo starts everything with the call
DrawRuler( pDC, 1, 127, 70 );
and shrinks midpoint heights by 8 in the recursive call.
The Space Filling Curve
The function
void SpaceFill( CDC *pDC, int Xpos, int Ypos, int Side, int NoDraw );
draws the space filling curve centered at coordinates (Xpos,
Ypos), with an initial square of side Side.
This is done recursively, meaning that after the square is drawn,
up to four recursive calls are made to draw the rest of the picture.
Each of the (three or four)
recursive calls draws a half-sized picture, centered
at the corner of the square that was just drawn.
The parameter NoDraw indicates which one of the quadrants
(1-4) does not get drawn recursivly.
If you look at the picture closely, you'll
see what's going on. My demo starts everything with the call
SpaceFill( pDC, 250, 250, 200, 0 );
Other Details
Will work on some of the other details in the lab on Thursday.
One thing you must remember is that when you add actions,
the all go into the View class.
This will generally require that you change a default when the class wizard
prompts you.
What to Submit
Submit the entire project directory on a 3.5" virus-free
floppy.
Give me a printout of the main class that has been altered
by you.
Include in your printout a statement of what works and what doesn't.
Print a few snapshots of your program in action.
You can get a snapshot of a window by selecting it and using
ALT+PrintScreen.