|
Boost-Commit : |
From: pbristow_at_[hidden]
Date: 2008-03-04 07:18:19
Author: pbristow
Date: 2008-03-04 07:18:18 EST (Tue, 04 Mar 2008)
New Revision: 43489
URL: http://svn.boost.org/trac/boost/changeset/43489
Log:
Some changes to plot to enable area fill setting, but still not work as wanted, or expected for area_fill.
Text files modified:
sandbox/SOC/2007/visualization/boost/svg_plot/svg_2d_plot.hpp | 57 ++++++++++++++++++++++++++++++++-------
sandbox/SOC/2007/visualization/boost/svg_plot/svg_style.hpp | 9 ++---
sandbox/SOC/2007/visualization/libs/svg_plot/example/2d_area_fill.cpp | 13 +++++++--
3 files changed, 60 insertions(+), 19 deletions(-)
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 2008-03-04 07:18:18 EST (Tue, 04 Mar 2008)
@@ -77,7 +77,6 @@
// plot_line_style(const svg_color& col = black, const svg_color& acol = true, double width = 2, bool line_on = true, bool bezier_on = false)
line_style_(black, true, 2, true, false) // Default line style, no fill.
- // TODO doesn't pick up line width.
{ // Constructor.
for(T i = begin; i != end; ++i)
{ // Sort into normal and limited series.
@@ -94,7 +93,7 @@
// Set functions for the plot series.
svg_2d_plot_series& fill_color(const svg_color& col_)
- {
+ { // Point fill color.
point_style_.fill_color_ = col_;
return *this;
}
@@ -123,18 +122,18 @@
return *this;
}
+ svg_2d_plot_series& area_fill(const svg_color& col_)
+ {
+ line_style_.area_fill_ = col_;
+ return *this;
+ }
+
svg_2d_plot_series& line_width(double wid_)
{
line_style_.width_ = wid_; // Sets legend line width too.
return *this;
}
- // Get functions for the plot series.
- double line_width()
- {
- return line_style_.width_;
- }
-
svg_2d_plot_series& line_on(bool on_)
{
line_style_.line_on_ = on_;
@@ -147,11 +146,47 @@
return *this;
}
+ // Get functions for the plot series.
+ plot_line_style line_style()
+ {
+ return line_style_;
+ }
+
+ double line_width()
+ {
+ return line_style_.width_;
+ }
+
bool bezier_on()
{
return line_style_.bezier_on_;
}
+ bool line_on()
+ {
+ return line_style_.line_on_;
+ }
+
+ svg_color& line_color()
+ {
+ return line_style_.color_;
+ }
+
+ svg_color& area_fill()
+ {
+ return line_style_.area_fill_;
+ }
+
+ int size()
+ {
+ return point_style_.size_;
+ }
+
+ point_shape shape()
+ {
+ return point_style_.shape_;
+ }
+
}; // struct svg_2d_plot_series
class svg_2d_plot : public detail::axis_plot_frame<svg_2d_plot>
@@ -1138,7 +1173,7 @@
if(is_fill)
{ // fill wanted.
transform_y(temp_y = 0.); // X-axis line.
- path.L(temp_x, temp_y).z(); // closepath with Z to terminate line.
+ path.L(temp_x, temp_y).z(); // Close path with Z to terminate line.
}
}
} // draw_straight_lines
@@ -1295,7 +1330,7 @@
y = j->second;
transform_point(x, y);
if((x > plot_left_) && (x < plot_right_) && (y > plot_top_) && (y < plot_bottom_))
- { // Onside plot window, so draw a point.
+ { // Is inside plot window, so draw a point.
draw_plot_point(x, y, g_ptr, series[i].point_style_);
}
} // for
@@ -1313,7 +1348,7 @@
y = j->second;
transform_point(x, y);
if((x > plot_left_) && (x < plot_right_) && (y > plot_top_) && (y < plot_bottom_))
- { // On plot window, so draw a point.
+ { // Is inside plot window, so draw a point.
// draw_plot_point(x, y, g_ptr, plot_point_style(blank, blank, s, cone)); default.
draw_plot_point(x, y, g_ptr, series[i].limit_point_style_);
}
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 2008-03-04 07:18:18 EST (Tue, 04 Mar 2008)
@@ -543,7 +543,7 @@
plot_line_style& width(double w)
{
width_ = w;
- return *this;
+ return *this; // Make chainable.
}
double width()
@@ -554,7 +554,7 @@
plot_line_style& color(const svg_color& f)
{
color_ = f;
- return *this;
+ return *this; // Make chainable.
}
svg_color& color()
@@ -565,7 +565,7 @@
plot_line_style& area_fill(const svg_color& f)
{
area_fill_ = f;
- return *this;
+ return *this; // Make chainable.
}
svg_color& area_fill()
@@ -601,8 +601,7 @@
{ //
os << "point_line_style("
<< p.color_ << ", "
- << p.area_fill_ << ", "
- //<< ((p.area_fill) ? "area fill, " : ", ")
+ << p.area_fill_ << " area fill, "
<< ((p.line_on_) ? "line, " : "no line, ")
<< ((p.bezier_on_) ? "bezier)" : "no bezier)");
// Usage: plot_line_style p; cout << p << endl;
Modified: sandbox/SOC/2007/visualization/libs/svg_plot/example/2d_area_fill.cpp
==============================================================================
--- sandbox/SOC/2007/visualization/libs/svg_plot/example/2d_area_fill.cpp (original)
+++ sandbox/SOC/2007/visualization/libs/svg_plot/example/2d_area_fill.cpp 2008-03-04 07:18:18 EST (Tue, 04 Mar 2008)
@@ -4,6 +4,14 @@
// For more information, see http://www.boost.org
// -----------------------------------------------------------------
+#ifdef _MSC_VER
+# pragma warning (disable : 4180) // qualifier applied to function type has no meaning; ignored
+# pragma warning (disable : 4503) // decorated name length exceeded, name was truncated
+# pragma warning (disable : 4512) // assignment operator could not be generated
+# pragma warning (disable : 4224) // nonstandard extension used : formal parameter 'function_ptr' was previously defined as a type
+# pragma warning (disable : 4127) // conditional expression is constant
+#endif
+
#include <boost/svg_plot/svg_2d_plot.hpp>
#include <map>
#include <cmath>
@@ -61,7 +69,7 @@
.x_major_tick_width(1)
.x_minor_tick_length(7)
.x_minor_tick_width(1)
- .x_num_minor__ticks(3)
+ .x_num_minor_ticks(3)
//Y axis settings.
.y_major_interval(25)
@@ -70,8 +78,7 @@
//legend settings
my_plot.legend_title_font_size(15);
- my_plot.plot(data1, "Sqrt(x)", point_style = none,
- area_fill_color = red);
+ my_plot.plot(data1, "Sqrt(x)").area_fill(red);
my_plot.write("./2d_area_fill.svg");
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