// Boost.Geometry (aka GGL, Generic Geometry Library) // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK. // This file was modified by Oracle on 2014. // Modifications copyright (c) 2014 Oracle and/or its affiliates. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_GEOMETRY_CORE_CLOSURE_HPP #define BOOST_GEOMETRY_CORE_CLOSURE_HPP #include #include #include #include #include #include #include namespace boost { namespace geometry { /*! \brief Enumerates options for defining if polygons are open or closed \ingroup enum \details The enumeration closure_selector describes options for if a polygon is open or closed. In a closed polygon the very first point (per ring) should be equal to the very last point. The specific closing property of a polygon type is defined by the closure metafunction. The closure metafunction defines a value, which is one of the values enumerated in the closure_selector \qbk{ [heading See also] [link geometry.reference.core.closure The closure metafunction] } */ enum closure_selector { /// Rings are open: first point and last point are different, algorithms /// close them explicitly on the fly open = 0, /// Rings are closed: first point and last point must be the same closed = 1, /// (Not yet implemented): algorithms first figure out if ring must be /// closed on the fly closure_undertermined = -1 }; namespace traits { /*! \brief Traits class indicating if points within a ring or (multi)polygon are closed (last point == first point), open or not known. \ingroup traits \par Geometries: - ring \tparam G geometry */ template struct closure { static const closure_selector value = closed; }; } // namespace traits #ifndef DOXYGEN_NO_DETAIL namespace core_detail { namespace closure { struct closed { static const closure_selector value = geometry::closed; }; /// Metafunction to define the minimum size of a ring: /// 3 for open rings, 4 for closed rings template struct minimum_ring_size {}; template <> struct minimum_ring_size : boost::mpl::size_t<4> {}; template <> struct minimum_ring_size : boost::mpl::size_t<3> {}; }} // namespace detail::point_order #endif // DOXYGEN_NO_DETAIL #ifndef DOXYGEN_NO_DISPATCH namespace core_dispatch { template struct closure { BOOST_MPL_ASSERT_MSG ( false, NOT_IMPLEMENTED_FOR_THIS_GEOMETRY_TYPE , (types) ); }; template struct closure : public core_detail::closure::closed {}; template struct closure : public core_detail::closure::closed {}; template struct closure : public core_detail::closure::closed {}; template struct closure : public core_detail::closure::closed {}; template struct closure { static const closure_selector value = geometry::traits::closure::value; }; // Specialization for Polygon: the closure is the closure of its rings template struct closure { static const closure_selector value = core_dispatch::closure < ring_tag, typename ring_type::type >::value ; }; template struct closure : public core_detail::closure::closed {}; template struct closure : public core_detail::closure::closed {}; // Specialization for MultiPolygon: the closure is the closure of Polygon's rings template struct closure { static const closure_selector value = core_dispatch::closure < polygon_tag, typename boost::range_value::type >::value ; }; } // namespace core_dispatch #endif // DOXYGEN_NO_DISPATCH /*! \brief \brief_meta{value, closure (clockwise\, counterclockwise), \meta_geometry_type} \tparam Geometry \tparam_geometry \ingroup core \qbk{[include reference/core/closure.qbk]} */ template struct closure { static const closure_selector value = core_dispatch::closure < typename tag::type, typename util::bare_type::type >::value; }; }} // namespace boost::geometry #endif // BOOST_GEOMETRY_CORE_CLOSURE_HPP