// Boost.Geometry (aka GGL, Generic Geometry Library) // Copyright (c) 2015-2017, Oracle and/or its affiliates. // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Licensed under the Boost Software License version 1.0. // http://www.boost.org/users/license.html #ifndef BOOST_GEOMETRY_GEOMETRIES_HELPER_GEOMETRY_HPP #define BOOST_GEOMETRY_GEOMETRIES_HELPER_GEOMETRY_HPP #include #include #include #include #include #include #include #include #include #include namespace boost { namespace geometry { namespace detail { namespace helper_geometries { template ::type> struct default_units { typedef typename coordinate_system::type::units type; }; // The Cartesian coordinate system does not define the type units. // For that reason the generic implementation for default_units cannot be used // and specialization needs to be defined. // Moreover, it makes sense to define the units for the Cartesian // coordinate system to be radians, as this way a Cartesian point can // potentially be used in algorithms taking non-Cartesian strategies // and work as if it was as point in the non-Cartesian coordinate // system with radian units. template struct default_units { typedef radian type; }; template struct cs_tag_to_coordinate_system { BOOST_MPL_ASSERT_MSG((false), NOT_IMPLEMENTED_FOR_THIS_COORDINATE_SYSTEM, (types)); }; template struct cs_tag_to_coordinate_system { typedef cs::cartesian type; }; template struct cs_tag_to_coordinate_system { typedef cs::spherical_equatorial type; }; template struct cs_tag_to_coordinate_system { typedef cs::spherical type; }; template struct cs_tag_to_coordinate_system { typedef cs::geographic type; }; template < typename Point, typename NewCoordinateType, typename NewUnits, typename CS_Tag = typename cs_tag::type > struct helper_point { typedef model::point < NewCoordinateType, dimension::value, typename cs_tag_to_coordinate_system::type > type; }; }} // detail::helper_geometries namespace detail_dispatch { template < typename Geometry, typename NewCoordinateType, typename NewUnits, typename Tag = typename tag::type> struct helper_geometry : not_implemented {}; template struct helper_geometry { typedef typename detail::helper_geometries::helper_point < Point, NewCoordinateType, NewUnits >::type type; }; template struct helper_geometry { typedef model::box < typename helper_geometry < typename point_type::type, NewCoordinateType, NewUnits >::type > type; }; } // detail_dispatch // Meta-function that provides a new helper geometry of the same kind as // the input geometry and the same coordinate system type, // but with a possibly different coordinate type and coordinate system units template < typename Geometry, typename NewCoordinateType = typename coordinate_type::type, typename NewUnits = typename detail::helper_geometries::default_units < Geometry >::type > struct helper_geometry { typedef typename detail_dispatch::helper_geometry < Geometry, NewCoordinateType, NewUnits >::type type; }; }} // namespace boost::geometry #endif // BOOST_GEOMETRY_GEOMETRIES_HELPER_GEOMETRY_HPP