Ifdefed some examples for release branch

[SVN r70919]
This commit is contained in:
Barend Gehrels
2011-04-03 07:50:11 +00:00
parent 85810e3132
commit 1431123722
8 changed files with 67 additions and 22 deletions

View File

@@ -16,7 +16,7 @@
#include <boost/geometry/geometry.hpp>
#include <boost/geometry/geometries/geometries.hpp>
#if defined(_MSC_VER)
#if defined(HAVE_TTMATH)
# include <boost/geometry/extensions/contrib/ttmath_stub.hpp>
#endif
@@ -29,7 +29,7 @@ int main()
boost::geometry::model::d2::point_xy<double> p1;
assign(p1, 1.2345, 2.3456);
#if defined(_MSC_VER)
#if defined(HAVE_TTMATH)
boost::geometry::model::d2::point_xy<ttmath::Big<1,4> > p2;
assign(p2, "1.2345", "2.3456"); /*< It is possible to assign coordinates with other types than the coordinate type.
For ttmath, you can e.g. conveniently use strings. The advantage is that it then has higher precision, because
@@ -40,7 +40,7 @@ int main()
std::cout
<< std::setprecision(20)
<< boost::geometry::dsv(p1) << std::endl
#if defined(_MSC_VER)
#if defined(HAVE_TTMATH)
<< boost::geometry::dsv(p2) << std::endl
#endif
;

View File

@@ -13,11 +13,15 @@
#include <fstream>
#include <boost/algorithm/string.hpp>
#include <boost/geometry/extensions/io/svg/svg_mapper.hpp>
#if defined(HAVE_SVG)
# include <boost/geometry/extensions/io/svg/svg_mapper.hpp>
#endif
template <typename Geometry, typename Range>
void create_svg(std::string const& filename, Geometry const& a, Geometry const& b, Range const& range)
{
#if defined(HAVE_SVG)
std::cout << std::endl << "[$img/algorithms/" << boost::replace_all_copy(filename, ".svg", ".png") << "]" << std::endl << std::endl;
typedef typename boost::geometry::point_type<Geometry>::type point_type;
@@ -38,6 +42,7 @@ void create_svg(std::string const& filename, Geometry const& a, Geometry const&
mapper.text(boost::geometry::return_centroid<point_type>(g), out.str(),
"fill:rgb(0,0,0);font-family:Arial;font-size:10px");
}
#endif
}
// NOTE: convert manually from svg to png using Inkscape ctrl-shift-E

View File

@@ -13,11 +13,15 @@
#include <fstream>
#include <boost/algorithm/string.hpp>
#include <boost/geometry/extensions/io/svg/svg_mapper.hpp>
#if defined(HAVE_SVG)
# include <boost/geometry/extensions/io/svg/svg_mapper.hpp>
#endif
template <typename Geometry1, typename Geometry2>
void create_svg(std::string const& filename, Geometry1 const& a, Geometry2 const& b)
{
#if defined(HAVE_SVG)
std::cout << std::endl << "[$img/algorithms/" << boost::replace_all_copy(filename, ".svg", ".png") << "]" << std::endl << std::endl;
typedef typename boost::geometry::point_type<Geometry1>::type point_type;
@@ -36,6 +40,7 @@ void create_svg(std::string const& filename, Geometry1 const& a, Geometry2 const
{
mapper.map(b, "opacity:0.8;fill:none;stroke:rgb(255,128,0);stroke-width:4;stroke-dasharray:1,7;stroke-linecap:round");
}
#endif
}
// NOTE: convert manually from svg to png using Inkscape ctrl-shift-E