123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217 |
- #ifndef BOOST_GEOMETRY_CORE_CLOSURE_HPP
- #define BOOST_GEOMETRY_CORE_CLOSURE_HPP
- #include <boost/range/value_type.hpp>
- #include <boost/geometry/core/ring_type.hpp>
- #include <boost/geometry/core/static_assert.hpp>
- #include <boost/geometry/core/tag.hpp>
- #include <boost/geometry/core/tags.hpp>
- #include <boost/geometry/util/type_traits_std.hpp>
- namespace boost { namespace geometry
- {
- enum closure_selector
- {
-
-
- open = 0,
-
- closed = 1,
-
-
- closure_undertermined = -1
- };
- namespace traits
- {
- template <typename G>
- struct closure
- {
- static const closure_selector value = closed;
- };
- }
- #ifndef DOXYGEN_NO_DETAIL
- namespace core_detail { namespace closure
- {
- struct closed
- {
- static const closure_selector value = geometry::closed;
- };
- template <closure_selector Closure>
- struct minimum_ring_size {};
- template <>
- struct minimum_ring_size<geometry::closed>
- : std::integral_constant<std::size_t, 4>
- {};
- template <>
- struct minimum_ring_size<geometry::open>
- : std::integral_constant<std::size_t, 3>
- {};
- }}
- #endif
- #ifndef DOXYGEN_NO_DISPATCH
- namespace core_dispatch
- {
- template <typename Tag, typename Geometry>
- struct closure
- {
- BOOST_GEOMETRY_STATIC_ASSERT_FALSE(
- "Not implemented for this Geometry type.",
- Geometry);
- };
- template <typename Box>
- struct closure<point_tag, Box> : public core_detail::closure::closed {};
- template <typename Box>
- struct closure<box_tag, Box> : public core_detail::closure::closed {};
- template <typename Box>
- struct closure<segment_tag, Box> : public core_detail::closure::closed {};
- template <typename LineString>
- struct closure<linestring_tag, LineString>
- : public core_detail::closure::closed {};
- template <typename Ring>
- struct closure<ring_tag, Ring>
- {
- static const closure_selector value
- = geometry::traits::closure<Ring>::value;
- };
- template <typename Polygon>
- struct closure<polygon_tag, Polygon>
- {
- static const closure_selector value = core_dispatch::closure
- <
- ring_tag,
- typename ring_type<polygon_tag, Polygon>::type
- >::value ;
- };
- template <typename MultiPoint>
- struct closure<multi_point_tag, MultiPoint>
- : public core_detail::closure::closed {};
- template <typename MultiLinestring>
- struct closure<multi_linestring_tag, MultiLinestring>
- : public core_detail::closure::closed {};
- template <typename MultiPolygon>
- struct closure<multi_polygon_tag, MultiPolygon>
- {
- static const closure_selector value = core_dispatch::closure
- <
- polygon_tag,
- typename boost::range_value<MultiPolygon>::type
- >::value ;
- };
- }
- #endif
- template <typename Geometry>
- struct closure
- {
- static const closure_selector value = core_dispatch::closure
- <
- typename tag<Geometry>::type,
- typename util::remove_cptrref<Geometry>::type
- >::value;
- };
- #ifndef DOXYGEN_NO_DETAIL
- namespace detail
- {
- template
- <
- typename Geometry,
- closure_selector Closure = geometry::closure<Geometry>::value
- >
- using minimum_ring_size = core_detail::closure::minimum_ring_size<Closure>;
- }
- #endif
- }}
- #endif
|