dpar.hpp 18 KB

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