Previous   |  Next   |  Back to Technical Manual Index

3.4. Module: DataAbstraction

-Class Hierarchy

DataAbstraction does not inherit from any other classes.


          Principally developed by Jeff McLamb
This class is used to package the specifics of reading in the map data files (in UTM coordinates), and triangulating them. First, the map files are parsed into space-delimited files of numbers (extra information that might be in the file is ignored), and then the data is read from the file, converted to floating point representation, and put into matrices. Another matrix is created that contains the result of the triangulation algorithm, performed on the original data. The class then provides a mechanism for iterating through the points that define the rectangles, so that the user may easily extract the proper data in order to draw the triangles to the screen.
-Implementation Details
As the constructor reads in the input file, it converts each point into floating point numbers using the C-style utility function, atof(), and then stores them in a Matrix, called input and z (for the z-values, which are used to determine coloring). The triangulation routing is used to triangulate, in two dimensions, the input data. These results are also stored in a Matrix, called output. The constructor does most of the work. Use of the class is intended to be done primarily via calls to NextPoint() and NextZ(). These member functions return the next point to be used in the triangle-drawing by reading a value in the output Matrix, and referencing into the input array to the row determined by the output value, and returning the actual values found at that point.

It is important to note that DataAbstraction must be used in the following fashion:  There must be one call to NextZ() for every two calls to NextPoint().  More specifically, the call to NextZ() must come before the second call to NextPoint().  This is because every other call to NextPoint() updates the iterator so that future references into the data refer to the next point.  At this point, a call to NextZ() will return the Z value of the new point, instead of the old one.


Next   |   Back to Technical Manual Index