comparison DEPENDENCIES/generic/include/boost/geometry/io/dsv/write.hpp @ 101:c530137014c0

Update Boost headers (1.58.0)
author Chris Cannam
date Mon, 07 Sep 2015 11:12:49 +0100
parents 2665513ce2d3
children
comparison
equal deleted inserted replaced
100:793467b5e61c 101:c530137014c0
1 // Boost.Geometry (aka GGL, Generic Geometry Library) 1 // Boost.Geometry (aka GGL, Generic Geometry Library)
2 2
3 // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. 3 // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
4 // Copyright (c) 2008-2012 Bruno Lalande, Paris, France. 4 // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
5 // Copyright (c) 2009-2012 Mateusz Loskot, London, UK. 5 // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
6 // Copyright (c) 2014 Adam Wulkiewicz, Lodz, Poland.
6 7
7 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library 8 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
8 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. 9 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
9 10
10 // Use, modification and distribution is subject to the Boost Software License, 11 // Use, modification and distribution is subject to the Boost Software License,
18 #include <ostream> 19 #include <ostream>
19 #include <string> 20 #include <string>
20 21
21 #include <boost/concept_check.hpp> 22 #include <boost/concept_check.hpp>
22 #include <boost/range.hpp> 23 #include <boost/range.hpp>
23 #include <boost/typeof/typeof.hpp> 24
25 #include <boost/geometry/algorithms/detail/interior_iterator.hpp>
24 26
25 #include <boost/geometry/core/exterior_ring.hpp> 27 #include <boost/geometry/core/exterior_ring.hpp>
26 #include <boost/geometry/core/interior_rings.hpp> 28 #include <boost/geometry/core/interior_rings.hpp>
27 #include <boost/geometry/core/ring_type.hpp> 29 #include <boost/geometry/core/ring_type.hpp>
28 #include <boost/geometry/core/tag_cast.hpp> 30 #include <boost/geometry/core/tag_cast.hpp>
31 #include <boost/geometry/core/tags.hpp>
29 32
30 #include <boost/geometry/geometries/concepts/check.hpp> 33 #include <boost/geometry/geometries/concepts/check.hpp>
31 34
32 namespace boost { namespace geometry 35 namespace boost { namespace geometry
33 { 36 {
207 210
208 os << settings.list_open; 211 os << settings.list_open;
209 212
210 dsv_range<ring>::apply(os, exterior_ring(poly), settings); 213 dsv_range<ring>::apply(os, exterior_ring(poly), settings);
211 214
212 typename interior_return_type<Polygon const>::type rings 215 typename interior_return_type<Polygon const>::type
213 = interior_rings(poly); 216 rings = interior_rings(poly);
214 for (BOOST_AUTO_TPL(it, boost::begin(rings)); it != boost::end(rings); ++it) 217 for (typename detail::interior_iterator<Polygon const>::type
218 it = boost::begin(rings); it != boost::end(rings); ++it)
215 { 219 {
216 os << settings.list_separator; 220 os << settings.list_separator;
217 dsv_range<ring>::apply(os, *it, settings); 221 dsv_range<ring>::apply(os, *it, settings);
218 } 222 }
219 os << settings.list_close; 223 os << settings.list_close;
337 private: 341 private:
338 Geometry const& m_geometry; 342 Geometry const& m_geometry;
339 dsv_settings m_settings; 343 dsv_settings m_settings;
340 }; 344 };
341 345
346
347 template <typename MultiGeometry>
348 struct dsv_multi
349 {
350 typedef dispatch::dsv
351 <
352 typename single_tag_of
353 <
354 typename tag<MultiGeometry>::type
355 >::type,
356 typename boost::range_value<MultiGeometry>::type
357 > dispatch_one;
358
359 typedef typename boost::range_iterator
360 <
361 MultiGeometry const
362 >::type iterator;
363
364
365 template <typename Char, typename Traits>
366 static inline void apply(std::basic_ostream<Char, Traits>& os,
367 MultiGeometry const& multi,
368 dsv_settings const& settings)
369 {
370 os << settings.list_open;
371
372 bool first = true;
373 for(iterator it = boost::begin(multi);
374 it != boost::end(multi);
375 ++it, first = false)
376 {
377 os << (first ? "" : settings.list_separator);
378 dispatch_one::apply(os, *it, settings);
379 }
380 os << settings.list_close;
381 }
382 };
383
342 }} // namespace detail::dsv 384 }} // namespace detail::dsv
343 #endif // DOXYGEN_NO_DETAIL 385 #endif // DOXYGEN_NO_DETAIL
386
387 // TODO: The alternative to this could be a forward declaration of dispatch::dsv<>
388 // or braking the code into the interface and implementation part
389 #ifndef DOXYGEN_NO_DISPATCH
390 namespace dispatch
391 {
392
393 template <typename Geometry>
394 struct dsv<multi_tag, Geometry>
395 : detail::dsv::dsv_multi<Geometry>
396 {};
397
398 } // namespace dispatch
399 #endif // DOXYGEN_NO_DISPATCH
344 400
345 /*! 401 /*!
346 \brief Main DSV-streaming function 402 \brief Main DSV-streaming function
347 \details DSV stands for Delimiter Separated Values. Geometries can be streamed 403 \details DSV stands for Delimiter Separated Values. Geometries can be streamed
348 as DSV. There are defaults for all separators. 404 as DSV. There are defaults for all separators.