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

map.c

The routines that draw the map in the Map View window are located here. The comment at the beginning of the file describes four coordinate systems that are used to maintain the map window:

  1. The first is the physical coordinates of the window. The units for this coordinate system is pixels.
  2. The second is the viewport coordinate system that is used by OpenGL to do the actual drawing. The viewport is normalized to $-1\le x\le 1$ and $-1\le y\le 1$ where the origin is the center of the physical window.
  3. The third is the coordinate system defined by the size of the elevation map. The size is given by the global (ugh) variables called columnCount and rowCount. The comment in the file says, ``This is a 'dimensionless' grid of uniform points with equal spacing between the points.'' It seems to really be a two-dimensional grid. I'm assuming the author of the comment was attempting to say that the units of the spacing on the grid are not clearly defined. Maybe. The comment isn't clear. In any case, the dimension of the grids is meters.
  4. The comment from the previous item continues, ``To be drawn in the window, [the grid] needs to be scaled and positioned in the window. This will be referred to as the SCALED MAP.'' The scaled map value is the map translated into the window coordinate system, in pixels, using the global (ugh again) variables called zoomx and zoomy.

This file contains the routines to draw the map and to resize it and thus maintain the proper aspect ratio. Routines that convert between coordinate systems are also in this file. The drawing of the red cross hairs is also performed here.


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