spar.hpp 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014
  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_SPAR_HPP
  8. #define BOOST_GEOMETRY_SRS_PROJECTIONS_SPAR_HPP
  9. #include <string>
  10. #include <type_traits>
  11. #include <vector>
  12. #include <boost/geometry/core/radius.hpp>
  13. #include <boost/geometry/core/static_assert.hpp>
  14. #include <boost/geometry/core/tag.hpp>
  15. #include <boost/geometry/core/tags.hpp>
  16. #include <boost/geometry/srs/projections/impl/pj_datums.hpp>
  17. #include <boost/geometry/srs/projections/impl/pj_ellps.hpp>
  18. #include <boost/geometry/srs/projections/dpar.hpp>
  19. #include <boost/geometry/srs/projections/par_data.hpp>
  20. #include <boost/geometry/srs/sphere.hpp>
  21. #include <boost/geometry/srs/spheroid.hpp>
  22. #include <boost/geometry/util/sequence.hpp>
  23. #include <boost/geometry/util/tuples.hpp>
  24. #include <boost/variant/variant.hpp>
  25. namespace boost { namespace geometry { namespace srs
  26. {
  27. namespace spar
  28. {
  29. // Static parameters holder
  30. template <typename ...>
  31. class parameters {};
  32. namespace detail
  33. {
  34. // TODO: implement this as a sequence utility
  35. template <std::size_t I, typename ...>
  36. struct parameters_base
  37. {
  38. BOOST_GEOMETRY_STATIC_ASSERT_FALSE(
  39. "I out of bounds.",
  40. std::integral_constant<size_t, I>);
  41. };
  42. template <std::size_t I, typename P, typename ...Ps>
  43. struct parameters_base<I, P, Ps...>
  44. {
  45. typedef typename parameters_base<I - 1, Ps...>::type type;
  46. };
  47. template <typename P, typename ...Ps>
  48. struct parameters_base<0, P, Ps...>
  49. {
  50. typedef parameters<P, Ps...> type;
  51. };
  52. } // namespace detail
  53. template <typename P, typename ...Ps>
  54. class parameters<P, Ps...>
  55. : private parameters<Ps...>
  56. {
  57. public:
  58. parameters() = default;
  59. parameters(parameters const&) = default;
  60. parameters(parameters&&) = default;
  61. parameters & operator=(parameters const&) = default;
  62. parameters & operator=(parameters&&) = default;
  63. template
  64. <
  65. typename R, typename ...Rs,
  66. std::enable_if_t<std::is_constructible<P, R>::value, int> = 0
  67. >
  68. explicit parameters(R&& r, Rs&&... rs)
  69. : parameters<Ps...>(std::forward<Rs>(rs)...)
  70. , m_p(std::forward<R>(r))
  71. {}
  72. template <std::size_t I>
  73. auto const& get() const
  74. {
  75. typedef typename detail::parameters_base<I, P, Ps...>::type base_t;
  76. return static_cast<base_t const&>(*this).m_p;
  77. }
  78. private:
  79. P m_p;
  80. template <typename ...>
  81. friend class parameters;
  82. };
  83. } // namespace spar
  84. }}} // namespace boost::geometry::srs
  85. namespace boost { namespace geometry { namespace tuples
  86. {
  87. template <std::size_t I, typename ...Ts>
  88. struct element<I, srs::spar::parameters<Ts...> >
  89. : util::sequence_element<I, util::type_sequence<Ts...> >
  90. {};
  91. template <typename ...Ts>
  92. struct size<srs::spar::parameters<Ts...> >
  93. : std::integral_constant<std::size_t, sizeof...(Ts)>
  94. {};
  95. template <int I, typename ...Ts>
  96. inline typename element<I, srs::spar::parameters<Ts...> >::type const&
  97. get(srs::spar::parameters<Ts...> const& tup)
  98. {
  99. return tup.template get<I>();
  100. }
  101. }}} // namespace boost::geometry::tuples
  102. namespace boost { namespace geometry { namespace srs
  103. {
  104. namespace spar
  105. {
  106. // Static parameters values
  107. struct datum_wgs84 {};
  108. struct datum_ggrs87 {};
  109. struct datum_nad83 {};
  110. struct datum_nad27 {};
  111. struct datum_potsdam {};
  112. struct datum_carthage {};
  113. struct datum_hermannskogel {};
  114. struct datum_ire65 {};
  115. struct datum_nzgd49 {};
  116. struct datum_osgb36 {};
  117. struct ellps_merit {};
  118. struct ellps_sgs85 {};
  119. struct ellps_grs80 {};
  120. struct ellps_iau76 {};
  121. struct ellps_airy {};
  122. struct ellps_apl4_9 {};
  123. struct ellps_nwl9d {};
  124. struct ellps_mod_airy {};
  125. struct ellps_andrae {};
  126. struct ellps_aust_sa {};
  127. struct ellps_grs67 {};
  128. struct ellps_bessel {};
  129. struct ellps_bess_nam {};
  130. struct ellps_clrk66 {};
  131. struct ellps_clrk80 {};
  132. struct ellps_clrk80ign {};
  133. struct ellps_cpm {};
  134. struct ellps_delmbr {};
  135. struct ellps_engelis {};
  136. struct ellps_evrst30 {};
  137. struct ellps_evrst48 {};
  138. struct ellps_evrst56 {};
  139. struct ellps_evrst69 {};
  140. struct ellps_evrstss {};
  141. struct ellps_fschr60 {};
  142. struct ellps_fschr60m {};
  143. struct ellps_fschr68 {};
  144. struct ellps_helmert {};
  145. struct ellps_hough {};
  146. struct ellps_intl {};
  147. struct ellps_krass {};
  148. struct ellps_kaula {};
  149. struct ellps_lerch {};
  150. struct ellps_mprts {};
  151. struct ellps_new_intl {};
  152. struct ellps_plessis {};
  153. struct ellps_seasia {};
  154. struct ellps_walbeck {};
  155. struct ellps_wgs60 {};
  156. struct ellps_wgs66 {};
  157. struct ellps_wgs72 {};
  158. struct ellps_wgs84 {};
  159. struct ellps_sphere {};
  160. struct mode_plane {};
  161. struct mode_di {};
  162. struct mode_dd {};
  163. struct mode_hex {};
  164. struct orient_isea {};
  165. struct orient_pole {};
  166. struct pm_greenwich {};
  167. struct pm_lisbon {};
  168. struct pm_paris {};
  169. struct pm_bogota {};
  170. struct pm_madrid {};
  171. struct pm_rome {};
  172. struct pm_bern {};
  173. struct pm_jakarta {};
  174. struct pm_ferro {};
  175. struct pm_brussels {};
  176. struct pm_stockholm {};
  177. struct pm_athens {};
  178. struct pm_oslo {};
  179. struct proj_aea {}; struct proj_leac {}; // Albers Equal Area, Lambert Equal Area Conic
  180. struct proj_aeqd {}; // Azimuthal Equidistant
  181. struct proj_airy {}; // Airy
  182. struct proj_aitoff {}; struct proj_wintri {}; // Aitoff, Winkel Tripel
  183. struct proj_august {};
  184. struct proj_apian {}; struct proj_ortel {}; struct proj_bacon {};
  185. struct proj_bipc {};
  186. struct proj_boggs {};
  187. struct proj_bonne {};
  188. struct proj_cass {};
  189. struct proj_cc {};
  190. struct proj_cea {};
  191. struct proj_chamb {};
  192. struct proj_collg {};
  193. struct proj_crast {};
  194. struct proj_denoy {};
  195. struct proj_eck1 {};
  196. struct proj_eck2 {};
  197. struct proj_eck3 {}; struct proj_putp1 {}; struct proj_wag6 {}; struct proj_kav7 {};
  198. struct proj_eck4 {};
  199. struct proj_eck5 {};
  200. struct proj_eqc {};
  201. struct proj_eqdc {};
  202. struct proj_etmerc {}; struct proj_utm {};
  203. struct proj_fahey {};
  204. struct proj_fouc_s {};
  205. struct proj_gall {};
  206. struct proj_geocent {};
  207. struct proj_geos {};
  208. struct proj_gins8 {};
  209. struct proj_gn_sinu {}; struct proj_sinu {}; struct proj_eck6 {}; struct proj_mbtfps {};
  210. struct proj_gnom {};
  211. struct proj_goode {};
  212. struct proj_gstmerc {};
  213. struct proj_hammer {};
  214. struct proj_hatano {};
  215. struct proj_healpix {};
  216. struct proj_rhealpix {};
  217. struct proj_igh {};
  218. struct proj_imw_p {};
  219. struct proj_isea {};
  220. struct proj_krovak {};
  221. struct proj_labrd {};
  222. struct proj_laea {};
  223. struct proj_lagrng {};
  224. struct proj_larr {};
  225. struct proj_lask {};
  226. struct proj_lonlat {}; struct proj_latlon {}; struct proj_latlong {}; struct proj_longlat {};
  227. struct proj_lcc {};
  228. struct proj_lcca {};
  229. struct proj_loxim {};
  230. struct proj_lsat {};
  231. struct proj_mbt_fps {};
  232. struct proj_mbtfpp {};
  233. struct proj_mbtfpq {};
  234. struct proj_merc {};
  235. struct proj_mill {};
  236. struct proj_mil_os {}; struct proj_lee_os {}; struct proj_gs48 {}; struct proj_alsk {}; struct proj_gs50 {};
  237. struct proj_moll {}; struct proj_wag4 {}; struct proj_wag5 {};
  238. struct proj_natearth {};
  239. struct proj_nell {};
  240. struct proj_nell_h {};
  241. struct proj_nicol {};
  242. struct proj_nsper {}; struct proj_tpers {};
  243. struct proj_nzmg {};
  244. struct proj_ob_tran {};
  245. struct proj_ocea {};
  246. struct proj_oea {};
  247. struct proj_omerc {};
  248. struct proj_ortho {};
  249. struct proj_poly {};
  250. struct proj_putp2 {};
  251. struct proj_putp3 {}; struct proj_putp3p {};
  252. struct proj_putp4p {}; struct proj_weren {};
  253. struct proj_putp5 {}; struct proj_putp5p {};
  254. struct proj_putp6 {}; struct proj_putp6p {};
  255. struct proj_qsc {};
  256. struct proj_robin {};
  257. struct proj_rouss {};
  258. struct proj_rpoly {};
  259. struct proj_euler {}; struct proj_murd1 {}; struct proj_murd2 {}; struct proj_murd3 {}; struct proj_pconic {}; struct proj_tissot {}; struct proj_vitk1 {};
  260. struct proj_somerc {};
  261. struct proj_stere {}; struct proj_ups {};
  262. struct proj_sterea {};
  263. struct proj_kav5 {}; struct proj_qua_aut {}; struct proj_fouc {}; struct proj_mbt_s {};
  264. struct proj_tcc {};
  265. struct proj_tcea {};
  266. struct proj_tmerc {};
  267. struct proj_tpeqd {};
  268. struct proj_urm5 {};
  269. struct proj_urmfps {}; struct proj_wag1 {};
  270. struct proj_vandg {};
  271. struct proj_vandg2 {}; struct proj_vandg3 {};
  272. struct proj_vandg4 {};
  273. struct proj_wag2 {};
  274. struct proj_wag3 {};
  275. struct proj_wag7 {};
  276. struct proj_wink1 {};
  277. struct proj_wink2 {};
  278. struct sweep_x {};
  279. struct sweep_y {};
  280. struct units_km {};
  281. struct units_m {};
  282. struct units_dm {};
  283. struct units_cm {};
  284. struct units_mm {};
  285. struct units_kmi {};
  286. struct units_in {};
  287. struct units_ft {};
  288. struct units_yd {};
  289. struct units_mi {};
  290. struct units_fath {};
  291. struct units_ch {};
  292. struct units_link {};
  293. struct units_us_in {};
  294. struct units_us_ft {};
  295. struct units_us_yd {};
  296. struct units_us_ch {};
  297. struct units_us_mi {};
  298. struct units_ind_yd {};
  299. struct units_ind_ft {};
  300. struct units_ind_ch {};
  301. // Static parameters names
  302. #define BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PARAM_F(NAME) \
  303. template <typename T = double> \
  304. struct NAME \
  305. { \
  306. NAME() : value(0) {} \
  307. explicit NAME(T const& v) : value(v) {} \
  308. T value; \
  309. };
  310. BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PARAM_F(a)
  311. BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PARAM_F(b)
  312. BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PARAM_F(e)
  313. BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PARAM_F(es)
  314. BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PARAM_F(f)
  315. BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PARAM_F(gamma)
  316. BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PARAM_F(h)
  317. BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PARAM_F(k)
  318. BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PARAM_F(k_0)
  319. BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PARAM_F(m)
  320. BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PARAM_F(n)
  321. BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PARAM_F(q)
  322. BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PARAM_F(r)
  323. BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PARAM_F(rf)
  324. BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PARAM_F(to_meter)
  325. BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PARAM_F(vto_meter)
  326. BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PARAM_F(w)
  327. BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PARAM_F(x_0)
  328. BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PARAM_F(y_0)
  329. #define BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PARAM_R(NAME) \
  330. BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PARAM_F(NAME)
  331. BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PARAM_R(alpha)
  332. BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PARAM_R(azi)
  333. BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PARAM_R(lat_0)
  334. BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PARAM_R(lat_1)
  335. BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PARAM_R(lat_2)
  336. BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PARAM_R(lat_b)
  337. BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PARAM_R(lat_ts)
  338. BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PARAM_R(lon_0)
  339. BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PARAM_R(lon_1)
  340. BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PARAM_R(lon_2)
  341. BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PARAM_R(lon_wrap)
  342. BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PARAM_R(lonc)
  343. BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PARAM_R(o_alpha)
  344. BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PARAM_R(o_lat_1)
  345. BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PARAM_R(o_lat_2)
  346. BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PARAM_R(o_lat_c)
  347. BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PARAM_R(o_lat_p)
  348. BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PARAM_R(o_lon_1)
  349. BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PARAM_R(o_lon_2)
  350. BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PARAM_R(o_lon_c)
  351. BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PARAM_R(o_lon_p)
  352. BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PARAM_R(pm)
  353. BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PARAM_R(r_lat_a)
  354. BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PARAM_R(r_lat_g)
  355. BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PARAM_R(theta)
  356. BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PARAM_R(tilt)
  357. #define BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PARAM_I(NAME) \
  358. template <int I> struct NAME { static const int value = I; };
  359. BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PARAM_I(aperture)
  360. BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PARAM_I(lsat)
  361. BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PARAM_I(north_square)
  362. BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PARAM_I(path)
  363. BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PARAM_I(resolution)
  364. BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PARAM_I(south_square)
  365. BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PARAM_I(zone)
  366. #define BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PARAM_BE(NAME) \
  367. struct NAME {};
  368. BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PARAM_BE(czech)
  369. BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PARAM_BE(geoc)
  370. BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PARAM_BE(guam)
  371. BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PARAM_BE(no_cut)
  372. BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PARAM_BE(no_defs)
  373. BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PARAM_BE(no_rot)
  374. BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PARAM_BE(ns)
  375. BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PARAM_BE(over)
  376. BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PARAM_BE(r_a)
  377. BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PARAM_BE(r_au)
  378. BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PARAM_BE(r_g)
  379. BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PARAM_BE(r_h)
  380. BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PARAM_BE(r_v)
  381. BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PARAM_BE(rescale)
  382. BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PARAM_BE(south)
  383. template
  384. <
  385. typename SpheroidOrSphere
  386. >
  387. struct ellps
  388. {
  389. typedef SpheroidOrSphere model_type;
  390. ellps() : model() {}
  391. explicit ellps(SpheroidOrSphere const& sph) : model(sph) {}
  392. SpheroidOrSphere model;
  393. };
  394. struct nadgrids
  395. : srs::detail::nadgrids
  396. {
  397. typedef srs::detail::nadgrids base_t;
  398. nadgrids(std::string const& g0) : base_t(g0) {}
  399. nadgrids(std::string const& g0, std::string const& g1) : base_t(g0, g1) {}
  400. nadgrids(std::string const& g0, std::string const& g1, std::string const& g2) : base_t(g0, g1, g2) {}
  401. nadgrids(std::string const& g0, std::string const& g1, std::string const& g2, std::string const& g3) : base_t(g0, g1, g2, g3) {}
  402. nadgrids(std::string const& g0, std::string const& g1, std::string const& g2, std::string const& g3, std::string const& g4) : base_t(g0, g1, g2, g3, g4) {}
  403. #ifndef BOOST_NO_CXX11_HDR_INITIALIZER_LIST
  404. nadgrids(std::initializer_list<std::string> l) : base_t(l) {}
  405. #endif
  406. };
  407. template <typename Proj>
  408. struct o_proj
  409. {
  410. typedef Proj type;
  411. };
  412. template <typename T = double>
  413. struct towgs84
  414. : srs::detail::towgs84<T>
  415. {
  416. typedef srs::detail::towgs84<T> base_t;
  417. towgs84(T const& v0, T const& v1, T const& v2)
  418. : base_t(v0, v1, v2)
  419. {}
  420. towgs84(T const& v0, T const& v1, T const& v2, T const& v3, T const& v4, T const& v5, T const& v6)
  421. : base_t(v0, v1, v2, v3, v4, v5, v6)
  422. {}
  423. #ifndef BOOST_NO_CXX11_HDR_INITIALIZER_LIST
  424. towgs84(std::initializer_list<T> l) : base_t(l) {}
  425. #endif
  426. };
  427. template <typename Units>
  428. struct vunits
  429. {
  430. typedef Units type;
  431. };
  432. // Static parameters traits
  433. #ifndef DOXYGEN_NO_DETAIL
  434. namespace detail
  435. {
  436. template <typename D>
  437. struct datum_traits
  438. {
  439. static const bool is_specialized = false;
  440. typedef void ellps_type;
  441. typedef void def_type;
  442. };
  443. #define BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_DATUM(NAME, ELLPS, DEF_T, DEF_V) \
  444. template <> \
  445. struct datum_traits<spar::NAME> \
  446. { \
  447. static const bool is_specialized = true; \
  448. typedef spar::ELLPS ellps_type; \
  449. typedef spar::DEF_T def_type; \
  450. static spar::DEF_T def() { return spar::DEF_T DEF_V; } \
  451. static const dpar::value_datum id = dpar::NAME; \
  452. };
  453. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_DATUM(datum_wgs84, ellps_wgs84, towgs84<double>, (0,0,0))
  454. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_DATUM(datum_ggrs87, ellps_grs80, towgs84<double>, (-199.87,74.79,246.62))
  455. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_DATUM(datum_nad83, ellps_grs80, towgs84<double>, (0,0,0))
  456. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_DATUM(datum_nad27, ellps_clrk66, nadgrids, ("@conus","@alaska","@ntv2_0.gsb","@ntv1_can.dat"))
  457. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_DATUM(datum_potsdam, ellps_bessel, towgs84<double>, (598.1,73.7,418.2,0.202,0.045,-2.455,6.7))
  458. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_DATUM(datum_carthage, ellps_clrk80ign, towgs84<double>, (-263.0,6.0,431.0))
  459. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_DATUM(datum_hermannskogel, ellps_bessel, towgs84<double>, (577.326,90.129,463.919,5.137,1.474,5.297,2.4232))
  460. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_DATUM(datum_ire65, ellps_mod_airy, towgs84<double>, (482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15))
  461. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_DATUM(datum_nzgd49, ellps_intl, towgs84<double>, (59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993))
  462. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_DATUM(datum_osgb36, ellps_airy, towgs84<double>, (446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894))
  463. template <typename E>
  464. struct ellps_traits
  465. {
  466. static const bool is_specialized = false;
  467. template <typename T> struct model_type
  468. {
  469. typedef void type;
  470. };
  471. };
  472. template <typename E>
  473. struct ellps_traits<spar::ellps<E> >
  474. {
  475. static const bool is_specialized = true;
  476. template <typename T> struct model_type
  477. {
  478. // TODO: transform to spheroid<T> or sphere<T>
  479. typedef typename spar::ellps<E>::model_type type;
  480. };
  481. template <typename T>
  482. static typename spar::ellps<E>::model_type const& model(spar::ellps<E> const& e)
  483. {
  484. return e.model;
  485. }
  486. };
  487. // TODO: Implement as RadiusType-agnostic, member struct template defining model
  488. // and function template returning it
  489. #define BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_ELLPS(NAME) \
  490. template <> \
  491. struct ellps_traits<spar::NAME> \
  492. { \
  493. static const bool is_specialized = true; \
  494. template <typename T> struct model_type \
  495. { \
  496. typedef srs::spheroid<T> type; \
  497. }; \
  498. template <typename T> \
  499. static srs::spheroid<T> model(spar::NAME const&) { \
  500. return srs::spheroid<T>(projections::detail::pj_get_ellps<T>().first[dpar::NAME].a, \
  501. projections::detail::pj_get_ellps<T>().first[dpar::NAME].b); \
  502. } \
  503. };
  504. #define BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_SPHERE(NAME) \
  505. template <> \
  506. struct ellps_traits<spar::NAME> \
  507. { \
  508. static const bool is_specialized = true; \
  509. template <typename T> struct model_type \
  510. { \
  511. typedef srs::sphere<T> type; \
  512. }; \
  513. template <typename T> \
  514. static srs::sphere<T> model(spar::NAME const&) { \
  515. return srs::sphere<T>(projections::detail::pj_get_ellps<T>().first[dpar::NAME].a); \
  516. } \
  517. };
  518. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_ELLPS(ellps_merit)
  519. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_ELLPS(ellps_sgs85)
  520. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_ELLPS(ellps_grs80)
  521. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_ELLPS(ellps_iau76)
  522. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_ELLPS(ellps_airy)
  523. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_ELLPS(ellps_apl4_9)
  524. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_ELLPS(ellps_nwl9d)
  525. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_ELLPS(ellps_mod_airy)
  526. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_ELLPS(ellps_andrae)
  527. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_ELLPS(ellps_aust_sa)
  528. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_ELLPS(ellps_grs67)
  529. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_ELLPS(ellps_bessel)
  530. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_ELLPS(ellps_bess_nam)
  531. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_ELLPS(ellps_clrk66)
  532. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_ELLPS(ellps_clrk80)
  533. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_ELLPS(ellps_clrk80ign)
  534. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_ELLPS(ellps_cpm)
  535. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_ELLPS(ellps_delmbr)
  536. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_ELLPS(ellps_engelis)
  537. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_ELLPS(ellps_evrst30)
  538. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_ELLPS(ellps_evrst48)
  539. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_ELLPS(ellps_evrst56)
  540. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_ELLPS(ellps_evrst69)
  541. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_ELLPS(ellps_evrstss)
  542. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_ELLPS(ellps_fschr60)
  543. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_ELLPS(ellps_fschr60m)
  544. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_ELLPS(ellps_fschr68)
  545. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_ELLPS(ellps_helmert)
  546. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_ELLPS(ellps_hough)
  547. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_ELLPS(ellps_intl)
  548. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_ELLPS(ellps_krass)
  549. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_ELLPS(ellps_kaula)
  550. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_ELLPS(ellps_lerch)
  551. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_ELLPS(ellps_mprts)
  552. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_ELLPS(ellps_new_intl)
  553. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_ELLPS(ellps_plessis)
  554. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_ELLPS(ellps_seasia)
  555. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_ELLPS(ellps_walbeck)
  556. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_ELLPS(ellps_wgs60)
  557. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_ELLPS(ellps_wgs66)
  558. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_ELLPS(ellps_wgs72)
  559. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_ELLPS(ellps_wgs84)
  560. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_SPHERE(ellps_sphere)
  561. template <typename M>
  562. struct mode_traits
  563. {
  564. static const bool is_specialized = false;
  565. typedef void type;
  566. };
  567. #define BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_MODE(NAME) \
  568. template <> \
  569. struct mode_traits<spar::NAME> \
  570. { \
  571. static const bool is_specialized = true; \
  572. typedef spar::NAME type; \
  573. };
  574. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_MODE(mode_plane)
  575. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_MODE(mode_di)
  576. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_MODE(mode_dd)
  577. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_MODE(mode_hex)
  578. template <typename O>
  579. struct orient_traits
  580. {
  581. static const bool is_specialized = false;
  582. typedef void type;
  583. };
  584. #define BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_ORIENT(NAME) \
  585. template <> \
  586. struct orient_traits<spar::NAME> \
  587. { \
  588. static const bool is_specialized = true; \
  589. typedef spar::NAME type; \
  590. };
  591. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_ORIENT(orient_isea)
  592. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_ORIENT(orient_pole)
  593. template <typename M>
  594. struct pm_traits
  595. {
  596. static const bool is_specialized = false;
  597. typedef void type;
  598. };
  599. template <typename T>
  600. struct pm_traits<spar::pm<T> >
  601. {
  602. static const bool is_specialized = true;
  603. typedef T type;
  604. static T const& value(spar::pm<T> const& p) { return p.value; }
  605. };
  606. #define BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PM(NAME, INDEX) \
  607. template <> \
  608. struct pm_traits<spar::NAME> \
  609. { \
  610. static const bool is_specialized = true; \
  611. typedef double type; \
  612. static double value(spar::NAME const& ) { return projections::detail::pj_prime_meridians[INDEX].deg; } \
  613. };
  614. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PM(pm_greenwich, 0)
  615. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PM(pm_lisbon, 1)
  616. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PM(pm_paris, 2)
  617. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PM(pm_bogota, 3)
  618. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PM(pm_madrid, 4)
  619. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PM(pm_rome, 5)
  620. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PM(pm_bern, 6)
  621. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PM(pm_jakarta, 7)
  622. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PM(pm_ferro, 8)
  623. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PM(pm_brussels, 9)
  624. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PM(pm_stockholm, 10)
  625. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PM(pm_athens, 11)
  626. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PM(pm_oslo, 12)
  627. template <typename P>
  628. struct proj_traits
  629. {
  630. static const bool is_specialized = false;
  631. typedef void type;
  632. };
  633. #define BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(NAME) \
  634. template <> \
  635. struct proj_traits<spar::NAME> \
  636. { \
  637. static const bool is_specialized = true; \
  638. typedef spar::NAME type; \
  639. static const srs::dpar::value_proj id = dpar::NAME; \
  640. };
  641. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_aea)
  642. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_leac)
  643. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_aeqd)
  644. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_airy)
  645. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_aitoff)
  646. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_wintri)
  647. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_august)
  648. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_apian)
  649. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_ortel)
  650. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_bacon)
  651. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_bipc)
  652. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_boggs)
  653. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_bonne)
  654. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_cass)
  655. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_cc)
  656. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_cea)
  657. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_chamb)
  658. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_collg)
  659. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_crast)
  660. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_denoy)
  661. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_eck1)
  662. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_eck2)
  663. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_eck3)
  664. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_putp1)
  665. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_wag6)
  666. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_kav7)
  667. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_eck4)
  668. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_eck5)
  669. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_eqc)
  670. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_eqdc)
  671. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_etmerc)
  672. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_utm)
  673. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_fahey)
  674. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_fouc_s)
  675. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_gall)
  676. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_geocent)
  677. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_geos)
  678. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_gins8)
  679. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_gn_sinu)
  680. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_sinu)
  681. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_eck6)
  682. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_mbtfps)
  683. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_gnom)
  684. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_goode)
  685. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_gstmerc)
  686. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_hammer)
  687. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_hatano)
  688. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_healpix)
  689. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_rhealpix)
  690. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_igh)
  691. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_imw_p)
  692. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_isea)
  693. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_krovak)
  694. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_labrd)
  695. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_laea)
  696. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_lagrng)
  697. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_larr)
  698. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_lask)
  699. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_lonlat)
  700. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_latlon)
  701. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_latlong)
  702. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_longlat)
  703. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_lcc)
  704. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_lcca)
  705. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_loxim)
  706. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_lsat)
  707. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_mbt_fps)
  708. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_mbtfpp)
  709. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_mbtfpq)
  710. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_merc)
  711. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_mill)
  712. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_mil_os)
  713. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_lee_os)
  714. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_gs48)
  715. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_alsk)
  716. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_gs50)
  717. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_moll)
  718. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_wag4)
  719. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_wag5)
  720. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_natearth)
  721. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_nell)
  722. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_nell_h)
  723. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_nicol)
  724. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_nsper)
  725. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_tpers)
  726. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_nzmg)
  727. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_ob_tran)
  728. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_ocea)
  729. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_oea)
  730. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_omerc)
  731. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_ortho)
  732. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_poly)
  733. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_putp2)
  734. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_putp3)
  735. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_putp3p)
  736. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_putp4p)
  737. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_weren)
  738. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_putp5)
  739. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_putp5p)
  740. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_putp6)
  741. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_putp6p)
  742. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_qsc)
  743. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_robin)
  744. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_rouss)
  745. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_rpoly)
  746. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_euler)
  747. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_murd1)
  748. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_murd2)
  749. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_murd3)
  750. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_pconic)
  751. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_tissot)
  752. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_vitk1)
  753. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_somerc)
  754. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_stere)
  755. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_ups)
  756. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_sterea)
  757. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_kav5)
  758. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_qua_aut)
  759. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_fouc)
  760. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_mbt_s)
  761. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_tcc)
  762. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_tcea)
  763. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_tmerc)
  764. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_tpeqd)
  765. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_urm5)
  766. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_urmfps)
  767. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_wag1)
  768. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_vandg)
  769. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_vandg2)
  770. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_vandg3)
  771. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_vandg4)
  772. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_wag2)
  773. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_wag3)
  774. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_wag7)
  775. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_wink1)
  776. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_PROJ(proj_wink2)
  777. template <typename S>
  778. struct sweep_traits
  779. {
  780. static const bool is_specialized = false;
  781. typedef void type;
  782. };
  783. #define BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_SWEEP(NAME) \
  784. template <> \
  785. struct sweep_traits<spar::NAME> \
  786. { \
  787. static const bool is_specialized = true; \
  788. typedef spar::NAME type; \
  789. };
  790. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_SWEEP(sweep_x)
  791. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_SWEEP(sweep_y)
  792. template <typename S>
  793. struct units_traits
  794. {
  795. static const bool is_specialized = false;
  796. typedef void type;
  797. };
  798. #define BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_UNITS(NAME) \
  799. template <> \
  800. struct units_traits<spar::NAME> \
  801. { \
  802. static const bool is_specialized = true; \
  803. typedef spar::NAME type; \
  804. static const srs::dpar::value_units id = dpar::NAME; \
  805. };
  806. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_UNITS(units_km)
  807. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_UNITS(units_m)
  808. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_UNITS(units_dm)
  809. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_UNITS(units_cm)
  810. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_UNITS(units_mm)
  811. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_UNITS(units_kmi)
  812. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_UNITS(units_in)
  813. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_UNITS(units_ft)
  814. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_UNITS(units_yd)
  815. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_UNITS(units_mi)
  816. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_UNITS(units_fath)
  817. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_UNITS(units_ch)
  818. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_UNITS(units_link)
  819. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_UNITS(units_us_in)
  820. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_UNITS(units_us_ft)
  821. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_UNITS(units_us_yd)
  822. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_UNITS(units_us_ch)
  823. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_UNITS(units_us_mi)
  824. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_UNITS(units_ind_yd)
  825. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_UNITS(units_ind_ft)
  826. BOOST_GEOMETRY_PROJECTIONS_DETAIL_REGISTER_UNITS(units_ind_ch)
  827. template <typename T, template <typename> class Param>
  828. struct is_same_t : std::false_type {};
  829. template <typename T, template <typename> class Param>
  830. struct is_same_t<Param<T>, Param> : std::true_type {};
  831. template <typename T, template <int> class Param>
  832. struct is_same_i : std::false_type {};
  833. template <int I, template <int> class Param>
  834. struct is_same_i<Param<I>, Param> : std::true_type {};
  835. template <typename T, template <typename> class Traits>
  836. struct it_traits_specialized
  837. : std::integral_constant
  838. <
  839. bool,
  840. Traits<T>::is_specialized
  841. >
  842. {};
  843. template <typename Param>
  844. struct is_param
  845. {
  846. template <typename T>
  847. struct pred : std::is_same<T, Param> {};
  848. };
  849. template <template <typename> class Param>
  850. struct is_param_t
  851. {
  852. template <typename T>
  853. struct pred : is_same_t<T, Param> {};
  854. };
  855. template <template <int> class Param>
  856. struct is_param_i
  857. {
  858. template <typename T>
  859. struct pred : is_same_i<T, Param> {};
  860. };
  861. template <template <typename> class Traits>
  862. struct is_param_tr
  863. {
  864. template <typename T>
  865. struct pred : it_traits_specialized<T, Traits> {};
  866. };
  867. // pick proj static name
  868. template <typename Tuple>
  869. struct pick_proj_tag
  870. {
  871. typedef typename geometry::tuples::find_if
  872. <
  873. Tuple,
  874. is_param_tr<proj_traits>::pred
  875. >::type proj_type;
  876. static const bool is_found = geometry::tuples::is_found<proj_type>::value;
  877. BOOST_GEOMETRY_STATIC_ASSERT((is_found), "Projection not named.", Tuple);
  878. typedef proj_traits<proj_type> traits_type;
  879. typedef typename traits_type::type type;
  880. };
  881. template <typename Tuple>
  882. struct pick_o_proj_tag
  883. {
  884. typedef typename geometry::tuples::find_if
  885. <
  886. Tuple,
  887. is_param_t<o_proj>::pred
  888. >::type o_proj_type;
  889. static const bool is_found = geometry::tuples::is_found<o_proj_type>::value;
  890. BOOST_GEOMETRY_STATIC_ASSERT((is_found), "Expected o_proj parameter.", Tuple);
  891. typedef proj_traits<typename o_proj_type::type> traits_type;
  892. typedef typename traits_type::type type;
  893. };
  894. } // namespace detail
  895. #endif // DOXYGEN_NO_DETAIL
  896. } // namespace spar
  897. }}} // namespace boost::geometry::srs
  898. #endif // BOOST_GEOMETRY_SRS_PROJECTIONS_SPAR_HPP