next up previous contents
Next: draw.c Up: Files Previous: debug.c
Go to: SmartForest Home Printer-friendly: sf-impl.pdf


demfile.c

This file is responsible for reading in the .elev file. This happens in the read_DEMFile routine. This routine first calls elevReader in elevReader.c. The elevReader routine does the actual reading of the .elev file and initializes the elev variable with this information. When control returns to read_DEMFile, the map variable is then initialized with its values. The map variable's values are set using elev's values. The map variable is very important since it is used to create all of the pixel maps that are used by the program. The pixel maps are responsible for changing the colors on the land in the Forest View to reflect the selected stand feature.

This file, along with standInterface.c, also performs automatic memory management for the pixel maps. Each pixel map is approximately 12 megabytes large. Currently there are 7 different pixel maps. To help keep memory usage reasonable, these two files keep track of how many times each map is used. If the program runs out of memory when it tries to allocate memory for a pixel map, it first releases the currently allocated pixel maps, one at a time, starting with the least used map until it has enough memory to allocate the new map. We expect that only one map will need to be released since all of the maps have the same size. The routines that coordinate this effort are located in these two files. As more pixel maps are added to the application (due to the addition of stand features) a maximum limit may need to be imposed on the number of pixel maps permitted to be active in memory.


next up previous contents
Next: draw.c Up: Files Previous: debug.c
Matthew S. Davis
2002-08-07