Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:36:52

0001 // Boost.Geometry
0002 
0003 // Copyright (c) 2017-2020, Oracle and/or its affiliates.
0004 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
0005 
0006 // Use, modification and distribution is subject to the Boost Software License,
0007 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
0008 // http://www.boost.org/LICENSE_1_0.txt)
0009 
0010 #ifndef BOOST_GEOMETRY_STRATEGY_RELATE_HPP
0011 #define BOOST_GEOMETRY_STRATEGY_RELATE_HPP
0012 
0013 
0014 #include <type_traits>
0015 
0016 #include <boost/geometry/core/cs.hpp>
0017 #include <boost/geometry/core/point_type.hpp>
0018 #include <boost/geometry/core/static_assert.hpp>
0019 #include <boost/geometry/core/topological_dimension.hpp>
0020 
0021 #include <boost/geometry/strategies/covered_by.hpp>
0022 #include <boost/geometry/strategies/intersection.hpp>
0023 #include <boost/geometry/strategies/within.hpp>
0024 
0025 
0026 namespace boost { namespace geometry
0027 {
0028 
0029 namespace strategy
0030 {
0031 
0032 namespace point_in_geometry
0033 {
0034 
0035 #ifndef DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
0036 namespace services
0037 {
0038 
0039 template
0040 <
0041     typename Point,
0042     typename Geometry,
0043     typename Tag1 = typename tag<Point>::type,
0044     typename Tag2 = typename tag<Geometry>::type
0045 >
0046 struct default_strategy
0047     : strategy::within::services::default_strategy
0048         <
0049             Point,
0050             Geometry
0051         >
0052 {
0053     typedef typename default_strategy::type within_strategy_type;
0054 
0055     typedef typename strategy::covered_by::services::default_strategy
0056         <
0057             Point,
0058             Geometry
0059         >::type covered_by_strategy_type;
0060 
0061     static const bool same_strategies = std::is_same<within_strategy_type, covered_by_strategy_type>::value;
0062     BOOST_GEOMETRY_STATIC_ASSERT(same_strategies,
0063         "Default within and covered_by strategies not compatible.",
0064         within_strategy_type, covered_by_strategy_type);
0065 };
0066 
0067 template<typename Point, typename Geometry>
0068 struct default_strategy<Point, Geometry, point_tag, point_tag>
0069     : strategy::within::services::default_strategy<Point, Geometry>
0070 {};
0071 
0072 template<typename Point, typename Geometry>
0073 struct default_strategy<Point, Geometry, point_tag, multi_point_tag>
0074     : strategy::within::services::default_strategy<Point, Geometry>
0075 {};
0076 
0077 
0078 } // namespace services
0079 #endif // DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
0080 
0081 
0082 } // namespace point_in_geometry
0083 
0084 namespace relate
0085 {
0086 
0087 #ifndef DOXYGEN_NO_DETAIL
0088 namespace detail
0089 {
0090 
0091 template <typename Geometry>
0092 struct default_intersection_strategy
0093     : strategy::intersection::services::default_strategy
0094         <
0095             typename cs_tag<Geometry>::type
0096         >
0097 {};
0098 
0099 template <typename PointLike, typename Geometry>
0100 struct default_point_in_geometry_strategy
0101     : point_in_geometry::services::default_strategy
0102         <
0103             typename point_type<PointLike>::type,
0104             Geometry
0105         >
0106 {};
0107 
0108 } // namespace detail
0109 #endif // DOXYGEN_NO_DETAIL
0110 
0111 #ifndef DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
0112 namespace services
0113 {
0114 
0115 template
0116 <
0117     typename Geometry1,
0118     typename Geometry2,
0119     int TopDim1 = geometry::topological_dimension<Geometry1>::value,
0120     int TopDim2 = geometry::topological_dimension<Geometry2>::value
0121 >
0122 struct default_strategy
0123 {
0124     BOOST_GEOMETRY_STATIC_ASSERT_FALSE(
0125         "Not implemented for these types.",
0126         Geometry1, Geometry2);
0127 };
0128 
0129 template <typename PointLike1, typename PointLike2>
0130 struct default_strategy<PointLike1, PointLike2, 0, 0>
0131     : detail::default_point_in_geometry_strategy<PointLike1, PointLike2>
0132 {};
0133 
0134 template <typename PointLike, typename Geometry, int TopDim2>
0135 struct default_strategy<PointLike, Geometry, 0, TopDim2>
0136     : detail::default_point_in_geometry_strategy<PointLike, Geometry>
0137 {};
0138 
0139 template <typename Geometry, typename PointLike, int TopDim1>
0140 struct default_strategy<Geometry, PointLike, TopDim1, 0>
0141     : detail::default_point_in_geometry_strategy<PointLike, Geometry>
0142 {};
0143 
0144 template <typename Geometry1, typename Geometry2>
0145 struct default_strategy<Geometry1, Geometry2, 1, 1>
0146     : detail::default_intersection_strategy<Geometry1>
0147 {};
0148 
0149 template <typename Geometry1, typename Geometry2>
0150 struct default_strategy<Geometry1, Geometry2, 1, 2>
0151     : detail::default_intersection_strategy<Geometry1>
0152 {};
0153 
0154 template <typename Geometry1, typename Geometry2>
0155 struct default_strategy<Geometry1, Geometry2, 2, 1>
0156     : detail::default_intersection_strategy<Geometry1>
0157 {};
0158 
0159 template <typename Geometry1, typename Geometry2>
0160 struct default_strategy<Geometry1, Geometry2, 2, 2>
0161     : detail::default_intersection_strategy<Geometry1>
0162 {};
0163 
0164 } // namespace services
0165 #endif // DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
0166 
0167 } // namespace relate
0168 
0169 } // namespace strategy
0170 
0171 
0172 }} // namespace boost::geometry
0173 
0174 
0175 #endif // BOOST_GEOMETRY_STRATEGY_RELATE_HPP