1 | | May 9, 2007:[[BR]] |
2 | | This is a test. Expect real documentation this weekend (this week is finals week, so I don't have much in the way of free time before Saturday). |
3 | | [[BR]][[BR]] |
4 | | '''Link to prototype code:'''[[BR]] |
5 | | [http://www.tcnj.edu/~voytko2/svg.zip] |
| 1 | = 0. Introduction = |
| 2 | This is the central repository for design and implementation considerations for this project. If you have any suggestions or comments, either leave them here or email me at jakevoytko [at] gmail [dot] com[[BR]] |
| 3 | |
| 4 | = 1. User Interface = |
| 5 | |
| 6 | == Example == |
| 7 | {{{ |
| 8 | #!cpp |
| 9 | vector<double> experiment_data; |
| 10 | |
| 11 | // fill experiment_data here |
| 12 | |
| 13 | svg_graph my_graph("./image.svg"); |
| 14 | |
| 15 | my_graph<< image_size(500, 500) << x_scale(0, 10) << y_scale(0, 10) |
| 16 | << line_color(BLACK) << draw_axis(); |
| 17 | |
| 18 | my_graph<< plot_range(experiment_data.begin(), experiment_data.end()) << write(); |
| 19 | }}} |
| 20 | |
| 21 | |
| 22 | ---- |
| 23 | = 2. Design Decisions = |
| 24 | |
| 25 | == 2.1 svg class == |
| 26 | |
| 27 | === Document enum === |
| 28 | The very first thing the user sees in svg.hpp is the following line: |
| 29 | |
| 30 | {{{ |
| 31 | #!cpp |
| 32 | enum {SVG_XML_HEADER, SVG_XML_DOCTYPE, SVG_OPEN, SVG_G_OPEN, SVG_G_STROKE, |
| 33 | SVG_G_FILL, SVG_G_CLOSE}; |
| 34 | }}} |
| 35 | |
| 36 | This is done in order to standardize locations in the svg document that is being output. document[SVG_XML_HEADER], for example, will always refer to the line that has the SVG file's XML header. I'm currently debating the necessity of this feature; in my demo program that I wrote, there were lines in document that I never had to refer to again, but there were some lines that I did have to use a few times. At the moment, I'm going to keep the enum, though I will probably move it to a more suitable location so that it's not in the boost::svg namespace. |
| 37 | |
| 38 | === Private default constructor === |
| 39 | I'm making the default constructor private simply because I can not think of a reasonable default for the class to have. I'd bet good money that having the data output to the console was not what the user wanted! Guessing a default file could potentially be disasterous: if we don't overwrite an already existing file, all of the user's efforts would be for naught. If we overwrite an existing file, we could overwrite something the user would have preferred to keep. As a result, I find it reasonable to expect the user to specify a stream when they create the svg object, in keeping with Scott Meyer's suggestion that incorrect use of the interface should not compile. |
| 40 | |
| 41 | === To be continued... === |
| 42 | |
| 43 | ---- |
| 44 | = 3. To Do List = |
| 45 | |
| 46 | * Finish organizing this wiki |
| 47 | * Set up codebase in SVN |
| 48 | * Clean up demo code. Perhaps I could comment a little better |
| 49 | * Explore compression of the output file |
| 50 | * Allow any STL-compliant container to be input |
| 51 | * Fully support chaining of the overloaded input operator |