]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/geometry/doc/src/examples/examples_utils/create_svg_buffer.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / geometry / doc / src / examples / examples_utils / create_svg_buffer.hpp
CommitLineData
7c673cae
FG
1// Boost.Geometry (aka GGL, Generic Geometry Library)
2
3// Copyright (c) 2014 Barend Gehrels, Amsterdam, the Netherlands.
4
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)
8
9// Code to create SVG for buffer examples
10
11#ifndef CREATE_SVG_BUFFER_HPP
12#define CREATE_SVG_BUFFER_HPP
13
14#include <fstream>
15
16#if defined(HAVE_SVG)
17# include <boost/geometry/io/svg/svg_mapper.hpp>
18#endif
19
20template <typename Geometry1, typename Geometry2>
21void create_svg_buffer(std::string const& filename, Geometry1 const& original, Geometry2 const& buffer)
22{
23#if defined(HAVE_SVG)
24 typedef typename boost::geometry::point_type<Geometry1>::type point_type;
25 std::ofstream svg(filename.c_str());
26
27 boost::geometry::svg_mapper<point_type> mapper(svg, 400, 400);
28 mapper.add(original);
29 mapper.add(buffer);
30
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");
33
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");
36
37#else
38 boost::ignore_unused_variable_warning(filename);
39 boost::ignore_unused_variable_warning(original);
40 boost::ignore_unused_variable_warning(buffer);
41#endif
42}
43
44// NOTE: convert manually from svg to png using Inkscape ctrl-shift-E
45// and copy png to html/img/...
46
47
48#endif // CREATE_SVG_BUFFER_HPP
49