Next: The .elev File
Up: Program Execution & Data
Previous: Program Execution & Data
Go to:
SmartForest Home Printer-friendly:
sf-impl.pdf
main() is located in the file named g.c. It performs the following
sequence of operations:
- The random number generator is seeded with the process identifier.
- Process the optional command-line arguments.
- Several X Windows
arguments are prepared to create the main window. When the arguments
are ready, the main X Windows application window
is created. Note that the window's
contents are not yet drawn.
- The mapping between events and callbacks is established.
- Initialize the data elements in the legend and in the stand legend.
- The Data Preferences file is loaded. The file name is
sf.prf where the directory is relative to the directory
where SmartForest is run. The subdirectory may be overridden by setting
the SMARTFOREST_APPDIR
environment variable. Only the
directory may be overridden. The file's name (sf.prf) may not be
overridden. (This should be changed so that this file is handled consistently
with the other files.)
- Determine the size of datamap's and standDatamap's entries.
Update each entry's length field with the size.
- The .elev file is parsed. See Section 4.2.2.
- The .trl file is parsed. See Section 4.2.3.
- The .slf file is parsed. See Section 4.2.4.
- The default image file name that is used when the user selects
File-Save Image As is set to ./ImageFiles/default.jpg. The
directory may be overridden by setting the SMARTFOREST_PROJDIR
environment variable. Again, only the subdirectory may be overridden.
The file name, default.jpg, may not be overridden at initialization
time. However, this file name may be overridden in the dialog box
that appears when the user selects File-Save Image As.
(This should be changed so that this file is handled consistently
with the other files.)
- The .stnd file is parsed. See Section 4.2.5.
- The headers of the .elev and .stnd files should be
identical for SmartForest to run properly. Verify that they are the same.
- The normals data structure is initialized. According to the
comment in the function initialize_normals(),
these values are
used to ``compute where the person stands when they are in the middle of a
dem grid...Initially, map
is the
position in space of the
DEM sample at
.'' The map structure is initialized when
the .elev file is parsed, above. See Section 4.2.2.
``[We] later mangle map
and map
, but
leave
map
alone, using it as the height of each DEM sample.
- The colors that are used to draw the ground, water, roads, fields,
trees and tree stems are initialized. Each of these is implemented as
a two-dimensional array: the first dimension varies the color based on
the height of the object and the second dimension represents the RGB
values at that height.
- If the user specified -installc as a command-line option,
then a private color map is used for the application. Note that this
command-line option is currently not permitted as our check for the number
of arguments only allows for the data file names.
- The contents of the windows are finally drawn.
- Initialize the map message and the stand message. These show the current
mode of the map and the stand, respectively.
- A remote-procedure-call server is initialized (AIX only).
- Finally, XtAppMainLoop is called and main() terminates.
Next: The .elev File
Up: Program Execution & Data
Previous: Program Execution & Data
Matthew S. Davis
2002-08-07