chore: Replace typedefs by using

This commit is contained in:
Vissarion Fisikopoulos 2025-02-04 17:22:04 +02:00
parent 3097cef828
commit 75c7dfded7
5 changed files with 37 additions and 68 deletions

View File

@ -68,8 +68,8 @@ private:
{ {
static inline bool apply(Point1 const& point1, Point2 const& point2) static inline bool apply(Point1 const& point1, Point2 const& point2)
{ {
typedef typename helper_geometry<Point1>::type helper_point_type1; using helper_point_type1 = typename helper_geometry<Point1>::type;
typedef typename helper_geometry<Point2>::type helper_point_type2; using helper_point_type2 = typename helper_geometry<Point2>::type;
helper_point_type1 point1_normalized; helper_point_type1 point1_normalized;
bool const exact_normalized = false; bool const exact_normalized = false;
@ -89,11 +89,11 @@ private:
{ {
static inline bool apply(Point1 const& point1, Point2 const& point2) static inline bool apply(Point1 const& point1, Point2 const& point2)
{ {
typedef typename geometry::select_most_precise using calculation_type = typename geometry::select_most_precise
< <
typename fp_coordinate_type<Point1>::type, typename fp_coordinate_type<Point1>::type,
typename fp_coordinate_type<Point2>::type typename fp_coordinate_type<Point2>::type
>::type calculation_type; >::type;
typename helper_geometry typename helper_geometry
< <
@ -151,7 +151,7 @@ namespace services
template <typename PointLike1, typename PointLike2, typename Tag1, typename Tag2> template <typename PointLike1, typename PointLike2, typename Tag1, typename Tag2>
struct default_strategy<PointLike1, PointLike2, Tag1, Tag2, pointlike_tag, pointlike_tag, spherical_tag, spherical_tag> struct default_strategy<PointLike1, PointLike2, Tag1, Tag2, pointlike_tag, pointlike_tag, spherical_tag, spherical_tag>
{ {
typedef strategy::within::spherical_point_point type; using type = strategy::within::spherical_point_point;
}; };
} // namespace services } // namespace services
@ -168,7 +168,7 @@ namespace strategy { namespace covered_by { namespace services
template <typename PointLike1, typename PointLike2, typename Tag1, typename Tag2> template <typename PointLike1, typename PointLike2, typename Tag1, typename Tag2>
struct default_strategy<PointLike1, PointLike2, Tag1, Tag2, pointlike_tag, pointlike_tag, spherical_tag, spherical_tag> struct default_strategy<PointLike1, PointLike2, Tag1, Tag2, pointlike_tag, pointlike_tag, spherical_tag, spherical_tag>
{ {
typedef strategy::within::spherical_point_point type; using type = strategy::within::spherical_point_point;
}; };
}}} // namespace strategy::covered_by::services }}} // namespace strategy::covered_by::services

View File

@ -152,11 +152,7 @@ struct constants_on_spheroid<CoordinateType, degree, false>
template <typename Units, typename CoordinateType> template <typename Units, typename CoordinateType>
inline CoordinateType latitude_convert_ep(CoordinateType const& lat) inline CoordinateType latitude_convert_ep(CoordinateType const& lat)
{ {
typedef math::detail::constants_on_spheroid using constants = math::detail::constants_on_spheroid<CoordinateType, Units>;
<
CoordinateType,
Units
> constants;
return constants::quarter_period() - lat; return constants::quarter_period() - lat;
} }
@ -165,31 +161,21 @@ inline CoordinateType latitude_convert_ep(CoordinateType const& lat)
template <typename Units, bool IsEquatorial, typename T> template <typename Units, bool IsEquatorial, typename T>
static bool is_latitude_pole(T const& lat) static bool is_latitude_pole(T const& lat)
{ {
typedef math::detail::constants_on_spheroid using constants = math::detail::constants_on_spheroid<T, Units>;
<
T,
Units
> constants;
return math::equals(math::abs(IsEquatorial return math::equals(math::abs(IsEquatorial
? lat ? lat
: math::latitude_convert_ep<Units>(lat)), : math::latitude_convert_ep<Units>(lat)),
constants::quarter_period()); constants::quarter_period());
} }
template <typename Units, typename T> template <typename Units, typename T>
static bool is_longitude_antimeridian(T const& lon) static bool is_longitude_antimeridian(T const& lon)
{ {
typedef math::detail::constants_on_spheroid using constants = math::detail::constants_on_spheroid<T, Units>;
<
T,
Units
> constants;
return math::equals(math::abs(lon), constants::half_period()); return math::equals(math::abs(lon), constants::half_period());
} }
@ -219,7 +205,7 @@ struct latitude_convert_if_polar<Units, false>
template <typename Units, typename CoordinateType, bool IsEquatorial = true> template <typename Units, typename CoordinateType, bool IsEquatorial = true>
class normalize_spheroidal_coordinates class normalize_spheroidal_coordinates
{ {
typedef constants_on_spheroid<CoordinateType, Units> constants; using constants = constants_on_spheroid<CoordinateType, Units>;
protected: protected:
static inline CoordinateType normalize_up(CoordinateType const& value) static inline CoordinateType normalize_up(CoordinateType const& value)
@ -324,7 +310,7 @@ public:
template <typename Units, typename CoordinateType> template <typename Units, typename CoordinateType>
inline void normalize_angle_loop(CoordinateType& angle) inline void normalize_angle_loop(CoordinateType& angle)
{ {
typedef constants_on_spheroid<CoordinateType, Units> constants; using constants = constants_on_spheroid<CoordinateType, Units>;
CoordinateType const pi = constants::half_period(); CoordinateType const pi = constants::half_period();
CoordinateType const two_pi = constants::period(); CoordinateType const two_pi = constants::period();
while (angle > pi) while (angle > pi)
@ -336,7 +322,7 @@ inline void normalize_angle_loop(CoordinateType& angle)
template <typename Units, typename CoordinateType> template <typename Units, typename CoordinateType>
inline void normalize_angle_cond(CoordinateType& angle) inline void normalize_angle_cond(CoordinateType& angle)
{ {
typedef constants_on_spheroid<CoordinateType, Units> constants; using constants = constants_on_spheroid<CoordinateType, Units>;
CoordinateType const pi = constants::half_period(); CoordinateType const pi = constants::half_period();
CoordinateType const two_pi = constants::period(); CoordinateType const two_pi = constants::period();
if (angle > pi) if (angle > pi)
@ -462,10 +448,7 @@ template <typename Units, typename CoordinateType>
inline CoordinateType longitude_distance_unsigned(CoordinateType const& longitude1, inline CoordinateType longitude_distance_unsigned(CoordinateType const& longitude1,
CoordinateType const& longitude2) CoordinateType const& longitude2)
{ {
typedef math::detail::constants_on_spheroid using constants = math::detail::constants_on_spheroid<CoordinateType, Units>;
<
CoordinateType, Units
> constants;
CoordinateType const c0 = 0; CoordinateType const c0 = 0;
CoordinateType diff = longitude_distance_signed<Units>(longitude1, longitude2); CoordinateType diff = longitude_distance_signed<Units>(longitude1, longitude2);

View File

@ -101,16 +101,16 @@ struct coordinate_cast<rational<T> >
template <typename T1, typename T2> template <typename T1, typename T2>
struct select_most_precise<boost::rational<T1>, boost::rational<T2> > struct select_most_precise<boost::rational<T1>, boost::rational<T2> >
{ {
typedef typename boost::rational using type = typename boost::rational
< <
typename select_most_precise<T1, T2>::type typename select_most_precise<T1, T2>::type
> type; > ;
}; };
template <typename T> template <typename T>
struct select_most_precise<boost::rational<T>, double> struct select_most_precise<boost::rational<T>, double>
{ {
typedef typename boost::rational<T> type; using type = typename boost::rational<T>;
}; };
namespace util namespace util

View File

@ -130,7 +130,7 @@ struct test_point_point_with_height
template <typename P> template <typename P>
void test_segment_segment(std::string const& header) void test_segment_segment(std::string const& header)
{ {
typedef bgm::segment<P> seg; using seg = bgm::segment<P>;
std::string const str = header + "-"; std::string const str = header + "-";
@ -159,7 +159,7 @@ void test_segment_segment(std::string const& header)
BOOST_AUTO_TEST_CASE( equals_point_point_se ) BOOST_AUTO_TEST_CASE( equals_point_point_se )
{ {
typedef bg::cs::spherical_equatorial<bg::degree> cs_type; using cs_type = bg::cs::spherical_equatorial<bg::degree>;
test_point_point<bgm::point<int, 2, cs_type> >::apply("se"); test_point_point<bgm::point<int, 2, cs_type> >::apply("se");
test_point_point<bgm::point<double, 2, cs_type> >::apply("se"); test_point_point<bgm::point<double, 2, cs_type> >::apply("se");
@ -206,7 +206,7 @@ BOOST_AUTO_TEST_CASE( equals_point_point_radian )
BOOST_AUTO_TEST_CASE( equals_point_point_with_height_se ) BOOST_AUTO_TEST_CASE( equals_point_point_with_height_se )
{ {
typedef bg::cs::spherical_equatorial<bg::degree> cs_type; using cs_type = bg::cs::spherical_equatorial<bg::degree>;
test_point_point<bgm::point<int, 3, cs_type> >::apply("seh"); test_point_point<bgm::point<int, 3, cs_type> >::apply("seh");
test_point_point<bgm::point<double, 3, cs_type> >::apply("seh"); test_point_point<bgm::point<double, 3, cs_type> >::apply("seh");
@ -226,7 +226,7 @@ BOOST_AUTO_TEST_CASE( equals_point_point_with_height_se )
BOOST_AUTO_TEST_CASE( equals_point_point_geo ) BOOST_AUTO_TEST_CASE( equals_point_point_geo )
{ {
typedef bg::cs::geographic<bg::degree> cs_type; using cs_type = bg::cs::geographic<bg::degree>;
test_point_point<bgm::point<int, 2, cs_type> >::apply("geo"); test_point_point<bgm::point<int, 2, cs_type> >::apply("geo");
test_point_point<bgm::point<double, 2, cs_type> >::apply("geo"); test_point_point<bgm::point<double, 2, cs_type> >::apply("geo");
@ -246,7 +246,7 @@ BOOST_AUTO_TEST_CASE( equals_point_point_geo )
BOOST_AUTO_TEST_CASE( equals_segment_segment_se ) BOOST_AUTO_TEST_CASE( equals_segment_segment_se )
{ {
typedef bg::cs::spherical_equatorial<bg::degree> cs_type; using cs_type = bg::cs::spherical_equatorial<bg::degree>;
test_segment_segment<bgm::point<int, 2, cs_type> >("se"); test_segment_segment<bgm::point<int, 2, cs_type> >("se");
test_segment_segment<bgm::point<double, 2, cs_type> >("se"); test_segment_segment<bgm::point<double, 2, cs_type> >("se");
@ -255,7 +255,7 @@ BOOST_AUTO_TEST_CASE( equals_segment_segment_se )
BOOST_AUTO_TEST_CASE( equals_segment_segment_geo ) BOOST_AUTO_TEST_CASE( equals_segment_segment_geo )
{ {
typedef bg::cs::geographic<bg::degree> cs_type; using cs_type = bg::cs::geographic<bg::degree>;
test_segment_segment<bgm::point<int, 2, cs_type> >("geo"); test_segment_segment<bgm::point<int, 2, cs_type> >("geo");
test_segment_segment<bgm::point<double, 2, cs_type> >("geo"); test_segment_segment<bgm::point<double, 2, cs_type> >("geo");

View File

@ -27,11 +27,12 @@
#include <boost/geometry/geometries/multi_linestring.hpp> #include <boost/geometry/geometries/multi_linestring.hpp>
#include <boost/geometry/algorithms/difference.hpp> #include <boost/geometry/algorithms/difference.hpp>
typedef bg::model::point<double,2,bg::cs::cartesian> point_type; using point_type = bg::model::point<double,2,bg::cs::cartesian>;
typedef bg::model::segment<point_type> segment_type; using segment_type = bg::model::segment<point_type>;
typedef bg::model::linestring<point_type> linestring_type; using linestring_type = bg::model::linestring<point_type>;
typedef bg::model::multi_linestring<linestring_type> multi_linestring_type; using multi_linestring_type = bg::model::multi_linestring<linestring_type>;
using L = linestring_type;
using ML = multi_linestring_type;
//=========================================================================== //===========================================================================
@ -47,10 +48,7 @@ BOOST_AUTO_TEST_CASE( test_difference_linestring_linestring )
std::cout << std::endl; std::cout << std::endl;
#endif #endif
typedef linestring_type L; using tester = test_difference_of_geometries<L, L, ML>;
typedef multi_linestring_type ML;
typedef test_difference_of_geometries<L, L, ML> tester;
tester::apply tester::apply
(from_wkt<L>("LINESTRING(0 0,1 1,2 1,3 2)"), (from_wkt<L>("LINESTRING(0 0,1 1,2 1,3 2)"),
@ -566,10 +564,7 @@ BOOST_AUTO_TEST_CASE( test_difference_linestring_multilinestring )
std::cout << std::endl; std::cout << std::endl;
#endif #endif
typedef linestring_type L; using tester = test_difference_of_geometries<L, ML, ML>;
typedef multi_linestring_type ML;
typedef test_difference_of_geometries<L, ML, ML> tester;
// disjoint linestrings // disjoint linestrings
tester::apply tester::apply
@ -790,10 +785,7 @@ BOOST_AUTO_TEST_CASE( test_difference_multilinestring_linestring )
std::cout << std::endl; std::cout << std::endl;
#endif #endif
typedef linestring_type L; using tester = test_difference_of_geometries<ML, L, ML>;
typedef multi_linestring_type ML;
typedef test_difference_of_geometries<ML, L, ML> tester;
// disjoint linestrings // disjoint linestrings
tester::apply tester::apply
@ -875,9 +867,7 @@ BOOST_AUTO_TEST_CASE( test_difference_multilinestring_multilinestring )
std::cout << std::endl; std::cout << std::endl;
#endif #endif
typedef multi_linestring_type ML; using tester = test_difference_of_geometries<ML, ML, ML>;
typedef test_difference_of_geometries<ML, ML, ML> tester;
// disjoint linestrings // disjoint linestrings
tester::apply tester::apply
@ -1167,9 +1157,7 @@ BOOST_AUTO_TEST_CASE( test_difference_ml_ml_degenerate )
std::cout << std::endl; std::cout << std::endl;
#endif #endif
typedef multi_linestring_type ML; using tester = test_difference_of_geometries<ML, ML, ML>;
typedef test_difference_of_geometries<ML, ML, ML> tester;
// the following test cases concern linestrings with duplicate // the following test cases concern linestrings with duplicate
// points and possibly linestrings with zero length. // points and possibly linestrings with zero length.
@ -1254,9 +1242,7 @@ BOOST_AUTO_TEST_CASE( test_difference_ml_ml_spikes )
std::cout << std::endl; std::cout << std::endl;
#endif #endif
typedef multi_linestring_type ML; using tester = test_difference_of_geometries<ML, ML, ML>;
typedef test_difference_of_geometries<ML, ML, ML> tester;
// the following test cases concern linestrings with spikes // the following test cases concern linestrings with spikes
@ -1446,9 +1432,9 @@ BOOST_AUTO_TEST_CASE( test_difference_ml_ml_spikes )
BOOST_AUTO_TEST_CASE( test_difference_ls_mls_geo_rad ) BOOST_AUTO_TEST_CASE( test_difference_ls_mls_geo_rad )
{ {
typedef bg::model::point<double, 2, bg::cs::geographic<bg::radian> > pt; using pt = bg::model::point<double, 2, bg::cs::geographic<bg::radian>>;
typedef bg::model::linestring<pt> ls; using ls = bg::model::linestring<pt>;
typedef bg::model::multi_linestring<ls> mls; using mls = bg::model::multi_linestring<ls>;
bg::srs::spheroid<double> sph_wgs84(6378137.0, 6356752.3142451793); bg::srs::spheroid<double> sph_wgs84(6378137.0, 6356752.3142451793);
boost::geometry::strategy::intersection::geographic_segments<> wgs84(sph_wgs84); boost::geometry::strategy::intersection::geographic_segments<> wgs84(sph_wgs84);