|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r80844 - in sandbox/SOC/2007/visualization/boost/svg_plot: . detail impl
From: pbristow_at_[hidden]
Date: 2012-10-04 12:22:31
Author: pbristow
Date: 2012-10-04 12:22:30 EDT (Thu, 04 Oct 2012)
New Revision: 80844
URL: http://svn.boost.org/trac/boost/changeset/80844
Log:
Working on Netbeans gcc 4.3.3 on Cygwin.
Text files modified:
sandbox/SOC/2007/visualization/boost/svg_plot/detail/auto_axes.hpp | 262 ++++++++++++++++++++++++++++++---------
sandbox/SOC/2007/visualization/boost/svg_plot/detail/axis_plot_frame.hpp | 1
sandbox/SOC/2007/visualization/boost/svg_plot/detail/functors.hpp | 2
sandbox/SOC/2007/visualization/boost/svg_plot/impl/svg_1d_plot.ipp | 68 +++++-----
sandbox/SOC/2007/visualization/boost/svg_plot/svg_1d_plot.hpp | 13 +
sandbox/SOC/2007/visualization/boost/svg_plot/svg_2d_plot.hpp | 57 +++++---
6 files changed, 279 insertions(+), 124 deletions(-)
Modified: sandbox/SOC/2007/visualization/boost/svg_plot/detail/auto_axes.hpp
==============================================================================
--- sandbox/SOC/2007/visualization/boost/svg_plot/detail/auto_axes.hpp (original)
+++ sandbox/SOC/2007/visualization/boost/svg_plot/detail/auto_axes.hpp 2012-10-04 12:22:30 EDT (Thu, 04 Oct 2012)
@@ -10,9 +10,9 @@
Also allow optional forcing of the ticks to be multiples of 1, 2, 5, 10.
\date Aug 09
\author Paul A. Bristow
- */
+*/
-// Copyright Paul A. Bristow 2006 - 2009.
+// Copyright Paul A. Bristow 2006 - 2012.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0.
@@ -74,10 +74,10 @@
// Declarations:
// Show and show_all to display size and contents of STL containers.
-// range and range_all to find the min and max of STL containers.
+// range_mx and range_all to find the min and max of STL containers.
// _all versions deal with a container of containers.
-//! Roundup and Rounddown to 2, 4, 6, 8, 10, or 5, 10 or 2, 5, 10 systems:
+//! round up and round down to 2, 4, 6, 8, 10, or 5, 10 or 2, 5, 10 systems:
//! Round value up to nearest multiple of 10.
double roundup10(double value);
//! Round value down to nearest multiple of 10.
@@ -100,15 +100,120 @@
double* axis_tick_increment, //!< Computed tick increment for the axis, updated by scale_axis.
int* auto_ticks, //!< Computed number of ticks, updated by scale_axis.
// NO check_limits parameter.
- bool origin, //!< Do not include the origin unless the range min_value <= 0 <= max_value.
- double tight, //!< Tightness - fraction of 'overrun' allowed before another tick used.
+ bool origin = false, //!< Do not include the origin unless the range min_value <= 0 <= max_value.
+ double tight = 0., //!< Tightness - fraction of 'overrun' allowed before another tick used.
//!< for visual effect up to about 0.001 might suit a 1000 pixel wide image,
//!< allowing values just 1 pixel over the tick to be shown.
- int min_ticks, //!< Minimum number of major ticks.
- int steps //!< Round up and down to 2, 4, 6, 8, 10, or 5, 10 or 2, 5, 10 systems.
+ int min_ticks = 6, //!< Minimum number of major ticks.
+ int steps = 0 //!< Round up and down to 2, 4, 6, 8, 10, or 5, 10 or 2, 5, 10 systems.
+);
+
+//! Scale axis function to define axis marker ticks based on min & max parameters values.
+void scale_axis(
+ double min_value, //!< Updated with Minimum value found.
+ double max_value, //!< Updated with Maximum value found.
+ double* axis_min_value, //!< Minimum value for the axis, updated by scale_axis.
+ double* axis_max_value, //!< Maximum value for the axis, updated by scale_axis.
+ double* axis_tick_increment, //!< Tick increment for the axis, updated by scale_axis.
+ int* auto_ticks, //!< Updated with number of ticks.
+ bool check_limits = true, //!< Whether to check all values for infinity, NaN etc.
+ double autoscale_plusminus = 2., //!< Multiplier of uncertainty or standard deviations to allow for confidence ellipses.
+ bool origin = false, //!< If true, ensures that zero is a tick value.
+ double tight = 0., //!< Allows user to avoid a small fraction over a tick using another tick.
+ int min_ticks = 6, //!< Minimum number of ticks.
+ int steps = 0 //!< Round up and down to 2, 4, 6, 8, 10, or 5, 10, or 2, 5, 10 major ticks multiples.
+);
+
+//! Scale axis using iterator into an STL container.
+// \tparam iter iterator into an STL container: array, vector, set ...
+template <typename Iter>
+void scale_axis(
+ Iter begin, //!< iterators into begin in STL container.
+ Iter end, //!< iterators into end in STL container.
+ // (not necessarily ordered by size, so will find min and max).
+ double* axis_min_value, //!< Computed minimum value for the axis, updated by scale_axis.
+ double* axis_max_value, //!< Computed maximum value for the axis, updated by scale_axis.
+ double* axis_tick_increment, //!< Computed tick increment for the axis, updated by scale_axis.
+ int* auto_ticks, //!< Computed number of ticks, updated by scale_axis.
+ bool check_limits, //!< Whether to check all values for infinity, NaN etc.
+ double autoscale_plusminus, //!< Mutiplier of uncertainty or standard deviations to allow fo confidence ellipses.
+ bool origin = false, //!< Do not include the origin unless the range min_value <= 0 <= max_value.
+ double tight = 0., //!< tightest - fraction of 'overrun' allowed before another tick used.
+ // for visual effect up to about 0.001 might suit a 1000 pixel wide image,
+ // allowing values just 1 pixel over the tick to be shown.
+ int min_ticks = 6, //!< Minimum number of major ticks.
+ int steps = 0 //!< 0, or 2 for 2, 4, 6, 8, 10, 5 for 1, 5, 10, or 10 (2, 5, 10).
+);
+
+//! Scale axis using all the 1D data in an STL container.
+//! Scale axis using an \b entire Container Data series, usually to plot.
+//! (not necessarily ordered, so will find min and max).
+ //! \tparam T an STL container: array, vector ...
+ template <typename C>
+ void scale_axis(
+ const C& container, //!< STL container, usually of a data series.
+ double* axis_min_value, //!< Computed minimum value for the axis, updated by scale_axis.
+ double* axis_max_value, //!< Computed maximum value for the axis, updated by scale_axis.
+ double* axis_tick_increment, //!< Computed tick increment for the axis, updated by scale_axis.
+ int* auto_ticks, //!< Computed number of ticks, updated by scale_axis.
+ bool check_limits, //!< Whether to check all values for infinity, NaN etc.
+ double autoscale_plusminus = 3., //!< Multiplier of uncertainty or standard deviations to allow for confidence ellipses.
+ bool origin = false, //!< do not include the origin unless the range min_value <= 0 <= max_value.
+ double tight = 0., //!< tightest - fraction of 'overrun' allowed before another tick used.
+ //! for visual effect up to about 0.001 might suit a 1000 pixel wide image,
+ //! allowing values just 1 pixel over the tick to be shown.
+ int min_ticks = 6, //!< Minimum number of major ticks.
+ int steps = 0 //!< 0, or 2 for 2, 4, 6, 8, 10, 5 for 1, 5, 10, or 10 (2, 5, 10).
+);
+
+/*! Scale X and Y axis using T a 2D STL container: array of pairs, vector of pairs, list of pairs, map ...
+ \param container Data series to plot - entire 2D container.
+ \tparam T STL container of 2D pairs of X and Y.
+*/
+template <typename C>
+void scale_axis(
+ const C& container, //!< Data series to plot - \b entire 2D container (not necessarily ordered, so will find min and max).
+ double* x_axis_min_value, //!< Computed minimum value for the X-axis, updated by scale_axis.
+ double* x_axis_max_value, //!< Computed minimum value for the X-axis, updated by scale_axis.
+ double* x_axis_tick_increment, //!< Updated with X axis tick increment.
+ int* x_auto_ticks, //!< Computed number of X axis ticks, updated by scale_axis.
+ double* y_axis_min_value, //!< Computed minimum value for the Y-axis, updated by scale_axis.
+ double* y_axis_max_value, //!< Computed maximum value for the Y-axis, updated by scale_axis.
+ double* y_axis_tick_increment, //!< Updated with Y axis tick increment.
+ int* y_auto_ticks, //!< Computed number of Y-axis ticks, updated by scale_axis.
+ bool check_limits = true, //!< Whether to check all values for infinity, NaN etc.
+ double autoscale_plusminus = 3., //!< Mutiplier of uncertainty or standard deviations to allow fo confidence ellipses.
+ bool x_origin = false, //!< do not include the origin unless the range min_value <= 0 <= max_value.
+ double x_tight = 0., //!< tightest - fraction of 'overrun' allowed before another tick used.
+ //! for visual effect up to about 0.001 might suit a 1000 pixel wide image,
+ //! allowing values just 1 pixel over the tick to be shown.
+ int x_min_ticks = 6, //!< Minimum number of major ticks.
+ int x_steps = 0, //!< 0, or 2 for 2, 4, 6, 8, 10, 5 for 1, 5, 10, or 10 (2, 5, 10).
+ bool y_origin = false, //!< do not include the origin un../sandbox/SOC/2007/visualization/boost/svg_plot/detail/auto_axes.hpp:398:5: error: need âtypenameâ before âT:: const_iteratorâ because âTâ is a dependent scopeless the range min_value <= 0 <= max_value.
+ double y_tight = 0., //!< tightest - fraction of 'overrun' allowed before another tick used.
+ // for visual effect up to about 0.001 might suit a 1000 pixel wide image,
+ // allowing values just 1 pixel over the tick to be shown.
+ int y_min_ticks = 6, //!< Minimum number of major ticks.
+ int y_steps = 0 //!< 0, or 2 for 2, 4, 6, 8, 10, 5 for 1, 5, 10, or 10 (2, 5, 10).
);
-// end of declarations.
+// All use:
+namespace detail
+{ // Declaration of implementation with default parameters.
+void scale_axis_impl(double min_value, double max_value, // Scale axis from input range min & max.
+ double* axis_min_value, double* axis_max_value, double* axis_tick_increment,
+ int* auto_ticks, // All 4 updated.
+ // NO check_limits parameter in this version.
+ bool origin = false, // Do not include the origin unless the range min_value <= 0 <= max_value.
+ double tight = 0., // tightest - fraction of 'overrun' allowed before another tick used.
+ // for visual effect up to about 0.001 might suit a 1000 pixel wide image,
+ // allowing values just 1 pixel over the tick to be shown.
+ int min_ticks = 6, // Minimum number of major ticks.
+ int steps = 0); // 0, or 2 for 2, 4, 6, 8, 10, 5 for 1, 5, 10, or 10 (2, 5, 10).
+} // namespace detail
+
+
+// End of declarations.
// Definitions.
@@ -119,10 +224,10 @@
\tparam iter InputIterator into STL container.
\return number of normal values (not 'at limit' neither too big, NaN nor infinite).
*/
-template <typename iter>
+template <typename Iter>
int mnmx(
- iter begin, //!< iterator to chosen first item in container.
- iter end, //!< iterator to chosen last item in container.
+ Iter begin, //!< iterator to chosen first item in container.
+ Iter end, //!< iterator to chosen last item in container.
double* min, //!< Updated with Minimum value found (not 'at limit').
double* max) //!< Updated with Maximum value found (not 'at limit').
{
@@ -131,7 +236,7 @@
using boost::svg::detail::is_limit; // Either x and/or y not a proper data value.
int goods = 0; // Count of values within limits.
int limits = 0;
- iter pos = begin;
+ Iter pos = begin;
while(pos != end && is_limit(value_of(*pos)))
{ // Count any limits before the first 'good' (FP normal) value.
limits++;
@@ -184,6 +289,28 @@
return goods; // If goods < 2,
} // template <typename iter>int mnmx((iter begin, iter end, double* min, double* max)
+//! Scale axis and update min and max axis values, and tick increment and number of ticks.
+void scale_axis(
+ double min_value, //!< Scale axis from input range min & max.
+ double max_value, //!< Scale axis from input range min & max.
+ double* axis_min_value, //!< Computed minimum value for the axis, updated by scale_axis.
+ double* axis_max_value, //!< Computed maximum value for the axis, updated by scale_axis.
+ double* axis_tick_increment, //!< Computed tick increment for the axis, updated by scale_axis.
+ int* auto_ticks, //!< Computed number of ticks, updated by scale_axis.
+ // NO check_limits parameter.
+ bool origin, // = false, //!< Do not include the origin unless the range min_value <= 0 <= max_value.
+ double tight, // = 0., //!< Tightness - fraction of 'overrun' allowed before another tick used.
+ //!< for visual effect up to about 0.001 might suit a 1000 pixel wide image,
+ //!< allowing values just 1 pixel over the tick to be shown.
+ int min_ticks, //= 6, //!< Minimum number of major ticks.
+ int steps // = 0 //!< Round up and down to 2, 4, 6, 8, 10, or 5, 10 or 2, 5, 10 systems.
+)
+{
+ detail::scale_axis_impl(min_value, max_value,
+ axis_min_value, axis_max_value, axis_tick_increment, auto_ticks, // All 4 updated.
+ origin, tight, min_ticks, steps); // Display range.
+} //
+
//! Scale axis function to define axis marker ticks based on min & max parameters values.
void scale_axis(
double min_value, //!< Updated with Minimum value found.
@@ -202,17 +329,17 @@
// Must assume max and min are OK (can't ignore limit values).
// If either at limit then will be caught and exception thrown later by x_range.
// So deliberately ignore check_limits parameter & and autoscale_plusminus & suppress any warnings.
- scale_axis(min_value, max_value,
+ detail::scale_axis_impl(min_value, max_value,
axis_min_value, axis_max_value, axis_tick_increment, auto_ticks, // All 4 updated.
origin, tight, min_ticks, steps); // Display range.
}
//! Scale axis using an iterator into an STL container.
-// \tparam iter interator into an STL container: array, vector, set ...
-template <typename iter>
+// \tparam iter iterator into an STL container: array, vector, set ...
+template <typename Iter>
void scale_axis(
- iter begin, //!< iterators into begin in STL container.
- iter end, //!< iterators into end in STL container.
+ Iter begin, //!< iterators into begin in STL container.
+ Iter end, //!< iterators into end in STL container.
// (not necessarily ordered by size, so will find min and max).
double* axis_min_value, //!< Computed minimum value for the axis, updated by scale_axis.
double* axis_max_value, //!< Computed maximum value for the axis, updated by scale_axis.
@@ -220,15 +347,15 @@
int* auto_ticks, //!< Computed number of ticks, updated by scale_axis.
bool check_limits, //!< Whether to check all values for infinity, NaN etc.
double autoscale_plusminus, //!< Mutiplier of uncertainty or standard deviations to allow fo confidence ellipses.
- bool origin = false, //!< do not include the origin unless the range min_value <= 0 <= max_value.
- double tight = 0., //!< tightest - fraction of 'overrun' allowed before another tick used.
+ bool origin, // = false, //!< Do not include the origin unless the range min_value <= 0 <= max_value.
+ double tight, // = 0., //!< tightest - fraction of 'overrun' allowed before another tick used.
// for visual effect up to about 0.001 might suit a 1000 pixel wide image,
// allowing values just 1 pixel over the tick to be shown.
- int min_ticks = 6, //!< Minimum number of major ticks.
- int steps = 0) //!< 0, or 2 for 2, 4, 6, 8, 10, 5 for 1, 5, 10, or 10 (2, 5, 10).
+ int min_ticks, // = 6, //!< Minimum number of major ticks.
+ int steps) // = 0) //!< 0, or 2 for 2, 4, 6, 8, 10, 5 for 1, 5, 10, or 10 (2, 5, 10).
{ //! Scale axis from data series (usually to plot), perhaps only part of container.
- // \tparam iter interator into an STL container: array, vector, set ...
- void scale_axis(double min_value, double max_value, // Input range.
+ // \tparam iter iterator into an STL container: array, vector, set ...
+ void detail::scale_axis_impl(double min_value, double max_value, // Input range.
double* axis_min_value, double* axis_max_value, double* axis_tick_increment, int* auto_ticks, // All 4 updated.
bool origin, // If true, ensures that zero is a tick value.
double tight, // Allows user to avoid a small fraction over a tick using another tick.
@@ -241,7 +368,7 @@
// BUT only if it can be assumed that no values are 'at limits',
// infinity, NaN, max_value, min_value, denorm_min.
// Otherwise it is necessary to inspect all values individually.
- std::pair<iter, iter> result = boost::minmax_element(begin, end); // min & max
+ std::pair<Iter, Iter> result = boost::minmax_element(begin, end); // min & max
// scale_axis (not check_limits version) forward declaration to ensure compiler finds right version.
x_min = *(result.first);
x_max = *(result.second);
@@ -253,14 +380,14 @@
{
throw std::runtime_error("Autoscale could not find useful min & max to scale axis!");
}
- scale_axis(x_min, x_max,
+ detail::scale_axis_impl(x_min, x_max,
axis_min_value, axis_max_value, axis_tick_increment, auto_ticks, // All 4 updated.
origin, tight, min_ticks, steps); // Display range.
}
} // template <typename iter> void scale_axis(iter begin, iter end, ...
//! Scale axis using all the 1D data in an STL container.
- //! \tparam T an STL container: array, vector ...
+//! \tparam T an STL container: array, vector ...
template <class T>
void scale_axis(
const T& container, //!< STL container, usually of a data series.
@@ -269,13 +396,13 @@
double* axis_tick_increment, //!< Computed tick increment for the axis, updated by scale_axis.
int* auto_ticks, //!< Computed number of ticks, updated by scale_axis.
bool check_limits, //!< Whether to check all values for infinity, NaN etc.
- double autoscale_plusminus = 3., //!< Multiplier of uncertainty or standard deviations to allow for confidence ellipses.
- bool origin = false, //!< do not include the origin unless the range min_value <= 0 <= max_value.
- double tight = 0., //!< tightest - fraction of 'overrun' allowed before another tick used.
+ double autoscale_plusminus, // = 3., //!< Multiplier of uncertainty or standard deviations to allow for confidence ellipses.
+ bool origin, // = false, //!< do not include the origin unless the range min_value <= 0 <= max_value.
+ double tight, // = 0., //!< tightest - fraction of 'overrun' allowed before another tick used.
//! for visual effect up to about 0.001 might suit a 1000 pixel wide image,
//! allowing values just 1 pixel over the tick to be shown.
- int min_ticks = 6, //!< Minimum number of major ticks.
- int steps = 0) //!< 0, or 2 for 2, 4, 6, 8, 10, 5 for 1, 5, 10, or 10 (2, 5, 10).
+ int min_ticks, // = 6, //!< Minimum number of major ticks.
+ int steps) // = 0) //!< 0, or 2 for 2, 4, 6, 8, 10, 5 for 1, 5, 10, or 10 (2, 5, 10).
{ //! scale axis using an \b entire Container Data series, usually to plot.
//! (not necessarily ordered, so will find min and max).
double x_min;
@@ -303,11 +430,15 @@
}
// std::cout << "x_min " << x_min << ", x_max " << x_max << std::endl; //
}
- scale_axis(x_min, x_max,
- axis_min_value, axis_max_value, axis_tick_increment, auto_ticks, // All 4 updated.
- origin, tight, min_ticks, steps); // Display range.
+
+ detail::scale_axis_impl(x_min, x_max,
+ axis_min_value, axis_max_value, axis_tick_increment, auto_ticks,
+ origin, tight, min_ticks, steps);
+
} // template <class T> int scale_axis T an STL container: array, vector ...
+
+
//! Scale X and Y axis using T a 2D STL container: array of pairs, vector of pairs, ...
//! \tparam T STL container of 2D pairs of X and Y.
template <class T>
@@ -321,20 +452,20 @@
double* y_axis_max_value, //!< Computed maximum value for the Y-axis, updated by scale_axis.
double* y_axis_tick_increment, //!< Updated with Y axis tick increment.
int* y_auto_ticks, //!< Computed number of Y-axis ticks, updated by scale_axis.
- bool check_limits = true, //!< Whether to check all values for infinity, NaN etc.
- double autoscale_plusminus = 3., //!< Mutiplier of uncertainty or standard deviations to allow fo confidence ellipses.
- bool x_origin = false, //!< do not include the origin unless the range min_value <= 0 <= max_value.
- double x_tight = 0., //!< tightest - fraction of 'overrun' allowed before another tick used.
+ bool check_limits, // = true, //!< Whether to check all values for infinity, NaN etc.
+ double autoscale_plusminus, // = 3., //!< Mutiplier of uncertainty or standard deviations to allow fo confidence ellipses.
+ bool x_origin, // = false, //!< do not include the origin unless the range min_value <= 0 <= max_value.
+ double x_tight, // = 0., //!< tightest - fraction of 'overrun' allowed before another tick used.
//! for visual effect up to about 0.001 might suit a 1000 pixel wide image,
//! allowing values just 1 pixel over the tick to be shown.
- int x_min_ticks = 6, //!< Minimum number of major ticks.
- int x_steps = 0, //!< 0, or 2 for 2, 4, 6, 8, 10, 5 for 1, 5, 10, or 10 (2, 5, 10).
- bool y_origin = false, //!< do not include the origin un../sandbox/SOC/2007/visualization/boost/svg_plot/detail/auto_axes.hpp:398:5: error: need âtypenameâ before âT:: const_iteratorâ because âTâ is a dependent scopeless the range min_value <= 0 <= max_value.
- double y_tight = 0., //!< tightest - fraction of 'overrun' allowed before another tick used.
+ int x_min_ticks, // = 6, //!< Minimum number of major ticks.
+ int x_steps, // = 0, //!< 0, or 2 for 2, 4, 6, 8, 10, 5 for 1, 5, 10, or 10 (2, 5, 10).
+ bool y_origin, // = false, //!< do not include the origin un../sandbox/SOC/2007/visualization/boost/svg_plot/detail/auto_axes.hpp:398:5: error: need âtypenameâ before âT:: const_iteratorâ because âTâ is a dependent scopeless the range min_value <= 0 <= max_value.
+ double y_tight, // = 0., //!< tightest - fraction of 'overrun' allowed before another tick used.
// for visual effect up to about 0.001 might suit a 1000 pixel wide image,
// allowing values just 1 pixel over the tick to be shown.
- int y_min_ticks = 6, //!< Minimum number of major ticks.
- int y_steps = 0) //!< 0, or 2 for 2, 4, 6, 8, 10, 5 for 1, 5, 10, or 10 (2, 5, 10).
+ int y_min_ticks, // = 6, //!< Minimum number of major ticks.
+ int y_steps) // = 0) //!< 0, or 2 for 2, 4, 6, 8, 10, 5 for 1, 5, 10, or 10 (2, 5, 10).
{ /*! Scale X and Y axis using T a 2D STL container: array of pairs, vector of pairs, list of pairs, map ...
\param container Data series to plot - entire 2D container.
*/
@@ -461,27 +592,28 @@
std::cout << "Checked: x_min " << x_min << ", x_max " << x_max << ", y_min " << y_min << ", y_max " << y_max << ", " << goods << " 'good' values, " << limits << " values at limits."<< std::endl;
}
}
- scale_axis(x_min, x_max,
+ detail::scale_axis_impl(x_min, x_max,
x_axis_min_value, x_axis_max_value, x_axis_tick_increment, x_auto_ticks,
x_origin, x_tight, x_min_ticks, x_steps);
- scale_axis(y_min, y_max,
+ detail::scale_axis_impl(y_min, y_max,
y_axis_min_value, y_axis_max_value, y_axis_tick_increment, y_auto_ticks,
y_origin, y_tight, y_min_ticks, y_steps);
+
} // template <class T> int scale_axis T an STL container: array, vector ...
-
-// Above versions all use the scale_axis version below that does the real scaling work.
-
-void scale_axis(double min_value, double max_value, // Scale axis from Input range min & max.
+// Above versions all use the scale_axis_impl implementation below that does the real scaling work.
+namespace detail
+{ // Definition of implementation with default parameters.
+void scale_axis_impl(double min_value, double max_value, // Scale axis from Input range min & max.
double* axis_min_value, double* axis_max_value, double* axis_tick_increment, int* auto_ticks, // All 4 updated.
// NO check_limits parameter in this version.
- bool origin = false, // Do not include the origin unless the range min_value <= 0 <= max_value.
- double tight = 0., // tightest - fraction of 'overrun' allowed before another tick used.
+ bool origin, // = false, // Do not include the origin unless the range min_value <= 0 <= max_value.
+ double tight, // = 0., // tightest - fraction of 'overrun' allowed before another tick used.
// for visual effect up to about 0.001 might suit a 1000 pixel wide image,
// allowing values just 1 pixel over the tick to be shown.
- int min_ticks = 6, // Minimum number of major ticks.
- int steps = 0) // 0, or 2 for 2, 4, 6, 8, 10, 5 for 1, 5, 10, or 10 (2, 5, 10).
+ int min_ticks, // = 6, // Minimum number of major ticks.
+ int steps) // = 0) // 0, or 2 for 2, 4, 6, 8, 10, 5 for 1, 5, 10, or 10 (2, 5, 10).
{
int ticks = -1; // Negative to warn of 'bad' value.
double test_max;
@@ -660,8 +792,9 @@
*axis_max_value = test_max;
*axis_tick_increment = test_increment; // major_tick_interval.
*auto_ticks = ticks; // major ticks.
-} // scale_axis
+} // scale_axis_impl
+} // namespace detail
// Utility functions to display containers
// and to find min and max values in containers.
@@ -706,7 +839,7 @@
} // Container Data series to plot.
template <class T>
-std::pair<double, double> range(const T& container) //! Container Data series
+std::pair<double, double> range_mx(const T& container) //! Container Data series
{ /*! \return minimum and maximum of an STL container.
\tparam T an STL container: array, vector, set, map ...
*/
@@ -716,7 +849,7 @@
minmax.first = *result.first;
minmax.second = *result.second;
return minmax;
-} // template <class T> range
+} // template <class T> range_mx
template <typename T> // T an STL container: array, vector, set, map ...
std::pair<double, double> range_all(const T& containers) // Container of STL containers of Data series.
@@ -728,7 +861,7 @@
);
for (typename T::const_iterator it = containers.begin(); it != containers.end(); it++)
{
- std::pair<double, double> mm = range(*it); // Scale of this container.
+ std::pair<double, double> mm = range_mx(*it); // Scale of this container.
minmax.first = (std::min)(mm.first, minmax.first); //
minmax.second = (std::max)(mm.second, minmax.second);
}
@@ -922,11 +1055,18 @@
}
} // double rounddown2(double value)
- } // svg
-} // boost
+} // namespace svg
+} // namespace boost
#if defined (BOOST_MSVC)
# pragma warning(pop)
#endif
#endif // BOOST_SVG_AUTO_AXES_HPP
+
+/*
+
+/
+
+
+*/
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 2012-10-04 12:22:30 EDT (Thu, 04 Oct 2012)
@@ -25,6 +25,7 @@
// template <class T>bool isfinite (T);
// template <class T>bool isinf (T);
// template <class T> bool isnan (T);
+#include <boost/svg_plot/detail/auto_axes.hpp>
#include <boost/quan/unc.hpp>
// using boost::svg::unc;
#include <boost/quan/meas.hpp>
Modified: sandbox/SOC/2007/visualization/boost/svg_plot/detail/functors.hpp
==============================================================================
--- sandbox/SOC/2007/visualization/boost/svg_plot/detail/functors.hpp (original)
+++ sandbox/SOC/2007/visualization/boost/svg_plot/detail/functors.hpp 2012-10-04 12:22:30 EDT (Thu, 04 Oct 2012)
@@ -176,7 +176,7 @@
typedef std::pair<Meas, unc<correlated> > result_type;
//!< result type is pair of uncertain values.
- Meas i; //!< Start Meas (uncun + daetime etc) value.
+ Meas i; //!< Start Meas (uncun + datetime etc) value.
void start(Meas i)
{ //!< Set a start value.
Modified: sandbox/SOC/2007/visualization/boost/svg_plot/impl/svg_1d_plot.ipp
==============================================================================
--- sandbox/SOC/2007/visualization/boost/svg_plot/impl/svg_1d_plot.ipp (original)
+++ sandbox/SOC/2007/visualization/boost/svg_plot/impl/svg_1d_plot.ipp 2012-10-04 12:22:30 EDT (Thu, 04 Oct 2012)
@@ -6,7 +6,7 @@
// svg_1d_plot.ipp
// Copyright Jacob Voytko 2007
-// Copyright Paul A. Bristow 2008, 2009, 2011
+// Copyright Paul A. Bristow 2008, 2009, 2011, 2012
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0.
@@ -691,9 +691,9 @@
{ /*! Add a data series to the plot (by default, converting to unc doubles), with optional title.
\code
std::vector<float> my_data; // my container.
-my_data.pushback(2.f); // Fill container with some data.
-my_data.pushback(3.f);
-my_data.pushback(4.f);
+my_data.push_back(2.f); // Fill container with some data.
+my_data.push_back(3.f);
+my_data.push_back(4.f);
my_1d_plot.plot(my_data, "All data in my container"); // Plot all data in container.
\endcode
@@ -715,7 +715,7 @@
return serieses_[serieses_.size() - 1];
} // plot(const T& container, const std::string& title)
-template <class T> //! \tparam T floating-point type of the data (T must be convertable to double).
+template <class T> //! \tparam T floating-point type of the data (T must be convertible to double).
svg_1d_plot_series& svg_1d_plot::plot(const T& begin, const T& end, const std::string& title)
{ /*! Add a data series to the plot (by default, converting to unc doubles), with optional title.
\note This version permits a partial range of the container, from begin to end, to be used.
@@ -739,14 +739,14 @@
return serieses_[serieses_.size() - 1]; // Reference to data series just added.
} // plot
-
-//template <typename T, typename U>
+#ifdef _MSC_VER
+template <typename T, typename U>
/*!
- \tparam T floating-point type of the data (which must be convertable to double).
+ \tparam T floating-point type of the data (which must be convertible to double).
\tparam U functor floating-point type (default is @c double_1d_convert).
*/
-//svg_1d_plot_series& svg_1d_plot::plot(const T& container, const std::string& title /* = "" */, U functor/*= double_1d_convert*/)
-//{ //! Add a data series to the plot, with optional title.
+svg_1d_plot_series& svg_1d_plot::plot(const T& container, const std::string& title /* = "" */, U functor/*= double_1d_convert*/)
+{ //! Add a data series to the plot, with optional title.
/*!
This version of plot includes a functor, allowing other than just convert data values to double(the default).
\param container Container for data (for example vector) that contains the data to be added to the plot.
@@ -755,25 +755,26 @@
\return a reference to data series just added (to make chainable).
-*/
-// serieses_.push_back(
-// svg_1d_plot_series(
-// boost::make_transform_iterator(container.begin(), functor),
-// boost::make_transform_iterator(container.end(), functor),
-// title)
-// );
-// return serieses_[serieses_.size() - 1]; // Reference to data series just added.
-//} // plot
-
+ */
+ serieses_.push_back(
+ svg_1d_plot_series(
+ boost::make_transform_iterator(container.begin(), functor),
+ boost::make_transform_iterator(container.end(), functor),
+ title)
+ );
+ return serieses_[serieses_.size() - 1]; // Reference to data series just added.
+} // plot
+#endif // _MSC_VER
-//template <typename T, typename U>
+#ifdef _MSC_VER
+template <typename T, typename U>
/*!
- \tparam T floating-point type of the data (which must be convertable to double).
+ \tparam T floating-point type of the data (which must be convertible to double).
\tparam U functor floating-point type (default is double_1d_convert).
*/
-//svg_1d_plot_series& svg_1d_plot::plot(const T& begin, const T& end, const std::string& title /* = ""*/,
-// U functor /* = double_1d_convert */)
-//{
+svg_1d_plot_series& svg_1d_plot::plot(const T& begin, const T& end, const std::string& title /* = ""*/,
+ U functor /* = double_1d_convert */)
+{
/*! Add a data series to the plot, with optional title. (Version with custom functor, rather than to double).
\note This version permits a @b partial range, begin to end, of the container to be used.
@@ -783,14 +784,15 @@
\param functor Custom functor.
\return a reference to data series just added (to make chainable).
*/
-// serieses_.push_back(
-// svg_1d_plot_series(
-// boost::make_transform_iterator(begin, functor),
-// boost::make_transform_iterator(end, functor),
-// title)
-// );
-// return serieses_[serieses_.size() - 1]; //!< \return Reference to data series just added.
-//} // plot
+ serieses_.push_back(
+ svg_1d_plot_series(
+ boost::make_transform_iterator(begin, functor),
+ boost::make_transform_iterator(end, functor),
+ title)
+ );
+ return serieses_[serieses_.size() - 1]; //!< \return Reference to data series just added.
+} // plot
+#endif // _MSC_VER
// End Definitions of svg_plot_series Public Member Functions.
} // namespace svg
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 2012-10-04 12:22:30 EDT (Thu, 04 Oct 2012)
@@ -8,7 +8,7 @@
*/
// Copyright Jacob Voytko 2007
-// Copyright Paul A. Bristow 2008, 2009, 2011
+// Copyright Paul A. Bristow 2008, 2009, 2011, 2012
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0.
@@ -141,7 +141,8 @@
//friend void show_2d_plot_settings(svg_1d_plot&); // Surely not needed?
friend class detail::axis_plot_frame<svg_1d_plot>;
- //protected: // but seems little benefit?
+public:
+ //protected: // but seems little benefit?
// Member data names conventionally end with _, for example: border_margin_,
// and set & get accessor functions are named *without* _ suffix,
// for example: border_margin() & border_margin(int).
@@ -285,12 +286,12 @@
svg_1d_plot_series& plot(const T& container, const std::string& title = "");
template <typename T>
svg_1d_plot_series& plot(const T& begin, const T& end, const std::string& title = "");
- /*
+
template <typename T, typename U>
- svg_1d_plot_series& plot(const T& container, const std::string& title = "", U functor = detail::double_1d_convert);
+ svg_1d_plot_series& plot(const T& container, const std::string& title = "", U functor = boost::svg::detail::double_1d_convert());
template <typename T, typename U>
- svg_1d_plot_series& plot(const T& begin, const T& end, const std::string& title = "", U functor = detail::double_1d_convert);
- */
+ svg_1d_plot_series& plot(const T& begin, const T& end, const std::string& title = "", U functor = boost::svg::detail::double_1d_convert());
+ // GCC seems to need functor to have trailing (), but MSVC does not.
}; // class svg_1d_plot
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 2012-10-04 12:22:30 EDT (Thu, 04 Oct 2012)
@@ -58,7 +58,7 @@
namespace svg
{
// Forward declarations.
- const std::string strip_e0s(std::string s); // Strip unncessary zeros and e and sign.
+ const std::string strip_e0s(std::string s); // Strip unnecessary zeros and e and sign.
class svg_2d_plot; //! Plot framework.
class svg_2d_plot_series; //! One series of data to plot.
@@ -67,12 +67,11 @@
\brief Holds a series of 2D data values (points) to be plotted.
\details Data values are sorted into normal and 'at limits':
NaN, infinity or too small or too large.\n\n
- multimap is used rather than vector of pairs because
- multimap sorts and ensures that lines joining data points
+ std::multimap is used rather than vector of pairs because
+ std::multimap sorts and ensures that lines joining data points
are unaffected by the order in which data is presented.
(For 1-D a vector of doubles can be used).
*/
- friend svg_2d_plot_series;
friend void draw_straight_lines(const svg_2d_plot_series&);
public:
@@ -95,7 +94,7 @@
T end, //!< ending iterator into container of data series, end() to finish with the last item.
std::string title = "" //!< Title of data series.
);
- // Function declarations only - definitions may be in .ipp file).
+ // Function declarations only - definitions are in .ipp file).
// Set functions for the plot series.
svg_2d_plot_series& fill_color(const svg_color& col_);
svg_2d_plot_series& stroke_color(const svg_color& col_);
@@ -345,12 +344,12 @@
See also svg_1d_plot.hpp for 1-D version.
*/
friend void show_2d_plot_settings(svg_2d_plot&);
- friend svg_2d_plot_series;
+ friend class svg_2d_plot_series;
friend class detail::axis_plot_frame<svg_2d_plot>;
// axis_plot_frame.hpp contains functions common to 1 and 2-D.
// private:
- public: //temporary for experimental gil
+ public:
// Member data names conventionally end with _,
// for example: border_margin_,
// and set & get accessor functions are named without _ suffix,
@@ -2293,15 +2292,21 @@
svg_2d_plot& y_values_ioflags(std::ios_base::fmtflags f);
std::ios_base::fmtflags y_values_ioflags();
- // Versions of plot functions to add data series from a container, all or part.
+ // Versions of plot functions to add data series from a container, all or part,
+ // declarations including defaults for parameters (except containers, of course).
template <typename T>
svg_2d_plot_series& plot(const T& container, const std::string& title = "");
+
template <typename T, typename U>
- svg_2d_plot_series& plot(const T& container, const std::string& title = "", U functor = pair_double_2d_convert);
+ svg_2d_plot_series& plot(const T& container, const std::string& title = "",
+ U functor = boost::svg::detail::pair_double_2d_convert() );
+
template <typename T>
svg_2d_plot_series& plot(const T& begin, const T& end, const std::string& title = "");
+
template <typename T, typename U>
- svg_2d_plot_series& plot(const T& begin, const T& end, const std::string& title = "", U functor = pair_double_2d_convert);
+ svg_2d_plot_series& plot(const T& begin, const T& end, const std::string& title = "",
+ U functor = boost::svg::detail::pair_double_2d_convert() );
}; // class svg_2d_plot : public detail::axis_plot_frame<svg_2d_plot>
@@ -2766,7 +2771,7 @@
{ //! Data series using iterator's range to use to calculate autoscaled values.
scale_axis(begin, end,
&y_auto_min_value_, &y_auto_max_value_, &y_auto_tick_interval_, &y_auto_ticks_,
- autoscale_check_limits_, autoscale_plusminus_
+ autoscale_check_limits_, autoscale_plusminus_,
y_include_zero_, y_tight_, y_min_ticks_, y_steps_);
y_autoscale_ = true; // Default to use calculated values.
return *this; //! \return reference to svg_2d_plot to make chainable.
@@ -3223,8 +3228,8 @@
*/
serieses_.push_back(
svg_2d_plot_series(
- boost::make_transform_iterator(container.begin(), detail::pair_Meas_2d_convert<false>()),
- boost::make_transform_iterator(container.end(), detail::pair_Meas_2d_convert<false>()),
+ boost::make_transform_iterator(container.begin(), boost::svg::detail::pair_Meas_2d_convert<false>()),
+ boost::make_transform_iterator(container.end(), boost::svg::detail::pair_Meas_2d_convert<false>()),
title)
);
return serieses_[serieses_.size()-1]; //! \return Reference to data series just added to make chainable.
@@ -3241,7 +3246,7 @@
boost::make_transform_iterator(container.end(), functor),
title)
);
- return serieses_[series_.size()-1]; //! \return Reference to data series just added to make chainable.
+ return serieses_[serieses_.size()-1]; //! \return Reference to data series just added to make chainable.
}
template <typename T>
@@ -3256,13 +3261,19 @@
my_2d_plot.plot(&my_data[1], &my_data[], "my_data 1 to 3"); // Add part of data series.
\endcode
*/
- serieses_.push_back(
+
+#ifdef _MSC_VER
+ serieses_.push_back
+ (
svg_2d_plot_series(
- boost::make_transform_iterator(begin, detail::unc_1d_convert()),
- boost::make_transform_iterator(end, detail::unc_1d_convert()),
+ boost::make_transform_iterator(begin, boost::svg::detail::unc_1d_convert() ), // Xs
+ boost::make_transform_iterator(end, boost::svg::detail::unc_1d_convert() ), // Ys
title)
);
- return serieses_[series_.size() - 1]; //! \return Reference to data series just added to make chainable.
+
+#endif // _MSC_VER
+
+ return serieses_[serieses_.size() - 1]; //! \return Reference to data series just added to make chainable.
} // plot(const T& begin, const T& end, const std::string& title = "")
template <typename T, typename U>
@@ -3273,17 +3284,17 @@
*/
serieses_.push_back(
svg_2d_plot_series(
- boost::make_transform_iterator(container.begin(), functor),
- boost::make_transform_iterator(container.end(), functor),
+ boost::make_transform_iterator(begin, functor),
+ boost::make_transform_iterator(end, functor),
title)
);
- return serieses_[series_.size() - 1]; //! \return Reference to data series just added to make chainable.
+ return serieses_[serieses_.size() - 1]; //! \return Reference to data series just added to make chainable.
}
svg_2d_plot& svg_2d_plot::write(std::ostream& s_out)
- { //! Write the SVG image to an ostream.
+ { //! Write the SVG image to an std::ostream.
update_image();
- image_.write(s_out); // Use the ostream version of write.
+ image_.write(s_out); // Use the std::ostream version of write.
return *this; //! \return reference to svg_2d_plot to make chainable.
}
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