pj_param.hpp 21 KB

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