Previous   |  Next   |  Back to Technical Manual Index

3.1. Module: GlMapWindow

-Class Hierarchy

Fl_Gl_Window
   |
   +----GlMapWindow
-Authorship
            Principally developed by Chris Arrington and Kwan Skinner

-Description

At a high level, this class is a window that displays a map given the filenames of input data. It is a subclass of Fltk class Fl_Gl_Window, which is a widget class that sets up a drawing area for OpenGL calls. The virtual method draw() must be implemented, in which OpenGL commands can be issused to display graphics. The Fltk Window method show() must be called by the user to display the GlMapWindow in the Fltk Window.
-Implementation Details
Objects of STL class Vector are used to keep track of active windows and stored tiles. The data member "windows" is a vector of pointers to terrain_map_viewer objects. Each time a box is drawn inside the display area by the user, a pointer to a new terrain_map_viewer object is created and added to "windows". When the parent thumbnail_map_viewer is closed, kill_all_windows() is called and it closes all terrain maps in the "windows" vector by creating an iterator for "windows" and calling the hide() method on each terrain_map_viewer, which closes the Fltk window.

Since many or none of the tiles that make up a map sheet can be displayed at one time, a vector "tiles" is used to keep track of each DataAbstraction object that represents one of the mapsheet tiles. The data member "tiles" is a vector of DataAbstraction pointers, and mapsheet tiles can be added to it via the addTile() method. When draw() is called, an iterator for the vector is created and iterated through, extracting the data from each DataAbstraction object needed to draw the triangles for that mapsheet tile.

There are 4 double variables used to set the coordinate system of the display, minX, minY, maxX, and maxY. They are each initially set to 1.0. Whenever a tile is added, the maximum and minimum values for X and Y are obtained and compared to the current values for this window, updating if necessary.

-Methods
 

Next   |  Back to Technical Manual Index