Chris@16
|
1 // Boost.Geometry (aka GGL, Generic Geometry Library)
|
Chris@16
|
2
|
Chris@16
|
3 // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
|
Chris@16
|
4 // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
|
Chris@16
|
5 // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
|
Chris@16
|
6
|
Chris@16
|
7 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
|
Chris@16
|
8 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
|
Chris@16
|
9
|
Chris@16
|
10 // Use, modification and distribution is subject to the Boost Software License,
|
Chris@16
|
11 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
Chris@16
|
12 // http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
13
|
Chris@16
|
14 #ifndef BOOST_GEOMETRY_MULTI_IO_DSV_WRITE_HPP
|
Chris@16
|
15 #define BOOST_GEOMETRY_MULTI_IO_DSV_WRITE_HPP
|
Chris@16
|
16
|
Chris@16
|
17 #include <boost/range.hpp>
|
Chris@16
|
18
|
Chris@16
|
19 #include <boost/geometry/multi/core/tags.hpp>
|
Chris@16
|
20 #include <boost/geometry/multi/geometries/concepts/check.hpp>
|
Chris@16
|
21
|
Chris@16
|
22 #include <boost/geometry/io/dsv/write.hpp>
|
Chris@16
|
23
|
Chris@16
|
24 namespace boost { namespace geometry
|
Chris@16
|
25 {
|
Chris@16
|
26
|
Chris@16
|
27 #ifndef DOXYGEN_NO_DETAIL
|
Chris@16
|
28 namespace detail { namespace dsv
|
Chris@16
|
29 {
|
Chris@16
|
30
|
Chris@16
|
31 template <typename MultiGeometry>
|
Chris@16
|
32 struct dsv_multi
|
Chris@16
|
33 {
|
Chris@16
|
34 typedef dispatch::dsv
|
Chris@16
|
35 <
|
Chris@16
|
36 typename single_tag_of
|
Chris@16
|
37 <
|
Chris@16
|
38 typename tag<MultiGeometry>::type
|
Chris@16
|
39 >::type,
|
Chris@16
|
40 typename boost::range_value<MultiGeometry>::type
|
Chris@16
|
41 > dispatch_one;
|
Chris@16
|
42
|
Chris@16
|
43 typedef typename boost::range_iterator
|
Chris@16
|
44 <
|
Chris@16
|
45 MultiGeometry const
|
Chris@16
|
46 >::type iterator;
|
Chris@16
|
47
|
Chris@16
|
48
|
Chris@16
|
49 template <typename Char, typename Traits>
|
Chris@16
|
50 static inline void apply(std::basic_ostream<Char, Traits>& os,
|
Chris@16
|
51 MultiGeometry const& multi,
|
Chris@16
|
52 dsv_settings const& settings)
|
Chris@16
|
53 {
|
Chris@16
|
54 os << settings.list_open;
|
Chris@16
|
55
|
Chris@16
|
56 bool first = true;
|
Chris@16
|
57 for(iterator it = boost::begin(multi);
|
Chris@16
|
58 it != boost::end(multi);
|
Chris@16
|
59 ++it, first = false)
|
Chris@16
|
60 {
|
Chris@16
|
61 os << (first ? "" : settings.list_separator);
|
Chris@16
|
62 dispatch_one::apply(os, *it, settings);
|
Chris@16
|
63 }
|
Chris@16
|
64 os << settings.list_close;
|
Chris@16
|
65 }
|
Chris@16
|
66 };
|
Chris@16
|
67
|
Chris@16
|
68 }} // namespace detail::dsv
|
Chris@16
|
69 #endif // DOXYGEN_NO_DETAIL
|
Chris@16
|
70
|
Chris@16
|
71
|
Chris@16
|
72 #ifndef DOXYGEN_NO_DISPATCH
|
Chris@16
|
73 namespace dispatch
|
Chris@16
|
74 {
|
Chris@16
|
75
|
Chris@16
|
76 template <typename Geometry>
|
Chris@16
|
77 struct dsv<multi_tag, Geometry>
|
Chris@16
|
78 : detail::dsv::dsv_multi<Geometry>
|
Chris@16
|
79 {};
|
Chris@16
|
80
|
Chris@16
|
81 } // namespace dispatch
|
Chris@16
|
82 #endif // DOXYGEN_NO_DISPATCH
|
Chris@16
|
83
|
Chris@16
|
84 }} // namespace boost::geometry
|
Chris@16
|
85
|
Chris@16
|
86 #endif // BOOST_GEOMETRY_MULTI_IO_DSV_WRITE_HPP
|