123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133 |
- // Boost.Geometry (aka GGL, Generic Geometry Library)
- // Unit Test
- // Copyright (c) 2014, Oracle and/or its affiliates.
- // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
- // Licensed under the Boost Software License version 1.0.
- // http://www.boost.org/users/license.html
- #ifndef BOOST_GEOMETRY_TEST_TEST_GEOMETRIES_CUSTOM_LON_LAT_POINT_HPP
- #define BOOST_GEOMETRY_TEST_TEST_GEOMETRIES_CUSTOM_LON_LAT_POINT_HPP
- #include <boost/mpl/int.hpp>
- #include <boost/geometry/core/access.hpp>
- #include <boost/geometry/core/coordinate_dimension.hpp>
- #include <boost/geometry/core/coordinate_system.hpp>
- #include <boost/geometry/core/coordinate_type.hpp>
- #include <boost/geometry/core/tag.hpp>
- #include <boost/geometry/core/tags.hpp>
- // read/write longitude/latitude point
- template <typename CoordinateType, typename CoordinateSystem>
- struct rw_lon_lat_point
- {
- CoordinateType longitude, latitude;
- };
- namespace boost { namespace geometry { namespace traits
- {
- template <typename CoordinateType, typename CoordinateSystem>
- struct tag<rw_lon_lat_point<CoordinateType, CoordinateSystem> >
- {
- typedef point_tag type;
- };
- template <typename CoordinateType, typename CoordinateSystem>
- struct coordinate_type<rw_lon_lat_point<CoordinateType, CoordinateSystem> >
- {
- typedef CoordinateType type;
- };
- template <typename CoordinateType, typename CoordinateSystem>
- struct coordinate_system<rw_lon_lat_point<CoordinateType, CoordinateSystem> >
- {
- typedef CoordinateSystem type;
- };
- template <typename CoordinateType, typename CoordinateSystem>
- struct dimension<rw_lon_lat_point<CoordinateType, CoordinateSystem> >
- : boost::mpl::int_<2>
- {};
- template
- <
- typename CoordinateType,
- typename CoordinateSystem,
- std::size_t Dimension
- >
- struct access<rw_lon_lat_point<CoordinateType, CoordinateSystem>, Dimension>
- {
- static inline CoordinateType
- get(rw_lon_lat_point<CoordinateType, CoordinateSystem> const& p)
- {
- return (Dimension == 0) ? p.longitude : p.latitude;
- }
- static inline
- void set(rw_lon_lat_point<CoordinateType, CoordinateSystem>& p,
- CoordinateType const& value)
- {
- ( Dimension == 0 ? p.longitude : p.latitude ) = value;
- }
- };
- }}} // namespace boost::geometry::traits
- // read-only longitude/latitude point
- template <typename CoordinateType, typename CoordinateSystem>
- struct ro_lon_lat_point
- {
- CoordinateType longitude, latitude;
- };
- namespace boost { namespace geometry { namespace traits
- {
- template <typename CoordinateType, typename CoordinateSystem>
- struct tag<ro_lon_lat_point<CoordinateType, CoordinateSystem> >
- {
- typedef point_tag type;
- };
- template <typename CoordinateType, typename CoordinateSystem>
- struct coordinate_type<ro_lon_lat_point<CoordinateType, CoordinateSystem> >
- {
- typedef CoordinateType type;
- };
- template <typename CoordinateType, typename CoordinateSystem>
- struct coordinate_system<ro_lon_lat_point<CoordinateType, CoordinateSystem> >
- {
- typedef CoordinateSystem type;
- };
- template <typename CoordinateType, typename CoordinateSystem>
- struct dimension<ro_lon_lat_point<CoordinateType, CoordinateSystem> >
- : boost::mpl::int_<2>
- {};
- template
- <
- typename CoordinateType,
- typename CoordinateSystem,
- std::size_t Dimension
- >
- struct access<ro_lon_lat_point<CoordinateType, CoordinateSystem>, Dimension>
- {
- static inline CoordinateType
- get(ro_lon_lat_point<CoordinateType, CoordinateSystem> const& p)
- {
- return (Dimension == 0) ? p.longitude : p.latitude;
- }
- };
- }}} // namespace boost::geometry::traits
- #endif // BOOST_GEOMETRY_TEST_TEST_GEOMETRIES_CUSTOM_LON_LAT_POINT_HPP
|