File indexing completed on 2025-01-18 09:35:21
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018 #ifndef BOOST_GEOMETRY_ALGORITHMS_MAKE_HPP
0019 #define BOOST_GEOMETRY_ALGORITHMS_MAKE_HPP
0020
0021 #include <type_traits>
0022
0023 #include "boost/geometry/algorithms/detail/assign_values.hpp"
0024
0025 #include <boost/geometry/core/make.hpp>
0026
0027 #include <boost/geometry/geometries/concepts/check.hpp>
0028
0029 namespace boost { namespace geometry
0030 {
0031
0032 #ifndef DOXYGEN_NO_DETAIL
0033 namespace detail { namespace make
0034 {
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051 template <typename Geometry, typename Range>
0052 inline Geometry make_points(Range const& range)
0053 {
0054 concepts::check<Geometry>();
0055
0056 Geometry geometry;
0057 geometry::append(geometry, range);
0058 return geometry;
0059 }
0060
0061 }}
0062 #endif
0063
0064
0065
0066
0067
0068
0069
0070
0071
0072
0073
0074
0075
0076
0077
0078
0079
0080
0081
0082
0083
0084 template
0085 <
0086 typename Geometry,
0087 typename Type,
0088 std::enable_if_t<! traits::make<Geometry>::is_specialized, int> = 0
0089 >
0090 inline Geometry make(Type const& c1, Type const& c2)
0091 {
0092 concepts::check<Geometry>();
0093
0094 Geometry geometry;
0095 dispatch::assign
0096 <
0097 typename tag<Geometry>::type,
0098 Geometry,
0099 geometry::dimension<Geometry>::type::value
0100 >::apply(geometry, c1, c2);
0101 return geometry;
0102 }
0103
0104
0105 template
0106 <
0107 typename Geometry,
0108 typename Type,
0109 std::enable_if_t<traits::make<Geometry>::is_specialized, int> = 0
0110 >
0111 constexpr inline Geometry make(Type const& c1, Type const& c2)
0112 {
0113 concepts::check<Geometry>();
0114
0115
0116
0117 return traits::make<Geometry>::apply(c1, c2);
0118 }
0119
0120
0121
0122
0123
0124
0125
0126
0127
0128
0129
0130
0131
0132
0133
0134
0135
0136
0137
0138
0139
0140 template
0141 <
0142 typename Geometry,
0143 typename Type,
0144 std::enable_if_t<! traits::make<Geometry>::is_specialized, int> = 0
0145 >
0146 inline Geometry make(Type const& c1, Type const& c2, Type const& c3)
0147 {
0148 concepts::check<Geometry>();
0149
0150 Geometry geometry;
0151 dispatch::assign
0152 <
0153 typename tag<Geometry>::type,
0154 Geometry,
0155 geometry::dimension<Geometry>::type::value
0156 >::apply(geometry, c1, c2, c3);
0157 return geometry;
0158 }
0159
0160 template
0161 <
0162 typename Geometry,
0163 typename Type,
0164 std::enable_if_t<traits::make<Geometry>::is_specialized, int> = 0
0165 >
0166 constexpr inline Geometry make(Type const& c1, Type const& c2, Type const& c3)
0167 {
0168 concepts::check<Geometry>();
0169
0170
0171
0172 return traits::make<Geometry>::apply(c1, c2, c3);
0173 }
0174
0175
0176 template <typename Geometry, typename Type>
0177 inline Geometry make(Type const& c1, Type const& c2, Type const& c3, Type const& c4)
0178 {
0179 concepts::check<Geometry>();
0180
0181 Geometry geometry;
0182 dispatch::assign
0183 <
0184 typename tag<Geometry>::type,
0185 Geometry,
0186 geometry::dimension<Geometry>::type::value
0187 >::apply(geometry, c1, c2, c3, c4);
0188 return geometry;
0189 }
0190
0191
0192
0193
0194
0195
0196
0197
0198
0199
0200
0201
0202
0203
0204
0205
0206
0207
0208
0209
0210
0211
0212 template <typename Geometry>
0213 inline Geometry make_inverse()
0214 {
0215 concepts::check<Geometry>();
0216
0217 Geometry geometry;
0218 dispatch::assign_inverse
0219 <
0220 typename tag<Geometry>::type,
0221 Geometry
0222 >::apply(geometry);
0223 return geometry;
0224 }
0225
0226
0227
0228
0229
0230
0231
0232
0233 template <typename Geometry>
0234 inline Geometry make_zero()
0235 {
0236 concepts::check<Geometry>();
0237
0238 Geometry geometry;
0239 dispatch::assign_zero
0240 <
0241 typename tag<Geometry>::type,
0242 Geometry
0243 >::apply(geometry);
0244 return geometry;
0245 }
0246
0247 }}
0248
0249 #endif