dpar.hpp 17 KB

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