Changes between Version 2 and Version 3 of soc/2007/VisualizationOfContainers


Ignore:
Timestamp:
May 16, 2007, 2:45:38 AM (15 years ago)
Author:
jakevoytko
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • soc/2007/VisualizationOfContainers

    v2 v3  
    11= 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]]
     2This project is focused on using STL containers in order to graph data on a two dimensional (and if time allows, three dimensional!) plot. The graph would be written in an `svg` image, compliant with the W3C standard. The goals of the project are as follows:
     3
     4 * To provide an easy syntax for building graphs
     5 * To let users produce a simple graph with minimal intervention by using sane defaults
     6 * To demonstrate how to incorporate SVG images into Boost documentation
     7 * To allow users to easily customize graphs to their heart's content
     8 * To allow the user to talk with the `svg_graph` class using coordinate units instead of pixels or other arbitrary measures
     9
     10I have only a student's grasp of C++, so if you have a suggestion to help me with design or implementation, either leave them here or email me at jakevoytko [at] gmail [dot] com[[BR]]
    311
    412= 1. User Interface =
     
    1927}}}
    2028
     29== Output ==
     30[[Image(http://www.tcnj.edu/~voytko2/img/image.svg)]]
    2131
    2232----
    2333= 2. Design Decisions =
    2434
    25 == 2.1 svg class ==
     35== 2.1 `svg_graph` class ==
     36'''Currently supported operations of the form `my_graph << function()`:'''
     37 * `x_scale(double, double)` and `y_scale(double, double)`
     38   * Allows the user to set the bottom, top, left, and right edge of the graph
    2639
    27 === Document enum ===
    28 The very first thing the user sees in svg.hpp is the following line:
     40 * `image_size(int, int)`
     41   * This sizes the border of the image. The default right now is up in the air. 100x100 is perhaps unreasonably small for someone with a 1280x1024 monitor, but maybe 300x300 is unreasonably large for someone with 800x600 screen resolution
    2942
    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 }}}
     43 * `set_start(int)`
     44   * Allows the user to set the x-axis location of the first data point. This is important currently because the interface does not yet support coordinate `pair<,>`s, and so the user is stuck defining the interval with which the data is input. Obviously not all data has a uniform distribution, and they'll be able to pass an STL container of pair<,>s in the future to alleviate this problem.
    3545
    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.
     46 * `set_interval(double)`
     47   * This allows the user to set the interval between data points that are being graphed. Again, this is necessary until we allow the user to put in coordinate `pair<,>`s, and will remain necessary after that for users who do not have data in coordinates
    3748
    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.
     49 * `plot_range(std::vector<double>::iterator, std::vector<double>::iterator)`
     50   * Will be the made generic
     51   * Allows the user to input a begin and an end, and have the user plot the data in between
    4052
    41 === To be continued... ===
     53 * `draw_axis()`
     54   * The user specifies that s/he would like the axis drawn in the image.
     55
     56'' '''Inherited from `svg`'''. I am only including the ones it makes sense to include. In the current prototype code, it inherits handling for a few functions that are not only illogical, but produce unexpected results! This will be taken care of.
     57
     58 * `write()`
     59   * Since it would be too much work (and sometimes impossible) to maintain the file without intervention, this function acts as a 'commit'.
     60   * The user can be sure that whenever they have executed this command, the full output is written to the stream they have specified.
     61
     62 * `line_color(svg_color c)`
     63   * Allows users to define a color
     64   * `line_point()` will soon be supported
     65   * Users will be able to define custom colors soon
     66
     67== 2.2 `svg` Class ==
     68All of the design decisions for the `svg` class are motivated by the fact that the `svg` class is the parent for the `svg_graph` class. As such, I tend to treat it as a second-class citizen. My personal tendency is to make it purely a computation and drawing class, and leave all interface work to the `svg_graph` class
     69
     70When I designed the prototype, I made the svg class have a user interface much in the way that the svg_graph class does with the stream operator. However, as I look at the list of features that I'd like the user to be able to access, I will consider the ramifications of removing a user interface for the svg portion, and instead focus it on being the functional backbone of the svg_graph class. I will post to the Boost discussion board and see if people are more interested in eventually having a fully-functioning SVG suite, or more interested in having a fully-functioning graphing utility in the near future.
    4271
    4372----
    4473= 3. To Do List =
    4574
    46  * Finish organizing this wiki
     75== 3.1 Near Future ==
    4776 * Set up codebase in SVN
    48  * Clean up demo code. Perhaps I could comment a little better
    49  * Explore compression of the output file
     77 * Clean up demo code. Comment better, cement next draft of architecture
     78 * Explore size-saving of the output file (I currently don't take advantage of things like paths that the `svg` model has to offer)
    5079 * Allow any STL-compliant container to be input
    5180 * Fully support chaining of the overloaded input operator
     81
     82== 3.2 Medium Future ==
     83 * Explore hover features in the SVG format as a potential way to label data
     84
     85== 3.3 Not So Near Future ==
     86 * Support 3-D graphs