write_svg_multi.hpp 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. // Boost.Geometry (aka GGL, Generic Geometry Library)
  2. // Copyright (c) 2009-2012 Barend Gehrels, Amsterdam, the Netherlands.
  3. // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
  4. // (geolib/GGL), copyright (c) 1995-2010 Geodan, 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)
  8. #ifndef BOOST_GEOMETRY_IO_SVG_WRITE_SVG_MULTI_HPP
  9. #define BOOST_GEOMETRY_IO_SVG_WRITE_SVG_MULTI_HPP
  10. #include <boost/geometry/io/svg/write_svg.hpp>
  11. namespace boost { namespace geometry
  12. {
  13. #ifndef DOXYGEN_NO_DETAIL
  14. namespace detail { namespace svg
  15. {
  16. template <typename MultiGeometry, typename Policy>
  17. struct svg_multi
  18. {
  19. template <typename Char, typename Traits>
  20. static inline void apply(std::basic_ostream<Char, Traits>& os,
  21. MultiGeometry const& multi, std::string const& style, int size)
  22. {
  23. for (typename boost::range_iterator<MultiGeometry const>::type
  24. it = boost::begin(multi);
  25. it != boost::end(multi);
  26. ++it)
  27. {
  28. Policy::apply(os, *it, style, size);
  29. }
  30. }
  31. };
  32. }} // namespace detail::svg
  33. #endif // DOXYGEN_NO_DETAIL
  34. #ifndef DOXYGEN_NO_DISPATCH
  35. namespace dispatch
  36. {
  37. template <typename MultiPolygon>
  38. struct svg<multi_polygon_tag, MultiPolygon>
  39. : detail::svg::svg_multi
  40. <
  41. MultiPolygon,
  42. detail::svg::svg_poly
  43. <
  44. typename boost::range_value<MultiPolygon>::type
  45. >
  46. >
  47. {};
  48. } // namespace dispatch
  49. #endif // DOXYGEN_NO_DISPATCH
  50. }} // namespace boost::geometry
  51. #endif // BOOST_GEOMETRY_IO_SVG_WRITE_SVG_MULTI_HPP