]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/geometry/doc/src/examples/algorithms/create_svg_two.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / geometry / doc / src / examples / algorithms / create_svg_two.hpp
CommitLineData
7c673cae
FG
1// Boost.Geometry (aka GGL, Generic Geometry Library)
2
3// Copyright (c) 2011-2012 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 examples
10
11#ifndef CREATE_SVG_TWO_HPP
12#define CREATE_SVG_TWO_HPP
13
14#include <fstream>
15#include <boost/algorithm/string.hpp>
16
17#if defined(HAVE_SVG)
18# include <boost/geometry/io/svg/svg_mapper.hpp>
19#endif
20
21template <typename Geometry1, typename Geometry2>
22void create_svg(std::string const& filename, Geometry1 const& a, Geometry2 const& b)
23{
24#if defined(HAVE_SVG)
25 std::cout << std::endl << "[$img/algorithms/" << boost::replace_all_copy(filename, ".svg", ".png") << "]" << std::endl << std::endl;
26
27 typedef typename boost::geometry::point_type<Geometry1>::type point_type;
28 std::ofstream svg(filename.c_str());
29
30 boost::geometry::svg_mapper<point_type> mapper(svg, 400, 400);
31 mapper.add(a);
32 mapper.add(b);
33
34 mapper.map(a, "fill-opacity:0.5;fill:rgb(153,204,0);stroke:rgb(153,204,0);stroke-width:2");
35 if (boost::geometry::geometry_id<Geometry2>::value == 1)
36 {
37 mapper.map(b, "fill:rgb(255,128,0);stroke:rgb(0,0,100);stroke-width:1");
38 }
39 else
40 {
41 mapper.map(b, "opacity:0.8;fill:none;stroke:rgb(255,128,0);stroke-width:4;stroke-dasharray:1,7;stroke-linecap:round");
42 }
43#else
44 boost::ignore_unused_variable_warning(filename);
45 boost::ignore_unused_variable_warning(a);
46 boost::ignore_unused_variable_warning(b);
47#endif
48}
49
50// NOTE: convert manually from svg to png using Inkscape ctrl-shift-E
51// and copy png to html/img/algorithms/
52
53
54#endif // CREATE_SVG_TWO_HPP
55