|
Boost-Commit : |
From: JakeVoytko_at_[hidden]
Date: 2007-07-28 20:52:01
Author: jakevoytko
Date: 2007-07-28 20:52:01 EDT (Sat, 28 Jul 2007)
New Revision: 7577
URL: http://svn.boost.org/trac/boost/changeset/7577
Log:
Bug fixes to headers
Text files modified:
sandbox/SOC/2007/visualization/boost/svg_plot/detail/axis_plot_frame.hpp | 124 ++++++++++------------------------------
sandbox/SOC/2007/visualization/boost/svg_plot/svg_1d_plot.hpp | 10 ++
sandbox/SOC/2007/visualization/boost/svg_plot/svg_2d_plot.hpp | 96 +++++++++++++-----------------
3 files changed, 83 insertions(+), 147 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 2007-07-28 20:52:01 EDT (Sat, 28 Jul 2007)
@@ -12,6 +12,7 @@
#include <string>
#include "../svg_style.hpp"
+#include "../svg.hpp"
#include "svg_tag.hpp"
namespace boost{
@@ -66,10 +67,14 @@
}
}
- if(x1 < derived().plot_x2 && x1 > derived().plot_x1)
+ else
{
- grid_path.M(x1, y1).L(x1, y2);
+ y1 = derived().plot_y1 + 1;
+ y2 = derived().plot_y2 - 1;
}
+
+ grid_path.M(x1, y1).L(x1, y2);
+
}
double x_tick_length = derived().x_minor_length / 2.;
@@ -117,10 +122,13 @@
}
}
- if(x1 < derived().plot_x2 && x1 > derived().plot_x1)
+ else
{
- grid_path.M(x1, y1).L(x1, y2);
+ y1 = derived().plot_y1;
+ y2 = derived().plot_y2;
}
+ grid_path.M(x1, y1).L(x1, y2);
+
}
//draw major tick
@@ -437,13 +445,13 @@
Derived& title_font_size(unsigned int _size)
{
- derived().title_info.font_size() = _size;
+ derived().title_info.font_size(_size);
return derived();
}
Derived& legend_title_font_size(unsigned int _size)
{
- derived().legend_title_font_size = _size;
+ derived().legend_title_size = _size;
return derived();
}
@@ -473,6 +481,12 @@
return derived();
}
+ Derived& x_external_style_on(bool _cmd)
+ {
+ derived().use_x_external_style = _cmd;
+ return derived();
+ }
+
Derived& x_label_on(bool _cmd)
{
derived().use_x_label = _cmd;
@@ -481,7 +495,7 @@
Derived& x_major_labels_on(bool _cmd)
{
- derived().x_major_labels_on = _cmd;
+ derived().use_x_major_labels = _cmd;
return derived();
}
@@ -533,12 +547,6 @@
// x_minor_tick_color()
// -----------------------------------------------------------------
- Derived& title_color(svg_color_constant _col)
- {
- title_color(constant_to_rgb(_col));
- return derived();
- }
-
Derived& title_color(const svg_color& _col)
{
derived().image.get_g_element(PLOT_TITLE).style().stroke_color(_col);
@@ -546,35 +554,18 @@
return derived();
}
- Derived& background_color(svg_color_constant _col)
- {
- background_color(constant_to_rgb(_col));
- return derived();
- }
-
Derived& background_color(const svg_color& _col)
{
derived().image.get_g_element(PLOT_BACKGROUND).style().fill_color(_col);
return derived();
}
- Derived& legend_background_color(svg_color_constant _col)
- {
- legend_background_color(constant_to_rgb(_col));
- return derived();
- }
-
Derived& legend_background_color(const svg_color& _col)
{
derived().image.get_g_element(PLOT_LEGEND_BACKGROUND).style().fill_color(_col);
return derived();
}
- Derived& legend_border_color(svg_color_constant _col)
- {
- legend_border_color(constant_to_rgb(_col));
- return derived();
- }
Derived& legend_border_color(const svg_color& _col)
{
@@ -582,36 +573,18 @@
return derived();
}
- Derived& background_border_color(svg_color_constant _col)
- {
- derived().image.get_g_element(PLOT_BACKGROUND).style().stroke_color(_col);
- return derived();
- }
-
Derived& background_border_color(const svg_color& _col)
{
derived().image.get_g_element(PLOT_BACKGROUND).style().stroke_color(_col);
return derived();
}
- Derived& plot_background_color(svg_color_constant _col)
- {
- derived().image.get_g_element(PLOT_PLOT_BACKGROUND).style().fill_color(_col);
- return derived();
- }
-
Derived& plot_background_color(const svg_color& _col)
{
derived().image.get_g_element(PLOT_PLOT_BACKGROUND).style().fill_color(_col);
return derived();
}
- Derived& x_axis_color(svg_color_constant _col)
- {
- x_axis_color(constant_to_rgb(_col));
- return derived();
- }
-
Derived& x_axis_color(const svg_color& _col)
{
derived().image.get_g_element(PLOT_X_AXIS).style()
@@ -626,65 +599,30 @@
Derived& x_major_tick_color(const svg_color& _col)
{
derived().image.get_g_element(PLOT_X_MAJOR_TICKS).style().stroke_color(_col);
- derived().image.get_g_element(PLOT_X_MAJOR_TICKS).style().fill_color(_col);
- return derived();
- }
-
- Derived& x_major_tick_color(svg_color_constant _col)
- {
- x_major_tick_color(constant_to_rgb(_col));
return derived();
}
Derived& x_label_color(const svg_color& _col)
{
derived().image.get_g_element(PLOT_X_LABEL).style().stroke_color(_col);
- derived().image.get_g_element(PLOT_X_LABEL).style().fill_color(_col);
- return derived();
- }
-
- Derived& x_label_color(svg_color_constant _col)
- {
- x_label_color(constant_to_rgb(_col));
return derived();
}
Derived& x_minor_tick_color(const svg_color& _col)
{
derived().image.get_g_element(PLOT_X_MINOR_TICKS).style().stroke_color(_col);
- derived().image.get_g_element(PLOT_X_MINOR_TICKS).style().fill_color(_col);
- return derived();
- }
-
- Derived& x_minor_tick_color(svg_color_constant _col)
- {
- x_minor_tick_color(constant_to_rgb(_col));
return derived();
}
Derived& x_major_grid_color(const svg_color& _col)
{
derived().image.get_g_element(PLOT_X_MAJOR_GRID).style().stroke_color(_col);
- derived().image.get_g_element(PLOT_X_MAJOR_GRID).style().fill_color(_col);
- return derived();
- }
-
- Derived& x_major_grid_color(svg_color_constant _col)
- {
- x_major_grid_color(constant_to_rgb(_col));
return derived();
}
Derived& x_minor_grid_color(const svg_color& _col)
{
derived().image.get_g_element(PLOT_X_MINOR_GRID).style().stroke_color(_col);
- derived().image.get_g_element(PLOT_X_MINOR_GRID).style().fill_color(_col);
- return derived();
- }
-
- Derived& x_minor_grid_color(svg_color_constant _col)
- {
- x_minor_grid_color(constant_to_rgb(_col));
return derived();
}
@@ -716,13 +654,13 @@
Derived& x_major_tick(double _inter)
{
- derived().x_major_tick = _inter;
+ derived().x_major = _inter;
return derived();
}
Derived& x_major_tick_length(unsigned int _length)
{
- derived().x_major_tick_length = _length;
+ derived().x_major_length = _length;
return derived();
}
@@ -734,7 +672,7 @@
Derived& x_minor_tick_length(unsigned int _length)
{
- derived().x_minor_tick_length = _length;
+ derived().x_minor_length = _length;
return derived();
}
@@ -746,11 +684,11 @@
Derived& x_num_minor_ticks(unsigned int _num)
{
- derived().x_num_minor_ticks = _num;
+ derived().x_num_minor = _num;
return derived();
}
- Derived& x_scale(double x1, double x2)
+ Derived& x_range(double x1, double x2)
{
if(x2 <= x1)
{
@@ -800,7 +738,7 @@
bool get_x_major_labels()
{
- return derived().x_major_labels_on;
+ return derived().use_x_major_labels;
}
// color information
@@ -882,22 +820,22 @@
double get_x_major_tick()
{
- return derived().x_major_tick;
+ return derived().x_major;
}
unsigned int get_x_major_tick_length()
{
- return derived().x_major_tick_length;
+ return derived().x_major_length;
}
unsigned int get_x_minor_tick_length()
{
- return derived().x_minor_tick_length;
+ return derived().x_minor_length;
}
unsigned int get_x_num_minor_ticks()
{
- return derived().x_num_minor_ticks;
+ return derived().x_num_minor;
}
unsigned int get_x_major_tick_width()
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 2007-07-28 20:52:01 EDT (Sat, 28 Jul 2007)
@@ -234,6 +234,14 @@
plot_y2 -= 20;
}
+ if(use_x_external_style)
+ {
+ plot_y2 -=
+ x_major_length > x_minor_length ?
+ x_major_length :
+ x_minor_length ;
+ }
+
//for the title. Will take into account font size soon
plot_y1 +=40;
@@ -409,7 +417,7 @@
boost::make_transform_iterator(container.begin(), x_functor),
boost::make_transform_iterator(container.end(), x_functor),
title,
- plot_point_style(fill_color, stroke_color, size, point_style)
+ plot_point_style(stroke_color, fill_color, size, point_style)
));
}
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 2007-07-28 20:52:01 EDT (Sat, 28 Jul 2007)
@@ -174,21 +174,18 @@
{
_transform_y(y1 = j);
- if(!use_plot_window)
+ if(!use_plot_window && use_y_label)
{
- // spacing for labels
- if(use_legend)
- {
- x1 -= 155;
- }
-
- if(use_y_label)
- {
- x2 -= 12 * 1.5;
- }
+ x2 -= 12 * 1.5;
+ }
+
+ else
+ {
+ x1 = plot_x1 + 1;
+ x2 = plot_x2 - 1;
}
- if(y1 < plot_y2 && y1 > plot_y1)
+ if(y1 > plot_y1)
{
grid_path.M(x1, y1).L(x2, y1);
}
@@ -226,23 +223,18 @@
{
_transform_y(y1 = i);
- if(!use_plot_window)
+ if(!use_plot_window && use_y_label)
{
- if(use_title)
- {
- x1 += title_info.font_size() * 1.5;
- }
-
- if(use_y_label)
- {
- x2 -= 12 * 1.5;
- }
+ x1 += 12 * 1.5;
}
- if(y1 < plot_y2 && y1 > plot_y1)
+ else
{
- grid_path.M(x1, y1).L(x2, y1);
+ x1 = plot_x1 + 1;
+ x2 = plot_x2 - 1;
}
+
+ grid_path.M(x1, y1).L(x2, y1);
}
//draw major tick
@@ -324,8 +316,8 @@
// draw the ticks on the positive side
for(double i = 0; i < y_max; i += y_major)
{
- for(double j = i + y_minor_jump;
- j < i + y_major;
+ for(double j = i + y_minor_jump;
+ j < i + y_major;
j += y_minor_jump)
{
_draw_y_minor_ticks(j, minor_tick_path, minor_grid_path);
@@ -672,14 +664,6 @@
return *this;
}
-
-svg_2d_plot& y_axis_color(svg_color_constant _col)
-{
- y_axis_color(constant_to_rgb(_col));
-
- return (svg_2d_plot&)*this;
-}
-
svg_2d_plot& y_axis_color(const svg_color& _col)
{
image.get_g_element(detail::PLOT_Y_AXIS)
@@ -691,29 +675,27 @@
return *this;
}
-svg_2d_plot& y_major_tick_color(const svg_color& _col)
+svg_2d_plot& y_major_grid_color(const svg_color& _col)
{
- image.get_g_element(detail::PLOT_Y_MAJOR_TICKS).style().stroke_color(_col);
- image.get_g_element(detail::PLOT_Y_MAJOR_TICKS).style().fill_color(_col);
+ image.get_g_element(detail::PLOT_Y_MAJOR_GRID).style().stroke_color(_col);
return *this;
}
-svg_2d_plot& y_major_tick_color(svg_color_constant _col)
+svg_2d_plot& y_minor_grid_color(const svg_color& _col)
{
- y_major_tick_color(constant_to_rgb(_col));
+ image.get_g_element(detail::PLOT_Y_MINOR_GRID).style().stroke_color(_col);
return *this;
}
-svg_2d_plot& y_minor_tick_color(const svg_color& _col)
+svg_2d_plot& y_major_tick_color(const svg_color& _col)
{
- image.get_g_element(detail::PLOT_Y_MINOR_TICKS).style().stroke_color(_col);
- image.get_g_element(detail::PLOT_Y_MINOR_TICKS).style().fill_color(_col);
+ image.get_g_element(detail::PLOT_Y_MAJOR_TICKS).style().stroke_color(_col);
return *this;
}
-svg_2d_plot& y_minor_tick_color(svg_color_constant _col)
+svg_2d_plot& y_minor_tick_color(const svg_color& _col)
{
- y_minor_tick_color(constant_to_rgb(_col));
+ image.get_g_element(detail::PLOT_Y_MINOR_TICKS).style().stroke_color(_col);
return *this;
}
@@ -802,6 +784,18 @@
return *this;
}
+svg_2d_plot& y_major_grid_on(bool _is)
+{
+ use_y_major_grid = _is;
+ return *this;
+}
+
+svg_2d_plot& y_minor_grid_on(bool _is)
+{
+ use_y_minor_grid = _is;
+ return *this;
+}
+
#if defined (BOOST_MSVC)
# pragma warning(push)
# pragma warning(disable: 4100) // "'boost_parameter_enabler_argument' : unreferenced formal parameter"
@@ -810,25 +804,21 @@
BOOST_PARAMETER_MEMBER_FUNCTION
(
(void),
- plot_2d,
+ plot,
tag,
(required
(container, *)
(title, (const std::string&))
)
(optional
+ (fill_color, (const svg_color&), white)
(stroke_color, (const svg_color&), black)
+ (line_color, (const svg_color&), black)
+ (area_fill_color, (svg_color_constant), blank)
(point_style, (point_shape), circle)
(size, (int), 10)
(line_on, (bool), true)
- (line_color, (const svg_color&), black)
- (area_fill_color, (svg_color_constant), blank)
- )
- (deduced
- (optional
- (fill_color, (const svg_color&), white)
- (x_functor, *, boost_default_2d_convert())
- )
+ (x_functor, *, boost_default_2d_convert())
)
)
{
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