123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146 |
- // Boost.Geometry (aka GGL, Generic Geometry Library)
- // Copyright (c) 2015-2022, 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 <boost/geometry/core/closure.hpp>
- #include <boost/geometry/core/coordinate_dimension.hpp>
- #include <boost/geometry/core/coordinate_type.hpp>
- #include <boost/geometry/core/cs.hpp>
- #include <boost/geometry/core/point_order.hpp>
- #include <boost/geometry/core/point_type.hpp>
- #include <boost/geometry/core/tag.hpp>
- #include <boost/geometry/core/tags.hpp>
- #include <boost/geometry/geometries/box.hpp>
- #include <boost/geometry/geometries/linestring.hpp>
- #include <boost/geometry/geometries/point.hpp>
- #include <boost/geometry/geometries/ring.hpp>
- #include <boost/geometry/algorithms/not_implemented.hpp>
- namespace boost { namespace geometry
- {
- namespace detail { namespace helper_geometries
- {
- template
- <
- typename Point,
- typename NewCoordinateType,
- typename NewUnits,
- typename CS_Tag = typename cs_tag<Point>::type
- >
- struct helper_point
- {
- typedef model::point
- <
- NewCoordinateType,
- dimension<Point>::value,
- typename cs_tag_to_coordinate_system<NewUnits, CS_Tag>::type
- > type;
- };
- }} // detail::helper_geometries
- namespace detail_dispatch
- {
- template
- <
- typename Geometry,
- typename NewCoordinateType,
- typename NewUnits,
- typename Tag = typename tag<Geometry>::type>
- struct helper_geometry : not_implemented<Geometry>
- {};
- template <typename Point, typename NewCoordinateType, typename NewUnits>
- struct helper_geometry<Point, NewCoordinateType, NewUnits, point_tag>
- {
- using type = typename detail::helper_geometries::helper_point
- <
- Point, NewCoordinateType, NewUnits
- >::type;
- };
- template <typename Box, typename NewCoordinateType, typename NewUnits>
- struct helper_geometry<Box, NewCoordinateType, NewUnits, box_tag>
- {
- using type = model::box
- <
- typename helper_geometry
- <
- typename point_type<Box>::type, NewCoordinateType, NewUnits
- >::type
- >;
- };
- template <typename Linestring, typename NewCoordinateType, typename NewUnits>
- struct helper_geometry<Linestring, NewCoordinateType, NewUnits, linestring_tag>
- {
- using type = model::linestring
- <
- typename helper_geometry
- <
- typename point_type<Linestring>::type, NewCoordinateType, NewUnits
- >::type
- >;
- };
- template <typename Ring, typename NewCoordinateType, typename NewUnits>
- struct helper_geometry<Ring, NewCoordinateType, NewUnits, ring_tag>
- {
- using type = model::ring
- <
- typename helper_geometry
- <
- typename point_type<Ring>::type, NewCoordinateType, NewUnits
- >::type,
- point_order<Ring>::value != counterclockwise,
- closure<Ring>::value != open
- >;
- };
- } // 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<Geometry>::type,
- typename NewUnits = typename detail::cs_angular_units<Geometry>::type
- >
- struct helper_geometry
- {
- using type = typename detail_dispatch::helper_geometry
- <
- Geometry, NewCoordinateType, NewUnits
- >::type;
- };
- }} // namespace boost::geometry
- #endif // BOOST_GEOMETRY_GEOMETRIES_HELPER_GEOMETRY_HPP
|