// Boost.Geometry (aka GGL, Generic Geometry Library) // Copyright (c) 2014-2017, Oracle and/or its affiliates. // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Licensed under the Boost Software License version 1.0. // http://www.boost.org/users/license.html #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_IS_SIMPLE_INTERFACE_HPP #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_IS_SIMPLE_INTERFACE_HPP #include #include #include #include #include #include #include #include namespace boost { namespace geometry { namespace resolve_strategy { struct is_simple { template static inline bool apply(Geometry const& geometry, Strategy const& strategy) { return dispatch::is_simple::apply(geometry, strategy); } template static inline bool apply(Geometry const& geometry, default_strategy) { // NOTE: Currently the strategy is only used for Linear geometries typedef typename strategy::intersection::services::default_strategy < typename cs_tag::type >::type strategy_type; return dispatch::is_simple::apply(geometry, strategy_type()); } }; } // namespace resolve_strategy namespace resolve_variant { template struct is_simple { template static inline bool apply(Geometry const& geometry, Strategy const& strategy) { concepts::check(); return resolve_strategy::is_simple::apply(geometry, strategy); } }; template struct is_simple > { template struct visitor : boost::static_visitor { Strategy const& m_strategy; visitor(Strategy const& strategy) : m_strategy(strategy) {} template bool operator()(Geometry const& geometry) const { return is_simple::apply(geometry, m_strategy); } }; template static inline bool apply(boost::variant const& geometry, Strategy const& strategy) { return boost::apply_visitor(visitor(strategy), geometry); } }; } // namespace resolve_variant /*! \brief \brief_check{is simple} \ingroup is_simple \tparam Geometry \tparam_geometry \tparam Strategy \tparam_strategy{Is_simple} \param geometry \param_geometry \param strategy \param_strategy{is_simple} \return \return_check{is simple} \qbk{distinguish,with strategy} \qbk{[include reference/algorithms/is_simple.qbk]} */ template inline bool is_simple(Geometry const& geometry, Strategy const& strategy) { return resolve_variant::is_simple::apply(geometry, strategy); } /*! \brief \brief_check{is simple} \ingroup is_simple \tparam Geometry \tparam_geometry \param geometry \param_geometry \return \return_check{is simple} \qbk{[include reference/algorithms/is_simple.qbk]} */ template inline bool is_simple(Geometry const& geometry) { return resolve_variant::is_simple::apply(geometry, default_strategy()); } }} // namespace boost::geometry #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_IS_SIMPLE_INTERFACE_HPP