Skip to content

Commit

Permalink
chore: replace typename coordinate_system with coordinate_system_t an…
Browse files Browse the repository at this point in the history
…d add detail meta function coordinate_system_unit
  • Loading branch information
barendgehrels committed Oct 31, 2024
1 parent 7d4c687 commit fe2098b
Show file tree
Hide file tree
Showing 33 changed files with 109 additions and 100 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ struct collected_vector_polar
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;
Expand Down
2 changes: 1 addition & 1 deletion include/boost/geometry/algorithms/detail/gc_make_rtree.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>
>
>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ class multipoint_multipolygon_point
<
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>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
<
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>();
Expand Down
2 changes: 1 addition & 1 deletion include/boost/geometry/algorithms/merge_elements.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 16 additions & 1 deletion include/boost/geometry/core/coordinate_system.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
8 changes: 4 additions & 4 deletions include/boost/geometry/core/radian_access.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/*!
Expand All @@ -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);
}

/*!
Expand All @@ -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);
}

/*!
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion include/boost/geometry/formulas/geographic.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};


Expand Down
6 changes: 3 additions & 3 deletions include/boost/geometry/geometries/concepts/point_concept.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion include/boost/geometry/index/rtree.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ class rtree
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;
Expand Down
2 changes: 1 addition & 1 deletion include/boost/geometry/srs/transformation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ public :
<
calculation_type,
dimension<PointOfSegment>::value,
typename coordinate_system<PointOfSegment>::type
coordinate_system_t<PointOfSegment>
> fp_point_type;

// For convenience
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class cross_track
<
CT,
dimension<PointOfSegment>::value,
typename coordinate_system<PointOfSegment>::type
coordinate_system_t<PointOfSegment>
> result;

// http://williams.best.vwh.net/avform.htm#XTE
Expand Down
2 changes: 1 addition & 1 deletion test/algorithms/envelope_expand/envelope_on_spheroid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ class envelope_on_spheroid_basic_tester
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>();

Expand Down
6 changes: 1 addition & 5 deletions test/algorithms/envelope_expand/expand_on_spheroid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,7 @@ class test_expand_on_spheroid
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;
Expand Down
24 changes: 12 additions & 12 deletions test/algorithms/similarity/discrete_frechet_distance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand Down
37 changes: 19 additions & 18 deletions test/algorithms/similarity/discrete_hausdorff_distance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand All @@ -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);
Expand All @@ -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);
Expand Down
Loading

0 comments on commit fe2098b

Please sign in to comment.