CS360 Assignment #3

Points: 50

The biological sciences have found the need to map certain outdoor regions on a grid as follows:

The polygon on the above grid represents a region that is populated by a particular species of plant. In particular, an unknown number of species can occupy regions on the grid and the same species can occupy multiple locations on the grid. The goal of this assignment is to allow a user the ability to hold up to the display screen a transparency, with a grid and regional information, and through the use of only polygons, map out each individual region labelling each. When the user is done mapping and labeling each region, the program will find the area of each polygon, combine areas of like types, and print a list of each species and its' associated area.

You are to create a 10x10 square grid where each square consists of 40x40 pixels horizontally and vertically. I'm assuming a screen resolution of 640x480. The first thing your program will do is ask the user for the meaning of each square. A value of 1 meter signifies that four consecutive pixels represents .1 meter.

Once you have this information, then display the grid on the display screen and allow the user to map out each species' region on the display screen one region at a time. After each region (polygon), ask the user to name the region and associate a number with that region. After the initial region, all subsequent regions will be new or old, so when naming all other regions allow the user to specify an old region using a number or name a new region. Fill each polygon region with a color representing the number associated with the region. Overlapping regions will assume the color of the last region entered.

Each region object will simply be defined by an ordered set of points. You can use any data structure to represent the list of regions. When the user is done entering regions, then print a list of species and the area represented by all regions mapped out for that species. Generate this list for all unique species.

So as an example, let's assume the following:

As far as the user mapping regions on the grid, it is acceptable to allow the user to accpet the region at the end or to start over with the complete region if they don't like the region they mapped out or made a mistake. I'm not really interested in complete user friendliness.

The last piece of the pie is the calculation of the area of a polygon. Documentation for this exists in the lab.