dpar.hpp 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882
  1. // Boost.Geometry
  2. // Copyright (c) 2017-2022, Oracle and/or its affiliates.
  3. // Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
  4. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
  5. // Use, modification and distribution is subject to the Boost Software License,
  6. // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  7. // http://www.boost.org/LICENSE_1_0.txt)
  8. #ifndef BOOST_GEOMETRY_SRS_PROJECTIONS_DPAR_HPP
  9. #define BOOST_GEOMETRY_SRS_PROJECTIONS_DPAR_HPP
  10. #include <string>
  11. #include <type_traits>
  12. #include <vector>
  13. #include <boost/geometry/core/radius.hpp>
  14. #include <boost/geometry/core/tag.hpp>
  15. #include <boost/geometry/core/tags.hpp>
  16. #include <boost/geometry/srs/projections/exception.hpp>
  17. #include <boost/geometry/srs/projections/par_data.hpp>
  18. #include <boost/geometry/srs/sphere.hpp>
  19. #include <boost/geometry/srs/spheroid.hpp>
  20. #include <boost/geometry/util/range.hpp>
  21. #include <boost/range/begin.hpp>
  22. #include <boost/range/end.hpp>
  23. #include <boost/range/size.hpp>
  24. #include <boost/range/value_type.hpp>
  25. #include <boost/tuple/tuple.hpp>
  26. #include <boost/variant/variant.hpp>
  27. namespace boost { namespace geometry { namespace srs
  28. {
  29. namespace detail
  30. {
  31. template <typename T, int I, typename ...>
  32. struct find_type_index_impl
  33. : std::integral_constant<int, I>
  34. {};
  35. template
  36. <
  37. typename T,
  38. int I,
  39. typename Type,
  40. typename ...Types
  41. >
  42. struct find_type_index_impl<T, I, Type, Types...>
  43. : std::conditional_t
  44. <
  45. std::is_same<T, Type>::value,
  46. std::integral_constant<int, I>,
  47. typename find_type_index_impl<T, I + 1, Types...>::type
  48. >
  49. {};
  50. template <typename Variant, typename T>
  51. struct find_type_index
  52. {};
  53. template <BOOST_VARIANT_ENUM_PARAMS(typename T), typename T>
  54. struct find_type_index<boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)>, T>
  55. : find_type_index_impl<T, 0, BOOST_VARIANT_ENUM_PARAMS(T)>
  56. {};
  57. template
  58. <
  59. typename Range,
  60. typename ToValue,
  61. bool IsRange = range::detail::is_range<Range>::value
  62. >
  63. struct is_convertible_range
  64. : std::is_convertible
  65. <
  66. typename boost::range_value<Range>::type,
  67. ToValue
  68. >
  69. {};
  70. template
  71. <
  72. typename Range,
  73. typename ToValue
  74. >
  75. struct is_convertible_range<Range, ToValue, false>
  76. : std::false_type
  77. {};
  78. } // namespace detail
  79. namespace dpar
  80. {
  81. enum value_datum
  82. {
  83. datum_wgs84 = 0,
  84. datum_ggrs87,
  85. datum_nad83,
  86. datum_nad27,
  87. datum_potsdam,
  88. datum_carthage,
  89. datum_hermannskogel,
  90. datum_ire65,
  91. datum_nzgd49,
  92. datum_osgb36,
  93. };
  94. enum value_ellps
  95. {
  96. ellps_merit = 0,
  97. ellps_sgs85,
  98. ellps_grs80,
  99. ellps_iau76,
  100. ellps_airy,
  101. ellps_apl4_9,
  102. ellps_nwl9d,
  103. ellps_mod_airy,
  104. ellps_andrae,
  105. ellps_aust_sa,
  106. ellps_grs67,
  107. ellps_bessel,
  108. ellps_bess_nam,
  109. ellps_clrk66,
  110. ellps_clrk80,
  111. ellps_clrk80ign,
  112. ellps_cpm,
  113. ellps_delmbr,
  114. ellps_engelis,
  115. ellps_evrst30,
  116. ellps_evrst48,
  117. ellps_evrst56,
  118. ellps_evrst69,
  119. ellps_evrstss,
  120. ellps_fschr60,
  121. ellps_fschr60m,
  122. ellps_fschr68,
  123. ellps_helmert,
  124. ellps_hough,
  125. ellps_intl,
  126. ellps_krass,
  127. ellps_kaula,
  128. ellps_lerch,
  129. ellps_mprts,
  130. ellps_new_intl,
  131. ellps_plessis,
  132. ellps_seasia,
  133. ellps_walbeck,
  134. ellps_wgs60,
  135. ellps_wgs66,
  136. ellps_wgs72,
  137. ellps_wgs84,
  138. ellps_sphere
  139. };
  140. enum value_mode
  141. {
  142. mode_plane = 0,
  143. mode_di,
  144. mode_dd,
  145. mode_hex
  146. };
  147. enum value_orient
  148. {
  149. orient_isea = 0,
  150. orient_pole,
  151. };
  152. enum value_pm
  153. {
  154. pm_greenwich = 0,
  155. pm_lisbon,
  156. pm_paris,
  157. pm_bogota,
  158. pm_madrid,
  159. pm_rome,
  160. pm_bern,
  161. pm_jakarta,
  162. pm_ferro,
  163. pm_brussels,
  164. pm_stockholm,
  165. pm_athens,
  166. pm_oslo
  167. };
  168. enum value_proj
  169. {
  170. proj_unknown = 0,
  171. proj_aea, proj_leac,
  172. proj_aeqd,
  173. proj_airy,
  174. proj_aitoff, proj_wintri,
  175. proj_august,
  176. proj_apian, proj_ortel, proj_bacon,
  177. proj_bipc,
  178. proj_boggs,
  179. proj_bonne,
  180. proj_cass,
  181. proj_cc,
  182. proj_cea,
  183. proj_chamb,
  184. proj_col_urban,
  185. proj_collg,
  186. proj_crast,
  187. proj_denoy,
  188. proj_eck1,
  189. proj_eck2,
  190. proj_eck3, proj_putp1, proj_wag6, proj_kav7,
  191. proj_eck4,
  192. proj_eck5,
  193. proj_eqc,
  194. proj_eqdc,
  195. proj_etmerc, proj_utm,
  196. proj_fahey,
  197. proj_fouc_s,
  198. proj_gall,
  199. proj_geocent,
  200. proj_geos,
  201. proj_gins8,
  202. proj_gn_sinu, proj_sinu, proj_eck6, proj_mbtfps,
  203. proj_gnom,
  204. proj_goode,
  205. proj_gstmerc,
  206. proj_hammer,
  207. proj_hatano,
  208. proj_healpix,
  209. proj_rhealpix,
  210. proj_igh,
  211. proj_imw_p,
  212. proj_isea,
  213. proj_krovak,
  214. proj_labrd,
  215. proj_laea,
  216. proj_lagrng,
  217. proj_larr,
  218. proj_lask,
  219. proj_lonlat, proj_latlon, proj_latlong, proj_longlat,
  220. proj_lcc,
  221. proj_lcca,
  222. proj_loxim,
  223. proj_lsat,
  224. proj_mbt_fps,
  225. proj_mbtfpp,
  226. proj_mbtfpq,
  227. proj_merc,
  228. proj_mill,
  229. proj_mil_os, proj_lee_os, proj_gs48, proj_alsk, proj_gs50,
  230. proj_moll, proj_wag4, proj_wag5,
  231. proj_natearth,
  232. proj_nell,
  233. proj_nell_h,
  234. proj_nicol,
  235. proj_nsper, proj_tpers,
  236. proj_nzmg,
  237. proj_ob_tran,
  238. proj_ocea,
  239. proj_oea,
  240. proj_omerc,
  241. proj_ortho,
  242. proj_poly,
  243. proj_putp2,
  244. proj_putp3, proj_putp3p,
  245. proj_putp4p, proj_weren,
  246. proj_putp5, proj_putp5p,
  247. proj_putp6, proj_putp6p,
  248. proj_qsc,
  249. proj_robin,
  250. proj_rouss,
  251. proj_rpoly,
  252. proj_euler, proj_murd1, proj_murd2, proj_murd3, proj_pconic, proj_tissot, proj_vitk1,
  253. proj_somerc,
  254. proj_stere, proj_ups,
  255. proj_sterea,
  256. proj_kav5, proj_qua_aut, proj_fouc, proj_mbt_s,
  257. proj_tcc,
  258. proj_tcea,
  259. proj_tmerc,
  260. proj_tpeqd,
  261. proj_urm5,
  262. proj_urmfps, proj_wag1,
  263. proj_vandg,
  264. proj_vandg2, proj_vandg3,
  265. proj_vandg4,
  266. proj_wag2,
  267. proj_wag3,
  268. proj_wag7,
  269. proj_webmerc,
  270. proj_wink1,
  271. proj_wink2
  272. };
  273. enum value_sweep
  274. {
  275. sweep_x = 0, sweep_y
  276. };
  277. enum value_units
  278. {
  279. units_km = 0,
  280. units_m,
  281. units_dm,
  282. units_cm,
  283. units_mm,
  284. units_kmi,
  285. units_in,
  286. units_ft,
  287. units_yd,
  288. units_mi,
  289. units_fath,
  290. units_ch,
  291. units_link,
  292. units_us_in,
  293. units_us_ft,
  294. units_us_yd,
  295. units_us_ch,
  296. units_us_mi,
  297. units_ind_yd,
  298. units_ind_ft,
  299. units_ind_ch
  300. };
  301. enum name_f
  302. {
  303. a = 0,
  304. b,
  305. e,
  306. es,
  307. f,
  308. h,
  309. h_0,
  310. k = 7,
  311. k_0,
  312. m, // also used for M
  313. n,
  314. //phdg_0, // currently not used
  315. //plat_0, // currently not used
  316. //plon_0, // currently not used
  317. q = 14,
  318. r, // originally R
  319. rf,
  320. to_meter,
  321. vto_meter,
  322. w, // originally W
  323. x_0,
  324. y_0
  325. };
  326. enum name_r
  327. {
  328. alpha = 22,
  329. azi,
  330. gamma,
  331. lat_0,
  332. lat_1,
  333. lat_2,
  334. lat_3,
  335. lat_b,
  336. lat_ts, // 30
  337. lon_0,
  338. lon_1,
  339. lon_2,
  340. lon_3,
  341. lon_wrap,
  342. lonc,
  343. o_alpha,
  344. o_lat_1,
  345. o_lat_2,
  346. o_lat_c, // 40
  347. o_lat_p,
  348. o_lon_1,
  349. o_lon_2,
  350. o_lon_c,
  351. o_lon_p,
  352. r_lat_a, // originally R_lat_a
  353. r_lat_g, // originally R_lat_g
  354. theta,
  355. tilt
  356. };
  357. enum name_i
  358. {
  359. aperture = 50,
  360. lsat,
  361. north_square,
  362. path,
  363. resolution,
  364. south_square,
  365. zone
  366. };
  367. enum name_be
  368. {
  369. czech = 57,
  370. geoc,
  371. guam,
  372. no_cut, // 60
  373. no_defs,
  374. no_rot,
  375. ns,
  376. over,
  377. r_au, // originally R_A
  378. r_a, // originally R_a
  379. r_g, // originally R_g
  380. r_h, // originally R_h
  381. r_v, // originally R_V
  382. rescale, // 70
  383. south,
  384. variant_c, // BG specific
  385. no_off,
  386. hyperbolic
  387. };
  388. /*enum name_catalog
  389. {
  390. catalog = 72 // currently not used
  391. };
  392. enum name_date
  393. {
  394. date = 73 // currently not used
  395. };*/
  396. enum name_datum
  397. {
  398. datum = 74
  399. };
  400. enum name_ellps
  401. {
  402. ellps = 75 // id, sphere or spheroid
  403. };
  404. /*enum name_geoidgrids
  405. {
  406. geoidgrids = 76 // currently not used
  407. };*/
  408. enum name_mode
  409. {
  410. mode = 77
  411. };
  412. enum name_nadgrids
  413. {
  414. nadgrids = 78 // arbitrary-length list of strings
  415. };
  416. enum name_orient
  417. {
  418. orient = 79
  419. };
  420. enum name_pm
  421. {
  422. pm = 80 // id or angle
  423. };
  424. enum name_proj
  425. {
  426. o_proj = 81,
  427. proj
  428. };
  429. enum name_sweep
  430. {
  431. sweep = 83
  432. };
  433. enum name_towgs84
  434. {
  435. towgs84 = 84 // 3 or 7 element list of numbers
  436. };
  437. enum name_units
  438. {
  439. units = 85,
  440. vunits
  441. };
  442. enum name_axis
  443. {
  444. axis = 86 // 3 element list of numbers
  445. };
  446. template <typename T>
  447. struct parameter
  448. {
  449. parameter()
  450. : m_id(-1), m_value(false)
  451. {}
  452. parameter(name_f id, T const& v)
  453. : m_id(id), m_value(v)
  454. {}
  455. // TODO various angle units
  456. parameter(name_r id, T const& v)
  457. : m_id(id), m_value(v)
  458. {}
  459. parameter(name_i id, int v)
  460. : m_id(id), m_value(v)
  461. {}
  462. parameter(name_be id)
  463. : m_id(id), m_value(true)
  464. {}
  465. parameter(name_be id, bool v)
  466. : m_id(id), m_value(v)
  467. {}
  468. parameter(name_datum id, value_datum v)
  469. : m_id(id), m_value(int(v))
  470. {}
  471. parameter(value_datum v)
  472. : m_id(datum), m_value(int(v))
  473. {}
  474. // TODO: store model at this point?
  475. parameter(name_ellps id, value_ellps v)
  476. : m_id(id), m_value(int(v))
  477. {}
  478. // TODO: store model at this point?
  479. parameter(value_ellps v)
  480. : m_id(ellps), m_value(int(v))
  481. {}
  482. template
  483. <
  484. typename Sphere,
  485. std::enable_if_t
  486. <
  487. std::is_same<typename geometry::tag<Sphere>::type, srs_sphere_tag>::value,
  488. int
  489. > = 0
  490. >
  491. parameter(name_ellps id, Sphere const& v)
  492. : m_id(id)
  493. , m_value(T(get_radius<0>(v)))
  494. {}
  495. template
  496. <
  497. typename Spheroid,
  498. std::enable_if_t
  499. <
  500. std::is_same<typename geometry::tag<Spheroid>::type, srs_spheroid_tag>::value,
  501. int
  502. > = 0
  503. >
  504. parameter(name_ellps id, Spheroid const& v)
  505. : m_id(id)
  506. , m_value(srs::spheroid<T>(get_radius<0>(v), get_radius<2>(v)))
  507. {}
  508. parameter(name_mode id, value_mode v)
  509. : m_id(id), m_value(int(v))
  510. {}
  511. parameter(value_mode v)
  512. : m_id(mode), m_value(int(v))
  513. {}
  514. template
  515. <
  516. typename Range,
  517. std::enable_if_t
  518. <
  519. detail::is_convertible_range<Range const, std::string>::value,
  520. int
  521. > = 0
  522. >
  523. parameter(name_nadgrids id, Range const& v)
  524. : m_id(id)
  525. , m_value(srs::detail::nadgrids(boost::begin(v), boost::end(v)))
  526. {}
  527. #ifndef BOOST_NO_CXX11_HDR_INITIALIZER_LIST
  528. parameter(name_nadgrids id, std::initializer_list<std::string> v)
  529. : m_id(id)
  530. , m_value(srs::detail::nadgrids(v))
  531. {}
  532. #endif
  533. parameter(name_orient id, value_orient v)
  534. : m_id(id), m_value(int(v))
  535. {}
  536. parameter(value_orient v)
  537. : m_id(orient), m_value(int(v))
  538. {}
  539. // TODO: store to_meters at this point?
  540. parameter(name_pm id, value_pm v)
  541. : m_id(id), m_value(int(v))
  542. {}
  543. // TODO: store to_meters at this point?
  544. parameter(value_pm v)
  545. : m_id(pm), m_value(int(v))
  546. {}
  547. // TODO angle units
  548. parameter(name_pm id, T const& v)
  549. : m_id(id), m_value(v)
  550. {}
  551. parameter(name_proj id, value_proj v)
  552. : m_id(id), m_value(int(v))
  553. {}
  554. parameter(value_proj v)
  555. : m_id(proj), m_value(int(v))
  556. {}
  557. parameter(name_sweep id, value_sweep v)
  558. : m_id(id), m_value(int(v))
  559. {}
  560. parameter(value_sweep v)
  561. : m_id(sweep), m_value(int(v))
  562. {}
  563. template
  564. <
  565. typename Range,
  566. std::enable_if_t
  567. <
  568. detail::is_convertible_range<Range const, T>::value,
  569. int
  570. > = 0
  571. >
  572. parameter(name_towgs84 id, Range const& v)
  573. : m_id(id)
  574. , m_value(srs::detail::towgs84<T>(boost::begin(v), boost::end(v)))
  575. {
  576. std::size_t n = boost::size(v);
  577. if (n != 3 && n != 7)
  578. {
  579. BOOST_THROW_EXCEPTION( projection_exception("Invalid number of towgs84 elements. Should be 3 or 7.") );
  580. }
  581. }
  582. #ifndef BOOST_NO_CXX11_HDR_INITIALIZER_LIST
  583. parameter(name_towgs84 id, std::initializer_list<T> v)
  584. : m_id(id)
  585. , m_value(srs::detail::towgs84<T>(v))
  586. {
  587. std::size_t n = v.size();
  588. if (n != 3 && n != 7)
  589. {
  590. BOOST_THROW_EXCEPTION( projection_exception("Invalid number of towgs84 elements. Should be 3 or 7.") );
  591. }
  592. }
  593. #endif
  594. parameter(name_axis id, std::initializer_list<int> v)
  595. : m_id(id)
  596. , m_value(srs::detail::axis(v))
  597. {
  598. std::size_t n = v.size();
  599. if (n != 3)
  600. {
  601. BOOST_THROW_EXCEPTION( projection_exception("Invalid number of axis elements. Should be 3.") );
  602. }
  603. }
  604. parameter(name_units id, value_units v)
  605. : m_id(id), m_value(int(v))
  606. {}
  607. parameter(value_units v)
  608. : m_id(units), m_value(int(v))
  609. {}
  610. private:
  611. typedef boost::variant
  612. <
  613. bool,
  614. int,
  615. T,
  616. srs::spheroid<T>,
  617. srs::detail::nadgrids,
  618. srs::detail::towgs84<T>
  619. > variant_type;
  620. public:
  621. bool is_id_equal(name_f const& id) const { return m_id == int(id); }
  622. bool is_id_equal(name_r const& id) const { return m_id == int(id); }
  623. bool is_id_equal(name_i const& id) const { return m_id == int(id); }
  624. bool is_id_equal(name_be const& id) const { return m_id == int(id); }
  625. bool is_id_equal(name_datum const& id) const { return m_id == int(id); }
  626. bool is_id_equal(name_ellps const& id) const { return m_id == int(id); }
  627. bool is_id_equal(name_mode const& id) const { return m_id == int(id); }
  628. bool is_id_equal(name_nadgrids const& id) const { return m_id == int(id); }
  629. bool is_id_equal(name_orient const& id) const { return m_id == int(id); }
  630. bool is_id_equal(name_pm const& id) const { return m_id == int(id); }
  631. bool is_id_equal(name_proj const& id) const { return m_id == int(id); }
  632. bool is_id_equal(name_sweep const& id) const { return m_id == int(id); }
  633. bool is_id_equal(name_towgs84 const& id) const { return m_id == int(id); }
  634. bool is_id_equal(name_units const& id) const { return m_id == int(id); }
  635. bool is_id_equal(name_axis const& id) const { return m_id == int(id); }
  636. template <typename V>
  637. V const& get_value() const
  638. {
  639. return boost::get<V>(m_value);
  640. }
  641. template <typename V>
  642. bool is_value_set() const
  643. {
  644. return m_value.which() == srs::detail::find_type_index<variant_type, V>::value;
  645. }
  646. private:
  647. int m_id;
  648. variant_type m_value;
  649. };
  650. template <typename T = double>
  651. class parameters
  652. {
  653. typedef std::vector<parameter<T> > container_type;
  654. public:
  655. typedef typename container_type::value_type value_type;
  656. typedef typename container_type::const_iterator const_iterator;
  657. typedef typename container_type::const_reference const_reference;
  658. typedef typename container_type::size_type size_type;
  659. BOOST_DEFAULTED_FUNCTION(parameters(), {})
  660. #if defined(BOOST_NO_CXX11_RVALUE_REFERENCES) || defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
  661. template <typename Id>
  662. explicit parameters(Id id)
  663. {
  664. add(id);
  665. }
  666. template <typename Id>
  667. parameters & add(Id id)
  668. {
  669. m_params.push_back(parameter<T>(id));
  670. return *this;
  671. }
  672. template <typename Id>
  673. parameters & operator()(Id id)
  674. {
  675. return add(id);
  676. }
  677. template <typename Id, typename V>
  678. parameters(Id id, V const& value)
  679. {
  680. add(id, value);
  681. }
  682. template <typename Id, typename V>
  683. parameters & add(Id id, V const& value)
  684. {
  685. m_params.push_back(parameter<T>(id, value));
  686. return *this;
  687. }
  688. template <typename Id, typename V>
  689. parameters & operator()(Id id, V const& value)
  690. {
  691. return add(id, value);
  692. }
  693. #ifndef BOOST_NO_CXX11_HDR_INITIALIZER_LIST
  694. template <typename Id, typename V>
  695. parameters(Id id, std::initializer_list<V> value)
  696. {
  697. add(id, value);
  698. }
  699. template <typename Id, typename V>
  700. parameters & add(Id id, std::initializer_list<V> value)
  701. {
  702. m_params.push_back(parameter<T>(id, value));
  703. return *this;
  704. }
  705. template <typename Id, typename V>
  706. parameters & operator()(Id id, std::initializer_list<V> value)
  707. {
  708. return add(id, value);
  709. }
  710. #endif // BOOST_NO_CXX11_HDR_INITIALIZER_LIST
  711. #else // BOOST_NO_CXX11_RVALUE_REFERENCES || BOOST_NO_CXX11_RVALUE_REFERENCES
  712. template <typename Id>
  713. explicit parameters(Id id)
  714. {
  715. add(id);
  716. }
  717. template <typename Id>
  718. parameters & add(Id id)
  719. {
  720. m_params.emplace_back(id);
  721. return *this;
  722. }
  723. template <typename Id>
  724. parameters & operator()(Id id)
  725. {
  726. return add(id);
  727. }
  728. template <typename Id, typename V>
  729. parameters(Id id, V && value)
  730. {
  731. add(id, std::forward<V>(value));
  732. }
  733. template <typename Id, typename V>
  734. parameters & add(Id id, V && value)
  735. {
  736. m_params.emplace_back(id, std::forward<V>(value));
  737. return *this;
  738. }
  739. template <typename Id, typename V>
  740. parameters & operator()(Id id, V && value)
  741. {
  742. return add(id, std::forward<V>(value));
  743. }
  744. #ifndef BOOST_NO_CXX11_HDR_INITIALIZER_LIST
  745. template <typename Id, typename V>
  746. parameters(Id id, std::initializer_list<V> value)
  747. {
  748. add(id, value);
  749. }
  750. template <typename Id, typename V>
  751. parameters & add(Id id, std::initializer_list<V> value)
  752. {
  753. m_params.emplace_back(id, value);
  754. return *this;
  755. }
  756. template <typename Id, typename V>
  757. parameters & operator()(Id id, std::initializer_list<V> value)
  758. {
  759. return add(id, value);
  760. }
  761. #endif // BOOST_NO_CXX11_HDR_INITIALIZER_LIST
  762. #endif // BOOST_NO_CXX11_RVALUE_REFERENCES || BOOST_NO_CXX11_RVALUE_REFERENCES
  763. const_iterator begin() const { return m_params.begin(); }
  764. const_iterator end() const { return m_params.end(); }
  765. const_reference operator[](size_type i) const { return m_params[i]; }
  766. size_type size() { return m_params.size(); }
  767. bool empty() { return m_params.empty(); }
  768. private:
  769. container_type m_params;
  770. };
  771. } // namespace dpar
  772. }}} // namespace boost::geometry::srs
  773. #endif // BOOST_GEOMETRY_SRS_PROJECTIONS_DPAR_HPP