]>
Commit | Line | Data |
---|---|---|
11fdf7f2 TL |
1 | // Boost.Geometry (aka GGL, Generic Geometry Library) |
2 | // This file is manually converted from PROJ4 | |
3 | ||
4 | // Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands. | |
5 | ||
20effc67 TL |
6 | // This file was modified by Oracle on 2017-2020. |
7 | // Modifications copyright (c) 2017-2020, Oracle and/or its affiliates. | |
11fdf7f2 TL |
8 | // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle |
9 | ||
10 | // Use, modification and distribution is subject to the Boost Software License, | |
11 | // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at | |
12 | // http://www.boost.org/LICENSE_1_0.txt) | |
13 | ||
14 | // This file is converted from PROJ4, http://trac.osgeo.org/proj | |
15 | // PROJ4 is originally written by Gerald Evenden (then of the USGS) | |
16 | // PROJ4 is maintained by Frank Warmerdam | |
17 | // PROJ4 is converted to Geometry Library by Barend Gehrels (Geodan, Amsterdam) | |
18 | ||
19 | // Original copyright notice: | |
20 | ||
21 | // Permission is hereby granted, free of charge, to any person obtaining a | |
22 | // copy of this software and associated documentation files (the "Software"), | |
23 | // to deal in the Software without restriction, including without limitation | |
24 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, | |
25 | // and/or sell copies of the Software, and to permit persons to whom the | |
26 | // Software is furnished to do so, subject to the following conditions: | |
27 | ||
28 | // The above copyright notice and this permission notice shall be included | |
29 | // in all copies or substantial portions of the Software. | |
30 | ||
31 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | |
32 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
33 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | |
34 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
35 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | |
36 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | |
37 | // DEALINGS IN THE SOFTWARE. | |
38 | ||
39 | #ifndef BOOST_GEOMETRY_PROJECTIONS_PJ_PARAM_HPP | |
40 | #define BOOST_GEOMETRY_PROJECTIONS_PJ_PARAM_HPP | |
41 | ||
42 | ||
20effc67 | 43 | #include <iterator> |
11fdf7f2 | 44 | #include <string> |
20effc67 | 45 | #include <type_traits> |
11fdf7f2 TL |
46 | #include <vector> |
47 | ||
20effc67 TL |
48 | #include <boost/geometry/core/static_assert.hpp> |
49 | ||
92f5a8d4 TL |
50 | #include <boost/geometry/srs/projections/exception.hpp> |
51 | ||
11fdf7f2 TL |
52 | #include <boost/geometry/srs/projections/impl/dms_parser.hpp> |
53 | #include <boost/geometry/srs/projections/impl/projects.hpp> | |
92f5a8d4 TL |
54 | #include <boost/geometry/srs/projections/proj4.hpp> |
55 | #include <boost/geometry/srs/projections/dpar.hpp> | |
56 | #include <boost/geometry/srs/projections/spar.hpp> | |
57 | ||
11fdf7f2 TL |
58 | |
59 | namespace boost { namespace geometry { namespace projections { | |
60 | ||
92f5a8d4 | 61 | |
11fdf7f2 TL |
62 | namespace detail { |
63 | ||
92f5a8d4 TL |
64 | inline bool pj_param_pred(srs::detail::proj4_parameter const& p, std::string const& name) |
65 | { | |
66 | return p.name == name; | |
67 | } | |
11fdf7f2 | 68 | |
20effc67 TL |
69 | template |
70 | < | |
71 | typename T, typename Id, | |
72 | std::enable_if_t<! std::is_convertible<Id, std::string>::value, int> = 0 | |
73 | > | |
74 | inline bool pj_param_pred(srs::dpar::parameter<T> const& p, Id const& id) | |
92f5a8d4 TL |
75 | { |
76 | return p.is_id_equal(id); | |
77 | } | |
11fdf7f2 | 78 | |
92f5a8d4 TL |
79 | /* input exists */ |
80 | template <typename Params, typename Name> | |
81 | inline typename Params::const_iterator | |
82 | pj_param_find(Params const& params, Name const& name) | |
83 | { | |
84 | typedef typename Params::const_iterator iterator; | |
85 | for (iterator it = params.begin(); it != params.end(); it++) | |
86 | { | |
87 | if (pj_param_pred(*it, name)) | |
88 | { | |
89 | //it->used = true; | |
90 | return it; | |
91 | } | |
92 | // TODO: needed for pipeline | |
93 | /*else if (it->name == "step") | |
94 | { | |
95 | return pl.end(); | |
96 | }*/ | |
97 | } | |
98 | ||
99 | return params.end(); | |
100 | } | |
101 | ||
102 | /* | |
103 | template | |
104 | < | |
105 | typename StaticParams, | |
106 | typename IsParamPred, | |
107 | int I = tuples_find_index_if<StaticParams, typename IsParamPred::pred>::value, | |
20effc67 | 108 | int N = geometry::tuples::size<StaticParams>::value |
92f5a8d4 TL |
109 | > |
110 | struct pj_param_find_static | |
11fdf7f2 | 111 | { |
20effc67 | 112 | typedef geometry::tuples::element<I, StaticParams> type; |
92f5a8d4 TL |
113 | typedef const type* result_type; |
114 | static result_type get(StaticParams const& params) | |
11fdf7f2 | 115 | { |
92f5a8d4 | 116 | return boost::addressof(boost::get<I>(params)); |
11fdf7f2 | 117 | } |
92f5a8d4 TL |
118 | }; |
119 | ||
120 | template <typename StaticParams, typename IsParamPred, int N> | |
121 | struct pj_param_find_static<StaticParams, IsParamPred, N> | |
122 | { | |
123 | typedef void type; | |
124 | typedef const type* result_type; | |
125 | static result_type get(StaticParams const& ) { return NULL; } | |
126 | };*/ | |
127 | ||
128 | ||
129 | /* input exists */ | |
130 | template <typename Params, typename Name> | |
131 | inline bool pj_param_exists(Params const& params, Name const& name) | |
132 | { | |
133 | return pj_param_find(params, name) != params.end(); | |
134 | } | |
135 | ||
20effc67 TL |
136 | template <typename Param, typename ...Ps> |
137 | inline bool pj_param_exists(srs::spar::parameters<Ps...> const& ) | |
92f5a8d4 | 138 | { |
f67539c2 | 139 | return geometry::tuples::is_found |
92f5a8d4 | 140 | < |
f67539c2 | 141 | typename geometry::tuples::find_if |
92f5a8d4 | 142 | < |
20effc67 | 143 | srs::spar::parameters<Ps...>, |
92f5a8d4 TL |
144 | srs::spar::detail::is_param<Param>::template pred |
145 | >::type | |
146 | >::value; | |
147 | } | |
148 | ||
20effc67 TL |
149 | template <template <typename> class Param, typename ...Ps> |
150 | inline bool pj_param_exists(srs::spar::parameters<Ps...> const& ) | |
92f5a8d4 | 151 | { |
f67539c2 | 152 | return geometry::tuples::is_found |
92f5a8d4 | 153 | < |
f67539c2 | 154 | typename geometry::tuples::find_if |
92f5a8d4 | 155 | < |
20effc67 | 156 | srs::spar::parameters<Ps...>, |
92f5a8d4 TL |
157 | srs::spar::detail::is_param_t<Param>::template pred |
158 | >::type | |
159 | >::value; | |
160 | } | |
161 | ||
162 | ||
163 | template <typename T> | |
164 | inline void set_value(T & val, srs::detail::proj4_parameter const& p) | |
165 | { | |
166 | val = geometry::str_cast<T>(p.value); | |
167 | } | |
11fdf7f2 | 168 | |
92f5a8d4 TL |
169 | template <typename T, typename T2> |
170 | inline void set_value(T & val, srs::dpar::parameter<T2> const& p) | |
171 | { | |
172 | val = p.template get_value<T>(); | |
173 | } | |
11fdf7f2 | 174 | |
92f5a8d4 TL |
175 | template <typename T> |
176 | inline void set_value_r(T & val, srs::detail::proj4_parameter const& p) | |
177 | { | |
178 | val = dms_parser<T, true>::apply(p.value.c_str()).angle(); | |
179 | } | |
11fdf7f2 TL |
180 | |
181 | template <typename T> | |
92f5a8d4 | 182 | inline void set_value_r(T & val, srs::dpar::parameter<T> const& p) |
11fdf7f2 | 183 | { |
92f5a8d4 TL |
184 | val = p.template get_value<T>() * math::d2r<T>(); |
185 | } | |
11fdf7f2 | 186 | |
92f5a8d4 TL |
187 | template <typename Name> |
188 | inline void check_name(Name const&) | |
189 | { | |
20effc67 TL |
190 | static const bool is_ok = std::is_convertible<Name, std::string>::value |
191 | || std::is_same<Name, srs::dpar::name_i>::value | |
192 | || std::is_same<Name, srs::dpar::name_f>::value | |
193 | || std::is_same<Name, srs::dpar::name_r>::value; | |
194 | BOOST_GEOMETRY_STATIC_ASSERT((is_ok), "Invalid argument.", Name); | |
92f5a8d4 | 195 | } |
11fdf7f2 | 196 | |
92f5a8d4 TL |
197 | |
198 | /* integer input */ | |
199 | template <typename Params, typename Name> | |
200 | inline bool _pj_param_i(Params const& params, Name const& name, int & par) | |
201 | { | |
202 | check_name(name); | |
203 | typename Params::const_iterator it = pj_param_find(params, name); | |
204 | if (it != params.end()) | |
11fdf7f2 | 205 | { |
92f5a8d4 TL |
206 | set_value(par, *it); |
207 | return true; | |
208 | } | |
209 | return false; | |
210 | } | |
211 | ||
212 | /* floating point input */ | |
213 | template <typename T, typename Params, typename Name> | |
214 | inline bool _pj_param_f(Params const& params, Name const& name, T & par) | |
215 | { | |
216 | check_name(name); | |
217 | typename Params::const_iterator it = pj_param_find(params, name); | |
218 | if (it != params.end()) | |
219 | { | |
220 | set_value(par, *it); | |
221 | return true; | |
222 | } | |
223 | return false; | |
224 | } | |
225 | ||
226 | /* radians input */ | |
227 | template <typename T, typename Params, typename Name> | |
228 | inline bool _pj_param_r(Params const& params, Name const& name, T & par) | |
229 | { | |
230 | check_name(name); | |
231 | typename Params::const_iterator it = pj_param_find(params, name); | |
232 | if (it != params.end()) | |
233 | { | |
234 | set_value_r(par, *it); | |
235 | return true; | |
236 | } | |
237 | return false; | |
238 | } | |
239 | ||
240 | /* bool input */ | |
241 | inline bool _pj_get_param_b(srs::detail::proj4_parameters const& pl, std::string const& name) | |
242 | { | |
243 | srs::detail::proj4_parameters::const_iterator it = pj_param_find(pl, name); | |
244 | if (it != pl.end()) | |
245 | { | |
246 | switch (it->value[0]) | |
11fdf7f2 | 247 | { |
92f5a8d4 TL |
248 | case '\0': case 'T': case 't': |
249 | return true; | |
250 | case 'F': case 'f': | |
251 | return false; | |
252 | default: | |
253 | BOOST_THROW_EXCEPTION( projection_exception(error_invalid_boolean_param) ); | |
254 | return false; | |
11fdf7f2 | 255 | } |
92f5a8d4 TL |
256 | } |
257 | return false; | |
258 | } | |
259 | ||
260 | template <typename T> | |
261 | inline bool _pj_get_param_b(srs::dpar::parameters<T> const& pl, srs::dpar::name_be const& name) | |
262 | { | |
263 | bool result = false; | |
264 | typename srs::dpar::parameters<T>::const_iterator it = pj_param_find(pl, name); | |
265 | if (it != pl.end()) | |
266 | set_value(result, *it); | |
267 | return result; | |
268 | } | |
11fdf7f2 | 269 | |
92f5a8d4 TL |
270 | /* string input */ |
271 | inline bool pj_param_s(srs::detail::proj4_parameters const& pl, std::string const& name, std::string & par) | |
272 | { | |
273 | srs::detail::proj4_parameters::const_iterator it = pj_param_find(pl, name); | |
274 | if (it != pl.end()) | |
275 | { | |
276 | par = it->value; | |
277 | return true; | |
278 | } | |
279 | return false; | |
280 | } | |
281 | ||
282 | template | |
283 | < | |
284 | typename Params, | |
285 | template <typename> class IsSamePred, | |
f67539c2 | 286 | int I = geometry::tuples::find_index_if<Params, IsSamePred>::value, |
20effc67 | 287 | int N = geometry::tuples::size<Params>::value |
92f5a8d4 TL |
288 | > |
289 | struct _pj_param_x_static | |
290 | { | |
291 | static const bool result = true; | |
292 | template <typename T> | |
293 | static void apply(Params const& params, T & out) | |
294 | { | |
295 | // TODO: int values could be extracted directly from the type | |
20effc67 | 296 | out = geometry::tuples::get<I>(params).value; |
11fdf7f2 | 297 | } |
92f5a8d4 TL |
298 | }; |
299 | ||
300 | template | |
301 | < | |
302 | typename Params, | |
303 | template <typename> class IsSamePred, | |
304 | int N | |
305 | > | |
306 | struct _pj_param_x_static<Params, IsSamePred, N, N> | |
307 | { | |
308 | static const bool result = false; | |
309 | template <typename T> | |
310 | static void apply(Params const& , T & ) | |
311 | {} | |
312 | }; | |
11fdf7f2 | 313 | |
20effc67 TL |
314 | template <template <int> class Param, typename ...Ps> |
315 | inline bool _pj_param_i(srs::spar::parameters<Ps...> const& params, int & par) | |
92f5a8d4 TL |
316 | { |
317 | typedef _pj_param_x_static | |
318 | < | |
20effc67 | 319 | srs::spar::parameters<Ps...>, |
92f5a8d4 TL |
320 | srs::spar::detail::is_param_i<Param>::template pred |
321 | > impl; | |
322 | impl::apply(params, par); | |
323 | return impl::result; | |
11fdf7f2 TL |
324 | } |
325 | ||
20effc67 TL |
326 | template <template <typename> class Param, typename ...Ps, typename T> |
327 | inline bool _pj_param_f(srs::spar::parameters<Ps...> const& params, T & par) | |
92f5a8d4 TL |
328 | { |
329 | typedef _pj_param_x_static | |
330 | < | |
20effc67 | 331 | srs::spar::parameters<Ps...>, |
92f5a8d4 TL |
332 | srs::spar::detail::is_param_t<Param>::template pred |
333 | > impl; | |
334 | impl::apply(params, par); | |
335 | return impl::result; | |
336 | } | |
337 | ||
20effc67 TL |
338 | template <template <typename> class Param, typename ...Ps, typename T> |
339 | inline bool _pj_param_r(srs::spar::parameters<Ps...> const& params, T & par) | |
92f5a8d4 TL |
340 | { |
341 | typedef _pj_param_x_static | |
342 | < | |
20effc67 | 343 | srs::spar::parameters<Ps...>, |
92f5a8d4 TL |
344 | srs::spar::detail::is_param_t<Param>::template pred |
345 | > impl; | |
346 | impl::apply(params, par); | |
347 | if (impl::result) | |
348 | par *= math::d2r<T>(); | |
349 | return impl::result; | |
350 | } | |
351 | ||
20effc67 TL |
352 | template <typename Param, typename ...Ps> |
353 | inline bool _pj_get_param_b(srs::spar::parameters<Ps...> const& params) | |
92f5a8d4 TL |
354 | { |
355 | return pj_param_exists<Param>(params); | |
356 | } | |
357 | ||
358 | //template <typename T, typename Name, typename Value> | |
359 | //inline bool pj_param_id(srs::dpar::parameters<T> const& pl, Name const& name, Value & par) | |
360 | //{ | |
361 | // typename srs::dpar::parameters<T>::const_iterator it = pj_param_find(pl, name); | |
362 | // if (it != pl.end()) | |
363 | // { | |
364 | // par = static_cast<Value>(it->template get_value<int>()); | |
365 | // return true; | |
366 | // } | |
367 | // return false; | |
368 | //} | |
369 | ||
370 | // NOTE: In the original code, in pl_ell_set.c there is a function pj_get_param | |
371 | // which behavior is similar to pj_param but it doesn't set `user` member to TRUE | |
372 | // while pj_param does in the original code. In Boost.Geometry this member is not used. | |
373 | template <typename Params, typename Name> | |
374 | inline int _pj_get_param_i(Params const& pl, Name const& name) | |
375 | { | |
376 | int res = 0; | |
377 | _pj_param_i(pl, name, res); | |
378 | return res; | |
379 | } | |
380 | ||
381 | template <template <int> class Param, typename Params> | |
382 | inline int _pj_get_param_i(Params const& pl) | |
383 | { | |
384 | int res = 0; | |
385 | _pj_param_i<Param>(pl, res); | |
386 | return res; | |
387 | } | |
388 | ||
389 | template <typename T, typename Params, typename Name> | |
390 | inline T _pj_get_param_f(Params const& pl, Name const& name) | |
391 | { | |
392 | T res = 0; | |
393 | _pj_param_f(pl, name, res); | |
394 | return res; | |
395 | } | |
396 | ||
397 | template <typename T, template <typename> class Param, typename Params> | |
398 | inline T _pj_get_param_f(Params const& pl) | |
399 | { | |
400 | T res = 0; | |
401 | _pj_param_f<Param>(pl, res); | |
402 | return res; | |
403 | } | |
404 | ||
405 | template <typename T, typename Params, typename Name> | |
406 | inline T _pj_get_param_r(Params const& pl, Name const& name) | |
407 | { | |
408 | T res = 0; | |
409 | _pj_param_r(pl, name, res); | |
410 | return res; | |
411 | } | |
412 | ||
413 | template <typename T, template <typename> class Param, typename Params> | |
414 | inline T _pj_get_param_r(Params const& pl) | |
415 | { | |
416 | T res = 0; | |
417 | _pj_param_r<Param>(pl, res); | |
418 | return res; | |
419 | } | |
420 | ||
421 | inline std::string pj_get_param_s(srs::detail::proj4_parameters const& pl, std::string const& name) | |
422 | { | |
423 | std::string res; | |
424 | pj_param_s(pl, name, res); | |
425 | return res; | |
426 | } | |
427 | ||
428 | ||
429 | // ------------------------------------------------------------------------- // | |
430 | ||
431 | template <typename Param, typename Name> | |
432 | inline bool pj_param_exists(srs::detail::proj4_parameters const& pl, | |
433 | std::string const& sn, | |
434 | Name const& ) | |
435 | { | |
436 | return pj_param_exists(pl, sn); | |
437 | } | |
438 | template <template <typename> class Param, typename Name> | |
439 | inline bool pj_param_exists(srs::detail::proj4_parameters const& pl, | |
440 | std::string const& sn, | |
441 | Name const& ) | |
442 | { | |
443 | return pj_param_exists(pl, sn); | |
444 | } | |
445 | template <typename Param, typename T, typename Name> | |
446 | inline bool pj_param_exists(srs::dpar::parameters<T> const& pl, | |
447 | std::string const& , | |
448 | Name const& n) | |
449 | { | |
450 | return pj_param_exists(pl, n); | |
451 | } | |
452 | template <template <typename> class Param, typename T, typename Name> | |
453 | inline bool pj_param_exists(srs::dpar::parameters<T> const& pl, | |
454 | std::string const& , | |
455 | Name const& n) | |
456 | { | |
457 | return pj_param_exists(pl, n); | |
458 | } | |
20effc67 TL |
459 | template <typename Param, typename ...Ps, typename Name> |
460 | inline bool pj_param_exists(srs::spar::parameters<Ps...> const& pl, | |
92f5a8d4 TL |
461 | std::string const& , |
462 | Name const& ) | |
463 | { | |
464 | return pj_param_exists<Param>(pl); | |
465 | } | |
20effc67 TL |
466 | template <template <typename> class Param, typename ...Ps, typename Name> |
467 | inline bool pj_param_exists(srs::spar::parameters<Ps...> const& pl, | |
92f5a8d4 TL |
468 | std::string const& , |
469 | Name const& ) | |
470 | { | |
471 | return pj_param_exists<Param>(pl); | |
472 | } | |
473 | ||
474 | template <typename Param> | |
475 | inline bool pj_get_param_b(srs::detail::proj4_parameters const& pl, | |
476 | std::string const& sn, | |
477 | srs::dpar::name_be const& ) | |
478 | { | |
479 | return _pj_get_param_b(pl, sn); | |
480 | } | |
481 | template <typename Param, typename T> | |
482 | inline bool pj_get_param_b(srs::dpar::parameters<T> const& pl, | |
483 | std::string const& , | |
484 | srs::dpar::name_be const& n) | |
485 | { | |
486 | return _pj_get_param_b(pl, n); | |
487 | } | |
20effc67 TL |
488 | template <typename Param, typename ...Ps> |
489 | inline bool pj_get_param_b(srs::spar::parameters<Ps...> const& pl, | |
92f5a8d4 TL |
490 | std::string const& , |
491 | srs::dpar::name_be const& ) | |
492 | { | |
493 | return _pj_get_param_b<Param>(pl); | |
494 | } | |
495 | ||
496 | //#define BOOST_GEOMETRY_GET_PARAM_B(PARAMS, NAME) pj_get_param_b(PARAMS, #NAME, srs::dpar::NAME) | |
497 | ||
498 | template <template <int> class Param> | |
499 | inline bool pj_param_i(srs::detail::proj4_parameters const& pl, | |
500 | std::string const& sn, | |
501 | srs::dpar::name_i const& , | |
502 | int & par) | |
503 | { | |
504 | return _pj_param_i(pl, sn, par); | |
505 | } | |
506 | template <template <int> class Param, typename T> | |
507 | inline bool pj_param_i(srs::dpar::parameters<T> const& pl, | |
508 | std::string const& , | |
509 | srs::dpar::name_i const& n, | |
510 | int & par) | |
511 | { | |
512 | return _pj_param_i(pl, n, par); | |
513 | } | |
20effc67 TL |
514 | template <template <int> class Param, typename ...Ps> |
515 | inline bool pj_param_i(srs::spar::parameters<Ps...> const& pl, | |
92f5a8d4 TL |
516 | std::string const& , |
517 | srs::dpar::name_i const& , | |
518 | int & par) | |
519 | { | |
520 | return _pj_param_i<Param>(pl, par); | |
521 | } | |
522 | ||
523 | //#define BOOST_GEOMETRY_PARAM_I(PARAMS, NAME, PAR) pj_param_i(PARAMS, #NAME, srs::dpar::NAME, PAR) | |
524 | ||
525 | template <template <int> class Param> | |
526 | inline int pj_get_param_i(srs::detail::proj4_parameters const& pl, | |
527 | std::string const& sn, | |
528 | srs::dpar::name_i const& ) | |
529 | { | |
530 | return _pj_get_param_i(pl, sn); | |
531 | } | |
532 | template <template <int> class Param, typename T> | |
533 | inline int pj_get_param_i(srs::dpar::parameters<T> const& pl, | |
534 | std::string const& , | |
535 | srs::dpar::name_i const& n) | |
536 | { | |
537 | return _pj_get_param_i(pl, n); | |
538 | } | |
20effc67 TL |
539 | template <template <int> class Param, typename ...Ps> |
540 | inline bool pj_get_param_i(srs::spar::parameters<Ps...> const& pl, | |
92f5a8d4 TL |
541 | std::string const& , |
542 | srs::dpar::name_i const& ) | |
543 | { | |
544 | return _pj_get_param_i<Param>(pl); | |
545 | } | |
546 | ||
547 | //#define BOOST_GEOMETRY_GET_PARAM_I(PARAMS, NAME) pj_get_param_i(PARAMS, #NAME, srs::dpar::NAME) | |
548 | ||
549 | template <template <typename> class Param, typename T> | |
550 | inline bool pj_param_f(srs::detail::proj4_parameters const& pl, | |
551 | std::string const& sn, | |
552 | srs::dpar::name_f const& , | |
553 | T & par) | |
554 | { | |
555 | return _pj_param_f(pl, sn, par); | |
556 | } | |
557 | template <template <typename> class Param, typename T> | |
558 | inline bool pj_param_f(srs::dpar::parameters<T> const& pl, | |
559 | std::string const& , | |
560 | srs::dpar::name_f const& n, | |
561 | T & par) | |
562 | { | |
563 | return _pj_param_f(pl, n, par); | |
564 | } | |
20effc67 TL |
565 | template <template <typename> class Param, typename ...Ps, typename T> |
566 | inline bool pj_param_f(srs::spar::parameters<Ps...> const& pl, | |
92f5a8d4 TL |
567 | std::string const& , |
568 | srs::dpar::name_f const& , | |
569 | T & par) | |
570 | { | |
571 | return _pj_param_f<Param>(pl, par); | |
572 | } | |
573 | ||
574 | //#define BOOST_GEOMETRY_PARAM_F(PARAMS, NAME, PAR) pj_param_f(PARAMS, #NAME, srs::dpar::NAME, PAR) | |
575 | ||
576 | template <typename T, template <typename> class Param> | |
577 | inline T pj_get_param_f(srs::detail::proj4_parameters const& pl, | |
578 | std::string const& sn, | |
579 | srs::dpar::name_f const& ) | |
580 | { | |
581 | return _pj_get_param_f<T>(pl, sn); | |
582 | } | |
583 | template <typename T, template <typename> class Param> | |
584 | inline T pj_get_param_f(srs::dpar::parameters<T> const& pl, | |
585 | std::string const& , | |
586 | srs::dpar::name_f const& n) | |
587 | { | |
588 | return _pj_get_param_f<T>(pl, n); | |
589 | } | |
20effc67 TL |
590 | template <typename T, template <typename> class Param, typename ...Ps> |
591 | inline T pj_get_param_f(srs::spar::parameters<Ps...> const& pl, | |
92f5a8d4 TL |
592 | std::string const& , |
593 | srs::dpar::name_f const& ) | |
594 | { | |
595 | return _pj_get_param_f<T, Param>(pl); | |
596 | } | |
597 | ||
598 | ||
599 | //#define BOOST_GEOMETRY_GET_PARAM_F(PARAMS, NAME) pj_get_param_f<T>(PARAMS, #NAME, srs::dpar::NAME) | |
600 | ||
601 | template <template <typename> class Param, typename T> | |
602 | inline bool pj_param_r(srs::detail::proj4_parameters const& pl, | |
603 | std::string const& sn, | |
604 | srs::dpar::name_r const& , | |
605 | T & par) | |
606 | { | |
607 | return _pj_param_r(pl, sn, par); | |
608 | } | |
609 | template <template <typename> class Param, typename T> | |
610 | inline bool pj_param_r(srs::dpar::parameters<T> const& pl, | |
611 | std::string const& , | |
612 | srs::dpar::name_r const& n, | |
613 | T & par) | |
614 | { | |
615 | return _pj_param_r(pl, n, par); | |
616 | } | |
20effc67 TL |
617 | template <template <typename> class Param, typename ...Ps, typename T> |
618 | inline bool pj_param_r(srs::spar::parameters<Ps...> const& pl, | |
92f5a8d4 TL |
619 | std::string const& , |
620 | srs::dpar::name_r const& , | |
621 | T & par) | |
622 | { | |
623 | return _pj_param_r<Param>(pl, par); | |
624 | } | |
625 | ||
626 | //#define BOOST_GEOMETRY_PARAM_R(PARAMS, NAME, PAR) pj_param_r(PARAMS, #NAME, srs::dpar::NAME, PAR) | |
627 | ||
628 | template <typename T, template <typename> class Param> | |
629 | inline T pj_get_param_r(srs::detail::proj4_parameters const& pl, | |
630 | std::string const& sn, | |
631 | srs::dpar::name_r const& ) | |
632 | { | |
633 | return _pj_get_param_r<T>(pl, sn); | |
634 | } | |
635 | template <typename T, template <typename> class Param> | |
636 | inline T pj_get_param_r(srs::dpar::parameters<T> const& pl, | |
637 | std::string const& , | |
638 | srs::dpar::name_r const& n) | |
639 | { | |
640 | return _pj_get_param_r<T>(pl, n); | |
641 | } | |
20effc67 TL |
642 | template <typename T, template <typename> class Param, typename ...Ps> |
643 | inline T pj_get_param_r(srs::spar::parameters<Ps...> const& pl, | |
92f5a8d4 TL |
644 | std::string const& , |
645 | srs::dpar::name_r const& ) | |
646 | { | |
647 | return _pj_get_param_r<T, Param>(pl); | |
648 | } | |
649 | ||
650 | //#define BOOST_GEOMETRY_GET_PARAM_R(PARAMS, NAME) pj_get_param_r<T>(PARAMS, #NAME, srs::dpar::NAME) | |
651 | ||
11fdf7f2 TL |
652 | } // namespace detail |
653 | }}} // namespace boost::geometry::projections | |
654 | ||
655 | #endif |