1 // Boost.Geometry (aka GGL, Generic Geometry Library)
3 // Copyright (c) 2014 Barend Gehrels, Amsterdam, the Netherlands.
5 // Use, modification and distribution is subject to the Boost Software License,
6 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
7 // http://www.boost.org/LICENSE_1_0.txt)
9 // Code to create SVG for buffer examples
11 #ifndef CREATE_SVG_BUFFER_HPP
12 #define CREATE_SVG_BUFFER_HPP
17 # include <boost/geometry/io/svg/svg_mapper.hpp>
20 template <typename Geometry1, typename Geometry2>
21 void create_svg_buffer(std::string const& filename, Geometry1 const& original, Geometry2 const& buffer)
24 typedef typename boost::geometry::point_type<Geometry1>::type point_type;
25 std::ofstream svg(filename.c_str());
27 boost::geometry::svg_mapper<point_type> mapper(svg, 400, 400);
31 // Draw buffer at bottom
32 mapper.map(buffer, "fill-opacity:0.6;fill:rgb(255,255,64);stroke:rgb(255,128,0);stroke-width:3");
34 // Draw original on top
35 mapper.map(original, "fill-opacity:0.6;fill:rgb(51,51,153);stroke:rgb(51,51,153);stroke-width:2");
38 boost::ignore_unused_variable_warning(filename);
39 boost::ignore_unused_variable_warning(original);
40 boost::ignore_unused_variable_warning(buffer);
44 // NOTE: convert manually from svg to png using Inkscape ctrl-shift-E
45 // and copy png to html/img/...
48 #endif // CREATE_SVG_BUFFER_HPP