1 // Boost.Geometry (aka GGL, Generic Geometry Library)
3 // Copyright (c) 2011-2014 Barend Gehrels, Amsterdam, the Netherlands.
5 // This file was modified by Oracle on 2014.
6 // Modifications copyright (c) 2014, Oracle and/or its affiliates.
8 // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
10 // Use, modification and distribution is subject to the Boost Software License,
11 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
12 // http://www.boost.org/LICENSE_1_0.txt)
14 // Code to create SVG for examples
16 #ifndef CREATE_SVG_ONE_HPP
17 #define CREATE_SVG_ONE_HPP
20 #include <boost/algorithm/string.hpp>
23 # include <boost/geometry/io/svg/svg_mapper.hpp>
26 template <typename Geometry>
27 void create_svg(std::string const& filename, Geometry const& g)
30 std::cout << std::endl << "[$img/algorithms/" << boost::replace_all_copy(filename, ".svg", ".png") << "]" << std::endl << std::endl;
32 typedef typename boost::geometry::point_type<Geometry>::type point_type;
33 std::ofstream svg(filename.c_str());
35 boost::geometry::svg_mapper<point_type> mapper(svg, 400, 400);
38 mapper.map(g, "fill-opacity:0.3;fill:rgb(51,51,153);stroke:rgb(51,51,153);stroke-width:2");
40 boost::ignore_unused(filename, g);
44 // NOTE: convert manually from svg to png using Inkscape ctrl-shift-E
45 // and copy png to html/img/algorithms/
48 #endif // CREATE_SVG_ONE_HPP