3.4. Module: DataAbstraction
-Class Hierarchy
DataAbstraction does not inherit from any other classes.
-Authorship
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.-MethodsIt 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.
DataAbstraction(char *argv[])
Description: This constructor parses, triangulates, and stores the map data in Matrix objects.
Inputs: a pointer to a char array, used to get the filename of the input file.
Outputs: Three Matrix objects, input, output, and z, the first being the x-y values of the input data, the second being the triangulation results, and the third being the z values of the input data.
Assumptions:
Exceptions:
Known Bugs: None Yet.
PrintInput()
Description: A test method that just prints out the values in the input Matrix to standard out.
Inputs:
Outputs: the input Matrix.
Assumptions:
Exceptions:
Known Bugs: None Yet.
PrintOutput()
Description: A test method that just prints out the values in the output Matrix to standard out.
Inputs: None
Outputs: the outputMatrix.
Assumptions:
Exceptions: None.
Known Bugs: Too many to describe at this moment.
PrintZ()
Description:A test method that just prints out the values in the z Matrix to standard out.
Inputs:
Outputs:
Assumptions:
Exceptions:
Known Bugs: None Yet.
NextPoint()
Description: Returns the next value associated with the next triangle in the output Matrix.
Inputs:
Outputs: The next value associated with the next triangle in the outpui Matrix.
Assumptions:
Exceptions:
Known Bugs:
NextZ()
Description: Returns the next z-value associated with the next triangle in the output Matrix.
Inputs: None.
Outputs: Returns the next z-value associated with the next triangle in the output Matrix.
Assumptions:
Exceptions:
Known Bugs: