123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341 |
- #ifndef BOOST_GEOMETRY_CORE_CS_HPP
- #define BOOST_GEOMETRY_CORE_CS_HPP
- #include <cstddef>
- #include <boost/geometry/core/coordinate_system.hpp>
- #include <boost/geometry/core/static_assert.hpp>
- #include <boost/geometry/core/tags.hpp>
- namespace boost { namespace geometry
- {
- struct degree {};
- struct radian {};
- #ifndef DOXYGEN_NO_DETAIL
- namespace core_detail
- {
- template <typename DegreeOrRadian>
- struct define_angular_units
- {
- BOOST_GEOMETRY_STATIC_ASSERT_FALSE(
- "Coordinate system unit must be degree or radian.",
- DegreeOrRadian);
- };
- template <>
- struct define_angular_units<geometry::degree>
- {
- typedef geometry::degree units;
- };
- template <>
- struct define_angular_units<geometry::radian>
- {
- typedef geometry::radian units;
- };
- }
- #endif
- namespace cs
- {
- struct cartesian {};
- template<typename DegreeOrRadian>
- struct geographic
- : core_detail::define_angular_units<DegreeOrRadian>
- {};
- template<typename DegreeOrRadian>
- struct spherical
- : core_detail::define_angular_units<DegreeOrRadian>
- {};
- template<typename DegreeOrRadian>
- struct spherical_equatorial
- : core_detail::define_angular_units<DegreeOrRadian>
- {};
- template<typename DegreeOrRadian>
- struct polar
- : core_detail::define_angular_units<DegreeOrRadian>
- {};
- struct undefined {};
- }
- namespace traits
- {
- template <typename CoordinateSystem>
- struct cs_tag
- {
- };
- #ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS
- template<typename DegreeOrRadian>
- struct cs_tag<cs::geographic<DegreeOrRadian> >
- {
- typedef geographic_tag type;
- };
- template<typename DegreeOrRadian>
- struct cs_tag<cs::spherical<DegreeOrRadian> >
- {
- typedef spherical_polar_tag type;
- };
- template<typename DegreeOrRadian>
- struct cs_tag<cs::spherical_equatorial<DegreeOrRadian> >
- {
- typedef spherical_equatorial_tag type;
- };
- template<>
- struct cs_tag<cs::cartesian>
- {
- typedef cartesian_tag type;
- };
- template <>
- struct cs_tag<cs::undefined>
- {
- typedef cs_undefined_tag type;
- };
- #endif
- }
- template <typename Geometry>
- struct cs_tag
- {
- typedef typename traits::cs_tag
- <
- typename geometry::coordinate_system<Geometry>::type
- >::type type;
- };
- namespace traits
- {
- template <typename CoordinateSystem>
- struct cs_angular_units
- {
- typedef geometry::radian type;
- };
- #ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS
- template<typename DegreeOrRadian>
- struct cs_angular_units<cs::geographic<DegreeOrRadian> >
- {
- typedef DegreeOrRadian type;
- };
- template<typename DegreeOrRadian>
- struct cs_angular_units<cs::spherical<DegreeOrRadian> >
- {
- typedef DegreeOrRadian type;
- };
- template<typename DegreeOrRadian>
- struct cs_angular_units<cs::spherical_equatorial<DegreeOrRadian> >
- {
- typedef DegreeOrRadian type;
- };
- #endif
- }
- #ifndef DOXYGEN_NO_DETAIL
- namespace detail
- {
- template <typename Geometry>
- struct cs_angular_units
- {
- typedef typename traits::cs_angular_units
- <
- typename geometry::coordinate_system<Geometry>::type
- >::type type;
- };
- template <typename Units, typename CsTag>
- struct cs_tag_to_coordinate_system
- {
- BOOST_GEOMETRY_STATIC_ASSERT_FALSE(
- "Not implemented for this coordinate system.",
- Units, CsTag);
- };
- template <typename Units>
- struct cs_tag_to_coordinate_system<Units, cs_undefined_tag>
- {
- typedef cs::undefined type;
- };
- template <typename Units>
- struct cs_tag_to_coordinate_system<Units, cartesian_tag>
- {
- typedef cs::cartesian type;
- };
- template <typename Units>
- struct cs_tag_to_coordinate_system<Units, spherical_equatorial_tag>
- {
- typedef cs::spherical_equatorial<Units> type;
- };
- template <typename Units>
- struct cs_tag_to_coordinate_system<Units, spherical_polar_tag>
- {
- typedef cs::spherical<Units> type;
- };
- template <typename Units>
- struct cs_tag_to_coordinate_system<Units, geographic_tag>
- {
- typedef cs::geographic<Units> type;
- };
- }
- #endif
- }}
- #endif
|