Skip to content

Commit

Permalink
chore: replace typedef with using in overlay
Browse files Browse the repository at this point in the history
  • Loading branch information
barendgehrels committed Nov 5, 2024
1 parent 2acb7eb commit 6640b92
Show file tree
Hide file tree
Showing 36 changed files with 175 additions and 177 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -221,10 +221,10 @@ struct buffer_range
{
boost::ignore_unused(segment_strategy);

typedef typename std::iterator_traits
using point_type = typename std::iterator_traits
<
Iterator
>::value_type point_type;
>::value_type;

point_type second_point, penultimate_point, ultimate_point; // last two points from begin/end

Expand Down Expand Up @@ -469,7 +469,7 @@ struct buffer_inserter_ring
{
output_point_type first_p1, first_p2, last_p1, last_p2;

typedef detail::buffer::buffer_range<RingOutput> buffer_range;
using buffer_range = detail::buffer::buffer_range<RingOutput>;

geometry::strategy::buffer::result_code result
= buffer_range::iterate(collection, begin, end,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ namespace detail { namespace buffer
class backtrack_for_buffer
{
public :
typedef detail::overlay::backtrack_state state_type;
using state_type = detail::overlay::backtrack_state;

template
<
Expand Down Expand Up @@ -148,7 +148,7 @@ struct buffer_turn_info
buffer_turn_operation<Point, SegmentRatio>
>
{
typedef Point point_type;
using point_type = Point;

std::size_t turn_index;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,25 +128,25 @@ struct buffered_piece_collection
using coordinate_type = geometry::coordinate_type_t<Ring>;

// Ring/polygon type, always clockwise
typedef geometry::model::ring<point_type> clockwise_ring_type;
using clockwise_ring_type = geometry::model::ring<point_type>;

typedef geometry::model::box<point_type> box_type;
using box_type = geometry::model::box<point_type>;

typedef buffer_turn_info
using buffer_turn_info_type = buffer_turn_info
<
point_type,
typename segment_ratio_type<point_type>::type
> buffer_turn_info_type;
>;

typedef buffer_turn_operation
using buffer_turn_operation_type = buffer_turn_operation
<
point_type,
typename segment_ratio_type<point_type>::type
> buffer_turn_operation_type;
>;

typedef std::vector<buffer_turn_info_type> turn_vector_type;
using turn_vector_type = std::vector<buffer_turn_info_type>;

typedef piece_border<Ring, point_type> piece_border_type;
using piece_border_type = piece_border<Ring, point_type> ;

struct piece
{
Expand Down Expand Up @@ -203,7 +203,7 @@ struct buffered_piece_collection

struct original_ring
{
typedef geometry::sections<box_type, 1> sections_type;
using sections_type = geometry::sections<box_type, 1>;

// Creates an empty instance
inline original_ring()
Expand All @@ -224,7 +224,7 @@ struct buffered_piece_collection
// The dimension is critical because the direction is later used
// in the optimization for within checks using winding strategy
// and this strategy is scanning in x direction.
typedef std::integer_sequence<std::size_t, 0> dimensions;
using dimensions = std::integer_sequence<std::size_t, 0>;
geometry::sectionalize
<
false, dimensions
Expand All @@ -239,7 +239,7 @@ struct buffered_piece_collection
bool m_has_interiors;
};

typedef std::vector<piece> piece_vector_type;
using piece_vector_type = std::vector<piece>;

piece_vector_type m_pieces;
turn_vector_type m_turns;
Expand All @@ -258,15 +258,15 @@ struct buffered_piece_collection
segment_identifier current_segment_id;

// Monotonic sections (used for offsetted rings around points)
typedef geometry::sections<box_type, 2> sections_type;
using sections_type = geometry::sections<box_type, 2>;
sections_type monotonic_sections;

// Define the clusters, mapping cluster_id -> turns
typedef std::map
using cluster_type = std::map
<
signed_size_type,
detail::overlay::cluster_info
> cluster_type;
>;

cluster_type m_clusters;

Expand Down Expand Up @@ -1028,14 +1028,14 @@ struct buffered_piece_collection

inline void traverse()
{
typedef detail::overlay::traverse
using traverser = detail::overlay::traverse
<
false, false,
buffered_ring_collection<buffered_ring<Ring> >,
buffered_ring_collection<buffered_ring<Ring > >,
overlay_buffer,
backtrack_for_buffer
> traverser;
>;
std::map<ring_identifier, overlay::ring_turn_info> turn_info_per_ring;

traversed_rings.clear();
Expand Down Expand Up @@ -1065,14 +1065,14 @@ struct buffered_piece_collection
template <typename GeometryOutput, typename OutputIterator>
inline OutputIterator assign(OutputIterator out) const
{
typedef typename geometry::area_result
using area_result_type = typename geometry::area_result
<
buffered_ring<Ring>, Strategy
>::type area_result_type;
typedef detail::overlay::ring_properties
>::type;
using properties = detail::overlay::ring_properties
<
point_type, area_result_type
> properties;
>;

std::map<ring_identifier, properties> selected;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ struct ring_type
detail::buffer::buffered_ring_collection<Ring>
>
{
typedef Ring type;
using type = Ring;
};


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,8 @@ class piece_turn_visitor
inline void calculate_turns(Piece const& piece1, Piece const& piece2,
Section const& section1, Section const& section2)
{
typedef typename boost::range_value<Rings const>::type ring_type;
typedef typename boost::range_value<Turns const>::type turn_type;
using ring_type = typename boost::range_value<Rings const>::type;
using turn_type = typename boost::range_value<Turns const>::type;

signed_size_type const piece1_first_index = piece1.first_seg_id.segment_index;
signed_size_type const piece2_first_index = piece2.first_seg_id.segment_index;
Expand Down Expand Up @@ -261,10 +261,10 @@ class piece_turn_visitor
{
unique_sub_range_from_piece<ring_type> unique_sub_range2(ring2, prev2, it2);

typedef detail::overlay::get_turn_info
using turn_policy = detail::overlay::get_turn_info
<
detail::overlay::assign_policy_only_start_turns
> turn_policy;
>;

turn_policy::apply(unique_sub_range1, unique_sub_range2,
the_model,
Expand Down Expand Up @@ -292,9 +292,8 @@ class piece_turn_visitor
{
boost::ignore_unused(first);

typedef typename boost::range_value<Pieces const>::type piece_type;
piece_type const& piece1 = m_pieces[section1.ring_id.source_index];
piece_type const& piece2 = m_pieces[section2.ring_id.source_index];
auto const& piece1 = m_pieces[section1.ring_id.source_index];
auto const& piece2 = m_pieces[section2.ring_id.source_index];

if ( piece1.index == piece2.index
|| is_adjacent(piece1, piece2)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ struct buffer_all<Input, Output, TagIn, multi_polygon_tag>
PointStrategy const& point_strategy,
Strategies const& strategies)
{
typedef typename boost::range_value<Output>::type polygon_type;
using polygon_type = typename boost::range_value<Output>::type;

if (geometry::is_empty(geometry_in))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ private :
template <typename It>
inline void calculate_radii(Point const& center, It begin, It end)
{
typedef geometry::model::referring_segment<Point const> segment_type;
using segment_type = geometry::model::referring_segment<Point const>;

bool first = true;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@ struct intersection_areal_areal_<TupledOut, tupled_output_tag>
TupledOut& geometry_out,
Strategy const& strategy)
{
typedef typename geometry::detail::output_geometry_value
using single_out = typename geometry::detail::output_geometry_value
<
TupledOut
>::type single_out;
>::type;

boost::ignore_unused
<
Expand All @@ -89,18 +89,18 @@ struct intersection_areal_areal_<TupledOut, tupled_output_tag>
>
>();

typedef geometry::detail::output_geometry_access
using areal = geometry::detail::output_geometry_access
<
single_out, polygon_tag, polygon_tag
> areal;
typedef geometry::detail::output_geometry_access
>;
using linear = geometry::detail::output_geometry_access
<
single_out, linestring_tag, linestring_tag
> linear;
typedef geometry::detail::output_geometry_access
>;
using pointlike = geometry::detail::output_geometry_access
<
single_out, point_tag, point_tag
> pointlike;
>;

// A * A -> A
call_intersection(areal1, areal2,
Expand All @@ -124,15 +124,15 @@ struct intersection_areal_areal_<TupledOut, tupled_output_tag>
// however this results in static assert failure related to rescale policy
// After the removing of rescaling replacing boundary with areal geometry results in
// some tests failing.
typedef typename geometry::tuples::element
using areal_out_type = typename geometry::tuples::element
<
areal::index, TupledOut
>::type areal_out_type;
>::type;

typedef geometry::detail::boundary_view
using areal_out_boundary_type = geometry::detail::boundary_view
<
areal_out_type const
> areal_out_boundary_type;
>;

areal_out_boundary_type areal_out_boundary(areal::get(geometry_out));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@ struct intersection
GeometryOut& geometry_out,
Strategy const& strategy)
{
typedef typename geometry::detail::output_geometry_value
using single_out = typename geometry::detail::output_geometry_value
<
GeometryOut
>::type SingleOut;
>::type;

intersection_insert
<
Geometry1, Geometry2, SingleOut,
Geometry1, Geometry2, single_out,
overlay_intersection
>::apply(geometry1, geometry2,
geometry::detail::output_geometry_back_inserter(geometry_out),
Expand Down Expand Up @@ -195,10 +195,10 @@ struct intersection<default_strategy, false>
GeometryOut & geometry_out,
default_strategy)
{
typedef typename strategies::relate::services::default_strategy
using strategy_type = typename strategies::relate::services::default_strategy
<
Geometry1, Geometry2
>::type strategy_type;
>::type;

return intersection
<
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ inline OutputIterator add_rings(SelectionMap const& map,
// everything is figured out yet (sum of positive/negative rings)
if (geometry::num_points(result) >= min_num_points)
{
typedef typename geometry::area_result<GeometryOut, Strategy>::type area_type;
using area_type = typename geometry::area_result<GeometryOut, Strategy>::type;
area_type const area = geometry::area(result, strategy);
area_type const zero = 0;
// Ignore if area is 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ template
>
struct assign_visitor
{
typedef typename RingMap::mapped_type ring_info_type;
using ring_info_type = typename RingMap::mapped_type;

Geometry1 const& m_geometry1;
Geometry2 const& m_geometry2;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class backtrack_check_self_intersections
{}
};
public :
typedef state state_type;
using state_type = state;

template
<
Expand Down Expand Up @@ -155,7 +155,7 @@ template
class backtrack_debug
{
public :
typedef backtrack_state state_type;
using state_type = backtrack_state;

template <typename Operation, typename Rings, typename Turns>
static inline void apply(std::size_t size_at_start,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ template<typename Box, typename Point>
class liang_barsky
{
private:
typedef model::referring_segment<Point> segment_type;
using segment_type = model::referring_segment<Point>;

template <typename CoordinateType, typename CalcType>
inline bool check_edge(CoordinateType const& p, CoordinateType const& q, CalcType& t1, CalcType& t2) const
Expand Down Expand Up @@ -90,7 +90,7 @@ class liang_barsky

// TODO: Temporary, this strategy should be moved, it is cartesian-only

typedef strategy::within::cartesian_point_point equals_point_point_strategy_type;
using equals_point_point_strategy_type = strategy::within::cartesian_point_point;

static inline equals_point_point_strategy_type get_equals_point_point_strategy()
{
Expand Down
Loading

0 comments on commit 6640b92

Please sign in to comment.