123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 |
- #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_CONVERT_RING_HPP
- #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_CONVERT_RING_HPP
- #include <boost/range/algorithm/reverse.hpp>
- #include <boost/geometry/algorithms/convert.hpp>
- #include <boost/geometry/algorithms/num_points.hpp>
- #include <boost/geometry/core/exterior_ring.hpp>
- #include <boost/geometry/core/interior_rings.hpp>
- #include <boost/geometry/core/static_assert.hpp>
- #include <boost/geometry/core/tags.hpp>
- namespace boost { namespace geometry
- {
- #ifndef DOXYGEN_NO_DETAIL
- namespace detail { namespace overlay
- {
- template<typename Tag>
- struct convert_ring
- {
- BOOST_GEOMETRY_STATIC_ASSERT_FALSE(
- "Not or not yet implemented for this geometry Tag.",
- Tag);
- };
- template<>
- struct convert_ring<ring_tag>
- {
- template<typename Destination, typename Source>
- static inline void apply(Destination& destination, Source const& source,
- bool append, bool reverse)
- {
- if (! append)
- {
- geometry::convert(source, destination);
- if (reverse)
- {
- boost::reverse(destination);
- }
- }
- }
- };
- template<>
- struct convert_ring<polygon_tag>
- {
- template<typename Destination, typename Source>
- static inline void apply(Destination& destination, Source const& source,
- bool append, bool reverse)
- {
- if (! append)
- {
- geometry::convert(source, exterior_ring(destination));
- if (reverse)
- {
- boost::reverse(exterior_ring(destination));
- }
- }
- else
- {
-
-
- std::size_t const min_num_points
- = core_detail::closure::minimum_ring_size
- <
- geometry::closure<Destination>::value
- >::value;
- if (geometry::num_points(source) >= min_num_points)
- {
-
- interior_rings(destination).resize(
- interior_rings(destination).size() + 1);
- geometry::convert(source, interior_rings(destination).back());
- if (reverse)
- {
- boost::reverse(interior_rings(destination).back());
- }
- }
- }
- }
- };
- }}
- #endif
- }}
- #endif
|