|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r55432 - in sandbox/SOC/2007/visualization/boost/svg_plot: . detail
From: pbristow_at_[hidden]
Date: 2009-08-06 13:20:37
Author: pbristow
Date: 2009-08-06 13:20:36 EDT (Thu, 06 Aug 2009)
New Revision: 55432
URL: http://svn.boost.org/trac/boost/changeset/55432
Log:
lots of changes to try to get indexing by Doxygen, adding doxygen description to declaration as well as definitions in axis_plot frame.
Also deprecated image_x_size in favour of x_size.
Text files modified:
sandbox/SOC/2007/visualization/boost/svg_plot/detail/axis_plot_frame.hpp | 159 +++++++++++++++++++++++++++------------
sandbox/SOC/2007/visualization/boost/svg_plot/detail/svg_tag.hpp | 20 +++--
sandbox/SOC/2007/visualization/boost/svg_plot/show_1d_settings.hpp | 6
sandbox/SOC/2007/visualization/boost/svg_plot/show_2d_settings.hpp | 6
sandbox/SOC/2007/visualization/boost/svg_plot/svg_2d_plot.hpp | 28 +++++-
sandbox/SOC/2007/visualization/boost/svg_plot/svg_boxplot.hpp | 8 +-
sandbox/SOC/2007/visualization/boost/svg_plot/svg_style.hpp | 1
7 files changed, 154 insertions(+), 74 deletions(-)
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-08-06 13:20:36 EDT (Thu, 06 Aug 2009)
@@ -1674,51 +1674,84 @@
// If both are set, stroke is considered 'more important',
// 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();
- Derived& image_y_size(unsigned int i);
- svg_color background_color();
- Derived& background_color(const svg_color& col);
- Derived& background_border_color(const svg_color& col);
- svg_color background_border_color();
- Derived& background_border_width(double w);
- double background_border_width();
- Derived& description(const std::string d);
- const std::string& description();
- Derived& document_title(const std::string d);
- std::string document_title();
- Derived& copyright_holder(const std::string d);
- const std::string copyright_holder();
- Derived& copyright_date(const std::string d);
- const std::string copyright_date();
- Derived& license(std::string repro = "permits",
+ Derived& size(unsigned int x, unsigned int y); //! Set SVG image size (SVG units, default pixels).
+ std::pair<double, double> size(); //! \return SVG image size, both horizontal width and vertical height (SVG units, default pixels).
+
+ Derived& x_size(unsigned int i); //! Set SVG image X-axis size (SVG units, default pixels).
+ unsigned int x_size(); //! \return SVG image X-axis size as horizontal width (SVG units, default pixels).
+ unsigned int image_x_size(); // Obselete - deprecated.
+ Derived& image_x_size(unsigned int i); // Obselete - deprecated.
+
+ unsigned int y_size(); //! \return SVG image Y-axis size as horizontal width (SVG units, default pixels).
+ Derived& y_size(unsigned int i); //! Set SVG image Y-axis size (SVG units, default pixels).
+ unsigned int image_y_size(); //! Obselete - deprecated - use y_size().
+ Derived& image_y_size(unsigned int i); // Obselete - deprecated - y_size(unsigned int i).
+
+ svg_color background_color(); //! \return plot background color.
+ Derived& background_color(const svg_color& col); //! Set plot background border color.
+ Derived& background_border_color(const svg_color& col); //! Set plot background border color.
+ svg_color background_border_color(); //! \return plot background border color.
+ Derived& background_border_width(double w); //! Set plot background border width.
+ double background_border_width(); //! \return plot background border color.
+ Derived& description(const std::string d); //! Writes description to the document for header as <desc> My Description </desc>
+ const std::string& description(); //! \return description of the document for header as <desc> My description </desc>
+ Derived& document_title(const std::string d);
+ std::string document_title(); //! \return document title to the document for header as \verbatim <title> My Title </title> \endverbatim
+ Derived& copyright_holder(const std::string d);//! Writes copyright_holder to the document
+ //! (for header as <!-- SVG Plot Copyright Paul A. Bristow 2007 --> )
+ //! and as \verbatim metadata: <meta name="copyright" content="Paul A. Bristow" /meta> \endverbatim
+ const std::string copyright_holder(); //! \return copyright holder.
+ Derived& copyright_date(const std::string d); //! Writes copyright date to the document.
+ //! and as \verbatim metadata <meta name="date" content="2007" /> \endverbatim
+ const std::string copyright_date(); //! \return copyright_date.
+ Derived& license(
+ std::string repro= "permits",
std::string distrib = "permits",
std::string attrib = "requires",
std::string commercial = "permits",
- std::string derivative = "permits");
- bool license_on();
- Derived& license_on(bool l);
- bool boost_license_on();
- Derived& boost_license_on(bool l);
- const std::string license_reproduction();
- const std::string license_distribution();
- const std::string license_attribution();
- const std::string license_commercialuse();
- Derived& coord_precision(int digits);
- int coord_precision();
- Derived& x_value_precision(int digits);
- int x_value_precision();
- Derived& x_value_ioflags(int flags);
- int x_value_ioflags();
- Derived& x_labels_strip_e0s(bool cmd);
- bool y_labels_strip_e0s();
- Derived& title(const std::string title);
- const std::string title();
- Derived& title_font_size(unsigned int i);
- unsigned int title_font_size();
+ std::string derivative = "permits"); //! Set license conditions for reproduction, atribution, commercial use, and derivative works,
+ //! usually "permits", "requires", or "prohibits",
+ //! and set license_on == true.
+ bool license_on(); //! \return true if license conditions should be included in the SVG document.
+ Derived& license_on(bool l); //! Set if license conditions should be included in the SVG document.
+ bool boost_license_on(); //! \return if the Boost license conditions should be included in the SVG document.
+ Derived& boost_license_on(bool l); //! Set true if the Boost license conditions should be included in the SVG document.
+ const std::string license_reproduction(); //! \return reproduction license conditions, usually "permits", "requires", or "prohibits".
+ const std::string license_distribution(); //! \return distribution license conditions, usually "permits", "requires", or "prohibits".
+ const std::string license_attribution(); //! \return attribution license conditions, usually "permits", "requires", or "prohibits".
+ const std::string license_commercialuse(); //! \return commercial use license conditions, usually "permits", "requires", or "prohibits".
+ Derived& coord_precision(int digits); /*! Precision of SVG coordinates in decimal digits (default 3).
+ 3 decimal digits precision is sufficient for small images.
+ 4 or 5 decimal digits precision will give higher quality plots,
+ especially for larger images, at the expense of larger .svg files,
+ particularly if there are very many data points.
+ */
+ int coord_precision(); //! \return precision of SVG coordinates in decimal digits.
+ Derived& x_value_precision(int digits); /*! Precision of X tick label values in decimal digits (default 3).
+ 3 decimal digits precision is sufficient for small images.
+ 4 or 5 decimal digits precision will give more cluttered plots.
+ If the range of labels is very small, then more digits will be essential.
+ */
+ int x_value_precision(); //! \return precision of X tick label values in decimal digits
+ Derived& x_value_ioflags(int flags); /*! Set iostream std::ios::fmtflags for X value label (default decimal == 0X201).
+ Mainly useful for changing to scientific, fixed or hexadecimal format.
+ For example: .x_value_ioflags(std::ios::dec | std::ios::scientific)
+ */
+ int x_value_ioflags(); //! \return stream std::ios::fmtflags for control of format of X value labels.
+ Derived& x_labels_strip_e0s(bool cmd); //! Set if to strip redundant zeros, signs and exponents, for example, reducing "1.2e+000" to "1.2"
+ //! This markedly reduces visual clutter, and is the default.
+ bool y_labels_strip_e0s(); //! \return if to strip redundant zeros, signs and exponents, for example, reducing "1.2e+000" to "1.2"
+ Derived& title(const std::string title); /*!
+ Set a title for plot.
+ The string may include Unicode for greek letter and symbols.
+ For example a title that includes a greek omega and degree symbols:
+ \verbatim my_plot.title("Plot of Ω function (°C)"); \endverbatim
+
+ Unicode symbols are at http://unicode.org/charts/symbols.html .
+ */
+ const std::string title(); //! \return a title for plot, whose string may include Unicode for greek letter and symbols.
+ Derived& title_font_size(unsigned int i); //! Sets the font size for the title (svg units, default pixels).
+ unsigned int title_font_size(); //! \return the font size for the title (svg units, default pixels).
Derived& title_font_family(const std::string& family);
const std::string& title_font_family();
Derived& title_font_style(const std::string& style);
@@ -2008,7 +2041,7 @@
} // x_autoscale(const T& begin, const T& end)
template <class Derived>
- template <class T> // T an STL container: array, vector ...
+ template <class T> // T an STL container: array, vector...
Derived& axis_plot_frame<Derived>::x_autoscale(const T& container) // Use whole 1D data series.
{ //! Data series (all values) to use to calculate autoscaled X-axis values.
//scale_axis(container.begin(), container.end(), // All the container.
@@ -2031,32 +2064,60 @@
}
template <class Derived>
- std::pair<double, double> axis_plot_frame<Derived>::image_size()
+ std::pair<double, double> axis_plot_frame<Derived>::size()
{ //! \return SVG image size, both horizontal width and vertical height (SVG units, default pixels).
return derived().image_.xy_sizes();
}
template <class Derived>
- unsigned int axis_plot_frame<Derived>::image_x_size()
+ unsigned int axis_plot_frame<Derived>::image_x_size() //!< Obselete - deprecated.
+ { //! \return SVG image X-axis size as horizontal width (SVG units, default pixels).
+ return derived().image_.x_size();
+ }
+
+ template <class Derived>
+ unsigned int axis_plot_frame<Derived>::x_size()
{ //! \return SVG image X-axis size as horizontal width (SVG units, default pixels).
return derived().image_.x_size();
}
template <class Derived>
- Derived& axis_plot_frame<Derived>::image_x_size(unsigned int i)
+ Derived& axis_plot_frame<Derived>::image_x_size(unsigned int i) //!< Obselete - deprecated.
+ { //! Set SVG image X-axis size (SVG units, default pixels).
+ // Can't this be x_size(unsigned int i)
+ derived().image_.x_size(i);
+ return derived();
+ }
+
+ template <class Derived>
+ Derived& axis_plot_frame<Derived>::x_size(unsigned int i)
{ //! Set SVG image X-axis size (SVG units, default pixels).
+ // Can't this be x_size(unsigned int i)
derived().image_.x_size(i);
return derived();
}
template <class Derived>
- unsigned int axis_plot_frame<Derived>::image_y_size()
- { //! \return SVG image Y-axis size as vertical height (SVG units, default pixels).
+ unsigned int axis_plot_frame<Derived>::image_y_size() //!< Obselete - deprecated.
+ { //! \return SVG image Y-axis size as vertical height (SVG units, default pixels).
+ return derived().image_.y_size();
+ }
+
+ template <class Derived>
+ Derived& axis_plot_frame<Derived>::image_y_size(unsigned int i) //!< Obselete - deprecated.
+ {//! Set SVG image Y-axis size (SVG units, default pixels).
+ derived().image_.y_size(i);
+ return derived();
+ }
+
+ template <class Derived>
+ unsigned int axis_plot_frame<Derived>::y_size()
+ { //! \return SVG image Y-axis size as vertical height (SVG units, default pixels).
return derived().image_.y_size();
}
template <class Derived>
- Derived& axis_plot_frame<Derived>::image_y_size(unsigned int i)
+ Derived& axis_plot_frame<Derived>::y_size(unsigned int i)
{//! Set SVG image Y-axis size (SVG units, default pixels).
derived().image_.y_size(i);
return derived();
Modified: sandbox/SOC/2007/visualization/boost/svg_plot/detail/svg_tag.hpp
==============================================================================
--- sandbox/SOC/2007/visualization/boost/svg_plot/detail/svg_tag.hpp (original)
+++ sandbox/SOC/2007/visualization/boost/svg_plot/detail/svg_tag.hpp 2009-08-06 13:20:36 EDT (Thu, 06 Aug 2009)
@@ -241,18 +241,20 @@
public:
line_element(double x1, double y1, double x2, double y2)
: x1_(x1), y1_(y1), x2_(x2), y2_(y2)
- {
+ { // Constructor assigning all line_element private data.
}
line_element(double x1, double y1,
double x2, double y2,
- const svg_style& style_info,
- const std::string& id_name="",
- const std::string& class_name="",
+ // Inherited from svg_element:
+ const svg_style& style_info, // No default?
+ const std::string& id_name = "",
+ const std::string& class_name = "",
const std::string& clip_name = "")
: x1_(x1), y1_(y1), x2_(x2), y2_(y2),
svg_element(style_info, id_name, class_name, clip_name)
- {
+ { // Constructor assigning all line_element private data,
+ // and also inherited svg_element data.
}
void write(std::ostream& rhs)
@@ -288,6 +290,7 @@
qurve_element(double x1, double y1,
double x2, double y2, // Control point - will not pass thru this point.
double x3, double y3,
+ // Inherited from svg_element:
const svg_style& style_info,
const std::string& id_name="",
const std::string& class_name="",
@@ -329,9 +332,9 @@
friend bool operator!=(const rect_element&, const rect_element&);
private:
- double x_; //! x-axis coordinate of the side of the rectangle which has the smaller x-axis coordinate value.
- double y_; //! y-axis coordinate of the side of the rectangle which has the smaller y-axis coordinate value.
- //! So is top left corner of rectangle.
+ double x_; //! X-axis coordinate of the side of the rectangle which has the smaller x-axis coordinate value.
+ double y_; //! Y-axis coordinate of the side of the rectangle which has the smaller y-axis coordinate value.
+ //! So (0, 0) is top left corner of rectangle.
double width_; //! x + width is top right.
double height_; //! y + height is bottom left.
//! x + width and y + height is bottom right.
@@ -343,6 +346,7 @@
}
rect_element(double x, double y, double w, double h,
+ // Inherited from svg_element:
const svg_style& style_info,
const std::string& id_name,
const std::string& class_name,
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-08-06 13:20:36 EDT (Thu, 06 Aug 2009)
@@ -191,9 +191,9 @@
cout << "description "<< plot.description() << endl;
cout << "document_title \"" << plot.document_title() << '"' << endl;
//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 x_size " << plot.x_size() << endl;
+ cout << "image y_size " << plot.y_size() << endl;
+ cout << "image_size " << plot.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();
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-08-06 13:20:36 EDT (Thu, 06 Aug 2009)
@@ -141,9 +141,9 @@
cout << "description " << plot.description() << endl;
cout << "document_title " << '"' << plot.document_title() << '"' << endl;
//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 << "x_size " << plot.x_size() << endl;
+ cout << "image y_size " << plot.y_size() << endl;
+ cout << "image x_size " << plot.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();
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-08-06 13:20:36 EDT (Thu, 06 Aug 2009)
@@ -727,15 +727,31 @@
if(plot_window_on_)
{
- // A margin is needed to allow any plot window border rectangle to show OK.
- // A small margin is to prevent it overlapping the image border.
- // Also allows for axis value labels that mark the min and max
- // that must extend half a font width beyond the plot window border.
-
- double margin = (std::max)(image_border_.margin_, static_cast<double>(x_value_label_style_.font_size()/2) );
+ // A margin is needed to allow any plot window border rectangle to show OK.
+ // A small margin is to prevent it overlapping the image border.
+ // Also allows for axis value labels that mark the min and max
+ // that must extend beyond the plot window border,
+ // if writing is vertical need only half a font, but half x_ticks_.label_max_space_ if horizontal.
+ // x_ticks_.label_max_space_ calculated this - but is not calculated yet!
+ // So just allow a few chars.
+
+ double value_space;
+ // Really want
+ // value_space = x_ticks_.label_max_space_ /2.; // Assume value label is center aligned.
+ if (x_ticks_.label_rotation_ != horizontal)
+ { // vertical-ish x value labels just need half a font.
+ value_space = x_value_label_style_.font_size() / 2; // half a single font width.
+ }
+ else
+ { // horizontal so need space for half the label, assumed 4 chars.
+ value_space = x_value_label_style_.font_size() * 2; // two font widths.
+ }
+ double margin = 0.;
+ margin = (std::max)(image_border_.margin_, value_space);
plot_left_ += margin;
plot_right_ -= margin;
+ // Might need to do similar for Y-axis if anyone complains.
margin = (std::max)(image_border_.margin_, static_cast<double>(y_value_label_style_.font_size()/2) );
plot_top_ += margin;
plot_bottom_ -= margin;
Modified: sandbox/SOC/2007/visualization/boost/svg_plot/svg_boxplot.hpp
==============================================================================
--- sandbox/SOC/2007/visualization/boost/svg_plot/svg_boxplot.hpp (original)
+++ sandbox/SOC/2007/visualization/boost/svg_plot/svg_boxplot.hpp 2009-08-06 13:20:36 EDT (Thu, 06 Aug 2009)
@@ -1883,8 +1883,8 @@
svg_boxplot& x_tick_width(unsigned int width);
svg_boxplot& y_major_tick_width(unsigned int width);
svg_boxplot& y_minor_tick_width(unsigned int width);
- unsigned int image_x_size();
- unsigned int image_y_size();
+ unsigned int x_size();
+ unsigned int y_size();
std::string title(); // title assigned to boxplot.
bool x_label_on();
int x_major_labels();
@@ -2342,12 +2342,12 @@
return *this; //! \return reference to svg_boxplot to make chainable.
}
- unsigned int svg_boxplot::image_x_size()
+ unsigned int svg_boxplot::x_size()
{ //! \return width of the SVG image.
return image_.x_size();
}
- unsigned int svg_boxplot::image_y_size()
+ unsigned int svg_boxplot::y_size()
{ //! \return height of the SVG image.
return image_.x_size();
}
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-08-06 13:20:36 EDT (Thu, 06 Aug 2009)
@@ -1228,7 +1228,6 @@
// || !axis.axis_line_on_ ignore these tests to avoid the above that doesn't work.
// Zero isn't likely to be the longest value label.
// ticks_labels_style& tick_labels = (dim_ = X) ? x_ticks() : y_ticks(); // doesn't work.
- //
// Check length of label for the ticks on the positive side (right or above zero).
for(double v = 0.; v <= max_; v += major_interval_)
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