|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r80907 - in sandbox/SOC/2007/visualization: boost/svg_plot boost/svg_plot/detail libs/svg_plot/example
From: pbristow_at_[hidden]
Date: 2012-10-08 12:57:15
Author: pbristow
Date: 2012-10-08 12:57:13 EDT (Mon, 08 Oct 2012)
New Revision: 80907
URL: http://svn.boost.org/trac/boost/changeset/80907
Log:
more added std:: etc
Text files modified:
sandbox/SOC/2007/visualization/boost/svg_plot/detail/auto_axes.hpp | 13 +++---
sandbox/SOC/2007/visualization/boost/svg_plot/detail/numeric_limits_handling.hpp | 1
sandbox/SOC/2007/visualization/boost/svg_plot/svg_1d_plot.hpp | 12 ++++--
sandbox/SOC/2007/visualization/boost/svg_plot/svg_2d_plot.hpp | 2 +
sandbox/SOC/2007/visualization/libs/svg_plot/example/auto_1d_containers.cpp | 8 ++--
sandbox/SOC/2007/visualization/libs/svg_plot/example/container_minmax.cpp | 77 +++++++++++++++++++--------------------
sandbox/SOC/2007/visualization/libs/svg_plot/example/demo_2d_area_fill.cpp | 12 +++---
sandbox/SOC/2007/visualization/libs/svg_plot/example/demo_rounds.cpp | 36 +++++++++--------
8 files changed, 85 insertions(+), 76 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-08 12:57:13 EDT (Mon, 08 Oct 2012)
@@ -27,6 +27,7 @@
# pragma warning (disable: 4100) // 'check_limits' and autoscale_plusminus: unreferenced formal parameters
#endif
+#include <boost/svg_plot/detail/numeric_limits_handling.hpp>
#include <boost/svg_plot/detail/FP_compare.hpp> // is_small & is_close
#include <boost/quan/meas.hpp> // for value_of.
@@ -355,12 +356,12 @@
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 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.
- int min_ticks, // Minimum number of ticks.
- int steps); // Round up and down to 2, 4, 6, 8, 10, or 5, 10 or 2, 5, 10 systems.
+// 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.
+// int min_ticks, // Minimum number of ticks.
+// int steps); // Round up and down to 2, 4, 6, 8, 10, or 5, 10 or 2, 5, 10 systems.
double x_min;
double x_max;
if (!check_limits)
Modified: sandbox/SOC/2007/visualization/boost/svg_plot/detail/numeric_limits_handling.hpp
==============================================================================
--- sandbox/SOC/2007/visualization/boost/svg_plot/detail/numeric_limits_handling.hpp (original)
+++ sandbox/SOC/2007/visualization/boost/svg_plot/detail/numeric_limits_handling.hpp 2012-10-08 12:57:13 EDT (Mon, 08 Oct 2012)
@@ -126,6 +126,7 @@
inline bool pair_is_limit(std::pair<const Meas, unc<correlated> > a)
{ //! Check on values of both x Meas and y unc data points.
// \return false if either or both are at limit.
+ double rounddown2(double value); // 2, 4,
return limit_max(value_of(a.first)) || limit_min(value_of(a.first)) || limit_NaN(value_of(a.first))
|| limit_max(value_of(a.second)) || limit_min(value_of(a.second)) || limit_NaN(value_of(a.second));
}
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-08 12:57:13 EDT (Mon, 08 Oct 2012)
@@ -31,7 +31,7 @@
#include <boost/svg_plot/svg_style.hpp>
#include <boost/svg_plot/detail/axis_plot_frame.hpp> // Code shared with 2D.
#include <boost/svg_plot/detail/functors.hpp>
-using boost::svg::detail::unc_1d_convert;
+//using boost::svg::detail::unc_1d_convert;
#include <boost/svg_plot/detail/numeric_limits_handling.hpp>
//#include <boost/quan/unc.hpp>
//#include <boost/quan/unc_init.hpp>
@@ -40,14 +40,18 @@
using boost::svg::detail::limit_NaN;
-#include <boost/svg_plot/detail/auto_axes.hpp> /*! provides:
-void scale_axis(double min_value, double max_value, // Input range
+#include <boost/svg_plot/detail/auto_axes.hpp>
+/*! provides:
+void boost::svg::scale_axis(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.
int min_ticks, // Minimum number of ticks.
int steps); // Round up and down to 2, 4, 6, 8, 10, or 5, 10 or 2, 5, 10 systems.
-*/
+
+template<typename T>
+void boost::svg::scale_axis(const T&, double*, double*, double*, int*, double*, double*, double*, int*, bool, double, bool, double, int, int, bool, double, int, int);
+ */
#include <vector>
#include <ostream>
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-08 12:57:13 EDT (Mon, 08 Oct 2012)
@@ -42,6 +42,8 @@
#include <boost/svg_plot/detail/auto_axes.hpp>
using boost::svg::detail::limit_NaN;
+
+
#include <map> // for map & multimap
#include <string>
#include <sstream>
Modified: sandbox/SOC/2007/visualization/libs/svg_plot/example/auto_1d_containers.cpp
==============================================================================
--- sandbox/SOC/2007/visualization/libs/svg_plot/example/auto_1d_containers.cpp (original)
+++ sandbox/SOC/2007/visualization/libs/svg_plot/example/auto_1d_containers.cpp 2012-10-08 12:57:13 EDT (Mon, 08 Oct 2012)
@@ -34,7 +34,7 @@
// Note neither of these check for 'limits' (infinite, NaN) values.
#include <boost/svg_plot/detail/pair.hpp>
- using boost::svg::detail::operator<<; // Output pair as, for example: 1.23, 4.56
+// using boost::svg::detail::operator<<; // Output pair as, for example: 1.23, 4.56
//#include <boost/svg_plot/show_1d_settings.hpp>
// Only needed for showing which settings in use.
@@ -170,10 +170,10 @@
with unc class
Description: Autorun "J:\Cpp\SVG\Debug\auto_1d_containers.exe"
- 6 values in container: 0.2 1.1 4.2 3.3 5.4 6.5
+ 6 values in container: 0.2 1.1 4.2 3.3 5.4 6.5
2 containers.
- 6 values in container: 0.2 1.1 4.2 3.3 5.4 6.5
- 6 values in container: 0.46 2.53 9.66 7.59 12.42 14.95
+ 6 values in container: 0.2 1.1 4.2 3.3 5.4 6.5
+ 6 values in container: 0.46 2.53 9.66 7.59 12.42 14.95
Data range: <0.2, 14.95>
x_range() 0, 15
Modified: sandbox/SOC/2007/visualization/libs/svg_plot/example/container_minmax.cpp
==============================================================================
--- sandbox/SOC/2007/visualization/libs/svg_plot/example/container_minmax.cpp (original)
+++ sandbox/SOC/2007/visualization/libs/svg_plot/example/container_minmax.cpp 2012-10-08 12:57:13 EDT (Mon, 08 Oct 2012)
@@ -89,7 +89,7 @@
template <typename T> // T an STL container: array, vector ...
size_t show(const T& container)
{ // Show all the containers values.
- for (T::const_iterator it = container.begin(); it != container.end(); it++)
+ for (typename T::const_iterator it = container.begin(); it != container.end(); it++)
{
cout << *it << ' ';
}
@@ -111,7 +111,7 @@
template <typename T> // T an STL container: container of containers.
size_t show_all(const T& containers)
{ // Show all the containers values.
- for (T::const_iterator it = containers.begin(); it != containers.end(); it++)
+ for (typename T::const_iterator it = containers.begin(); it != containers.end(); it++)
{
show(*it);
}
@@ -157,12 +157,12 @@
{
iter it = min_element(begin, end);
cout << "min_element " << *it << endl;
- pair<iter, iter> result = boost::minmax_element(begin, end);
+ std::pair<iter, iter> result = boost::minmax_element(begin, end);
//pair<const T::const_iterator, const T::const_iterator > result = boost::minmax_element(begin, end);
// error C2825: 'T': must be a class or namespace when followed by '::'
cout << "minmax_elements " << *result.first << ' ' << *result.second << endl;
- pair<double, double > minmax;
+ std::pair<double, double > minmax;
minmax.first = *result.first;
minmax.second = *result.second;
return minmax; // pair<double, double>
@@ -171,18 +171,18 @@
template <class T> // T an STL container: for example: array<float>, vector<double> ...
pair<double, double> s(const T& container) // Data series to plot.
{
- pair<T::const_iterator, T::const_iterator> result = boost::minmax_element(container.begin(), container.end());
+ pair<T::const_iterator, typename T::const_iterator> result = boost::minmax_element(container.begin(), container.end());
cout << "minmax_elements " << *result.first << ' ' << *result.second << endl;
- pair<double, double > minmax; // Convert type of container T to double.
+ std::pair<double, double > minmax; // Convert type of container T to double.
minmax.first = *result.first;
minmax.second = *result.second;
return minmax; // pair<double, double>
} // template <class T> int s T an STL container: array, vector ...
template <class T> // T an STL container: array, vector ...
-pair<double, double> scale(const T& container) // Container Data series
+std::pair<double, double> scale(const T& container) // Container Data series
{
- //typedef <const T& >::const_iterator container_iterator;
+ //typedef typename <const T& >::const_iterator container_iterator;
//pair< T, T > result = boost::minmax_element(container.begin(), container.end());
//pair< vector_iterator, vector_iterator > result = boost::minmax_element(container.begin(), container.end());
//cout << "Autoscale min is " << *(result.first) << endl;
@@ -198,7 +198,7 @@
//mm.second= *(minmax_element(container.begin(), container.end()).second);
// But this calls minmax_element twice.
- pair<T::const_iterator, T::const_iterator> result = boost::minmax_element(container.begin(), container.end());
+ pair<typename T::const_iterator, typename T::const_iterator> result = boost::minmax_element(container.begin(), container.end());
pair<double, double> minmax;
minmax.first = *result.first;
@@ -207,12 +207,12 @@
} // template <class T> int scale_axis, T an STL container: array, vector set, map ...
template <class T> // T an STL container: array, vector, set, map ...
-pair<double, double> s_all(const T& containers) // Container of containers of Data series.
+std::pair<double, double> s_all(const T& containers) // Container of containers of Data series.
{
- pair<double, double> minmax(numeric_limits<double>::max(), numeric_limits<double>::min());
- for (T::const_iterator it = containers.begin(); it != containers.end(); it++)
+ std::pair<double, double> minmax(std::numeric_limits<double>::max(), std::numeric_limits<double>::min());
+ for (typename T::const_iterator it = containers.begin(); it != containers.end(); it++)
{
- pair<double, double> mm = s(*it); // Scale of this container.
+ std::pair<double, double> mm = s(*it); // Scale of this container.
minmax.first = (std::min)(mm.first, minmax.first); //
minmax.second = (std::max)(mm.second, minmax.second);
}
@@ -221,7 +221,7 @@
int main()
{
- vector<double> my_data;
+ std::vector<double> my_data;
// Initialize my_data with some entirely fictional data.
my_data.push_back(0.2);
my_data.push_back(1.1); // [1]
@@ -230,13 +230,13 @@
my_data.push_back(5.4); // [4]
my_data.push_back(6.5); // [5]
- vector<double> my_data_2;
+ std::vector<double> my_data_2;
// transform(my_data.begin(), my_data.end(), data2.begin(), bind1st(multiplies<double>(), 2.3));
- copy(my_data.begin(), my_data.end(), back_inserter(my_data_2));
- copy(my_data.begin(), my_data.end(), ostream_iterator<double>(cout, " "));
+ copy(my_data.begin(), my_data.end(), std::back_inserter(my_data_2));
+ copy(my_data.begin(), my_data.end(), std::ostream_iterator<double>(cout, " "));
cout << endl << my_data.size() << " values in my_data. " << endl;
- copy(my_data_2.begin(), my_data_2.end(), ostream_iterator<double>(cout, " "));
- transform(my_data_2.begin(), my_data_2.end(), my_data_2.begin(), bind1st(multiplies<double>(), 2.3));
+ copy(my_data_2.begin(), my_data_2.end(), std::ostream_iterator<double>(cout, " "));
+ std::transform(my_data_2.begin(), my_data_2.end(), my_data_2.begin(), std::bind1st(multiplies<double>(), 2.3));
copy(my_data_2.begin(), my_data_2.end(), ostream_iterator<double>(cout, " "));
cout << endl << my_data.size() << " values in my_data. " << endl;
@@ -246,34 +246,33 @@
my_containers.push_back(my_data);
my_containers.push_back(my_data_2);
- cout << my_containers.size() << " containers." << endl;
+ std::cout << my_containers.size() << " containers." << std::endl;
show_all(my_containers);
- cout << s_all(my_containers) << endl;
-
+ std::cout << s_all(my_containers) << std::endl;
-
- typedef vector<double>::const_iterator vector_iterator;
- pair< vector_iterator, vector_iterator > result = boost::minmax_element(my_data.begin(), my_data.end());
- cout << "The smallest element is " << *(result.first) << endl; // 0.2
- cout << "The largest element is " << *(result.second) << endl; // 6.5
+ typedef std::vector<double>::const_iterator vector_iterator;
+ std::pair< vector_iterator, vector_iterator > result
+ = boost::minmax_element(my_data.begin(), my_data.end());
+ std::cout << "The smallest element is " << *(result.first) << std::endl; // 0.2
+ std::cout << "The largest element is " << *(result.second) << std::endl; // 6.5
// Autoscaling using two double min and max values.
double first_value = *(my_data.begin());
double last_value = *(--my_data.end());
- cout << "First value " << first_value << ", last = " << last_value << endl;
+ std::cout << "First value " << first_value << ", last = " << last_value << std::endl;
// Using first and last in container,
// assuming the data are ordered in ascending value,
- // either because they have been sorted, for vector or array,
- // or by being sorted as inserted, for example, map, multimap.
+ // either because they have been sorted, for std::vector or array,
+ // or by being sorted as inserted, for example, std::map, std::multimap.
//s(*my_data.begin(),*(--my_data.end()));
// Using two begin & end iterators into STL container,
- pair<double, double> mm = s(my_data.begin(), my_data.end() );
- cout << mm << endl;
- cout << mm.first << ' ' << mm.second << endl;
+ std::pair<double, double> mm = s(my_data.begin(), my_data.end() );
+ std::cout << mm << std::endl;
+ std::cout << mm.first << ' ' << mm.second << std::endl;
// Using two begin & end pointer into STL container,
// scale_axis does finding min and max.
@@ -283,7 +282,7 @@
// scale_axis does finding min and max.
mm = s(my_data); // Display range.
- multiset<double> my_set;
+ std::multiset<double> my_set;
// Initialize my_set with some entirely fictional data.
my_set.insert(2.3);
my_set.insert(7.8);
@@ -294,17 +293,17 @@
my_set.insert(6.7);
my_set.insert(8.9);
// Show the set.
- multiset<double>::const_iterator si;
+ std::multiset<double>::const_iterator si;
for (si = my_set.begin(); si != my_set.end(); si++)
{
cout << *si << ' ';
}
- cout << endl;
- cout << my_set.size() << " values in my_set. " << endl; // 8 values in my_set.
+ std::cout << endl;
+ std::cout << my_set.size() << " values in my_set. " << std::endl; // 8 values in my_set.
mm = s(my_set); // Display range.
- cout << mm << endl; // 1.2, 8.9
- cout <<"first " << *my_set.begin() << ", last " << *(--my_set.end()) << endl;
+ std::cout << mm << std::endl; // 1.2, 8.9
+ std::cout <<"first " << *my_set.begin() << ", last " << *(--my_set.end()) << std::endl;
Modified: sandbox/SOC/2007/visualization/libs/svg_plot/example/demo_2d_area_fill.cpp
==============================================================================
--- sandbox/SOC/2007/visualization/libs/svg_plot/example/demo_2d_area_fill.cpp (original)
+++ sandbox/SOC/2007/visualization/libs/svg_plot/example/demo_2d_area_fill.cpp 2012-10-08 12:57:13 EDT (Mon, 08 Oct 2012)
@@ -18,7 +18,7 @@
using namespace boost::svg; // Needed to get svg colors and others.
using boost::svg::svg_2d_plot;
-#include <map>
+#include <map>
using std::map; // STL container for data.
#include <cmath>
using std::sin;
@@ -45,7 +45,7 @@
map<double, double> data_sin; // Containers for some trig data.
map<double, double> data_cos;
map<double, double> data_tan;
-
+
double inter = 3.14159265358979 / 8.; // 16 points per cycle of 2 pi.
// Problem here if pi is more accurate (adding 3 at end) = 3.141592653589793
// tan line - going to infinity and back does not show.
@@ -53,7 +53,7 @@
// tan is very badly behaved and floating-point is evil!
for(double i = 0; i <= 10.; i += inter)
- { //
+ { //
data_sin[i] = my_sin(i);
data_cos[i] = my_cos(i);
data_tan[i] = my_tan(i);
@@ -82,7 +82,7 @@
.x_major_grid_color(cyan)
.y_major_grid_color(cyan)
;
-
+
// Color settings.
my_plot.background_color(whitesmoke)
.legend_background_color(lightyellow)
@@ -96,11 +96,11 @@
.x_minor_tick_length(7)
.x_minor_tick_width(1)
.x_num_minor_ticks(3)
-
+
// Y axis settings.
.y_major_interval(25)
.y_num_minor_ticks(4); // 4 minor ticks between 0 to 25, so mark major 0, minor 5, 10, 15, 20, major 25 ...
-
+
svg_2d_plot_series& s_sin = my_plot.plot(data_sin, "sin(x)").line_on(true).area_fill(red);
std::cout << "s_sin.area_fill() " << s_sin.area_fill() << std::endl; // s_sin.area_fill() RGB(255,0,0)
Modified: sandbox/SOC/2007/visualization/libs/svg_plot/example/demo_rounds.cpp
==============================================================================
--- sandbox/SOC/2007/visualization/libs/svg_plot/example/demo_rounds.cpp (original)
+++ sandbox/SOC/2007/visualization/libs/svg_plot/example/demo_rounds.cpp 2012-10-08 12:57:13 EDT (Mon, 08 Oct 2012)
@@ -1,7 +1,7 @@
/*! \file demo_rounds.cpp
\brief Demonstration of rounding algorithm used for autoscaling.
- \details
- \author Paul A Bristow
+ \details
+ \author Paul A Bristow
*/// demo_rounds.cpp
// Copyright Paul A. Bristow 2006.
@@ -29,13 +29,15 @@
#include <iostream>
- using std::cout;
- using std::endl;
+// using std::cout;
+// using std::endl;
int main()
{
using namespace boost::svg;
+ using std::cout;
+ using std::endl;
double r = roundup10(0.99);
@@ -69,14 +71,14 @@
cout << roundup2(0.9e-3) << endl; // 0.001
cout << roundup2(2.1e-3) << endl; // 0.004
cout << roundup2(3.1e-3) << endl; // 0.004
- cout << roundup2(4.1e-3) << endl; //
- cout << roundup2(7.1e-3) << endl; //
+ cout << roundup2(4.1e-3) << endl; //
+ cout << roundup2(7.1e-3) << endl; //
cout << roundup2(1.1e+3) << endl; // 2000
- cout << roundup2(0.9e+3) << endl; //
- cout << roundup2(2.1e+3) << endl; //
- cout << roundup2(3.1e+3) << endl; //
- cout << roundup2(4.1e+3) << endl; //
- cout << roundup2(7.1e+3) << endl; //
+ cout << roundup2(0.9e+3) << endl; //
+ cout << roundup2(2.1e+3) << endl; //
+ cout << roundup2(3.1e+3) << endl; //
+ cout << roundup2(4.1e+3) << endl; //
+ cout << roundup2(7.1e+3) << endl; //
cout << rounddown2(2.1) << endl; // 2
cout << rounddown2(4.1) << endl; // 2
@@ -88,11 +90,11 @@
cout << roundup5(4.1) << endl; // 5
cout << roundup5(5.1) << endl; // 10
cout << roundup5(7.1) << endl; // 10
- cout << roundup5(1.1e-3) << endl; //
- cout << roundup5(0.9e-3) << endl; //
- cout << roundup5(2.1e-3) << endl; //
- cout << roundup5(3.1e-3) << endl; //
- cout << roundup5(4.1e-3) << endl; //
+ cout << roundup5(1.1e-3) << endl; //
+ cout << roundup5(0.9e-3) << endl; //
+ cout << roundup5(2.1e-3) << endl; //
+ cout << roundup5(3.1e-3) << endl; //
+ cout << roundup5(4.1e-3) << endl; //
cout << roundup5(7.1e-3) << endl; // 0.01
cout << roundup5(1.1e+3) << endl; // 5000
cout << roundup5(0.9e+3) << endl; // 1000
@@ -124,7 +126,7 @@
100
200
5
-binary roundup10
+binary roundup10
2
1
4
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