1 // Boost.Geometry (aka GGL, Generic Geometry Library) 2 3 // Copyright (c) 2008-2012 Bruno Lalande, Paris, France. 4 // Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands. 5 // Copyright (c) 2009-2012 Mateusz Loskot, London, UK. 6 7 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library 8 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. 9 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 14 #ifndef BOOST_GEOMETRY_CORE_COORDINATE_SYSTEM_HPP 15 #define BOOST_GEOMETRY_CORE_COORDINATE_SYSTEM_HPP 16 17 18 #include <boost/mpl/assert.hpp> 19 20 #include <boost/geometry/core/point_type.hpp> 21 #include <boost/geometry/util/bare_type.hpp> 22 23 24 namespace boost { namespace geometry 25 { 26 27 28 namespace traits 29 { 30 31 /*! 32 \brief Traits class defining the coordinate system of a point, important for strategy selection 33 \ingroup traits 34 \par Geometries: 35 - point 36 \par Specializations should provide: 37 - typedef CS type; (cs::cartesian, cs::spherical, etc) 38 */ 39 template <typename Point, typename Enable = void> 40 struct coordinate_system 41 { 42 BOOST_MPL_ASSERT_MSG 43 ( 44 false, NOT_IMPLEMENTED_FOR_THIS_POINT_TYPE, (types<Point>) 45 ); 46 }; 47 48 } // namespace traits 49 50 51 52 #ifndef DOXYGEN_NO_DISPATCH 53 namespace core_dispatch 54 { 55 template <typename GeometryTag, typename G> 56 struct coordinate_system 57 { 58 typedef typename point_type<GeometryTag, G>::type P; 59 60 // Call its own specialization on point-tag 61 typedef typename coordinate_system<point_tag, P>::type type; 62 }; 63 64 65 template <typename Point> 66 struct coordinate_system<point_tag, Point> 67 { 68 typedef typename traits::coordinate_system 69 < 70 typename geometry::util::bare_type<Point>::type 71 >::type type; 72 }; 73 74 75 } // namespace core_dispatch 76 #endif 77 78 79 /*! 80 \brief \brief_meta{type, coordinate system (cartesian\, spherical\, etc), \meta_point_type} 81 \tparam Geometry \tparam_geometry 82 \ingroup core 83 84 \qbk{[include reference/core/coordinate_system.qbk]} 85 */ 86 template <typename Geometry> 87 struct coordinate_system 88 { 89 typedef typename core_dispatch::coordinate_system 90 < 91 typename tag<Geometry>::type, 92 typename geometry::util::bare_type<Geometry>::type 93 >::type type; 94 }; 95 96 97 }} // namespace boost::geometry 98 99 100 #endif // BOOST_GEOMETRY_CORE_COORDINATE_SYSTEM_HPP 101