Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r51704 - in sandbox/SOC/2007/visualization/boost/svg_plot: . detail
From: pbristow_at_[hidden]
Date: 2009-03-11 11:45:37


Author: pbristow
Date: 2009-03-11 11:45:36 EDT (Wed, 11 Mar 2009)
New Revision: 51704
URL: http://svn.boost.org/trac/boost/changeset/51704

Log:
Changes to use of separator - now , means stay on same line. still now checked 2d version fully.

Added image size.
Text files modified:
   sandbox/SOC/2007/visualization/boost/svg_plot/detail/FP_compare.hpp | 37 ++++++++-------
   sandbox/SOC/2007/visualization/boost/svg_plot/detail/axis_plot_frame.hpp | 94 +++++++++++++++++++++++++--------------
   sandbox/SOC/2007/visualization/boost/svg_plot/detail/pair.hpp | 10 +++
   sandbox/SOC/2007/visualization/boost/svg_plot/show_1d_settings.hpp | 6 +-
   sandbox/SOC/2007/visualization/boost/svg_plot/show_2d_settings.hpp | 10 +--
   sandbox/SOC/2007/visualization/boost/svg_plot/svg.hpp | 26 +++++++---
   sandbox/SOC/2007/visualization/boost/svg_plot/svg_1d_plot.hpp | 6 +
   sandbox/SOC/2007/visualization/boost/svg_plot/svg_2d_plot.hpp | 4
   sandbox/SOC/2007/visualization/boost/svg_plot/svg_style.hpp | 65 +++++++++++++--------------
   9 files changed, 150 insertions(+), 108 deletions(-)

Modified: sandbox/SOC/2007/visualization/boost/svg_plot/detail/FP_compare.hpp
==============================================================================
--- sandbox/SOC/2007/visualization/boost/svg_plot/detail/FP_compare.hpp (original)
+++ sandbox/SOC/2007/visualization/boost/svg_plot/detail/FP_compare.hpp 2009-03-11 11:45:36 EDT (Wed, 11 Mar 2009)
@@ -1,18 +1,19 @@
 /*! \file FP_compare.hpp
     \brief Two types of floating-point comparison "Very close" and "Close enough" to a chosen tolerance.
+ \details
+ Derived from Boost.Test Copyright Gennadiy Rozental 2001-2007.
+ See http://www.boost.org/libs/test for the library home page.
+ Deliberately removed any treatment of percent to avoid further potential confusion!
+ \date Mar 2009
     \author Paul A. Bristow
 */
 
-// Copyright Paul A. Bristow 2008
+// Copyright Paul A. Bristow 2008, 2009
 
 // Distributed under the Boost Software License, Version 1.0.
 // (See accompanying file LICENSE_1_0.txt or copy at
 // http://www.boost.org/LICENSE_1_0.txt)
 
-// Derived from Boost.Test Copyright Gennadiy Rozental 2001-2007.
-// See http://www.boost.org/libs/test for the library home page.
-// Deliberately removed any treatment of percent to avoid further potential confusion!
-
 #ifndef BOOST_FLOATING_POINT_COMPARISON_HPP
 #define BOOST_FLOATING_POINT_COMPARISON_HPP
 
@@ -23,7 +24,6 @@
 //{
 // namespace math
 // {
- // Reminder - add full specification to \enum \class etc
 
 // Check two floating-point values are close within a chosen tolerance.
 template<typename FPT> class close_to;
@@ -34,10 +34,10 @@
 enum floating_point_comparison_type
 { /*! \enum floating_point_comparison_type
    \brief Two types of floating-point comparison "Very close" and "Close enough".
- \details equations in Dougles E. Knuth, Seminumerical algorithms (3rd Ed) section 4.2.4, Vol II,
+ \details equations in Douglas E. Knuth, Seminumerical algorithms (3rd Ed) section 4.2.4, Vol II,
     pp 213-225, Addison-Wesley, 1997, ISBN: 0201896842.\n
- Strong requires closeness relative to \b BOTH values being compared,
- Weak only requires only closeness relative to \b EITHER \b ONE value.
+ Strong requires closeness relative to \b both values being compared,
+ Weak only requires only closeness relative to \b either \b one value.
   */
   FPC_STRONG, //!< "Very close" - Knuth equation 1 (the default).
   FPC_WEAK //!< "Close enough" - Knuth equation 2.
@@ -66,7 +66,7 @@
 
 template<typename FPT> FPT
 fpt_abs(FPT arg)
-{ //! abs function (just in case abs is not defined for User-defined FPT).
+{ //! abs function (just in case abs is not defined for a user-defined FPT).
   return arg <static_cast<FPT>(0) ? -arg : arg;
 }
 
@@ -100,7 +100,7 @@
 
   */
 public:
- // One constructor for fraction tolerance only. (Percent is NOT implemented).
+ // One constructor for fraction tolerance only. (By design, percent is NOT implemented ).
   template<typename FPT>
   explicit close_to(FPT tolerance,
     floating_point_comparison_type fpc_type = FPC_STRONG)
@@ -140,7 +140,7 @@
 
   template<typename FPT>
   FPT size()
- { //! Get the chosen fraction_tolerance_.
+ { //! Get the chosen tolerance, as a fraction.
     return fraction_tolerance_;
   }
 
@@ -150,16 +150,16 @@
   }
 
 private:
- FPT fraction_tolerance_; //! tolerance as a fraction.
- floating_point_comparison_type strong_or_weak_; //! Knuth's "Very close" (equation 1), the default, or "Close enough" (equation 2).
+ FPT fraction_tolerance_; //!< tolerance as a fraction.
+ floating_point_comparison_type strong_or_weak_; //!< Knuth's "Very close" (equation 1), the default, or "Close enough" (equation 2).
 
 }; // class close_to
 
 template<typename FPT = double>
 class smallest
 { /*! \class smallest
- \brief Check floating-point value is smaller than a chosen small value,
- default twice min_value() for the Floating-point type.
+ \brief Check floating-point value is smaller than a chosen small value,
+ default is twice min_value() for the floating-point type FPT.
       \details
        It is somewhat common for beginners to add a comparison check to 0 before
        computing a division, in order to avoid possible division-by-zero exceptions or
@@ -172,6 +172,7 @@
        does, that is, the program may actually test that x == 0, then, further down,
        find that x = 0 without any apparent change to x!\n
        David Monniaux, http://arxiv.org/abs/cs/0701192v4.
+ \tparam FPT A floating-point type, float, double, long double or user-defined like NTL quad_float or RR.
    */
 
 public:
@@ -235,14 +236,14 @@
 typedef smallest<double> tiny;
 /*!
   \typedef tiny
- \brief Allow tiny as a shorthand for double min_value 4.45e-308.
+ \brief Allow tiny as a shorthand for twice the double min_value 4.45e-308.
   \details Since double and the default smallest value 2 * std::numeric_limits<double>::min_value() = 2 * 2.22507e-308 + 4.45015e-308
   is a very common requirement, provide an convenience alias for this.
 */
 
 /*!
   \typedef neareq
- \brief Allow neareq as a shorthand for 2 double epsilon = 4.44e-16
+ \brief Allow neareq as a shorthand for twice double epsilon = 4.44e-16
   \details Since double and the default close_to value 2 * epsilon = std::numeric_limits<double>::epsilon = 2 * 2.220446e-016 = 4.440892e-016
   is a very common requirement, provide an convenience alias for this.
 */

Modified: sandbox/SOC/2007/visualization/boost/svg_plot/detail/axis_plot_frame.hpp
==============================================================================
--- sandbox/SOC/2007/visualization/boost/svg_plot/detail/axis_plot_frame.hpp (original)
+++ sandbox/SOC/2007/visualization/boost/svg_plot/detail/axis_plot_frame.hpp 2009-03-11 11:45:36 EDT (Wed, 11 Mar 2009)
@@ -1,7 +1,7 @@
  /*! \file axis_plot_frame.hpp
   \brief SVG Plot functions common to 1D, 2D and Boxplots.
   \details Functions are derived from base class axis_plot_frame.
- \date 11 Feb 2009
+ \date Mar 2009
   \author Jacob Voytko and Paul A. Bristow
 */
 
@@ -20,7 +20,7 @@
 #include "../svg.hpp"
 #include "svg_tag.hpp"
 #include "numeric_limits_handling.hpp"
-//using boost::math::fpclassify for
+// using boost::math::fpclassify for
 // boost::math::
 // template <class T>bool isfinite (T);
 // template <class T>bool isinf (T);
@@ -33,9 +33,9 @@
 // using std::string;
 
 #include <iostream> // for testing only.
- using std::cerr;
- using std::cout;
- using std::endl;
+ //using std::cerr;
+ //using std::cout;
+ //using std::endl;
 
 #include <utility>
 // using std::pair
@@ -48,8 +48,8 @@
     // when they are in svg_2d_plot.hpp
 
     static const double sin45 = 0.707; //!< Use to calculate 'length' if axis value labels are sloping.
- static const double reducer = 0.9; // To make uncertainty and df a bit smaller to distinguish from value.
- // 0.8 reduced from value 12, to 9 which is a bit too small.
+ static const double reducer = 0.9; //!< To make uncertainty and degrees of freedom testimates a bit smaller to distinguish from value.
+ // (0.8 reduced from value 12, to 9 which is a bit too small).
 
     // x_axis_position_ and y_axis_position_ use x_axis_intersect & y_axis_intersect
     enum x_axis_intersect
@@ -74,11 +74,11 @@
       outside_right = +2, //!< Outside right (Default).
       outside_top = +3, //!< Outside at top.
       outside_bottom = +4, //!< Outside at bottom.
- somewhere = +5 //! legend_top_left(x, y)
+ somewhere = +5 //!< legend_top_left(x, y)
     };
 
     namespace detail
- {
+ { //! \namespace detail Holds base class axis_plot_frame for 1D, 2D and Box plots.
       template <class Derived>
       class axis_plot_frame
       { /*! \class boost::svg::detail::axis_plot_frame
@@ -104,6 +104,9 @@
         // void draw_title();
         // void adjust_limits(double& x, double& y);
         // void draw_plot_point(double x, double y, g_element& g_ptr, const plot_point_style& sty);
+ // void draw_plot_point_value(double x, double y, g_element& g_ptr, value_style& val_style, plot_point_style& point_style, unc uvalue);
+ // void draw_plot_point_values(double x, double y, g_element& x_g_ptr, g_element& y_g_ptr, const value_style& x_sty, const value_style& y_sty, unc uncx, unc uncy);
+
 
         // Clear functions.
         // void clear_all(); // Calls all the other clear_* functions.
@@ -125,12 +128,12 @@
         // This implies that user's choice of X-axis range is wrong?
         // So more drastic action like throwing might be least worst action?
 
- void transform_x(double & x)
+ void transform_x(double& x)
         { //! Scale and shift X value only.
           x = derived().x_scale_ * x + derived().x_shift_;
         }
 
- void transform_y(double & y)
+ void transform_y(double& y)
         { //! Scale and shift Y value only.
           y = derived().y_scale_ * y + derived().y_shift_;
         }
@@ -1027,7 +1030,7 @@
 
           void draw_plot_point_value(double x, double y, g_element& g_ptr, value_style& val_style, plot_point_style& point_style, unc uvalue)
           { /*! Write one data point (X or Y) value as a string, for example "1.23e-2", near the data point marker.
- Unecessary e, +, & leading exponent zeros may optionally be stripped, and the position and rotation controlled.
+ Unecessary e, +, \& leading exponent zeros may optionally be stripped, and the position and rotation controlled.
              Uncertainty estimate ('plus or minus') may be optionally be appended.
              Degrees of freedom estimate (number of replicates) may optionally be appended.
              For example: "3.45 +-0.1(10)"\n
@@ -1084,7 +1087,9 @@
               al = center_align;
               y += marker_size; // Down marker font size;
              break;
- case uphill: // -45 - OK
+ case slopeup: // -30 - OK
+ case steepup: // -45 - OK
+ case uphill: // -60 - OK
               al = left_align;
               x += label_size /3; // Right third label font size - centers on marker.
               y -= marker_size * 0.6; // UP marker font size;
@@ -1100,8 +1105,11 @@
               y -= marker_size * 0.8; // Up
               rot = downhill;
               break;
- case downhill: // OK
- al = left_align;
+
+ case slopedownhill: // 30 gentle slope down.
+ case downhill: // 45 down.
+ case steepdown: // 60 steeply down.
+ al = left_align;
               x += marker_size * 0.4; // Right;
               y += marker_size * 0.9; // Down
               break;
@@ -1140,7 +1148,6 @@
               label_u = sv(u, val_style, true); // stripped.
               t.tspan(pm).fill_color(val_style.plusminus_color_);
               t.tspan(label_u).fill_color(val_style.plusminus_color_).font_size(udf_font);
- // TODO Colors should not be hard coded.
             }
             if (val_style.df_on_ == true // Is wanted.
                   && (df != (std::numeric_limits<unsigned short int>::max)()) // and deg_free is defined OK.
@@ -1154,6 +1161,10 @@
               label_df = label.str();
               t.tspan(label_df).fill_color(val_style.df_color_).font_size(udf_font);
             }
+ if (val_style.suffix_ != "")
+ { // Want a suffix like "]" or " sec]".
+ t.tspan(val_style.suffix_);
+ }
 
           } // void draw_plot_point_value(double x, double y, g_element& g_ptr, double value)
 
@@ -1175,15 +1186,19 @@
           } // std::string sv(double v, const value_style& sty)
 
           void draw_plot_point_values(double x, double y, g_element& x_g_ptr, g_element& y_g_ptr, const value_style& x_sty, const value_style& y_sty, unc uncx, unc uncy)
- { //! Write the \b pair of data point's X and Y values as a string,.
- //! If a separator, then both on the same line, for example "1.23, 3.45", or "[5.6, 7.8]
- //! X value_style is used to provide the prefix and separator, and Y value_style to provide the suffix.
- //! For example, x_style prefix("[ X=", and separator ",\&#x00A0;Y= ", " and Y value_style = "]"
- //! will produce a value label like "[X=-1.23, Y=4.56]"
- //! Note the need to use a Unicode space \&#x00A0; for get space for all browsers.
- //! For as long a string as this you may need to make the total image size bigger,
- //! and to orient the value labels with care.
- // draw_plot_point_values is only when both x and Y pairs are wanted.
+ { /*! \brief Write the \b pair of data point's X and Y values as a string.
+ \details If a separator, then both on the same line, for example "1.23, 3.45", or "[5.6, 7.8]
+ \verbatim
+ X value_style is used to provide the prefix and separator, and Y value_style to provide the suffix.
+ For example, x_style prefix("[ X=", and separator ",<ampersand>#x00A0;Y= ", " and Y value_style = "]"
+ will produce a value label like "[X=-1.23, Y=4.56]"
+ Note the need to use a Unicode space <ampsand>#x00A0; for get space for all browsers.
+ For as long a string as this you may need to make the total image size bigger,
+ and to orient the value labels with care.
+ draw_plot_point_values is only when both x and Y pairs are wanted.
+ \endverbatim
+ */
+ // verbatim needed to avoid a warning about using \&#x00A0; within Doxygen comment.
             using std::string;
             using std::stringstream;
             double vx = uncx.value();
@@ -1234,7 +1249,9 @@
               al = center_align;
               y += marker_size; // Down marker font size;
              break;
- case uphill: // -45 - OK
+ case slopeup: // -30 - OK
+ case steepup: // -45 - OK
+ case uphill: // -60 - OK
               al = left_align;
               x += label_size /3; // Right third label font size - centers on marker.
               y -= marker_size * 0.6; // UP marker font size;
@@ -1250,7 +1267,9 @@
               y -= marker_size * 0.8; // Up
               rot = downhill;
               break;
- case downhill: // OK
+ case slopedownhill: // 30 gentle slope down.
+ case downhill: // 45 down.
+ case steepdown: // 60 steeply down.
               al = left_align;
               x += marker_size * 0.4; // Right;
               y += marker_size * 0.9; // Down
@@ -1278,7 +1297,7 @@
 
             int fx = static_cast<int>(x_sty.values_text_style_.font_size() * reducer);
             // Make uncertainty and df a bit smaller to distinguish from value by default (but make configurable).
- // X value (and optional uncertainty & df).
+ // X value (and optional uncertainty and df).
             text_element& t = x_g_ptr.text(x, y, label_xv, x_sty.values_text_style_, al, rot);
             // Optionally, show uncertainty as 95% confidence plus minus: 2.1 +-0.012
             // and also optionally show degrees of freedom (23).
@@ -1311,11 +1330,11 @@
               t.tspan(label_xdf).fill_color(x_sty.df_color_).font_size(fx);
             }
             int fy = static_cast<int>(y_sty.values_text_style_.font_size() * reducer);
- // If there is a separator, put values on the same line, else as below put below the marker.
- bool sameline = (x_sty.separator_ != ""); // Might add to value_style? to allow 1.2, with 3.4 on line below.
+ // If there a comma is 1st char in separator, put values on the same line, else as below put below the marker.
+ bool sameline = (x_sty.separator_[0] == ','); // Might add to value_style? to allow 1.2, with 3.4 on line below.
             if (sameline)
             { // On same line so no change in y.
- t.tspan(x_sty.separator_).fill_color(black).font_size(fx); // Separator like comma and leading space ", ".
+ t.tspan(x_sty.separator_).fill_color(black).font_size(fx); // Separator like comma and Unicode leading space ", Y=".
               t.tspan(label_yv, y_sty.values_text_style_); // Color?
               if (
                    (y_sty.plusminus_on_) // Is wanted.
@@ -1468,6 +1487,7 @@
           // and so is returned by get functions.
 
           Derived& size(unsigned int x, unsigned int y);
+ std::pair<double, double> image_size();
           unsigned int image_x_size();
           Derived& image_x_size(unsigned int i);
           unsigned int image_y_size();
@@ -1674,7 +1694,7 @@
           bool x_df_on();
           Derived& x_df_color(const svg_color& col);
           svg_color x_df_color();
- Derived& x_decor(const std::string& pre, const std::string& sep, const std::string& suf);
+ Derived& x_decor(const std::string& pre, const std::string& sep = "", const std::string& suf = "");
           const std::string x_suffix();
           const std::string x_separator();
           const std::string x_prefix();
@@ -1798,8 +1818,14 @@
           }
 
           template <class Derived>
+ std::pair<double, double> axis_plot_frame<Derived>::image_size()
+ { //! \return SVG image size horizontal width and vertical height (SVG units, default pixels).
+ return derived().image.size();
+ }
+
+ template <class Derived>
           unsigned int axis_plot_frame<Derived>::image_x_size()
- { //! \return SVG image X-axis size (SVG units, default pixels).
+ { //! \return SVG image X-axis size as horizontal width (SVG units, default pixels).
             return derived().image.x_size();
           }
 
@@ -1812,7 +1838,7 @@
 
           template <class Derived>
           unsigned int axis_plot_frame<Derived>::image_y_size()
- { //! \return SVG image Y-axis size (SVG units, default pixels).
+ { //! \return SVG image Y-axis size as vertical height (SVG units, default pixels).
             return derived().image.y_size();
           }
 

Modified: sandbox/SOC/2007/visualization/boost/svg_plot/detail/pair.hpp
==============================================================================
--- sandbox/SOC/2007/visualization/boost/svg_plot/detail/pair.hpp (original)
+++ sandbox/SOC/2007/visualization/boost/svg_plot/detail/pair.hpp 2009-03-11 11:45:36 EDT (Wed, 11 Mar 2009)
@@ -16,6 +16,9 @@
 #ifndef BOOST_SVG_PAIR
 #define BOOST_SVG_PAIR
 
+#include <boost/svg_plot/uncertain.hpp>
+// using boost::svg::unc;
+
 #include<iostream>
  // using std::ostream;
 
@@ -29,11 +32,12 @@
 {
 namespace detail
 {
+
   // Hidden in namespace detail to avoid clashes with other implementations of std::pair operator<<.
   template<class T1, class T2>
   std::ostream& operator<< (std::ostream& os, const std::pair<T1, T2>& p);
   std::ostream& operator<< (std::ostream& os, const std::pair<double, double>& p);
- //std::ostream& operator<< (std::ostream& os, const std::pair<unc, unc>& p);
+ // std::ostream& operator<< (std::ostream& os, const std::pair<boost::svg::unc, boost::svg::unc>& p);
 
   template<class T1, class T2>
   std::ostream& operator<< (std::ostream& os, const std::pair<T1, T2>& p)
@@ -52,6 +56,10 @@
       return os;
   } // std::ostream& operator<<
 
+
+
+
+
   //std::pair<class T1, class T2>& operator=(const pair& rhs)
   //{
   // first = rhs.first;

Modified: sandbox/SOC/2007/visualization/boost/svg_plot/show_1d_settings.hpp
==============================================================================
--- sandbox/SOC/2007/visualization/boost/svg_plot/show_1d_settings.hpp (original)
+++ sandbox/SOC/2007/visualization/boost/svg_plot/show_1d_settings.hpp 2009-03-11 11:45:36 EDT (Wed, 11 Mar 2009)
@@ -172,9 +172,7 @@
 
   int iostate = cout.flags(); // Save to restore one exit.
   cout << dec << std::boolalpha << endl;
- cout << endl;
- //cout << ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" << "image_filename() " << plot.image.image_filename() << endl;
- // doesn't work - no filename is shown.
+ cout << endl;
 
   cout << "axes_on " << plot.axes_on() << endl;
   cout << "background_border_width " << plot.background_border_width() << endl;
@@ -190,6 +188,8 @@
   //cout << plot.draw_bezier_lines() << endl;
   cout << "image_x_size " << plot.image_x_size() << endl;
   cout << "image_y_size " << plot.image_y_size() << endl;
+ cout << "image_size " << plot.image_size() << endl;
+ cout << "image_filename " << plot.image.image_filename() << endl;
   cout << "legend_on " << plot.legend_on() << endl;
   std::pair<double, double> lt = plot.legend_top_left();
   std::pair<double, double> rb = plot.legend_bottom_right();

Modified: sandbox/SOC/2007/visualization/boost/svg_plot/show_2d_settings.hpp
==============================================================================
--- sandbox/SOC/2007/visualization/boost/svg_plot/show_2d_settings.hpp (original)
+++ sandbox/SOC/2007/visualization/boost/svg_plot/show_2d_settings.hpp 2009-03-11 11:45:36 EDT (Wed, 11 Mar 2009)
@@ -9,7 +9,7 @@
 */
 
 // Copyright Jacob Voytko 2007
-// Copyright Paul A. Bristow 2007
+// Copyright Paul A. Bristow 2007, 2009
 
 // Use, modification and distribution are subject to the
 // Boost Software License, Version 1.0.
@@ -128,8 +128,6 @@
   int iostate = cout.flags(); // Save to restore one exit.
   cout << dec << std::boolalpha << endl;
   cout << endl;
- //cout << ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" << "image_filename() " << plot.image.image_filename() << endl;
- // doesn't work - no filename is shown.
 
   cout << "axes_on " << plot.axes_on() << endl;
   cout << "background_border_width " << plot.background_border_width() << endl;
@@ -145,6 +143,8 @@
   //cout << plot.draw_bezier_lines() << endl;
   cout << "image_x_size " << plot.image_x_size() << endl;
   cout << "image_y_size " << plot.image_y_size() << endl;
+ cout << "image_size " << plot.image_size() << endl;
+ cout << "image_filename " << plot.image.image_filename() << endl;
   cout << "legend_on " << plot.legend_on() << endl;
   std::pair<double, double> lt = plot.legend_top_left();
   std::pair<double, double> rb = plot.legend_bottom_right();
@@ -252,7 +252,6 @@
   cout << "x_prefix " << plot.x_prefix() << endl;
   cout << "x_separator " << plot.x_separator() << endl;
   cout << "x_suffix " << plot.x_suffix() << endl;
-
   cout << "xy_values_on " << plot.xy_values_on() << endl;
   cout << "y_label_on " << plot.y_label_on() << endl;
   cout << "y_label_axis " << plot.y_label_axis() << endl;
@@ -294,7 +293,7 @@
   cout << "y_ticks_on_window_or_axis " << l_or_r(plot.y_ticks_on_window_or_axis()) << endl;
   cout << "y_max " << plot.y_max() << endl;
   cout << "y_min " << plot.y_min() << endl;
- //cout << "y_values_on " << plot.y_values_on() << endl;
+ cout << "y_values_on " << plot.y_values_on() << endl;
   cout << "y_plusminus_on " << plot.y_plusminus_on() << endl;
   cout << "y_plusminus_color " << plot.y_plusminus_color() << endl;
   cout << "y_df_on " << plot.y_df_on() << endl;
@@ -305,7 +304,6 @@
 
   cout << "data lines width " << plot.data_lines_width() << endl;
 
-
  cout.flags(iostate); // Restore.
 } // void show_plot_settings(svg_2d_plot& plot)
 

Modified: sandbox/SOC/2007/visualization/boost/svg_plot/svg.hpp
==============================================================================
--- sandbox/SOC/2007/visualization/boost/svg_plot/svg.hpp (original)
+++ sandbox/SOC/2007/visualization/boost/svg_plot/svg.hpp 2009-03-11 11:45:36 EDT (Wed, 11 Mar 2009)
@@ -7,6 +7,7 @@
 
   \version 1.1
   \author Jacob Voytko & Paul A. Bristow
+ \date Mar 2009
  */
 
 /*!
@@ -108,7 +109,7 @@
 
   */
 // Copyright Jacob Voytko 2007
-// Copyright Paul A Bristow 2007
+// Copyright Paul A Bristow 2007, 2009
 
 // Use, modification and distribution are subject to the
 // Boost Software License, Version 1.0.
@@ -283,8 +284,7 @@
   }
 
   void write_css(std::ostream& s_out)
- { //! Output CSS (Cascading Style Sheet)
- // Not used at present.
+ { //! Output CSS (Cascading Style Sheet) - (not yet used or implemented).
     if (css_.size() != 0) // css != ""
     { // TODO confirm that this isn't useful if css is "".
       // [CDATA[ ... ]] enclosing the style information
@@ -366,17 +366,25 @@
   }
 
   unsigned int x_size()
- { //! \return X-axis (horizontal) image size.
+ { //! \return X-axis (horizontal width) SVG image size.
     return x_size_;
   }
 
   unsigned int y_size()
- { //! \return Y-axis (vertical) image size.
+ { //! \return Y-axis (vertical height) SVG image size.
     return y_size_;
   }
 
+ std::pair<double, double> size()
+ { //! \return the size (horizontal width and vertical height) of the SVG image.
+ std::pair<double, double> r;
+ r.first =x_size_;
+ r.second = y_size_;
+ return r;
+ }
+
   unsigned int document_size()
- { //! How many elements have been added to document.
+ { //! How many elements (groups or layers) have been added to document.
     return static_cast<unsigned int>(document.size());
   }
 
@@ -396,7 +404,7 @@
   }
 
   int coord_precision()
- { //!< \return decimal digits to be output for X and Y coordinates.
+ { //! \return decimal digits to be output for X and Y coordinates.
     return coord_precision_;
   }
 
@@ -412,7 +420,7 @@
   // --------------------------------------------------------------------------------
 
   void write(const std::string& filename)
- { //!< Write whole .svg 'file' contents to file.
+ { //! Write whole .svg 'file' contents to file.
     std::string file(filename); // Copy to avoid problems with const if need to append.
     if (file.find('.') == std::string::npos)
     { // No file type suffix, so provide the default .svg.
@@ -430,7 +438,7 @@
   }
 
   void write(std::ostream& s_out)
- { //!< Write whole .svg 'file' contents to stream (perhaps a file).
+ { //! Write whole .svg 'file' contents to stream (perhaps a file).
     write_header(s_out); // "<?xml version=...
     // write svg document, begin <svg tag.
     // <svg xml:space="preserve" width="5.5in" height=".5in">

Modified: sandbox/SOC/2007/visualization/boost/svg_plot/svg_1d_plot.hpp
==============================================================================
--- sandbox/SOC/2007/visualization/boost/svg_plot/svg_1d_plot.hpp (original)
+++ sandbox/SOC/2007/visualization/boost/svg_plot/svg_1d_plot.hpp 2009-03-11 11:45:36 EDT (Wed, 11 Mar 2009)
@@ -252,7 +252,8 @@
      See also svg_2d_plot.hpp for 2-D version.
     */
 
- friend void show_plot_settings(svg_1d_plot&);
+ friend void show_1d_plot_settings(svg_1d_plot&);
+ friend void show_2d_plot_settings(svg_1d_plot&);
   friend class detail::axis_plot_frame<svg_1d_plot>;
 
  protected:
@@ -415,7 +416,8 @@
     x_axis_position_(0) // Move into axis_style?
   {
     size(500, 200); // Default image size.
- // Only need to be quite shallow (y_size) for a 1-D plot.
+ // Only needs to be quite shallow (y_size) for a 1-D plot.
+ // (But may need more height if long value labels are used, for example: "[time = 1.23 +-0.02 sec]").
     // 200 barely leaves enough room for five data series in the legend).
     // (2-D usually needs to be much more rectangular).
 

Modified: sandbox/SOC/2007/visualization/boost/svg_plot/svg_2d_plot.hpp
==============================================================================
--- sandbox/SOC/2007/visualization/boost/svg_plot/svg_2d_plot.hpp (original)
+++ sandbox/SOC/2007/visualization/boost/svg_plot/svg_2d_plot.hpp 2009-03-11 11:45:36 EDT (Wed, 11 Mar 2009)
@@ -334,7 +334,7 @@
 
        See also svg_1d_plot.hpp for 1-D version.
     */
- friend void show_plot_settings(svg_2d_plot&);
+ friend void show_2d_plot_settings(svg_2d_plot&);
      friend svg_2d_plot_series;
      friend class detail::axis_plot_frame<svg_2d_plot>;
      // axis_plot_frame.hpp contains functions common to 1 and 2-D.
@@ -2255,7 +2255,7 @@
       }
 
       std::pair<double, double> svg_2d_plot::y_range()
- { //! Set the range (max and min) for Y axis from the pair parameter provided.
+ { //! \return the range (max and min) for Y axis.
         std::pair<double, double> r;
         r.first = y_axis_.min_;
         r.second = y_axis_.max_;

Modified: sandbox/SOC/2007/visualization/boost/svg_plot/svg_style.hpp
==============================================================================
--- sandbox/SOC/2007/visualization/boost/svg_plot/svg_style.hpp (original)
+++ sandbox/SOC/2007/visualization/boost/svg_plot/svg_style.hpp 2009-03-11 11:45:36 EDT (Wed, 11 Mar 2009)
@@ -1,17 +1,16 @@
 /*!
   \file svg_style.hpp
-
   \brief Styles for SVG specifying font, sizes, shape, color etc for text, values, lines, axes etc.
   \details SVG style information is fill, stroke, width, line & bezier curve.
    This module provides struct plot_point_style & struct plot_line_style
    and class svg_style holding the styles.
    See http://www.w3.org/TR/SVG11/styling.html
-
+ \date Mar 2009
   \author Jacob Voytko and Paul A. Bristow
 */
 
 // Copyright Jacob Voytko 2007
-// Copyright Paul A. Bristow 2008
+// Copyright Paul A. Bristow 2008, 2009
 
 // Use, modification and distribution are subject to the
 // Boost Software License, Version 1.0.
@@ -26,6 +25,7 @@
 #endif
 
 #include "svg_color.hpp"
+// using svg_color
 #include "detail/svg_style_detail.hpp"
 
 #include <iostream>
@@ -77,26 +77,26 @@
 double string_svg_length(const std::string& s, const text_style& style);
 // Estimate length of string when appears as svg units.
 
-/*
-\verbatim
+/*!
  This is the style information for any group (g) tag.
  This may be expanded to include more data from the SVG standard.
 
  There are some strange effects for text on some browsers
  (Firefox especially) when only stroke is specified.
  fill is interpreted as black, and the font outline is fuzzy and bolder.
- <g id="title" stroke="rgb(255,0,0)"> .. is red border and black fill.
- (because created as a graphic not a builtin font?)
- <g id="title" fill="rgb(255,0,0)"> .. is red sharp font.
- <g id="title" stroke="rgb(255,0,0)" fill="rgb(255,0,0)"> red and red fill also fuzzy.
- So for text, only specific the fill unless a different outline is really wanted.
- Defaults for text provide a built-in glyph, for example for title:
- <g id="title">
- <text x="250" y="36" text-anchor="middle" font-size="18" font-family="Verdana">
- Plot of data
- </text>
- </g>
- and this is not a graphic.
+\verbatim
+ <g id="title" stroke="rgb(255,0,0)"> .. is red border and black fill.
+ (because created as a graphic not a builtin font?)
+ <g id="title" fill="rgb(255,0,0)"> .. is red sharp font.
+ <g id="title" stroke="rgb(255,0,0)" fill="rgb(255,0,0)"> red and red fill also fuzzy.
+ So for text, only specific the fill unless a different outline is really wanted.
+ Defaults for text provide a built-in glyph, for example for title:
+ <g id="title">
+ <text x="250" y="36" text-anchor="middle" font-size="18" font-family="Verdana">
+ Plot of data
+ </text>
+ </g>
+ and this is not a graphic.
  \endverbatim
 */
 
@@ -138,7 +138,7 @@
 
   void write(std::ostream& os); // Output to file or stream.
 
- // comparison operators (useful for testing at least).
+ // Comparison operators (useful for testing at least).
   bool operator==(svg_style& s);
   bool operator!=(svg_style& s);
 }; // class svg_style
@@ -150,31 +150,31 @@
   :
   stroke_(stroke), fill_(fill), width_(width),
   stroke_on_(false), fill_on_(false), width_on_(false)
- { // Construct with specified fill and stroke colors, and width.
+ { //! Construct svg_style with specified fill and stroke colors, and width.
   }
 
   svg_style::svg_style()
- :
- stroke_(svg_color(0, 0, 0)), // == black.
- fill_(blank),
- width_(0), // No width specified.
- fill_on_(false), stroke_on_(false), width_on_(false)
+ : //! Default svg_style has everything off.
+ stroke_(svg_color(0, 0, 0)), //! Stroke default is black.
+ fill_(blank), //! No fill color.
+ width_(0), //! No width specified.
+ fill_on_(false), stroke_on_(false), width_on_(false) //! All switches off.
   { // Default constructor initialises all private data.
   }
 
   // Member Functions definitions.
   svg_color svg_style::fill_color() const
- { //! \return SVG fill color.
+ { //! \return SVG fill color.
     return svg_color(fill_);
   }
 
   svg_color svg_style::stroke_color() const
- { //! \return SVG stroke color.
+ { //! \return SVG stroke color.
     return svg_color(stroke_);
   }
 
   double svg_style::stroke_width() const
- { //! \return SVG stroke width.
+ { //! \return SVG stroke width.
     return width_;
   }
 
@@ -186,8 +186,7 @@
   svg_style& svg_style::fill_on(bool is)
   { //! Set fill is wanted.
     fill_on_ = is;
- return *this; // Make chainable.
- //! \return svg_style& to make chainable.
+ return *this; //! \return svg_style& to make chainable.
   }
 
   bool svg_style::stroke_on() const
@@ -235,7 +234,7 @@
   }
 
   bool svg_style::operator==(svg_style& s)
- { //! Compare styles.
+ { //! Compare svg_styles.
      return (s.fill_color() == fill_)
        && (s.stroke_color() == stroke_)
        && (s.stroke_width() == width_)
@@ -245,7 +244,7 @@
    }
 
   bool svg_style::operator!=(svg_style& s)
- {//! Compare styles (for inequality).
+ {//! Compare svg_styles (for inequality).
      return (s.fill_color() != fill_)
        || (s.stroke_color() != stroke_)
        || (s.stroke_width() != width_)
@@ -270,9 +269,9 @@
   } // std::ostream& operator<<
 
   void svg_style::write(std::ostream& os)
- { //! Write any stroke, fill colors and/or width info (start with space) to SVG XML document.
+ { //! Write any stroke, fill colors and/or width info to SVG XML document.
     if(stroke_on_)
- {
+ { // (Note: start with space but no terminating space)
         os << " stroke=\"";
         stroke_.write(os);
         os << "\"";


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk