coordinate_system.hpp 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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. // This file was modified by Oracle on 2020.
  6. // Modifications copyright (c) 2020, Oracle and/or its affiliates.
  7. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
  8. // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
  9. // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
  10. // Use, modification and distribution is subject to the Boost Software License,
  11. // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  12. // http://www.boost.org/LICENSE_1_0.txt)
  13. #ifndef BOOST_GEOMETRY_CORE_COORDINATE_SYSTEM_HPP
  14. #define BOOST_GEOMETRY_CORE_COORDINATE_SYSTEM_HPP
  15. #include <boost/geometry/core/point_type.hpp>
  16. #include <boost/geometry/core/static_assert.hpp>
  17. #include <boost/geometry/util/type_traits_std.hpp>
  18. namespace boost { namespace geometry
  19. {
  20. namespace traits
  21. {
  22. /*!
  23. \brief Traits class defining the coordinate system of a point, important for strategy selection
  24. \ingroup traits
  25. \par Geometries:
  26. - point
  27. \par Specializations should provide:
  28. - typedef CS type; (cs::cartesian, cs::spherical, etc)
  29. */
  30. template <typename Point, typename Enable = void>
  31. struct coordinate_system
  32. {
  33. BOOST_GEOMETRY_STATIC_ASSERT_FALSE(
  34. "Not implemented for this Point type.",
  35. Point);
  36. };
  37. } // namespace traits
  38. #ifndef DOXYGEN_NO_DISPATCH
  39. namespace core_dispatch
  40. {
  41. template <typename GeometryTag, typename G>
  42. struct coordinate_system
  43. {
  44. typedef typename point_type<GeometryTag, G>::type P;
  45. // Call its own specialization on point-tag
  46. typedef typename coordinate_system<point_tag, P>::type type;
  47. };
  48. template <typename Point>
  49. struct coordinate_system<point_tag, Point>
  50. {
  51. typedef typename traits::coordinate_system
  52. <
  53. typename util::remove_cptrref<Point>::type
  54. >::type type;
  55. };
  56. } // namespace core_dispatch
  57. #endif
  58. /*!
  59. \brief \brief_meta{type, coordinate system (cartesian\, spherical\, etc), \meta_point_type}
  60. \tparam Geometry \tparam_geometry
  61. \ingroup core
  62. \qbk{[include reference/core/coordinate_system.qbk]}
  63. */
  64. template <typename Geometry>
  65. struct coordinate_system
  66. {
  67. typedef typename core_dispatch::coordinate_system
  68. <
  69. typename tag<Geometry>::type,
  70. typename util::remove_cptrref<Geometry>::type
  71. >::type type;
  72. };
  73. }} // namespace boost::geometry
  74. #endif // BOOST_GEOMETRY_CORE_COORDINATE_SYSTEM_HPP