chore: replace typename coordinate_system with coordinate_system_t and add detail meta function coordinate_system_unit

This commit is contained in:
Barend Gehrels 2024-10-31 21:59:04 +01:00
parent 7d4c687fd8
commit 60ad3bdd6f
33 changed files with 109 additions and 100 deletions

View File

@ -62,7 +62,7 @@ struct intersects_antimeridian
return apply
<
typename coordinate_system<Point>::type::units
detail::coordinate_system_units_t<Point>
>(geometry::get<0>(p1_normalized),
geometry::get<1>(p1_normalized),
geometry::get<0>(p2_normalized),

View File

@ -254,7 +254,7 @@ private:
using constants = math::detail::constants_on_spheroid
<
coord_type,
typename coordinate_system<Point>::type::units
detail::coordinate_system_units_t<Point>
> ;
constexpr coord_type pi_2 = constants::half_period() / 2;

View File

@ -39,7 +39,7 @@ using gc_make_rtree_box_t = geometry::model::box
<
geometry::coordinate_type_t<GC>,
geometry::dimension<GC>::value,
typename geometry::coordinate_system<GC>::type
geometry::coordinate_system_t<GC>
>
>;

View File

@ -187,7 +187,7 @@ private:
<
geometry::coordinate_type_t<MultiPoint>,
geometry::dimension<MultiPoint>::value,
typename geometry::coordinate_system<MultiPoint>::type
geometry::coordinate_system_t<MultiPoint>
>;
using box_type = geometry::model::box<point_type>;
using box_pair = std::pair<box_type, std::size_t>;

View File

@ -55,11 +55,8 @@ struct preceding_check<0, Geometry, spherical_tag>
template <typename Point, typename Box>
static inline bool apply(int dir, Point const& point, Box const& point_box, Box const& other_box)
{
typedef typename select_coordinate_type
<
Point, Box
>::type calc_t;
typedef typename coordinate_system<Point>::type::units units_t;
using calc_t = typename select_coordinate_type<Point, Box>::type;
using units_t = detail::coordinate_system_units_t<Point>;
calc_t const c0 = 0;

View File

@ -190,7 +190,7 @@ struct get_direction_loop<Point, DimensionVector, 0, Count, spherical_tag>
int directions[Count])
{
using coordinate_type = coordinate_type_t<Segment>;
using units_t = typename coordinate_system<Point>::type::units;
using units_t = detail::coordinate_system_units_t<Point>;
coordinate_type const diff = math::longitude_distance_signed
<

View File

@ -114,8 +114,8 @@ struct box_box
{
BOOST_STATIC_ASSERT((std::is_same
<
typename geometry::coordinate_system<Box1>::type,
typename geometry::coordinate_system<Box2>::type
geometry::coordinate_system_t<Box1>,
geometry::coordinate_system_t<Box2>
>::value
));
assert_dimension_equal<Box1, Box2>();

View File

@ -271,7 +271,7 @@ struct merge_gc
using original_point_t = geometry::point_type_t<GeometryCollection>;
using iterator_t = typename boost::range_iterator<GeometryCollection const>::type;
using coor_t = geometry::coordinate_type_t<original_point_t>;
using cs_t = typename geometry::coordinate_system<original_point_t>::type;
using cs_t = geometry::coordinate_system_t<original_point_t>;
using point_t = model::point<coor_t, 2, cs_t>;
using multi_point_t = typename util::sequence_find_if

View File

@ -96,10 +96,25 @@ struct coordinate_system
>::type;
};
template <typename Geometry>
using coordinate_system_t = typename coordinate_system<Geometry>::type;
#ifndef DOXYGEN_NO_DETAIL
namespace detail {
// Short cut for coordinate system units
template <typename Geometry>
struct coordinate_system_units
{
using type = typename coordinate_system<Geometry>::type::units;
};
template <typename Geometry>
using coordinate_system_units_t = typename coordinate_system_units<Geometry>::type;
} // namespace detail
#endif // DOXYGEN_NO_DETAIL
}} // namespace boost::geometry

View File

@ -191,7 +191,7 @@ template <std::size_t Dimension, typename Geometry>
inline typename fp_coordinate_type<Geometry>::type get_as_radian(Geometry const& geometry)
{
return detail::radian_access<Dimension, Geometry,
typename coordinate_system<Geometry>::type>::get(geometry);
coordinate_system_t<Geometry>>::get(geometry);
}
/*!
@ -211,7 +211,7 @@ inline void set_from_radian(Geometry& geometry,
typename fp_coordinate_type<Geometry>::type const& radians)
{
detail::radian_access<Dimension, Geometry,
typename coordinate_system<Geometry>::type>::set(geometry, radians);
coordinate_system_t<Geometry>>::set(geometry, radians);
}
/*!
@ -231,7 +231,7 @@ template <std::size_t Index, std::size_t Dimension, typename Geometry>
inline typename fp_coordinate_type<Geometry>::type get_as_radian(Geometry const& geometry)
{
return detail::radian_access_box_segment<Index, Dimension, Geometry,
typename coordinate_system<Geometry>::type>::get(geometry);
coordinate_system_t<Geometry>>::get(geometry);
}
/*!
@ -252,7 +252,7 @@ inline void set_from_radian(Geometry& geometry,
typename fp_coordinate_type<Geometry>::type const& radians)
{
detail::radian_access_box_segment<Index, Dimension, Geometry,
typename coordinate_system<Geometry>::type>::set(geometry, radians);
coordinate_system_t<Geometry>>::set(geometry, radians);
}
}} // namespace boost::geometry

View File

@ -128,7 +128,7 @@ inline PointGeo cart3d_to_geo(Point3d const& point_3d, Spheroid const& spheroid)
math::normalize_spheroidal_coordinates
<
typename coordinate_system<PointGeo>::type::units,
geometry::detail::coordinate_system_units_t<PointGeo>,
coord_t
>(lon, lat);

View File

@ -47,14 +47,14 @@ struct tag<boost::polygon::point_data<CoordinateType> >
template <typename CoordinateType>
struct coordinate_type<boost::polygon::point_data<CoordinateType> >
{
typedef CoordinateType type;
using type = CoordinateType;
};
template <typename CoordinateType>
struct coordinate_system<boost::polygon::point_data<CoordinateType> >
{
typedef cs::cartesian type;
using type = cs::cartesian;
};

View File

@ -41,7 +41,7 @@ class Point
#ifndef DOXYGEN_NO_CONCEPT_MEMBERS
using ctype = coordinate_type_t<Geometry>;
using csystem = typename coordinate_system<Geometry>::type;
using csystem = coordinate_system_t<Geometry>;
// The following enum is used to fully instantiate the coordinate
// system class; this is needed in order to check the units passed
@ -93,8 +93,8 @@ class ConstPoint
{
#ifndef DOXYGEN_NO_CONCEPT_MEMBERS
typedef coordinate_type_t<Geometry> ctype;
typedef typename coordinate_system<Geometry>::type csystem;
using ctype = coordinate_type_t<Geometry>;
using csystem = coordinate_system_t<Geometry>;
// The following enum is used to fully instantiate the coordinate
// system class; this is needed in order to check the units passed

View File

@ -195,7 +195,7 @@ public:
geometry::model::point<
coordinate_type_t<indexable_type>,
dimension<indexable_type>::value,
typename coordinate_system<indexable_type>::type
coordinate_system_t<indexable_type>
>
>
bounds_type;

View File

@ -103,7 +103,7 @@ struct transform_geometry_point
CT
>::type,
geometry::dimension<point_type>::type::value,
typename geometry::coordinate_system<point_type>::type
geometry::coordinate_system_t<point_type>
>;
template <typename PtIn, typename PtOut>

View File

@ -42,7 +42,7 @@ struct compute_closest_point_to_segment
<
CalculationType,
dimension<PointOfSegment>::value,
typename coordinate_system<PointOfSegment>::type
coordinate_system_t<PointOfSegment>
>;
// For convenience

View File

@ -170,7 +170,7 @@ public :
<
calculation_type,
dimension<PointOfSegment>::value,
typename coordinate_system<PointOfSegment>::type
coordinate_system_t<PointOfSegment>
> fp_point_type;
// For convenience

View File

@ -84,7 +84,7 @@ public :
<
typename calculation_type<Point, PointOfSegment>::type,
dimension<PointOfSegment>::value,
typename coordinate_system<PointOfSegment>::type
coordinate_system_t<PointOfSegment>
> cp;
geometry::set_from_radian<0>(cp, result.lon);

View File

@ -93,7 +93,7 @@ public:
<
CT,
dimension<PointOfSegment>::value,
typename coordinate_system<PointOfSegment>::type
coordinate_system_t<PointOfSegment>
> result;
// http://williams.best.vwh.net/avform.htm#XTE

View File

@ -201,7 +201,7 @@ private:
T3 const& lon_max, T4 const& lat_max, double height_max,
double tolerance)
{
typedef typename bg::coordinate_system<Box>::type::units box_units_type;
using box_units_type = bg::detail::coordinate_system_unit_t<Box>;
std::string const units_str = units2string<box_units_type>();

View File

@ -138,11 +138,7 @@ private:
double height_max2,
double tolerance)
{
typedef typename bg::coordinate_system
<
Box
>::type::units box_units_type;
using box_units_type = bg::detail::coordinate_system_units_t<Box>;
std::string const units_str = units2string<box_units_type>();
Box detected;

View File

@ -16,13 +16,13 @@
#include "test_frechet_distance.hpp"
template <typename P>
template <typename P>
void test_all_cartesian()
{
typedef bg::model::linestring<P> linestring_2d;
using linestring_2d = bg::model::linestring<P>;
#ifdef BOOST_GEOMETRY_TEST_DEBUG
typedef typename coordinate_system<P>::type CordType;
std::cout << typeid(CordType).name() << std::endl;
using coor_t = bg::coordinate_system_t<P>;
std::cout << typeid(coor_t).name() << std::endl;
#endif
test_geometry<linestring_2d,linestring_2d >("LINESTRING(3 0,2 1,3 2)","LINESTRING(0 0,3 4,4 3)", 3);
@ -37,14 +37,14 @@ void test_all_cartesian()
}
template <typename P>
template <typename P>
void test_all_geographic()
{
typedef bg::model::linestring<P> linestring_2d;
using linestring_2d = bg::model::linestring<P>;
#ifdef BOOST_GEOMETRY_TEST_DEBUG
typedef typename coordinate_system<P>::type CordType;
std::cout << typeid(CordType).name() << std::endl;
using coor_t = bg::coordinate_system_t<P>;
std::cout << typeid(coor_t).name() << std::endl;
#endif
test_geometry<linestring_2d,linestring_2d >("LINESTRING(3 0,2 1,3 2)","LINESTRING(0 0,3 4,4 3)", 333958);
@ -59,14 +59,14 @@ void test_all_geographic()
}
template <typename P>
template <typename P>
void test_all_spherical_equ()
{
typedef bg::model::linestring<P> linestring_2d;
using linestring_2d = bg::model::linestring<P>;
#ifdef BOOST_GEOMETRY_TEST_DEBUG
typedef typename coordinate_system<P>::type CordType;
std::cout << typeid(CordType).name() << std::endl;
using coor_t = bg::coordinate_system_t<P>;
std::cout << typeid(coor_t).name() << std::endl;
#endif
test_geometry<linestring_2d,linestring_2d >("LINESTRING(3 0,2 1,3 2)","LINESTRING(0 0,3 4,4 3)", 0.05235987);

View File

@ -23,16 +23,16 @@
#include "test_hausdorff_distance.hpp"
template <typename P>
template <typename P>
void test_all_cartesian()
{
typedef bg::model::linestring<P> linestring_2d;
typedef bg::model::multi_linestring<linestring_2d> mlinestring_t;
typedef bg::model::multi_point<P> mpoint_t;
using linestring_2d = bg::model::linestring<P>;
using mlinestring_t = bg::model::multi_linestring<linestring_2d>;
using mpoint_t = bg::model::multi_point<P>;
#ifdef BOOST_GEOMETRY_TEST_DEBUG
typedef typename coordinate_system<P>::type CordType;
std::cout << typeid(CordType).name() << std::endl;
using coor_t = bg::coordinate_system_t<P>;
std::cout << typeid(coor_t).name() << std::endl;
#endif
test_geometry<P,mpoint_t>("POINT(3 1)","MULTIPOINT(0 0,3 4,4 3)", sqrt(5.0));
@ -48,15 +48,16 @@ void test_all_cartesian()
test_geometry<linestring_2d,linestring_2d >("LINESTRING(0 0,3 4,4 3)","LINESTRING(4 3,3 4,0 0)",0);
}
template <typename P>
template <typename P>
void test_all_geographic()
{
typedef bg::model::linestring<P> linestring_2d;
typedef bg::model::multi_linestring<linestring_2d> mlinestring_t;
typedef bg::model::multi_point<P> mpoint_t;
using linestring_2d = bg::model::linestring<P>;
using mlinestring_t = bg::model::multi_linestring<linestring_2d>;
using mpoint_t = bg::model::multi_point<P>;
#ifdef BOOST_GEOMETRY_TEST_DEBUG
typedef typename coordinate_system<P>::type CordType;
std::cout << typeid(CordType).name() << std::endl;
using coor_t = bg::coordinate_system_t<P>;
std::cout << typeid(coor_t).name() << std::endl;
#endif
test_geometry<P,mpoint_t>("POINT(3 1)","MULTIPOINT(0 0,3 4,4 3)", 247552);
@ -74,16 +75,16 @@ void test_all_geographic()
test_geometry<linestring_2d,linestring_2d >("LINESTRING(0 0,3 4,4 3)","LINESTRING(4 3,3 4,0 0)",0);
}
template <typename P>
template <typename P>
void test_all_spherical_equ()
{
typedef bg::model::linestring<P> linestring_2d;
typedef bg::model::multi_linestring<linestring_2d> mlinestring_t;
typedef bg::model::multi_point<P> mpoint_t;
using linestring_2d = bg::model::linestring<P>;
using mlinestring_t = bg::model::multi_linestring<linestring_2d>;
using mpoint_t = bg::model::multi_point<P>;
#ifdef BOOST_GEOMETRY_TEST_DEBUG
typedef typename coordinate_system<P>::type CordType;
std::cout << typeid(CordType).name() << std::endl;
using coor_t = bg::coordinate_system_t<P>;
std::cout << typeid(coor_t).name() << std::endl;
#endif
test_geometry<P,mpoint_t>("POINT(3 1)","MULTIPOINT(0 0,3 4,4 3)", 0.03902);

View File

@ -30,9 +30,9 @@ struct rw_point
namespace boost { namespace geometry { namespace traits {
template <> struct tag<ro_point> { typedef point_tag type; };
template <> struct coordinate_type<ro_point> { typedef float type; };
template <> struct coordinate_system<ro_point> { typedef cs::cartesian type; };
template <> struct tag<ro_point> { using type = point_tag; };
template <> struct coordinate_type<ro_point> { using type = float; };
template <> struct coordinate_system<ro_point> { using type = cs::cartesian; };
template <> struct dimension<ro_point> { enum { value = 2 }; };
template <> struct access<ro_point, 0>
@ -48,9 +48,9 @@ template <> struct access<ro_point, 1>
template <> struct tag<rw_point> { typedef point_tag type; };
template <> struct coordinate_type<rw_point> { typedef float type; };
template <> struct coordinate_system<rw_point> { typedef cs::cartesian type; };
template <> struct tag<rw_point> { using type = point_tag; };
template <> struct coordinate_type<rw_point> { using type = float; };
template <> struct coordinate_system<rw_point> { using type = cs::cartesian; };
template <> struct dimension<rw_point> { enum { value = 2 }; };
template <> struct access<rw_point, 0>

View File

@ -27,19 +27,19 @@ namespace boost { namespace geometry { namespace traits {
template <>
struct tag<point>
{
typedef point_tag type;
using type = point_tag;
};
template <>
struct coordinate_type<point>
{
typedef float type;
using type = float;
};
template <>
struct coordinate_system<point>
{
typedef bg::cs::cartesian type;
using type = bg::cs::cartesian;
};
template <>

View File

@ -28,9 +28,9 @@ struct point
namespace boost { namespace geometry { namespace traits {
template <> struct tag<point> { typedef point_tag type; };
template <> struct coordinate_type<point> { typedef float type; };
template <> struct coordinate_system<point> { typedef bg::cs::cartesian type; };
template <> struct tag<point> { using type = point_tag; };
template <> struct coordinate_type<point> { using type = float; };
template <> struct coordinate_system<point> { using type = bg::cs::cartesian; };
template <> struct dimension<point> { enum { value = 3 }; };
template <> struct access<point, 0>

View File

@ -25,9 +25,9 @@ struct point
namespace boost { namespace geometry { namespace traits {
template <> struct tag<point> { typedef point_tag type; };
//template <> struct coordinate_type<point> { typedef float type; };
template <> struct coordinate_system<point> { typedef bg::cs::cartesian type; };
template <> struct tag<point> { using type = point_tag; };
//template <> struct coordinate_type<point> { using type = float; };
template <> struct coordinate_system<point> { using type = bg::cs::cartesian; };
template <> struct dimension<point> { enum { value = 2 }; };
template <> struct access<point, 0>

View File

@ -26,9 +26,9 @@ struct point
namespace boost { namespace geometry { namespace traits {
template <> struct tag<point> { typedef point_tag type; };
template <> struct coordinate_type<point> { typedef float type; };
template <> struct coordinate_system<point> { typedef bg::cs::cartesian type; };
template <> struct tag<point> { using type = point_tag; };
template <> struct coordinate_type<point> { using type = float; };
template <> struct coordinate_system<point> { using type = bg::cs::cartesian; };
//template <> struct dimension<point> { enum { value = 2 }; };
template <> struct access<point, 0>

View File

@ -25,9 +25,9 @@ struct point
namespace boost { namespace geometry { namespace traits {
template <> struct tag<point> { typedef point_tag type; };
template <> struct coordinate_type<point> { typedef float type; };
template <> struct coordinate_system<point> { typedef bg::cs::cartesian type; };
template <> struct tag<point> { using type = point_tag; };
template <> struct coordinate_type<point> { using type = float; };
template <> struct coordinate_system<point> { using type = bg::cs::cartesian; };
template <> struct dimension<point> { enum { value = 2 }; };
template <> struct access<point, 0>

View File

@ -25,9 +25,9 @@ struct point
namespace boost { namespace geometry { namespace traits {
template <> struct tag<point> { typedef point_tag type; };
template <> struct coordinate_type<point> { typedef float type; };
template <> struct coordinate_system<point> { typedef bg::cs::cartesian type; };
template <> struct tag<point> { using type = point_tag; };
template <> struct coordinate_type<point> { using type = float; };
template <> struct coordinate_system<point> { using type = bg::cs::cartesian; };
template <> struct dimension<point> { enum { value = 2 }; };
template <> struct access<point, 0>

View File

@ -30,9 +30,9 @@ struct rw_point
namespace boost { namespace geometry { namespace traits {
template <> struct tag<ro_point> { typedef point_tag type; };
template <> struct coordinate_type<ro_point> { typedef float type; };
template <> struct coordinate_system<ro_point> { typedef bg::cs::cartesian type; };
template <> struct tag<ro_point> { using type = point_tag; };
template <> struct coordinate_type<ro_point> { using type = float; };
template <> struct coordinate_system<ro_point> { using type = bg::cs::cartesian; };
template <> struct dimension<ro_point> { enum { value = 2 }; };
template <> struct access<ro_point, 0>
@ -48,9 +48,9 @@ template <> struct access<ro_point, 1>
template <> struct tag<rw_point> { typedef point_tag type; };
template <> struct coordinate_type<rw_point> { typedef float type; };
template <> struct coordinate_system<rw_point> { typedef bg::cs::cartesian type; };
template <> struct tag<rw_point> { using type = point_tag; };
template <> struct coordinate_type<rw_point> { using type = float; };
template <> struct coordinate_system<rw_point> { using type = bg::cs::cartesian; };
template <> struct dimension<rw_point> { enum { value = 2 }; };
template <> struct access<rw_point, 0>

View File

@ -59,10 +59,10 @@ template<>
struct tag<test::test_point> { using type = point_tag; };
template<>
struct coordinate_type<test::test_point> { typedef float type; };
struct coordinate_type<test::test_point> { using type = float; };
template<>
struct coordinate_system<test::test_point> { typedef cs::cartesian type; };
struct coordinate_system<test::test_point> { using type = cs::cartesian; };
template<>
struct dimension<test::test_point> : std::integral_constant<int, 3> {};

View File

@ -48,10 +48,10 @@ template<> struct tag<test::test_point_xy>
{ using type = point_tag; };
template<> struct coordinate_type<test::test_point_xy>
{ typedef double type; };
{ using type = double; };
template<> struct coordinate_system<test::test_point_xy>
{ typedef cs::cartesian type; };
{ using type = cs::cartesian; };
template<> struct dimension<test::test_point_xy> : std::integral_constant<int, 2> {};