|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r55400 - in sandbox/SOC/2007/visualization/boost/svg_plot: . detail
From: pbristow_at_[hidden]
Date: 2009-08-04 07:22:48
Author: pbristow
Date: 2009-08-04 07:22:46 EDT (Tue, 04 Aug 2009)
New Revision: 55400
URL: http://svn.boost.org/trac/boost/changeset/55400
Log:
name changes g to add_g_element and private image to image_.
Problem in discrete functions remains. docs not yet updated.
Text files modified:
sandbox/SOC/2007/visualization/boost/svg_plot/detail/axis_plot_frame.hpp | 378 ++++++++++++++++++++--------------------
sandbox/SOC/2007/visualization/boost/svg_plot/detail/svg_tag.hpp | 29 +-
sandbox/SOC/2007/visualization/boost/svg_plot/show_1d_settings.hpp | 2
sandbox/SOC/2007/visualization/boost/svg_plot/show_2d_settings.hpp | 2
sandbox/SOC/2007/visualization/boost/svg_plot/svg.hpp | 62 +++---
sandbox/SOC/2007/visualization/boost/svg_plot/svg_1d_plot.hpp | 64 +++---
sandbox/SOC/2007/visualization/boost/svg_plot/svg_2d_plot.hpp | 174 +++++++++---------
sandbox/SOC/2007/visualization/boost/svg_plot/svg_boxplot.hpp | 192 ++++++++++----------
sandbox/SOC/2007/visualization/boost/svg_plot/svg_style.hpp | 4
9 files changed, 456 insertions(+), 451 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-04 07:22:46 EDT (Tue, 04 Aug 2009)
@@ -143,7 +143,7 @@
double x(value); // Tick position and tick value label,
transform_x(x); // Convert to svg.
double y_bottom(0.); // Start on the horizontal X-axis line.
- double y_top(derived().image.y_size()); // Image top.
+ double y_top(derived().image_.y_size()); // Image top.
// Draw the minor grid, if wanted.
if(derived().x_ticks_.minor_grid_on_)
@@ -231,7 +231,7 @@
return;
}
double y_up(0.); // upper end of tick.
- double y_down(derived().image.x_size()); // y_down = lower end of tick.
+ double y_down(derived().image_.x_size()); // y_down = lower end of tick.
if(derived().x_ticks_.major_grid_on_)
{ // Draw major grid vertical line.
if(!derived().plot_window_on_)
@@ -469,7 +469,7 @@
{ // External to plot window style bottom or top.
// Always want all values including "0", if labeling external to plot window.
// x_ticks_.ticks_on_window_or_on_axis_ == true != 0
- derived().image.g(detail::PLOT_X_TICKS_VALUES).text(
+ derived().image_.g(detail::PLOT_X_TICKS_VALUES).text(
x,
y,
tick_value_label.str(),
@@ -480,7 +480,7 @@
{
if ((value != 0) && derived().x_axis_.axis_line_on_)
{ // Avoid a "0" below the X-axis if it would be cut through by any internal vertical Y-axis line.
- derived().image.g(detail::PLOT_X_TICKS_VALUES).text(
+ derived().image_.g(detail::PLOT_X_TICKS_VALUES).text(
x,
y,
tick_value_label.str(),
@@ -521,23 +521,23 @@
}
}
double y = derived().x_axis_.axis_; // y = 0, (provided y range includes zero).
- derived().image.g(PLOT_X_AXIS).line(xleft, y, xright, y);
+ derived().image_.g(PLOT_X_AXIS).line(xleft, y, xright, y);
if (derived().x_ticks_.ticks_on_window_or_on_axis_ < 0) // bottom
{ // Draw a vertical line holding the ticks on the top of plot window.
- derived().image.g(PLOT_X_AXIS).line(xleft, derived().plot_bottom_, xright, derived().plot_bottom_);
+ derived().image_.g(PLOT_X_AXIS).line(xleft, derived().plot_bottom_, xright, derived().plot_bottom_);
}
else if (derived().x_ticks_.ticks_on_window_or_on_axis_ > 0) // top
{// Draw a vertical line holding the ticks on the bottom of plot window.
- derived().image.g(PLOT_X_AXIS).line(xleft, derived().plot_top_, xright, derived().plot_top_);
+ derived().image_.g(PLOT_X_AXIS).line(xleft, derived().plot_top_, xright, derived().plot_top_);
}
}
else if (derived().x_axis_position_ == top)
{
- derived().image.g(PLOT_X_AXIS).line(xleft, derived().plot_top_, xright, derived().plot_top_);
+ derived().image_.g(PLOT_X_AXIS).line(xleft, derived().plot_top_, xright, derived().plot_top_);
}
else if (derived().x_axis_position_ == bottom)
{
- derived().image.g(PLOT_X_AXIS).line(xleft, derived().plot_bottom_, xright, derived().plot_bottom_);
+ derived().image_.g(PLOT_X_AXIS).line(xleft, derived().plot_bottom_, xright, derived().plot_bottom_);
}
else
{ // warn that things have gone wrong?
@@ -545,10 +545,10 @@
} // x_axis_.axis_line_on_
// Access the paths for the ticks & grids, ready for additions.
- path_element& minor_tick_path = derived().image.g(PLOT_X_MINOR_TICKS).path();
- path_element& major_tick_path = derived().image.g(PLOT_X_MAJOR_TICKS).path();
- path_element& minor_grid_path = derived().image.g(PLOT_X_MINOR_GRID).path();
- path_element& major_grid_path = derived().image.g(PLOT_X_MAJOR_GRID).path();
+ path_element& minor_tick_path = derived().image_.g(PLOT_X_MINOR_TICKS).path();
+ path_element& major_tick_path = derived().image_.g(PLOT_X_MAJOR_TICKS).path();
+ path_element& minor_grid_path = derived().image_.g(PLOT_X_MINOR_GRID).path();
+ path_element& major_grid_path = derived().image_.g(PLOT_X_MAJOR_GRID).path();
// x_minor_jump is the interval between minor ticks.
double x_minor_jump = derived().x_ticks_.major_interval_ /
@@ -608,7 +608,7 @@
{ //! Draw the X-axis label text (for example, length),
//! and append any optional units (for example, km).
// X-label color default is set in constructor thus:
- // image.g(detail::PLOT_X_LABEL).style().stroke_color(black);
+ // image_.g(detail::PLOT_X_LABEL).style().stroke_color(black);
// and changed using x_label_color(color);
// Similarly for font family and size etc (must be same for both label and units).
@@ -707,12 +707,12 @@
{ // Ticks are ON the X-axis line, so X label is just below the plot bottom.
// No space needed for ticks.
// Character starts at bottom of capital letter, so allow for descenders.
- //y = derived().image.y_size() - derived().image_border_width(); // Place X Label just above the image bottom.
+ //y = derived().image_.y_size() - derived().image_border_width(); // Place X Label just above the image bottom.
//y -= derived().image_border_.margin_;
y += derived().x_label_info_.textstyle().font_size() * 1.7;
}
- derived().image.g(PLOT_X_LABEL).push_back(new text_element(
+ derived().image_.g(PLOT_X_LABEL).push_back(new text_element(
( // x position relative to the x-axis which is middle of plot window.
derived().plot_right_ + derived().plot_left_) / 2, // x coordinate - middle.
y, // Down from plot window.
@@ -766,11 +766,11 @@
Greek, math symbols etc, taking about 8 characters per symbol.
For example, the Unicode symbol for square root is "√" but takes only about one character width).
*/
- derived().title_info_.x(derived().image.x_size() / 2.); // Center of image.
+ derived().title_info_.x(derived().image_.x_size() / 2.); // Center of image.
double y;
y = derived().title_info_.textstyle().font_size() * derived().text_margin_; // Leave a linespace above.
derived().title_info_.y(y);
- derived().image.g(PLOT_TITLE).push_back(new text_element(derived().title_info_));
+ derived().image_.g(PLOT_TITLE).push_back(new text_element(derived().title_info_));
} // void draw_title()
void size_legend_box()
@@ -898,7 +898,7 @@
break;
case outside_top:
// Centered.
- derived().legend_left_ = derived().image.x_size() / 2. - derived().legend_width_ / 2; // Center.
+ derived().legend_left_ = derived().image_.x_size() / 2. - derived().legend_width_ / 2; // Center.
derived().legend_right_ = derived().legend_left_ + derived().legend_width_;
derived().plot_top_ += derived().legend_height_ + spacing;
derived().legend_top_ = derived().title_info_.y() + derived().title_font_size() * derived().text_margin_;
@@ -907,10 +907,10 @@
break;
case outside_bottom:
// Centered.
- derived().legend_bottom_ = derived().image.y_size();
+ derived().legend_bottom_ = derived().image_.y_size();
derived().legend_bottom_ -= (derived().image_border_.width_ + derived().image_border_.margin_); // up
derived().legend_top_ = derived().legend_bottom_ - derived().legend_height_;
- derived().legend_left_ = derived().image.x_size()/ 2. - derived().legend_width_ / 2; // Center.
+ derived().legend_left_ = derived().image_.x_size()/ 2. - derived().legend_width_ / 2; // Center.
derived().legend_right_ = derived().legend_left_ + derived().legend_width_;
derived().plot_bottom_ = derived().legend_top_;
derived().plot_bottom_ -= 2 * spacing;
@@ -925,28 +925,28 @@
// Check if the location requested will fit,
// now that we know the size of box needed.
- if ( (derived().legend_left_ < 0) || (derived().legend_left_ > derived().image.x_size()))
+ if ( (derived().legend_left_ < 0) || (derived().legend_left_ > derived().image_.x_size()))
{ // left outside image?
std::cout << "Legend top left " << derived().legend_left_
- << " is outside image size = " << derived().image.x_size() << std::endl;
+ << " is outside image size = " << derived().image_.x_size() << std::endl;
}
- if ((derived().legend_right_ < 0) || (derived().legend_right_ > derived().image.x_size()))
+ if ((derived().legend_right_ < 0) || (derived().legend_right_ > derived().image_.x_size()))
{ // right outside image?
std::cout << "Legend top right " << derived().legend_right_
- << " is outside image size = " << derived().image.x_size() << std::endl;
+ << " is outside image size = " << derived().image_.x_size() << std::endl;
}
- if ((derived().legend_top_ < 0) || (derived().legend_top_ > derived().image.y_size()))
+ if ((derived().legend_top_ < 0) || (derived().legend_top_ > derived().image_.y_size()))
{ // top outside image?
std::cout << "Legend top " << derived().legend_top_
- << " outside image!" << derived().image.y_size() << std::endl;
+ << " outside image!" << derived().image_.y_size() << std::endl;
}
- if ((derived().legend_bottom_ < 0 ) || (derived().legend_bottom_ > derived().image.y_size()))
+ if ((derived().legend_bottom_ < 0 ) || (derived().legend_bottom_ > derived().image_.y_size()))
{ // bottom outside image?
std::cout << "Legend bottom " << derived().legend_bottom_
- << " outside " << derived().image.y_size() << std::endl;
+ << " outside " << derived().image_.y_size() << std::endl;
}
- derived().image.g(detail::PLOT_LEGEND_BACKGROUND)
+ derived().image_.g(detail::PLOT_LEGEND_BACKGROUND)
.style().fill_color(derived().legend_box_.fill()) //
.stroke_color(derived().legend_box_.stroke())
.stroke_width(derived().legend_box_.width())
@@ -954,7 +954,7 @@
;
// Draw border box round legend.
- g_element* g_ptr = &(derived().image.g(PLOT_LEGEND_BACKGROUND));
+ g_element* g_ptr = &(derived().image_.g(PLOT_LEGEND_BACKGROUND));
g_ptr->push_back(new
rect_element(derived().legend_left_, derived().legend_top_, derived().legend_width_, derived().legend_height_));
} // if legend_on_
@@ -979,7 +979,7 @@
double legend_height = derived().legend_height_;
// Draw border box round legend.
- g_element* g_ptr = &(derived().image.g(PLOT_LEGEND_BACKGROUND));
+ g_element* g_ptr = &(derived().image_.g(PLOT_LEGEND_BACKGROUND));
g_ptr->push_back(new
rect_element(legend_x_start, legend_y_start, legend_width, legend_height));
@@ -990,13 +990,13 @@
derived().legend_header_.x(legend_x_start + legend_width / 2.); // / 2. to center in legend box.
// Might be better to use center_align here because will fail if legend contains symbols in Unicode.
derived().legend_header_.y(legend_y_pos);
- derived().image.g(PLOT_LEGEND_TEXT).push_back(new text_element(derived().legend_header_));
+ derived().image_.g(PLOT_LEGEND_TEXT).push_back(new text_element(derived().legend_header_));
legend_y_pos += 2 * spacing; // Might be 1.5? - useful if many series makes the box too tall.
}
- g_ptr = &(derived().image.g(PLOT_LEGEND_POINTS));
+ g_ptr = &(derived().image_.g(PLOT_LEGEND_POINTS));
g_element* g_inner_ptr = g_ptr;
- g_inner_ptr = &(derived().image.g(PLOT_LEGEND_TEXT));
+ g_inner_ptr = &(derived().image_.g(PLOT_LEGEND_TEXT));
for(unsigned int i = 0; i < derived().serieses_.size(); ++i)
{ // Show point marker, perhaps line, & text info for all the data series.
@@ -1007,7 +1007,7 @@
double legend_x_pos = legend_x_start;
legend_x_pos += spacing; // space before point marker and/or line & text.
- g_inner_ptr = &(g_ptr->g());
+ g_inner_ptr = &(g_ptr->add_g_element());
// Use both stroke & fill colors from the points' style.
// Applies to both shape AND line.
g_inner_ptr->style().stroke_color(derived().serieses_[i].point_style_.stroke_color_);
@@ -1048,7 +1048,7 @@
} // legend_lines_
// Legend text for each Data Series added to the plot.
- g_inner_ptr = &(derived().image.g(PLOT_LEGEND_TEXT));
+ g_inner_ptr = &(derived().image_.g(PLOT_LEGEND_TEXT));
g_inner_ptr->push_back(new text_element(
legend_x_pos, // allow space for the marker.
legend_y_pos,
@@ -1120,11 +1120,11 @@
{
y_radius = 1.;
}
- //image.g(PLOT_DATA_UNC).style().stroke_color(magenta).fill_color(pink).stroke_width(1);
+ //image_.g(PLOT_DATA_UNC).style().stroke_color(magenta).fill_color(pink).stroke_width(1);
// color set in svg_1d_plot data at present.
- g_element* gu3_ptr = &(derived().image.g(PLOT_DATA_UNC3));
- g_element* gu2_ptr = &(derived().image.g(PLOT_DATA_UNC2));
- g_element* gu1_ptr = &(derived().image.g(PLOT_DATA_UNC1));
+ g_element* gu3_ptr = &(derived().image_.g(PLOT_DATA_UNC3));
+ g_element* gu2_ptr = &(derived().image_.g(PLOT_DATA_UNC2));
+ g_element* gu1_ptr = &(derived().image_.g(PLOT_DATA_UNC1));
gu1_ptr->ellipse(x, y, x_radius, y_radius); // Radii are one standard deviation.
gu2_ptr->ellipse(x, y, x_radius * 2, y_radius * 2); // Radii are two standard deviation..
gu3_ptr->ellipse(x, y, x_radius * 3, y_radius * 3); // Radii are three standard deviation..
@@ -1604,54 +1604,54 @@
void clear_background()
{ //! Clear the whole image background layer of the SVG plot.
- derived().image.g(PLOT_BACKGROUND).clear();
+ derived().image_.g(PLOT_BACKGROUND).clear();
}
void clear_title()
{ //! Clear the plot title layer of the SVG plot.
- derived().image.g(PLOT_TITLE).clear();
+ derived().image_.g(PLOT_TITLE).clear();
}
void clear_points()
{ //! Clear the data points layer of the SVG plot.
- derived().image.g(PLOT_DATA_POINTS).clear();
+ derived().image_.g(PLOT_DATA_POINTS).clear();
}
void clear_plot_background()
{ //! Clear the plot area background layer of the SVG plot.
- derived().image.g(PLOT_WINDOW_BACKGROUND).clear();
+ derived().image_.g(PLOT_WINDOW_BACKGROUND).clear();
}
void clear_legend()
{ //! Clear the legend layer of the SVG plot.
- derived().image.g(PLOT_LEGEND_BACKGROUND).clear();
- derived().image.g(PLOT_LEGEND_POINTS).clear();
- derived().image.g(PLOT_LEGEND_TEXT).clear();
+ derived().image_.g(PLOT_LEGEND_BACKGROUND).clear();
+ derived().image_.g(PLOT_LEGEND_POINTS).clear();
+ derived().image_.g(PLOT_LEGEND_TEXT).clear();
}
void clear_x_axis()
{ //! Clear the X axis layer of the SVG plot.
- derived().image.g(PLOT_X_AXIS).clear();
- derived().image.g(PLOT_X_MINOR_TICKS).clear();
- derived().image.g(PLOT_X_MAJOR_TICKS).clear();
- derived().image.g(PLOT_X_LABEL).clear();
- derived().image.g(PLOT_X_TICKS_VALUES).clear();
+ derived().image_.g(PLOT_X_AXIS).clear();
+ derived().image_.g(PLOT_X_MINOR_TICKS).clear();
+ derived().image_.g(PLOT_X_MAJOR_TICKS).clear();
+ derived().image_.g(PLOT_X_LABEL).clear();
+ derived().image_.g(PLOT_X_TICKS_VALUES).clear();
}
void clear_y_axis()
{ //! Clear the Y axis layer of the SVG plot.
- derived().image.g(PLOT_Y_AXIS).clear();
- derived().image.g(PLOT_Y_MINOR_TICKS).clear();
- derived().image.g(PLOT_Y_MAJOR_TICKS).clear();
- derived().image.g(PLOT_Y_LABEL).clear();
+ derived().image_.g(PLOT_Y_AXIS).clear();
+ derived().image_.g(PLOT_Y_MINOR_TICKS).clear();
+ derived().image_.g(PLOT_Y_MAJOR_TICKS).clear();
+ derived().image_.g(PLOT_Y_LABEL).clear();
}
void clear_grids()
{ //! Clear the grids layer of the SVG plot.
- derived().image.g(PLOT_X_MAJOR_GRID).clear();
- derived().image.g(PLOT_X_MINOR_GRID).clear();
- derived().image.g(PLOT_Y_MAJOR_GRID).clear();
- derived().image.g(PLOT_Y_MINOR_GRID).clear();
+ derived().image_.g(PLOT_X_MAJOR_GRID).clear();
+ derived().image_.g(PLOT_X_MINOR_GRID).clear();
+ derived().image_.g(PLOT_Y_MAJOR_GRID).clear();
+ derived().image_.g(PLOT_Y_MINOR_GRID).clear();
}
private:
@@ -1968,7 +1968,7 @@
//Derived& load_stylesheet(const std::string& file)
//{
- // derived().image.load_stylesheet(file);
+ // derived().image_.load_stylesheet(file);
// return derived();
//}
@@ -1977,13 +1977,13 @@
//svg& get_svg()
//{
// derived()._update_image();
- // return derived().image;
+ // return derived().image_;
//}
//const svg& get_svg() const
//{
// derived()._update_image();
- // return derived().image;
+ // return derived().image_;
//}
}; // template <class Derived> class axis_plot_frame
@@ -2026,59 +2026,59 @@
{ //! Set SVG image size (SVG units, default pixels).
// Might put default sizes here?
// Check on sanity of these values?
- derived().image.size(x, y);
+ derived().image_.size(x, y);
return derived();
}
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();
+ { //! \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()
{ //! \return SVG image X-axis size as horizontal width (SVG units, default pixels).
- return derived().image.x_size();
+ return derived().image_.x_size();
}
template <class Derived>
Derived& axis_plot_frame<Derived>::image_x_size(unsigned int i)
{ //! Set SVG image X-axis size (SVG units, default pixels).
- derived().image.x_size(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).
- return derived().image.y_size();
+ return derived().image_.y_size();
}
template <class Derived>
Derived& axis_plot_frame<Derived>::image_y_size(unsigned int i)
{//! Set SVG image Y-axis size (SVG units, default pixels).
- derived().image.y_size(i);
+ derived().image_.y_size(i);
return derived();
}
template <class Derived>
svg_color axis_plot_frame<Derived>::background_color()
{ //! \return plot background color.
- return derived().image.g(PLOT_BACKGROUND).style().fill_color();
+ return derived().image_.g(PLOT_BACKGROUND).style().fill_color();
}
template <class Derived>
Derived& axis_plot_frame<Derived>::background_color(const svg_color& col)
{ //! Set plot background color.
- derived().image.g(PLOT_BACKGROUND).style().fill_color(col);
+ derived().image_.g(PLOT_BACKGROUND).style().fill_color(col);
return derived();
}
template <class Derived>
Derived& axis_plot_frame<Derived>::background_border_color(const svg_color& col)
{ //! Set plot background border color.
- derived().image.g(PLOT_BACKGROUND).style().stroke_color(col);
+ derived().image_.g(PLOT_BACKGROUND).style().stroke_color(col);
/*!
background_border_color example:
\code
@@ -2091,74 +2091,74 @@
template <class Derived>
svg_color axis_plot_frame<Derived>::background_border_color()
{ //! \return plot background border color.
- return derived().image.g(PLOT_BACKGROUND).style().stroke_color();
+ return derived().image_.g(PLOT_BACKGROUND).style().stroke_color();
}
template <class Derived>
Derived& axis_plot_frame<Derived>::background_border_width(double w)
{ //! Set plot background border width.
- derived().image.g(PLOT_BACKGROUND).style().stroke_width(w);
+ derived().image_.g(PLOT_BACKGROUND).style().stroke_width(w);
return derived();
}
template <class Derived>
double axis_plot_frame<Derived>::background_border_width()
{ //! \return plot background border width.
- return derived().image.g(PLOT_BACKGROUND).style().stroke_width();
+ return derived().image_.g(PLOT_BACKGROUND).style().stroke_width();
}
template <class Derived>
Derived& axis_plot_frame<Derived>::description(const std::string d)
- { //! Writes description to the document for header as \verbatim <desc> My Data <\desc> \endverbatim
- derived().image.description(d);
+ { //! Writes description to the document for header as \verbatim <desc> My Data </desc> \endverbatim
+ derived().image_.description(d);
return derived();
}
template <class Derived>
const std::string& axis_plot_frame<Derived>::description()
- { //! \return description of the document for header as \verbatim <desc> ... <\desc> \endverbatim
- return derived().image.description();
+ { //! \return description of the document for header as \verbatim <desc> ... </desc> \endverbatim
+ return derived().image_.description();
}
template <class Derived>
Derived& axis_plot_frame<Derived>::document_title(const std::string d)
- { //! Write document title to the SVG document for header as \verbatim <title> My Title <\title> \endverbatim
- derived().image.document_title(d);
+ { //! Write document title to the SVG document for header as \verbatim <title> My Title </title> \endverbatim
+ derived().image_.document_title(d);
return derived();
}
template <class Derived>
std::string axis_plot_frame<Derived>::document_title()
- { //! \return document title to the document for header as \verbatim <title> My Title <\title> \endverbatim
- return derived().image.document_title();
+ { //! \return document title to the document for header as \verbatim <title> My Title </title> \endverbatim
+ return derived().image_.document_title();
}
template <class Derived>
Derived& axis_plot_frame<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" /> \endverbatim
- derived().image.copyright_holder(d);
+ //! and as \verbatim metadata: <meta name="copyright" content="Paul A. Bristow" /meta> \endverbatim
+ derived().image_.copyright_holder(d);
return derived();
}
template <class Derived>
const std::string axis_plot_frame<Derived>::copyright_holder()
{ //! \return copyright holder.
- return derived().image.copyright_holder();
+ return derived().image_.copyright_holder();
}
template <class Derived>
Derived& axis_plot_frame<Derived>::copyright_date(const std::string d)
{ //! Writes copyright date to the document.
//! and as \verbatim metadata <meta name="date" content="2007" /> \endverbatim
- derived().image.copyright_date(d);
+ derived().image_.copyright_date(d);
return derived();
}
template <class Derived>
const std::string axis_plot_frame<Derived>::copyright_date()
{ //! \return copyright_date.
- return derived().image.copyright_date();
+ return derived().image_.copyright_date();
}
template <class Derived>
@@ -2171,7 +2171,7 @@
//! usually "permits", "requires", or "prohibits",
//! and set license_on == true.
// Might check these are "permits", "requires", or "prohibits"?
- derived().image.license(repro, distrib, attrib, commercial, derivative);
+ derived().image_.license(repro, distrib, attrib, commercial, derivative);
return derived();
}
@@ -2179,52 +2179,52 @@
bool axis_plot_frame<Derived>::license_on()
{ //! \return true if license conditions should be included in the SVG document.
//! \see axis_plot_frame::license
- return derived().image.license_on();
+ return derived().image_.license_on();
}
template <class Derived>
Derived& axis_plot_frame<Derived>::license_on(bool l)
{ //! Set if license conditions should be included in the SVG document.
//! \see axis_plot_frame::license
- derived().image.license_on(l);
+ derived().image_.license_on(l);
return derived();
}
template <class Derived>
bool axis_plot_frame<Derived>::boost_license_on()
{ //! \return if the Boost license conditions should be included in the SVG document.
//! To set see axis_plot_frame::boost_license_on(bool).
- return derived().image.boost_license_one();
+ return derived().image_.boost_license_one();
}
template <class Derived>
Derived& axis_plot_frame<Derived>::boost_license_on(bool l)
{ //! Set if the Boost license conditions should be included in the SVG document.
- derived().image.boost_license_on(l);
+ derived().image_.boost_license_on(l);
return derived();
}
template <class Derived>
const std::string axis_plot_frame<Derived>::license_reproduction()
{ //! \return reproduction license conditions, usually "permits", "requires", or "prohibits".
- return derived().image.reproduction();
+ return derived().image_.reproduction();
}
template <class Derived>
const std::string axis_plot_frame<Derived>::license_distribution()
{ //! \return distribution license conditions, usually "permits", "requires", or "prohibits".
- return derived().image.distribution();
+ return derived().image_.distribution();
}
template <class Derived>
const std::string axis_plot_frame<Derived>::license_attribution()
{ //! \return attribution license conditions, usually "permits", "requires", or "prohibits".
- return derived().image.attribution();
+ return derived().image_.attribution();
}
template <class Derived>
const std::string axis_plot_frame<Derived>::license_commercialuse()
{ //! \return commercial use license conditions, usually "permits", "requires", or "prohibits".
- return derived().image.commercialuse();
+ return derived().image_.commercialuse();
}
template <class Derived>
@@ -2235,14 +2235,14 @@
especially for larger images, at the expense of larger .svg files,
particularly if there are very many data points.
*/
- derived().image.coord_precision(digits);
+ derived().image_.coord_precision(digits);
return derived();
}
template <class Derived>
int axis_plot_frame<Derived>::coord_precision()
{ //! \return precision of SVG coordinates in decimal digits.
- return derived().image.coord_precision();
+ return derived().image_.coord_precision();
}
template <class Derived>
@@ -2308,7 +2308,7 @@
// effectively concatenates with any existing title.
// So clear the existing string first but doesn't work,
// so need to clear the whole g_element.
- //derived().image.g(PLOT_TITLE).clear();
+ //derived().image_.g(PLOT_TITLE).clear();
derived().title_info_.text(title);
derived().title_on_ = true; // Assume display wanted, if bother to set title.
return derived();
@@ -2495,7 +2495,7 @@
Derived& axis_plot_frame<Derived>::legend_top_left(double x, double y)
{ //! Set position of top left of legend box (svg coordinates, default pixels).
//! Bottom right is controlled by contents, so the user cannot set it.
- if((x < 0) || (x > derived().image.x_size()) || (y < 0) || (y > derived().image.y_size()))
+ if((x < 0) || (x > derived().image_.x_size()) || (y < 0) || (y > derived().image_.y_size()))
{
throw std::runtime_error("Legend box position outside image!");
}
@@ -2588,7 +2588,7 @@
derived().plot_window_on_ = cmd;
if(cmd)
{ // Set plot window.
- derived().image.g(detail::PLOT_WINDOW_BACKGROUND).style()
+ derived().image_.g(detail::PLOT_WINDOW_BACKGROUND).style()
.fill_color(derived().plot_window_border_.fill_) // background color and
.stroke_color(derived().plot_window_border_.stroke_); // border color.
}
@@ -2606,27 +2606,27 @@
Derived& axis_plot_frame<Derived>::plot_border_color(const svg_color& col)
{ //! Set the color for the plot window background.
derived().plot_window_border_.stroke_ = col;
- derived().image.g(detail::PLOT_WINDOW_BACKGROUND).style().stroke_color(col);
+ derived().image_.g(detail::PLOT_WINDOW_BACKGROUND).style().stroke_color(col);
return derived();
}
template <class Derived>
svg_color axis_plot_frame<Derived>::plot_border_color()
{ //! \return the color for the plot window background.
- return derived().image.g(detail::PLOT_WINDOW_BACKGROUND).style().stroke_color();
+ return derived().image_.g(detail::PLOT_WINDOW_BACKGROUND).style().stroke_color();
}
template <class Derived>
double axis_plot_frame<Derived>::plot_border_width()
{ //! \return the width for the plot window border (svg units, default pixels).
- return derived().image.g(detail::PLOT_WINDOW_BACKGROUND).style().stroke_width();
+ return derived().image_.g(detail::PLOT_WINDOW_BACKGROUND).style().stroke_width();
}
template <class Derived>
Derived& axis_plot_frame<Derived>::plot_border_width(double w)
{ //! Set the width for the plot window border (svg units, default pixels).
derived().plot_window_border_.width_ = w;
- derived().image.g(detail::PLOT_WINDOW_BACKGROUND).style().stroke_width(w);
+ derived().image_.g(detail::PLOT_WINDOW_BACKGROUND).style().stroke_width(w);
return derived();
}
@@ -2834,8 +2834,8 @@
template <class Derived>
Derived& axis_plot_frame<Derived>::x_axis_label_color(const svg_color& col)
{ //! Set X axis label color.
- derived().image.g(detail::PLOT_X_LABEL).style().fill_color(col);
- //derived().image.g(detail::PLOT_X_LABEL).style().stroke_color(col);
+ derived().image_.g(detail::PLOT_X_LABEL).style().fill_color(col);
+ //derived().image_.g(detail::PLOT_X_LABEL).style().stroke_color(col);
// Setting the stroke color produces fuzzy characters :-(
// Set BOTH stroke and fill to the same color?
return derived();
@@ -2845,7 +2845,7 @@
svg_color axis_plot_frame<Derived>::x_axis_label_color()
{ //! \return X axis label color.
// But only return the fill color.
- return derived().image.g(detail::PLOT_X_LABEL).style().fill_color();
+ return derived().image_.g(detail::PLOT_X_LABEL).style().fill_color();
}
// X-axis tick label style.
@@ -2853,8 +2853,8 @@
Derived& axis_plot_frame<Derived>::x_ticks_values_color(const svg_color& col)
{ //! Set X axis tick value label color.
// Set BOTH stroke and fill to the same color.
- derived().image.g(detail::PLOT_X_TICKS_VALUES).style().fill_color(col);
- //derived().image.g(detail::PLOT_X_TICK_VALUE_LABELS).style().stroke_color(col);
+ derived().image_.g(detail::PLOT_X_TICKS_VALUES).style().fill_color(col);
+ //derived().image_.g(detail::PLOT_X_TICK_VALUE_LABELS).style().stroke_color(col);
// Setting the stroke color produces fuzzy characters :-(
//derived().x_ticks_.color_ = col;
return derived();
@@ -2864,7 +2864,7 @@
svg_color axis_plot_frame<Derived>::x_ticks_values_color()
{ //! \return X-axis ticks value label color.
// But only return the fill color.
- return derived().image.g(detail::PLOT_X_TICKS_VALUES).style().fill_color();
+ return derived().image_.g(detail::PLOT_X_TICKS_VALUES).style().fill_color();
//return x_ticks_.color_ ;
}
@@ -3084,8 +3084,8 @@
// Function title_color could set both fill (middle) and stroke (outside),
// but just setting fill if simplest,
// but does not allow separate inside & outside colors.
- derived().image.g(PLOT_TITLE).style().fill_color(col);
- //derived().image.g(PLOT_TITLE).style().stroke_color(col);
+ derived().image_.g(PLOT_TITLE).style().fill_color(col);
+ //derived().image_.g(PLOT_TITLE).style().stroke_color(col);
return derived();
}
@@ -3093,8 +3093,8 @@
svg_color axis_plot_frame<Derived>::title_color()
{ //! \return the color of any title of the plot.
// Function title_color could get either fill and stroke,
- // return derived().image.g(PLOT_TITLE).style().stroke_color();
- return derived().image.g(PLOT_TITLE).style().fill_color();
+ // return derived().image_.g(PLOT_TITLE).style().stroke_color();
+ return derived().image_.g(PLOT_TITLE).style().fill_color();
}
//Derived& title_font_width(double width)
@@ -3102,32 +3102,32 @@
// width of text is effectively the boldness.
// // Not useful with current browsers, setting this may cause lower quality graphic fonts
// // perhaps because the font is created using graphics rather than a built-in font.
- // derived().image.g(PLOT_TITLE).style().stroke_width(width);
+ // derived().image_.g(PLOT_TITLE).style().stroke_width(width);
// return derived();
//}
//Derived& legend_font_width(double width)
//{ //! \return the width of the font for the title of the plot.
// width of text is effectively the boldness.
- // derived().image.g(PLOT_LEGEND_TEXT).style().stroke_width(width);
+ // derived().image_.g(PLOT_LEGEND_TEXT).style().stroke_width(width);
// return derived();
//}
//double legend_font_width()
//{ // Set the width of the font for the title of the legend.
// Probably not useful at present (se above).
- // return derived().image.g(PLOT_LEGEND_TEXT).style().stroke_width();
+ // return derived().image_.g(PLOT_LEGEND_TEXT).style().stroke_width();
//}
//double legend_font_width()
//{ //! \return the width of the font for the title of the legend.
- // return derived().image.g(PLOT_TITLE).style().stroke_width();
+ // return derived().image_.g(PLOT_TITLE).style().stroke_width();
//}
template <class Derived>
Derived& axis_plot_frame<Derived>::legend_color(const svg_color& col)
{ //! Set the color of the title of the legend.
- // derived().image.g(PLOT_LEGEND_TEXT).style().stroke_color(col);
- derived().image.g(PLOT_LEGEND_TEXT).style().fill_color(col);
+ // derived().image_.g(PLOT_LEGEND_TEXT).style().stroke_color(col);
+ derived().image_.g(PLOT_LEGEND_TEXT).style().fill_color(col);
return derived();
}
@@ -3136,22 +3136,22 @@
{ //! \return the color of the title of the legend.
// Function legend_color sets only stroke, assuming that 'filled' text is not being used.
// (It produces much lower quality fonts on some browsers).
- return derived().image.g(PLOT_LEGEND_TEXT).style().fill_color();
- // return derived().image.g(PLOT_LEGEND_TEXT).style().stroke_color();
+ return derived().image_.g(PLOT_LEGEND_TEXT).style().fill_color();
+ // return derived().image_.g(PLOT_LEGEND_TEXT).style().stroke_color();
}
template <class Derived>
Derived& axis_plot_frame<Derived>::legend_background_color(const svg_color& col)
{ //! Set the background fill color of the legend box.
derived().legend_box_.fill(col);
- derived().image.g(PLOT_LEGEND_BACKGROUND).style().fill_color(col);
+ derived().image_.g(PLOT_LEGEND_BACKGROUND).style().fill_color(col);
return derived();
}
template <class Derived>
svg_color axis_plot_frame<Derived>::legend_background_color()
{ //! \return the background fill color of the legend box.
- return derived().image.g(PLOT_LEGEND_BACKGROUND).style().fill_color();
+ return derived().image_.g(PLOT_LEGEND_BACKGROUND).style().fill_color();
}
template <class Derived>
@@ -3164,7 +3164,7 @@
Derived& axis_plot_frame<Derived>::legend_border_color(const svg_color& col)
{ //! Set the border stroke color of the legend box.
derived().legend_box_.stroke(col);
- derived().image.g(PLOT_LEGEND_BACKGROUND).style().stroke_color(col);
+ derived().image_.g(PLOT_LEGEND_BACKGROUND).style().stroke_color(col);
return derived();
}
@@ -3172,20 +3172,20 @@
svg_color axis_plot_frame<Derived>::legend_border_color()
{ //! \return the border stroke color of the legend box.
return derived().legend_box_.stroke();
- // return derived().image.g(PLOT_LEGEND_BACKGROUND).style().stroke_color();
+ // return derived().image_.g(PLOT_LEGEND_BACKGROUND).style().stroke_color();
}
template <class Derived>
Derived& axis_plot_frame<Derived>::plot_background_color(const svg_color& col)
{ //! Set the fill color of the plot window background.
- derived().image.g(PLOT_WINDOW_BACKGROUND).style().fill_color(col);
+ derived().image_.g(PLOT_WINDOW_BACKGROUND).style().fill_color(col);
return derived();
}
template <class Derived>
svg_color axis_plot_frame<Derived>::plot_background_color()
{ //! \return the fill color of the plot window background.
- return derived().image.g(PLOT_WINDOW_BACKGROUND).style().fill_color();
+ return derived().image_.g(PLOT_WINDOW_BACKGROUND).style().fill_color();
}
template <class Derived>
@@ -3208,42 +3208,42 @@
Derived& axis_plot_frame<Derived>::x_axis_color(const svg_color& col)
{ //! Set the color of the X-axis line.
// Note only stroke color is set.
- derived().image.g(PLOT_X_AXIS).style().stroke_color(col);
+ derived().image_.g(PLOT_X_AXIS).style().stroke_color(col);
return derived();
}
template <class Derived>
svg_color axis_plot_frame<Derived>::x_axis_color()
{ //! \return the color of the X-axis line.
- return derived().image.g(PLOT_X_AXIS).style().stroke_color();
+ return derived().image_.g(PLOT_X_AXIS).style().stroke_color();
}
template <class Derived>
Derived& axis_plot_frame<Derived>::y_axis_color(const svg_color& col)
{ //! Set the color of the Y-axis line.
- derived().image.g(PLOT_Y_AXIS).style().stroke_color(col);
+ derived().image_.g(PLOT_Y_AXIS).style().stroke_color(col);
return derived();
}
template <class Derived>
svg_color axis_plot_frame<Derived>::y_axis_color()
{ //! \return the color of the Y-axis line.
- return derived().image.g(PLOT_Y_AXIS).style().stroke_color();
+ return derived().image_.g(PLOT_Y_AXIS).style().stroke_color();
}
template <class Derived>
Derived& axis_plot_frame<Derived>::x_label_color(const svg_color& col)
{ //! Set the color of X-axis label (including any units).
// add fill as well PAB Oct 07
- derived().image.g(PLOT_X_LABEL).style().fill_color(col);
- derived().image.g(PLOT_X_LABEL).style().stroke_color(col);
+ derived().image_.g(PLOT_X_LABEL).style().fill_color(col);
+ derived().image_.g(PLOT_X_LABEL).style().stroke_color(col);
return derived();
}
template <class Derived>
svg_color axis_plot_frame<Derived>::x_label_color()
{ //! \return the color of X-axis label (including any units).
- return derived().image.g(PLOT_X_LABEL).style().fill_color();
+ return derived().image_.g(PLOT_X_LABEL).style().fill_color();
}
template <class Derived>
@@ -3251,132 +3251,132 @@
{ //! Set the width (boldness) of X-axis label (including any units).
//! (not recommended until browsers implement better).
// width of text is effectively the boldness.
- derived().image.g(PLOT_X_LABEL).style().stroke_width(width);
+ derived().image_.g(PLOT_X_LABEL).style().stroke_width(width);
return derived();
}
template <class Derived>
double axis_plot_frame<Derived>::x_label_width()
{ //! \return the width (boldness) of X-axis label (including any units).
- return derived().image.g(PLOT_X_LABEL).style().stroke_width();
+ return derived().image_.g(PLOT_X_LABEL).style().stroke_width();
}
template <class Derived>
Derived& axis_plot_frame<Derived>::y_label_color(const svg_color& col)
{ //! Set the color of Y-axis label (including any units).
- derived().image.g(PLOT_Y_LABEL).style().fill_color(col);
- derived().image.g(PLOT_Y_LABEL).style().stroke_color(col);
+ derived().image_.g(PLOT_Y_LABEL).style().fill_color(col);
+ derived().image_.g(PLOT_Y_LABEL).style().stroke_color(col);
return derived();
}
template <class Derived>
svg_color axis_plot_frame<Derived>::y_label_color()
{ //! \return the color of Y-axis label (including any units).
- return derived().image.g(PLOT_Y_LABEL).style().fill_color();
+ return derived().image_.g(PLOT_Y_LABEL).style().fill_color();
}
template <class Derived>
Derived& axis_plot_frame<Derived>::x_major_tick_color(const svg_color& col)
{ //! Set the color of X-axis major ticks.
- derived().image.g(PLOT_X_MAJOR_TICKS).style().stroke_color(col);
+ derived().image_.g(PLOT_X_MAJOR_TICKS).style().stroke_color(col);
return derived();
}
template <class Derived>
svg_color axis_plot_frame<Derived>::x_major_tick_color()
{ //! \return the color of X-axis major ticks.
- return derived().image.g(PLOT_X_MAJOR_TICKS).style().stroke_color();
+ return derived().image_.g(PLOT_X_MAJOR_TICKS).style().stroke_color();
}
template <class Derived>
Derived& axis_plot_frame<Derived>::x_minor_tick_color(const svg_color& col)
{ //! Set the color of X-axis minor ticks.
- derived().image.g(PLOT_X_MINOR_TICKS).style().stroke_color(col);
+ derived().image_.g(PLOT_X_MINOR_TICKS).style().stroke_color(col);
return derived();
}
template <class Derived>
svg_color axis_plot_frame<Derived>::x_minor_tick_color()
{ //! \return the color of X-axis minor ticks.
- return derived().image.g(PLOT_X_MINOR_TICKS).style().stroke_color();
+ return derived().image_.g(PLOT_X_MINOR_TICKS).style().stroke_color();
}
template <class Derived>
Derived& axis_plot_frame<Derived>::x_major_grid_color(const svg_color& col)
{ //! Set the color of X-axis major grid lines.
- derived().image.g(PLOT_X_MAJOR_GRID).style().stroke_color(col);
+ derived().image_.g(PLOT_X_MAJOR_GRID).style().stroke_color(col);
return derived();
}
template <class Derived>
svg_color axis_plot_frame<Derived>::x_major_grid_color()
{ //! \return the color of X-axis major grid lines.
- return derived().image.g(PLOT_X_MAJOR_GRID).style().stroke_color();
+ return derived().image_.g(PLOT_X_MAJOR_GRID).style().stroke_color();
}
template <class Derived>
Derived& axis_plot_frame<Derived>::x_major_grid_width(double w)
{ //! Set the width of X-axis major grid lines.
- derived().image.g(PLOT_X_MAJOR_GRID).style().stroke_width(w);
+ derived().image_.g(PLOT_X_MAJOR_GRID).style().stroke_width(w);
return derived();
}
template <class Derived>
double axis_plot_frame<Derived>::x_major_grid_width()
{ //! \return the color of X-axis major grid lines.
- return derived().image.g(PLOT_X_MAJOR_GRID).style().stroke_width();
+ return derived().image_.g(PLOT_X_MAJOR_GRID).style().stroke_width();
}
template <class Derived>
Derived& axis_plot_frame<Derived>::x_minor_grid_color(const svg_color& col)
{ //! Set the color of X-axis minor grid lines.
- derived().image.g(PLOT_X_MINOR_GRID).style().stroke_color(col);
+ derived().image_.g(PLOT_X_MINOR_GRID).style().stroke_color(col);
return derived();
}
template <class Derived>
svg_color axis_plot_frame<Derived>::x_minor_grid_color()
{ //! \return the color of X-axis minor grid lines.
- return derived().image.g(PLOT_X_MINOR_GRID).style().stroke_color();
+ return derived().image_.g(PLOT_X_MINOR_GRID).style().stroke_color();
}
template <class Derived>
Derived& axis_plot_frame<Derived>::x_minor_grid_width(double w)
{ //! Set the width of X-axis minor grid lines.
- derived().image.g(PLOT_X_MINOR_GRID).style().stroke_width(w);
+ derived().image_.g(PLOT_X_MINOR_GRID).style().stroke_width(w);
return derived();
}
template <class Derived>
double axis_plot_frame<Derived>::x_minor_grid_width()
{ //! \return the width of X-axis minor grid lines.
- return derived().image.g(PLOT_X_MINOR_GRID).style().stroke_width();
+ return derived().image_.g(PLOT_X_MINOR_GRID).style().stroke_width();
}
template <class Derived>
Derived& axis_plot_frame<Derived>::x_axis_width(double width)
{ //! Set the width of X-axis lines.
- derived().image.g(PLOT_X_AXIS).style().stroke_width(width);
+ derived().image_.g(PLOT_X_AXIS).style().stroke_width(width);
return derived();
}
template <class Derived>
double axis_plot_frame<Derived>::x_axis_width()
{ //! \return the width of X-axis lines.
- return derived().image.g(PLOT_X_AXIS).style().stroke_width();
+ return derived().image_.g(PLOT_X_AXIS).style().stroke_width();
}
template <class Derived>
Derived& axis_plot_frame<Derived>::data_lines_width(double width)
{ //! Set the width of lines joining data points.
- derived().image.g(PLOT_DATA_LINES).style().stroke_width(width);
+ derived().image_.g(PLOT_DATA_LINES).style().stroke_width(width);
return derived();
}
template <class Derived>
double axis_plot_frame<Derived>::data_lines_width()
{ //! \return the width of lines joining data points.
- return derived().image.g(PLOT_DATA_LINES).style().stroke_width();
+ return derived().image_.g(PLOT_DATA_LINES).style().stroke_width();
}
template <class Derived>
@@ -3505,8 +3505,8 @@
// but just setting fill is simplest,
// but does not allow separate inside & outside colors.
// Might be better to set in x_values_style
- derived().image.g(PLOT_X_POINT_VALUES).style().fill_color(col);
- //derived().image.g(PLOT_X_POINT_VALUES).style().stroke_color(col);
+ derived().image_.g(PLOT_X_POINT_VALUES).style().fill_color(col);
+ //derived().image_.g(PLOT_X_POINT_VALUES).style().stroke_color(col);
return derived();
}
@@ -3515,8 +3515,8 @@
svg_color axis_plot_frame<Derived>::x_values_color()
{ //! \return the color of data point X values near data points markers.
// Function could get either fill and stroke,
- // return derived().image.g(PLOT_X_POINT_VALUES).style().stroke_color();
- return derived().image.g(PLOT_X_POINT_VALUES).style().fill_color();
+ // return derived().image_.g(PLOT_X_POINT_VALUES).style().stroke_color();
+ return derived().image_.g(PLOT_X_POINT_VALUES).style().fill_color();
}
template <class Derived>
@@ -3665,14 +3665,14 @@
Derived& axis_plot_frame<Derived>::x_major_tick_width(double width)
{ //! Set width of X major ticks.
derived().x_ticks_.major_tick_width_ = width; // Redundant?
- derived().image.g(PLOT_X_MAJOR_TICKS).style().stroke_width(width);
+ derived().image_.g(PLOT_X_MAJOR_TICKS).style().stroke_width(width);
return derived();
}
template <class Derived>
double axis_plot_frame<Derived>::x_major_tick_width()
{//! \return width of X major ticks.
- return derived().image.g(PLOT_X_MAJOR_TICKS).style().stroke_width();
+ return derived().image_.g(PLOT_X_MAJOR_TICKS).style().stroke_width();
}
template <class Derived>
@@ -3692,7 +3692,7 @@
Derived& axis_plot_frame<Derived>::x_minor_tick_width(double width)
{ //! Set width of X minor ticks.
derived().x_ticks_.minor_tick_width_ = width;
- derived().image.g(PLOT_X_MINOR_TICKS).style().stroke_width(width);
+ derived().image_.g(PLOT_X_MINOR_TICKS).style().stroke_width(width);
return derived();
}
@@ -3700,7 +3700,7 @@
double axis_plot_frame<Derived>::x_minor_tick_width()
{ //! \return width of X minor ticks.
// return derived().x_minor_tick_width_; // should be the same but store in stroke_width is definitive.
- return derived().image.g(PLOT_X_MINOR_TICKS).style().stroke_width();
+ return derived().image_.g(PLOT_X_MINOR_TICKS).style().stroke_width();
}
template <class Derived>
@@ -3978,7 +3978,7 @@
Derived& axis_plot_frame<Derived>::limit_color(const svg_color& col)
{ //! Set the color for 'at limit' point stroke color.
// Need to set the series
- derived().image.g(detail::PLOT_LIMIT_POINTS).style().stroke_color(col);
+ derived().image_.g(detail::PLOT_LIMIT_POINTS).style().stroke_color(col);
// derived().serieses_[0].limit_point_color(col); // Would require to add some data first!
return derived();
}
@@ -3986,14 +3986,14 @@
template <class Derived>
svg_color axis_plot_frame<Derived>::limit_color()
{ //! \return the color for the 'at limit' point stroke color.
- return derived().image.g(detail::PLOT_LIMIT_POINTS).style().stroke_color();
+ return derived().image_.g(detail::PLOT_LIMIT_POINTS).style().stroke_color();
}
template <class Derived>
Derived& axis_plot_frame<Derived>::limit_fill_color(const svg_color& col)
{ //! Set the color for 'at limit' point fill color.
- derived().image.g(detail::PLOT_LIMIT_POINTS).style().fill_on(true);
- derived().image.g(detail::PLOT_LIMIT_POINTS).style().fill_color(col);
+ derived().image_.g(detail::PLOT_LIMIT_POINTS).style().fill_on(true);
+ derived().image_.g(detail::PLOT_LIMIT_POINTS).style().fill_color(col);
//derived().serieses_[0].limit_point_style_.fill_color(col);
return derived();
}
@@ -4001,52 +4001,52 @@
template <class Derived>
svg_color axis_plot_frame<Derived>::limit_fill_color()
{ //! \return the color for the 'at limit' point fill color.
- return derived().image.g(detail::PLOT_LIMIT_POINTS).style().fill_color();
+ return derived().image_.g(detail::PLOT_LIMIT_POINTS).style().fill_color();
}
template <class Derived>
Derived& axis_plot_frame<Derived>::one_sd_color(const svg_color& col)
{ //! Set the color for the one standard deviation (~67% confidence) ellipse fill.
- derived().image.g(detail::PLOT_DATA_UNC1).style().fill_on(true);
- derived().image.g(detail::PLOT_DATA_UNC1).style().fill_color(col);
- derived().image.g(detail::PLOT_DATA_UNC1).style().stroke_color(blank);
+ derived().image_.g(detail::PLOT_DATA_UNC1).style().fill_on(true);
+ derived().image_.g(detail::PLOT_DATA_UNC1).style().fill_color(col);
+ derived().image_.g(detail::PLOT_DATA_UNC1).style().stroke_color(blank);
return derived();
}
template <class Derived>
svg_color axis_plot_frame<Derived>::one_sd_color()
{ //! \return Color for the one standard deviation (~67% confidence) ellipse fill.
- return derived().image.g(detail::PLOT_DATA_UNC1).style().fill_color();
+ return derived().image_.g(detail::PLOT_DATA_UNC1).style().fill_color();
}
template <class Derived>
Derived& axis_plot_frame<Derived>::two_sd_color(const svg_color& col)
{ //! Set the color for two standard deviation (~95% confidence) ellipse fill.
- derived().image.g(detail::PLOT_DATA_UNC2).style().fill_on(true);
- derived().image.g(detail::PLOT_DATA_UNC2).style().fill_color(col);
- derived().image.g(detail::PLOT_DATA_UNC2).style().stroke_color(blank);
+ derived().image_.g(detail::PLOT_DATA_UNC2).style().fill_on(true);
+ derived().image_.g(detail::PLOT_DATA_UNC2).style().fill_color(col);
+ derived().image_.g(detail::PLOT_DATA_UNC2).style().stroke_color(blank);
return derived();
}
template <class Derived>
svg_color axis_plot_frame<Derived>::two_sd_color()
{ //! \return Color for two standard deviation (~95% confidence) ellipse fill.
- return derived().image.g(detail::PLOT_DATA_UNC2).style().fill_color();
+ return derived().image_.g(detail::PLOT_DATA_UNC2).style().fill_color();
}
template <class Derived>
Derived& axis_plot_frame<Derived>::three_sd_color(const svg_color& col)
{ //! Set the color for three standard deviation (~99% confidence) ellipse fill.
- derived().image.g(detail::PLOT_DATA_UNC3).style().fill_on(true);
- derived().image.g(detail::PLOT_DATA_UNC3).style().fill_color(col);
- derived().image.g(detail::PLOT_DATA_UNC3).style().stroke_color(blank);
+ derived().image_.g(detail::PLOT_DATA_UNC3).style().fill_on(true);
+ derived().image_.g(detail::PLOT_DATA_UNC3).style().fill_color(col);
+ derived().image_.g(detail::PLOT_DATA_UNC3).style().stroke_color(blank);
return derived();
}
template <class Derived>
svg_color axis_plot_frame<Derived>::three_sd_color()
{ //! \return Color for three standard deviation (~99% confidence) ellipse fill.
- return derived().image.g(detail::PLOT_DATA_UNC3).style().fill_color();
+ return derived().image_.g(detail::PLOT_DATA_UNC3).style().fill_color();
}
template <class Derived>
@@ -4058,7 +4058,7 @@
for example Greek or math symbols, taking about 6 characters per symbol)
because the render engine does the centering.
*/
- g_element* g = &(derived()).image.g(); // New group.
+ g_element* g = &(derived()).image_.add_g_element(); // New group.
g->style().fill_color(col); // Set its color
g->push_back(new text_element(x, y, note, tsty, al, rot)); // Add to document image.
// No checks on X or Y - leave to SVG to not draw outside image.
@@ -4071,7 +4071,7 @@
{ /*! \brief Annotate plot with a line from SVG Coordinates X1, Y1 to X2, Y2.
\details Default color black.
*/
- g_element* g = &(derived()).image.g(); // New group.
+ g_element* g = &(derived()).image_.add_g_element(); // New group.
g->style().stroke_color(col);
//g->style().width(w); // todo
g->push_back(new line_element(x1, y1, x2, y2));
@@ -4091,7 +4091,7 @@
// This assumes that the notes, lines and curves are the last item before the write.
transform_point(x1, y1);
transform_point(x2, y2);
- g_element* g = &(derived()).image.g(); // New group.
+ g_element* g = &(derived()).image_.add_g_element(); // New group.
g->style().stroke_color(col);
g->push_back(new line_element(x1, y1, x2, y2));
// No checks on X or Y - leave to SVG to not draw outside image.
@@ -4112,7 +4112,7 @@
transform_point(x1, y1);
transform_point(x2, y2);
transform_point(x3, y3);
- g_element* g = &(derived()).image.g(); // New group.
+ g_element* g = &(derived()).image_.add_g_element(); // New group.
g->style().stroke_color(col);
g->push_back(new qurve_element(x1, y1, x2, y2, x3, y3));
// No checks on X or Y - leave to SVG to not draw outside image.
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-04 07:22:46 EDT (Tue, 04 Aug 2009)
@@ -1980,16 +1980,14 @@
class g_element: public svg_element
{ /*! \class boost::svg::g_element
\brief g_element (group element) is the node element of our document tree.
- \verbatim
- 'g' element is a container element for grouping together <g /> ... </g>
- \endverbatim.
+ 'g' element is a container element for grouping together <g> ... </g>
\details g_element ('g' element is a container element
for grouping together related graphics elements).\n
See http://www.w3.org/TR/SVG/struct.html#NewDocument 5.2.1 Overview.
\verbatim
'g' element is a container element for grouping together <g /> </g>
- related graphics elements, for example:
+ related graphics elements, for example, an image background rectangle with border and fill:
<g id="background" fill="rgb(255,255,255)"><rect width="500" height="350"/></g>
\endverbatim.
*/
@@ -2045,14 +2043,13 @@
} // void write(std::ostream& rhs)
g_element& g(int i)
- { // i is index of children nodes.
- return *(static_cast<g_element*>(&children[i]));
+ { //! i is index of children nodes.
+ return *(static_cast<g_element*>(&children[i])); // \return reference to child node g_element.
}
- g_element& g()
+ g_element& add_g_element()
{ //! Add a new group element.
//! \return A reference to the new child node just created.
- // was add_g_element
children.push_back(new g_element());
return *(static_cast<g_element*>(&children[children.size()-1]));
}
@@ -2145,21 +2142,23 @@
polygon_element& pentagon(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4, double x5, double y5, bool f = true)
{ //! Add a new pentagon element.
- //! \return A reference to the new child node just created. // push_back a complete pentagon to the document.
+ //! \return A reference to the new child node just created.
+ // push_back a complete pentagon to the document.
children.push_back(new polygon_element(x1, y1, x2, y2, x3, y3, x4, y4, x5, y5, f));
return *(static_cast<polygon_element*>(&(children[(unsigned int)(children.size()-1)])));
}
polygon_element& hexagon(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4, double x5, double y5, double x6, double y6, bool f = true)
{ //! Add a new hexagon element.
- //! \return A reference to the new child node just created. // push_back a complete 6-sided star to the document.
+ //! \return A reference to the new child node just created.
+ // push_back a complete 6-sided star to the document.
children.push_back(new polygon_element(x1, y1, x2, y2, x3, y3, x4, y4, x5, y5, x6, y6, f));
return *(static_cast<polygon_element*>(&(children[(unsigned int)(children.size()-1)])));
}
polygon_element& polygon()
{ //! Add a new polygon element.
- //! \return A reference to the new child node just created.
+ //! \return A reference to the new polygon element just created.
children.push_back(new polygon_element()); // Empty polygon,
// to which poly_path_points can be added later using member function P.
return *(static_cast<polygon_element*>(&(children[(unsigned int)(children.size()-1)])));
@@ -2167,25 +2166,25 @@
polyline_element& polyline()
{ //! Add a new polyline element.
- //! \return A reference to the new child node just created.
+ //! \return A reference to the new polyline element just created.
children.push_back(new polyline_element()); // Empty polyline.
return *(static_cast<polyline_element*>(&(children[(unsigned int)(children.size()-1)])));
}
path_element& path()
{ //! Add a new path element.
- //! \return A reference to the new child node just created.
+ //! \return A reference to the new path just created.
children.push_back(new path_element()); // Empty path.
return *(static_cast<path_element*>(&(children[(unsigned int)(children.size()-1)])));
}
void push_back(svg_element* g)
- { //! Add a new g_element.
+ { //! Add a new child node g_element.
children.push_back(g);
}
void clear()
- {
+ { //! Remove all the child nodes.
children.clear();
}
}; // class g_element
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-04 07:22:46 EDT (Tue, 04 Aug 2009)
@@ -194,7 +194,7 @@
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 << "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-08-04 07:22:46 EDT (Tue, 04 Aug 2009)
@@ -144,7 +144,7 @@
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 << "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/svg.hpp
==============================================================================
--- sandbox/SOC/2007/visualization/boost/svg_plot/svg.hpp (original)
+++ sandbox/SOC/2007/visualization/boost/svg_plot/svg.hpp 2009-08-04 07:22:46 EDT (Tue, 04 Aug 2009)
@@ -194,7 +194,7 @@
// svg& y_size(unsigned int y)
// unsigned int y_size()
// svg& size(unsigned int x, unsigned int y)
-// information about the image file
+// information about the image file.
// svg& description(std::string d)
// std::string& description()
// svg& document_title(std::string d)
@@ -233,11 +233,12 @@
unsigned int x_size_; //!< SVG image X-axis size (in SVG units (default pixels).
unsigned int y_size_; //!< SVG image Y-axis size (in SVG units (default pixels).
- g_element document; //!< group_element to hold all elements of the svg document.
+ g_element document; //!< To hold all group elements of the svg document.
std::vector<clip_path_element> clip_paths; //!< Points on clip path (used for plot window).
- std::string title_document_; //!< SVG document title (for header as \verbatim <title> ... <\title> \endverbatim).
- std::string image_desc_; //!< SVG image description (for header as \verbatim <desc> ... <\desc> \endverbatim).
- std::string holder_copyright_; //!< SVG info on holder of copyright (probably == author, but could be institution).
+ // Document metadata:
+ std::string title_document_; //!< SVG document title (appears in the SVG file header as \verbatim <title> ... </title> \endverbatim).
+ std::string image_desc_; //!< SVG image description (appears in the SVG file header as \verbatim <desc> ... </desc> \endverbatim).
+ std::string holder_copyright_; //!< SVG info on holder of copyright (probably == author, but could be an institution).
std::string date_copyright_; //!< SVG info on date of copyright claimed.
std::string css_; //!< Cascading Style Sheet.
std::string filename_; //!< file SVG XML written to.
@@ -249,7 +250,9 @@
std::string commercialuse_; //!< License requirements for commerical use: "permits", "requires", or "prohibits".
std::string distribution_; //!< License requirements for distribution: "permits", "requires", or "prohibits".
std::string derivative_works_; //!< License requirements for derivative: "permits", "requires", or "prohibits".
+
int coord_precision_; //!< Number of decimal digits precision for output of X and Y coordinates to SVG XML.
+ // Not sure this is the best place for this?
private:
@@ -318,12 +321,12 @@
*/
for(size_t i = 0; i < clip_paths.size(); ++i)
{
- clip_paths[ (unsigned int)i ].write(s_out);
+ clip_paths[(unsigned int)i].write(s_out);
}
- // Write all visual elements.
+ // Write all visual group elements.
for(size_t i = 0; i < document.size(); ++i)
{ // plot_background, grids, axes ... title
- document[ (unsigned int)i ].write(s_out);
+ document[(unsigned int)i].write(s_out);
}
} // write_document
@@ -332,8 +335,8 @@
:
x_size_(400), //!< X-axis of the whole SVG image (default SVG units, default pixels).
y_size_(400), //!< Y-axis of the whole SVG image (default SVG units, default pixels).
- title_document_(""), //!< This is SVG document title, not a plot title.
- image_desc_(""), //!< Information about the image, for example, the program that created it.
+ title_document_(""), //!< This is a SVG document title, not a plot title.
+ image_desc_(""), //!< Information about the SVG image, for example, the program that created it.
author_(""), //!< Author of image (defaults to the copyright holder).
holder_copyright_(""), //!< Name of copyright holder.
date_copyright_(""), //!< Date of copyright claim.
@@ -376,16 +379,16 @@
return y_size_;
}
- std::pair<double, double> size()
- { //! \return the size (horizontal width and vertical height) of the SVG image.
+ std::pair<double, double> xy_sizes()
+ { //! \return both X and Y sizes (horizontal width and vertical height) of the SVG image.
std::pair<double, double> r;
- r.first =x_size_;
+ r.first = x_size_;
r.second = y_size_;
return r;
}
unsigned int document_size()
- { //! How many elements (groups or layers) have been added to document.
+ { //! How many group elements groups have been added to the document.
return static_cast<unsigned int>(document.size());
}
@@ -641,7 +644,7 @@
}
void description(const std::string d)
- { //! \verbatim Write description to the document (for header as <desc>). \endverbatim
+ { //! \verbatim Write description to the document (for header as <desc> ... </desc>). \endverbatim
image_desc_ = d;
}
@@ -660,9 +663,9 @@
return author_;
}
- void document_title(const std::string d)
- { //! \verbatim Set document title for the document (for header as <title>). \endverbatim
- title_document_ = d;
+ void document_title(const std::string title)
+ { //! \verbatim Set document title for the document (for header as <title> ... </title>). \endverbatim
+ title_document_ = title;
}
const std::string document_title()
@@ -670,9 +673,9 @@
return title_document_;
}
- void copyright_holder(const std::string d)
+ void copyright_holder(const std::string copyright_holder)
{ //! \verbatim Set document title for the document (for header as <copyright_holder>). \endverbatim
- holder_copyright_ = d;
+ holder_copyright_ = copyright_holder;
}
const std::string copyright_holder()
@@ -680,9 +683,9 @@
return holder_copyright_;
}
- void copyright_date(const std::string d)
+ void copyright_date(const std::string copyright_date)
{ //! \verbatim Set document title for the document (for header as <copyright_date>). \endverbatim
- date_copyright_ = d;
+ date_copyright_ = copyright_date;
}
const std::string copyright_date()
@@ -785,26 +788,27 @@
return document.polyline(v);
}
- // Add the information about path, clip_path to the document.
+ // Add information about path, clip_path to the document.
path_element& path()
- { //! Construct an empty path, ready for additions with chainable functions M., L. ...
- return document.path();
+ { //! Construct an empty path, ready for additions with chainable functions M., L., ...
+ return document.path(); //! \return reference to path element.
}
clip_path_element& clip_path(const rect_element& rect, const std::string& id)
{ //! Rectangle outside which 'painting' is 'clipped' so doesn't show.
clip_paths.push_back(clip_path_element(id, rect));
- return clip_paths[clip_paths.size()-1];
+ return clip_paths[clip_paths.size()-1]; //! \return Reference to clip_path element.
}
- g_element& g()
+ g_element& add_g_element()
{ //! Add information about a group element to the document.
- return document.g(); //! return reference to the group element.
+ //! Increments the size of the array of g_elements, returned by g_element.size().
+ return document.add_g_element(); //! return reference to the added group element.
}
g_element& g(int i)
- { //! \return from the array of g_elements, indexed by group type, PLOT_BACKGROUND, PLOT_WINDOW_BACKGROUND, ... SVG_PLOT_DOC_CHILDREN
+ { //! from array of g_elements, indexed by group type, PLOT_BACKGROUND, PLOT_WINDOW_BACKGROUND, ... SVG_PLOT_DOC_CHILDREN,
return document.g(i); //! return reference to the ith group element.
}
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-08-04 07:22:46 EDT (Tue, 04 Aug 2009)
@@ -275,7 +275,7 @@
double y_scale_; //!< scale used for transform from Cartesian to SVG coordinates.
double y_shift_; //!< shift from SVG origin is top left, Cartesian is bottom right.
- svg image; //!< Stored so as to avoid rewriting style information constantly.
+ svg image_; //!< Stored so as to avoid rewriting style information constantly.
double text_margin_; //!< Marginal space around text items like title,
@@ -438,21 +438,21 @@
// Build the document tree & add all the children of the root node.
for(int i = 0; i < detail::SVG_PLOT_DOC_CHILDREN; ++i)
{
- image.g();
+ image_.add_g_element();
}
set_ids();
// Set other SVG color, stroke & width defaults for various child PLOT nodes.
- image.g(PLOT_BACKGROUND).style().stroke_color(image_border_.stroke_);
- image.g(PLOT_BACKGROUND).style().stroke_width(image_border_.width_); //
- image.g(PLOT_BACKGROUND).style().fill_color(image_border_.fill_);
- image.g(PLOT_WINDOW_BACKGROUND).style().fill_color(plot_window_border_.fill_);
- image.g(PLOT_WINDOW_BACKGROUND).style().stroke_width(plot_window_border_.width_).stroke_color(plot_window_border_.stroke_);
- image.g(PLOT_LIMIT_POINTS).style().stroke_color(lightslategray).fill_color(antiquewhite);
- image.g(PLOT_X_AXIS).style().stroke_color(black).stroke_width(x_axis_.width());
- image.g(PLOT_DATA_UNC3).style().stroke_color(lightgoldenrodyellow).fill_color(lightgoldenrodyellow).stroke_width(1);
- image.g(PLOT_DATA_UNC2).style().stroke_color(peachpuff).fill_color(peachpuff).stroke_width(1);
- image.g(PLOT_DATA_UNC1).style().stroke_color(magenta).fill_color(pink).stroke_width(1);
+ image_.g(PLOT_BACKGROUND).style().stroke_color(image_border_.stroke_);
+ image_.g(PLOT_BACKGROUND).style().stroke_width(image_border_.width_); //
+ image_.g(PLOT_BACKGROUND).style().fill_color(image_border_.fill_);
+ image_.g(PLOT_WINDOW_BACKGROUND).style().fill_color(plot_window_border_.fill_);
+ image_.g(PLOT_WINDOW_BACKGROUND).style().stroke_width(plot_window_border_.width_).stroke_color(plot_window_border_.stroke_);
+ image_.g(PLOT_LIMIT_POINTS).style().stroke_color(lightslategray).fill_color(antiquewhite);
+ image_.g(PLOT_X_AXIS).style().stroke_color(black).stroke_width(x_axis_.width());
+ image_.g(PLOT_DATA_UNC3).style().stroke_color(lightgoldenrodyellow).fill_color(lightgoldenrodyellow).stroke_width(1);
+ image_.g(PLOT_DATA_UNC2).style().stroke_color(peachpuff).fill_color(peachpuff).stroke_width(1);
+ image_.g(PLOT_DATA_UNC1).style().stroke_color(magenta).fill_color(pink).stroke_width(1);
// Note that widths are stored in member data *and* copied here.
// Not sure if this is wise but ...
@@ -464,14 +464,14 @@
if(x_ticks_.use_up_ticks() || x_ticks_.use_down_ticks())
{
- image.g(PLOT_X_MAJOR_TICKS).style().stroke_width(x_ticks_.major_tick_width_).stroke_color(black);
- image.g(PLOT_X_MINOR_TICKS).style().stroke_width(x_ticks_.minor_tick_width_).stroke_color(black);
+ image_.g(PLOT_X_MAJOR_TICKS).style().stroke_width(x_ticks_.major_tick_width_).stroke_color(black);
+ image_.g(PLOT_X_MINOR_TICKS).style().stroke_width(x_ticks_.minor_tick_width_).stroke_color(black);
}
// Grids.
// Default color & width for grid, used or not.
- image.g(PLOT_X_MAJOR_GRID).style().stroke_width(x_ticks_.major_grid_width_).stroke_color(svg_color(200, 220, 255));
- image.g(PLOT_X_MINOR_GRID).style().stroke_width(x_ticks_.minor_grid_width_).stroke_color(svg_color(200, 220, 255));
- //image.g(PLOT_DATA_LINES).style().stroke_width(2); // default width.
+ image_.g(PLOT_X_MAJOR_GRID).style().stroke_width(x_ticks_.major_grid_width_).stroke_color(svg_color(200, 220, 255));
+ image_.g(PLOT_X_MINOR_GRID).style().stroke_width(x_ticks_.minor_grid_width_).stroke_color(svg_color(200, 220, 255));
+ //image_.g(PLOT_DATA_LINES).style().stroke_width(2); // default width.
// Alter with, for example: plot.data_lines_width(4);
legend_place_ = (plot_window_on_) ? outside_right : inside; // Defaults.
@@ -502,7 +502,7 @@
{ //! Document ids for use in identifying group elements, for example: <g id = "PLOT_TITLE".../g>
for(int i = 0; i < detail::SVG_PLOT_DOC_CHILDREN; ++i)
{
- image.g(i).id(detail::document_ids_[i]);
+ image_.g(i).id(detail::document_ids_[i]);
}
} // void set_ids()
@@ -516,8 +516,8 @@
// but reduce by the width of any image border.
plot_left_ = 0 + image_border_width(); // Top left of image.
plot_top_ = 0 + image_border_width();
- plot_right_ = image.x_size() - image_border_width(); // Bottom right of image.
- plot_bottom_ = image.y_size() - image_border_width();
+ plot_right_ = image_.x_size() - image_border_width(); // Bottom right of image.
+ plot_bottom_ = image_.y_size() - image_border_width();
if(title_on_ && title_info_.text() != "")
{ // Leave space at top for title.
@@ -644,7 +644,7 @@
if(plot_window_on_ == true)
{ // Draw plot window border as a rectangular box.
- image.g(detail::PLOT_WINDOW_BACKGROUND).push_back(
+ image_.g(detail::PLOT_WINDOW_BACKGROUND).push_back(
new rect_element(plot_left_, plot_top_, (plot_right_ - plot_left_), plot_bottom_ - plot_top_));
} // plot_window_on_
} // void calculate_plot_window()
@@ -663,7 +663,7 @@
//! (For 1-D, there is, of course, only the horizontal X-axis!)
double x(0.);
double y1(0.);
- double y2(image.y_size());
+ double y2(image_.y_size());
transform_x(x);
// Draw origin, making sure it is in the plot window.
if(x_axis_.axis_line_on_ && (x >= plot_left_) && (x <= plot_right_))
@@ -684,7 +684,7 @@
y1 = plot_top_;
y2 = plot_bottom_;
}
- image.g(detail::PLOT_X_AXIS).line(x, y1, x, y2);
+ image_.g(detail::PLOT_X_AXIS).line(x, y1, x, y2);
}
draw_x_axis();
} // draw_axes()
@@ -695,8 +695,8 @@
clear_all(); // Removes all elements that will show up in a subsequent draw.
// Draw plot background.
- image.g(detail::PLOT_BACKGROUND).push_back(
- new rect_element(0, 0, image.x_size(), image.y_size()));
+ image_.g(detail::PLOT_BACKGROUND).push_back(
+ new rect_element(0, 0, image_.x_size(), image_.y_size()));
calculate_plot_window();
calculate_transform();
@@ -722,7 +722,7 @@
for(unsigned int i = 0; i < serieses_.size(); ++i)
{ // Plot the data points for each of the data series.
- g_element& g_ptr = image.g(detail::PLOT_DATA_POINTS).g();
+ g_element& g_ptr = image_.g(detail::PLOT_DATA_POINTS).add_g_element();
g_ptr.style().stroke_color(serieses_[i].point_style_.stroke_color_);
g_ptr.style().fill_color(serieses_[i].point_style_.fill_color_);
@@ -740,7 +740,7 @@
draw_plot_point(x, y, g_ptr, serieses_[i].point_style_, ux, unc(0)); // Marker. (y uncertainty is zero)
if (x_values_on_)
{ // Show the value (& perhaps uncertainty) of the data point too.
- g_element& g_ptr_v = image.g(detail::PLOT_X_POINT_VALUES).g();
+ g_element& g_ptr_v = image_.g(detail::PLOT_X_POINT_VALUES).add_g_element();
draw_plot_point_value(x, y, g_ptr_v, x_values_style_, serieses_[i].point_style_, ux);
// TODO separate X and Y colors?
}
@@ -754,7 +754,7 @@
// Draw all the 'bad' or at_limit points.
for(unsigned int i = 0; i < serieses_.size(); ++i)
{
- g_element& g_ptr = image.g(detail::PLOT_LIMIT_POINTS);
+ g_element& g_ptr = image_.g(detail::PLOT_LIMIT_POINTS);
for (unsigned int j = 0; j != serieses_[i].series_limits_.size(); ++j)
{
@@ -788,8 +788,8 @@
}
// else is inside plot window, so draw a limit point marker.
// draw_plot_point(x, y, g_ptr, plot_point_style(lightgray, whitesmoke, s, cone)); default.
- serieses_[i].limit_point_style_.stroke_color_ = image.g(detail::PLOT_LIMIT_POINTS).style().stroke_color();
- serieses_[i].limit_point_style_.fill_color_ = image.g(detail::PLOT_LIMIT_POINTS).style().fill_color();
+ serieses_[i].limit_point_style_.stroke_color_ = image_.g(detail::PLOT_LIMIT_POINTS).style().stroke_color();
+ serieses_[i].limit_point_style_.fill_color_ = image_.g(detail::PLOT_LIMIT_POINTS).style().fill_color();
// This is a kludge. limit_point_style_ should probably be common to all data series.
draw_plot_point(x, y, g_ptr, serieses_[i].limit_point_style_, 0, 0);
@@ -838,7 +838,7 @@
{
throw std::runtime_error("Failed to open " + filename);
}
- image.image_filename(filename);
+ image_.image_filename(filename);
// Note filename for optional output as comment in the .svg file.
svg_1d_plot::write(fout); // Use the ostream version.
return *this;
@@ -857,7 +857,7 @@
For example, if a curve is shown using 100 points,
reducing to coord_precision(3) from default of 6 will reduce file size by 300 bytes.
*/
- image.write(s_out);
+ image_.write(s_out);
return (svg_1d_plot&)*this;
} // write
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-04 07:22:46 EDT (Tue, 04 Aug 2009)
@@ -354,7 +354,7 @@
double y_scale_; //!< scale factor used by transform() to go from Cartesian to SVG coordinates.
double y_shift_; //!< shift factor used by transform() to go from Cartesian to SVG coordinates.
- svg image; //!< Stored so as to avoid rewriting style information constantly.
+ svg image_; //!< Stored so as to avoid rewriting style information constantly.
double text_margin_; //!< Marginal space around text items like title, text_margin_ * font_size to get distance in svg units.
@@ -569,26 +569,26 @@
// Build the document tree by adding all children of the root node.
for(int i = 0; i < SVG_PLOT_DOC_CHILDREN; ++i)
{
- image.g();
+ image_.add_g_element();
}
set_ids();
// Set other SVG color, stroke & width defaults for various child PLOT nodes.
- image.g(PLOT_BACKGROUND).style().fill_color(image_border_.fill_);
- image.g(PLOT_BACKGROUND).style().stroke_color(image_border_.stroke_);
- image.g(PLOT_BACKGROUND).style().stroke_width(image_border_.width_); //
- image.g(PLOT_WINDOW_BACKGROUND).style().fill_color(plot_window_border_.fill_);
- image.g(PLOT_WINDOW_BACKGROUND).style().stroke_width(plot_window_border_.width_).stroke_color(plot_window_border_.stroke_);
- image.g(PLOT_LIMIT_POINTS).style().stroke_color(lightslategray).fill_color(antiquewhite);
- image.g(PLOT_X_AXIS).style().stroke_color(black).stroke_width(x_axis_.width());
- image.g(PLOT_Y_AXIS).style().stroke_color(black).stroke_width(y_axis_.width());
-
- image.g(PLOT_DATA_UNC3).style().stroke_color(blank).fill_color(lightgoldenrodyellow).stroke_width(1);
- image.g(PLOT_DATA_UNC2).style().stroke_color(peachpuff).fill_color(peachpuff).stroke_width(1);
- image.g(PLOT_DATA_UNC1).style().stroke_color(pink).fill_color(pink).stroke_width(1);
+ image_.g(PLOT_BACKGROUND).style().fill_color(image_border_.fill_);
+ image_.g(PLOT_BACKGROUND).style().stroke_color(image_border_.stroke_);
+ image_.g(PLOT_BACKGROUND).style().stroke_width(image_border_.width_); //
+ image_.g(PLOT_WINDOW_BACKGROUND).style().fill_color(plot_window_border_.fill_);
+ image_.g(PLOT_WINDOW_BACKGROUND).style().stroke_width(plot_window_border_.width_).stroke_color(plot_window_border_.stroke_);
+ image_.g(PLOT_LIMIT_POINTS).style().stroke_color(lightslategray).fill_color(antiquewhite);
+ image_.g(PLOT_X_AXIS).style().stroke_color(black).stroke_width(x_axis_.width());
+ image_.g(PLOT_Y_AXIS).style().stroke_color(black).stroke_width(y_axis_.width());
+
+ image_.g(PLOT_DATA_UNC3).style().stroke_color(blank).fill_color(lightgoldenrodyellow).stroke_width(1);
+ image_.g(PLOT_DATA_UNC2).style().stroke_color(peachpuff).fill_color(peachpuff).stroke_width(1);
+ image_.g(PLOT_DATA_UNC1).style().stroke_color(pink).fill_color(pink).stroke_width(1);
- //image.g(detail::PLOT_NOTES).style().fill_color(black);
+ //image_.g(detail::PLOT_NOTES).style().fill_color(black);
// Note that widths are stored in member data *and* copied here.
// Not sure if this is wise but ...
@@ -596,22 +596,22 @@
// Ticks
if(x_ticks_.use_up_ticks() || x_ticks_.use_down_ticks())
{
- image.g(PLOT_X_MAJOR_TICKS).style().stroke_width(x_ticks_.major_tick_width_).stroke_color(black);
- image.g(PLOT_X_MINOR_TICKS).style().stroke_width(x_ticks_.minor_tick_width_).stroke_color(black);
+ image_.g(PLOT_X_MAJOR_TICKS).style().stroke_width(x_ticks_.major_tick_width_).stroke_color(black);
+ image_.g(PLOT_X_MINOR_TICKS).style().stroke_width(x_ticks_.minor_tick_width_).stroke_color(black);
}
if(y_ticks_.left_ticks_on_ || y_ticks_.right_ticks_on_)
{
- image.g(PLOT_Y_MAJOR_TICKS).style().stroke_width(y_ticks_.major_tick_width_).stroke_color(black);
- image.g(PLOT_Y_MINOR_TICKS).style().stroke_width(y_ticks_.minor_tick_width_).stroke_color(black);
+ image_.g(PLOT_Y_MAJOR_TICKS).style().stroke_width(y_ticks_.major_tick_width_).stroke_color(black);
+ image_.g(PLOT_Y_MINOR_TICKS).style().stroke_width(y_ticks_.minor_tick_width_).stroke_color(black);
}
// Grids.
// Default color & width for grid, used or not.
// Might avoid empty grid stuff if this was only done if grid used? TODO
- image.g(PLOT_X_MAJOR_GRID).style().stroke_width(x_ticks_.major_grid_width_).stroke_color(svg_color(200, 220, 255));
- image.g(PLOT_X_MINOR_GRID).style().stroke_width(x_ticks_.minor_grid_width_).stroke_color(svg_color(200, 220, 255));
- image.g(PLOT_Y_MAJOR_GRID).style().stroke_width(y_ticks_.major_grid_width_).stroke_color(svg_color(200, 220, 255));
- image.g(PLOT_Y_MINOR_GRID).style().stroke_width(y_ticks_.minor_grid_width_).stroke_color(svg_color(200, 220, 255));
- image.g(PLOT_DATA_LINES).style().stroke_width(2); // default width.
+ image_.g(PLOT_X_MAJOR_GRID).style().stroke_width(x_ticks_.major_grid_width_).stroke_color(svg_color(200, 220, 255));
+ image_.g(PLOT_X_MINOR_GRID).style().stroke_width(x_ticks_.minor_grid_width_).stroke_color(svg_color(200, 220, 255));
+ image_.g(PLOT_Y_MAJOR_GRID).style().stroke_width(y_ticks_.major_grid_width_).stroke_color(svg_color(200, 220, 255));
+ image_.g(PLOT_Y_MINOR_GRID).style().stroke_width(y_ticks_.minor_grid_width_).stroke_color(svg_color(200, 220, 255));
+ image_.g(PLOT_DATA_LINES).style().stroke_width(2); // default width.
// Alter with plot.data_lines_width(4);
legend_place_ = (plot_window_on_) ? outside_right : inside; // Defaults.
@@ -657,7 +657,7 @@
{ //! document ids for use in <g id = "PLOT_TITLE".../>
for(int i = 0; i < detail::SVG_PLOT_DOC_CHILDREN; ++i)
{ // Order determines the painting order.
- image.g(i).id(detail::document_ids_[i]);
+ image_.g(i).id(detail::document_ids_[i]);
}
} // void set_ids()
@@ -678,8 +678,8 @@
// but reduce by the width of any image border.
plot_left_ = 0 + image_border_width(); // Top left of image.
plot_top_ = 0 + image_border_width();
- plot_right_ = image.x_size() - image_border_width(); // Bottom right of image.
- plot_bottom_ = image.y_size() - image_border_width();
+ plot_right_ = image_.x_size() - image_border_width(); // Bottom right of image.
+ plot_bottom_ = image_.y_size() - image_border_width();
if(title_on_)
{ // Leave space at top for title.
@@ -980,7 +980,7 @@
}
if (plot_window_on_)
{ // Draw plot window rectangle with border and/or background.
- image.g(detail::PLOT_WINDOW_BACKGROUND).push_back(
+ image_.g(detail::PLOT_WINDOW_BACKGROUND).push_back(
new rect_element(plot_left_, plot_top_, (plot_right_ - plot_left_), plot_bottom_ - plot_top_));
}
@@ -1015,24 +1015,24 @@
}
}
}
- image.g(detail::PLOT_Y_AXIS).line(x, ytop, x, ybottom);
+ image_.g(detail::PLOT_Y_AXIS).line(x, ytop, x, ybottom);
// <g id="yAxis" stroke="rgb(0,0,0)"><line x1="70.5" y1="53" x2="70.5" y2="357"/>
if (y_ticks_.ticks_on_window_or_on_axis_ < 0) //(y_axis_position_ == left)
{ // Draw vertical line holding the ticks on the left of plot window.
- image.g(detail::PLOT_Y_AXIS).line(plot_left_, plot_top_, plot_left_, plot_bottom_);
+ image_.g(detail::PLOT_Y_AXIS).line(plot_left_, plot_top_, plot_left_, plot_bottom_);
}
else
{// Draw vertical line holding the ticks on the right of plot window.
- image.g(detail::PLOT_Y_AXIS).line(plot_right_, plot_top_, plot_right_, plot_bottom_);
+ image_.g(detail::PLOT_Y_AXIS).line(plot_right_, plot_top_, plot_right_, plot_bottom_);
}
}
else if (y_axis_position_ == left)
{ // Draw on the left of plot window.
- image.g(detail::PLOT_Y_AXIS).line(plot_left_, plot_top_, plot_left_, plot_bottom_);
+ image_.g(detail::PLOT_Y_AXIS).line(plot_left_, plot_top_, plot_left_, plot_bottom_);
}
else if (y_axis_position_ == right)
{// Draw on the right of plot window.
- image.g(detail::PLOT_Y_AXIS).line(plot_right_, plot_top_, plot_right_, plot_bottom_);
+ image_.g(detail::PLOT_Y_AXIS).line(plot_right_, plot_top_, plot_right_, plot_bottom_);
}
else
{ // ??? Warn that things have gone wrong?
@@ -1040,10 +1040,10 @@
}
// Access the paths for the ticks & grids, ready for additions.
- path_element& minor_tick_path = image.g(detail::PLOT_Y_MINOR_TICKS).path();
- path_element& major_tick_path = image.g(detail::PLOT_Y_MAJOR_TICKS).path();
- path_element& minor_grid_path = image.g(detail::PLOT_Y_MINOR_GRID).path();
- path_element& major_grid_path = image.g(detail::PLOT_Y_MAJOR_GRID).path();
+ path_element& minor_tick_path = image_.g(detail::PLOT_Y_MINOR_TICKS).path();
+ path_element& major_tick_path = image_.g(detail::PLOT_Y_MAJOR_TICKS).path();
+ path_element& minor_grid_path = image_.g(detail::PLOT_Y_MINOR_GRID).path();
+ path_element& major_grid_path = image_.g(detail::PLOT_Y_MAJOR_GRID).path();
// y_minor_jump is the interval between minor ticks.
double y_minor_jump = y_ticks_.major_interval_ / ((double)(y_ticks_.num_minor_ticks_ + 1.) );
@@ -1108,7 +1108,7 @@
void draw_y_axis_label()
{ //! Draw a vertical Y-axis label, and optional y units.
// Y-label color is set in constructor thus:
- // image.g(detail::PLOT_Y_LABEL).style().stroke_color(black);
+ // image_.g(detail::PLOT_Y_LABEL).style().stroke_color(black);
// and changed using y_label_color(color);
// Similarly for font family and size.
@@ -1221,7 +1221,7 @@
}
// Glyph is at bottom left of western characters.
- image.g(detail::PLOT_Y_LABEL).push_back(new
+ image_.g(detail::PLOT_Y_LABEL).push_back(new
text_element(x, // distance from left side of image.
y, // center on the plot window.
label, // "Y-Axis" for example.
@@ -1242,7 +1242,7 @@
return;
}
double x_left(0.); // Left end of tick.
- double x_right(image.y_size()); // Right end of tick.
+ double x_right(image_.y_size()); // Right end of tick.
if(y_ticks_.major_grid_on_ == true)
{ // Draw horizontal major Y grid line.
if(!plot_window_on_ == true)
@@ -1490,7 +1490,7 @@
{ // External to plot window style left or right.
// Always want all values including "0", if labeling external to plot window.
// y_ticks_.ticks_on_window_or_on_axis_ == true != 0
- image.g(detail::PLOT_Y_TICKS_VALUES).text(
+ image_.g(detail::PLOT_Y_TICKS_VALUES).text(
x,
y,
label.str(),
@@ -1501,7 +1501,7 @@
{ // ! y_ticks_.y_ticks_on_plot_window_ == 0 'Internal' - value labels either side of vertical Y-axis.
if ((value != 0) && y_axis_.axis_line_on_)
{ // Avoid a zero ON the Y-axis if it would be cut through by any horizontal X-axis line.
- image.g(detail::PLOT_Y_TICKS_VALUES).text(
+ image_.g(detail::PLOT_Y_TICKS_VALUES).text(
x,
y,
label.str(), // "1.23"
@@ -1516,7 +1516,7 @@
void draw_y_minor_tick(double value, path_element& tick_path, path_element& grid_path)
{ //! Draw a Y-axis minor tick and optional grid. (minor ticks do not have value labels).
double x_left(0.); // Start on vertical Y axis line.
- double x_right(image.y_size()); // right edge of image.
+ double x_right(image_.y_size()); // right edge of image.
double y(value); // Tick position and value label,
transform_y(y); // convert to svg.
@@ -1585,7 +1585,7 @@
void draw_straight_lines(const svg_2d_plot_series& series)
{ //! Add line between series of data points (straight rather than a Bezier curve).
- g_element& g_ptr = image.g(detail::PLOT_DATA_LINES).g();
+ g_element& g_ptr = image_.g(detail::PLOT_DATA_LINES).add_g_element();
g_ptr.clip_id(plot_window_clip_);
g_ptr.style().stroke_color(series.line_style_.stroke_color_);
g_ptr.style().fill_color(series.line_style_.area_fill_); // Now set in path below too.
@@ -1652,7 +1652,7 @@
void draw_bezier_lines(const svg_2d_plot_series& series)
{ //! Add Bezier curve line between data points.
- g_element& g_ptr = image.g(detail::PLOT_DATA_LINES).g();
+ g_element& g_ptr = image_.g(detail::PLOT_DATA_LINES).add_g_element();
g_ptr.clip_id(plot_window_clip_);
g_ptr.style().stroke_color(series.line_style_.stroke_color_);
path_element& path = g_ptr.path();
@@ -1755,7 +1755,7 @@
double y(0.);
for(unsigned int i = 0; i < serieses_.size(); ++i)
{
- g_element& g_ptr = image.g(detail::PLOT_DATA_POINTS).g();
+ g_element& g_ptr = image_.g(detail::PLOT_DATA_POINTS).add_g_element();
g_ptr.style()
.fill_color(serieses_[i].point_style_.fill_color_)
@@ -1776,14 +1776,14 @@
{ // Is inside plot window, so draw a point.
draw_plot_point(x, y, g_ptr, serieses_[i].point_style_, ux, uy); // Add the unc to allow access to uncertainty.
// TODO might refactor so that only pass ux, and uy.
- g_element& g_ptr_vx = image.g(detail::PLOT_X_POINT_VALUES).g();
+ g_element& g_ptr_vx = image_.g(detail::PLOT_X_POINT_VALUES).add_g_element();
if (x_values_on_)
{ // Show the value of the X data point too.
// void draw_plot_point_value(double x, double y, g_element& g_ptr, value_style& val_style, plot_point_style& point_style, double value)
draw_plot_point_value(x, y, g_ptr_vx, x_values_style_, serieses_[i].point_style_, ux);
}
- g_element& g_ptr_vy = image.g(detail::PLOT_Y_POINT_VALUES).g();
+ g_element& g_ptr_vy = image_.g(detail::PLOT_Y_POINT_VALUES).add_g_element();
if (y_values_on_)
{ // show the value of the Y data point too.
draw_plot_point_value(x, y, g_ptr_vy, y_values_style_,serieses_[i].point_style_, uy);
@@ -1800,7 +1800,7 @@
// Draw all the abnormal 'at_limit' points.
for(unsigned int i = 0; i < serieses_.size(); ++i)
{
- g_element& g_ptr = image.g(detail::PLOT_LIMIT_POINTS);
+ g_element& g_ptr = image_.g(detail::PLOT_LIMIT_POINTS);
for(std::multimap<double,double>::const_iterator j = serieses_[i].series_limits_.begin();
j!=serieses_[i].series_limits_.end(); ++j)
@@ -1864,8 +1864,8 @@
// else is inside plot window, so draw a limit point marker.
// draw_plot_point(x, y, g_ptr, plot_point_style(lightgray, whitesmoke, s, cone)); default.
}
- serieses_[i].limit_point_style_.stroke_color_ = image.g(detail::PLOT_LIMIT_POINTS).style().stroke_color();
- serieses_[i].limit_point_style_.fill_color_ = image.g(detail::PLOT_LIMIT_POINTS).style().fill_color();
+ serieses_[i].limit_point_style_.stroke_color_ = image_.g(detail::PLOT_LIMIT_POINTS).style().stroke_color();
+ serieses_[i].limit_point_style_.fill_color_ = image_.g(detail::PLOT_LIMIT_POINTS).style().fill_color();
// This is a kludge. limit_point_style_ should probably be common to all data series.
draw_plot_point(x, y, g_ptr, serieses_[i].limit_point_style_, unc(0.), unc(0.)); // No uncertainty info for values at limit infinity & NaN.
@@ -1881,7 +1881,7 @@
void draw_bars()
{ //! Draw normal bar chart for 'good' non-limit points.
- g_element& g_ptr = image.g(detail::PLOT_DATA_POINTS).g(); // Moved up out of loop.
+ g_element& g_ptr = image_.g(detail::PLOT_DATA_POINTS).add_g_element(); // Moved up out of loop.
double x(0.);
double y(0.); // Cartesian coord y = 0.
double x0(0.); // Y-axis line.
@@ -1971,7 +1971,7 @@
Using the y values for the bins implies changing the Y axes labeling and scaling too.
*/
- g_element& g_ptr = image.g(detail::PLOT_DATA_POINTS).g(); // Moved up out of loop.
+ g_element& g_ptr = image_.g(detail::PLOT_DATA_POINTS).add_g_element(); // Moved up out of loop.
for(unsigned int i = 0; i < serieses_.size(); ++i)
{ // for each data series.
if (serieses_[i].histogram_style_.histogram_option_ == no_histogram)
@@ -2043,8 +2043,8 @@
// previous painting, so the order of drawing is important.
// Draw image background (perhaps with border and/or fill color).
- image.g(detail::PLOT_BACKGROUND).push_back(
- new rect_element(0, 0, image.x_size(), image.y_size()));
+ image_.g(detail::PLOT_BACKGROUND).push_back(
+ new rect_element(0, 0, image_.x_size(), image_.y_size()));
calculate_plot_window();
draw_title(); // Moved to ensure plot_X and Y are valid.
@@ -2055,12 +2055,12 @@
// TODO should this be border thickness?
// Actually we DO want to allow a small amount of overlap
// so round point can lie on the axis line without being chopped in half or not show at all!!!
- image.clip_path(rect_element(plot_left_ + 1, plot_top_ + 1,
+ image_.clip_path(rect_element(plot_left_ + 1, plot_top_ + 1,
plot_right_ - plot_left_ - 2, plot_bottom_ - plot_top_ - 2),
plot_window_clip_);
// <clipPath id="plot_window"><rect x="35" y="38" width="309" height="322"/></clipPath>
- image.g(detail::PLOT_DATA_POINTS).clip_id(plot_window_clip_);
+ image_.g(detail::PLOT_DATA_POINTS).clip_id(plot_window_clip_);
// Draw axes, labels & legend, as required.
draw_x_axis(); // Must do X-axis first.
@@ -2324,13 +2324,13 @@
svg_2d_plot& svg_2d_plot::y_axis_width(double width)
{ //! Set width of Y axis line.
- image.g(detail::PLOT_Y_AXIS).style().stroke_width(width);
+ image_.g(detail::PLOT_Y_AXIS).style().stroke_width(width);
return *this; //! \return reference to svg_2d_plot to make chainable.
}
double svg_2d_plot::y_axis_width()
{//! \return width of Y axis line.
- return image.g(detail::PLOT_Y_AXIS).style().stroke_width();
+ return image_.g(detail::PLOT_Y_AXIS).style().stroke_width();
}
svg_2d_plot& svg_2d_plot::y_value_precision(int digits)
@@ -2376,26 +2376,26 @@
svg_2d_plot& svg_2d_plot::y_axis_color(const svg_color& col)
{ //! Set Y axis linecolor. (set only stroke color).
- image.g(detail::PLOT_Y_AXIS).style().stroke_color(col);
+ image_.g(detail::PLOT_Y_AXIS).style().stroke_color(col);
return *this; //! \return reference to svg_2d_plot to make chainable.
}
svg_color svg_2d_plot::y_axis_color()
{ //! \return the stroke color.
- return image.g(detail::PLOT_Y_AXIS).style().stroke_color();
+ return image_.g(detail::PLOT_Y_AXIS).style().stroke_color();
}
svg_2d_plot& svg_2d_plot::y_axis_label_color(const svg_color& col)
{ //! Set stroke color.
// Setting the stroke color produces fuzzy characters :-(
- image.g(detail::PLOT_Y_LABEL).style().fill_color(col);
+ image_.g(detail::PLOT_Y_LABEL).style().fill_color(col);
return *this; //! \return reference to svg_2d_plot to make chainable.
}
svg_color svg_2d_plot::y_axis_label_color()
{ //! \return the y axis label stroke color.
// y_label_info_.style().stroke_color();
- return image.g(detail::PLOT_Y_LABEL).style().fill_color();
+ return image_.g(detail::PLOT_Y_LABEL).style().fill_color();
}
svg_2d_plot& svg_2d_plot::y_label_units_on(bool b)
@@ -2412,69 +2412,69 @@
svg_2d_plot& svg_2d_plot::y_axis_value_color(const svg_color& col)
{ //! Set color of Y axis value labels.
- image.g(detail::PLOT_Y_TICKS_VALUES).style().stroke_color(col);
+ image_.g(detail::PLOT_Y_TICKS_VALUES).style().stroke_color(col);
return *this; //! \return reference to svg_2d_plot to make chainable.
}
svg_color svg_2d_plot::y_axis_value_color()
{ //! \return color of Y-axis tick value labels.
// Only return the stroke color.
- return image.g(detail::PLOT_Y_TICKS_VALUES).style().stroke_color();
+ return image_.g(detail::PLOT_Y_TICKS_VALUES).style().stroke_color();
}
svg_2d_plot& svg_2d_plot::y_label_width(double width)
{ //! Set width of Y axis value labels.
- image.g(detail::PLOT_Y_LABEL).style().stroke_width(width);
+ image_.g(detail::PLOT_Y_LABEL).style().stroke_width(width);
return *this; //! \return reference to svg_2d_plot to make chainable.
}
double svg_2d_plot::y_label_width()
{ //! \return color of Y axis value labels.
- return image.g(detail::PLOT_Y_LABEL).style().stroke_width();
+ return image_.g(detail::PLOT_Y_LABEL).style().stroke_width();
}
svg_2d_plot& svg_2d_plot::y_major_grid_color(const svg_color& col)
{ //! Set color of Y major grid lines.
- image.g(detail::PLOT_Y_MAJOR_GRID).style().stroke_color(col);
+ image_.g(detail::PLOT_Y_MAJOR_GRID).style().stroke_color(col);
return *this; //! \return reference to svg_2d_plot to make chainable.
}
const svg_color svg_2d_plot::y_major_grid_color()
{ //! \return color of Y major grid lines.
- return image.g(detail::PLOT_Y_MAJOR_GRID).style().stroke_color();
+ return image_.g(detail::PLOT_Y_MAJOR_GRID).style().stroke_color();
}
svg_2d_plot& svg_2d_plot::y_minor_grid_color(const svg_color& col)
{ //! Set color of Y minor grid lines.
- image.g(detail::PLOT_Y_MINOR_GRID).style().stroke_color(col);
+ image_.g(detail::PLOT_Y_MINOR_GRID).style().stroke_color(col);
return *this; //! \return reference to svg_2d_plot to make chainable.
}
const svg_color svg_2d_plot::y_minor_grid_color()
{ //! \return color of Y minor grid lines.
- return image.g(detail::PLOT_Y_MINOR_GRID).style().stroke_color();
+ return image_.g(detail::PLOT_Y_MINOR_GRID).style().stroke_color();
}
svg_2d_plot& svg_2d_plot::y_major_tick_color(const svg_color& col)
{ //! Set color of Y major tick lines.
- image.g(detail::PLOT_Y_MAJOR_TICKS).style().stroke_color(col);
+ image_.g(detail::PLOT_Y_MAJOR_TICKS).style().stroke_color(col);
return *this; //! \return reference to svg_2d_plot to make chainable.
}
const svg_color svg_2d_plot::y_major_tick_color()
{ //! \return color of Y major tick lines.
- return image.g(detail::PLOT_Y_MAJOR_TICKS).style().stroke_color();
+ return image_.g(detail::PLOT_Y_MAJOR_TICKS).style().stroke_color();
}
svg_2d_plot& svg_2d_plot::y_minor_tick_color(const svg_color& col)
{ //! Set color of Y minor tick lines.
- image.g(detail::PLOT_Y_MINOR_TICKS).style().stroke_color(col);
+ image_.g(detail::PLOT_Y_MINOR_TICKS).style().stroke_color(col);
return *this; //! \return reference to svg_2d_plot to make chainable.
}
const svg_color svg_2d_plot::y_minor_tick_color()
{ //! \return color of Y minor tick lines.
- return image.g(detail::PLOT_Y_MINOR_TICKS).style().stroke_color();
+ return image_.g(detail::PLOT_Y_MINOR_TICKS).style().stroke_color();
}
const std::string svg_2d_plot::y_axis_position()
@@ -2776,7 +2776,7 @@
svg_2d_plot& svg_2d_plot::y_major_tick_width(double width)
{ //! Set width of major ticks on Y axis.
y_ticks_.major_tick_width_ = width;
- image.g(detail::PLOT_Y_MAJOR_TICKS).style().stroke_width(width);
+ image_.g(detail::PLOT_Y_MAJOR_TICKS).style().stroke_width(width);
return *this; //! \return reference to svg_2d_plot to make chainable.
}
@@ -2788,7 +2788,7 @@
svg_2d_plot& svg_2d_plot::y_minor_tick_width(double width)
{ //! Set width of minor ticks on Y axis.
y_ticks_.minor_tick_width_ = width;
- image.g(detail::PLOT_Y_MINOR_TICKS).style().stroke_width(width);
+ image_.g(detail::PLOT_Y_MINOR_TICKS).style().stroke_width(width);
return *this; //! \return reference to svg_2d_plot to make chainable.
}
@@ -2890,7 +2890,7 @@
svg_2d_plot& svg_2d_plot::y_minor_grid_width(double width)
{ //! Set width of minor grid lines.
y_ticks_.minor_grid_width_ = width;
- image.g(detail::PLOT_Y_MINOR_GRID).style().stroke_width(width);
+ image_.g(detail::PLOT_Y_MINOR_GRID).style().stroke_width(width);
return *this; //! \return reference to svg_2d_plot to make chainable.
}
@@ -2902,7 +2902,7 @@
svg_2d_plot& svg_2d_plot::y_major_grid_width(double width)
{ //! Set width of major grid lines.
y_ticks_.major_grid_width_ = width;
- image.g(detail::PLOT_Y_MAJOR_GRID).style().stroke_width(width);
+ image_.g(detail::PLOT_Y_MAJOR_GRID).style().stroke_width(width);
return *this; //! \return reference to svg_2d_plot to make chainable.
}
@@ -2961,16 +2961,16 @@
// but just setting fill if simplest,
// but does not allow separate inside & outside colors.
y_ticks_.values_color_ = col;
- image.g(detail::PLOT_Y_TICKS_VALUES).style().fill_color(col);
+ image_.g(detail::PLOT_Y_TICKS_VALUES).style().fill_color(col);
// Setting stroke seems to produce fuzzy letters.
- //svg_2d_plot().image.g(PLOT_Y_POINT_VALUES).style().stroke_color(col);
+ //svg_2d_plot().image_.g(PLOT_Y_POINT_VALUES).style().stroke_color(col);
return *this; //! \return reference to svg_2d_plot to make chainable.
}
svg_color svg_2d_plot::y_ticks_values_color()
{ //! \return color for Y-axis ticks values.
// Function could greturn either fill and stroke,
- // image.g(detail::PLOT_Y_TICKS_VALUES).style().fill_color();
+ // image_.g(detail::PLOT_Y_TICKS_VALUES).style().fill_color();
return y_ticks_.values_color_;
}
@@ -3050,16 +3050,16 @@
// Function could set both fill (middle) and stroke (outside),
// but just setting fill if simplest,
// but does not allow separate inside & outside colors.
- image.g(detail::PLOT_Y_POINT_VALUES).style().fill_color(col);
- //svg_2d_plot().image.g(PLOT_Y_POINT_VALUES).style().stroke_color(col);
+ image_.g(detail::PLOT_Y_POINT_VALUES).style().fill_color(col);
+ //svg_2d_plot().image_.g(PLOT_Y_POINT_VALUES).style().stroke_color(col);
return *this; //! \return reference to svg_2d_plot to make chainable.
}
svg_color svg_2d_plot::y_values_color()
{ //! \return color for Y axis values.
// Function could get either fill and stroke,
- // return svg_2d_plot().image.g(PLOT_Y_POINT_VALUES).style().stroke_color();
- return image.g(detail::PLOT_Y_POINT_VALUES).style().fill_color();
+ // return svg_2d_plot().image_.g(PLOT_Y_POINT_VALUES).style().stroke_color();
+ return image_.g(detail::PLOT_Y_POINT_VALUES).style().fill_color();
}
svg_2d_plot& svg_2d_plot::y_values_rotation(rotate_style rotate)
@@ -3183,7 +3183,7 @@
svg_2d_plot& svg_2d_plot::write(std::ostream& s_out)
{ //! Write the SVG image to an ostream.
update_image();
- image.write(s_out); // Use the ostream version of write.
+ image_.write(s_out); // Use the ostream version of write.
return *this; //! \return reference to svg_2d_plot to make chainable.
}
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-04 07:22:46 EDT (Tue, 04 Aug 2009)
@@ -634,8 +634,8 @@
// axis_plot_frame.hpp contains functions common to 1 and 2-D, and boxplot.
private:
- svg image; // Stored so as to avoid rewriting style information constantly.
- // image.size(500, 500);
+ svg image_; // Stored so as to avoid rewriting style information constantly.
+ // image_.size(500, 500);
double x_scale_; //! Used by function transform()
double x_shift_; //! to go from Cartesian to SVG coordinates.
@@ -820,51 +820,51 @@
// Build the document tree. add children of the root node.
for(int i = 0; i < boxplot::BOXPLOT_DOC_CHILDREN; ++i)
{
- image.g();
+ image_.add_g_element();
}
//set_ids();
// void set_ids() // This only used once in constructor and IS now inlined.
// document ids for use in <g id = "PLOT_TITLE".../>
for(int i = 0; i < boxplot::BOXPLOT_DOC_CHILDREN; ++i)
{ // Order determines the painting order.
- image.g(i).id(boxplot::document_ids_[i]);
+ image_.g(i).id(boxplot::document_ids_[i]);
}
// Set boxplot color defaults.
- image.g(boxplot::PLOT_BACKGROUND).style().fill_color(image_border_.fill_);
- image.g(boxplot::PLOT_BACKGROUND).style().stroke_color(image_border_.stroke_);
- image.g(boxplot::PLOT_BACKGROUND).style().stroke_width(image_border_.width_); //
-
- image.g(boxplot::PLOT_WINDOW_BACKGROUND).style().fill_color(plot_window_border_.fill_);
- image.g(boxplot::PLOT_WINDOW_BACKGROUND).style().stroke_width(plot_window_border_.width_).stroke_color(plot_window_border_.stroke_);
- image.g(boxplot::X_AXIS).style().stroke_color(black).stroke_width(x_axis_.width());
- image.g(boxplot::Y_AXIS).style().stroke_color(black).stroke_width(y_axis_.width());
+ image_.g(boxplot::PLOT_BACKGROUND).style().fill_color(image_border_.fill_);
+ image_.g(boxplot::PLOT_BACKGROUND).style().stroke_color(image_border_.stroke_);
+ image_.g(boxplot::PLOT_BACKGROUND).style().stroke_width(image_border_.width_); //
+
+ image_.g(boxplot::PLOT_WINDOW_BACKGROUND).style().fill_color(plot_window_border_.fill_);
+ image_.g(boxplot::PLOT_WINDOW_BACKGROUND).style().stroke_width(plot_window_border_.width_).stroke_color(plot_window_border_.stroke_);
+ image_.g(boxplot::X_AXIS).style().stroke_color(black).stroke_width(x_axis_.width());
+ image_.g(boxplot::Y_AXIS).style().stroke_color(black).stroke_width(y_axis_.width());
// Ticks & grids.
if(x_ticks_.use_up_ticks() || x_ticks_.use_down_ticks())
{
- image.g(boxplot::X_TICKS).style().stroke_width(x_ticks_.minor_tick_width_).stroke_color(black);
+ image_.g(boxplot::X_TICKS).style().stroke_width(x_ticks_.minor_tick_width_).stroke_color(black);
}
if(y_ticks_.left_ticks_on_ || y_ticks_.right_ticks_on_)
{
- image.g(boxplot::Y_MAJOR_TICKS).style().stroke_width(y_ticks_.major_tick_width_).stroke_color(black);
- image.g(boxplot::Y_MINOR_TICKS).style().stroke_width(y_ticks_.minor_tick_width_).stroke_color(black);
- image.g(boxplot::Y_MAJOR_GRID).style().stroke_width(y_ticks_.major_grid_width_).stroke_color(svg_color(200, 220, 255));
- image.g(boxplot::Y_MINOR_GRID).style().stroke_width(y_ticks_.minor_grid_width_).stroke_color(svg_color(200, 220, 255));
- }
-
- image.g(boxplot::X_LABEL).style().fill_color(black); // for text only specify fill_color (NOT stroke color).
- image.g(boxplot::Y_LABEL).style().fill_color(black);
- image.g(boxplot::VALUE_LABELS).style().fill_color(black);
- image.g(boxplot::PLOT_TITLE).style().fill_color(black);
-
- image.g(boxplot::WHISKER).style().stroke_color(black);
- image.g(boxplot::BOX_AXIS).style().stroke_color(black);
- image.g(boxplot::BOX).style().stroke_color(black).fill_color(ghostwhite);
- image.g(boxplot::MEDIAN).style().stroke_color(red).stroke_width(2);
- image.g(boxplot::EXTREME_OUTLIERS).style().stroke_color(purple).fill_color(white);
- image.g(boxplot::MILD_OUTLIERS).style().stroke_color(pink).fill_color(black);
- image.g(boxplot::DATA_VALUE_LABELS).style().fill_color(black).stroke_on(false);
+ image_.g(boxplot::Y_MAJOR_TICKS).style().stroke_width(y_ticks_.major_tick_width_).stroke_color(black);
+ image_.g(boxplot::Y_MINOR_TICKS).style().stroke_width(y_ticks_.minor_tick_width_).stroke_color(black);
+ image_.g(boxplot::Y_MAJOR_GRID).style().stroke_width(y_ticks_.major_grid_width_).stroke_color(svg_color(200, 220, 255));
+ image_.g(boxplot::Y_MINOR_GRID).style().stroke_width(y_ticks_.minor_grid_width_).stroke_color(svg_color(200, 220, 255));
+ }
+
+ image_.g(boxplot::X_LABEL).style().fill_color(black); // for text only specify fill_color (NOT stroke color).
+ image_.g(boxplot::Y_LABEL).style().fill_color(black);
+ image_.g(boxplot::VALUE_LABELS).style().fill_color(black);
+ image_.g(boxplot::PLOT_TITLE).style().fill_color(black);
+
+ image_.g(boxplot::WHISKER).style().stroke_color(black);
+ image_.g(boxplot::BOX_AXIS).style().stroke_color(black);
+ image_.g(boxplot::BOX).style().stroke_color(black).fill_color(ghostwhite);
+ image_.g(boxplot::MEDIAN).style().stroke_color(red).stroke_width(2);
+ image_.g(boxplot::EXTREME_OUTLIERS).style().stroke_color(purple).fill_color(white);
+ image_.g(boxplot::MILD_OUTLIERS).style().stroke_color(pink).fill_color(black);
+ image_.g(boxplot::DATA_VALUE_LABELS).style().fill_color(black).stroke_on(false);
} // boxplot constructor.
@@ -902,8 +902,8 @@
// but reduce by the width of any image border.
plot_left_ = 0. + image_border_.width_; // Top left of image.
plot_top_ = 0. + image_border_.width_;
- plot_right_ = image.x_size() - image_border_.width_; // Bottom right of image.
- plot_bottom_ = image.y_size() - image_border_.width_;
+ plot_right_ = image_.x_size() - image_border_.width_; // Bottom right of image.
+ plot_bottom_ = image_.y_size() - image_border_.width_;
if(plot_window_on_)
{ // Needed to allow any plot window border rectangle to show OK.
// A small margin is to prevent it overlapping the image border.
@@ -1158,14 +1158,14 @@
//}
if (plot_window_on_)
{ // Draw plot window rectangle with border and/or background.
- image.g(detail::PLOT_WINDOW_BACKGROUND).push_back(
+ image_.g(detail::PLOT_WINDOW_BACKGROUND).push_back(
new rect_element(plot_left_, plot_top_, (plot_right_ - plot_left_), plot_bottom_ - plot_top_));
}
} // void calculate_plot_window()
void draw_title()
{ //! Update title_info_ with position.
- title_info_.x(image.x_size() / 2.); // Center of image.
+ title_info_.x(image_.x_size() / 2.); // Center of image.
/*! \verbatim
Assumes align = center_align.
Note: center_align will ensure that will center correctly
@@ -1175,7 +1175,7 @@
*/
double y = title_info_.textstyle().font_size() * text_margin_; // Leave a linespace above.
title_info_.y(y); // Vertical position.
- image.g(boxplot::PLOT_TITLE).push_back(new text_element(title_info_));
+ image_.g(boxplot::PLOT_TITLE).push_back(new text_element(title_info_));
} // void draw_title()
void draw_x_axis()
@@ -1184,21 +1184,21 @@
{ // Want a X-axis line.
if (x_axis_position_ == top)
{ // horizontal line at top of plot window.
- image.g(boxplot::X_AXIS).line(plot_left_, plot_top_, plot_right_, plot_top_);
+ image_.g(boxplot::X_AXIS).line(plot_left_, plot_top_, plot_right_, plot_top_);
}
else if (x_axis_position_ == bottom)
{// horizontal line at bottom of plot window.
- image.g(boxplot::X_AXIS).line(plot_left_, plot_bottom_, plot_right_, plot_bottom_);
+ image_.g(boxplot::X_AXIS).line(plot_left_, plot_bottom_, plot_right_, plot_bottom_);
}
else
{ // horizontal line at y = 0
double y(0.);
transform_y(y);
//x_axis_. = y;
- image.g(boxplot::X_AXIS).line(plot_left_, y, plot_right_, y);
+ image_.g(boxplot::X_AXIS).line(plot_left_, y, plot_right_, y);
}
}
- path_element& major_tick_path = image.g(boxplot::X_TICKS).path();
+ path_element& major_tick_path = image_.g(boxplot::X_TICKS).path();
for(size_t i = 0; i < series.size(); ++i)
{ // Draw a ticks for each series, evenly spaced along X axis.
draw_x_major_tick(
@@ -1214,18 +1214,18 @@
{ // Want a vertical Y-axis line, for boxplot only ever left or right.
if (y_axis_position_ == left)
{ // Vertical line at left of plot window.
- image.g(boxplot::Y_AXIS).line(plot_left_, plot_bottom_, plot_left_, plot_top_);
+ image_.g(boxplot::Y_AXIS).line(plot_left_, plot_bottom_, plot_left_, plot_top_);
}
else if (y_axis_position_ == right)
{// Vertical line at right of plot window.
- image.g(boxplot::Y_AXIS).line(plot_right_, plot_bottom_, plot_right_, plot_top_);
+ image_.g(boxplot::Y_AXIS).line(plot_right_, plot_bottom_, plot_right_, plot_top_);
}
}
- path_element& minor_tick_path = image.g(boxplot::Y_MINOR_TICKS).path();
- path_element& major_tick_path = image.g(boxplot::Y_MAJOR_TICKS).path();
- path_element& major_grid_path = image.g(boxplot::Y_MAJOR_GRID).path();
- path_element& minor_grid_path = image.g(boxplot::Y_MINOR_GRID).path();
+ path_element& minor_tick_path = image_.g(boxplot::Y_MINOR_TICKS).path();
+ path_element& major_tick_path = image_.g(boxplot::Y_MAJOR_TICKS).path();
+ path_element& major_grid_path = image_.g(boxplot::Y_MAJOR_GRID).path();
+ path_element& minor_grid_path = image_.g(boxplot::Y_MINOR_GRID).path();
// y_minor_jump is the interval between minor ticks.
double y_minor_jump = y_ticks_.major_interval_ / ((double)(y_ticks_.num_minor_ticks_ + 1.) );
@@ -1275,7 +1275,7 @@
series_info.x(x_left); // Horizontal position.
double y = y_bottom + series_info.textstyle().font_size() * (text_margin_ * 0.7); // Leave a linespace above.
series_info.y(y); // Vertical position.
- image.g(boxplot::VALUE_LABELS).push_back(new text_element(series_info));
+ image_.g(boxplot::VALUE_LABELS).push_back(new text_element(series_info));
}
} // void draw_x_major_tick
@@ -1289,7 +1289,7 @@
return;
}
double x_left(0.); // Left end of tick.
- double x_right(image.y_size()); // Right end of tick.
+ double x_right(image_.y_size()); // Right end of tick.
if(y_ticks_.major_grid_on_ == true)
{ // Draw horizontal major Y grid line.
if(!plot_window_on_ == true)
@@ -1467,7 +1467,7 @@
{ // External to plot window style left or right.
// Always want all values including "0", if labeling external to plot window.
// y_ticks_.ticks_on_window_or_on_axis_ == true != 0
- image.g(boxplot::VALUE_LABELS).text(
+ image_.g(boxplot::VALUE_LABELS).text(
x,
y,
label.str(), y_value_label_style_, alignment, y_ticks_.label_rotation_);
@@ -1476,7 +1476,7 @@
{ // ! y_ticks_.y_ticks_on_plot_window_ == 0 'Internal' - value labels either side of vertical Y-axis.
if ((value != 0) && y_axis_.axis_line_on_)
{ // Avoid a zero ON the Y-axis if it would be cut through by any horizontal X-axis line.
- image.g(boxplot::VALUE_LABELS).text(
+ image_.g(boxplot::VALUE_LABELS).text(
x,
y,
label.str(),
@@ -1491,7 +1491,7 @@
void draw_y_minor_tick(double value, path_element& tick_path, path_element& grid_path)
{ //! Draw a Y-axis minor tick and optional grid.
double x_left(0.); // Start on vertical Y axis line.
- double x_right(image.y_size()); // right edge of image.
+ double x_right(image_.y_size()); // right edge of image.
double y(value); // Tick position and value label,
transform_y(y); // convert to svg.
@@ -1560,7 +1560,7 @@
void draw_x_axis_label()
{ //! Draw an axis label (and optional units) for example "length (km)".
// X-label color is set in constructor thus:
- // image.g(detail::PLOT_X_LABEL).style().stroke_color(black);
+ // image_.g(detail::PLOT_X_LABEL).style().stroke_color(black);
// and changed using x_label_color(color);
std::string label = x_label_info_.text(); // x_axis_ label, and optional units.
@@ -1583,7 +1583,7 @@
}
}
- image.g(boxplot::X_LABEL).push_back(new text_element(
+ image_.g(boxplot::X_LABEL).push_back(new text_element(
( // x position relative to the x-axis which is middle of plot window.
plot_right_ + plot_left_) / 2, // x coordinate - middle.
y, // Down from plot window.
@@ -1596,7 +1596,7 @@
void draw_y_axis_label()
{ //! Draw vertical y_axis label, and optional y units.
// Y-label color is set in constructor thus:
- // image.g(boxplot::Y_LABEL).style().fill_color(black);
+ // image_.g(boxplot::Y_LABEL).style().fill_color(black);
// and changed using y_label_color(color);
std::string label = y_label_info_.text();
@@ -1619,7 +1619,7 @@
}
}
- image.g(boxplot::Y_LABEL).push_back(new
+ image_.g(boxplot::Y_LABEL).push_back(new
text_element(x,
(plot_bottom_ + plot_top_) / 2., // center on the plot window.
label, // "Y-Axis" for example.
@@ -1633,7 +1633,7 @@
double x, double width,
const svg_style& box_styl)
{ //! Draw the box border and any fill.
- g_element& g_ptr = image.g(boxplot::MEDIAN).g();
+ g_element& g_ptr = image_.g(boxplot::MEDIAN).add_g_element();
g_ptr.style().stroke_color(box_styl.stroke_color())
.stroke_width(box_styl.stroke_width())
@@ -1651,7 +1651,7 @@
//! and optionally the median value.
double median_y = median;
transform_y(median_y); // SVG coordinate of median line.
- g_element& g_ptr = image.g(boxplot::MEDIAN).g();
+ g_element& g_ptr = image_.g(boxplot::MEDIAN).add_g_element();
g_ptr.style().stroke_color(median_style.stroke_color())
.stroke_width(median_style.stroke_width());
@@ -1660,7 +1660,7 @@
// void draw_plot_point_value(double x, double y, g_element& g_ptr, value_style& val_style, plot_point_style& point_style, double value)
if (median_values_on_)
{ // Show the value of the median too.
- g_element& g_ptr_median = image.g(boxplot::DATA_VALUE_LABELS).g();
+ g_element& g_ptr_median = image_.g(boxplot::DATA_VALUE_LABELS).add_g_element();
draw_plot_point_value(x_offset + half_width, median_y, g_ptr_median, const_cast<value_style&>(values_style), mild_outlier_, median);
// Share the mild_outlier point style?
g_ptr_median.clip_id(plot_window_clip_);
@@ -1675,21 +1675,21 @@
const svg_style& axis_whisker)
{ //! Draw the whiskers.
// Set up document structure for whiskers:
- g_element& g_whisk_ptr = image.g(boxplot::WHISKER).g();
+ g_element& g_whisk_ptr = image_.g(boxplot::WHISKER).add_g_element();
// Set colors for min and max whiskers.
- g_whisk_ptr.g().style()
+ g_whisk_ptr.add_g_element().style()
.stroke_color(min_whisker.stroke_color())
.fill_color(min_whisker.fill_color())
.stroke_width(min_whisker.stroke_width());
- g_whisk_ptr.g().style()
+ g_whisk_ptr.add_g_element().style()
.stroke_color(max_whisker.stroke_color())
.fill_color(max_whisker.fill_color())
.stroke_width(max_whisker.stroke_width());
// Set axis structure and colors.
- g_element& g_axis_ptr = image.g(boxplot::BOX_AXIS).g();
+ g_element& g_axis_ptr = image_.g(boxplot::BOX_AXIS).add_g_element();
g_axis_ptr.style()
.stroke_color(axis_whisker.stroke_color())
@@ -1715,7 +1715,7 @@
const value_style& values_style)
{ //! Draw any outliers, both mild and extreme.
// Draw marker points for any mild and/or extreme outliers.
- g_element& g_mild_ptr = image.g(boxplot::MILD_OUTLIERS).g();
+ g_element& g_mild_ptr = image_.g(boxplot::MILD_OUTLIERS).add_g_element();
g_mild_ptr.style().fill_color(mild_style.fill_color_)
.stroke_color(mild_style.stroke_color_);
@@ -1735,11 +1735,11 @@
draw_plot_point(x, y, g_mild_ptr, const_cast<plot_point_style&>(mild_style), unc(0), unc(0)); // Kludge!
if (outlier_values_on_)
{ // Show the value of the data point too.
- draw_plot_point_value(x, y, image.g(boxplot::DATA_VALUE_LABELS).g(), const_cast<value_style&>(values_style), mild_outlier_, value);
+ draw_plot_point_value(x, y, image_.g(boxplot::DATA_VALUE_LABELS).add_g_element(), const_cast<value_style&>(values_style), mild_outlier_, value);
}
} // In window OK.
}
- g_element& g_ext_ptr = image.g(boxplot::EXTREME_OUTLIERS).g();
+ g_element& g_ext_ptr = image_.g(boxplot::EXTREME_OUTLIERS).add_g_element();
g_ext_ptr.style().fill_color(extreme_style.fill_color_)
.stroke_color(extreme_style.stroke_color_);
@@ -1753,7 +1753,7 @@
draw_plot_point(x, y, g_ext_ptr, const_cast<plot_point_style&>(extreme_style), 0, 0); // Kludge!
if (extreme_outlier_values_on_) // This isn't a series setting - but might be.
{ // Show the value of the data point too.
- draw_plot_point_value(x, y, image.g(boxplot::DATA_VALUE_LABELS).g(), const_cast<value_style&>(values_style), ext_outlier_, value);
+ draw_plot_point_value(x, y, image_.g(boxplot::DATA_VALUE_LABELS).add_g_element(), const_cast<value_style&>(values_style), ext_outlier_, value);
}
} // in window.
}
@@ -1792,8 +1792,8 @@
clear_all();
// Draw image background & border, if any.
- image.g(boxplot::PLOT_BACKGROUND).push_back(
- new rect_element(0, 0, image.x_size(), image.y_size()) );
+ image_.g(boxplot::PLOT_BACKGROUND).push_back(
+ new rect_element(0, 0, image_.x_size(), image_.y_size()) );
draw_title();
calculate_plot_window();
@@ -1805,7 +1805,7 @@
double margin = plot_window_border_.width_ * 5.; // Or more?
// This controls how much points can overlap the plot window.
// Might also make margin relative to data value font size and/or data marker size?
- image.clip_path(rect_element(plot_left_ - margin, // margin left
+ image_.clip_path(rect_element(plot_left_ - margin, // margin left
plot_top_ - margin, // margin above top
plot_right_ - plot_left_ + margin, // increased lengths for rect (not x, y)
plot_bottom_ - plot_top_ + margin),
@@ -1835,7 +1835,7 @@
//svg& get_svg()
//{
// update_image();
- // return image;
+ // return image_;
//}
// svg_boxplot& load_stylesheet(const std::string& file); // Removed pending reimplementation of stylesheets.
@@ -2043,7 +2043,7 @@
throw std::runtime_error("Unable to open "+ filename);
}
- image.image_filename(filename);
+ image_.image_filename(filename);
// Note filename for optional output as comment in the .svg file.
svg_boxplot::write(fout); // Use the ostream version.
return *this;
@@ -2053,7 +2053,7 @@
{ //! Write SVG image to ostream.
// This ostream version used by filename version.
update_image();
- image.write(s_out);
+ image_.write(s_out);
return *this; //! \return reference to svg_boxplot to make chainable.
}
@@ -2123,52 +2123,52 @@
svg_boxplot& svg_boxplot::y_major_tick_color(const svg_color& col)
{ //! Set Y major ticks color.
- image.g(boxplot::Y_MAJOR_TICKS).style().stroke_color(col);
+ image_.g(boxplot::Y_MAJOR_TICKS).style().stroke_color(col);
return *this; //! \return reference to svg_boxplot to make chainable.
}
svg_boxplot& svg_boxplot::x_tick_color(const svg_color& col)
{ //! \return Y major ticks color.
- image.g(boxplot::X_TICKS).style().stroke_color(col);
+ image_.g(boxplot::X_TICKS).style().stroke_color(col);
return *this; //! \return reference to svg_boxplot to make chainable.
}
svg_boxplot& svg_boxplot::y_minor_tick_color(const svg_color& col)
{ //! Set Y minor ticks color.
- image.g(detail::PLOT_Y_MINOR_TICKS).style().stroke_color(col);
+ image_.g(detail::PLOT_Y_MINOR_TICKS).style().stroke_color(col);
return *this; //! \return reference to svg_boxplot to make chainable.
}
svg_boxplot& svg_boxplot::title_color(const svg_color& col)
{ //! Set boxplot title color.
- image.g(boxplot::PLOT_TITLE).style().stroke_color(col);
+ image_.g(boxplot::PLOT_TITLE).style().stroke_color(col);
return *this; //! \return reference to svg_boxplot to make chainable.
}
svg_boxplot& svg_boxplot::background_color(const svg_color& col)
{ //! Set SVG image background color.
// "imageBackground"
- image.g(boxplot::PLOT_BACKGROUND).style().fill_color(col);
+ image_.g(boxplot::PLOT_BACKGROUND).style().fill_color(col);
return *this;
}
svg_boxplot& svg_boxplot::background_border_color(const svg_color& col)
{ //! Set SVG image background border color.
- image.g(boxplot::PLOT_BACKGROUND).style().stroke_color(col);
+ image_.g(boxplot::PLOT_BACKGROUND).style().stroke_color(col);
return *this; //! \return reference to svg_boxplot to make chainable.
}
svg_boxplot& svg_boxplot::plot_background_color(const svg_color& col)
{ //! Set plot window background color.
// Plot Window "plotBackground"
- image.g(boxplot::PLOT_WINDOW_BACKGROUND).style().fill_color(col);
+ image_.g(boxplot::PLOT_WINDOW_BACKGROUND).style().fill_color(col);
return *this; //! \return reference to svg_boxplot to make chainable.
}
svg_boxplot& svg_boxplot::plot_border_color(const svg_color& col)
{ //! Set plot window border color.
// Plot window "plotBackground"
- image.g(boxplot::PLOT_WINDOW_BACKGROUND).style().stroke_color(col);
+ image_.g(boxplot::PLOT_WINDOW_BACKGROUND).style().stroke_color(col);
return *this; //! \return reference to svg_boxplot to make chainable.
}
@@ -2213,7 +2213,7 @@
svg_boxplot& svg_boxplot::size(unsigned int x, unsigned int y)
{ //! Set SVG image width (x) and height (y).
- image.size(x, y);
+ image_.size(x, y);
return *this; //! \return reference to svg_boxplot to make chainable.
}
@@ -2225,7 +2225,7 @@
svg_boxplot& svg_boxplot::y_label_color(const svg_color& col)
{ //! Set font color for Y axis label.
- image.g(boxplot::Y_LABEL).style().fill_color(col);
+ image_.g(boxplot::Y_LABEL).style().fill_color(col);
return *this; //! \return reference to svg_boxplot to make chainable.
}
@@ -2287,7 +2287,7 @@
svg_boxplot& svg_boxplot::x_label_color(const svg_color& col)
{ //! Set the font color for the X axis label.
- image.g(boxplot::X_LABEL).style().fill_color(col);
+ image_.g(boxplot::X_LABEL).style().fill_color(col);
return *this; //! \return reference to svg_boxplot to make chainable.
}
@@ -2326,30 +2326,30 @@
svg_boxplot& svg_boxplot::x_tick_width(unsigned int width)
{ //! Set the width of major ticks on the X axis.
- image.g(boxplot::X_TICKS).style().stroke_width(width);
+ image_.g(boxplot::X_TICKS).style().stroke_width(width);
return *this; //! \return reference to svg_boxplot to make chainable.
}
svg_boxplot& svg_boxplot::y_major_tick_width(unsigned int width)
{ //! Set the width of major ticks on the Y axis.
- image.g(boxplot::Y_MAJOR_TICKS).style().stroke_width(width);
+ image_.g(boxplot::Y_MAJOR_TICKS).style().stroke_width(width);
return *this; //! \return reference to svg_boxplot to make chainable.
}
svg_boxplot& svg_boxplot::y_minor_tick_width(unsigned int width)
{ //! Set the width of minor ticks on the Y axis.
- image.g(boxplot::Y_MINOR_TICKS).style().stroke_width(width);
+ image_.g(boxplot::Y_MINOR_TICKS).style().stroke_width(width);
return *this; //! \return reference to svg_boxplot to make chainable.
}
unsigned int svg_boxplot::image_x_size()
{ //! \return width of the SVG image.
- return image.x_size();
+ return image_.x_size();
}
unsigned int svg_boxplot::image_y_size()
{ //! \return height of the SVG image.
- return image.x_size();
+ return image_.x_size();
}
std::string svg_boxplot::title()
@@ -2369,37 +2369,37 @@
svg_color svg_boxplot::title_color()
{ //! \return color of the title.
- return image.g(boxplot::PLOT_TITLE).style().fill_color();
+ return image_.g(boxplot::PLOT_TITLE).style().fill_color();
}
svg_color svg_boxplot::background_color()
{ //! \return Color of the background for the SVG image.
- return image.g(boxplot::PLOT_BACKGROUND).style().fill_color();
+ return image_.g(boxplot::PLOT_BACKGROUND).style().fill_color();
}
svg_color svg_boxplot::background_border_color()
{ //! \return Color of the border of the background for the SVG image.
- return image.g(boxplot::PLOT_BACKGROUND).style().stroke_color();
+ return image_.g(boxplot::PLOT_BACKGROUND).style().stroke_color();
}
svg_color svg_boxplot::plot_background_color()
{ //! \return Color of the background for the plot.
- return image.g(boxplot::PLOT_WINDOW_BACKGROUND).style().fill_color();
+ return image_.g(boxplot::PLOT_WINDOW_BACKGROUND).style().fill_color();
}
svg_color svg_boxplot::plot_border_color()
{ //! \return Color of the border of the background for the plot.
- return image.g(boxplot::PLOT_WINDOW_BACKGROUND).style().stroke_color();
+ return image_.g(boxplot::PLOT_WINDOW_BACKGROUND).style().stroke_color();
}
svg_color svg_boxplot::x_label_color()
{ //! \return Color of the X axis label.
- return image.g(boxplot::X_LABEL).style().fill_color();
+ return image_.g(boxplot::X_LABEL).style().fill_color();
}
svg_color svg_boxplot::x_tick_color()
{ //! \return Color of ticks on the X axis.
- return image.g(boxplot::X_TICKS).style().stroke_color();
+ return image_.g(boxplot::X_TICKS).style().stroke_color();
}
double svg_boxplot::x_tick_length()
@@ -2409,7 +2409,7 @@
double svg_boxplot::x_major_tick_width()
{ //! \return Width of major ticks on the X axis.
- return image.g(boxplot::X_TICKS).style().stroke_width();
+ return image_.g(boxplot::X_TICKS).style().stroke_width();
}
std::string svg_boxplot::x_label_text()
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-04 07:22:46 EDT (Tue, 04 Aug 2009)
@@ -42,7 +42,7 @@
// Forward declarations of classes in svg_style.hpp
class svg_style; // Holds the basic stroke, fill colors and width, and their switches.
-class text_style; // Text font family, size ...
+class text_style; // Text and tspan element's font family, size ...
class value_style; // Data series point value information, text, color, uncertainty & df, orientation.
class plot_point_style; // Shape, color, (optional value & uncertainty) of data point markers.
class plot_line_style; // Style of line joining data series values.
@@ -327,6 +327,8 @@
text_style& font_weight(const std::string& s);
text_style& font_stretch(const std::string& s);
text_style& font_decoration(const std::string& s);
+ // text_style& font_variant(const std::string& s); // Not implemented,
+
int font_size() const;
const std::string& font_family() const;
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