Skip to content

Commit

Permalink
chore: change coordinate_type to coordinate_type_t and use 'using' at…
Browse files Browse the repository at this point in the history
… those places
  • Loading branch information
barendgehrels committed Oct 28, 2024
1 parent 19f22c2 commit 6178d86
Show file tree
Hide file tree
Showing 144 changed files with 499 additions and 539 deletions.
6 changes: 3 additions & 3 deletions include/boost/geometry/algorithms/area_result.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@ template <typename Curr, typename Next>
struct more_precise_coordinate_type
: std::is_same
<
typename geometry::coordinate_type<Curr>::type,
geometry::coordinate_type_t<Curr>,
typename geometry::select_most_precise
<
typename geometry::coordinate_type<Curr>::type,
typename geometry::coordinate_type<Next>::type
geometry::coordinate_type_t<Curr>,
geometry::coordinate_type_t<Next>
>::type
>
{};
Expand Down
11 changes: 6 additions & 5 deletions include/boost/geometry/algorithms/azimuth.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,19 +58,20 @@ struct azimuth<Point1, Point2, point_tag, point_tag>
template <typename Strategy>
static auto apply(Point1 const& p1, Point2 const& p2, Strategy const& strategy)
{
typedef typename decltype(strategy.azimuth())::template result_type
auto azimuth_strategy = strategy.azimuth();
using calc_t = typename decltype(azimuth_strategy)::template result_type
<
typename coordinate_type<Point1>::type,
typename coordinate_type<Point2>::type
>::type calc_t;
coordinate_type_t<Point1>,
coordinate_type_t<Point2>
>::type;

calc_t result = 0;
calc_t const x1 = geometry::get_as_radian<0>(p1);
calc_t const y1 = geometry::get_as_radian<1>(p1);
calc_t const x2 = geometry::get_as_radian<0>(p2);
calc_t const y2 = geometry::get_as_radian<1>(p2);

strategy.azimuth().apply(x1, y1, x2, y2, result);
azimuth_strategy.apply(x1, y1, x2, y2, result);

// NOTE: It is not clear which units we should use for the result.
// For now radians are always returned but a user could expect
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,7 @@ inline void assign_point_to_index(Point const& point, Geometry& geometry)
detail::for_each_dimension<Geometry>([&](auto dimension)
{
geometry::set<Index, dimension>(geometry,
util::numeric_cast
<
typename coordinate_type<Geometry>::type
>(geometry::get<dimension>(point)));
util::numeric_cast<coordinate_type_t<Geometry>>(geometry::get<dimension>(point)));
});
}

Expand Down Expand Up @@ -93,7 +90,7 @@ inline void assign_point_from_index(Geometry const& geometry, Point& point)
geometry::set<dimension>(point,
util::numeric_cast
<
typename coordinate_type<Point>::type
coordinate_type_t<Point>
>(geometry::get<Index, dimension>(geometry)));
});
}
Expand Down
14 changes: 7 additions & 7 deletions include/boost/geometry/algorithms/detail/assign_values.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ struct assign_zero_point
template <typename Point>
static inline void apply(Point& point)
{
typedef typename coordinate_type<Point>::type coordinate_type;
using coordinate_type = coordinate_type_t<Point>;

coordinate_type const zero = 0;
detail::for_each_dimension<Point>([&](auto dimension)
Expand All @@ -71,7 +71,7 @@ struct assign_inverse_box_or_segment
template <typename BoxOrSegment>
static inline void apply(BoxOrSegment& geometry)
{
typedef typename coordinate_type<BoxOrSegment>::type coordinate_type;
using coordinate_type = coordinate_type_t<BoxOrSegment>;

coordinate_type const highest = util::bounds<coordinate_type>::highest();
coordinate_type const lowest = util::bounds<coordinate_type>::lowest();
Expand All @@ -90,7 +90,7 @@ struct assign_zero_box_or_segment
template <typename BoxOrSegment>
static inline void apply(BoxOrSegment& geometry)
{
typedef typename coordinate_type<BoxOrSegment>::type coordinate_type;
using coordinate_type = coordinate_type_t<BoxOrSegment>;

coordinate_type const zero = 0;
detail::for_each_dimension<BoxOrSegment>([&](auto dimension)
Expand All @@ -114,7 +114,7 @@ inline void assign_box_2d_corner(Box const& box, Point& point)
assert_dimension<Point, 2>();

// Copy coordinates
typedef typename coordinate_type<Point>::type coordinate_type;
using coordinate_type = coordinate_type_t<Point>;

geometry::set<0>(point, util::numeric_cast<coordinate_type>(get<Corner1, 0>(box)));
geometry::set<1>(point, util::numeric_cast<coordinate_type>(get<Corner2, 1>(box)));
Expand All @@ -125,7 +125,7 @@ inline void assign_box_2d_corner(Box const& box, Point& point)
template <typename Geometry>
struct assign_2d_box_or_segment
{
typedef typename coordinate_type<Geometry>::type coordinate_type;
using coordinate_type = coordinate_type_t<Geometry>;

// Here we assign 4 coordinates to a box of segment
// -> Most logical is: x1,y1,x2,y2
Expand Down Expand Up @@ -161,7 +161,7 @@ struct assign
template <typename Point>
struct assign<point_tag, Point, 2>
{
typedef typename coordinate_type<Point>::type coordinate_type;
using coordinate_type = coordinate_type_t<Point>;

template <typename T>
static inline void apply(Point& point, T const& c1, T const& c2)
Expand All @@ -174,7 +174,7 @@ struct assign<point_tag, Point, 2>
template <typename Point>
struct assign<point_tag, Point, 3>
{
typedef typename coordinate_type<Point>::type coordinate_type;
using coordinate_type = coordinate_type_t<Point>;

template <typename T>
static inline void apply(Point& point, T const& c1, T const& c2, T const& c3)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace detail { namespace buffer
template <typename BoxIn, typename BoxOut, typename T, std::size_t C, std::size_t D, std::size_t N>
struct box_loop
{
typedef typename coordinate_type<BoxOut>::type coordinate_type;
using coordinate_type = coordinate_type_t<BoxOut>;

static inline void apply(BoxIn const& box_in, T const& distance, BoxOut& box_out)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@ template
>
struct buffered_piece_collection
{
typedef typename geometry::point_type<Ring>::type point_type;
typedef typename geometry::coordinate_type<Ring>::type coordinate_type;
using point_type = geometry::point_type_t<Ring>;
using coordinate_type = geometry::coordinate_type_t<Ring>;

// Ring/polygon type, always clockwise
typedef geometry::model::ring<point_type> clockwise_ring_type;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,13 @@ struct closure<geometry::detail::buffer::buffered_ring<Ring> >
template <typename Ring>
struct point_type<geometry::detail::buffer::buffered_ring_collection<Ring> >
{
typedef typename geometry::point_type<Ring>::type type;
using type = geometry::point_type_t<Ring>;
};

template <typename Ring>
struct tag<geometry::detail::buffer::buffered_ring_collection<Ring> >
{
typedef geometry::detail::buffer::buffered_ring_collection_tag type;
using type = geometry::detail::buffer::buffered_ring_collection_tag;
};


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ namespace detail { namespace buffer
template <typename Ring>
struct unique_sub_range_from_piece
{
typedef typename boost::range_iterator<Ring const>::type iterator_type;
typedef typename geometry::point_type<Ring const>::type point_type;
using iterator_type = typename boost::range_iterator<Ring const>::type;
using point_type = geometry::point_type_t<Ring const>;

unique_sub_range_from_piece(Ring const& ring,
iterator_type iterator_at_i, iterator_type iterator_at_j)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ struct line_line_intersection
// in a custom strategy, then the calculation of the point in between
// might be incorrect and the optimization is not used.

using ct = typename coordinate_type<Point>::type;
using ct = coordinate_type_t<Point>;

auto const p = detail::make::make_infinite_line<ct>(pi, pj);
auto const q = detail::make::make_infinite_line<ct>(qi, qj);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,9 @@ namespace detail { namespace buffer
template <typename Ring, typename Point>
struct piece_border
{
typedef typename geometry::coordinate_type<Point>::type coordinate_type;
typedef typename default_comparable_distance_result<Point>::type radius_type;
typedef typename geometry::strategy::buffer::turn_in_ring_winding<coordinate_type>::state_type state_type;
using coordinate_type = geometry::coordinate_type_t<Point>;
using radius_type = typename default_comparable_distance_result<Point>::type;
using state_type = typename geometry::strategy::buffer::turn_in_ring_winding<coordinate_type>::state_type;

bool m_reversed;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ template
>
struct translating_transformer
{
typedef typename geometry::point_type<Geometry>::type point_type;
typedef boost::reference_wrapper<point_type const> result_type;
using point_type = geometry::point_type_t<Geometry>;
using result_type = boost::reference_wrapper<point_type const>;

explicit translating_transformer(Geometry const&) {}
explicit translating_transformer(point_type const&) {}
Expand All @@ -72,8 +72,8 @@ struct translating_transformer
template <typename Geometry>
struct translating_transformer<Geometry, areal_tag, cartesian_tag>
{
typedef typename geometry::point_type<Geometry>::type point_type;
typedef point_type result_type;
using point_type = geometry::point_type_t<Geometry>;
using result_type = point_type;

explicit translating_transformer(Geometry const& geom)
: m_origin(NULL)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ struct linear_to_areal

using point_type = typename std::conditional
<
std::is_same<typename coordinate_type<Linear>::type, most_precise_type>::value,
std::is_same<coordinate_type_t<Linear>, most_precise_type>::value,
point_type_t<Linear>,
point_type_t<Areal>
>::type;
Expand Down Expand Up @@ -141,7 +141,7 @@ struct areal_to_areal

using point_type = typename std::conditional
<
std::is_same<typename coordinate_type<Areal1>::type, most_precise_type>::value,
std::is_same<coordinate_type_t<Areal1>, most_precise_type>::value,
point_type_t<Areal1>,
point_type_t<Areal2>
>::type;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ struct indexed_to_indexed
{
static inline void apply(Source const& source, Destination& destination)
{
typedef typename coordinate_type<Destination>::type coordinate_type;
using coordinate_type = coordinate_type_t<Destination>;

geometry::set<min_corner, Dimension>(destination,
util::numeric_cast<coordinate_type>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ struct point_to_point
{
static inline void apply(Source const& source, Destination& destination)
{
typedef typename coordinate_type<Destination>::type coordinate_type;
using coordinate_type = coordinate_type_t<Destination>;

set<Dimension>(destination, util::numeric_cast<coordinate_type>(get<Dimension>(source)));
point_to_point<Source, Destination, Dimension + 1, DimensionCount>::apply(source, destination);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ struct convex_hull<GeometryCollection, geometry_collection_tag>
{
// Assuming that single point_type is used by the GeometryCollection
using subgeometry_type = typename detail::first_geometry_type<GeometryCollection>::type;
using point_type = typename geometry::point_type<subgeometry_type>::type;
using point_type = geometry::point_type_t<subgeometry_type>;
using ring_type = model::ring<point_type, true, false>;

// Calculate box rings once
Expand Down
10 changes: 5 additions & 5 deletions include/boost/geometry/algorithms/detail/direction_code.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,9 @@ struct direction_code_impl<spherical_equatorial_tag>
units_sa_t, units_p_t);
}

using coor_sa_t = typename coordinate_type<PointSegmentA>::type;
using coor_sb_t = typename coordinate_type<PointSegmentB>::type;
using coor_p_t = typename coordinate_type<Point2>::type;
using coor_sa_t = coordinate_type_t<PointSegmentA>;
using coor_sb_t = coordinate_type_t<PointSegmentB>;
using coor_p_t = coordinate_type_t<Point2>;

// Declare unit type (equal for all types) and calc type (coerced to most precise)
using units_t = typename cs_angular_units<Point2>::type;
Expand Down Expand Up @@ -211,12 +211,12 @@ struct direction_code_impl<spherical_polar_tag>
{
using constants_sa_t = math::detail::constants_on_spheroid
<
typename coordinate_type<PointSegmentA>::type,
coordinate_type_t<PointSegmentA>,
typename cs_angular_units<PointSegmentA>::type
>;
using constants_p_t = math::detail::constants_on_spheroid
<
typename coordinate_type<Point2>::type,
coordinate_type_t<Point2>,
typename cs_angular_units<Point2>::type
>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ inline bool point_on_border_covered_by(Geometry1 const& geometry1,
Geometry2 const& geometry2,
Strategy const& strategy)
{
using point_type = typename geometry::point_type<Geometry1>::type;
using point_type = geometry::point_type_t<Geometry1>;
typename helper_geometry<point_type>::type pt;
return geometry::point_on_border(pt, geometry1)
&& geometry::covered_by(pt, geometry2, strategy);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,9 @@ struct disjoint_linear
Geometry2 const& geometry2,
Strategy const& strategy)
{
using point_type = typename geometry::point_type<Geometry1>::type;
using point_type = geometry::point_type_t<Geometry1>;
using mutable_point_type = typename helper_geometry<point_type>::type;
using ratio_type = geometry::segment_ratio
<
typename coordinate_type<point_type>::type
> ;
using ratio_type = geometry::segment_ratio<coordinate_type_t<point_type>>;
using turn_info_type = overlay::turn_info
<
mutable_point_type,
Expand Down
26 changes: 13 additions & 13 deletions include/boost/geometry/algorithms/detail/disjoint/segment_box.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,17 +131,17 @@ struct disjoint_segment_box_sphere_or_spheroid

// Case 2: disjoint if bounding boxes are disjoint

typedef typename coordinate_type<segment_point_type>::type CT;
using coor_t = coordinate_type_t<segment_point_type>;

segment_point_type p0_normalized;
NormalizeStrategy::apply(p0, p0_normalized);
segment_point_type p1_normalized;
NormalizeStrategy::apply(p1, p1_normalized);

CT lon1 = geometry::get_as_radian<0>(p0_normalized);
CT lat1 = geometry::get_as_radian<1>(p0_normalized);
CT lon2 = geometry::get_as_radian<0>(p1_normalized);
CT lat2 = geometry::get_as_radian<1>(p1_normalized);
coor_t lon1 = geometry::get_as_radian<0>(p0_normalized);
coor_t lat1 = geometry::get_as_radian<1>(p0_normalized);
coor_t lon2 = geometry::get_as_radian<0>(p1_normalized);
coor_t lat2 = geometry::get_as_radian<1>(p1_normalized);

if (lon1 > lon2)
{
Expand All @@ -166,12 +166,12 @@ struct disjoint_segment_box_sphere_or_spheroid

// Case 3: test intersection by comparing angles

CT alp1, a_b0, a_b1, a_b2, a_b3;
coor_t alp1, a_b0, a_b1, a_b2, a_b3;

CT b_lon_min = geometry::get_as_radian<geometry::min_corner, 0>(box);
CT b_lat_min = geometry::get_as_radian<geometry::min_corner, 1>(box);
CT b_lon_max = geometry::get_as_radian<geometry::max_corner, 0>(box);
CT b_lat_max = geometry::get_as_radian<geometry::max_corner, 1>(box);
coor_t b_lon_min = geometry::get_as_radian<geometry::min_corner, 0>(box);
coor_t b_lat_min = geometry::get_as_radian<geometry::min_corner, 1>(box);
coor_t b_lon_max = geometry::get_as_radian<geometry::max_corner, 0>(box);
coor_t b_lat_max = geometry::get_as_radian<geometry::max_corner, 1>(box);

azimuth_strategy.apply(lon1, lat1, lon2, lat2, alp1);
azimuth_strategy.apply(lon1, lat1, b_lon_min, b_lat_min, a_b0);
Expand Down Expand Up @@ -212,12 +212,12 @@ struct disjoint_segment_box_sphere_or_spheroid
// points of the box are above (below) the segment in northern (southern)
// hemisphere. Then we have to compute the vertex of the segment

CT vertex_lat;
coor_t vertex_lat;

if ((lat1 < b_lat_min && vertex_north)
|| (lat1 > b_lat_max && !vertex_north))
{
CT b_lat_below; //latitude of box closest to equator
coor_t b_lat_below; //latitude of box closest to equator

if (vertex_north)
{
Expand All @@ -230,7 +230,7 @@ struct disjoint_segment_box_sphere_or_spheroid

//optimization TODO: computing the spherical longitude should suffice for
// the majority of cases
CT vertex_lon = geometry::formula::vertex_longitude<CT, CS_Tag>
coor_t vertex_lon = geometry::formula::vertex_longitude<coor_t, CS_Tag>
::apply(lon1, lat1,
lon2, lat2,
vertex_lat,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ inline auto collection_to_collection(GeometryCollection1 const& collection1,
{
using result_t = typename geometry::distance_result<GeometryCollection1, GeometryCollection2, Strategies>::type;

using point1_t = typename geometry::point_type<GeometryCollection1>::type;
using point1_t = geometry::point_type_t<GeometryCollection1>;
using box1_t = model::box<point1_t>;
using point2_t = typename geometry::point_type<GeometryCollection2>::type;
using point2_t = geometry::point_type_t<GeometryCollection2>;
using box2_t = model::box<point2_t>;

using rtree_value_t = std::pair<box1_t, typename boost::range_iterator<GeometryCollection1 const>::type>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ template
>
struct initialize
{
typedef typename coordinate_type<Box>::type coordinate_type;
using coordinate_type = coordinate_type_t<Box>;

static inline void apply(Box& box,
coordinate_type min_value
Expand Down
Loading

0 comments on commit 6178d86

Please sign in to comment.