Software Design Document csv2kml
Software Design Document csv2kml
08.11.2009
<Version 0.1>
1. INTRODUCTION.......................................................................................................................................3
2. SECTIONS..................................................................................................................................................3
2.1 FILLBOX...................................................................................................................................................3
2.1.1 IDENTIFICATION.............................................................................................................................................3
2.1.2 TYPE...........................................................................................................................................................3
2.1.3 PURPOSE......................................................................................................................................................3
2.1.4 FUNCTION....................................................................................................................................................3
2.1.5 DEPENDENCIES..............................................................................................................................................3
2.1.6 INTERFACE....................................................................................................................................................3
2.1.7 RESOURCES..................................................................................................................................................3
2.1.8 PROCESSING.................................................................................................................................................3
2.2 FILLBOX2.................................................................................................................................................4
2.2.1 IDENTIFICATION.............................................................................................................................................4
2.2.2 TYPE...........................................................................................................................................................4
2.2.3 PURPOSE......................................................................................................................................................4
2.2.4 FUNCTION....................................................................................................................................................4
2.2.5 DEPENDENCIES..............................................................................................................................................4
2.2.6 INTERFACE....................................................................................................................................................4
2.2.7 RESOURCES..................................................................................................................................................4
2.2.8 PROCESSING.................................................................................................................................................4
2.3 OUTFILECREATOR.................................................................................................................................4
2.3.1 IDENTIFICATION.............................................................................................................................................4
2.3.2 TYPE...........................................................................................................................................................4
2.3.3 PURPOSE......................................................................................................................................................4
2.3.4 FUNCTION....................................................................................................................................................5
2.3.5 DEPENDENCIES..............................................................................................................................................5
2.3.6 INTERFACE....................................................................................................................................................5
2.3.7 RESOURCES..................................................................................................................................................5
2.3.8 PROCESSING.................................................................................................................................................5
2.4 POSITION..................................................................................................................................................5
2.4.1 IDENTIFICATION.............................................................................................................................................5
2.4.2 TYPE...........................................................................................................................................................5
2.4.3 PURPOSE......................................................................................................................................................5
2.4.4 FUNCTION....................................................................................................................................................5
2.4.5 DEPENDENCIES..............................................................................................................................................5
2.4.6 INTERFACE....................................................................................................................................................5
2.4.7 RESOURCES..................................................................................................................................................6
2.4.8 PROCESSING.................................................................................................................................................6
2.5 MAIN..........................................................................................................................................................6
2.5.1 IDENTIFICATION.............................................................................................................................................6
2.5.2 TYPE...........................................................................................................................................................6
2.5.3 PURPOSE......................................................................................................................................................6
2.5.4 FUNCTION....................................................................................................................................................6
2.5.5 DEPENDENCIES..............................................................................................................................................6
2.5.6 INTERFACE....................................................................................................................................................6
2.5.7 RESOURCES..................................................................................................................................................6
2.5.8 PROCESSING.................................................................................................................................................6
1. INTRODUCTION
This Software Design Document proposes an explanation of CSV2KML that generates kml files
to be viewed in Google Earth. This design document will help the people who are interested in
modifying, implementing or learning the design of the program. This report belongs to a program
which is written in C++ programming language.
The rest of the SDD contains some information about the functions in the program. So that the
programmers will simply understand what is going on in the program.
There are some information about the design entities where all the needed information about the
functions in the program is explained.
2. SECTIONS
2.1 FILLBOX
2.1.1 IDENTIFICATION
FillBox
2.1.2 TYPE
Void function
2.1.3 PURPOSE
To get column name values from header line of the input csv file.
2.1.4 FUNCTION
Fills a string array named box with the data in header line of the input csv file.
2.1.5 DEPENDENCIES
Invoked by: main function.
2.1.6 INTERFACE
Input : two integers, string array, string
Parameters:
: an integer that increases until it reaches the number of values in line minus 1
2.1.7 RESOURCES
Memory.
2.1.8 PROCESSING
Begin fillBox(integer&, integer&, string& [], string&)
In a loop, until all commas in the line are visited,
- fills the string array with comma seperated values in the line
- if the value is between quotes, cuts off the quotes
2.2 FILLBOX2
2.2.1 IDENTIFICATION
FillBox2
2.2.2 TYPE
Void function
2.2.3 PURPOSE
To get column values from lines of the input csv file.
2.2.4 FUNCTION
Fills a string array named box2 with the data in one line of the input csv file other than header line
in each time it is called.
2.2.5 DEPENDENCES
Invoked by: main function.
2.2.6 INTERFACE
Input : two integers, string array, string
Parameters:
: an integer that increases until it reaches the number of values in line2 minus 1
2.2.7 RESOURCES
Memory.
2.2.8 PROCESSNG
Begin fillBox2(integer&, integer&, string& [], string&)
In a loop, until all commas in the line are visited,
- fills the string array with comma seperated values in the line
2.3.6 INTERFACE
Input : two integers, array of char pointers, string array
Parameters:
argv
outfile
: a string array to hold created output file names for input files (maximum 20 files)
2.3.7 RESOURCES
Memory.
2.3.8 PROCESSNG
Begin outFileCreator(integer&, integer&, char**, string& [] )
In a loop, from 1 to number of input files,
- takes the name of input file and puts it to i'th element of string array,
- removes the input file's extension,
- add .kml extension to i'th element of string array
End outFileCreator
2.4 POSITION
2.4.1 IDENTIFICATION
position
2.4.2 TYPE
Void function
2.4.3 PURPOSE
To write latitude/longitude or time/latitude/longitude values into the output file when -xy or -txy
parameters are given.
2.4.4 FUNCTION
Writes into the output kml file the values of latitude/longitude or time/latitude/longitude.
2.4.5 DEPENDENCES
Invoked by: main function.
2.4.6 INTERFACE
Input : ofstream, two string arrays, three integers
Parameters:
oFile
box
: a string array to hold the values in header line of input file. (maximum 20 values)
box2
: a string array to hold the values in one line of input file each time. (maximum 20
values)
latLoc
: an
2.4.7 RESOURCES
Memory and file.
2.4.8 PROCESSNG
Begin position(ofstream&, string &[], string &[], int&, int&, int& )
If time value exists in the input file, writes time values into oFile.
Writes latitude and longitude values into oFile.
End position
2.5 MAIN
2.5.1 IDENTIFICATION
main
2.5.2 TYPE
Void function
2.5.3 PURPOSE
Enables to execute the program.
2.5.4 FUNCTION
Generates kml files from csv files calling some functions and using five main if statements which
consist of for and while loops.
2.5.5 DEPENDENCES
Invokes: fillBox, fillBox2, outFileCreator, and position functions.
2.5.6 INTERFACE
Input : int, char**
Parameters:
2.5.7 RESOURCES
Memory and file.
2.5.8 PROCESSNG
Begin main(int, char **)
Necessary variables are generated.
Searches options -nh, -xy, and -txy in command line, if found, identifies their locations.
Identifies the location of first input file.
Identifies whether there exists other parameters.
First case is controlled:
- If there is no parameter other than program name and input file names or only -txy
option exists other than program name and input file names or only -txy and -nh options
exist other than program name and input file names.
If true;
- necessary variables are generated,
- call outFileCreator,
- if header exists;
call fillBox,
find the locations of time, latitude, and longitude names in box array,
in a loop, read lines until the end of file is reached,
- call fillBox2,
- write column values into the output file via ofstream oFile
- close ifstream and ofstream,
If false, control the second case:
- If only -txy option and its parameters exist other than program name and input file
names or only -txy option, its parameters, and -nh option exist other than program name and
input file names.
If true;
- Take the -txy parameters from command line,
- Do the operations in first case.
If false, control the third case:
- If only -nh option exist other than program name and input file names.
If true;
- Do the operations in first case but do not call fillBox.
If false, control the forth case:
- If only -xy option exists other than program name and input file names or only -xy and
-nh options exist other than program name and input file names.
If true;
- Do the operations in first case but exclude operations about time values.
If false, control the last case:
- If only -xy option and its parameters exist other than program name and input file
names or only -xy option, its parameters, and -nh option exist other than program name and
input file names.
If true;
- Do the operations in second case but exclude operations about time values.
End main