coordinate_system.hpp 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. // Boost.Geometry (aka GGL, Generic Geometry Library)
  2. // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
  3. // Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands.
  4. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
  5. // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
  6. // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
  7. // Use, modification and distribution is subject to the Boost Software License,
  8. // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  9. // http://www.boost.org/LICENSE_1_0.txt)
  10. #ifndef BOOST_GEOMETRY_CORE_COORDINATE_SYSTEM_HPP
  11. #define BOOST_GEOMETRY_CORE_COORDINATE_SYSTEM_HPP
  12. #include <boost/mpl/assert.hpp>
  13. #include <boost/geometry/core/point_type.hpp>
  14. #include <boost/geometry/util/bare_type.hpp>
  15. namespace boost { namespace geometry
  16. {
  17. namespace traits
  18. {
  19. /*!
  20. \brief Traits class defining the coordinate system of a point, important for strategy selection
  21. \ingroup traits
  22. \par Geometries:
  23. - point
  24. \par Specializations should provide:
  25. - typedef CS type; (cs::cartesian, cs::spherical, etc)
  26. */
  27. template <typename Point, typename Enable = void>
  28. struct coordinate_system
  29. {
  30. BOOST_MPL_ASSERT_MSG
  31. (
  32. false, NOT_IMPLEMENTED_FOR_THIS_POINT_TYPE, (types<Point>)
  33. );
  34. };
  35. } // namespace traits
  36. #ifndef DOXYGEN_NO_DISPATCH
  37. namespace core_dispatch
  38. {
  39. template <typename GeometryTag, typename G>
  40. struct coordinate_system
  41. {
  42. typedef typename point_type<GeometryTag, G>::type P;
  43. // Call its own specialization on point-tag
  44. typedef typename coordinate_system<point_tag, P>::type type;
  45. };
  46. template <typename Point>
  47. struct coordinate_system<point_tag, Point>
  48. {
  49. typedef typename traits::coordinate_system
  50. <
  51. typename geometry::util::bare_type<Point>::type
  52. >::type type;
  53. };
  54. } // namespace core_dispatch
  55. #endif
  56. /*!
  57. \brief \brief_meta{type, coordinate system (cartesian\, spherical\, etc), \meta_point_type}
  58. \tparam Geometry \tparam_geometry
  59. \ingroup core
  60. \qbk{[include reference/core/coordinate_system.qbk]}
  61. */
  62. template <typename Geometry>
  63. struct coordinate_system
  64. {
  65. typedef typename core_dispatch::coordinate_system
  66. <
  67. typename tag<Geometry>::type,
  68. typename geometry::util::bare_type<Geometry>::type
  69. >::type type;
  70. };
  71. }} // namespace boost::geometry
  72. #endif // BOOST_GEOMETRY_CORE_COORDINATE_SYSTEM_HPP