File indexing completed on 2025-01-18 09:35:16
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_RELATION_INTERFACE_HPP
0015 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_RELATION_INTERFACE_HPP
0016
0017
0018 #include <boost/geometry/algorithms/detail/relate/interface.hpp>
0019
0020
0021 namespace boost { namespace geometry
0022 {
0023
0024 #ifndef DOXYGEN_NO_DETAIL
0025 namespace detail { namespace relate
0026 {
0027
0028 template <typename Geometry1, typename Geometry2>
0029 struct result_handler_type<Geometry1, Geometry2, geometry::de9im::matrix>
0030 {
0031 typedef matrix_handler<geometry::de9im::matrix> type;
0032 };
0033
0034
0035 }}
0036 #endif
0037
0038 namespace resolve_dynamic
0039 {
0040
0041 template
0042 <
0043 typename Geometry1, typename Geometry2,
0044 typename Tag1 = typename geometry::tag<Geometry1>::type,
0045 typename Tag2 = typename geometry::tag<Geometry2>::type
0046 >
0047 struct relation
0048 {
0049 template <typename Matrix, typename Strategy>
0050 static inline Matrix apply(Geometry1 const& geometry1,
0051 Geometry2 const& geometry2,
0052 Strategy const& strategy)
0053 {
0054 concepts::check<Geometry1 const>();
0055 concepts::check<Geometry2 const>();
0056 assert_dimension_equal<Geometry1, Geometry2>();
0057
0058 typename detail::relate::result_handler_type
0059 <
0060 Geometry1,
0061 Geometry2,
0062 Matrix
0063 >::type handler;
0064
0065 resolve_strategy::relate
0066 <
0067 Strategy
0068 >::apply(geometry1, geometry2, handler, strategy);
0069
0070 return handler.result();
0071 }
0072 };
0073
0074 template <typename Geometry1, typename Geometry2, typename Tag2>
0075 struct relation<Geometry1, Geometry2, dynamic_geometry_tag, Tag2>
0076 {
0077 template <typename Matrix, typename Strategy>
0078 static inline Matrix apply(Geometry1 const& geometry1,
0079 Geometry2 const& geometry2,
0080 Strategy const& strategy)
0081 {
0082 Matrix result;
0083 traits::visit<Geometry1>::apply([&](auto const& g1)
0084 {
0085 result = relation
0086 <
0087 util::remove_cref_t<decltype(g1)>,
0088 Geometry2
0089 >::template apply<Matrix>(g1, geometry2, strategy);
0090 }, geometry1);
0091 return result;
0092 }
0093 };
0094
0095 template <typename Geometry1, typename Geometry2, typename Tag1>
0096 struct relation<Geometry1, Geometry2, Tag1, dynamic_geometry_tag>
0097 {
0098 template <typename Matrix, typename Strategy>
0099 static inline Matrix apply(Geometry1 const& geometry1,
0100 Geometry2 const& geometry2,
0101 Strategy const& strategy)
0102 {
0103 Matrix result;
0104 traits::visit<Geometry2>::apply([&](auto const& g2)
0105 {
0106 result = relation
0107 <
0108 Geometry1,
0109 util::remove_cref_t<decltype(g2)>
0110 >::template apply<Matrix>(geometry1, g2, strategy);
0111 }, geometry2);
0112 return result;
0113 }
0114 };
0115
0116 template <typename Geometry1, typename Geometry2>
0117 struct relation<Geometry1, Geometry2, dynamic_geometry_tag, dynamic_geometry_tag>
0118 {
0119 template <typename Matrix, typename Strategy>
0120 static inline Matrix apply(Geometry1 const& geometry1,
0121 Geometry2 const& geometry2,
0122 Strategy const& strategy)
0123 {
0124 Matrix result;
0125 traits::visit<Geometry1, Geometry2>::apply([&](auto const& g1, auto const& g2)
0126 {
0127 result = relation
0128 <
0129 util::remove_cref_t<decltype(g1)>,
0130 util::remove_cref_t<decltype(g2)>
0131 >::template apply<Matrix>(g1, g2, strategy);
0132 }, geometry1, geometry2);
0133 return result;
0134 }
0135 };
0136
0137 }
0138
0139
0140
0141
0142
0143
0144
0145
0146
0147
0148
0149
0150
0151
0152
0153
0154 template <typename Geometry1, typename Geometry2, typename Strategy>
0155 inline de9im::matrix relation(Geometry1 const& geometry1,
0156 Geometry2 const& geometry2,
0157 Strategy const& strategy)
0158 {
0159 return resolve_dynamic::relation
0160 <
0161 Geometry1,
0162 Geometry2
0163 >::template apply<de9im::matrix>(geometry1, geometry2, strategy);
0164 }
0165
0166
0167
0168
0169
0170
0171
0172
0173
0174
0175
0176
0177
0178 template <typename Geometry1, typename Geometry2>
0179 inline de9im::matrix relation(Geometry1 const& geometry1,
0180 Geometry2 const& geometry2)
0181 {
0182 return resolve_dynamic::relation
0183 <
0184 Geometry1,
0185 Geometry2
0186 >::template apply<de9im::matrix>(geometry1, geometry2, default_strategy());
0187 }
0188
0189
0190 }}
0191
0192 #endif