diff --git a/README.md b/README.md index 9532cec9c..9c26e0e6c 100644 --- a/README.md +++ b/README.md @@ -12,8 +12,8 @@ Boost.Geometry, part of collection of the [Boost C++ Libraries](http://github.co Branch | Build | Coverage | Regression | Documentation ------------|---------------|----------------|------------|-------------- -**develop** | [![circleci](https://circleci.com/gh/boostorg/geometry/tree/develop.svg?style=shield)](https://circleci.com/gh/boostorg/geometry/tree/develop)
[![minimal](https://github.com/boostorg/geometry/workflows/minimal/badge.svg?branch=develop)](https://github.com/boostorg/geometry/actions?query=branch:develop+workflow:minimal) | [![coveralls](https://coveralls.io/repos/github/boostorg/geometry/badge.svg?branch=develop)](https://coveralls.io/github/boostorg/geometry?branch=develop)
[![codecov](https://codecov.io/gh/boostorg/geometry/branch/develop/graph/badge.svg)](https://codecov.io/gh/boostorg/geometry/branch/develop) | [![geometry](https://img.shields.io/badge/-geometry-4480cc.png)](http://www.boost.org/development/tests/develop/developer/geometry.html) [![index](https://img.shields.io/badge/-index-4480cc.png)](http://www.boost.org/development/tests/develop/developer/geometry-index.html) [![extensions](https://img.shields.io/badge/-extensions-4480cc.png)](http://www.boost.org/development/tests/develop/developer/geometry-extensions.html) | [![documentation](https://github.com/boostorg/geometry/workflows/documentation/badge.svg?branch=develop)](https://github.com/boostorg/geometry/actions?query=branch:develop+workflow:documentation) -**master** | [![circleci](https://circleci.com/gh/boostorg/geometry/tree/master.svg?style=shield)](https://circleci.com/gh/boostorg/geometry/tree/master)
[![minimal](https://github.com/boostorg/geometry/workflows/minimal/badge.svg?branch=master)](https://github.com/boostorg/geometry/actions?query=branch:master+workflow:minimal) | [![coveralls](https://coveralls.io/repos/github/boostorg/geometry/badge.svg?branch=master)](https://coveralls.io/github/boostorg/geometry?branch=master)
[![codecov](https://codecov.io/gh/boostorg/geometry/branch/master/graph/badge.svg)](https://codecov.io/gh/boostorg/geometry/branch/master) | [![geometry](https://img.shields.io/badge/-geometry-4480cc.png)](http://www.boost.org/development/tests/master/developer/geometry.html) [![index](https://img.shields.io/badge/-index-4480cc.png)](http://www.boost.org/development/tests/master/developer/geometry-index.html) | [![documentation](https://github.com/boostorg/geometry/workflows/documentation/badge.svg?branch=master)](https://github.com/boostorg/geometry/actions?query=branch:master+workflow:documentation) +**develop** | [![circleci](https://circleci.com/gh/boostorg/geometry/tree/develop.svg?style=shield)](https://circleci.com/gh/boostorg/geometry/tree/develop)
[![minimal](https://github.com/boostorg/geometry/actions/workflows/minimal.yml/badge.svg?branch=develop)](https://github.com/boostorg/geometry/actions?query=branch:develop+workflow:minimal) | [![coveralls](https://coveralls.io/repos/github/boostorg/geometry/badge.svg?branch=develop)](https://coveralls.io/github/boostorg/geometry?branch=develop)
[![codecov](https://codecov.io/gh/boostorg/geometry/branch/develop/graph/badge.svg)](https://codecov.io/gh/boostorg/geometry/branch/develop) | [![geometry](https://img.shields.io/badge/-geometry-4480cc.png)](http://www.boost.org/development/tests/develop/developer/geometry.html) [![index](https://img.shields.io/badge/-index-4480cc.png)](http://www.boost.org/development/tests/develop/developer/geometry-index.html) [![extensions](https://img.shields.io/badge/-extensions-4480cc.png)](http://www.boost.org/development/tests/develop/developer/geometry-extensions.html) | [![documentation](https://github.com/boostorg/geometry/actions/workflows/documentation.yml/badge.svg?branch=develop)](https://github.com/boostorg/geometry/actions?query=branch:develop+workflow:documentation) +**master** | [![circleci](https://circleci.com/gh/boostorg/geometry/tree/master.svg?style=shield)](https://circleci.com/gh/boostorg/geometry/tree/master)
[![minimal](https://github.com/boostorg/geometry/actions/workflows/minimal.yml/badge.svg?branch=master)](https://github.com/boostorg/geometry/actions?query=branch:master+workflow:minimal) | [![coveralls](https://coveralls.io/repos/github/boostorg/geometry/badge.svg?branch=master)](https://coveralls.io/github/boostorg/geometry?branch=master)
[![codecov](https://codecov.io/gh/boostorg/geometry/branch/master/graph/badge.svg)](https://codecov.io/gh/boostorg/geometry/branch/master) | [![geometry](https://img.shields.io/badge/-geometry-4480cc.png)](http://www.boost.org/development/tests/master/developer/geometry.html) [![index](https://img.shields.io/badge/-index-4480cc.png)](http://www.boost.org/development/tests/master/developer/geometry-index.html) | [![documentation](https://github.com/boostorg/geometry/actions/workflows/documentation.yml/badge.svg?branch=master)](https://github.com/boostorg/geometry/actions?query=branch:master+workflow:documentation) ### Directories diff --git a/include/boost/geometry/algorithms/area_result.hpp b/include/boost/geometry/algorithms/area_result.hpp index 73d9f52c5..1288c5264 100644 --- a/include/boost/geometry/algorithms/area_result.hpp +++ b/include/boost/geometry/algorithms/area_result.hpp @@ -72,11 +72,11 @@ template struct more_precise_coordinate_type : std::is_same < - typename geometry::coordinate_type::type, + geometry::coordinate_type_t, typename geometry::select_most_precise < - typename geometry::coordinate_type::type, - typename geometry::coordinate_type::type + geometry::coordinate_type_t, + geometry::coordinate_type_t >::type > {}; diff --git a/include/boost/geometry/algorithms/azimuth.hpp b/include/boost/geometry/algorithms/azimuth.hpp index 7056c512c..e7718e0b7 100644 --- a/include/boost/geometry/algorithms/azimuth.hpp +++ b/include/boost/geometry/algorithms/azimuth.hpp @@ -46,8 +46,8 @@ namespace dispatch template < typename Geometry1, typename Geometry2, - typename Tag1 = typename tag::type, - typename Tag2 = typename tag::type + typename Tag1 = tag_t, + typename Tag2 = tag_t > struct azimuth : not_implemented {}; @@ -58,11 +58,12 @@ struct azimuth template 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::type, - typename coordinate_type::type - >::type calc_t; + coordinate_type_t, + coordinate_type_t + >::type; calc_t result = 0; calc_t const x1 = geometry::get_as_radian<0>(p1); @@ -70,7 +71,7 @@ struct azimuth 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 diff --git a/include/boost/geometry/algorithms/convert.hpp b/include/boost/geometry/algorithms/convert.hpp index 26335ec3d..d9cb61e84 100644 --- a/include/boost/geometry/algorithms/convert.hpp +++ b/include/boost/geometry/algorithms/convert.hpp @@ -381,11 +381,9 @@ struct convert { static inline void apply(Box const& box, Polygon& polygon) { - typedef typename ring_type::type ring_type; - convert < - Box, ring_type, + Box, ring_type_t, box_tag, ring_tag, 2, false >::apply(box, exterior_ring(polygon)); @@ -415,10 +413,9 @@ struct convert { static inline void apply(Ring const& ring, Polygon& polygon) { - typedef typename ring_type::type ring_type; convert < - Ring, ring_type, + Ring, ring_type_t, ring_tag, ring_tag, DimensionCount, false >::apply(ring, exterior_ring(polygon)); @@ -431,11 +428,9 @@ struct convert { static inline void apply(Polygon const& polygon, Ring& ring) { - typedef typename ring_type::type ring_type; - convert < - ring_type, Ring, + ring_type_t, Ring, ring_tag, ring_tag, DimensionCount, false >::apply(exterior_ring(polygon), ring); diff --git a/include/boost/geometry/algorithms/crosses.hpp b/include/boost/geometry/algorithms/crosses.hpp index 040076d3d..5d44211dd 100644 --- a/include/boost/geometry/algorithms/crosses.hpp +++ b/include/boost/geometry/algorithms/crosses.hpp @@ -48,8 +48,8 @@ template < typename Geometry1, typename Geometry2, - typename Tag1 = typename tag::type, - typename Tag2 = typename tag::type + typename Tag1 = tag_t, + typename Tag2 = tag_t > struct crosses : detail::relate::relate_impl @@ -215,8 +215,8 @@ namespace resolve_dynamic template < typename Geometry1, typename Geometry2, - typename Tag1 = typename geometry::tag::type, - typename Tag2 = typename geometry::tag::type + typename Tag1 = geometry::tag_t, + typename Tag2 = geometry::tag_t > struct crosses { diff --git a/include/boost/geometry/algorithms/densify.hpp b/include/boost/geometry/algorithms/densify.hpp index 3af062ebd..8aa837500 100644 --- a/include/boost/geometry/algorithms/densify.hpp +++ b/include/boost/geometry/algorithms/densify.hpp @@ -170,8 +170,8 @@ template < typename Geometry, typename GeometryOut, - typename Tag1 = typename tag::type, - typename Tag2 = typename tag::type + typename Tag1 = tag_t, + typename Tag2 = tag_t > struct densify : not_implemented @@ -360,7 +360,7 @@ struct densify namespace resolve_dynamic { -template ::type> +template > struct densify { template diff --git a/include/boost/geometry/algorithms/detail/assign_indexed_point.hpp b/include/boost/geometry/algorithms/detail/assign_indexed_point.hpp index 9ae46768e..41fced54e 100644 --- a/include/boost/geometry/algorithms/detail/assign_indexed_point.hpp +++ b/include/boost/geometry/algorithms/detail/assign_indexed_point.hpp @@ -59,10 +59,7 @@ inline void assign_point_to_index(Point const& point, Geometry& geometry) detail::for_each_dimension([&](auto dimension) { geometry::set(geometry, - util::numeric_cast - < - typename coordinate_type::type - >(geometry::get(point))); + util::numeric_cast>(geometry::get(point))); }); } @@ -93,7 +90,7 @@ inline void assign_point_from_index(Geometry const& geometry, Point& point) geometry::set(point, util::numeric_cast < - typename coordinate_type::type + coordinate_type_t >(geometry::get(geometry))); }); } diff --git a/include/boost/geometry/algorithms/detail/assign_values.hpp b/include/boost/geometry/algorithms/detail/assign_values.hpp index fe72bc568..64ee69f80 100644 --- a/include/boost/geometry/algorithms/detail/assign_values.hpp +++ b/include/boost/geometry/algorithms/detail/assign_values.hpp @@ -54,7 +54,7 @@ struct assign_zero_point template static inline void apply(Point& point) { - typedef typename coordinate_type::type coordinate_type; + using coordinate_type = coordinate_type_t; coordinate_type const zero = 0; detail::for_each_dimension([&](auto dimension) @@ -71,7 +71,7 @@ struct assign_inverse_box_or_segment template static inline void apply(BoxOrSegment& geometry) { - typedef typename coordinate_type::type coordinate_type; + using coordinate_type = coordinate_type_t; coordinate_type const highest = util::bounds::highest(); coordinate_type const lowest = util::bounds::lowest(); @@ -90,7 +90,7 @@ struct assign_zero_box_or_segment template static inline void apply(BoxOrSegment& geometry) { - typedef typename coordinate_type::type coordinate_type; + using coordinate_type = coordinate_type_t; coordinate_type const zero = 0; detail::for_each_dimension([&](auto dimension) @@ -114,7 +114,7 @@ inline void assign_box_2d_corner(Box const& box, Point& point) assert_dimension(); // Copy coordinates - typedef typename coordinate_type::type coordinate_type; + using coordinate_type = coordinate_type_t; geometry::set<0>(point, util::numeric_cast(get(box))); geometry::set<1>(point, util::numeric_cast(get(box))); @@ -125,7 +125,7 @@ inline void assign_box_2d_corner(Box const& box, Point& point) template struct assign_2d_box_or_segment { - typedef typename coordinate_type::type coordinate_type; + using coordinate_type = coordinate_type_t; // Here we assign 4 coordinates to a box of segment // -> Most logical is: x1,y1,x2,y2 @@ -161,7 +161,7 @@ struct assign template struct assign { - typedef typename coordinate_type::type coordinate_type; + using coordinate_type = coordinate_type_t; template static inline void apply(Point& point, T const& c1, T const& c2) @@ -174,7 +174,7 @@ struct assign template struct assign { - typedef typename coordinate_type::type coordinate_type; + using coordinate_type = coordinate_type_t; template static inline void apply(Point& point, T const& c1, T const& c2, T const& c3) diff --git a/include/boost/geometry/algorithms/detail/buffer/buffer_box.hpp b/include/boost/geometry/algorithms/detail/buffer/buffer_box.hpp index f19a91d6b..e26295eb3 100644 --- a/include/boost/geometry/algorithms/detail/buffer/buffer_box.hpp +++ b/include/boost/geometry/algorithms/detail/buffer/buffer_box.hpp @@ -26,7 +26,7 @@ namespace detail { namespace buffer template struct box_loop { - typedef typename coordinate_type::type coordinate_type; + using coordinate_type = coordinate_type_t; static inline void apply(BoxIn const& box_in, T const& distance, BoxOut& box_out) { diff --git a/include/boost/geometry/algorithms/detail/buffer/buffer_inserter.hpp b/include/boost/geometry/algorithms/detail/buffer/buffer_inserter.hpp index 1e6b798cd..02e1bf990 100644 --- a/include/boost/geometry/algorithms/detail/buffer/buffer_inserter.hpp +++ b/include/boost/geometry/algorithms/detail/buffer/buffer_inserter.hpp @@ -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 @@ -469,7 +469,7 @@ struct buffer_inserter_ring { output_point_type first_p1, first_p2, last_p1, last_p2; - typedef detail::buffer::buffer_range buffer_range; + using buffer_range = detail::buffer::buffer_range; geometry::strategy::buffer::result_code result = buffer_range::iterate(collection, begin, end, @@ -747,11 +747,10 @@ template struct buffer_inserter { private: - typedef typename ring_type::type input_ring_type; - typedef typename ring_type::type output_ring_type; - - typedef buffer_inserter_ring policy; + using input_ring_type = ring_type_t; + using output_ring_type = ring_type_t; + using policy = buffer_inserter_ring; template < @@ -873,12 +872,9 @@ struct buffer_inserter PolygonOutput, dispatch::buffer_inserter < - typename single_tag_of - < - typename tag::type - >::type, + typename single_tag_of>::type, typename boost::range_value::type, - typename geometry::ring_type::type + geometry::ring_type_t > > {}; @@ -918,7 +914,7 @@ inline void buffer_inserter(GeometryInput const& geometry_input, OutputIterator using collection_type = detail::buffer::buffered_piece_collection < - typename geometry::ring_type::type, + geometry::ring_type_t, Strategies, DistanceStrategy >; diff --git a/include/boost/geometry/algorithms/detail/buffer/buffer_policies.hpp b/include/boost/geometry/algorithms/detail/buffer/buffer_policies.hpp index e843b27d9..1685bc858 100644 --- a/include/boost/geometry/algorithms/detail/buffer/buffer_policies.hpp +++ b/include/boost/geometry/algorithms/detail/buffer/buffer_policies.hpp @@ -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 < @@ -87,20 +87,6 @@ g_backtrack_warning_count++; struct buffer_overlay_visitor { public : - void print(char const* /*header*/) - { - } - - template - void print(char const* /*header*/, Turns const& /*turns*/, int /*turn_index*/) - { - } - - template - void print(char const* /*header*/, Turns const& /*turns*/, int /*turn_index*/, int /*op_index*/) - { - } - template void visit_turns(int , Turns const& ) {} @@ -148,7 +134,7 @@ struct buffer_turn_info buffer_turn_operation > { - typedef Point point_type; + using point_type = Point; std::size_t turn_index; @@ -170,26 +156,6 @@ struct buffer_turn_info {} }; -struct buffer_less -{ - template - inline bool operator()(Indexed const& left, Indexed const& right) const - { - if (! (left.subject->seg_id == right.subject->seg_id)) - { - return left.subject->seg_id < right.subject->seg_id; - } - - // Both left and right are located on the SAME segment. - if (! (left.subject->fraction == right.subject->fraction)) - { - return left.subject->fraction < right.subject->fraction; - } - - return left.turn_index < right.turn_index; - } -}; - template struct piece_get_box { diff --git a/include/boost/geometry/algorithms/detail/buffer/buffered_piece_collection.hpp b/include/boost/geometry/algorithms/detail/buffer/buffered_piece_collection.hpp index 3f20813b4..9a836375c 100644 --- a/include/boost/geometry/algorithms/detail/buffer/buffered_piece_collection.hpp +++ b/include/boost/geometry/algorithms/detail/buffer/buffered_piece_collection.hpp @@ -124,29 +124,29 @@ template > struct buffered_piece_collection { - typedef typename geometry::point_type::type point_type; - typedef typename geometry::coordinate_type::type coordinate_type; + using point_type = geometry::point_type_t; + using coordinate_type = geometry::coordinate_type_t; // Ring/polygon type, always clockwise - typedef geometry::model::ring clockwise_ring_type; + using clockwise_ring_type = geometry::model::ring; - typedef geometry::model::box box_type; + using box_type = geometry::model::box; - typedef buffer_turn_info + using buffer_turn_info_type = buffer_turn_info < point_type, typename segment_ratio_type::type - > buffer_turn_info_type; + >; - typedef buffer_turn_operation + using buffer_turn_operation_type = buffer_turn_operation < point_type, typename segment_ratio_type::type - > buffer_turn_operation_type; + >; - typedef std::vector turn_vector_type; + using turn_vector_type = std::vector; - typedef piece_border piece_border_type; + using piece_border_type = piece_border ; struct piece { @@ -203,7 +203,7 @@ struct buffered_piece_collection struct original_ring { - typedef geometry::sections sections_type; + using sections_type = geometry::sections; // Creates an empty instance inline original_ring() @@ -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 dimensions; + using dimensions = std::integer_sequence; geometry::sectionalize < false, dimensions @@ -239,7 +239,7 @@ struct buffered_piece_collection bool m_has_interiors; }; - typedef std::vector piece_vector_type; + using piece_vector_type = std::vector; piece_vector_type m_pieces; turn_vector_type m_turns; @@ -258,15 +258,15 @@ struct buffered_piece_collection segment_identifier current_segment_id; // Monotonic sections (used for offsetted rings around points) - typedef geometry::sections sections_type; + using sections_type = geometry::sections; 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; @@ -447,7 +447,7 @@ struct buffered_piece_collection // Check if turns are inside pieces turn_in_piece_visitor < - typename geometry::cs_tag::type, + geometry::cs_tag_t, turn_vector_type, piece_vector_type, DistanceStrategy, Strategy > visitor(m_turns, m_pieces, m_distance_strategy, m_strategy); @@ -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_collection >, overlay_buffer, backtrack_for_buffer - > traverser; + >; std::map turn_info_per_ring; traversed_rings.clear(); @@ -1065,14 +1065,14 @@ struct buffered_piece_collection template inline OutputIterator assign(OutputIterator out) const { - typedef typename geometry::area_result + using area_result_type = typename geometry::area_result < buffered_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 selected; diff --git a/include/boost/geometry/algorithms/detail/buffer/buffered_ring.hpp b/include/boost/geometry/algorithms/detail/buffer/buffered_ring.hpp index 6118ec43b..00f3efa5e 100644 --- a/include/boost/geometry/algorithms/detail/buffer/buffered_ring.hpp +++ b/include/boost/geometry/algorithms/detail/buffer/buffered_ring.hpp @@ -108,7 +108,7 @@ namespace traits template struct tag > { - typedef ring_tag type; + using type = ring_tag; }; @@ -129,13 +129,13 @@ struct closure > template struct point_type > { - typedef typename geometry::point_type::type type; + using type = geometry::point_type_t; }; template struct tag > { - typedef geometry::detail::buffer::buffered_ring_collection_tag type; + using type = geometry::detail::buffer::buffered_ring_collection_tag; }; @@ -154,7 +154,7 @@ struct ring_type detail::buffer::buffered_ring_collection > { - typedef Ring type; + using type = Ring; }; @@ -177,7 +177,7 @@ struct point_order struct single_tag_of { - typedef ring_tag type; + using type = ring_tag; }; @@ -269,7 +269,7 @@ template<> struct get_ring { template - static inline typename ring_type::type const& apply( + static inline ring_type_t const& apply( ring_identifier const& id, MultiGeometry const& multi_ring) { diff --git a/include/boost/geometry/algorithms/detail/buffer/get_piece_turns.hpp b/include/boost/geometry/algorithms/detail/buffer/get_piece_turns.hpp index 3775e604e..9c9509ce7 100644 --- a/include/boost/geometry/algorithms/detail/buffer/get_piece_turns.hpp +++ b/include/boost/geometry/algorithms/detail/buffer/get_piece_turns.hpp @@ -43,8 +43,8 @@ namespace detail { namespace buffer template struct unique_sub_range_from_piece { - typedef typename boost::range_iterator::type iterator_type; - typedef typename geometry::point_type::type point_type; + using iterator_type = typename boost::range_iterator::type; + using point_type = geometry::point_type_t; unique_sub_range_from_piece(Ring const& ring, iterator_type iterator_at_i, iterator_type iterator_at_j) @@ -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::type ring_type; - typedef typename boost::range_value::type turn_type; + using ring_type = typename boost::range_value::type; + using turn_type = typename boost::range_value::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; @@ -261,10 +261,10 @@ class piece_turn_visitor { unique_sub_range_from_piece 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, @@ -292,9 +292,8 @@ public: { boost::ignore_unused(first); - typedef typename boost::range_value::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) diff --git a/include/boost/geometry/algorithms/detail/buffer/implementation.hpp b/include/boost/geometry/algorithms/detail/buffer/implementation.hpp index a9608a440..0f7a87bc8 100644 --- a/include/boost/geometry/algorithms/detail/buffer/implementation.hpp +++ b/include/boost/geometry/algorithms/detail/buffer/implementation.hpp @@ -76,7 +76,7 @@ struct buffer_all PointStrategy const& point_strategy, Strategies const& strategies) { - typedef typename boost::range_value::type polygon_type; + using polygon_type = typename boost::range_value::type; if (geometry::is_empty(geometry_in)) { diff --git a/include/boost/geometry/algorithms/detail/buffer/interface.hpp b/include/boost/geometry/algorithms/detail/buffer/interface.hpp index d19abd6ef..c74cd179e 100644 --- a/include/boost/geometry/algorithms/detail/buffer/interface.hpp +++ b/include/boost/geometry/algorithms/detail/buffer/interface.hpp @@ -38,8 +38,8 @@ template < typename Input, typename Output, - typename TagIn = typename tag::type, - typename TagOut = typename tag::type + typename TagIn = tag_t, + typename TagOut = tag_t > struct buffer_dc : not_implemented {}; @@ -48,8 +48,8 @@ template < typename Input, typename Output, - typename TagIn = typename tag::type, - typename TagOut = typename tag::type + typename TagIn = tag_t, + typename TagOut = tag_t > struct buffer_all : not_implemented {}; @@ -64,7 +64,7 @@ namespace resolve_dynamic template < typename Input, - typename TagIn = typename geometry::tag::type + typename TagIn = geometry::tag_t > struct buffer_dc { @@ -101,7 +101,7 @@ struct buffer_dc template < typename Input, - typename TagIn = typename geometry::tag::type + typename TagIn = geometry::tag_t > struct buffer_all { diff --git a/include/boost/geometry/algorithms/detail/buffer/line_line_intersection.hpp b/include/boost/geometry/algorithms/detail/buffer/line_line_intersection.hpp index f217c53b0..f98f9847b 100644 --- a/include/boost/geometry/algorithms/detail/buffer/line_line_intersection.hpp +++ b/include/boost/geometry/algorithms/detail/buffer/line_line_intersection.hpp @@ -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::type; + using ct = coordinate_type_t; auto const p = detail::make::make_infinite_line(pi, pj); auto const q = detail::make::make_infinite_line(qi, qj); diff --git a/include/boost/geometry/algorithms/detail/buffer/piece_border.hpp b/include/boost/geometry/algorithms/detail/buffer/piece_border.hpp index 3861fcbe5..60a42554a 100644 --- a/include/boost/geometry/algorithms/detail/buffer/piece_border.hpp +++ b/include/boost/geometry/algorithms/detail/buffer/piece_border.hpp @@ -103,9 +103,9 @@ namespace detail { namespace buffer template struct piece_border { - typedef typename geometry::coordinate_type::type coordinate_type; - typedef typename default_comparable_distance_result::type radius_type; - typedef typename geometry::strategy::buffer::turn_in_ring_winding::state_type state_type; + using coordinate_type = geometry::coordinate_type_t; + using radius_type = typename default_comparable_distance_result::type; + using state_type = typename geometry::strategy::buffer::turn_in_ring_winding::state_type; bool m_reversed; @@ -475,7 +475,7 @@ private : template inline void calculate_radii(Point const& center, It begin, It end) { - typedef geometry::model::referring_segment segment_type; + using segment_type = geometry::model::referring_segment; bool first = true; diff --git a/include/boost/geometry/algorithms/detail/calculate_point_order.hpp b/include/boost/geometry/algorithms/detail/calculate_point_order.hpp index 5dc92a0cc..4c74c8145 100644 --- a/include/boost/geometry/algorithms/detail/calculate_point_order.hpp +++ b/include/boost/geometry/algorithms/detail/calculate_point_order.hpp @@ -345,10 +345,10 @@ inline geometry::order_selector calculate_point_order(Ring const& ring, Strategy template inline geometry::order_selector calculate_point_order(Ring const& ring) { - typedef typename strategy::point_order::services::default_strategy + using strategy_type = typename strategy::point_order::services::default_strategy < - typename geometry::cs_tag::type - >::type strategy_type; + geometry::cs_tag_t + >::type; concepts::check(); diff --git a/include/boost/geometry/algorithms/detail/centroid/translating_transformer.hpp b/include/boost/geometry/algorithms/detail/centroid/translating_transformer.hpp index 6baf19078..593131d05 100644 --- a/include/boost/geometry/algorithms/detail/centroid/translating_transformer.hpp +++ b/include/boost/geometry/algorithms/detail/centroid/translating_transformer.hpp @@ -53,8 +53,8 @@ template > struct translating_transformer { - typedef typename geometry::point_type::type point_type; - typedef boost::reference_wrapper result_type; + using point_type = geometry::point_type_t; + using result_type = boost::reference_wrapper; explicit translating_transformer(Geometry const&) {} explicit translating_transformer(point_type const&) {} @@ -72,8 +72,8 @@ struct translating_transformer template struct translating_transformer { - typedef typename geometry::point_type::type point_type; - typedef point_type result_type; + using point_type = geometry::point_type_t; + using result_type = point_type; explicit translating_transformer(Geometry const& geom) : m_origin(NULL) diff --git a/include/boost/geometry/algorithms/detail/closest_points/linear_or_areal_to_areal.hpp b/include/boost/geometry/algorithms/detail/closest_points/linear_or_areal_to_areal.hpp index d856927f3..de0cd59b8 100644 --- a/include/boost/geometry/algorithms/detail/closest_points/linear_or_areal_to_areal.hpp +++ b/include/boost/geometry/algorithms/detail/closest_points/linear_or_areal_to_areal.hpp @@ -38,7 +38,7 @@ struct linear_to_areal using point_type = typename std::conditional < - std::is_same::type, most_precise_type>::value, + std::is_same, most_precise_type>::value, point_type_t, point_type_t >::type; @@ -141,7 +141,7 @@ struct areal_to_areal using point_type = typename std::conditional < - std::is_same::type, most_precise_type>::value, + std::is_same, most_precise_type>::value, point_type_t, point_type_t >::type; diff --git a/include/boost/geometry/algorithms/detail/closest_points/point_to_geometry.hpp b/include/boost/geometry/algorithms/detail/closest_points/point_to_geometry.hpp index 484fe683b..97e3c4ad4 100644 --- a/include/boost/geometry/algorithms/detail/closest_points/point_to_geometry.hpp +++ b/include/boost/geometry/algorithms/detail/closest_points/point_to_geometry.hpp @@ -253,7 +253,7 @@ template typename MultiGeometry, bool CheckCoveredBy = std::is_same < - typename tag::type, multi_polygon_tag + tag_t, multi_polygon_tag >::value > class point_to_multigeometry @@ -429,7 +429,7 @@ struct closest_points > : closest_points < Point, Linear, - point_tag, typename tag::type, false + point_tag, tag_t, false > {}; @@ -441,7 +441,7 @@ struct closest_points > : closest_points < Point, Areal, - point_tag, typename tag::type, false + point_tag, tag_t, false > {}; diff --git a/include/boost/geometry/algorithms/detail/comparable_distance/interface.hpp b/include/boost/geometry/algorithms/detail/comparable_distance/interface.hpp index d582dc925..582bec1b1 100644 --- a/include/boost/geometry/algorithms/detail/comparable_distance/interface.hpp +++ b/include/boost/geometry/algorithms/detail/comparable_distance/interface.hpp @@ -124,8 +124,8 @@ namespace resolve_dynamic template < typename Geometry1, typename Geometry2, - typename Tag1 = typename geometry::tag::type, - typename Tag2 = typename geometry::tag::type + typename Tag1 = geometry::tag_t, + typename Tag2 = geometry::tag_t > struct comparable_distance { diff --git a/include/boost/geometry/algorithms/detail/convert_indexed_to_indexed.hpp b/include/boost/geometry/algorithms/detail/convert_indexed_to_indexed.hpp index 607fdae00..0d0b1f508 100644 --- a/include/boost/geometry/algorithms/detail/convert_indexed_to_indexed.hpp +++ b/include/boost/geometry/algorithms/detail/convert_indexed_to_indexed.hpp @@ -42,7 +42,7 @@ struct indexed_to_indexed { static inline void apply(Source const& source, Destination& destination) { - typedef typename coordinate_type::type coordinate_type; + using coordinate_type = coordinate_type_t; geometry::set(destination, util::numeric_cast( diff --git a/include/boost/geometry/algorithms/detail/convert_point_to_point.hpp b/include/boost/geometry/algorithms/detail/convert_point_to_point.hpp index a29ca3fcf..dc8b0a7fb 100644 --- a/include/boost/geometry/algorithms/detail/convert_point_to_point.hpp +++ b/include/boost/geometry/algorithms/detail/convert_point_to_point.hpp @@ -43,7 +43,7 @@ struct point_to_point { static inline void apply(Source const& source, Destination& destination) { - typedef typename coordinate_type::type coordinate_type; + using coordinate_type = coordinate_type_t; set(destination, util::numeric_cast(get(source))); point_to_point::apply(source, destination); diff --git a/include/boost/geometry/algorithms/detail/convex_hull/interface.hpp b/include/boost/geometry/algorithms/detail/convex_hull/interface.hpp index ff8c1703b..60a5e37ac 100644 --- a/include/boost/geometry/algorithms/detail/convex_hull/interface.hpp +++ b/include/boost/geometry/algorithms/detail/convex_hull/interface.hpp @@ -128,7 +128,7 @@ private: // TODO: Or just implement point_type<> for GeometryCollection // and enforce the same point_type used in the whole sequence in check(). -template ::type> +template > struct default_strategy { using type = typename strategies::convex_hull::services::default_strategy @@ -201,7 +201,7 @@ namespace dispatch template < typename Geometry, - typename Tag = typename tag::type + typename Tag = tag_t > struct convex_hull { @@ -258,7 +258,7 @@ struct convex_hull { // Assuming that single point_type is used by the GeometryCollection using subgeometry_type = typename detail::first_geometry_type::type; - using point_type = typename geometry::point_type::type; + using point_type = geometry::point_type_t; using ring_type = model::ring; // Calculate box rings once @@ -304,7 +304,7 @@ private: }; -template ::type> +template > struct convex_hull_out { BOOST_GEOMETRY_STATIC_ASSERT_FALSE("This OutputGeometry is not supported.", OutputGeometry, Tag); @@ -531,7 +531,7 @@ struct convex_hull namespace resolve_dynamic { -template ::type> +template > struct convex_hull { template diff --git a/include/boost/geometry/algorithms/detail/covered_by/interface.hpp b/include/boost/geometry/algorithms/detail/covered_by/interface.hpp index 048803438..2d45798eb 100644 --- a/include/boost/geometry/algorithms/detail/covered_by/interface.hpp +++ b/include/boost/geometry/algorithms/detail/covered_by/interface.hpp @@ -38,8 +38,8 @@ template < typename Geometry1, typename Geometry2, - typename Tag1 = typename tag::type, - typename Tag2 = typename tag::type + typename Tag1 = tag_t, + typename Tag2 = tag_t > struct covered_by : not_implemented @@ -122,8 +122,8 @@ namespace resolve_dynamic { template < typename Geometry1, typename Geometry2, - typename Tag1 = typename geometry::tag::type, - typename Tag2 = typename geometry::tag::type + typename Tag1 = geometry::tag_t, + typename Tag2 = geometry::tag_t > struct covered_by { diff --git a/include/boost/geometry/algorithms/detail/direction_code.hpp b/include/boost/geometry/algorithms/detail/direction_code.hpp index ece34f15b..ba51da73d 100644 --- a/include/boost/geometry/algorithms/detail/direction_code.hpp +++ b/include/boost/geometry/algorithms/detail/direction_code.hpp @@ -105,9 +105,9 @@ struct direction_code_impl units_sa_t, units_p_t); } - using coor_sa_t = typename coordinate_type::type; - using coor_sb_t = typename coordinate_type::type; - using coor_p_t = typename coordinate_type::type; + using coor_sa_t = coordinate_type_t; + using coor_sb_t = coordinate_type_t; + using coor_p_t = coordinate_type_t; // Declare unit type (equal for all types) and calc type (coerced to most precise) using units_t = typename cs_angular_units::type; @@ -211,12 +211,12 @@ struct direction_code_impl { using constants_sa_t = math::detail::constants_on_spheroid < - typename coordinate_type::type, + coordinate_type_t, typename cs_angular_units::type >; using constants_p_t = math::detail::constants_on_spheroid < - typename coordinate_type::type, + coordinate_type_t, typename cs_angular_units::type >; @@ -249,7 +249,7 @@ struct direction_code_impl < std::is_same < - typename geometry::cs_tag::type, + geometry::cs_tag_t, spherical_polar_tag >::value, spherical_polar_tag, diff --git a/include/boost/geometry/algorithms/detail/disjoint/areal_areal.hpp b/include/boost/geometry/algorithms/detail/disjoint/areal_areal.hpp index 880e50378..921fdcfcb 100644 --- a/include/boost/geometry/algorithms/detail/disjoint/areal_areal.hpp +++ b/include/boost/geometry/algorithms/detail/disjoint/areal_areal.hpp @@ -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::type; + using point_type = geometry::point_type_t; typename helper_geometry::type pt; return geometry::point_on_border(pt, geometry1) && geometry::covered_by(pt, geometry2, strategy); diff --git a/include/boost/geometry/algorithms/detail/disjoint/linear_areal.hpp b/include/boost/geometry/algorithms/detail/disjoint/linear_areal.hpp index b8648eb77..5c1008a14 100644 --- a/include/boost/geometry/algorithms/detail/disjoint/linear_areal.hpp +++ b/include/boost/geometry/algorithms/detail/disjoint/linear_areal.hpp @@ -130,7 +130,7 @@ template < typename Segment, typename Areal, - typename Tag = typename tag::type + typename Tag = tag_t > struct disjoint_segment_areal : not_implemented @@ -170,7 +170,7 @@ public: { if (! disjoint_range_segment_or_box < - typename geometry::ring_type::type, + geometry::ring_type_t, Segment >::apply(geometry::exterior_ring(polygon), segment, strategy)) { diff --git a/include/boost/geometry/algorithms/detail/disjoint/linear_linear.hpp b/include/boost/geometry/algorithms/detail/disjoint/linear_linear.hpp index dbe23010d..d71a9c960 100644 --- a/include/boost/geometry/algorithms/detail/disjoint/linear_linear.hpp +++ b/include/boost/geometry/algorithms/detail/disjoint/linear_linear.hpp @@ -90,12 +90,9 @@ struct disjoint_linear Geometry2 const& geometry2, Strategy const& strategy) { - using point_type = typename geometry::point_type::type; + using point_type = geometry::point_type_t; using mutable_point_type = typename helper_geometry::type; - using ratio_type = geometry::segment_ratio - < - typename coordinate_type::type - > ; + using ratio_type = geometry::segment_ratio>; using turn_info_type = overlay::turn_info < mutable_point_type, @@ -114,8 +111,8 @@ struct disjoint_linear disjoint_interrupt_policy interrupt_policy; dispatch::get_turns < - typename geometry::tag::type, - typename geometry::tag::type, + geometry::tag_t, + geometry::tag_t, Geometry1, Geometry2, overlay::do_reverse::value>::value, // should be false diff --git a/include/boost/geometry/algorithms/detail/disjoint/linear_segment_or_box.hpp b/include/boost/geometry/algorithms/detail/disjoint/linear_segment_or_box.hpp index 25b91d3fe..795fe67c3 100644 --- a/include/boost/geometry/algorithms/detail/disjoint/linear_segment_or_box.hpp +++ b/include/boost/geometry/algorithms/detail/disjoint/linear_segment_or_box.hpp @@ -45,7 +45,7 @@ namespace detail { namespace disjoint template < typename SegmentOrBox, - typename Tag = typename tag::type + typename Tag = tag_t > struct disjoint_point_segment_or_box : not_implemented @@ -135,7 +135,7 @@ template < typename Linear, typename SegmentOrBox, - typename Tag = typename tag::type + typename Tag = tag_t > struct disjoint_linear_segment_or_box : not_implemented diff --git a/include/boost/geometry/algorithms/detail/disjoint/multipoint_geometry.hpp b/include/boost/geometry/algorithms/detail/disjoint/multipoint_geometry.hpp index 8fa9f8a0c..b352dadb2 100644 --- a/include/boost/geometry/algorithms/detail/disjoint/multipoint_geometry.hpp +++ b/include/boost/geometry/algorithms/detail/disjoint/multipoint_geometry.hpp @@ -461,7 +461,7 @@ public: }; -template ::type> +template > struct multipoint_areal : multi_point_single_geometry {}; diff --git a/include/boost/geometry/algorithms/detail/disjoint/segment_box.hpp b/include/boost/geometry/algorithms/detail/disjoint/segment_box.hpp index d959619c0..8fed7a926 100644 --- a/include/boost/geometry/algorithms/detail/disjoint/segment_box.hpp +++ b/include/boost/geometry/algorithms/detail/disjoint/segment_box.hpp @@ -131,17 +131,17 @@ struct disjoint_segment_box_sphere_or_spheroid // Case 2: disjoint if bounding boxes are disjoint - typedef typename coordinate_type::type CT; + using coor_t = coordinate_type_t; 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) { @@ -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(box); - CT b_lat_min = geometry::get_as_radian(box); - CT b_lon_max = geometry::get_as_radian(box); - CT b_lat_max = geometry::get_as_radian(box); + coor_t b_lon_min = geometry::get_as_radian(box); + coor_t b_lat_min = geometry::get_as_radian(box); + coor_t b_lon_max = geometry::get_as_radian(box); + coor_t b_lat_max = geometry::get_as_radian(box); azimuth_strategy.apply(lon1, lat1, lon2, lat2, alp1); azimuth_strategy.apply(lon1, lat1, b_lon_min, b_lat_min, a_b0); @@ -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) { @@ -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 + coor_t vertex_lon = geometry::formula::vertex_longitude ::apply(lon1, lat1, lon2, lat2, vertex_lat, diff --git a/include/boost/geometry/algorithms/detail/distance/geometry_collection.hpp b/include/boost/geometry/algorithms/detail/distance/geometry_collection.hpp index c3d079eb7..6094bb25b 100644 --- a/include/boost/geometry/algorithms/detail/distance/geometry_collection.hpp +++ b/include/boost/geometry/algorithms/detail/distance/geometry_collection.hpp @@ -68,9 +68,9 @@ inline auto collection_to_collection(GeometryCollection1 const& collection1, { using result_t = typename geometry::distance_result::type; - using point1_t = typename geometry::point_type::type; + using point1_t = geometry::point_type_t; using box1_t = model::box; - using point2_t = typename geometry::point_type::type; + using point2_t = geometry::point_type_t; using box2_t = model::box; using rtree_value_t = std::pair::type>; diff --git a/include/boost/geometry/algorithms/detail/distance/geometry_to_segment_or_box.hpp b/include/boost/geometry/algorithms/detail/distance/geometry_to_segment_or_box.hpp index a01275717..1c285d9ec 100644 --- a/include/boost/geometry/algorithms/detail/distance/geometry_to_segment_or_box.hpp +++ b/include/boost/geometry/algorithms/detail/distance/geometry_to_segment_or_box.hpp @@ -51,7 +51,7 @@ namespace detail { namespace distance template < typename SegmentOrBox, - typename Tag = typename tag::type + typename Tag = tag_t > struct segment_or_box_point_range_closure : not_implemented @@ -76,7 +76,7 @@ template typename Geometry, typename SegmentOrBox, typename Strategies, - typename Tag = typename tag::type + typename Tag = tag_t > class geometry_to_segment_or_box { @@ -97,7 +97,7 @@ private: template < typename SegOrBox, - typename SegOrBoxTag = typename tag::type + typename SegOrBoxTag = tag_t > struct assign_new_min_iterator : not_implemented @@ -128,7 +128,7 @@ private: < typename SegOrBox, typename PointRange, - typename SegOrBoxTag = typename tag::type + typename SegOrBoxTag = tag_t > struct assign_segment_or_box_points {}; diff --git a/include/boost/geometry/algorithms/detail/distance/interface.hpp b/include/boost/geometry/algorithms/detail/distance/interface.hpp index f903c5cee..024e9d6ef 100644 --- a/include/boost/geometry/algorithms/detail/distance/interface.hpp +++ b/include/boost/geometry/algorithms/detail/distance/interface.hpp @@ -187,8 +187,8 @@ namespace resolve_dynamic template < typename Geometry1, typename Geometry2, - typename Tag1 = typename geometry::tag::type, - typename Tag2 = typename geometry::tag::type + typename Tag1 = geometry::tag_t, + typename Tag2 = geometry::tag_t > struct distance { diff --git a/include/boost/geometry/algorithms/detail/distance/iterator_selector.hpp b/include/boost/geometry/algorithms/detail/distance/iterator_selector.hpp index 363ec465a..6a34c9940 100644 --- a/include/boost/geometry/algorithms/detail/distance/iterator_selector.hpp +++ b/include/boost/geometry/algorithms/detail/distance/iterator_selector.hpp @@ -27,7 +27,7 @@ namespace detail { namespace distance // class to choose between point_iterator and segment_iterator -template ::type> +template > struct iterator_selector { typedef geometry::segment_iterator iterator_type; diff --git a/include/boost/geometry/algorithms/detail/distance/point_to_geometry.hpp b/include/boost/geometry/algorithms/detail/distance/point_to_geometry.hpp index 08c8f7059..cf332734d 100644 --- a/include/boost/geometry/algorithms/detail/distance/point_to_geometry.hpp +++ b/include/boost/geometry/algorithms/detail/distance/point_to_geometry.hpp @@ -253,7 +253,7 @@ public: private: typedef point_to_range < - Point, typename ring_type::type, Closure, Strategies + Point, ring_type_t, Closure, Strategies > per_ring; struct distance_to_interior_rings @@ -315,10 +315,7 @@ template typename Point, typename MultiGeometry, typename Strategies, - bool CheckCoveredBy = std::is_same - < - typename tag::type, multi_polygon_tag - >::value + bool CheckCoveredBy = std::is_same, multi_polygon_tag>::value > class point_to_multigeometry { @@ -509,7 +506,7 @@ struct distance > : distance < Point, Linear, Strategy, - point_tag, typename tag::type, + point_tag, tag_t, strategy_tag_distance_point_segment, false > {}; @@ -523,7 +520,7 @@ struct distance > : distance < Point, Areal, Strategy, - point_tag, typename tag::type, + point_tag, tag_t, strategy_tag_distance_point_segment, false > {}; diff --git a/include/boost/geometry/algorithms/detail/dummy_geometries.hpp b/include/boost/geometry/algorithms/detail/dummy_geometries.hpp index 722e6546a..ef2e30bff 100644 --- a/include/boost/geometry/algorithms/detail/dummy_geometries.hpp +++ b/include/boost/geometry/algorithms/detail/dummy_geometries.hpp @@ -39,15 +39,15 @@ struct dummy_multi_polygon {}; namespace traits { -template <> struct tag { typedef point_tag type; }; -template <> struct tag { typedef segment_tag type; }; -template <> struct tag { typedef box_tag type; }; -template <> struct tag { typedef linestring_tag type; }; -template <> struct tag { typedef ring_tag type; }; -template <> struct tag { typedef polygon_tag type; }; -template <> struct tag { typedef multi_point_tag type; }; -template <> struct tag { typedef multi_linestring_tag type; }; -template <> struct tag { typedef multi_polygon_tag type; }; +template <> struct tag { using type = point_tag; }; +template <> struct tag { using type = segment_tag; }; +template <> struct tag { using type = box_tag; }; +template <> struct tag { using type = linestring_tag; }; +template <> struct tag { using type = ring_tag; }; +template <> struct tag { using type = polygon_tag; }; +template <> struct tag { using type = multi_point_tag; }; +template <> struct tag { using type = multi_linestring_tag; }; +template <> struct tag { using type = multi_polygon_tag; }; } // namespace traits diff --git a/include/boost/geometry/algorithms/detail/envelope/areal.hpp b/include/boost/geometry/algorithms/detail/envelope/areal.hpp index ece4d3d14..c375ded55 100644 --- a/include/boost/geometry/algorithms/detail/envelope/areal.hpp +++ b/include/boost/geometry/algorithms/detail/envelope/areal.hpp @@ -54,8 +54,7 @@ struct envelope_polygon template static inline void apply(Polygon const& polygon, Box& mbr, Strategy const& strategy) { - typename ring_return_type::type ext_ring - = exterior_ring(polygon); + ring_return_type_t ext_ring = exterior_ring(polygon); if (geometry::is_empty(ext_ring)) { diff --git a/include/boost/geometry/algorithms/detail/envelope/initialize.hpp b/include/boost/geometry/algorithms/detail/envelope/initialize.hpp index 8d8342661..39e64c729 100644 --- a/include/boost/geometry/algorithms/detail/envelope/initialize.hpp +++ b/include/boost/geometry/algorithms/detail/envelope/initialize.hpp @@ -62,7 +62,7 @@ template > struct initialize { - typedef typename coordinate_type::type coordinate_type; + using coordinate_type = coordinate_type_t; static inline void apply(Box& box, coordinate_type min_value diff --git a/include/boost/geometry/algorithms/detail/envelope/interface.hpp b/include/boost/geometry/algorithms/detail/envelope/interface.hpp index 70679dd91..a86e9c859 100644 --- a/include/boost/geometry/algorithms/detail/envelope/interface.hpp +++ b/include/boost/geometry/algorithms/detail/envelope/interface.hpp @@ -100,7 +100,7 @@ struct envelope namespace resolve_dynamic { -template ::type> +template > struct envelope { template diff --git a/include/boost/geometry/algorithms/detail/envelope/intersects_antimeridian.hpp b/include/boost/geometry/algorithms/detail/envelope/intersects_antimeridian.hpp index 05127e0d2..3163d1f7e 100644 --- a/include/boost/geometry/algorithms/detail/envelope/intersects_antimeridian.hpp +++ b/include/boost/geometry/algorithms/detail/envelope/intersects_antimeridian.hpp @@ -62,7 +62,7 @@ struct intersects_antimeridian return apply < - typename coordinate_system::type::units + detail::coordinate_system_units_t >(geometry::get<0>(p1_normalized), geometry::get<1>(p1_normalized), geometry::get<0>(p2_normalized), diff --git a/include/boost/geometry/algorithms/detail/envelope/range_of_boxes.hpp b/include/boost/geometry/algorithms/detail/envelope/range_of_boxes.hpp index 2fa922705..28aedbb3e 100644 --- a/include/boost/geometry/algorithms/detail/envelope/range_of_boxes.hpp +++ b/include/boost/geometry/algorithms/detail/envelope/range_of_boxes.hpp @@ -229,9 +229,9 @@ struct envelope_range_of_boxes { // boxes in the range are assumed to be normalized already - typedef typename boost::range_value::type box_type; - typedef typename coordinate_type::type coordinate_type; - typedef typename detail::cs_angular_units::type units_type; + using box_type = typename boost::range_value::type; + using coordinate_type = coordinate_type_t; + using units_type = typename detail::cs_angular_units::type; static const bool is_equatorial = ! std::is_same < @@ -239,13 +239,13 @@ struct envelope_range_of_boxes spherical_polar_tag >::value; - typedef math::detail::constants_on_spheroid + using constants = math::detail::constants_on_spheroid < coordinate_type, units_type, is_equatorial - > constants; + >; - typedef longitude_interval interval_type; - typedef std::vector interval_range_type; + using interval_type = longitude_interval; + using interval_range_type = std::vector; BOOST_GEOMETRY_ASSERT(! boost::empty(range_of_boxes)); diff --git a/include/boost/geometry/algorithms/detail/envelope/transform_units.hpp b/include/boost/geometry/algorithms/detail/envelope/transform_units.hpp index 790f6e386..dffa7cab3 100644 --- a/include/boost/geometry/algorithms/detail/envelope/transform_units.hpp +++ b/include/boost/geometry/algorithms/detail/envelope/transform_units.hpp @@ -37,8 +37,8 @@ template < typename GeometryIn, typename GeometryOut, - typename TagIn = typename tag::type, - typename TagOut = typename tag::type + typename TagIn = tag_t, + typename TagOut = tag_t > struct transform_units_impl : not_implemented diff --git a/include/boost/geometry/algorithms/detail/equals/collect_vectors.hpp b/include/boost/geometry/algorithms/detail/equals/collect_vectors.hpp index 952bf2215..419f6115d 100644 --- a/include/boost/geometry/algorithms/detail/equals/collect_vectors.hpp +++ b/include/boost/geometry/algorithms/detail/equals/collect_vectors.hpp @@ -250,11 +250,11 @@ struct collected_vector_polar private: static base_point_type to_equatorial(Point const& p) { - using coord_type = typename coordinate_type::type; + using coord_type = coordinate_type_t; using constants = math::detail::constants_on_spheroid < coord_type, - typename coordinate_system::type::units + detail::coordinate_system_units_t > ; constexpr coord_type pi_2 = constants::half_period() / 2; @@ -395,9 +395,7 @@ struct polygon_collect_vectors { static inline void apply(Collection& collection, Polygon const& polygon) { - typedef typename geometry::ring_type::type ring_type; - - typedef range_collect_vectors per_range; + using per_range = range_collect_vectors, Collection>; per_range::apply(collection, exterior_ring(polygon)); auto const& rings = interior_rings(polygon); @@ -504,7 +502,7 @@ inline void collect_vectors(Collection& collection, Geometry const& geometry) dispatch::collect_vectors < - typename tag::type, + tag_t, Collection, Geometry >::apply(collection, geometry); diff --git a/include/boost/geometry/algorithms/detail/equals/implementation.hpp b/include/boost/geometry/algorithms/detail/equals/implementation.hpp index 2f803f365..bf3081a13 100644 --- a/include/boost/geometry/algorithms/detail/equals/implementation.hpp +++ b/include/boost/geometry/algorithms/detail/equals/implementation.hpp @@ -215,7 +215,7 @@ struct equals_by_collection >::template type < calculation_type, - typename geometry::point_type::type + geometry::point_type_t >; std::vector c1, c2; diff --git a/include/boost/geometry/algorithms/detail/equals/interface.hpp b/include/boost/geometry/algorithms/detail/equals/interface.hpp index 5590a8d88..2b9058ab0 100644 --- a/include/boost/geometry/algorithms/detail/equals/interface.hpp +++ b/include/boost/geometry/algorithms/detail/equals/interface.hpp @@ -159,8 +159,8 @@ namespace resolve_dynamic { template < typename Geometry1, typename Geometry2, - typename Tag1 = typename geometry::tag::type, - typename Tag2 = typename geometry::tag::type + typename Tag1 = geometry::tag_t, + typename Tag2 = geometry::tag_t > struct equals { diff --git a/include/boost/geometry/algorithms/detail/expand/interface.hpp b/include/boost/geometry/algorithms/detail/expand/interface.hpp index 6552c266e..e530e6386 100644 --- a/include/boost/geometry/algorithms/detail/expand/interface.hpp +++ b/include/boost/geometry/algorithms/detail/expand/interface.hpp @@ -101,7 +101,7 @@ struct expand namespace resolve_dynamic { -template ::type> +template > struct expand { template diff --git a/include/boost/geometry/algorithms/detail/expand_by_epsilon.hpp b/include/boost/geometry/algorithms/detail/expand_by_epsilon.hpp index ae07f5bb0..9efa61c07 100644 --- a/include/boost/geometry/algorithms/detail/expand_by_epsilon.hpp +++ b/include/boost/geometry/algorithms/detail/expand_by_epsilon.hpp @@ -41,7 +41,7 @@ struct corner_by_epsilon { static inline void apply(Point & point) { - typedef typename coordinate_type::type coord_type; + using coord_type = coordinate_type_t; coord_type const coord = get(point); coord_type const seps = math::scaled_epsilon(coord); @@ -51,9 +51,9 @@ struct corner_by_epsilon } static inline void apply(Point & point, - typename coordinate_type::type const& eps) + coordinate_type_t const& eps) { - typedef typename coordinate_type::type coord_type; + using coord_type = coordinate_type_t; coord_type const coord = get(point); coord_type const seps = math::scaled_epsilon(coord, eps); @@ -72,13 +72,13 @@ template struct corner_by_epsilon { static inline void apply(Point const&) {} - static inline void apply(Point const&, typename coordinate_type::type const&) {} + static inline void apply(Point const&, coordinate_type_t const&) {} }; template < typename Box, - bool Enable = ! std::is_integral::type>::value + bool Enable = ! std::is_integral>::value > struct expand_by_epsilon { @@ -94,7 +94,7 @@ struct expand_by_epsilon } static inline void apply(Box & box, - typename coordinate_type::type const& eps) + coordinate_type_t const& eps) { typedef detail::indexed_point_view min_type; min_type min_point(box); @@ -110,7 +110,7 @@ template struct expand_by_epsilon { static inline void apply(Box &) {} - static inline void apply(Box &, typename coordinate_type::type const&) {} + static inline void apply(Box &, coordinate_type_t const&) {} }; } // namespace expand @@ -122,8 +122,7 @@ inline void expand_by_epsilon(Box & box) } template -inline void expand_by_epsilon(Box & box, - typename coordinate_type::type const& eps) +inline void expand_by_epsilon(Box & box, coordinate_type_t const& eps) { expand::expand_by_epsilon::apply(box, eps); } diff --git a/include/boost/geometry/algorithms/detail/extreme_points.hpp b/include/boost/geometry/algorithms/detail/extreme_points.hpp index f3845c920..8480b0167 100644 --- a/include/boost/geometry/algorithms/detail/extreme_points.hpp +++ b/include/boost/geometry/algorithms/detail/extreme_points.hpp @@ -122,8 +122,8 @@ template struct extreme_points_on_ring { - typedef typename geometry::coordinate_type::type coordinate_type; - typedef typename geometry::point_type::type point_type; + using coordinate_type = geometry::coordinate_type_t; + using point_type = geometry::point_type_t; template static inline bool extend(CirclingIterator& it, @@ -393,7 +393,7 @@ template < typename Geometry, std::size_t Dimension, - typename GeometryTag = typename tag::type + typename GeometryTag = tag_t > struct extreme_points {}; @@ -412,11 +412,10 @@ struct extreme_points static inline bool apply(Polygon const& polygon, Extremes& extremes, Intruders& intruders, SideStrategy const& strategy) { - typedef typename geometry::ring_type::type ring_type; - typedef detail::extreme_points::extreme_points_on_ring + using ring_implementation = detail::extreme_points::extreme_points_on_ring < - ring_type, Dimension - > ring_implementation; + geometry::ring_type_t, Dimension + >; if (! ring_implementation::apply(geometry::exterior_ring(polygon), extremes, intruders, strategy)) diff --git a/include/boost/geometry/algorithms/detail/for_each_range.hpp b/include/boost/geometry/algorithms/detail/for_each_range.hpp index 30b209dc6..5ea414b58 100644 --- a/include/boost/geometry/algorithms/detail/for_each_range.hpp +++ b/include/boost/geometry/algorithms/detail/for_each_range.hpp @@ -133,7 +133,7 @@ namespace dispatch template < typename Geometry, - typename Tag = typename tag::type + typename Tag = tag_t > struct for_each_range { diff --git a/include/boost/geometry/algorithms/detail/gc_make_rtree.hpp b/include/boost/geometry/algorithms/detail/gc_make_rtree.hpp index c1c00d469..d12cdff50 100644 --- a/include/boost/geometry/algorithms/detail/gc_make_rtree.hpp +++ b/include/boost/geometry/algorithms/detail/gc_make_rtree.hpp @@ -37,9 +37,9 @@ using gc_make_rtree_box_t = geometry::model::box < geometry::model::point < - typename geometry::coordinate_type::type, + geometry::coordinate_type_t, geometry::dimension::value, - typename geometry::coordinate_system::type + geometry::coordinate_system_t > >; diff --git a/include/boost/geometry/algorithms/detail/get_max_size.hpp b/include/boost/geometry/algorithms/detail/get_max_size.hpp index f4741824a..2397b552d 100644 --- a/include/boost/geometry/algorithms/detail/get_max_size.hpp +++ b/include/boost/geometry/algorithms/detail/get_max_size.hpp @@ -33,9 +33,9 @@ namespace detail template struct get_max_size_box { - static inline typename coordinate_type::type apply(Box const& box) + static inline coordinate_type_t apply(Box const& box) { - typename coordinate_type::type s + coordinate_type_t s = geometry::math::abs(geometry::get<1, Dimension>(box) - geometry::get<0, Dimension>(box)); return (std::max)(s, get_max_size_box::apply(box)); @@ -45,7 +45,7 @@ struct get_max_size_box template struct get_max_size_box { - static inline typename coordinate_type::type apply(Box const& box) + static inline coordinate_type_t apply(Box const& box) { return geometry::math::abs(geometry::get<1, 0>(box) - geometry::get<0, 0>(box)); } @@ -54,7 +54,7 @@ struct get_max_size_box // This might be implemented later on for other geometries too. // Not dispatched yet. template -inline typename coordinate_type::type get_max_size(Box const& box) +inline coordinate_type_t get_max_size(Box const& box) { return get_max_size_box::value - 1>::apply(box); } diff --git a/include/boost/geometry/algorithms/detail/intersection/areal_areal.hpp b/include/boost/geometry/algorithms/detail/intersection/areal_areal.hpp index 3f5d43886..cea95807e 100644 --- a/include/boost/geometry/algorithms/detail/intersection/areal_areal.hpp +++ b/include/boost/geometry/algorithms/detail/intersection/areal_areal.hpp @@ -75,10 +75,10 @@ struct intersection_areal_areal_ 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 < @@ -89,18 +89,18 @@ struct intersection_areal_areal_ > >(); - 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, @@ -124,15 +124,15 @@ struct intersection_areal_areal_ // 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)); diff --git a/include/boost/geometry/algorithms/detail/intersection/gc.hpp b/include/boost/geometry/algorithms/detail/intersection/gc.hpp index d47d4c05b..eb945d1de 100644 --- a/include/boost/geometry/algorithms/detail/intersection/gc.hpp +++ b/include/boost/geometry/algorithms/detail/intersection/gc.hpp @@ -44,8 +44,8 @@ struct gc_can_convert_element template using has_same_tag_as_single = std::is_same < - typename geometry::tag::type, - typename geometry::tag::type>::type + geometry::tag_t, + geometry::tag_t::type> >; using gc_types = typename traits::geometry_types::type; using found_type = typename util::sequence_find_if::type; diff --git a/include/boost/geometry/algorithms/detail/intersection/interface.hpp b/include/boost/geometry/algorithms/detail/intersection/interface.hpp index 8c4a00876..ee52ca3c0 100644 --- a/include/boost/geometry/algorithms/detail/intersection/interface.hpp +++ b/include/boost/geometry/algorithms/detail/intersection/interface.hpp @@ -37,8 +37,8 @@ namespace dispatch template < typename Geometry1, typename Geometry2, - typename Tag1 = typename geometry::tag::type, - typename Tag2 = typename geometry::tag::type, + typename Tag1 = geometry::tag_t, + typename Tag2 = geometry::tag_t, bool Reverse = reverse_dispatch::type::value > struct intersection @@ -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), @@ -109,9 +109,9 @@ namespace resolve_collection template < typename Geometry1, typename Geometry2, typename GeometryOut, - typename Tag1 = typename geometry::tag::type, - typename Tag2 = typename geometry::tag::type, - typename TagOut = typename geometry::tag::type + typename Tag1 = geometry::tag_t, + typename Tag2 = geometry::tag_t, + typename TagOut = geometry::tag_t > struct intersection { @@ -195,10 +195,10 @@ struct intersection 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 < @@ -216,8 +216,8 @@ namespace resolve_dynamic template < typename Geometry1, typename Geometry2, - typename Tag1 = typename geometry::tag::type, - typename Tag2 = typename geometry::tag::type + typename Tag1 = geometry::tag_t, + typename Tag2 = geometry::tag_t > struct intersection { diff --git a/include/boost/geometry/algorithms/detail/intersects/implementation.hpp b/include/boost/geometry/algorithms/detail/intersects/implementation.hpp index 36f57fe6a..cee1af9c0 100644 --- a/include/boost/geometry/algorithms/detail/intersects/implementation.hpp +++ b/include/boost/geometry/algorithms/detail/intersects/implementation.hpp @@ -46,20 +46,20 @@ struct self_intersects { concepts::check(); - typedef typename geometry::point_type::type point_type; - typedef typename strategies::relate::services::default_strategy + using point_type = geometry::point_type_t; + using strategy_type = typename strategies::relate::services::default_strategy < Geometry, Geometry - >::type strategy_type; + >::type; - typedef detail::overlay::turn_info turn_info; + using turn_info = detail::overlay::turn_info; std::deque turns; - typedef detail::overlay::get_turn_info + using turn_policy = detail::overlay::get_turn_info < detail::overlay::assign_null_policy - > turn_policy; + >; strategy_type strategy; diff --git a/include/boost/geometry/algorithms/detail/is_simple/debug_print_boundary_points.hpp b/include/boost/geometry/algorithms/detail/is_simple/debug_print_boundary_points.hpp index 720f5b651..bd0f191ce 100644 --- a/include/boost/geometry/algorithms/detail/is_simple/debug_print_boundary_points.hpp +++ b/include/boost/geometry/algorithms/detail/is_simple/debug_print_boundary_points.hpp @@ -43,7 +43,7 @@ namespace detail { namespace is_simple #ifdef BOOST_GEOMETRY_TEST_DEBUG -template ::type> +template > struct debug_boundary_points_printer : not_implemented {}; diff --git a/include/boost/geometry/algorithms/detail/is_simple/linear.hpp b/include/boost/geometry/algorithms/detail/is_simple/linear.hpp index 8c91e0c9f..c9d31ac0b 100644 --- a/include/boost/geometry/algorithms/detail/is_simple/linear.hpp +++ b/include/boost/geometry/algorithms/detail/is_simple/linear.hpp @@ -80,7 +80,7 @@ template < typename Geometry, typename Strategy, - typename Tag = typename tag::type + typename Tag = tag_t > class is_acceptable_turn : not_implemented diff --git a/include/boost/geometry/algorithms/detail/is_valid/debug_validity_phase.hpp b/include/boost/geometry/algorithms/detail/is_valid/debug_validity_phase.hpp index b072f7ad4..10b125d8e 100644 --- a/include/boost/geometry/algorithms/detail/is_valid/debug_validity_phase.hpp +++ b/include/boost/geometry/algorithms/detail/is_valid/debug_validity_phase.hpp @@ -24,7 +24,7 @@ namespace boost { namespace geometry namespace detail { namespace is_valid { -template ::type> +template > struct debug_validity_phase { static inline void apply(int) diff --git a/include/boost/geometry/algorithms/detail/is_valid/has_invalid_coordinate.hpp b/include/boost/geometry/algorithms/detail/is_valid/has_invalid_coordinate.hpp index 82a1f5f4c..35a48ec51 100644 --- a/include/boost/geometry/algorithms/detail/is_valid/has_invalid_coordinate.hpp +++ b/include/boost/geometry/algorithms/detail/is_valid/has_invalid_coordinate.hpp @@ -106,10 +106,10 @@ struct range_has_invalid_coordinate template < typename Geometry, - typename Tag = typename tag::type, + typename Tag = tag_t, bool HasFloatingPointCoordinates = std::is_floating_point < - typename coordinate_type::type + coordinate_type_t >::value > struct has_invalid_coordinate diff --git a/include/boost/geometry/algorithms/detail/is_valid/interface.hpp b/include/boost/geometry/algorithms/detail/is_valid/interface.hpp index 53576d20c..49acc24d4 100644 --- a/include/boost/geometry/algorithms/detail/is_valid/interface.hpp +++ b/include/boost/geometry/algorithms/detail/is_valid/interface.hpp @@ -92,7 +92,7 @@ struct is_valid namespace resolve_dynamic { -template ::type> +template > struct is_valid { template diff --git a/include/boost/geometry/algorithms/detail/is_valid/is_acceptable_turn.hpp b/include/boost/geometry/algorithms/detail/is_valid/is_acceptable_turn.hpp index 4aad18881..e08185fb6 100644 --- a/include/boost/geometry/algorithms/detail/is_valid/is_acceptable_turn.hpp +++ b/include/boost/geometry/algorithms/detail/is_valid/is_acceptable_turn.hpp @@ -33,7 +33,7 @@ template < typename Geometry, order_selector Order = geometry::point_order::value, - typename Tag = typename tag::type + typename Tag = tag_t > struct acceptable_operation {}; @@ -69,7 +69,7 @@ struct acceptable_operation -template ::type> +template > struct is_acceptable_turn {}; diff --git a/include/boost/geometry/algorithms/detail/is_valid/polygon.hpp b/include/boost/geometry/algorithms/detail/is_valid/polygon.hpp index a02ce3193..8e81df247 100644 --- a/include/boost/geometry/algorithms/detail/is_valid/polygon.hpp +++ b/include/boost/geometry/algorithms/detail/is_valid/polygon.hpp @@ -122,15 +122,14 @@ protected: VisitPolicy& visitor, Strategy const& strategy) { - typedef debug_validity_phase debug_phase; - typedef typename ring_type::type ring_type; + using debug_phase = debug_validity_phase; // check validity of exterior ring debug_phase::apply(1); if (! detail::is_valid::is_valid_ring < - ring_type, + ring_type_t, false // do not check self intersections >::apply(exterior_ring(polygon), visitor, strategy)) { @@ -453,10 +452,10 @@ public: else // else prevents unreachable code warning { // compute turns and check if all are acceptable - typedef debug_validity_phase debug_phase; + using debug_phase = debug_validity_phase; debug_phase::apply(3); - typedef has_valid_self_turns has_valid_turns; + using has_valid_turns = has_valid_self_turns; std::deque turns; bool has_invalid_turns diff --git a/include/boost/geometry/algorithms/detail/overlaps/implementation.hpp b/include/boost/geometry/algorithms/detail/overlaps/implementation.hpp index 5ab1b6ba7..d40b324c6 100644 --- a/include/boost/geometry/algorithms/detail/overlaps/implementation.hpp +++ b/include/boost/geometry/algorithms/detail/overlaps/implementation.hpp @@ -59,8 +59,8 @@ struct box_box_loop { assert_dimension_equal(); - typedef typename coordinate_type::type coordinate_type1; - typedef typename coordinate_type::type coordinate_type2; + using coordinate_type1 = coordinate_type_t; + using coordinate_type2 = coordinate_type_t; coordinate_type1 const& min1 = get(b1); coordinate_type1 const& max1 = get(b1); diff --git a/include/boost/geometry/algorithms/detail/overlaps/interface.hpp b/include/boost/geometry/algorithms/detail/overlaps/interface.hpp index bc2cfb517..a443beb03 100644 --- a/include/boost/geometry/algorithms/detail/overlaps/interface.hpp +++ b/include/boost/geometry/algorithms/detail/overlaps/interface.hpp @@ -46,8 +46,8 @@ template < typename Geometry1, typename Geometry2, - typename Tag1 = typename tag::type, - typename Tag2 = typename tag::type + typename Tag1 = tag_t, + typename Tag2 = tag_t > struct overlaps : detail::relate::relate_impl @@ -131,8 +131,8 @@ namespace resolve_dynamic template < typename Geometry1, typename Geometry2, - typename Tag1 = typename geometry::tag::type, - typename Tag2 = typename geometry::tag::type + typename Tag1 = geometry::tag_t, + typename Tag2 = geometry::tag_t > struct overlaps { diff --git a/include/boost/geometry/algorithms/detail/overlay/add_rings.hpp b/include/boost/geometry/algorithms/detail/overlay/add_rings.hpp index 026906b49..a253b58d7 100644 --- a/include/boost/geometry/algorithms/detail/overlay/add_rings.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/add_rings.hpp @@ -48,9 +48,9 @@ inline void convert_and_add(GeometryOut& result, ring_identifier id, bool reversed, bool append) { - typedef typename geometry::tag::type tag1; - typedef typename geometry::tag::type tag2; - typedef typename geometry::tag::type tag_out; + using tag1 = geometry::tag_t; + using tag2 = geometry::tag_t; + using tag_out = geometry::tag_t; if (id.source_index == 0) { @@ -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::type area_type; + using area_type = typename geometry::area_result::type; area_type const area = geometry::area(result, strategy); area_type const zero = 0; // Ignore if area is 0 diff --git a/include/boost/geometry/algorithms/detail/overlay/assign_parents.hpp b/include/boost/geometry/algorithms/detail/overlay/assign_parents.hpp index 73e3bdb28..ad775e7aa 100644 --- a/include/boost/geometry/algorithms/detail/overlay/assign_parents.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/assign_parents.hpp @@ -57,8 +57,8 @@ static inline bool within_selected_input(Item const& item2, RingCollection const& collection, Strategy const& strategy) { - typedef typename geometry::tag::type tag1; - typedef typename geometry::tag::type tag2; + using tag1 = geometry::tag_t; + using tag2 = geometry::tag_t; // NOTE: range_in_geometry first checks the item2.point and then // if this point is on boundary it checks points of inner_geometry @@ -92,8 +92,8 @@ static inline bool within_selected_input(Item const& item2, RingCollection const& collection, Strategy const& strategy) { - typedef typename geometry::tag::type tag1; - typedef typename geometry::tag::type tag2; + using tag1 = geometry::tag_t; + using tag2 = geometry::tag_t; switch (inner_id.source_index) { @@ -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; @@ -254,16 +254,16 @@ inline void assign_parents(Geometry1 const& geometry1, static bool const is_dissolve = OverlayType == overlay_dissolve; static bool const check_for_orientation = is_buffer || is_dissolve; - typedef typename geometry::tag::type tag1; - typedef typename geometry::tag::type tag2; + using tag1 = geometry::tag_t; + using tag2 = geometry::tag_t; - typedef typename RingMap::mapped_type ring_info_type; - typedef typename ring_info_type::point_type point_type; - typedef model::box box_type; - typedef typename geometry::area_result + using ring_info_type = typename RingMap::mapped_type; + using point_type = typename ring_info_type::point_type; + using box_type = model::box; + using area_result_type = typename geometry::area_result < point_type, Strategy // TODO: point_type is technically incorrect - >::type area_result_type; + >::type; { std::size_t count_total = ring_map.size(); diff --git a/include/boost/geometry/algorithms/detail/overlay/backtrack_check_si.hpp b/include/boost/geometry/algorithms/detail/overlay/backtrack_check_si.hpp index 2f8e6314a..517d881db 100644 --- a/include/boost/geometry/algorithms/detail/overlay/backtrack_check_si.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/backtrack_check_si.hpp @@ -100,7 +100,7 @@ class backtrack_check_self_intersections {} }; public : - typedef state state_type; + using state_type = state; template < @@ -155,7 +155,7 @@ template class backtrack_debug { public : - typedef backtrack_state state_type; + using state_type = backtrack_state; template static inline void apply(std::size_t size_at_start, diff --git a/include/boost/geometry/algorithms/detail/overlay/clip_linestring.hpp b/include/boost/geometry/algorithms/detail/overlay/clip_linestring.hpp index e598dcfef..b5b223ef7 100644 --- a/include/boost/geometry/algorithms/detail/overlay/clip_linestring.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/clip_linestring.hpp @@ -54,7 +54,7 @@ template class liang_barsky { private: - typedef model::referring_segment segment_type; + using segment_type = model::referring_segment; template inline bool check_edge(CoordinateType const& p, CoordinateType const& q, CalcType& t1, CalcType& t2) const @@ -90,7 +90,7 @@ public: // 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() { @@ -99,8 +99,8 @@ public: inline bool clip_segment(Box const& b, segment_type& s, bool& sp1_clipped, bool& sp2_clipped) const { - typedef typename select_coordinate_type::type coordinate_type; - typedef typename select_most_precise::type calc_type; + using coordinate_type = typename select_coordinate_type::type; + using calc_type = typename select_most_precise::type; calc_type t1 = 0; calc_type t2 = 1; diff --git a/include/boost/geometry/algorithms/detail/overlay/colocate_clusters.hpp b/include/boost/geometry/algorithms/detail/overlay/colocate_clusters.hpp index 6d04f0a09..330ef3463 100644 --- a/include/boost/geometry/algorithms/detail/overlay/colocate_clusters.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/colocate_clusters.hpp @@ -25,8 +25,8 @@ namespace detail { namespace overlay template < typename Point, - typename CoordinateType = typename geometry::coordinate_type::type, - typename CsTag = typename geometry::cs_tag::type, + typename CoordinateType = geometry::coordinate_type_t, + typename CsTag = geometry::cs_tag_t, bool IsIntegral = std::is_integral::value > struct cluster_colocator diff --git a/include/boost/geometry/algorithms/detail/overlay/copy_segment_point.hpp b/include/boost/geometry/algorithms/detail/overlay/copy_segment_point.hpp index ad5d2f5cd..1c5042be8 100644 --- a/include/boost/geometry/algorithms/detail/overlay/copy_segment_point.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/copy_segment_point.hpp @@ -92,7 +92,7 @@ struct copy_segment_point_polygon // Call ring-version with the right ring return copy_segment_point_range < - typename geometry::ring_type::type, + geometry::ring_type_t, Reverse, SegmentIdentifier, PointOut @@ -288,7 +288,7 @@ inline bool copy_segment_point(Geometry const& geometry, return dispatch::copy_segment_point < - typename tag::type, + tag_t, Geometry, Reverse, SegmentIdentifier, @@ -322,7 +322,7 @@ inline bool copy_segment_point(Geometry1 const& geometry1, Geometry2 const& geom { return dispatch::copy_segment_point < - typename tag::type, + tag_t, Geometry1, Reverse1, SegmentIdentifier, @@ -333,7 +333,7 @@ inline bool copy_segment_point(Geometry1 const& geometry1, Geometry2 const& geom { return dispatch::copy_segment_point < - typename tag::type, + tag_t, Geometry2, Reverse2, SegmentIdentifier, diff --git a/include/boost/geometry/algorithms/detail/overlay/copy_segments.hpp b/include/boost/geometry/algorithms/detail/overlay/copy_segments.hpp index f6a70648a..d33b5f195 100644 --- a/include/boost/geometry/algorithms/detail/overlay/copy_segments.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/copy_segments.hpp @@ -349,7 +349,7 @@ inline void copy_segments(Geometry const& geometry, dispatch::copy_segments < - typename tag::type, + tag_t, Reverse >::apply(geometry, seg_id, to_index, strategy, range_out); } diff --git a/include/boost/geometry/algorithms/detail/overlay/debug_traverse.hpp b/include/boost/geometry/algorithms/detail/overlay/debug_traverse.hpp new file mode 100644 index 000000000..8524ae212 --- /dev/null +++ b/include/boost/geometry/algorithms/detail/overlay/debug_traverse.hpp @@ -0,0 +1,69 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) + +// Copyright (c) 2007-2025 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2023-2024 Adam Wulkiewicz, Lodz, Poland. + +// This file was modified by Oracle on 2017-2024. +// Modifications copyright (c) 2017-2024 Oracle and/or its affiliates. +// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle +// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_DEBUG_TRAVERSE_HPP +#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_DEBUG_TRAVERSE_HPP + +#include + +#if defined(BOOST_GEOMETRY_DEBUG_INTERSECTION) \ + || defined(BOOST_GEOMETRY_OVERLAY_REPORT_WKT) \ + || defined(BOOST_GEOMETRY_DEBUG_TRAVERSE) +# include +# include +# include +#endif + +namespace boost { namespace geometry +{ + +#ifndef DOXYGEN_NO_DETAIL +namespace detail { namespace overlay +{ + +template +#ifdef BOOST_GEOMETRY_DEBUG_TRAVERSE +inline void debug_traverse(Turn const& turn, Operation op, + std::string const& header, bool condition = true) +{ + if (! condition) + { + return; + } + std::cout << " " << header + << " at " << op.seg_id + << " meth: " << method_char(turn.method) + << " op: " << operation_char(op.operation) + << " of: " << operation_char(turn.operations[0].operation) + << operation_char(turn.operations[1].operation) + << " " << geometry::wkt(turn.point) + << std::endl; + + if (boost::contains(header, "Finished")) + { + std::cout << std::endl; + } +} +#else +inline void debug_traverse(Turn const& , Operation, const char*, bool = true) +{ +} +#endif + +}} // namespace detail::overlay +#endif // DOXYGEN_NO_DETAIL + +}} // namespace boost::geometry + +#endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_DEBUG_TRAVERSE_HPP diff --git a/include/boost/geometry/algorithms/detail/overlay/enrich_intersection_points.hpp b/include/boost/geometry/algorithms/detail/overlay/enrich_intersection_points.hpp index 215a53298..ca82d015e 100644 --- a/include/boost/geometry/algorithms/detail/overlay/enrich_intersection_points.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/enrich_intersection_points.hpp @@ -104,8 +104,7 @@ inline void enrich_sort(Operations& operations, // Assign travel-to-vertex/ip index for each turn. template -inline void enrich_assign(Operations& operations, Turns& turns, - bool check_consecutive_turns) +inline void enrich_assign(Operations& operations, Turns& turns) { for (auto const& item : util::enumerate(operations)) { @@ -131,34 +130,6 @@ inline void enrich_assign(Operations& operations, Turns& turns, return next_turn.operations[operations[next_index].operation_index]; }; - if (check_consecutive_turns - && indexed.turn_index == operations[next_index].turn_index - && op.seg_id == next_operation().seg_id) - { - // If the two operations on the same turn are ordered consecutively, - // and they are on the same segment, then the turn where to travel to should - // be considered one further. Therefore next is increased. - // - // It often happens in buffer, in these configurations: - // +---->--+ - // | | - // | +->-*----> - // | | | - // ^ +-<-+ - // If the next index is not corrected, the small rectangle - // will be kept in the output. - - // This is a normal situation and occurs, for example, in every concave bend. - // In general it should always travel from turn to next turn. - // Only in some circumstances traveling to the same turn is necessary, for example - // if there is only one turn in the outer ring. - // - // (For dissolve this is not done, turn_index is often - // the same for two consecutive operations - but the conditions are changed - // and this should be verified again) - next_index = advance(next_index); - } - // Cluster behaviour: next should point after cluster, unless // their seg_ids are not the same // (For dissolve, this is still to be examined - TODO) @@ -167,6 +138,7 @@ inline void enrich_assign(Operations& operations, Turns& turns, && op.seg_id == next_operation().seg_id && indexed.turn_index != operations[next_index].turn_index) { + // In same cluster, on same segment, but not same turn next_index = advance(next_index); } @@ -285,45 +257,52 @@ struct enriched_map_default_include_policy // Add all (non discarded) operations on this ring // Blocked operations or uu on clusters (for intersection) // should be included, to block potential paths in clusters -template -inline void create_map(Turns const& turns, MappedVector& mapped_vector, - IncludePolicy const& include_policy) +template +inline auto create_map(Turns const& turns, IncludePolicy const& include_policy) { + using turn_type = typename boost::range_value::type; + using indexed_turn_operation = detail::overlay::indexed_turn_operation + < + typename turn_type::turn_operation_type + >; + + std::map + < + ring_identifier, + std::vector + > mapped_vector; + for (auto const& turn_item : util::enumerate(turns)) { auto const& index = turn_item.index; auto const& turn = turn_item.value; - if (! turn.discarded) + if (turn.discarded) { - for (auto const& op_item : util::enumerate(turn.operations)) + continue; + } + + for (auto const& op_item : util::enumerate(turn.operations)) + { + auto const& op_index = op_item.index; + auto const& op = op_item.value; + if (include_policy.include(op.operation)) { - auto const& op_index = op_item.index; - auto const& op = op_item.value; - if (include_policy.include(op.operation)) - { - ring_identifier const ring_id - ( - op.seg_id.source_index, - op.seg_id.multi_index, - op.seg_id.ring_index - ); - mapped_vector[ring_id].emplace_back - ( - index, op_index, op, turn.operations[1 - op_index].seg_id - ); - } + mapped_vector[ring_id_by_seg_id(op.seg_id)].emplace_back + ( + index, op_index, op, turn.operations[1 - op_index].seg_id + ); } } } + return mapped_vector; } template -inline typename geometry::coordinate_type::type - distance_measure(Point1 const& a, Point2 const& b) +inline geometry::coordinate_type_t distance_measure(Point1 const& a, Point2 const& b) { // TODO: use comparable distance for point-point instead - but that // causes currently cycling include problems - using ctype = typename geometry::coordinate_type::type; + using ctype = geometry::coordinate_type_t; ctype const dx = get<0>(a) - get<0>(b); ctype const dy = get<1>(a) - get<1>(b); return dx * dx + dy * dy; @@ -357,7 +336,6 @@ inline void calculate_remaining_distance(Turns& turns) } } - }} // namespace detail::overlay #endif //DOXYGEN_NO_DETAIL @@ -399,51 +377,14 @@ inline void enrich_intersection_points(Turns& turns, ? detail::overlay::operation_intersection : detail::overlay::operation_union; constexpr bool is_dissolve = OverlayType == overlay_dissolve; - constexpr bool is_buffer = OverlayType == overlay_buffer; - - using turn_type = typename boost::range_value::type; - using indexed_turn_operation = detail::overlay::indexed_turn_operation - < - typename turn_type::turn_operation_type - > ; - - using mapped_vector_type = std::map - < - ring_identifier, - std::vector - >; // Turns are often used by index (in clusters, next_index, etc) // and turns may therefore NOT be DELETED - they may only be flagged as discarded - bool has_cc = false; - bool has_colocations = false; - - if BOOST_GEOMETRY_CONSTEXPR (! is_buffer) - { - // Handle colocations, gathering clusters and (below) their properties. - has_colocations = detail::overlay::handle_colocations - < - Reverse1, Reverse2, OverlayType, Geometry1, Geometry2 - >(turns, clusters); - // Gather cluster properties (using even clusters with - // discarded turns - for open turns) - detail::overlay::gather_cluster_properties - < - Reverse1, - Reverse2, - OverlayType - >(clusters, turns, target_operation, - geometry1, geometry2, strategy); - } - else - { - // For buffer, this was already done before calling enrich_intersection_points. - has_colocations = ! clusters.empty(); - } - discard_duplicate_turns(turns, geometry1, geometry2); + bool has_cc = false; + // Discard turns not part of target overlay for (auto& turn : turns) { @@ -457,8 +398,6 @@ inline void enrich_intersection_points(Turns& turns, // For all operations, discard xx and none/none // For intersections, remove uu to avoid the need to travel // a union (during intersection) in uu/cc clusters (e.g. #31,#32,#33) - // The ux is necessary to indicate impossible paths - // (especially if rescaling is removed) // Similarly, for union, discard ii and ix @@ -492,11 +431,15 @@ inline void enrich_intersection_points(Turns& turns, strategy); } + if (! clusters.empty()) + { + detail::overlay::cleanup_clusters(turns, clusters); + detail::overlay::colocate_clusters(clusters, turns); + } + // Create a map of vectors of indexed operation-types to be able // to sort intersection points PER RING - mapped_vector_type mapped_vector; - - detail::overlay::create_map(turns, mapped_vector, + auto mapped_vector = detail::overlay::create_map(turns, detail::overlay::enriched_map_default_include_policy()); for (auto& pair : mapped_vector) @@ -507,12 +450,6 @@ inline void enrich_intersection_points(Turns& turns, strategy); } - if (has_colocations) - { - detail::overlay::cleanup_clusters(turns, clusters); - detail::overlay::colocate_clusters(clusters, turns); - } - // After cleaning up clusters assign the next turns for (auto& pair : mapped_vector) @@ -525,7 +462,7 @@ inline void enrich_intersection_points(Turns& turns, detail::overlay::enrich_adapt(pair.second, turns); } - detail::overlay::enrich_assign(pair.second, turns, ! is_dissolve); + detail::overlay::enrich_assign(pair.second, turns); } if (has_cc) diff --git a/include/boost/geometry/algorithms/detail/overlay/follow.hpp b/include/boost/geometry/algorithms/detail/overlay/follow.hpp index 133f1c93f..dbfefde18 100644 --- a/include/boost/geometry/algorithms/detail/overlay/follow.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/follow.hpp @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -164,7 +165,7 @@ inline bool is_touching(Turn const& turn, Operation const& op, template < typename GeometryOut, - typename Tag = typename geometry::tag::type + typename Tag = geometry::tag_t > struct add_isolated_point {}; @@ -297,7 +298,7 @@ struct action_selector template struct action_selector { - typedef action_selector normal_action; + using normal_action = action_selector; template < @@ -382,14 +383,14 @@ template > class follow { - typedef geometry::detail::output_geometry_access + using linear = geometry::detail::output_geometry_access < GeometryOut, linestring_tag, linestring_tag - > linear; - typedef geometry::detail::output_geometry_access + >; + using pointlike = geometry::detail::output_geometry_access < GeometryOut, point_tag, linestring_tag - > pointlike; + >; public : @@ -413,17 +414,17 @@ public : OutputIterator out, Strategy const& strategy) { - typedef following::action_selector action; + using action = following::action_selector; // Sort intersection points on segments-along-linestring, and distance // (like in enrich is done for poly/poly) // sort turns by Linear seg_id, then by fraction, then // for same ring id: x, u, i, c // for different ring id: c, i, u, x - typedef relate::turns::less + using turn_less = relate::turns::less < 0, relate::turns::less_op_linear_areal_single<0>, Strategy - > turn_less; + >; std::sort(boost::begin(turns), boost::end(turns), turn_less()); typename linear::type current_piece; diff --git a/include/boost/geometry/algorithms/detail/overlay/follow_linear_linear.hpp b/include/boost/geometry/algorithms/detail/overlay/follow_linear_linear.hpp index 1a6cd2800..f840df861 100644 --- a/include/boost/geometry/algorithms/detail/overlay/follow_linear_linear.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/follow_linear_linear.hpp @@ -181,16 +181,16 @@ class follow_linestring_linear { protected: // allow spikes (false indicates: do not remove spikes) - typedef following::action_selector action; + using action = following::action_selector; - typedef geometry::detail::output_geometry_access + using linear = geometry::detail::output_geometry_access < GeometryOut, linestring_tag, linestring_tag - > linear; - typedef geometry::detail::output_geometry_access + >; + using pointlike = geometry::detail::output_geometry_access < GeometryOut, point_tag, linestring_tag - > pointlike; + >; template < @@ -363,20 +363,20 @@ class follow_multilinestring_linear > { protected: - typedef typename boost::range_value::type Linestring; + using linestring_t = typename boost::range_value::type; - typedef follow_linestring_linear + using base_t = follow_linestring_linear < - LinestringOut, Linestring, Linear, + LinestringOut, linestring_t, Linear, OverlayType, FollowIsolatedPoints, FollowContinueTurns - > Base; + >; - typedef following::action_selector action; + using action = following::action_selector; - typedef typename boost::range_iterator + using linestring_iterator = typename boost::range_iterator < MultiLinestring const - >::type linestring_iterator; + >::type; template @@ -439,10 +439,10 @@ public: { BOOST_GEOMETRY_ASSERT( first != beyond ); - typedef copy_linestrings_in_range + using copy_linestrings = copy_linestrings_in_range < OutputIterator, OverlayType - > copy_linestrings; + >; linestring_iterator ls_first = boost::begin(multilinestring); linestring_iterator ls_beyond = boost::end(multilinestring); @@ -464,7 +464,7 @@ public: per_ls_next = std::find_if(per_ls_current, beyond, has_other_multi_id(current_multi_id)); - oit = Base::apply(*(ls_first + current_multi_id), + oit = base_t::apply(*(ls_first + current_multi_id), linear, per_ls_current, per_ls_next, oit, strategy); signed_size_type next_multi_id = -1; @@ -499,7 +499,7 @@ template overlay_type OverlayType, bool FollowIsolatedPoints, bool FollowContinueTurns, - typename TagIn1 = typename tag::type + typename TagIn1 = tag_t > struct follow : not_implemented diff --git a/include/boost/geometry/algorithms/detail/overlay/get_clusters.hpp b/include/boost/geometry/algorithms/detail/overlay/get_clusters.hpp index 783acc847..3a859c4f0 100644 --- a/include/boost/geometry/algorithms/detail/overlay/get_clusters.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/get_clusters.hpp @@ -40,7 +40,7 @@ public: template static inline bool equals(P const& p1, P const& p2) { - using coor_t = typename coordinate_type

::type; + using coor_t = coordinate_type_t

; static auto const tolerance = common_approximately_equals_epsilon_multiplier::value(); return approximately_equals(p1, p2, tolerance); @@ -101,7 +101,7 @@ inline void get_clusters(Turns& turns, Clusters& clusters) sweep_equal_policy < - std::is_integral::type>::value + std::is_integral>::value > equal_policy; std::vector> points; diff --git a/include/boost/geometry/algorithms/detail/overlay/get_intersection_points.hpp b/include/boost/geometry/algorithms/detail/overlay/get_intersection_points.hpp index 9085387c1..a2b3058f1 100644 --- a/include/boost/geometry/algorithms/detail/overlay/get_intersection_points.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/get_intersection_points.hpp @@ -55,12 +55,12 @@ struct get_turn_without_info Strategy const& strategy, OutputIterator out) { - typedef typename TurnInfo::point_type turn_point_type; + using turn_point_type = typename TurnInfo::point_type; - typedef policies::relate::segments_intersection_points + using policy_type = policies::relate::segments_intersection_points < segment_intersection_points - > policy_type; + >; typename policy_type::return_type const result = strategy.relate().apply(range_p, range_q, policy_type()); @@ -96,12 +96,12 @@ inline void get_intersection_points(Geometry1 const& geometry1, { concepts::check_concepts_and_equal_dimensions(); - typedef detail::get_intersection_points::get_turn_without_info - < - point_type_t, - point_type_t, - typename boost::range_value::type - > TurnPolicy; + using turn_policy_t = detail::get_intersection_points::get_turn_without_info + < + point_type_t, + point_type_t, + typename boost::range_value::type + >; detail::get_turns::no_interrupt_policy interrupt_policy; @@ -110,19 +110,19 @@ inline void get_intersection_points(Geometry1 const& geometry1, reverse_dispatch::type::value, dispatch::get_turns_reversed < - typename tag::type, - typename tag::type, + tag_t, + tag_t, Geometry1, Geometry2, false, false, - TurnPolicy + turn_policy_t >, dispatch::get_turns < - typename tag::type, - typename tag::type, + tag_t, + tag_t, Geometry1, Geometry2, false, false, - TurnPolicy + turn_policy_t > >::apply(0, geometry1, 1, geometry2, diff --git a/include/boost/geometry/algorithms/detail/overlay/get_ring.hpp b/include/boost/geometry/algorithms/detail/overlay/get_ring.hpp index f93cb23f5..7943238fd 100644 --- a/include/boost/geometry/algorithms/detail/overlay/get_ring.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/get_ring.hpp @@ -83,7 +83,7 @@ template<> struct get_ring { template - static inline typename ring_return_type::type const apply( + static inline ring_return_type_t const apply( ring_identifier const& id, Polygon const& polygon) { @@ -103,7 +103,7 @@ template<> struct get_ring { template - static inline typename ring_type::type const& apply( + static inline ring_type_t const& apply( ring_identifier const& id, MultiPolygon const& multi_polygon) { @@ -122,7 +122,7 @@ template inline signed_size_type segment_count_on_ring(Geometry const& geometry, ring_identifier const& ring_id) { - using tag = typename geometry::tag::type; + using tag = geometry::tag_t; // A closed polygon, a triangle of 4 points, including starting point, // contains 3 segments. So handle as if it is closed, and subtract one. diff --git a/include/boost/geometry/algorithms/detail/overlay/get_turn_info.hpp b/include/boost/geometry/algorithms/detail/overlay/get_turn_info.hpp index e61ad7286..7795f41e4 100644 --- a/include/boost/geometry/algorithms/detail/overlay/get_turn_info.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/get_turn_info.hpp @@ -216,7 +216,7 @@ struct turn_info_verification_functions BOOST_GEOMETRY_ASSERT(index_p > 0 && index_p <= 2); BOOST_GEOMETRY_ASSERT(index_q > 0 && index_q <= 2); - using distance_measure_result_type = typename geometry::coordinate_type::type; + using distance_measure_result_type = geometry::coordinate_type_t; bool const p_in_range = index_p < range_p.size(); bool const q_in_range = index_q < range_q.size(); @@ -1424,12 +1424,12 @@ struct get_turn_info UmbrellaStrategy const& umbrella_strategy, OutputIterator out) { - typedef intersection_info + using inters_info = intersection_info < UniqueSubRange1, UniqueSubRange2, typename TurnInfo::point_type, UmbrellaStrategy - > inters_info; + >; inters_info inters(range_p, range_q, umbrella_strategy); diff --git a/include/boost/geometry/algorithms/detail/overlay/get_turn_info_for_endpoint.hpp b/include/boost/geometry/algorithms/detail/overlay/get_turn_info_for_endpoint.hpp index 229277abe..59602625e 100644 --- a/include/boost/geometry/algorithms/detail/overlay/get_turn_info_for_endpoint.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/get_turn_info_for_endpoint.hpp @@ -231,7 +231,7 @@ private: template struct get_turn_info_for_endpoint { - typedef std::pair operations_pair; + using operations_pair = std::pair; BOOST_STATIC_ASSERT(EnableFirst || EnableLast); diff --git a/include/boost/geometry/algorithms/detail/overlay/get_turn_info_helpers.hpp b/include/boost/geometry/algorithms/detail/overlay/get_turn_info_helpers.hpp index 12db5ac8e..3b3c03ae6 100644 --- a/include/boost/geometry/algorithms/detail/overlay/get_turn_info_helpers.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/get_turn_info_helpers.hpp @@ -48,7 +48,7 @@ template > struct side_calculator { - typedef decltype(std::declval().side()) side_strategy_type; + using side_strategy_type = decltype(std::declval().side()); inline side_calculator(UniqueSubRange1 const& range_p, UniqueSubRange2 const& range_q, @@ -98,23 +98,23 @@ class intersection_info_base { public: - typedef segment_intersection_points intersection_point_type; - typedef policies::relate::segments_intersection_policy + using intersection_point_type = segment_intersection_points; + using intersection_policy_type = policies::relate::segments_intersection_policy < intersection_point_type - > intersection_policy_type; + >; - typedef typename intersection_policy_type::return_type result_type; + using result_type = typename intersection_policy_type::return_type; - typedef side_calculator + using side_calculator_type = side_calculator < UniqueSubRange1, UniqueSubRange2, UmbrellaStrategy - > side_calculator_type; + >; - typedef side_calculator + using swapped_side_calculator_type = side_calculator < UniqueSubRange2, UniqueSubRange1, UmbrellaStrategy - > swapped_side_calculator_type; + >; intersection_info_base(UniqueSubRange1 const& range_p, UniqueSubRange2 const& range_q, @@ -168,18 +168,18 @@ class intersection_info : public intersection_info_base { - typedef intersection_info_base base; + using base = intersection_info_base; public: - typedef typename UmbrellaStrategy::cs_tag cs_tag; + using cs_tag = typename UmbrellaStrategy::cs_tag; - typedef typename base::side_calculator_type side_calculator_type; - typedef typename base::result_type result_type; + using side_calculator_type = typename base::side_calculator_type; + using result_type = typename base::result_type; - typedef typename result_type::intersection_points_type i_info_type; - typedef typename result_type::direction_type d_info_type; + using i_info_type = typename result_type::intersection_points_type; + using d_info_type = typename result_type::direction_type; intersection_info(UniqueSubRange1 const& range_p, UniqueSubRange2 const& range_q, diff --git a/include/boost/geometry/algorithms/detail/overlay/get_turn_info_la.hpp b/include/boost/geometry/algorithms/detail/overlay/get_turn_info_la.hpp index 95e6ed669..15ce805b7 100644 --- a/include/boost/geometry/algorithms/detail/overlay/get_turn_info_la.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/get_turn_info_la.hpp @@ -54,12 +54,12 @@ struct get_turn_info_linear_areal UmbrellaStrategy const& umbrella_strategy, OutputIterator out) { - typedef intersection_info + using inters_info = intersection_info < UniqueSubRange1, UniqueSubRange2, typename TurnInfo::point_type, UmbrellaStrategy - > inters_info; + >; inters_info inters(range_p, range_q, umbrella_strategy); @@ -702,7 +702,7 @@ struct get_turn_info_linear_areal Strategy const& strategy) { namespace ov = overlay; - typedef ov::get_turn_info_for_endpoint get_info_e; + using get_info_e = ov::get_turn_info_for_endpoint; std::size_t const ip_count = inters.i_info().count; // no intersection points diff --git a/include/boost/geometry/algorithms/detail/overlay/get_turn_info_ll.hpp b/include/boost/geometry/algorithms/detail/overlay/get_turn_info_ll.hpp index 00349f29c..0831340d8 100644 --- a/include/boost/geometry/algorithms/detail/overlay/get_turn_info_ll.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/get_turn_info_ll.hpp @@ -49,12 +49,12 @@ struct get_turn_info_linear_linear UmbrellaStrategy const& umbrella_strategy, OutputIterator out) { - typedef intersection_info + using inters_info = intersection_info < UniqueSubRange1, UniqueSubRange2, typename TurnInfo::point_type, UmbrellaStrategy - > inters_info; + >; inters_info inters(range_p, range_q, umbrella_strategy); diff --git a/include/boost/geometry/algorithms/detail/overlay/get_turns.hpp b/include/boost/geometry/algorithms/detail/overlay/get_turns.hpp index b8cb1ea01..0e452280b 100644 --- a/include/boost/geometry/algorithms/detail/overlay/get_turns.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/get_turns.hpp @@ -200,13 +200,13 @@ class get_turns_in_sections { using range1_view = detail::closed_clockwise_view < - typename ring_type::type const, + ring_type_t const, geometry::closure::value, Reverse1 ? counterclockwise : clockwise >; using range2_view = detail::closed_clockwise_view < - typename ring_type::type const, + ring_type_t const, geometry::closure::value, Reverse2 ? counterclockwise : clockwise >; @@ -357,7 +357,7 @@ public : *prev2, *it2, strategy); - typedef typename boost::range_value::type turn_info; + using turn_info = typename boost::range_value::type; turn_info ti; ti.operations[0].seg_id @@ -390,8 +390,8 @@ public : private : - typedef typename geometry::point_type::type point1_type; - typedef typename geometry::point_type::type point2_type; + using point1_type = geometry::point_type_t; + using point2_type = geometry::point_type_t; // It is NOT possible to have section-iterators here // because of the logistics of "index" (the section-iterator automatically @@ -496,14 +496,14 @@ public: InterruptPolicy& interrupt_policy) { // First create monotonic sections... - typedef typename boost::range_value::type ip_type; - typedef typename ip_type::point_type point_type; + using ip_type = typename boost::range_value::type; + using point_type = typename ip_type::point_type; - typedef model::box box_type; - typedef geometry::sections sections_type; + using box_type = model::box; + using sections_type = geometry::sections; sections_type sec1, sec2; - typedef std::integer_sequence dimensions; + using dimensions = std::integer_sequence; geometry::sectionalize(geometry1, sec1, strategy, 0); @@ -540,9 +540,9 @@ template > struct get_turns_cs { - typedef typename geometry::point_type::type range_point_type; - typedef typename geometry::point_type::type box_point_type; - typedef std::array box_array; + using range_point_type = geometry::point_type_t; + using box_point_type = geometry::point_type_t; + using box_array = std::array; using view_type = detail::closed_clockwise_view < @@ -555,7 +555,7 @@ struct get_turns_cs struct unique_sub_range_from_box_policy { - typedef box_point_type point_type; + using point_type = box_point_type; unique_sub_range_from_box_policy(box_array const& box) : m_box(box) @@ -584,7 +584,7 @@ struct get_turns_cs struct unique_sub_range_from_view_policy { - typedef range_point_type point_type; + using point_type = range_point_type; unique_sub_range_from_view_policy(view_type const& view, point_type const& pi, point_type const& pj, iterator_type it) : m_view(view) @@ -684,7 +684,7 @@ private: // Depending on code some relations can be left out - typedef typename boost::range_value::type turn_info; + using turn_info = typename boost::range_value::type; turn_info ti; ti.operations[0].seg_id = seg_id; @@ -740,14 +740,12 @@ struct get_turns_polygon_cs InterruptPolicy& interrupt_policy, signed_size_type multi_index = -1) { - typedef typename geometry::ring_type::type ring_type; - - typedef detail::get_turns::get_turns_cs + using intersector_type = detail::get_turns::get_turns_cs < - ring_type, Box, + geometry::ring_type_t, Box, Reverse, ReverseBox, TurnPolicy - > intersector_type; + >; intersector_type::apply( source_id1, geometry::exterior_ring(polygon), @@ -815,9 +813,15 @@ struct topological_tag_base using type = tag_cast_t, pointlike_tag, linear_tag, areal_tag>; }; -template ::type, typename Tag2 = typename tag::type, - typename TagBase1 = typename topological_tag_base::type, typename TagBase2 = typename topological_tag_base::type> +template +< + typename Geometry1, typename Geometry2, + typename AssignPolicy, + typename Tag1 = tag_t, + typename Tag2 = tag_t, + typename TagBase1 = typename topological_tag_base::type, + typename TagBase2 = typename topological_tag_base::type +> struct get_turn_info_type : overlay::get_turn_info {}; @@ -833,8 +837,9 @@ struct get_turn_info_type::type, typename Tag2 = typename tag::type, - typename TagBase1 = typename topological_tag_base::type, typename TagBase2 = typename topological_tag_base::type> + typename Tag1 = tag_t, typename Tag2 = tag_t, + typename TagBase1 = typename topological_tag_base::type, + typename TagBase2 = typename topological_tag_base::type> struct turn_operation_type { using type = overlay::turn_operation; @@ -1009,27 +1014,29 @@ inline void get_turns(Geometry1 const& geometry1, { concepts::check_concepts_and_equal_dimensions(); - typedef detail::overlay::get_turn_info TurnPolicy; - //typedef detail::get_turns::get_turn_info_type TurnPolicy; + using turn_policy_t = detail::overlay::get_turn_info; + // Using get_turn_info_type would be more generic. But that is currently not compiling, + // because it misses the is_collinear field as used later in the algorithm. + // using turn_policy_t = detail::get_turns::get_turn_info_type; std::conditional_t < reverse_dispatch::type::value, dispatch::get_turns_reversed < - typename tag::type, - typename tag::type, + tag_t, + tag_t, Geometry1, Geometry2, Reverse1, Reverse2, - TurnPolicy + turn_policy_t >, dispatch::get_turns < - typename tag::type, - typename tag::type, + tag_t, + tag_t, Geometry1, Geometry2, Reverse1, Reverse2, - TurnPolicy + turn_policy_t > >::apply(0, geometry1, 1, geometry2, diff --git a/include/boost/geometry/algorithms/detail/overlay/handle_colocations.hpp b/include/boost/geometry/algorithms/detail/overlay/handle_colocations.hpp index fa5f52c59..80c15e36e 100644 --- a/include/boost/geometry/algorithms/detail/overlay/handle_colocations.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/handle_colocations.hpp @@ -260,7 +260,7 @@ template inline void check_colocation(bool& has_blocked, signed_size_type cluster_id, Turns const& turns, Clusters const& clusters) { - typedef typename boost::range_value::type turn_type; + using turn_type = typename boost::range_value::type; has_blocked = false; @@ -364,23 +364,6 @@ inline bool handle_colocations(Turns& turns, Clusters& clusters) return true; } - -struct is_turn_index -{ - is_turn_index(signed_size_type index) - : m_index(index) - {} - - template - inline bool operator()(Indexed const& indexed) const - { - // Indexed is a indexed_turn_operation - return indexed.turn_index == m_index; - } - - signed_size_type m_index; -}; - template < typename Sbs, @@ -431,16 +414,15 @@ inline void gather_cluster_properties(Clusters& clusters, Turns& turns, Geometry1 const& geometry1, Geometry2 const& geometry2, Strategy const& strategy) { - typedef typename boost::range_value::type turn_type; - typedef typename turn_type::point_type point_type; - typedef typename turn_type::turn_operation_type turn_operation_type; + using turn_type = typename boost::range_value::type; + using point_type = typename turn_type::point_type; + using turn_operation_type = typename turn_type::turn_operation_type; - // Define sorter, sorting counter-clockwise such that polygons are on the - // right side - typedef sort_by_side::side_sorter + // Define sorter, sorting counter-clockwise such that polygons are on the right side + using sbs_type = sort_by_side::side_sorter < Reverse1, Reverse2, OverlayType, point_type, Strategy, std::less - > sbs_type; + >; for (auto& pair : clusters) { diff --git a/include/boost/geometry/algorithms/detail/overlay/intersection_insert.hpp b/include/boost/geometry/algorithms/detail/overlay/intersection_insert.hpp index 1dbd717ae..35c919255 100644 --- a/include/boost/geometry/algorithms/detail/overlay/intersection_insert.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/intersection_insert.hpp @@ -117,7 +117,7 @@ struct intersection_linestring_linestring_point OutputIterator out, Strategy const& strategy) { - typedef detail::overlay::turn_info turn_info; + using turn_info = detail::overlay::turn_info; std::deque turns; geometry::get_intersection_points(linestring1, linestring2, @@ -269,7 +269,7 @@ struct intersection_of_linestring_with_areal return out; } - typedef detail::overlay::follow + using follower = detail::overlay::follow < GeometryOut, LineString, @@ -277,21 +277,21 @@ struct intersection_of_linestring_with_areal OverlayType, false, // do not remove spikes for linear geometries FollowIsolatedPoints - > follower; + >; - typedef typename geometry::detail::output_geometry_access + using linear = typename geometry::detail::output_geometry_access < GeometryOut, linestring_tag, linestring_tag - > linear; + >; using point_type = point_type_t; - typedef geometry::segment_ratio + using ratio_type = geometry::segment_ratio < - typename coordinate_type::type - > ratio_type; + coordinate_type_t + >; - typedef detail::overlay::turn_info + using turn_info = detail::overlay::turn_info < point_type, ratio_type, @@ -300,21 +300,21 @@ struct intersection_of_linestring_with_areal point_type, ratio_type > - > turn_info; + >; std::deque turns; detail::get_turns::no_interrupt_policy policy; - typedef detail::overlay::get_turn_info_linear_areal + using turn_policy = detail::overlay::get_turn_info_linear_areal < detail::overlay::assign_null_policy - > turn_policy; + >; dispatch::get_turns < - typename geometry::tag::type, - typename geometry::tag::type, + geometry::tag_t, + geometry::tag_t, LineString, Areal, false, @@ -387,11 +387,11 @@ struct intersection_areal_areal_point OutputIterator out, Strategy const& strategy) { - typedef detail::overlay::turn_info + using turn_info = detail::overlay::turn_info < PointOut, typename segment_ratio_type::type - > turn_info; + >; std::vector turns; detail::get_turns::no_interrupt_policy policy; @@ -419,9 +419,9 @@ struct intersection_linear_areal_point OutputIterator out, Strategy const& strategy) { - typedef geometry::segment_ratio::type> ratio_type; + using ratio_type = geometry::segment_ratio>; - typedef detail::overlay::turn_info + using turn_info = detail::overlay::turn_info < PointOut, ratio_type, @@ -430,12 +430,12 @@ struct intersection_linear_areal_point PointOut, ratio_type > - > turn_info; + >; - typedef detail::overlay::get_turn_info_linear_areal + using turn_policy = detail::overlay::get_turn_info_linear_areal < detail::overlay::assign_null_policy - > turn_policy; + >; std::vector turns; @@ -443,8 +443,8 @@ struct intersection_linear_areal_point dispatch::get_turns < - typename geometry::tag::type, - typename geometry::tag::type, + geometry::tag_t, + geometry::tag_t, Geometry1, Geometry2, false, @@ -1463,10 +1463,10 @@ inline OutputIterator intersection_insert(Geometry1 const& geometry1, concepts::check(); concepts::check(); - typedef typename strategies::relate::services::default_strategy + using strategy_type = typename strategies::relate::services::default_strategy < Geometry1, Geometry2 - >::type strategy_type; + >::type; return intersection_insert(geometry1, geometry2, out, strategy_type()); diff --git a/include/boost/geometry/algorithms/detail/overlay/less_by_segment_ratio.hpp b/include/boost/geometry/algorithms/detail/overlay/less_by_segment_ratio.hpp index 140c6aaf0..6f595d332 100644 --- a/include/boost/geometry/algorithms/detail/overlay/less_by_segment_ratio.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/less_by_segment_ratio.hpp @@ -39,11 +39,10 @@ namespace detail { namespace overlay template struct indexed_turn_operation { - typedef TurnOperation type; + using type = TurnOperation; std::size_t turn_index; std::size_t operation_index; - bool skip; // use pointers to avoid copies, const& is not possible because of usage in vector segment_identifier const* other_seg_id; // segment id of other segment of intersection of two segments TurnOperation const* subject; @@ -53,7 +52,6 @@ struct indexed_turn_operation segment_identifier const& oid) : turn_index(ti) , operation_index(oi) - , skip(false) , other_seg_id(&oid) , subject(boost::addressof(sub)) {} @@ -88,7 +86,7 @@ private : Geometry2 const& m_geometry2; Strategy const& m_strategy; - typedef typename geometry::point_type::type point_type; + using point_type = geometry::point_type_t; inline bool default_order(Indexed const& left, Indexed const& right) const { diff --git a/include/boost/geometry/algorithms/detail/overlay/linear_linear.hpp b/include/boost/geometry/algorithms/detail/overlay/linear_linear.hpp index 75ff47432..fd69ee32f 100644 --- a/include/boost/geometry/algorithms/detail/overlay/linear_linear.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/linear_linear.hpp @@ -227,7 +227,7 @@ public: OutputIterator oit, Strategy const& strategy) { - typedef typename detail::relate::turns::get_turns + using turn_info = typename detail::relate::turns::get_turns < Linear1, Linear2, @@ -237,9 +237,9 @@ public: Linear2, assign_policy > - >::template turn_info_type::type turn_info; + >::template turn_info_type::type; - typedef std::vector turns_container; + using turns_container = std::vector; turns_container turns; compute_turns(turns, linear1, linear2, strategy); @@ -252,7 +252,7 @@ public: LinestringOut, OverlayType, Linear1, - typename tag::type + tag_t >::apply(linear1, oit); } @@ -299,7 +299,7 @@ struct linear_linear_linestring LinestringOut, overlay_difference, Linear1, - typename tag::type + tag_t >::apply(linear1, oit); return linear_linear_linestring diff --git a/include/boost/geometry/algorithms/detail/overlay/needs_self_turns.hpp b/include/boost/geometry/algorithms/detail/overlay/needs_self_turns.hpp index 85a6f9604..7adf41903 100644 --- a/include/boost/geometry/algorithms/detail/overlay/needs_self_turns.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/needs_self_turns.hpp @@ -31,7 +31,7 @@ namespace detail { namespace overlay template < typename Geometry, - typename Tag = typename tag::type + typename Tag = tag_t > struct needs_self_turns { @@ -69,7 +69,7 @@ struct needs_self_turns { static inline bool apply(Geometry const& multi) { - typedef typename boost::range_value::type polygon_type; + using polygon_type = typename boost::range_value::type; std::size_t const n = boost::size(multi); return n > 1 || (n == 1 && needs_self_turns diff --git a/include/boost/geometry/algorithms/detail/overlay/overlay.hpp b/include/boost/geometry/algorithms/detail/overlay/overlay.hpp index 6ce28be73..04a95f134 100644 --- a/include/boost/geometry/algorithms/detail/overlay/overlay.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/overlay.hpp @@ -60,14 +60,6 @@ namespace detail { namespace overlay //! Default visitor for overlay, doing nothing struct overlay_null_visitor { - void print(char const* ) {} - - template - void print(char const* , Turns const& , int) {} - - template - void print(char const* , Turns const& , int , int ) {} - template void visit_turns(int , Turns const& ) {} @@ -182,14 +174,14 @@ inline OutputIterator return_if_one_input_is_empty(Geometry1 const& geometry1, Geometry2 const& geometry2, OutputIterator out, Strategy const& strategy) { - typedef typename geometry::ring_type::type ring_type; - typedef std::deque ring_container_type; + using ring_type = geometry::ring_type_t; + using ring_container_type = std::deque; - typedef ring_properties + using properties = ring_properties < - typename geometry::point_type::type, + geometry::point_type_t, typename geometry::area_result::type - > properties; + >; // Silence warning C4127: conditional expression is constant #if defined(_MSC_VER) @@ -253,23 +245,25 @@ struct overlay >(geometry1, geometry2, out, strategy); } - typedef typename geometry::point_type::type point_type; - typedef detail::overlay::traversal_turn_info + using point_type = geometry::point_type_t; + using turn_info = detail::overlay::traversal_turn_info < point_type, typename segment_ratio_type::type - > turn_info; - typedef std::deque turn_container_type; + >; + using turn_container_type = std::deque; - typedef typename geometry::ring_type::type ring_type; - typedef std::deque ring_container_type; + using ring_type = geometry::ring_type_t; + using ring_container_type = std::deque; // Define the clusters, mapping cluster_id -> turns - typedef std::map + using cluster_type = std::map < signed_size_type, cluster_info - > cluster_type; + >; + + constexpr operation_type target_operation = operation_from_overlay::value; turn_container_type turns; @@ -303,6 +297,21 @@ struct overlay cluster_type clusters; std::map turn_info_per_ring; + // Handle colocations, gathering clusters and (below) their properties. + detail::overlay::handle_colocations + < + Reverse1, Reverse2, OverlayType, Geometry1, Geometry2 + >(turns, clusters); + + // Gather cluster properties (using even clusters with + // discarded turns - for open turns) + detail::overlay::gather_cluster_properties + < + Reverse1, + Reverse2, + OverlayType + >(clusters, turns, target_operation, geometry1, geometry2, strategy); + geometry::enrich_intersection_points( turns, clusters, geometry1, geometry2, strategy); @@ -327,11 +336,11 @@ struct overlay get_ring_turn_info(turn_info_per_ring, turns, clusters); - typedef ring_properties + using properties = ring_properties < point_type, typename geometry::area_result::type - > properties; + >; // Select all rings which are NOT touched by any intersection point std::map selected_ring_properties; diff --git a/include/boost/geometry/algorithms/detail/overlay/pointlike_areal.hpp b/include/boost/geometry/algorithms/detail/overlay/pointlike_areal.hpp index 5cfbae09b..497bc6651 100644 --- a/include/boost/geometry/algorithms/detail/overlay/pointlike_areal.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/pointlike_areal.hpp @@ -183,14 +183,14 @@ private: { item_visitor_type item_visitor(multipolygon, oit, strategy); - typedef geometry::model::point + using point_type = geometry::model::point < - typename geometry::coordinate_type::type, + geometry::coordinate_type_t, geometry::dimension::value, - typename geometry::coordinate_system::type - > point_type; - typedef geometry::model::box box_type; - typedef std::pair box_pair; + geometry::coordinate_system_t + >; + using box_type = geometry::model::box; + using box_pair = std::pair; std::vector box_pairs; box_pairs.reserve(boost::size(multipolygon)); @@ -217,10 +217,10 @@ public: OutputIterator oit, Strategy const& strategy) { - typedef std::vector + using point_vector_type = std::vector < typename boost::range_value::type - > point_vector_type; + >; point_vector_type common_points; diff --git a/include/boost/geometry/algorithms/detail/overlay/pointlike_linear.hpp b/include/boost/geometry/algorithms/detail/overlay/pointlike_linear.hpp index bfb4880a1..c6a3cb58f 100644 --- a/include/boost/geometry/algorithms/detail/overlay/pointlike_linear.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/pointlike_linear.hpp @@ -217,8 +217,8 @@ private: class segment_range { public: - typedef geometry::segment_iterator const_iterator; - typedef const_iterator iterator; + using const_iterator = geometry::segment_iterator; + using iterator = const_iterator; explicit segment_range(Linear const& linear) : m_linear(linear) @@ -273,10 +273,10 @@ public: OutputIterator oit, Strategy const& strategy) { - typedef std::vector + using point_vector_type = std::vector < typename boost::range_value::type - > point_vector_type; + >; point_vector_type common_points; diff --git a/include/boost/geometry/algorithms/detail/overlay/pointlike_pointlike.hpp b/include/boost/geometry/algorithms/detail/overlay/pointlike_pointlike.hpp index 1745bcf43..a0c0ab03c 100644 --- a/include/boost/geometry/algorithms/detail/overlay/pointlike_pointlike.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/pointlike_pointlike.hpp @@ -53,7 +53,7 @@ template < typename PointOut, typename GeometryIn, - typename TagIn = typename tag::type + typename TagIn = tag_t > struct copy_points : not_implemented @@ -221,7 +221,7 @@ struct point_multipoint_point OutputIterator oit, Strategy const& strategy) { - typedef action_selector_pl action; + using action = action_selector_pl; for (auto it = boost::begin(multipoint); it != boost::end(multipoint); ++it) { @@ -255,7 +255,7 @@ struct multipoint_multipoint_point OutputIterator oit, Strategy const& strategy) { - typedef geometry::less less_type; + using less_type = geometry::less; if BOOST_GEOMETRY_CONSTEXPR (OverlayType != overlay_difference) { @@ -268,7 +268,7 @@ struct multipoint_multipoint_point } } - typedef typename boost::range_value::type point2_type; + using point2_type = typename boost::range_value::type; std::vector points2(boost::begin(multipoint2), boost::end(multipoint2)); @@ -421,8 +421,8 @@ struct union_pointlike_pointlike_point return detail_dispatch::overlay::pointlike_pointlike_point < PointLike2, PointLike1, PointOut, overlay_difference, - typename tag::type, - typename tag::type + tag_t, + tag_t >::apply(pointlike2, pointlike1, oit, strategy); } diff --git a/include/boost/geometry/algorithms/detail/overlay/range_in_geometry.hpp b/include/boost/geometry/algorithms/detail/overlay/range_in_geometry.hpp index 4fd69411d..76f7ac2bf 100644 --- a/include/boost/geometry/algorithms/detail/overlay/range_in_geometry.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/range_in_geometry.hpp @@ -29,11 +29,11 @@ namespace detail { namespace overlay template < typename Geometry, - typename Tag = typename geometry::tag::type + typename Tag = geometry::tag_t > struct points_range { - typedef geometry::point_iterator iterator_type; + using iterator_type = geometry::point_iterator; explicit points_range(Geometry const& geometry) : m_geometry(geometry) @@ -55,8 +55,8 @@ struct points_range template struct points_range { - typedef typename geometry::point_type::type point_type; - typedef const point_type * iterator_type; + using point_type = geometry::point_type_t; + using iterator_type = const point_type *; explicit points_range(Box const& box) { @@ -80,7 +80,7 @@ struct points_range template < typename Geometry, - typename Tag = typename geometry::tag::type + typename Tag = geometry::tag_t > struct point_in_geometry_helper { @@ -113,7 +113,7 @@ static inline int range_in_geometry(Geometry1 const& geometry1, { int result = 0; points_range points(geometry1); - typedef typename points_range::iterator_type iterator_type; + using iterator_type = typename points_range::iterator_type; iterator_type const end = points.end(); iterator_type it = points.begin(); if (it == end) diff --git a/include/boost/geometry/algorithms/detail/overlay/ring_properties.hpp b/include/boost/geometry/algorithms/detail/overlay/ring_properties.hpp index 4039891f7..f3f09e3ed 100644 --- a/include/boost/geometry/algorithms/detail/overlay/ring_properties.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/ring_properties.hpp @@ -30,8 +30,8 @@ namespace detail { namespace overlay template struct ring_properties { - typedef Point point_type; - typedef AreaType area_type; + using point_type = Point; + using area_type = AreaType; bool valid; diff --git a/include/boost/geometry/algorithms/detail/overlay/segment_as_subrange.hpp b/include/boost/geometry/algorithms/detail/overlay/segment_as_subrange.hpp index 610d2e13e..98b44ed22 100644 --- a/include/boost/geometry/algorithms/detail/overlay/segment_as_subrange.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/segment_as_subrange.hpp @@ -34,7 +34,7 @@ struct segment_as_subrange geometry::set<1>(m_p2, geometry::get<1, 1>(m_segment)); } - typedef typename geometry::point_type::type point_type; + using point_type = geometry::point_type_t; point_type const& at(std::size_t index) const { diff --git a/include/boost/geometry/algorithms/detail/overlay/select_rings.hpp b/include/boost/geometry/algorithms/detail/overlay/select_rings.hpp index 58371606e..ab5a37e12 100644 --- a/include/boost/geometry/algorithms/detail/overlay/select_rings.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/select_rings.hpp @@ -113,8 +113,7 @@ namespace dispatch ring_identifier id, RingPropertyMap& ring_properties, Strategy const& strategy) { - typedef typename geometry::ring_type::type ring_type; - typedef select_rings per_ring; + using per_ring = select_rings>; per_ring::apply(exterior_ring(polygon), geometry, id, ring_properties, strategy); @@ -131,8 +130,7 @@ namespace dispatch ring_identifier id, RingPropertyMap& ring_properties, Strategy const& strategy) { - typedef typename geometry::ring_type::type ring_type; - typedef select_rings per_ring; + using per_ring = select_rings>; per_ring::apply(exterior_ring(polygon), id, ring_properties, strategy); @@ -153,7 +151,7 @@ namespace dispatch ring_identifier id, RingPropertyMap& ring_properties, Strategy const& strategy) { - typedef select_rings::type> per_polygon; + using per_polygon = select_rings::type>; id.multi_index = 0; for (auto it = boost::begin(multi); it != boost::end(multi); ++it) @@ -307,8 +305,8 @@ inline void select_rings(Geometry1 const& geometry1, Geometry2 const& geometry2, RingPropertyMap& selected_ring_properties, Strategy const& strategy) { - typedef typename geometry::tag::type tag1; - typedef typename geometry::tag::type tag2; + using tag1 = geometry::tag_t; + using tag2 = geometry::tag_t; RingPropertyMap all_ring_properties; dispatch::select_rings::apply(geometry1, geometry2, @@ -336,10 +334,8 @@ inline void select_rings(Geometry const& geometry, RingPropertyMap& selected_ring_properties, Strategy const& strategy) { - typedef typename geometry::tag::type tag; - RingPropertyMap all_ring_properties; - dispatch::select_rings::apply(geometry, + dispatch::select_rings, Geometry>::apply(geometry, ring_identifier(0, -1, -1), all_ring_properties, strategy); diff --git a/include/boost/geometry/algorithms/detail/overlay/self_turn_points.hpp b/include/boost/geometry/algorithms/detail/overlay/self_turn_points.hpp index 49c4357c2..072f49554 100644 --- a/include/boost/geometry/algorithms/detail/overlay/self_turn_points.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/self_turn_points.hpp @@ -131,13 +131,13 @@ struct get_turns InterruptPolicy& interrupt_policy, int source_index, bool skip_adjacent) { - typedef model::box::type> box_type; + using box_type = model::box>; // sectionalize in two dimensions to detect // all potential spikes correctly - typedef geometry::sections sections_type; + using sections_type = geometry::sections; - typedef std::integer_sequence dimensions; + using dimensions = std::integer_sequence; sections_type sec; geometry::sectionalize(geometry, @@ -288,7 +288,7 @@ struct self_get_turn_points dispatch::self_get_turn_points < Reverse, - typename tag::type, + tag_t, Geometry, turn_policy >::apply(geometry, strategies, turns, interrupt_policy, diff --git a/include/boost/geometry/algorithms/detail/overlay/sort_by_side.hpp b/include/boost/geometry/algorithms/detail/overlay/sort_by_side.hpp index 14f32beed..5148fa2e4 100644 --- a/include/boost/geometry/algorithms/detail/overlay/sort_by_side.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/sort_by_side.hpp @@ -322,7 +322,7 @@ public : // Use the coordinate type, but if it is too small (e.g. std::int16), use a double using ct_type = typename geometry::select_most_precise < - typename geometry::coordinate_type::type, + geometry::coordinate_type_t, double >::type; diff --git a/include/boost/geometry/algorithms/detail/overlay/traversal.hpp b/include/boost/geometry/algorithms/detail/overlay/traversal.hpp index e30668882..3b92c6f04 100644 --- a/include/boost/geometry/algorithms/detail/overlay/traversal.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/traversal.hpp @@ -23,6 +23,7 @@ #include #include +#include #include #include #include @@ -44,36 +45,6 @@ namespace boost { namespace geometry namespace detail { namespace overlay { -template -#ifdef BOOST_GEOMETRY_DEBUG_TRAVERSE -inline void debug_traverse(Turn const& turn, Operation op, - std::string const& header, bool condition = true) -{ - if (! condition) - { - return; - } - std::cout << " " << header - << " at " << op.seg_id - << " meth: " << method_char(turn.method) - << " op: " << operation_char(op.operation) - << " vis: " << visited_char(op.visited) - << " of: " << operation_char(turn.operations[0].operation) - << operation_char(turn.operations[1].operation) - << " " << geometry::wkt(turn.point) - << std::endl; - - if (boost::contains(header, "Finished")) - { - std::cout << std::endl; - } -} -#else -inline void debug_traverse(Turn const& , Operation, const char*, bool = true) -{ -} -#endif - template < bool Reverse1, @@ -92,16 +63,16 @@ private : static const operation_type target_operation = operation_from_overlay::value; - typedef typename sort_by_side::side_compare::type side_compare_type; - typedef typename boost::range_value::type turn_type; - typedef typename turn_type::turn_operation_type turn_operation_type; + using side_compare_type = typename sort_by_side::side_compare::type; + using turn_type = typename boost::range_value::type; + using turn_operation_type = typename turn_type::turn_operation_type; - typedef typename geometry::point_type::type point_type; - typedef sort_by_side::side_sorter + using point_type = geometry::point_type_t; + using sbs_type = sort_by_side::side_sorter < Reverse1, Reverse2, OverlayType, point_type, Strategy, side_compare_type - > sbs_type; + >; public : inline traversal(Geometry1 const& geometry1, Geometry2 const& geometry2, diff --git a/include/boost/geometry/algorithms/detail/overlay/traversal_ring_creator.hpp b/include/boost/geometry/algorithms/detail/overlay/traversal_ring_creator.hpp index 89d44b5b2..e59c9adea 100644 --- a/include/boost/geometry/algorithms/detail/overlay/traversal_ring_creator.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/traversal_ring_creator.hpp @@ -51,16 +51,16 @@ template > struct traversal_ring_creator { - typedef traversal + using traversal_type = traversal < Reverse1, Reverse2, OverlayType, Geometry1, Geometry2, Turns, Clusters, Strategy, Visitor - > traversal_type; + >; - typedef typename boost::range_value::type turn_type; - typedef typename turn_type::turn_operation_type turn_operation_type; + using turn_type = typename boost::range_value::type; + using turn_operation_type = typename turn_type::turn_operation_type; static const operation_type target_operation = operation_from_overlay::value; @@ -254,7 +254,7 @@ struct traversal_ring_creator Rings& rings, std::size_t& finalized_ring_size, typename Backtrack::state_type& state) { - typedef typename boost::range_value::type ring_type; + using ring_type = typename boost::range_value::type; turn_operation_type const& start_op = start_turn.operations[op_index]; diff --git a/include/boost/geometry/algorithms/detail/overlay/turn_info.hpp b/include/boost/geometry/algorithms/detail/overlay/turn_info.hpp index 8f1d22c8c..f8cbabff4 100644 --- a/include/boost/geometry/algorithms/detail/overlay/turn_info.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/turn_info.hpp @@ -51,13 +51,13 @@ enum method_type template struct turn_operation { - typedef SegmentRatio segment_ratio_type; + using segment_ratio_type = SegmentRatio; operation_type operation; segment_identifier seg_id; - SegmentRatio fraction; + segment_ratio_type fraction; - typedef typename coordinate_type::type comparable_distance_type; + using comparable_distance_type = coordinate_type_t; comparable_distance_type remaining_distance; inline turn_operation() @@ -79,16 +79,16 @@ struct turn_operation template < typename Point, - typename SegmentRatio = geometry::segment_ratio::type>, + typename SegmentRatio = geometry::segment_ratio>, typename Operation = turn_operation, typename Container = std::array > struct turn_info { - typedef Point point_type; - typedef SegmentRatio segment_ratio_type; - typedef Operation turn_operation_type; - typedef Container container_type; + using point_type = Point; + using segment_ratio_type = SegmentRatio; + using turn_operation_type = Operation; + using container_type = Container; Point point; method_type method; diff --git a/include/boost/geometry/algorithms/detail/partition.hpp b/include/boost/geometry/algorithms/detail/partition.hpp index e3c4208e3..cfba85ff7 100644 --- a/include/boost/geometry/algorithms/detail/partition.hpp +++ b/include/boost/geometry/algorithms/detail/partition.hpp @@ -77,7 +77,7 @@ struct include_all_policy template inline void divide_box(Box const& box, Box& lower_box, Box& upper_box) { - using coor_t = typename coordinate_type::type; + using coor_t = coordinate_type_t; // Divide input box into two halves // either left/right (Dimension 0) diff --git a/include/boost/geometry/algorithms/detail/point_is_spike_or_equal.hpp b/include/boost/geometry/algorithms/detail/point_is_spike_or_equal.hpp index 2b86d3c6b..0958fe51d 100644 --- a/include/boost/geometry/algorithms/detail/point_is_spike_or_equal.hpp +++ b/include/boost/geometry/algorithms/detail/point_is_spike_or_equal.hpp @@ -53,7 +53,7 @@ inline bool point_is_spike_or_equal(Point1 const& last_point, // prev | back Point3 const& segment_b, // curr | back - 1 | spike's vertex SideStrategy const& strategy) { - typedef typename SideStrategy::cs_tag cs_tag; + using cs_tag = typename SideStrategy::cs_tag; int const side = strategy.apply(segment_a, segment_b, last_point); if (side == 0) diff --git a/include/boost/geometry/algorithms/detail/point_on_border.hpp b/include/boost/geometry/algorithms/detail/point_on_border.hpp index 8b3a20a16..4bb02da65 100644 --- a/include/boost/geometry/algorithms/detail/point_on_border.hpp +++ b/include/boost/geometry/algorithms/detail/point_on_border.hpp @@ -214,7 +214,7 @@ inline bool point_on_border(Point& point, Geometry const& geometry) return dispatch::point_on_border < - typename tag::type + tag_t >::apply(point, geometry); } diff --git a/include/boost/geometry/algorithms/detail/relate/areal_areal.hpp b/include/boost/geometry/algorithms/detail/relate/areal_areal.hpp index 3a2b30785..3d39a1c65 100644 --- a/include/boost/geometry/algorithms/detail/relate/areal_areal.hpp +++ b/include/boost/geometry/algorithms/detail/relate/areal_areal.hpp @@ -89,7 +89,7 @@ public: return false; } - using point_type = typename geometry::point_type::type; + using point_type = geometry::point_type_t; typename helper_geometry::type pt; bool const ok = geometry::point_on_border(pt, areal); diff --git a/include/boost/geometry/algorithms/detail/relate/boundary_checker.hpp b/include/boost/geometry/algorithms/detail/relate/boundary_checker.hpp index d513ec319..5b66269d3 100644 --- a/include/boost/geometry/algorithms/detail/relate/boundary_checker.hpp +++ b/include/boost/geometry/algorithms/detail/relate/boundary_checker.hpp @@ -42,7 +42,7 @@ template < typename Geometry, typename Strategy, - typename Tag = typename geometry::tag::type + typename Tag = geometry::tag_t > class boundary_checker {}; diff --git a/include/boost/geometry/algorithms/detail/relate/follow_helpers.hpp b/include/boost/geometry/algorithms/detail/relate/follow_helpers.hpp index 7bea32274..0a67642f0 100644 --- a/include/boost/geometry/algorithms/detail/relate/follow_helpers.hpp +++ b/include/boost/geometry/algorithms/detail/relate/follow_helpers.hpp @@ -47,7 +47,7 @@ template < std::size_t OpId, typename Geometry, - typename Tag = typename geometry::tag::type, + typename Tag = geometry::tag_t, bool IsMulti = util::is_multi::value > struct for_each_disjoint_geometry_if diff --git a/include/boost/geometry/algorithms/detail/relate/implementation_gc.hpp b/include/boost/geometry/algorithms/detail/relate/implementation_gc.hpp index f0fa11d2a..d39e8299c 100644 --- a/include/boost/geometry/algorithms/detail/relate/implementation_gc.hpp +++ b/include/boost/geometry/algorithms/detail/relate/implementation_gc.hpp @@ -122,7 +122,7 @@ struct gc_gc typename traits::geometry_types::type, util::is_multi_polygon >::type; - using pt1_t = typename geometry::point_type::type; + using pt1_t = geometry::point_type_t; using mpt1_t = std::conditional_t < std::is_void::value, @@ -158,7 +158,7 @@ struct gc_gc typename traits::geometry_types::type, util::is_multi_polygon >::type; - using pt2_t = typename geometry::point_type::type; + using pt2_t = geometry::point_type_t; using mpt2_t = std::conditional_t < std::is_void::value, diff --git a/include/boost/geometry/algorithms/detail/relate/interface.hpp b/include/boost/geometry/algorithms/detail/relate/interface.hpp index 19568a870..ca14ecfe7 100644 --- a/include/boost/geometry/algorithms/detail/relate/interface.hpp +++ b/include/boost/geometry/algorithms/detail/relate/interface.hpp @@ -62,8 +62,8 @@ namespace dispatch { template ::type, - typename Tag2 = typename geometry::tag::type, + typename Tag1 = geometry::tag_t, + typename Tag2 = geometry::tag_t, int TopDim1 = geometry::topological_dimension::value, int TopDim2 = geometry::topological_dimension::value, bool IsGeneric = detail::relate::is_generic::value @@ -231,8 +231,8 @@ namespace resolve_dynamic template < typename Geometry1, typename Geometry2, - typename Tag1 = typename geometry::tag::type, - typename Tag2 = typename geometry::tag::type + typename Tag1 = geometry::tag_t, + typename Tag2 = geometry::tag_t > struct relate { diff --git a/include/boost/geometry/algorithms/detail/relate/linear_areal.hpp b/include/boost/geometry/algorithms/detail/relate/linear_areal.hpp index 1dfea7490..9be59bd73 100644 --- a/include/boost/geometry/algorithms/detail/relate/linear_areal.hpp +++ b/include/boost/geometry/algorithms/detail/relate/linear_areal.hpp @@ -172,7 +172,7 @@ public: // TODO: // handle empty/invalid geometries in a different way than below? - using point_type = typename geometry::point_type::type; + using point_type = geometry::point_type_t; typename helper_geometry::type pt; bool const ok = geometry::point_on_border(pt, areal); @@ -271,7 +271,7 @@ inline bool calculate_from_inside(Geometry1 const& geometry1, auto const& range1 = sub_range(geometry1, turn.operations[op_id].seg_id); - using range2_view = detail::closed_clockwise_view::type const>; + using range2_view = detail::closed_clockwise_view const>; range2_view const range2(sub_range(geometry2, turn.operations[other_op_id].seg_id)); BOOST_GEOMETRY_ASSERT(boost::size(range1)); diff --git a/include/boost/geometry/algorithms/detail/relate/multi_point_geometry.hpp b/include/boost/geometry/algorithms/detail/relate/multi_point_geometry.hpp index 8d6fe39a5..f4abbfff3 100644 --- a/include/boost/geometry/algorithms/detail/relate/multi_point_geometry.hpp +++ b/include/boost/geometry/algorithms/detail/relate/multi_point_geometry.hpp @@ -51,7 +51,7 @@ namespace detail { namespace relate template < typename Geometry, - typename Tag = typename tag::type + typename Tag = tag_t > struct multi_point_geometry_eb { diff --git a/include/boost/geometry/algorithms/detail/relate/point_point.hpp b/include/boost/geometry/algorithms/detail/relate/point_point.hpp index 1348c0dc6..6e4aeba45 100644 --- a/include/boost/geometry/algorithms/detail/relate/point_point.hpp +++ b/include/boost/geometry/algorithms/detail/relate/point_point.hpp @@ -224,8 +224,8 @@ struct multipoint_multipoint Result & result) { // sort points from the 1 MPt - typedef typename geometry::point_type::type point_type; - typedef geometry::less less_type; + using point_type = geometry::point_type_t; + using less_type = geometry::less; std::vector points(boost::begin(sorted_mpt), boost::end(sorted_mpt)); diff --git a/include/boost/geometry/algorithms/detail/relate/relate_impl.hpp b/include/boost/geometry/algorithms/detail/relate/relate_impl.hpp index 52d3f6e0f..722638d52 100644 --- a/include/boost/geometry/algorithms/detail/relate/relate_impl.hpp +++ b/include/boost/geometry/algorithms/detail/relate/relate_impl.hpp @@ -43,8 +43,8 @@ struct relate_impl_base >::value, not_implemented < - typename geometry::tag::type, - typename geometry::tag::type + geometry::tag_t, + geometry::tag_t >, implemented_tag > diff --git a/include/boost/geometry/algorithms/detail/relate/topology_check.hpp b/include/boost/geometry/algorithms/detail/relate/topology_check.hpp index 90f1ebd52..4ded59ad4 100644 --- a/include/boost/geometry/algorithms/detail/relate/topology_check.hpp +++ b/include/boost/geometry/algorithms/detail/relate/topology_check.hpp @@ -34,7 +34,7 @@ template < typename Geometry, typename Strategy, - typename Tag = typename geometry::tag::type + typename Tag = geometry::tag_t > struct topology_check : not_implemented @@ -306,7 +306,7 @@ private: mutable bool m_has_interior; mutable bool m_has_boundary; - typedef typename geometry::point_type::type point_type; + using point_type = geometry::point_type_t; mutable std::vector m_endpoints; }; diff --git a/include/boost/geometry/algorithms/detail/relate/turns.hpp b/include/boost/geometry/algorithms/detail/relate/turns.hpp index 48661261a..868b1761d 100644 --- a/include/boost/geometry/algorithms/detail/relate/turns.hpp +++ b/include/boost/geometry/algorithms/detail/relate/turns.hpp @@ -54,7 +54,7 @@ struct get_turns { using turn_point_type = typename helper_geometry < - typename geometry::point_type::type + geometry::point_type_t >::type; template @@ -94,8 +94,8 @@ struct get_turns dispatch::get_turns < - typename geometry::tag::type, - typename geometry::tag::type, + geometry::tag_t, + geometry::tag_t, Geometry1, Geometry2, reverse1, diff --git a/include/boost/geometry/algorithms/detail/relation/interface.hpp b/include/boost/geometry/algorithms/detail/relation/interface.hpp index 4c3616ab4..95b146fdc 100644 --- a/include/boost/geometry/algorithms/detail/relation/interface.hpp +++ b/include/boost/geometry/algorithms/detail/relation/interface.hpp @@ -41,8 +41,8 @@ namespace resolve_dynamic template < typename Geometry1, typename Geometry2, - typename Tag1 = typename geometry::tag::type, - typename Tag2 = typename geometry::tag::type + typename Tag1 = geometry::tag_t, + typename Tag2 = geometry::tag_t > struct relation { diff --git a/include/boost/geometry/algorithms/detail/sections/range_by_section.hpp b/include/boost/geometry/algorithms/detail/sections/range_by_section.hpp index fd029db1b..315a75331 100644 --- a/include/boost/geometry/algorithms/detail/sections/range_by_section.hpp +++ b/include/boost/geometry/algorithms/detail/sections/range_by_section.hpp @@ -53,7 +53,7 @@ struct full_section_range template struct full_section_polygon { - static inline typename ring_return_type::type apply(Polygon const& polygon, Section const& section) + static inline ring_return_type_t apply(Polygon const& polygon, Section const& section) { return section.ring_id.ring_index < 0 ? geometry::exterior_ring(polygon) @@ -71,10 +71,10 @@ template > struct full_section_multi { - static inline typename ring_return_type::type apply( + static inline ring_return_type_t apply( MultiGeometry const& multi, Section const& section) { - typedef typename boost::range_size::type size_type; + using size_type = typename boost::range_size::type; BOOST_GEOMETRY_ASSERT ( @@ -171,14 +171,14 @@ struct range_by_section \param section structure with section */ template -inline typename ring_return_type::type +inline ring_return_type_t range_by_section(Geometry const& geometry, Section const& section) { concepts::check(); return dispatch::range_by_section < - typename tag::type, + tag_t, Geometry, Section >::apply(geometry, section); diff --git a/include/boost/geometry/algorithms/detail/sections/section_functions.hpp b/include/boost/geometry/algorithms/detail/sections/section_functions.hpp index d91ce7633..53be42f09 100644 --- a/include/boost/geometry/algorithms/detail/sections/section_functions.hpp +++ b/include/boost/geometry/algorithms/detail/sections/section_functions.hpp @@ -55,11 +55,8 @@ struct preceding_check<0, Geometry, spherical_tag> template 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::type::units units_t; + using calc_t = typename select_coordinate_type::type; + using units_t = detail::coordinate_system_units_t; calc_t const c0 = 0; diff --git a/include/boost/geometry/algorithms/detail/sections/sectionalize.hpp b/include/boost/geometry/algorithms/detail/sections/sectionalize.hpp index 872f54668..f72738bdc 100644 --- a/include/boost/geometry/algorithms/detail/sections/sectionalize.hpp +++ b/include/boost/geometry/algorithms/detail/sections/sectionalize.hpp @@ -189,8 +189,8 @@ struct get_direction_loop static inline void apply(Segment const& seg, int directions[Count]) { - using coordinate_type = typename coordinate_type::type; - using units_t = typename coordinate_system::type::units; + using coordinate_type = coordinate_type_t; + using units_t = detail::coordinate_system_units_t; coordinate_type const diff = math::longitude_distance_signed < @@ -391,7 +391,7 @@ struct sectionalize_part { using section_type = typename boost::range_value::type; using box_type = typename section_type::box_type; - using point_type = typename geometry::point_type::type; + using point_type = geometry::point_type_t; BOOST_STATIC_ASSERT ( @@ -713,7 +713,7 @@ inline void enlarge_sections(Sections& sections, Strategy const&) // but that somehow is not accepted by the NVCC (CUDA 12.4) compiler. using section_t = typename boost::range_value::type; using box_t = typename section_t::box_type; - using coor_t = typename geometry::coordinate_type::type; + using coor_t = geometry::coordinate_type_t; static auto const eps = math::scaled_epsilon(1000); @@ -872,7 +872,7 @@ inline void sectionalize(Geometry const& geometry, dispatch::sectionalize < - typename tag::type, + tag_t, Geometry, Reverse, DimensionVector diff --git a/include/boost/geometry/algorithms/detail/select_geometry_type.hpp b/include/boost/geometry/algorithms/detail/select_geometry_type.hpp index 5592fa5c4..d2c38ce53 100644 --- a/include/boost/geometry/algorithms/detail/select_geometry_type.hpp +++ b/include/boost/geometry/algorithms/detail/select_geometry_type.hpp @@ -25,7 +25,7 @@ namespace detail { -template ::type> +template > struct first_geometry_type { using type = Geometry; diff --git a/include/boost/geometry/algorithms/detail/sub_range.hpp b/include/boost/geometry/algorithms/detail/sub_range.hpp index c1ae9fefb..c85b88537 100644 --- a/include/boost/geometry/algorithms/detail/sub_range.hpp +++ b/include/boost/geometry/algorithms/detail/sub_range.hpp @@ -37,7 +37,7 @@ namespace detail_dispatch { template < typename Geometry, - typename Tag = typename geometry::tag::type, + typename Tag = geometry::tag_t, bool IsMulti = util::is_multi::value > struct sub_range : not_implemented @@ -58,7 +58,7 @@ struct sub_range template struct sub_range { - typedef typename geometry::ring_return_type::type return_type; + using return_type = geometry::ring_return_type_t; template static inline return_type apply(Geometry & geometry, Id const& id) @@ -69,10 +69,10 @@ struct sub_range } else { - typedef typename boost::range_size + using size_type = typename boost::range_size < typename geometry::interior_type::type - >::type size_type; + >::type; size_type const ri = static_cast(id.ring_index); return range::at(geometry::interior_rings(geometry), ri); } diff --git a/include/boost/geometry/algorithms/detail/touches/implementation.hpp b/include/boost/geometry/algorithms/detail/touches/implementation.hpp index 515f827dd..a29fa8ff4 100644 --- a/include/boost/geometry/algorithms/detail/touches/implementation.hpp +++ b/include/boost/geometry/algorithms/detail/touches/implementation.hpp @@ -65,8 +65,8 @@ struct box_box_loop template static inline bool apply(Box1 const& b1, Box2 const& b2, bool & touch) { - typedef typename coordinate_type::type coordinate_type1; - typedef typename coordinate_type::type coordinate_type2; + using coordinate_type1 = coordinate_type_t; + using coordinate_type2 = coordinate_type_t; coordinate_type1 const& min1 = get(b1); coordinate_type1 const& max1 = get(b1); @@ -114,8 +114,8 @@ struct box_box { BOOST_STATIC_ASSERT((std::is_same < - typename geometry::coordinate_system::type, - typename geometry::coordinate_system::type + geometry::coordinate_system_t, + geometry::coordinate_system_t >::value )); assert_dimension_equal(); @@ -217,7 +217,7 @@ inline bool point_on_border_within(Geometry1 const& geometry1, Geometry2 const& geometry2, Strategy const& strategy) { - using point_type = typename geometry::point_type::type; + using point_type = geometry::point_type_t; typename helper_geometry::type pt; return geometry::point_on_border(pt, geometry1) && geometry::within(pt, geometry2, strategy); @@ -242,7 +242,7 @@ struct areal_areal Geometry2 const& geometry2, Strategy const& strategy) { - using point_type = typename geometry::point_type::type; + using point_type = geometry::point_type_t; using mutable_point_type = typename helper_geometry::type; using turn_info = detail::overlay::turn_info; @@ -505,17 +505,17 @@ struct self_touches { concepts::check(); - typedef typename strategies::relate::services::default_strategy + using strategy_type = typename strategies::relate::services::default_strategy < Geometry, Geometry - >::type strategy_type; - typedef typename geometry::point_type::type point_type; - typedef detail::overlay::turn_info turn_info; + >::type; + using point_type = geometry::point_type_t; + using turn_info = detail::overlay::turn_info; - typedef detail::overlay::get_turn_info + using policy_type = detail::overlay::get_turn_info < detail::overlay::assign_null_policy - > policy_type; + >; std::deque turns; detail::touches::areal_interrupt_policy policy; diff --git a/include/boost/geometry/algorithms/detail/touches/interface.hpp b/include/boost/geometry/algorithms/detail/touches/interface.hpp index b7f6f10b1..5bdb26a97 100644 --- a/include/boost/geometry/algorithms/detail/touches/interface.hpp +++ b/include/boost/geometry/algorithms/detail/touches/interface.hpp @@ -149,8 +149,8 @@ namespace resolve_dynamic { template < typename Geometry1, typename Geometry2, - typename Tag1 = typename geometry::tag::type, - typename Tag2 = typename geometry::tag::type + typename Tag1 = geometry::tag_t, + typename Tag2 = geometry::tag_t > struct touches { @@ -228,7 +228,7 @@ struct touches } }; -template ::type> +template > struct self_touches; template diff --git a/include/boost/geometry/algorithms/detail/tupled_output.hpp b/include/boost/geometry/algorithms/detail/tupled_output.hpp index d13793e73..1188b5c09 100644 --- a/include/boost/geometry/algorithms/detail/tupled_output.hpp +++ b/include/boost/geometry/algorithms/detail/tupled_output.hpp @@ -117,8 +117,7 @@ template struct tupled_output_find_index_pred { template - struct pred - : std::is_same::type, Tag> + struct pred : std::is_same, Tag> {}; }; @@ -360,8 +359,7 @@ template struct is_tag_same_as_pred { template - struct pred - : std::is_same::type, Tag> + struct pred : std::is_same, Tag> {}; }; @@ -374,7 +372,7 @@ template typename GeometryOut, typename Tag, typename DefaultTag, - typename GeometryTag = typename geometry::tag::type + typename GeometryTag = geometry::tag_t > struct output_geometry_access {}; @@ -474,7 +472,7 @@ struct setop_insert_output_tag < geometry::detail::is_tupled_single_output::value, tupled_output_tag, - typename geometry::tag::type + geometry::tag_t > {}; diff --git a/include/boost/geometry/algorithms/detail/visit.hpp b/include/boost/geometry/algorithms/detail/visit.hpp index 7cbf9e231..5d41ddc27 100644 --- a/include/boost/geometry/algorithms/detail/visit.hpp +++ b/include/boost/geometry/algorithms/detail/visit.hpp @@ -30,7 +30,7 @@ namespace boost { namespace geometry namespace dispatch { -template ::type> +template > struct visit_one { template @@ -65,8 +65,8 @@ struct visit_one template < typename Geometry1, typename Geometry2, - typename Tag1 = typename tag::type, - typename Tag2 = typename tag::type + typename Tag1 = tag_t, + typename Tag2 = tag_t > struct visit_two { @@ -144,7 +144,7 @@ struct visit_two::type> +template > struct visit_breadth_first { template diff --git a/include/boost/geometry/algorithms/detail/within/interface.hpp b/include/boost/geometry/algorithms/detail/within/interface.hpp index 572e0e5c9..a0c4ed4c6 100644 --- a/include/boost/geometry/algorithms/detail/within/interface.hpp +++ b/include/boost/geometry/algorithms/detail/within/interface.hpp @@ -46,8 +46,8 @@ template < typename Geometry1, typename Geometry2, - typename Tag1 = typename tag::type, - typename Tag2 = typename tag::type + typename Tag1 = tag_t, + typename Tag2 = tag_t > struct within : not_implemented @@ -130,8 +130,8 @@ namespace resolve_dynamic template < typename Geometry1, typename Geometry2, - typename Tag1 = typename geometry::tag::type, - typename Tag2 = typename geometry::tag::type + typename Tag1 = geometry::tag_t, + typename Tag2 = geometry::tag_t > struct within { diff --git a/include/boost/geometry/algorithms/detail/within/point_in_geometry.hpp b/include/boost/geometry/algorithms/detail/within/point_in_geometry.hpp index 459e54ec8..7ef58a813 100644 --- a/include/boost/geometry/algorithms/detail/within/point_in_geometry.hpp +++ b/include/boost/geometry/algorithms/detail/within/point_in_geometry.hpp @@ -71,8 +71,7 @@ namespace detail_dispatch { namespace within { // returns 0 if P is on the boundry of G // returns -1 if P is in the exterior of G -template ::type> +template > struct point_in_geometry : not_implemented {}; @@ -94,7 +93,7 @@ struct point_in_geometry template static inline int apply(Point const& point, Segment const& segment, Strategy const& strategy) { - typedef typename geometry::point_type::type point_type; + using point_type = geometry::point_type_t; point_type p0, p1; // TODO: don't copy points detail::assign_point_from_index<0>(segment, p0); @@ -195,7 +194,7 @@ struct point_in_geometry { int const code = point_in_geometry < - typename ring_type::type + ring_type_t >::apply(point, exterior_ring(polygon), strategy); if (code == 1) @@ -205,7 +204,7 @@ struct point_in_geometry { int const interior_code = point_in_geometry < - typename ring_type::type + ring_type_t >::apply(point, *it, strategy); if (interior_code != -1) diff --git a/include/boost/geometry/algorithms/difference.hpp b/include/boost/geometry/algorithms/difference.hpp index 2d18b3142..98cb7ce53 100644 --- a/include/boost/geometry/algorithms/difference.hpp +++ b/include/boost/geometry/algorithms/difference.hpp @@ -332,9 +332,9 @@ namespace resolve_collection template < typename Geometry1, typename Geometry2, typename Collection, - typename Tag1 = typename geometry::tag::type, - typename Tag2 = typename geometry::tag::type, - typename CollectionTag = typename geometry::tag::type + typename Tag1 = geometry::tag_t, + typename Tag2 = geometry::tag_t, + typename CollectionTag = geometry::tag_t > struct difference { @@ -577,8 +577,8 @@ namespace resolve_dynamic template < typename Geometry1, typename Geometry2, - typename Tag1 = typename geometry::tag::type, - typename Tag2 = typename geometry::tag::type + typename Tag1 = geometry::tag_t, + typename Tag2 = geometry::tag_t > struct difference { diff --git a/include/boost/geometry/algorithms/discrete_frechet_distance.hpp b/include/boost/geometry/algorithms/discrete_frechet_distance.hpp index aff351550..44e0b9dce 100644 --- a/include/boost/geometry/algorithms/discrete_frechet_distance.hpp +++ b/include/boost/geometry/algorithms/discrete_frechet_distance.hpp @@ -145,8 +145,8 @@ template < typename Geometry1, typename Geometry2, - typename Tag1 = typename tag::type, - typename Tag2 = typename tag::type + typename Tag1 = tag_t, + typename Tag2 = tag_t > struct discrete_frechet_distance : not_implemented {}; diff --git a/include/boost/geometry/algorithms/discrete_hausdorff_distance.hpp b/include/boost/geometry/algorithms/discrete_hausdorff_distance.hpp index 88c5bb3a0..fd2e88845 100644 --- a/include/boost/geometry/algorithms/discrete_hausdorff_distance.hpp +++ b/include/boost/geometry/algorithms/discrete_hausdorff_distance.hpp @@ -215,8 +215,8 @@ template < typename Geometry1, typename Geometry2, - typename Tag1 = typename tag::type, - typename Tag2 = typename tag::type + typename Tag1 = tag_t, + typename Tag2 = tag_t > struct discrete_hausdorff_distance : not_implemented {}; diff --git a/include/boost/geometry/algorithms/dispatch/envelope.hpp b/include/boost/geometry/algorithms/dispatch/envelope.hpp index bfe0f0d44..29d730c3b 100644 --- a/include/boost/geometry/algorithms/dispatch/envelope.hpp +++ b/include/boost/geometry/algorithms/dispatch/envelope.hpp @@ -36,7 +36,7 @@ namespace dispatch template < typename Geometry, - typename Tag = typename tag::type + typename Tag = tag_t > struct envelope : not_implemented {}; diff --git a/include/boost/geometry/algorithms/dispatch/expand.hpp b/include/boost/geometry/algorithms/dispatch/expand.hpp index 204bbc6ce..8dd930501 100644 --- a/include/boost/geometry/algorithms/dispatch/expand.hpp +++ b/include/boost/geometry/algorithms/dispatch/expand.hpp @@ -40,8 +40,8 @@ namespace dispatch template < typename GeometryOut, typename Geometry, - typename TagOut = typename tag::type, - typename Tag = typename tag::type + typename TagOut = tag_t, + typename Tag = tag_t > struct expand : not_implemented {}; diff --git a/include/boost/geometry/algorithms/dispatch/is_simple.hpp b/include/boost/geometry/algorithms/dispatch/is_simple.hpp index 2ac92256b..48f9257d6 100644 --- a/include/boost/geometry/algorithms/dispatch/is_simple.hpp +++ b/include/boost/geometry/algorithms/dispatch/is_simple.hpp @@ -23,7 +23,7 @@ namespace dispatch { -template ::type> +template > struct is_simple : not_implemented {}; diff --git a/include/boost/geometry/algorithms/dispatch/is_valid.hpp b/include/boost/geometry/algorithms/dispatch/is_valid.hpp index 5d8108655..0947a1713 100644 --- a/include/boost/geometry/algorithms/dispatch/is_valid.hpp +++ b/include/boost/geometry/algorithms/dispatch/is_valid.hpp @@ -26,7 +26,7 @@ namespace dispatch template < typename Geometry, - typename Tag = typename tag::type, + typename Tag = tag_t, // for multi-geometries: determines if empty multi-geometries are allowed bool AllowEmptyMultiGeometries = true > diff --git a/include/boost/geometry/algorithms/for_each.hpp b/include/boost/geometry/algorithms/for_each.hpp index a1fd0a6cc..ee65045d6 100644 --- a/include/boost/geometry/algorithms/for_each.hpp +++ b/include/boost/geometry/algorithms/for_each.hpp @@ -427,7 +427,7 @@ struct for_each_point template < typename Geometry, - typename Tag = typename tag::type + typename Tag = tag_t > struct for_each_segment: not_implemented {}; diff --git a/include/boost/geometry/algorithms/is_convex.hpp b/include/boost/geometry/algorithms/is_convex.hpp index c5aef2ecb..a42d1f4b6 100644 --- a/include/boost/geometry/algorithms/is_convex.hpp +++ b/include/boost/geometry/algorithms/is_convex.hpp @@ -154,7 +154,7 @@ namespace dispatch template < typename Geometry, - typename Tag = typename tag::type + typename Tag = tag_t > struct is_convex { @@ -264,7 +264,7 @@ struct is_convex namespace resolve_dynamic { -template ::type> +template > struct is_convex { template diff --git a/include/boost/geometry/algorithms/is_empty.hpp b/include/boost/geometry/algorithms/is_empty.hpp index ddb7faaf8..508f6c18c 100644 --- a/include/boost/geometry/algorithms/is_empty.hpp +++ b/include/boost/geometry/algorithms/is_empty.hpp @@ -94,7 +94,7 @@ struct multi_is_empty namespace dispatch { -template ::type> +template > struct is_empty : not_implemented {}; @@ -150,7 +150,7 @@ struct is_empty namespace resolve_dynamic { -template ::type> +template > struct is_empty { static inline bool apply(Geometry const& geometry) diff --git a/include/boost/geometry/algorithms/length.hpp b/include/boost/geometry/algorithms/length.hpp index a79e78dd7..fd8cf1591 100644 --- a/include/boost/geometry/algorithms/length.hpp +++ b/include/boost/geometry/algorithms/length.hpp @@ -116,7 +116,7 @@ namespace dispatch { -template ::type> +template > struct length : detail::calculate_null { typedef typename default_length_result::type return_type; @@ -220,7 +220,7 @@ struct length namespace resolve_dynamic { -template ::type> +template > struct length { template diff --git a/include/boost/geometry/algorithms/line_interpolate.hpp b/include/boost/geometry/algorithms/line_interpolate.hpp index 9afbe5092..289c08ce5 100644 --- a/include/boost/geometry/algorithms/line_interpolate.hpp +++ b/include/boost/geometry/algorithms/line_interpolate.hpp @@ -187,8 +187,8 @@ template < typename Geometry, typename Pointlike, - typename Tag1 = typename tag::type, - typename Tag2 = typename tag::type + typename Tag1 = tag_t, + typename Tag2 = tag_t > struct line_interpolate { diff --git a/include/boost/geometry/algorithms/make.hpp b/include/boost/geometry/algorithms/make.hpp index 40cc5c0e4..c32db36ab 100644 --- a/include/boost/geometry/algorithms/make.hpp +++ b/include/boost/geometry/algorithms/make.hpp @@ -94,7 +94,7 @@ inline Geometry make(Type const& c1, Type const& c2) Geometry geometry; dispatch::assign < - typename tag::type, + tag_t, Geometry, geometry::dimension::type::value >::apply(geometry, c1, c2); @@ -150,7 +150,7 @@ inline Geometry make(Type const& c1, Type const& c2, Type const& c3) Geometry geometry; dispatch::assign < - typename tag::type, + tag_t, Geometry, geometry::dimension::type::value >::apply(geometry, c1, c2, c3); @@ -181,7 +181,7 @@ inline Geometry make(Type const& c1, Type const& c2, Type const& c3, Type const& Geometry geometry; dispatch::assign < - typename tag::type, + tag_t, Geometry, geometry::dimension::type::value >::apply(geometry, c1, c2, c3, c4); @@ -217,7 +217,7 @@ inline Geometry make_inverse() Geometry geometry; dispatch::assign_inverse < - typename tag::type, + tag_t, Geometry >::apply(geometry); return geometry; @@ -238,7 +238,7 @@ inline Geometry make_zero() Geometry geometry; dispatch::assign_zero < - typename tag::type, + tag_t, Geometry >::apply(geometry); return geometry; diff --git a/include/boost/geometry/algorithms/merge_elements.hpp b/include/boost/geometry/algorithms/merge_elements.hpp index 76c1cf63b..5d1de1114 100644 --- a/include/boost/geometry/algorithms/merge_elements.hpp +++ b/include/boost/geometry/algorithms/merge_elements.hpp @@ -66,7 +66,7 @@ template > inline void distribute_element(Geometry const& geometry, It it, PointLike& , Linear&, Areal& areal) { - typename geometry::point_type::type point; + geometry::point_type_t point; if (geometry::point_on_border(point, geometry)) { using point_t = typename Areal::value_type::first_type; @@ -81,7 +81,7 @@ template > inline void distribute_element(Geometry const& geometry, It it, PointLike& , Linear& linear, Areal& ) { - typename geometry::point_type::type point; + geometry::point_type_t point; if (geometry::point_on_border(point, geometry)) { using point_t = typename Linear::value_type::first_type; @@ -96,7 +96,7 @@ template > inline void distribute_element(Geometry const& geometry, It it, PointLike& pointlike, Linear& , Areal& ) { - typename geometry::point_type::type point; + geometry::point_type_t point; if (geometry::point_on_border(point, geometry)) { using point_t = typename Linear::value_type::first_type; @@ -268,11 +268,11 @@ struct merge_gc GeometryCollection & out, Strategy const& strategy) { - using original_point_t = typename geometry::point_type::type; + using original_point_t = geometry::point_type_t; using iterator_t = typename boost::range_iterator::type; - using coordinate_t = typename geometry::coordinate_type::type; - using cs_t = typename geometry::coordinate_system::type; - using point_t = model::point; + using coor_t = geometry::coordinate_type_t; + using cs_t = geometry::coordinate_system_t; + using point_t = model::point; using multi_point_t = typename util::sequence_find_if < @@ -346,7 +346,7 @@ namespace dispatch { -template ::type> +template > struct merge_elements : not_implemented {}; diff --git a/include/boost/geometry/algorithms/num_interior_rings.hpp b/include/boost/geometry/algorithms/num_interior_rings.hpp index 1cf90a81e..4d62c045f 100644 --- a/include/boost/geometry/algorithms/num_interior_rings.hpp +++ b/include/boost/geometry/algorithms/num_interior_rings.hpp @@ -46,7 +46,7 @@ namespace dispatch { -template ::type> +template > struct num_interior_rings : detail::counting::other_count<0> {}; diff --git a/include/boost/geometry/algorithms/num_points.hpp b/include/boost/geometry/algorithms/num_points.hpp index 6a59c2bb5..ad2e37e70 100644 --- a/include/boost/geometry/algorithms/num_points.hpp +++ b/include/boost/geometry/algorithms/num_points.hpp @@ -139,7 +139,7 @@ struct num_points namespace resolve_dynamic { -template ::type> +template > struct num_points { static inline std::size_t apply(Geometry const& geometry, bool add_for_open) diff --git a/include/boost/geometry/algorithms/num_segments.hpp b/include/boost/geometry/algorithms/num_segments.hpp index d73a8b4fc..6eb84b1d0 100644 --- a/include/boost/geometry/algorithms/num_segments.hpp +++ b/include/boost/geometry/algorithms/num_segments.hpp @@ -66,7 +66,7 @@ struct range_count namespace dispatch { -template ::type> +template > struct num_segments : not_implemented {}; @@ -140,7 +140,7 @@ namespace resolve_dynamic { -template ::type> +template > struct num_segments { static inline std::size_t apply(Geometry const& geometry) diff --git a/include/boost/geometry/algorithms/perimeter.hpp b/include/boost/geometry/algorithms/perimeter.hpp index 3b7f7e693..c99a555b2 100644 --- a/include/boost/geometry/algorithms/perimeter.hpp +++ b/include/boost/geometry/algorithms/perimeter.hpp @@ -51,7 +51,7 @@ namespace dispatch { // Default perimeter is 0.0, specializations implement calculated values -template ::type> +template > struct perimeter : detail::calculate_null { typedef typename default_length_result::type return_type; @@ -75,12 +75,12 @@ struct perimeter template struct perimeter : detail::calculate_polygon_sum { - typedef typename default_length_result::type return_type; - typedef detail::length::range_length + using return_type = typename default_length_result::type; + using policy = detail::length::range_length < - typename ring_type::type, + ring_type_t, closure::value - > policy; + >; template static inline return_type apply(Polygon const& polygon, Strategy const& strategy) @@ -163,7 +163,7 @@ struct perimeter namespace resolve_dynamic { -template ::type> +template > struct perimeter { template diff --git a/include/boost/geometry/algorithms/point_on_surface.hpp b/include/boost/geometry/algorithms/point_on_surface.hpp index 88077bcc2..55149d7d5 100644 --- a/include/boost/geometry/algorithms/point_on_surface.hpp +++ b/include/boost/geometry/algorithms/point_on_surface.hpp @@ -146,7 +146,7 @@ struct min_of_intruder template inline void calculate_average(Point& point, std::vector

const& points) { - typedef typename geometry::coordinate_type::type coordinate_type; + using coordinate_type = geometry::coordinate_type_t; coordinate_type x = 0; coordinate_type y = 0; @@ -237,8 +237,8 @@ template ::type point_type; - typedef typename geometry::coordinate_type::type coordinate_type; + using point_type = geometry::point_type_t; + using coordinate_type = geometry::coordinate_type_t; std::vector extremes; typedef std::vector > intruders_type; @@ -327,10 +327,10 @@ inline void point_on_surface(Geometry const& geometry, Point & point) \return The Point guaranteed to lie on the surface of the Geometry */ template -inline typename geometry::point_type::type +inline geometry::point_type_t return_point_on_surface(Geometry const& geometry, SideStrategy const& strategy) { - typename geometry::point_type::type result; + geometry::point_type_t result; geometry::point_on_surface(geometry, result, strategy); return result; } @@ -342,10 +342,10 @@ return_point_on_surface(Geometry const& geometry, SideStrategy const& strategy) \return The Point guaranteed to lie on the surface of the Geometry */ template -inline typename geometry::point_type::type +inline geometry::point_type_t return_point_on_surface(Geometry const& geometry) { - typename geometry::point_type::type result; + geometry::point_type_t result; geometry::point_on_surface(geometry, result); return result; } diff --git a/include/boost/geometry/algorithms/remove_spikes.hpp b/include/boost/geometry/algorithms/remove_spikes.hpp index 48880a503..e2c8a3593 100644 --- a/include/boost/geometry/algorithms/remove_spikes.hpp +++ b/include/boost/geometry/algorithms/remove_spikes.hpp @@ -206,7 +206,7 @@ namespace dispatch template < typename Geometry, - typename Tag = typename tag::type + typename Tag = tag_t > struct remove_spikes { diff --git a/include/boost/geometry/algorithms/reverse.hpp b/include/boost/geometry/algorithms/reverse.hpp index 307f8294f..9e125283f 100644 --- a/include/boost/geometry/algorithms/reverse.hpp +++ b/include/boost/geometry/algorithms/reverse.hpp @@ -79,7 +79,7 @@ namespace dispatch { -template ::type> +template > struct reverse { static inline void apply(Geometry&) @@ -125,7 +125,7 @@ struct reverse namespace resolve_dynamic { -template ::type> +template > struct reverse { static void apply(Geometry& geometry) diff --git a/include/boost/geometry/algorithms/simplify.hpp b/include/boost/geometry/algorithms/simplify.hpp index 28a3a5582..5299a3b6d 100644 --- a/include/boost/geometry/algorithms/simplify.hpp +++ b/include/boost/geometry/algorithms/simplify.hpp @@ -393,7 +393,7 @@ private : auto const cdistance_strategy = strategies::distance::detail::make_comparable(strategies) .distance(detail::dummy_point(), detail::dummy_point()); - using point_type = typename geometry::point_type::type; + using point_type = geometry::point_type_t; using cdistance_type = decltype(cdistance_strategy.apply( std::declval(), std::declval())); @@ -444,7 +444,7 @@ public : // Rotate it into a copied vector // (vector, because source type might not support rotation) // (duplicate end point will be simplified away) - typedef typename geometry::point_type::type point_type; + using point_type = geometry::point_type_t; std::vector rotated; rotated.reserve(size + 1); // 1 because open rings are closed @@ -653,11 +653,7 @@ struct has_same_tag_as { template struct pred - : std::is_same - < - typename geometry::tag::type, - typename geometry::tag::type - > + : std::is_same, geometry::tag_t> {}; }; @@ -689,8 +685,8 @@ template < typename GeometryIn, typename GeometryOut, - typename TagIn = typename tag::type, - typename TagOut = typename tag::type + typename TagIn = tag_t, + typename TagOut = tag_t > struct simplify: not_implemented {}; @@ -751,7 +747,7 @@ struct simplify::type + typename Tag = tag_t > struct simplify_insert: not_implemented {}; @@ -826,8 +822,8 @@ struct simplify default_strategy) { // NOTE: Alternatively take two geometry types in default_strategy - using cs_tag1_t = typename geometry::cs_tag::type; - using cs_tag2_t = typename geometry::cs_tag::type; + using cs_tag1_t = geometry::cs_tag_t; + using cs_tag2_t = geometry::cs_tag_t; BOOST_GEOMETRY_STATIC_ASSERT( (std::is_same::value), "Incompatible coordinate systems", @@ -915,8 +911,8 @@ namespace resolve_dynamic { template < typename GeometryIn, typename GeometryOut, - typename TagIn = typename tag::type, - typename TagOut = typename tag::type + typename TagIn = tag_t, + typename TagOut = tag_t > struct simplify { diff --git a/include/boost/geometry/algorithms/sym_difference.hpp b/include/boost/geometry/algorithms/sym_difference.hpp index b55075006..0ed7d16a3 100644 --- a/include/boost/geometry/algorithms/sym_difference.hpp +++ b/include/boost/geometry/algorithms/sym_difference.hpp @@ -486,9 +486,9 @@ namespace resolve_collection template < typename Geometry1, typename Geometry2, typename Collection, - typename Tag1 = typename geometry::tag::type, - typename Tag2 = typename geometry::tag::type, - typename CollectionTag = typename geometry::tag::type + typename Tag1 = geometry::tag_t, + typename Tag2 = geometry::tag_t, + typename CollectionTag = geometry::tag_t > struct sym_difference { @@ -680,8 +680,8 @@ namespace resolve_dynamic template < typename Geometry1, typename Geometry2, - typename Tag1 = typename geometry::tag::type, - typename Tag2 = typename geometry::tag::type + typename Tag1 = geometry::tag_t, + typename Tag2 = geometry::tag_t > struct sym_difference { diff --git a/include/boost/geometry/algorithms/transform.hpp b/include/boost/geometry/algorithms/transform.hpp index 8b7e814ec..65491620c 100644 --- a/include/boost/geometry/algorithms/transform.hpp +++ b/include/boost/geometry/algorithms/transform.hpp @@ -84,10 +84,10 @@ struct transform_box { // Create a valid box and therefore swap if necessary using coordinate_type = coordinate_type_t; - coordinate_type x1 = geometry::get<0>(p1) - , y1 = geometry::get<1>(p1) - , x2 = geometry::get<0>(p2) - , y2 = geometry::get<1>(p2); + coordinate_type x1 = geometry::get<0>(p1); + coordinate_type y1 = geometry::get<1>(p1); + coordinate_type x2 = geometry::get<0>(p2); + coordinate_type y2 = geometry::get<1>(p2); if (x1 > x2) { std::swap(x1, x2); } if (y1 > y2) { std::swap(y1, y2); } diff --git a/include/boost/geometry/algorithms/union.hpp b/include/boost/geometry/algorithms/union.hpp index 3deced91d..494e700ee 100644 --- a/include/boost/geometry/algorithms/union.hpp +++ b/include/boost/geometry/algorithms/union.hpp @@ -363,9 +363,9 @@ namespace resolve_collection template < typename Geometry1, typename Geometry2, typename GeometryOut, - typename Tag1 = typename geometry::tag::type, - typename Tag2 = typename geometry::tag::type, - typename TagOut = typename geometry::tag::type + typename Tag1 = geometry::tag_t, + typename Tag2 = geometry::tag_t, + typename TagOut = geometry::tag_t > struct union_ { @@ -720,8 +720,8 @@ namespace resolve_dynamic template < typename Geometry1, typename Geometry2, - typename Tag1 = typename geometry::tag::type, - typename Tag2 = typename geometry::tag::type + typename Tag1 = geometry::tag_t, + typename Tag2 = geometry::tag_t > struct union_ { diff --git a/include/boost/geometry/algorithms/unique.hpp b/include/boost/geometry/algorithms/unique.hpp index 618087e14..d1f132ea0 100644 --- a/include/boost/geometry/algorithms/unique.hpp +++ b/include/boost/geometry/algorithms/unique.hpp @@ -102,7 +102,7 @@ namespace dispatch template < typename Geometry, - typename Tag = typename tag::type + typename Tag = tag_t > struct unique { @@ -167,10 +167,10 @@ inline void unique(Geometry& geometry) concepts::check(); // Default strategy is the default point-comparison policy - typedef geometry::equal_to + using policy = geometry::equal_to < - typename geometry::point_type::type - > policy; + geometry::point_type_t + >; dispatch::unique::apply(geometry, policy()); diff --git a/include/boost/geometry/arithmetic/arithmetic.hpp b/include/boost/geometry/arithmetic/arithmetic.hpp index b88bd5cce..d25b0cdc9 100644 --- a/include/boost/geometry/arithmetic/arithmetic.hpp +++ b/include/boost/geometry/arithmetic/arithmetic.hpp @@ -41,7 +41,7 @@ namespace boost { namespace geometry \param value value to add */ template -inline void add_value(Point& p, typename coordinate_type::type const& value) +inline void add_value(Point& p, coordinate_type_t const& value) { BOOST_CONCEPT_ASSERT( (concepts::Point) ); @@ -83,7 +83,7 @@ inline void add_point(Point1& p1, Point2 const& p2) \param value value to subtract */ template -inline void subtract_value(Point& p, typename coordinate_type::type const& value) +inline void subtract_value(Point& p, coordinate_type_t const& value) { BOOST_CONCEPT_ASSERT( (concepts::Point) ); @@ -125,7 +125,7 @@ inline void subtract_point(Point1& p1, Point2 const& p2) \param value value to multiply by */ template -inline void multiply_value(Point& p, typename coordinate_type::type const& value) +inline void multiply_value(Point& p, coordinate_type_t const& value) { BOOST_CONCEPT_ASSERT( (concepts::Point) ); @@ -168,7 +168,7 @@ inline void multiply_point(Point1& p1, Point2 const& p2) \param value value to divide by */ template -inline void divide_value(Point& p, typename coordinate_type::type const& value) +inline void divide_value(Point& p, coordinate_type_t const& value) { BOOST_CONCEPT_ASSERT( (concepts::Point) ); @@ -210,7 +210,7 @@ inline void divide_point(Point1& p1, Point2 const& p2) \param value value to assign */ template -inline void assign_value(Point& p, typename coordinate_type::type const& value) +inline void assign_value(Point& p, coordinate_type_t const& value) { BOOST_CONCEPT_ASSERT( (concepts::Point) ); diff --git a/include/boost/geometry/arithmetic/determinant.hpp b/include/boost/geometry/arithmetic/determinant.hpp index 63974a9ea..ada0c5014 100644 --- a/include/boost/geometry/arithmetic/determinant.hpp +++ b/include/boost/geometry/arithmetic/determinant.hpp @@ -65,8 +65,8 @@ inline ReturnType determinant(U const& u, V const& v) return calculate_determinant < ReturnType, - typename geometry::coordinate_type::type, - typename geometry::coordinate_type::type + geometry::coordinate_type_t, + geometry::coordinate_type_t >::apply(get<0>(u), get<1>(u), get<0>(v), get<1>(v)); } diff --git a/include/boost/geometry/arithmetic/infinite_line_functions.hpp b/include/boost/geometry/arithmetic/infinite_line_functions.hpp index 16acb866c..15c6eecbf 100644 --- a/include/boost/geometry/arithmetic/infinite_line_functions.hpp +++ b/include/boost/geometry/arithmetic/infinite_line_functions.hpp @@ -89,7 +89,7 @@ inline typename select_most_precise < Type, - typename geometry::coordinate_type::type + geometry::coordinate_type_t >::type side_value(model::infinite_line const& line, Point const& p) { diff --git a/include/boost/geometry/arithmetic/normalize.hpp b/include/boost/geometry/arithmetic/normalize.hpp index 64e08c2dc..c338293ba 100644 --- a/include/boost/geometry/arithmetic/normalize.hpp +++ b/include/boost/geometry/arithmetic/normalize.hpp @@ -26,22 +26,22 @@ namespace detail { template -inline typename coordinate_type::type vec_length_sqr(Point const& pt) +inline coordinate_type_t vec_length_sqr(Point const& pt) { return dot_product(pt, pt); } template -inline typename coordinate_type::type vec_length(Point const& pt) +inline coordinate_type_t vec_length(Point const& pt) { // NOTE: hypot() could be used instead of sqrt() return math::sqrt(dot_product(pt, pt)); } template -inline bool vec_normalize(Point & pt, typename coordinate_type::type & len) +inline bool vec_normalize(Point & pt, coordinate_type_t& len) { - typedef typename coordinate_type::type coord_t; + using coord_t = coordinate_type_t; coord_t const c0 = 0; len = vec_length(pt); @@ -58,7 +58,7 @@ inline bool vec_normalize(Point & pt, typename coordinate_type::type & le template inline bool vec_normalize(Point & pt) { - typedef typename coordinate_type::type coord_t; + using coord_t = coordinate_type_t; coord_t len; return vec_normalize(pt, len); } diff --git a/include/boost/geometry/core/coordinate_promotion.hpp b/include/boost/geometry/core/coordinate_promotion.hpp index efbcdff7d..1a66e6472 100644 --- a/include/boost/geometry/core/coordinate_promotion.hpp +++ b/include/boost/geometry/core/coordinate_promotion.hpp @@ -49,10 +49,10 @@ struct promote_floating_point template struct fp_coordinate_type { - typedef typename promote_floating_point + using type = typename promote_floating_point < - typename coordinate_type::type - >::type type; + coordinate_type_t + >::type; }; namespace detail diff --git a/include/boost/geometry/core/coordinate_system.hpp b/include/boost/geometry/core/coordinate_system.hpp index cebdbc2e6..68922c029 100644 --- a/include/boost/geometry/core/coordinate_system.hpp +++ b/include/boost/geometry/core/coordinate_system.hpp @@ -58,20 +58,20 @@ namespace core_dispatch template struct coordinate_system { - typedef typename point_type::type P; + using P = typename point_type::type; // Call its own specialization on point-tag - typedef typename coordinate_system::type type; + using type = typename coordinate_system::type; }; template struct coordinate_system { - typedef typename traits::coordinate_system + using type = typename traits::coordinate_system < - typename util::remove_cptrref::type - >::type type; + util::remove_cptrref_t + >::type; }; @@ -96,10 +96,25 @@ struct coordinate_system >::type; }; - template using coordinate_system_t = typename coordinate_system::type; +#ifndef DOXYGEN_NO_DETAIL +namespace detail { + +// Short cut for coordinate system units +template +struct coordinate_system_units +{ + using type = typename coordinate_system::type::units; +}; + + +template +using coordinate_system_units_t = typename coordinate_system_units::type; + +} // namespace detail +#endif // DOXYGEN_NO_DETAIL }} // namespace boost::geometry diff --git a/include/boost/geometry/core/cs.hpp b/include/boost/geometry/core/cs.hpp index e6bc4e34f..197e86dbb 100644 --- a/include/boost/geometry/core/cs.hpp +++ b/include/boost/geometry/core/cs.hpp @@ -194,33 +194,33 @@ struct cs_tag template struct cs_tag > { - typedef geographic_tag type; + using type = geographic_tag; }; template struct cs_tag > { - typedef spherical_polar_tag type; + using type = spherical_polar_tag; }; template struct cs_tag > { - typedef spherical_equatorial_tag type; + using type = spherical_equatorial_tag; }; template<> struct cs_tag { - typedef cartesian_tag type; + using type = cartesian_tag; }; template <> struct cs_tag { - typedef cs_undefined_tag type; + using type = cs_undefined_tag; }; #endif // DOXYGEN_NO_TRAITS_SPECIALIZATIONS @@ -255,7 +255,7 @@ namespace traits template struct cs_angular_units { - typedef geometry::radian type; + using type = geometry::radian; }; #ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS @@ -263,19 +263,19 @@ struct cs_angular_units template struct cs_angular_units > { - typedef DegreeOrRadian type; + using type = DegreeOrRadian; }; template struct cs_angular_units > { - typedef DegreeOrRadian type; + using type = DegreeOrRadian; }; template struct cs_angular_units > { - typedef DegreeOrRadian type; + using type = DegreeOrRadian; }; #endif // DOXYGEN_NO_TRAITS_SPECIALIZATIONS @@ -313,31 +313,31 @@ struct cs_tag_to_coordinate_system template struct cs_tag_to_coordinate_system { - typedef cs::undefined type; + using type = cs::undefined; }; template struct cs_tag_to_coordinate_system { - typedef cs::cartesian type; + using type = cs::cartesian; }; template struct cs_tag_to_coordinate_system { - typedef cs::spherical_equatorial type; + using type = cs::spherical_equatorial; }; template struct cs_tag_to_coordinate_system { - typedef cs::spherical type; + using type = cs::spherical; }; template struct cs_tag_to_coordinate_system { - typedef cs::geographic type; + using type = cs::geographic; }; diff --git a/include/boost/geometry/core/exterior_ring.hpp b/include/boost/geometry/core/exterior_ring.hpp index 3e99aa4d2..e1477f83d 100644 --- a/include/boost/geometry/core/exterior_ring.hpp +++ b/include/boost/geometry/core/exterior_ring.hpp @@ -75,14 +75,9 @@ struct exterior_ring template struct exterior_ring { - static - typename geometry::ring_return_type::type - apply(Polygon& polygon) + static geometry::ring_return_type_t apply(Polygon& polygon) { - return traits::exterior_ring - < - typename std::remove_const::type - >::get(polygon); + return traits::exterior_ring>::get(polygon); } }; @@ -100,11 +95,11 @@ struct exterior_ring \return a reference to the exterior ring */ template -inline typename ring_return_type::type exterior_ring(Polygon& polygon) +inline ring_return_type_t exterior_ring(Polygon& polygon) { return core_dispatch::exterior_ring < - typename tag::type, + tag_t, Polygon >::apply(polygon); } @@ -121,12 +116,11 @@ inline typename ring_return_type::type exterior_ring(Polygon& polygon) \qbk{distinguish,const version} */ template -inline typename ring_return_type::type exterior_ring( - Polygon const& polygon) +inline ring_return_type_t exterior_ring(Polygon const& polygon) { return core_dispatch::exterior_ring < - typename tag::type, + tag_t, Polygon const >::apply(polygon); } diff --git a/include/boost/geometry/core/geometry_id.hpp b/include/boost/geometry/core/geometry_id.hpp index ed2a238c6..b237aa2d8 100644 --- a/include/boost/geometry/core/geometry_id.hpp +++ b/include/boost/geometry/core/geometry_id.hpp @@ -100,7 +100,7 @@ struct geometry_id : std::integral_constant {} \ingroup core */ template -struct geometry_id : core_dispatch::geometry_id::type> +struct geometry_id : core_dispatch::geometry_id> {}; diff --git a/include/boost/geometry/core/geometry_types.hpp b/include/boost/geometry/core/geometry_types.hpp index d64b9b862..50a11f4b7 100644 --- a/include/boost/geometry/core/geometry_types.hpp +++ b/include/boost/geometry/core/geometry_types.hpp @@ -32,7 +32,7 @@ struct geometry_types; namespace traits_dispatch { -template ::type> +template > struct geometry_types { BOOST_GEOMETRY_STATIC_ASSERT_FALSE( diff --git a/include/boost/geometry/core/interior_rings.hpp b/include/boost/geometry/core/interior_rings.hpp index b8b5c6280..89e8e3d32 100644 --- a/include/boost/geometry/core/interior_rings.hpp +++ b/include/boost/geometry/core/interior_rings.hpp @@ -90,11 +90,11 @@ struct interior_rings template struct interior_type { - typedef typename core_dispatch::interior_type + using type = typename core_dispatch::interior_type < polygon_tag, typename boost::range_value::type - >::type type; + >::type; }; @@ -113,11 +113,11 @@ struct interior_type */ template -inline typename interior_return_type::type interior_rings(Polygon& polygon) +inline interior_return_type_t interior_rings(Polygon& polygon) { return core_dispatch::interior_rings < - typename tag::type, + tag_t, Polygon >::apply(polygon); } @@ -134,12 +134,11 @@ inline typename interior_return_type::type interior_rings(Polygon& poly \qbk{distinguish,const version} */ template -inline typename interior_return_type::type interior_rings( - Polygon const& polygon) +inline interior_return_type_t interior_rings(Polygon const& polygon) { return core_dispatch::interior_rings < - typename tag::type, + tag_t, Polygon const >::apply(polygon); } diff --git a/include/boost/geometry/core/interior_type.hpp b/include/boost/geometry/core/interior_type.hpp index d7879d292..02048296f 100644 --- a/include/boost/geometry/core/interior_type.hpp +++ b/include/boost/geometry/core/interior_type.hpp @@ -39,7 +39,7 @@ namespace traits \par Geometries: - polygon \par Specializations should provide: - - typedef X type ( e.g. std::vector<myring<P>> ) + - using type = X ( e.g. std::vector<myring<P>> ) \tparam Geometry geometry */ template @@ -81,14 +81,14 @@ struct interior_return_type template struct interior_return_type { - typedef typename std::remove_const::type nc_polygon_type; + using nc_polygon_type = std::remove_const_t; - typedef std::conditional_t + using type = std::conditional_t < std::is_const::value, typename traits::interior_const_type::type, typename traits::interior_mutable_type::type - > type; + >; }; @@ -106,10 +106,10 @@ struct interior_type template struct interior_type { - typedef typename std::remove_reference + using type = std::remove_reference_t < typename interior_return_type::type - >::type type; + >; }; @@ -132,24 +132,32 @@ struct interior_type template struct interior_type { - typedef typename core_dispatch::interior_type + using type = typename core_dispatch::interior_type < - typename tag::type, + tag_t, Geometry - >::type type; + >::type; }; +template +using interior_type_t = typename interior_type::type; + + template struct interior_return_type { - typedef typename core_dispatch::interior_return_type + using type = typename core_dispatch::interior_return_type < - typename tag::type, + tag_t, Geometry - >::type type; + >::type; }; +template +using interior_return_type_t = typename interior_return_type::type; + + }} // namespace boost::geometry diff --git a/include/boost/geometry/core/point_type.hpp b/include/boost/geometry/core/point_type.hpp index ccb259c16..89c572c24 100644 --- a/include/boost/geometry/core/point_type.hpp +++ b/include/boost/geometry/core/point_type.hpp @@ -66,10 +66,10 @@ template struct point_type { // Default: call traits to get point type - typedef typename std::remove_const + using type = std::remove_const_t < typename traits::point_type::type - >::type type; + >; }; @@ -77,7 +77,7 @@ struct point_type template struct point_type { - typedef Point type; + using type = Point; }; @@ -85,14 +85,14 @@ struct point_type template struct point_type { - typedef typename boost::range_value::type type; + using type = typename boost::range_value::type; }; template struct point_type { - typedef typename boost::range_value::type type; + using type = typename boost::range_value::type; }; @@ -100,43 +100,43 @@ struct point_type template struct point_type { - typedef typename point_type + using type = typename point_type < ring_tag, typename ring_type::type - >::type type; + >::type; }; template struct point_type { - typedef typename boost::range_value + using type = typename boost::range_value < MultiPoint - >::type type; + >::type; }; template struct point_type { - typedef typename point_type + using type = typename point_type < linestring_tag, typename boost::range_value::type - >::type type; + >::type; }; template struct point_type { - typedef typename point_type + using type = typename point_type < polygon_tag, typename boost::range_value::type - >::type type; + >::type; }; @@ -149,8 +149,8 @@ struct point_type >::type; using type = typename point_type < - typename tag::type, - typename util::remove_cptrref::type + tag_t, + util::remove_cptrref_t >::type; }; @@ -164,8 +164,8 @@ struct point_type >::type; using type = typename point_type < - typename tag::type, - typename util::remove_cptrref::type + tag_t, + util::remove_cptrref_t >::type; }; diff --git a/include/boost/geometry/core/radian_access.hpp b/include/boost/geometry/core/radian_access.hpp index ef87701ba..05a55957e 100644 --- a/include/boost/geometry/core/radian_access.hpp +++ b/include/boost/geometry/core/radian_access.hpp @@ -191,7 +191,7 @@ template inline typename fp_coordinate_type::type get_as_radian(Geometry const& geometry) { return detail::radian_access::type>::get(geometry); + coordinate_system_t>::get(geometry); } /*! @@ -211,7 +211,7 @@ inline void set_from_radian(Geometry& geometry, typename fp_coordinate_type::type const& radians) { detail::radian_access::type>::set(geometry, radians); + coordinate_system_t>::set(geometry, radians); } /*! @@ -231,7 +231,7 @@ template inline typename fp_coordinate_type::type get_as_radian(Geometry const& geometry) { return detail::radian_access_box_segment::type>::get(geometry); + coordinate_system_t>::get(geometry); } /*! @@ -252,7 +252,7 @@ inline void set_from_radian(Geometry& geometry, typename fp_coordinate_type::type const& radians) { detail::radian_access_box_segment::type>::set(geometry, radians); + coordinate_system_t>::set(geometry, radians); } }} // namespace boost::geometry diff --git a/include/boost/geometry/core/ring_type.hpp b/include/boost/geometry/core/ring_type.hpp index eea52ec3f..e382c6117 100644 --- a/include/boost/geometry/core/ring_type.hpp +++ b/include/boost/geometry/core/ring_type.hpp @@ -106,7 +106,7 @@ struct ring_return_type template struct ring_return_type { - typedef typename ring_return_type + using type = typename ring_return_type < linestring_tag, std::conditional_t @@ -115,14 +115,14 @@ struct ring_return_type typename boost::range_value::type const, typename boost::range_value::type > - >::type type; + >::type; }; template struct ring_return_type { - typedef typename ring_return_type + using type = typename ring_return_type < polygon_tag, std::conditional_t @@ -131,7 +131,7 @@ struct ring_return_type typename boost::range_value::type const, typename boost::range_value::type > - >::type type; + >::type; }; @@ -157,30 +157,30 @@ struct ring_type template struct ring_type { - typedef typename std::remove_reference + using type = std::remove_reference_t < typename ring_return_type::type - >::type type; + >; }; template struct ring_type { - typedef typename std::remove_reference + using type = std::remove_reference_t < typename ring_return_type::type - >::type type; + >; }; template struct ring_type { - typedef typename std::remove_reference + using type = std::remove_reference_t < typename ring_return_type::type - >::type type; + >; }; @@ -204,7 +204,7 @@ struct ring_type { using type = typename core_dispatch::ring_type < - typename tag::type, + tag_t, Geometry >::type; }; @@ -218,7 +218,7 @@ struct ring_return_type { using type = typename core_dispatch::ring_return_type < - typename tag::type, + tag_t, Geometry >::type; }; diff --git a/include/boost/geometry/core/tag.hpp b/include/boost/geometry/core/tag.hpp index 196741562..c8424eb63 100644 --- a/include/boost/geometry/core/tag.hpp +++ b/include/boost/geometry/core/tag.hpp @@ -38,7 +38,7 @@ namespace traits \par Geometries: - all geometries \par Specializations should provide: - - typedef XXX_tag type; (point_tag, box_tag, ...) + - using type = XXX_tag; (point_tag, box_tag, ...) \tparam Geometry geometry */ template diff --git a/include/boost/geometry/core/tags.hpp b/include/boost/geometry/core/tags.hpp index f0d62783b..88422e4e0 100644 --- a/include/boost/geometry/core/tags.hpp +++ b/include/boost/geometry/core/tags.hpp @@ -135,19 +135,19 @@ struct single_tag_of template <> struct single_tag_of { - typedef point_tag type; + using type = point_tag; }; template <> struct single_tag_of { - typedef linestring_tag type; + using type = linestring_tag; }; template <> struct single_tag_of { - typedef polygon_tag type; + using type = polygon_tag; }; #endif diff --git a/include/boost/geometry/core/topological_dimension.hpp b/include/boost/geometry/core/topological_dimension.hpp index c1c750246..9bb644f29 100644 --- a/include/boost/geometry/core/topological_dimension.hpp +++ b/include/boost/geometry/core/topological_dimension.hpp @@ -100,7 +100,7 @@ struct top_dim : std::integral_constant {}; */ template struct topological_dimension - : core_dispatch::top_dim::type> {}; + : core_dispatch::top_dim> {}; #ifndef BOOST_NO_CXX17_INLINE_VARIABLES diff --git a/include/boost/geometry/formulas/authalic_radius_sqr.hpp b/include/boost/geometry/formulas/authalic_radius_sqr.hpp index 54da31761..75dd08926 100644 --- a/include/boost/geometry/formulas/authalic_radius_sqr.hpp +++ b/include/boost/geometry/formulas/authalic_radius_sqr.hpp @@ -30,7 +30,7 @@ namespace boost { namespace geometry namespace formula_dispatch { -template ::type> +template > struct authalic_radius_sqr : not_implemented {}; diff --git a/include/boost/geometry/formulas/eccentricity_sqr.hpp b/include/boost/geometry/formulas/eccentricity_sqr.hpp index 1608a8570..75479b379 100644 --- a/include/boost/geometry/formulas/eccentricity_sqr.hpp +++ b/include/boost/geometry/formulas/eccentricity_sqr.hpp @@ -26,7 +26,7 @@ namespace boost { namespace geometry namespace formula_dispatch { -template ::type> +template > struct eccentricity_sqr : not_implemented {}; diff --git a/include/boost/geometry/formulas/flattening.hpp b/include/boost/geometry/formulas/flattening.hpp index f94ead65b..98f498b69 100644 --- a/include/boost/geometry/formulas/flattening.hpp +++ b/include/boost/geometry/formulas/flattening.hpp @@ -24,7 +24,7 @@ namespace boost { namespace geometry namespace formula_dispatch { -template ::type> +template > struct flattening : not_implemented {}; diff --git a/include/boost/geometry/formulas/geographic.hpp b/include/boost/geometry/formulas/geographic.hpp index cc726876a..2fa45d8da 100644 --- a/include/boost/geometry/formulas/geographic.hpp +++ b/include/boost/geometry/formulas/geographic.hpp @@ -35,7 +35,7 @@ namespace formula { template inline Point3d geo_to_cart3d(PointGeo const& point_geo, Spheroid const& spheroid) { - typedef typename coordinate_type::type calc_t; + using calc_t = coordinate_type_t; calc_t const c1 = 1; calc_t const e_sqr = eccentricity_sqr(spheroid); @@ -61,7 +61,7 @@ inline Point3d geo_to_cart3d(PointGeo const& point_geo, Spheroid const& spheroid template inline void geo_to_cart3d(PointGeo const& point_geo, Point3d & result, Point3d & north, Point3d & east, Spheroid const& spheroid) { - typedef typename coordinate_type::type calc_t; + using calc_t = coordinate_type_t; calc_t const c1 = 1; calc_t const e_sqr = eccentricity_sqr(spheroid); @@ -94,8 +94,8 @@ inline void geo_to_cart3d(PointGeo const& point_geo, Point3d & result, Point3d & template inline PointGeo cart3d_to_geo(Point3d const& point_3d, Spheroid const& spheroid) { - typedef typename coordinate_type::type coord_t; - typedef typename coordinate_type::type calc_t; + using coord_t = coordinate_type_t; + using calc_t = coordinate_type_t; calc_t const c1 = 1; //calc_t const c2 = 2; @@ -128,7 +128,7 @@ inline PointGeo cart3d_to_geo(Point3d const& point_3d, Spheroid const& spheroid) math::normalize_spheroidal_coordinates < - typename coordinate_system::type::units, + geometry::detail::coordinate_system_units_t, coord_t >(lon, lat); @@ -141,7 +141,7 @@ inline PointGeo cart3d_to_geo(Point3d const& point_3d, Spheroid const& spheroid) template inline Point3d projected_to_xy(Point3d const& point_3d, Spheroid const& spheroid) { - typedef typename coordinate_type::type coord_t; + using coord_t = coordinate_type_t; // len_xy = sqrt(x^2 + y^2) // r = len_xy - |z / tan(lat)| @@ -167,7 +167,7 @@ inline Point3d projected_to_xy(Point3d const& point_3d, Spheroid const& spheroid template inline Point3d projected_to_surface(Point3d const& direction, Spheroid const& spheroid) { - typedef typename coordinate_type::type coord_t; + using coord_t = coordinate_type_t; //coord_t const c0 = 0; coord_t const c2 = 2; @@ -206,7 +206,7 @@ inline bool projected_to_surface(Point3d const& origin, Point3d const& direction Point3d & result1, Point3d & result2, Spheroid const& spheroid) { - typedef typename coordinate_type::type coord_t; + using coord_t = coordinate_type_t; coord_t const c0 = 0; coord_t const c1 = 1; @@ -265,7 +265,7 @@ inline bool great_elliptic_intersection(Point3d const& a1, Point3d const& a2, Point3d & result, Spheroid const& spheroid) { - typedef typename coordinate_type::type coord_t; + using coord_t = coordinate_type_t; coord_t c0 = 0; coord_t c1 = 1; @@ -308,7 +308,7 @@ inline bool great_elliptic_intersection(Point3d const& a1, Point3d const& a2, template static inline int elliptic_side_value(Point3d1 const& origin, Point3d1 const& norm, Point3d2 const& pt) { - typedef typename coordinate_type::type calc_t; + using calc_t = coordinate_type_t; calc_t c0 = 0; // vector oposite to pt - origin @@ -330,7 +330,7 @@ inline bool planes_spheroid_intersection(Point3d const& o1, Point3d const& n1, Point3d & ip1, Point3d & ip2, Spheroid const& spheroid) { - typedef typename coordinate_type::type coord_t; + using coord_t = coordinate_type_t; coord_t c0 = 0; coord_t c1 = 1; @@ -381,7 +381,7 @@ inline void experimental_elliptic_plane(Point3d const& p1, Point3d const& p2, Point3d & origin, Point3d & normal, Spheroid const& spheroid) { - typedef typename coordinate_type::type coord_t; + using coord_t = coordinate_type_t; Point3d xy1 = projected_to_xy(p1, spheroid); Point3d xy2 = projected_to_xy(p2, spheroid); @@ -416,7 +416,7 @@ inline bool experimental_elliptic_intersection(Point3d const& a1, Point3d const& Point3d & result, Spheroid const& spheroid) { - typedef typename coordinate_type::type coord_t; + using coord_t = coordinate_type_t; coord_t c0 = 0; coord_t c1 = 1; diff --git a/include/boost/geometry/formulas/mean_radius.hpp b/include/boost/geometry/formulas/mean_radius.hpp index 83c9b5403..f5f4c8c1d 100644 --- a/include/boost/geometry/formulas/mean_radius.hpp +++ b/include/boost/geometry/formulas/mean_radius.hpp @@ -24,7 +24,7 @@ namespace boost { namespace geometry namespace formula_dispatch { -template ::type> +template > struct mean_radius : not_implemented {}; diff --git a/include/boost/geometry/formulas/meridian_inverse.hpp b/include/boost/geometry/formulas/meridian_inverse.hpp index c21196f5c..808f31508 100644 --- a/include/boost/geometry/formulas/meridian_inverse.hpp +++ b/include/boost/geometry/formulas/meridian_inverse.hpp @@ -113,8 +113,8 @@ public : template static CT apply(T lat, Spheroid const& spheroid) { - CT const a = get_radius<0>(spheroid); - CT const f = formula::flattening(spheroid); + CT const a = geometry::get_radius<0>(spheroid); + CT const f = flattening(spheroid); CT n = f / (CT(2) - f); CT M = a/(1+n); CT C0 = 1; diff --git a/include/boost/geometry/formulas/quarter_meridian.hpp b/include/boost/geometry/formulas/quarter_meridian.hpp index 5aa10cc87..f6dd74d82 100644 --- a/include/boost/geometry/formulas/quarter_meridian.hpp +++ b/include/boost/geometry/formulas/quarter_meridian.hpp @@ -29,7 +29,7 @@ namespace boost { namespace geometry namespace formula_dispatch { -template ::type> +template > struct quarter_meridian : not_implemented {}; diff --git a/include/boost/geometry/formulas/sjoberg_intersection.hpp b/include/boost/geometry/formulas/sjoberg_intersection.hpp index af56f285f..ea7400039 100644 --- a/include/boost/geometry/formulas/sjoberg_intersection.hpp +++ b/include/boost/geometry/formulas/sjoberg_intersection.hpp @@ -1,6 +1,6 @@ // Boost.Geometry -// Copyright (c) 2023 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2023-2025 Adam Wulkiewicz, Lodz, Poland. // Copyright (c) 2016-2019 Oracle and/or its affiliates. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle @@ -566,7 +566,6 @@ public: { CT const c0 = 0; CT const dLj = d_lambda(c0); - CT const asin_tj_t0j = asin(Cj * tan_betaj / sqrt_1_Cj_sqr); return lonj - asin_tj_t0j + dLj; } @@ -676,8 +675,8 @@ public: CT const f = formula::flattening(spheroid); CT const one_minus_f = c1 - f; - geodesic_type geod1(lon_a1, lat_a1, alpha_a1, f); - geodesic_type geod2(lon_b1, lat_b1, alpha_b1, f); + geodesic_type const geod1(lon_a1, lat_a1, alpha_a1, f); + geodesic_type const geod2(lon_b1, lat_b1, alpha_b1, f); // Cj = 1 if on equator <=> sqrt_1_Cj_sqr = 0 // Cj = 0 if vertical <=> sqrt_1_Cj_sqr = 1 diff --git a/include/boost/geometry/formulas/spherical.hpp b/include/boost/geometry/formulas/spherical.hpp index 3a388bfbc..8b26251ea 100644 --- a/include/boost/geometry/formulas/spherical.hpp +++ b/include/boost/geometry/formulas/spherical.hpp @@ -56,7 +56,7 @@ static inline void sph_to_cart3d(T const& lon, T const& lat, T & x, T & y, T & z template static inline Point3d sph_to_cart3d(PointSph const& point_sph) { - typedef typename coordinate_type::type calc_t; + using calc_t = coordinate_type_t; calc_t const lon = get_as_radian<0>(point_sph); calc_t const lat = get_as_radian<1>(point_sph); @@ -81,8 +81,8 @@ static inline void cart3d_to_sph(T const& x, T const& y, T const& z, T & lon, T template static inline PointSph cart3d_to_sph(Point3d const& point_3d) { - typedef typename coordinate_type::type coord_t; - typedef typename coordinate_type::type calc_t; + using coord_t = coordinate_type_t; + using calc_t = coordinate_type_t; calc_t const x = get<0>(point_3d); calc_t const y = get<1>(point_3d); diff --git a/include/boost/geometry/formulas/vincenty_inverse.hpp b/include/boost/geometry/formulas/vincenty_inverse.hpp index 7789e17e9..b2f2500ff 100644 --- a/include/boost/geometry/formulas/vincenty_inverse.hpp +++ b/include/boost/geometry/formulas/vincenty_inverse.hpp @@ -98,7 +98,7 @@ public: CT const radius_a = CT(get_radius<0>(spheroid)); CT const radius_b = CT(get_radius<2>(spheroid)); - CT const f = formula::flattening(spheroid); + CT const f = flattening(spheroid); // U: reduced latitude, defined by tan U = (1-f) tan phi CT const one_min_f = c1 - f; diff --git a/include/boost/geometry/geometries/adapted/boost_array.hpp b/include/boost/geometry/geometries/adapted/boost_array.hpp index 7bd6aeae9..ebee8eb9f 100644 --- a/include/boost/geometry/geometries/adapted/boost_array.hpp +++ b/include/boost/geometry/geometries/adapted/boost_array.hpp @@ -54,14 +54,14 @@ namespace detail template struct boost_array_tag { - typedef geometry_not_recognized_tag type; + using type = geometry_not_recognized_tag; }; template <> struct boost_array_tag { - typedef point_tag type; + using type = point_tag; }; diff --git a/include/boost/geometry/geometries/adapted/boost_fusion.hpp b/include/boost/geometry/geometries/adapted/boost_fusion.hpp index 85c823631..b73b7ad58 100644 --- a/include/boost/geometry/geometries/adapted/boost_fusion.hpp +++ b/include/boost/geometry/geometries/adapted/boost_fusion.hpp @@ -140,7 +140,7 @@ struct access > > { - typedef typename coordinate_type::type ctype; + using ctype = coordinate_type_t; static inline ctype get(Sequence const& point) { @@ -165,7 +165,7 @@ struct tag > > { - typedef point_tag type; + using type = point_tag; }; diff --git a/include/boost/geometry/geometries/adapted/boost_polygon/box.hpp b/include/boost/geometry/geometries/adapted/boost_polygon/box.hpp index 87c3b6065..eafda0939 100644 --- a/include/boost/geometry/geometries/adapted/boost_polygon/box.hpp +++ b/include/boost/geometry/geometries/adapted/boost_polygon/box.hpp @@ -34,7 +34,7 @@ namespace traits template struct tag > { - typedef box_tag type; + using type = box_tag; }; diff --git a/include/boost/geometry/geometries/adapted/boost_polygon/point.hpp b/include/boost/geometry/geometries/adapted/boost_polygon/point.hpp index 8b14ce133..99940ee44 100644 --- a/include/boost/geometry/geometries/adapted/boost_polygon/point.hpp +++ b/include/boost/geometry/geometries/adapted/boost_polygon/point.hpp @@ -40,21 +40,21 @@ namespace traits template struct tag > { - typedef point_tag type; + using type = point_tag; }; template struct coordinate_type > { - typedef CoordinateType type; + using type = CoordinateType; }; template struct coordinate_system > { - typedef cs::cartesian type; + using type = cs::cartesian; }; diff --git a/include/boost/geometry/geometries/adapted/boost_polygon/polygon.hpp b/include/boost/geometry/geometries/adapted/boost_polygon/polygon.hpp index 5703601e0..ba6877846 100644 --- a/include/boost/geometry/geometries/adapted/boost_polygon/polygon.hpp +++ b/include/boost/geometry/geometries/adapted/boost_polygon/polygon.hpp @@ -35,7 +35,7 @@ namespace traits template struct tag > { - typedef polygon_tag type; + using type = polygon_tag; }; template diff --git a/include/boost/geometry/geometries/adapted/boost_polygon/ring.hpp b/include/boost/geometry/geometries/adapted/boost_polygon/ring.hpp index 490fa45fe..2c2636f29 100644 --- a/include/boost/geometry/geometries/adapted/boost_polygon/ring.hpp +++ b/include/boost/geometry/geometries/adapted/boost_polygon/ring.hpp @@ -34,7 +34,7 @@ namespace traits template struct tag > { - typedef ring_tag type; + using type = ring_tag; }; template diff --git a/include/boost/geometry/geometries/adapted/boost_polygon/ring_proxy.hpp b/include/boost/geometry/geometries/adapted/boost_polygon/ring_proxy.hpp index ca54ec6af..f79a995e8 100644 --- a/include/boost/geometry/geometries/adapted/boost_polygon/ring_proxy.hpp +++ b/include/boost/geometry/geometries/adapted/boost_polygon/ring_proxy.hpp @@ -243,7 +243,7 @@ namespace traits template struct tag > { - typedef ring_tag type; + using type = ring_tag; }; diff --git a/include/boost/geometry/geometries/adapted/boost_range/adjacent_filtered.hpp b/include/boost/geometry/geometries/adapted/boost_range/adjacent_filtered.hpp index 496dbeaec..25ed05f40 100644 --- a/include/boost/geometry/geometries/adapted/boost_range/adjacent_filtered.hpp +++ b/include/boost/geometry/geometries/adapted/boost_range/adjacent_filtered.hpp @@ -29,7 +29,7 @@ struct tag > struct tag > #endif { - typedef typename geometry::tag::type type; + using type = geometry::tag_t; }; } diff --git a/include/boost/geometry/geometries/adapted/boost_range/filtered.hpp b/include/boost/geometry/geometries/adapted/boost_range/filtered.hpp index 990d60846..634c5bb7d 100644 --- a/include/boost/geometry/geometries/adapted/boost_range/filtered.hpp +++ b/include/boost/geometry/geometries/adapted/boost_range/filtered.hpp @@ -29,7 +29,7 @@ struct tag > struct tag > #endif { - typedef typename geometry::tag::type type; + using type = geometry::tag_t; }; } diff --git a/include/boost/geometry/geometries/adapted/boost_range/reversed.hpp b/include/boost/geometry/geometries/adapted/boost_range/reversed.hpp index 3c8601fe1..a73f8c7c3 100644 --- a/include/boost/geometry/geometries/adapted/boost_range/reversed.hpp +++ b/include/boost/geometry/geometries/adapted/boost_range/reversed.hpp @@ -29,7 +29,7 @@ struct tag > struct tag > #endif { - typedef typename geometry::tag::type type; + using type = geometry::tag_t; }; } diff --git a/include/boost/geometry/geometries/adapted/boost_range/sliced.hpp b/include/boost/geometry/geometries/adapted/boost_range/sliced.hpp index 70189819c..c151e5518 100644 --- a/include/boost/geometry/geometries/adapted/boost_range/sliced.hpp +++ b/include/boost/geometry/geometries/adapted/boost_range/sliced.hpp @@ -25,7 +25,7 @@ namespace traits template struct tag > { - typedef typename geometry::tag::type type; + using type = geometry::tag_t; }; } diff --git a/include/boost/geometry/geometries/adapted/boost_range/strided.hpp b/include/boost/geometry/geometries/adapted/boost_range/strided.hpp index 5c9cdd6a8..b72fdade1 100644 --- a/include/boost/geometry/geometries/adapted/boost_range/strided.hpp +++ b/include/boost/geometry/geometries/adapted/boost_range/strided.hpp @@ -25,7 +25,7 @@ namespace traits template struct tag > { - typedef typename geometry::tag::type type; + using type = geometry::tag_t; }; } diff --git a/include/boost/geometry/geometries/adapted/boost_range/uniqued.hpp b/include/boost/geometry/geometries/adapted/boost_range/uniqued.hpp index beb51fe0b..880844dd0 100644 --- a/include/boost/geometry/geometries/adapted/boost_range/uniqued.hpp +++ b/include/boost/geometry/geometries/adapted/boost_range/uniqued.hpp @@ -29,7 +29,7 @@ struct tag > struct tag > #endif { - typedef typename geometry::tag::type type; + using type = geometry::tag_t; }; } diff --git a/include/boost/geometry/geometries/adapted/boost_tuple.hpp b/include/boost/geometry/geometries/adapted/boost_tuple.hpp index 84d6eb398..ac2b74cde 100644 --- a/include/boost/geometry/geometries/adapted/boost_tuple.hpp +++ b/include/boost/geometry/geometries/adapted/boost_tuple.hpp @@ -45,7 +45,7 @@ template struct tag > { - typedef point_tag type; + using type = point_tag; }; diff --git a/include/boost/geometry/geometries/adapted/c_array.hpp b/include/boost/geometry/geometries/adapted/c_array.hpp index c66ea2362..6251e9d2d 100644 --- a/include/boost/geometry/geometries/adapted/c_array.hpp +++ b/include/boost/geometry/geometries/adapted/c_array.hpp @@ -46,14 +46,14 @@ namespace detail template struct c_array_tag { - typedef geometry_not_recognized_tag type; + using type = geometry_not_recognized_tag; }; template <> struct c_array_tag { - typedef point_tag type; + using type = point_tag; }; diff --git a/include/boost/geometry/geometries/adapted/std_array.hpp b/include/boost/geometry/geometries/adapted/std_array.hpp index dfbd179d6..50f93cfee 100644 --- a/include/boost/geometry/geometries/adapted/std_array.hpp +++ b/include/boost/geometry/geometries/adapted/std_array.hpp @@ -51,14 +51,14 @@ namespace detail template struct std_array_tag { - typedef geometry_not_recognized_tag type; + using type = geometry_not_recognized_tag; }; template <> struct std_array_tag { - typedef point_tag type; + using type = point_tag; }; diff --git a/include/boost/geometry/geometries/adapted/std_pair_as_segment.hpp b/include/boost/geometry/geometries/adapted/std_pair_as_segment.hpp index e9200e0fd..cf2ebea9c 100644 --- a/include/boost/geometry/geometries/adapted/std_pair_as_segment.hpp +++ b/include/boost/geometry/geometries/adapted/std_pair_as_segment.hpp @@ -45,7 +45,7 @@ namespace traits template struct tag > { - typedef segment_tag type; + using type = segment_tag; }; template @@ -57,7 +57,7 @@ struct point_type > template struct indexed_access, 0, Dimension> { - typedef typename geometry::coordinate_type::type coordinate_type; + using coordinate_type = geometry::coordinate_type_t; static inline coordinate_type get(std::pair const& s) { @@ -74,7 +74,7 @@ struct indexed_access, 0, Dimension> template struct indexed_access, 1, Dimension> { - typedef typename geometry::coordinate_type::type coordinate_type; + using coordinate_type = geometry::coordinate_type_t; static inline coordinate_type get(std::pair const& s) { diff --git a/include/boost/geometry/geometries/box.hpp b/include/boost/geometry/geometries/box.hpp index d773129af..bab4695de 100644 --- a/include/boost/geometry/geometries/box.hpp +++ b/include/boost/geometry/geometries/box.hpp @@ -192,7 +192,7 @@ namespace traits template struct tag > { - typedef box_tag type; + using type = box_tag; }; template @@ -204,7 +204,7 @@ struct point_type > template struct indexed_access, min_corner, Dimension> { - typedef typename geometry::coordinate_type::type coordinate_type; + using coordinate_type = geometry::coordinate_type_t; static constexpr coordinate_type get(model::box const& b) { @@ -220,7 +220,7 @@ struct indexed_access, min_corner, Dimension> template struct indexed_access, max_corner, Dimension> { - typedef typename geometry::coordinate_type::type coordinate_type; + using coordinate_type = geometry::coordinate_type_t; static constexpr coordinate_type get(model::box const& b) { diff --git a/include/boost/geometry/geometries/concepts/concept_type.hpp b/include/boost/geometry/geometries/concepts/concept_type.hpp index 36b7ee1bb..5418fbabf 100644 --- a/include/boost/geometry/geometries/concepts/concept_type.hpp +++ b/include/boost/geometry/geometries/concepts/concept_type.hpp @@ -18,7 +18,7 @@ namespace boost { namespace geometry { namespace concepts { -template ::type> +template > struct concept_type { BOOST_GEOMETRY_STATIC_ASSERT_FALSE("Not implemented for this Tag.", Tag); diff --git a/include/boost/geometry/geometries/concepts/geometry_collection_concept.hpp b/include/boost/geometry/geometries/concepts/geometry_collection_concept.hpp index 7d232c145..a12549d80 100644 --- a/include/boost/geometry/geometries/concepts/geometry_collection_concept.hpp +++ b/include/boost/geometry/geometries/concepts/geometry_collection_concept.hpp @@ -47,7 +47,7 @@ template < typename Geometry, typename SubGeometry, - typename Tag = typename tag::type, + typename Tag = tag_t, bool IsSubDynamicOrCollection = util::is_dynamic_geometry::value || util::is_geometry_collection::value > diff --git a/include/boost/geometry/geometries/concepts/point_concept.hpp b/include/boost/geometry/geometries/concepts/point_concept.hpp index dbe004a58..bf05f02f7 100644 --- a/include/boost/geometry/geometries/concepts/point_concept.hpp +++ b/include/boost/geometry/geometries/concepts/point_concept.hpp @@ -40,8 +40,8 @@ class Point { #ifndef DOXYGEN_NO_CONCEPT_MEMBERS - typedef typename coordinate_type::type ctype; - typedef typename coordinate_system::type csystem; + using ctype = coordinate_type_t; + using csystem = coordinate_system_t; // 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 typename coordinate_type::type ctype; - typedef typename coordinate_system::type csystem; + using ctype = coordinate_type_t; + using csystem = coordinate_system_t; // The following enum is used to fully instantiate the coordinate // system class; this is needed in order to check the units passed diff --git a/include/boost/geometry/geometries/helper_geometry.hpp b/include/boost/geometry/geometries/helper_geometry.hpp index 6cade9723..609b855dd 100644 --- a/include/boost/geometry/geometries/helper_geometry.hpp +++ b/include/boost/geometry/geometries/helper_geometry.hpp @@ -48,7 +48,7 @@ struct helper_point < NewCoordinateType, dimension::value, - typename cs_tag_to_coordinate_system::type + cs_tag_to_coordinate_system_t > type; }; @@ -65,7 +65,8 @@ template typename Geometry, typename NewCoordinateType, typename NewUnits, - typename Tag = typename tag::type> + typename Tag = tag_t +> struct helper_geometry : not_implemented {}; @@ -129,7 +130,7 @@ struct helper_geometry template < typename Geometry, - typename NewCoordinateType = typename coordinate_type::type, + typename NewCoordinateType = coordinate_type_t, typename NewUnits = typename detail::cs_angular_units::type > struct helper_geometry diff --git a/include/boost/geometry/geometries/linestring.hpp b/include/boost/geometry/geometries/linestring.hpp index 37d3edd16..941b7fd32 100644 --- a/include/boost/geometry/geometries/linestring.hpp +++ b/include/boost/geometry/geometries/linestring.hpp @@ -108,7 +108,7 @@ template > struct tag > { - typedef linestring_tag type; + using type = linestring_tag; }; } // namespace traits diff --git a/include/boost/geometry/geometries/multi_linestring.hpp b/include/boost/geometry/geometries/multi_linestring.hpp index 79b59efeb..89257f90a 100644 --- a/include/boost/geometry/geometries/multi_linestring.hpp +++ b/include/boost/geometry/geometries/multi_linestring.hpp @@ -102,7 +102,7 @@ template > struct tag< model::multi_linestring > { - typedef multi_linestring_tag type; + using type = multi_linestring_tag; }; } // namespace traits diff --git a/include/boost/geometry/geometries/multi_point.hpp b/include/boost/geometry/geometries/multi_point.hpp index 1458d57a4..0b4274cb5 100644 --- a/include/boost/geometry/geometries/multi_point.hpp +++ b/include/boost/geometry/geometries/multi_point.hpp @@ -108,7 +108,7 @@ template > struct tag< model::multi_point > { - typedef multi_point_tag type; + using type = multi_point_tag; }; } // namespace traits diff --git a/include/boost/geometry/geometries/multi_polygon.hpp b/include/boost/geometry/geometries/multi_polygon.hpp index 87ada7fc7..b152124cb 100644 --- a/include/boost/geometry/geometries/multi_polygon.hpp +++ b/include/boost/geometry/geometries/multi_polygon.hpp @@ -102,7 +102,7 @@ template > struct tag< model::multi_polygon > { - typedef multi_polygon_tag type; + using type = multi_polygon_tag; }; } // namespace traits diff --git a/include/boost/geometry/geometries/point.hpp b/include/boost/geometry/geometries/point.hpp index 2671bf4cd..9ca7c6589 100644 --- a/include/boost/geometry/geometries/point.hpp +++ b/include/boost/geometry/geometries/point.hpp @@ -240,7 +240,7 @@ template > struct tag > { - typedef point_tag type; + using type = point_tag; }; template diff --git a/include/boost/geometry/geometries/point_xy.hpp b/include/boost/geometry/geometries/point_xy.hpp index 09b54c18f..3cf6c0efd 100644 --- a/include/boost/geometry/geometries/point_xy.hpp +++ b/include/boost/geometry/geometries/point_xy.hpp @@ -85,7 +85,7 @@ namespace traits template struct tag > { - typedef point_tag type; + using type = point_tag; }; template diff --git a/include/boost/geometry/geometries/point_xyz.hpp b/include/boost/geometry/geometries/point_xyz.hpp index d346b28a5..ac3134aad 100644 --- a/include/boost/geometry/geometries/point_xyz.hpp +++ b/include/boost/geometry/geometries/point_xyz.hpp @@ -88,7 +88,7 @@ namespace traits template struct tag > { - typedef point_tag type; + using type = point_tag; }; template diff --git a/include/boost/geometry/geometries/pointing_segment.hpp b/include/boost/geometry/geometries/pointing_segment.hpp index fd7f110d2..48c8adfa6 100644 --- a/include/boost/geometry/geometries/pointing_segment.hpp +++ b/include/boost/geometry/geometries/pointing_segment.hpp @@ -78,23 +78,20 @@ namespace traits template struct tag > { - typedef segment_tag type; + using type = segment_tag; }; template struct point_type > { - typedef Point type; + using type = Point; }; template struct indexed_access, 0, Dimension> { - typedef model::pointing_segment segment_type; - typedef typename geometry::coordinate_type - < - segment_type - >::type coordinate_type; + using segment_type = model::pointing_segment; + using coordinate_type = geometry::coordinate_type_t; static inline coordinate_type get(segment_type const& s) { @@ -113,11 +110,8 @@ struct indexed_access, 0, Dimension> template struct indexed_access, 1, Dimension> { - typedef model::pointing_segment segment_type; - typedef typename geometry::coordinate_type - < - segment_type - >::type coordinate_type; + using segment_type = model::pointing_segment; + using coordinate_type = geometry::coordinate_type_t; static inline coordinate_type get(segment_type const& s) { diff --git a/include/boost/geometry/geometries/polygon.hpp b/include/boost/geometry/geometries/polygon.hpp index 4857c001a..5d9d72c40 100644 --- a/include/boost/geometry/geometries/polygon.hpp +++ b/include/boost/geometry/geometries/polygon.hpp @@ -166,7 +166,7 @@ struct tag > > { - typedef polygon_tag type; + using type = polygon_tag; }; template diff --git a/include/boost/geometry/geometries/register/box.hpp b/include/boost/geometry/geometries/register/box.hpp index 71a7077a6..92b71c90b 100644 --- a/include/boost/geometry/geometries/register/box.hpp +++ b/include/boost/geometry/geometries/register/box.hpp @@ -23,7 +23,7 @@ template \ struct indexed_access \ { \ - typedef typename coordinate_type::type ct; \ + using ct = coordinate_type_t; \ static inline ct get(Box const& b) \ { return geometry::get(b. MinCorner); } \ static inline void set(Box& b, ct const& value) \ @@ -32,7 +32,7 @@ struct indexed_access \ template \ struct indexed_access \ { \ - typedef typename coordinate_type::type ct; \ + using ct = coordinate_type_t; \ static inline ct get(Box const& b) \ { return geometry::get(b. MaxCorner); } \ static inline void set(Box& b, ct const& value) \ @@ -44,7 +44,7 @@ struct indexed_access \ template \ struct indexed_access, min_corner, D> \ { \ - typedef typename coordinate_type

::type ct; \ + using ct = coordinate_type_t

; \ static inline ct get(Box

const& b) \ { return geometry::get(b. MinCorner); } \ static inline void set(Box

& b, ct const& value) \ @@ -53,7 +53,7 @@ struct indexed_access, min_corner, D> \ template \ struct indexed_access, max_corner, D> \ { \ - typedef typename coordinate_type

::type ct; \ + using ct = coordinate_type_t

; \ static inline ct get(Box

const& b) \ { return geometry::get(b. MaxCorner); } \ static inline void set(Box

& b, ct const& value) \ @@ -64,25 +64,25 @@ struct indexed_access, max_corner, D> \ #define BOOST_GEOMETRY_DETAIL_SPECIALIZE_BOX_ACCESS_4VALUES(Box, Point, Left, Bottom, Right, Top) \ template <> struct indexed_access \ { \ - typedef coordinate_type::type ct; \ + using ct = coordinate_type_t; \ static inline ct get(Box const& b) { return b. Left; } \ static inline void set(Box& b, ct const& value) { b. Left = value; } \ }; \ template <> struct indexed_access \ { \ - typedef coordinate_type::type ct; \ + using ct = coordinate_type_t; \ static inline ct get(Box const& b) { return b. Bottom; } \ static inline void set(Box& b, ct const& value) { b. Bottom = value; } \ }; \ template <> struct indexed_access \ { \ - typedef coordinate_type::type ct; \ + using ct = coordinate_type_t; \ static inline ct get(Box const& b) { return b. Right; } \ static inline void set(Box& b, ct const& value) { b. Right = value; } \ }; \ template <> struct indexed_access \ { \ - typedef coordinate_type::type ct; \ + using ct = coordinate_type_t; \ static inline ct get(Box const& b) { return b. Top; } \ static inline void set(Box& b, ct const& value) { b. Top = value; } \ }; @@ -91,11 +91,11 @@ template <> struct indexed_access \ #define BOOST_GEOMETRY_DETAIL_SPECIALIZE_BOX_TRAITS(Box, PointType) \ - template<> struct tag { typedef box_tag type; }; \ + template<> struct tag { using type = box_tag; }; \ template<> struct point_type { typedef PointType type; }; #define BOOST_GEOMETRY_DETAIL_SPECIALIZE_BOX_TRAITS_TEMPLATED(Box) \ - template struct tag > { typedef box_tag type; }; \ + template struct tag > { using type = box_tag; }; \ template struct point_type > { typedef P type; }; #endif // DOXYGEN_NO_SPECIALIZATIONS diff --git a/include/boost/geometry/geometries/register/linestring.hpp b/include/boost/geometry/geometries/register/linestring.hpp index cfc7dcaed..8394063cb 100644 --- a/include/boost/geometry/geometries/register/linestring.hpp +++ b/include/boost/geometry/geometries/register/linestring.hpp @@ -34,7 +34,7 @@ */ #define BOOST_GEOMETRY_REGISTER_LINESTRING(Linestring) \ namespace boost { namespace geometry { namespace traits { \ - template<> struct tag { typedef linestring_tag type; }; \ + template<> struct tag { using type = linestring_tag; }; \ }}} @@ -53,7 +53,7 @@ namespace boost { namespace geometry { namespace traits { \ */ #define BOOST_GEOMETRY_REGISTER_LINESTRING_TEMPLATED(Linestring) \ namespace boost { namespace geometry { namespace traits { \ - template struct tag< Linestring

> { typedef linestring_tag type; }; \ + template struct tag< Linestring

> { using type = linestring_tag; }; \ }}} diff --git a/include/boost/geometry/geometries/register/multi_linestring.hpp b/include/boost/geometry/geometries/register/multi_linestring.hpp index ad11289d1..f0f7b6e0a 100644 --- a/include/boost/geometry/geometries/register/multi_linestring.hpp +++ b/include/boost/geometry/geometries/register/multi_linestring.hpp @@ -33,7 +33,7 @@ */ #define BOOST_GEOMETRY_REGISTER_MULTI_LINESTRING(MultiLineString) \ namespace boost { namespace geometry { namespace traits { \ - template<> struct tag { typedef multi_linestring_tag type; }; \ + template<> struct tag { using type = multi_linestring_tag; }; \ }}} @@ -52,7 +52,7 @@ namespace boost { namespace geometry { namespace traits { \ */ #define BOOST_GEOMETRY_REGISTER_MULTI_LINESTRING_TEMPLATED(MultiLineString) \ namespace boost { namespace geometry { namespace traits { \ - template struct tag< MultiLineString > { typedef multi_linestring_tag type; }; \ + template struct tag< MultiLineString > { using type = multi_linestring_tag; }; \ }}} diff --git a/include/boost/geometry/geometries/register/multi_point.hpp b/include/boost/geometry/geometries/register/multi_point.hpp index 4e875ae0c..f4b3aeeb3 100644 --- a/include/boost/geometry/geometries/register/multi_point.hpp +++ b/include/boost/geometry/geometries/register/multi_point.hpp @@ -33,7 +33,7 @@ */ #define BOOST_GEOMETRY_REGISTER_MULTI_POINT(MultiPoint) \ namespace boost { namespace geometry { namespace traits { \ - template<> struct tag { typedef multi_point_tag type; }; \ + template<> struct tag { using type = multi_point_tag; }; \ }}} @@ -52,7 +52,7 @@ namespace boost { namespace geometry { namespace traits { \ */ #define BOOST_GEOMETRY_REGISTER_MULTI_POINT_TEMPLATED(MultiPoint) \ namespace boost { namespace geometry { namespace traits { \ - template struct tag< MultiPoint > { typedef multi_point_tag type; }; \ + template struct tag< MultiPoint > { using type = multi_point_tag; }; \ }}} diff --git a/include/boost/geometry/geometries/register/multi_polygon.hpp b/include/boost/geometry/geometries/register/multi_polygon.hpp index 1c3818b55..80ee97b9d 100644 --- a/include/boost/geometry/geometries/register/multi_polygon.hpp +++ b/include/boost/geometry/geometries/register/multi_polygon.hpp @@ -33,7 +33,7 @@ */ #define BOOST_GEOMETRY_REGISTER_MULTI_POLYGON(MultiPolygon) \ namespace boost { namespace geometry { namespace traits { \ - template<> struct tag { typedef multi_polygon_tag type; }; \ + template<> struct tag { using type = multi_polygon_tag; }; \ }}} @@ -52,7 +52,7 @@ namespace boost { namespace geometry { namespace traits { \ */ #define BOOST_GEOMETRY_REGISTER_MULTI_POLYGON_TEMPLATED(MultiPolygon) \ namespace boost { namespace geometry { namespace traits { \ - template struct tag< MultiPolygon > { typedef multi_polygon_tag type; }; \ + template struct tag< MultiPolygon > { using type = multi_polygon_tag; }; \ }}} diff --git a/include/boost/geometry/geometries/register/point.hpp b/include/boost/geometry/geometries/register/point.hpp index 95a8d521d..224a03941 100644 --- a/include/boost/geometry/geometries/register/point.hpp +++ b/include/boost/geometry/geometries/register/point.hpp @@ -31,10 +31,10 @@ // Starting point, specialize basic traits necessary to register a point #define BOOST_GEOMETRY_DETAIL_SPECIALIZE_POINT_TRAITS(Point, Dim, CoordinateType, CoordinateSystem) \ - template<> struct tag { typedef point_tag type; }; \ + template<> struct tag { using type = point_tag; }; \ template<> struct dimension : std::integral_constant {}; \ - template<> struct coordinate_type { typedef CoordinateType type; }; \ - template<> struct coordinate_system { typedef CoordinateSystem type; }; + template<> struct coordinate_type { using type = CoordinateType; }; \ + template<> struct coordinate_system { using type = CoordinateSystem; }; // Specialize access class per dimension #define BOOST_GEOMETRY_DETAIL_SPECIALIZE_POINT_ACCESS(Point, Dim, CoordinateType, Get, Set) \ diff --git a/include/boost/geometry/geometries/register/ring.hpp b/include/boost/geometry/geometries/register/ring.hpp index 761e46fbc..20a2a6cc3 100644 --- a/include/boost/geometry/geometries/register/ring.hpp +++ b/include/boost/geometry/geometries/register/ring.hpp @@ -34,7 +34,7 @@ */ #define BOOST_GEOMETRY_REGISTER_RING(Ring) \ namespace boost { namespace geometry { namespace traits { \ - template<> struct tag { typedef ring_tag type; }; \ + template<> struct tag { using type = ring_tag; }; \ }}} @@ -53,7 +53,7 @@ namespace boost { namespace geometry { namespace traits { \ */ #define BOOST_GEOMETRY_REGISTER_RING_TEMPLATED(Ring) \ namespace boost { namespace geometry { namespace traits { \ - template struct tag< Ring

> { typedef ring_tag type; }; \ + template struct tag< Ring

> { using type = ring_tag; }; \ }}} diff --git a/include/boost/geometry/geometries/register/segment.hpp b/include/boost/geometry/geometries/register/segment.hpp index 6ea88c091..f83e240b9 100644 --- a/include/boost/geometry/geometries/register/segment.hpp +++ b/include/boost/geometry/geometries/register/segment.hpp @@ -23,7 +23,7 @@ template \ struct indexed_access \ { \ - typedef typename coordinate_type::type ct; \ + using ct = coordinate_type_t; \ static inline ct get(Segment const& b) \ { return geometry::get(b. Index0); } \ static inline void set(Segment& b, ct const& value) \ @@ -32,7 +32,7 @@ struct indexed_access \ template \ struct indexed_access \ { \ - typedef typename coordinate_type::type ct; \ + using ct = coordinate_type_t; \ static inline ct get(Segment const& b) \ { return geometry::get(b. Index1); } \ static inline void set(Segment& b, ct const& value) \ @@ -44,7 +44,7 @@ struct indexed_access \ template \ struct indexed_access, min_corner, D> \ { \ - typedef typename coordinate_type

::type ct; \ + using ct = coordinate_type_t

; \ static inline ct get(Segment

const& b) \ { return geometry::get(b. Index0); } \ static inline void set(Segment

& b, ct const& value) \ @@ -53,7 +53,7 @@ struct indexed_access, min_corner, D> \ template \ struct indexed_access, max_corner, D> \ { \ - typedef typename coordinate_type

::type ct; \ + using ct = coordinate_type_t

; \ static inline ct get(Segment

const& b) \ { return geometry::get(b. Index1); } \ static inline void set(Segment

& b, ct const& value) \ @@ -64,25 +64,25 @@ struct indexed_access, max_corner, D> \ #define BOOST_GEOMETRY_DETAIL_SPECIALIZE_SEGMENT_ACCESS_4VALUES(Segment, Point, Left, Bottom, Right, Top) \ template <> struct indexed_access \ { \ - typedef coordinate_type::type ct; \ + using ct = coordinate_type_t; \ static inline ct get(Segment const& b) { return b. Left; } \ static inline void set(Segment& b, ct const& value) { b. Left = value; } \ }; \ template <> struct indexed_access \ { \ - typedef coordinate_type::type ct; \ + using ct = coordinate_type_t; \ static inline ct get(Segment const& b) { return b. Bottom; } \ static inline void set(Segment& b, ct const& value) { b. Bottom = value; } \ }; \ template <> struct indexed_access \ { \ - typedef coordinate_type::type ct; \ + using ct = coordinate_type_t; \ static inline ct get(Segment const& b) { return b. Right; } \ static inline void set(Segment& b, ct const& value) { b. Right = value; } \ }; \ template <> struct indexed_access \ { \ - typedef coordinate_type::type ct; \ + using ct = coordinate_type_t; \ static inline ct get(Segment const& b) { return b. Top; } \ static inline void set(Segment& b, ct const& value) { b. Top = value; } \ }; @@ -91,11 +91,11 @@ template <> struct indexed_access \ #define BOOST_GEOMETRY_DETAIL_SPECIALIZE_SEGMENT_TRAITS(Segment, PointType) \ - template<> struct tag { typedef segment_tag type; }; \ + template<> struct tag { using type = segment_tag; }; \ template<> struct point_type { typedef PointType type; }; #define BOOST_GEOMETRY_DETAIL_SPECIALIZE_SEGMENT_TRAITS_TEMPLATIZED(Segment) \ - template struct tag > { typedef segment_tag type; }; \ + template struct tag > { using type = segment_tag; }; \ template struct point_type > { typedef P type; }; #endif // DOXYGEN_NO_SPECIALIZATIONS diff --git a/include/boost/geometry/geometries/ring.hpp b/include/boost/geometry/geometries/ring.hpp index 3921e3a22..33991151b 100644 --- a/include/boost/geometry/geometries/ring.hpp +++ b/include/boost/geometry/geometries/ring.hpp @@ -114,7 +114,7 @@ template > struct tag > { - typedef ring_tag type; + using type = ring_tag; }; diff --git a/include/boost/geometry/geometries/segment.hpp b/include/boost/geometry/geometries/segment.hpp index 7195b8280..371395a60 100644 --- a/include/boost/geometry/geometries/segment.hpp +++ b/include/boost/geometry/geometries/segment.hpp @@ -124,7 +124,7 @@ namespace traits template struct tag > { - typedef segment_tag type; + using type = segment_tag; }; template @@ -137,7 +137,7 @@ template struct indexed_access, 0, Dimension> { typedef model::segment segment_type; - typedef typename geometry::coordinate_type::type coordinate_type; + using coordinate_type = geometry::coordinate_type_t; static constexpr coordinate_type get(segment_type const& s) { @@ -155,7 +155,7 @@ template struct indexed_access, 1, Dimension> { typedef model::segment segment_type; - typedef typename geometry::coordinate_type::type coordinate_type; + using coordinate_type = geometry::coordinate_type_t; static constexpr coordinate_type get(segment_type const& s) { @@ -187,7 +187,7 @@ struct make > template struct tag > { - typedef segment_tag type; + using type = segment_tag; }; template @@ -200,7 +200,7 @@ template struct indexed_access, 0, Dimension> { typedef model::referring_segment segment_type; - typedef typename geometry::coordinate_type::type coordinate_type; + using coordinate_type = geometry::coordinate_type_t; static inline coordinate_type get(segment_type const& s) { @@ -218,7 +218,7 @@ template struct indexed_access, 1, Dimension> { typedef model::referring_segment segment_type; - typedef typename geometry::coordinate_type::type coordinate_type; + using coordinate_type = geometry::coordinate_type_t; static inline coordinate_type get(segment_type const& s) { diff --git a/include/boost/geometry/index/detail/algorithms/bounds.hpp b/include/boost/geometry/index/detail/algorithms/bounds.hpp index 616504458..f20469785 100644 --- a/include/boost/geometry/index/detail/algorithms/bounds.hpp +++ b/include/boost/geometry/index/detail/algorithms/bounds.hpp @@ -28,10 +28,13 @@ namespace boost { namespace geometry { namespace index { namespace detail namespace dispatch { -template ::type, - typename TagBounds = typename geometry::tag::type> +template +< + typename Geometry, + typename Bounds, + typename TagGeometry = geometry::tag_t, + typename TagBounds = geometry::tag_t +> struct bounds { template @@ -67,10 +70,13 @@ inline void bounds(Geometry const& g, Bounds & b, Strategy const& s) namespace dispatch { -template ::type, - typename TagGeometry = typename geometry::tag::type> +template +< + typename Bounds, + typename Geometry, + typename TagBounds = geometry::tag_t, + typename TagGeometry = geometry::tag_t +> struct expand { // STATIC ASSERT @@ -144,10 +150,13 @@ namespace dispatch { -template ::type, - typename TagBounds = typename geometry::tag::type> +template +< + typename Geometry, + typename Bounds, + typename TagGeometry = geometry::tag_t, + typename TagBounds = geometry::tag_t +> struct covered_by_bounds {}; diff --git a/include/boost/geometry/index/detail/algorithms/comparable_distance_centroid.hpp b/include/boost/geometry/index/detail/algorithms/comparable_distance_centroid.hpp index 97553f7c3..dca15d376 100644 --- a/include/boost/geometry/index/detail/algorithms/comparable_distance_centroid.hpp +++ b/include/boost/geometry/index/detail/algorithms/comparable_distance_centroid.hpp @@ -49,8 +49,8 @@ struct sum_for_indexable_dimension::type point_coord_t; - typedef typename coordinate_type::type indexable_coord_t; + using point_coord_t = coordinate_type_t; + using indexable_coord_t = coordinate_type_t; point_coord_t pt_c = geometry::get(pt); indexable_coord_t ind_c_min = geometry::get(i); @@ -69,13 +69,14 @@ template typename geometry::default_comparable_distance_result::type comparable_distance_centroid(Point const& pt, Indexable const& i) { - return detail::sum_for_indexable< - Point, - Indexable, - typename tag::type, - detail::comparable_distance_centroid_tag, - dimension::value - >::apply(pt, i); + return detail::sum_for_indexable + < + Point, + Indexable, + tag_t, + detail::comparable_distance_centroid_tag, + dimension::value + >::apply(pt, i); } }}}} // namespace boost::geometry::index::detail diff --git a/include/boost/geometry/index/detail/algorithms/comparable_distance_far.hpp b/include/boost/geometry/index/detail/algorithms/comparable_distance_far.hpp index 102ac545e..9d1f1f63d 100644 --- a/include/boost/geometry/index/detail/algorithms/comparable_distance_far.hpp +++ b/include/boost/geometry/index/detail/algorithms/comparable_distance_far.hpp @@ -37,8 +37,8 @@ struct sum_for_indexable_dimension::type point_coord_t; - typedef typename coordinate_type::type indexable_coord_t; + using point_coord_t = coordinate_type_t; + using indexable_coord_t = coordinate_type; point_coord_t pt_c = geometry::get(pt); indexable_coord_t ind_c_min = geometry::get(i); @@ -59,13 +59,14 @@ template typename geometry::default_comparable_distance_result::type comparable_distance_far(Point const& pt, Indexable const& i) { - return detail::sum_for_indexable< - Point, - Indexable, - typename tag::type, - detail::comparable_distance_far_tag, - dimension::value - >::apply(pt, i); + return detail::sum_for_indexable + < + Point, + Indexable, + tag_t, + detail::comparable_distance_far_tag, + dimension::value + >::apply(pt, i); } }}}} // namespace boost::geometry::index::detail diff --git a/include/boost/geometry/index/detail/algorithms/comparable_distance_near.hpp b/include/boost/geometry/index/detail/algorithms/comparable_distance_near.hpp index 4f2905f3a..9e479875c 100644 --- a/include/boost/geometry/index/detail/algorithms/comparable_distance_near.hpp +++ b/include/boost/geometry/index/detail/algorithms/comparable_distance_near.hpp @@ -44,12 +44,12 @@ template < size_t DimensionIndex> struct sum_for_indexable_dimension { - typedef typename geometry::default_comparable_distance_result::type result_type; + using result_type = typename geometry::default_comparable_distance_result::type; inline static result_type apply(Point const& pt, BoxIndexable const& i) { - typedef typename coordinate_type::type point_coord_t; - typedef typename coordinate_type::type indexable_coord_t; + using point_coord_t = coordinate_type_t; + using indexable_coord_t = coordinate_type_t; point_coord_t pt_c = geometry::get(pt); indexable_coord_t ind_c_min = geometry::get(i); @@ -70,13 +70,14 @@ template typename geometry::default_comparable_distance_result::type comparable_distance_near(Point const& pt, Indexable const& i) { - return detail::sum_for_indexable< - Point, - Indexable, - typename tag::type, - detail::comparable_distance_near_tag, - dimension::value - >::apply(pt, i); + return detail::sum_for_indexable + < + Point, + Indexable, + tag_t, + detail::comparable_distance_near_tag, + dimension::value + >::apply(pt, i); } }}}} // namespace boost::geometry::index::detail diff --git a/include/boost/geometry/index/detail/algorithms/content.hpp b/include/boost/geometry/index/detail/algorithms/content.hpp index f7dfe373d..2134263a1 100644 --- a/include/boost/geometry/index/detail/algorithms/content.hpp +++ b/include/boost/geometry/index/detail/algorithms/content.hpp @@ -94,7 +94,7 @@ typename default_content_result::type content(Indexable const& b) return dispatch::content < Indexable, - typename tag::type + tag_t >::apply(b); } diff --git a/include/boost/geometry/index/detail/algorithms/is_valid.hpp b/include/boost/geometry/index/detail/algorithms/is_valid.hpp index 5cd241c29..3773efad2 100644 --- a/include/boost/geometry/index/detail/algorithms/is_valid.hpp +++ b/include/boost/geometry/index/detail/algorithms/is_valid.hpp @@ -45,8 +45,7 @@ struct is_valid_box } }; -template ::type> +template > struct is_valid { BOOST_GEOMETRY_STATIC_ASSERT_FALSE( diff --git a/include/boost/geometry/index/detail/algorithms/margin.hpp b/include/boost/geometry/index/detail/algorithms/margin.hpp index dc86a511e..8a4f9fda3 100644 --- a/include/boost/geometry/index/detail/algorithms/margin.hpp +++ b/include/boost/geometry/index/detail/algorithms/margin.hpp @@ -34,7 +34,7 @@ struct default_margin_result { using type = typename select_most_precise < - typename coordinate_type::type, + coordinate_type_t, double >::type; }; @@ -168,10 +168,11 @@ struct comparable_margin template typename default_margin_result::type comparable_margin(Geometry const& g) { - return dispatch::comparable_margin< - Geometry, - typename tag::type - >::apply(g); + return dispatch::comparable_margin + < + Geometry, + tag_t + >::apply(g); } //template diff --git a/include/boost/geometry/index/detail/algorithms/minmaxdist.hpp b/include/boost/geometry/index/detail/algorithms/minmaxdist.hpp index 2f28163a1..53211c6a3 100644 --- a/include/boost/geometry/index/detail/algorithms/minmaxdist.hpp +++ b/include/boost/geometry/index/detail/algorithms/minmaxdist.hpp @@ -34,12 +34,12 @@ template < size_t DimensionIndex> struct smallest_for_indexable_dimension { - typedef typename geometry::default_comparable_distance_result::type result_type; + using result_type = typename geometry::default_comparable_distance_result::type; inline static result_type apply(Point const& pt, BoxIndexable const& i, result_type const& maxd) { - typedef typename coordinate_type::type point_coord_t; - typedef typename coordinate_type::type indexable_coord_t; + using point_coord_t = coordinate_type_t; + using indexable_coord_t = coordinate_type_t; point_coord_t pt_c = geometry::get(pt); indexable_coord_t ind_c_min = geometry::get(i); @@ -112,11 +112,12 @@ template typename geometry::default_comparable_distance_result::type minmaxdist(Point const& pt, Indexable const& i) { - return detail::minmaxdist_impl< - Point, - Indexable, - typename tag::type - >::apply(pt, i); + return detail::minmaxdist_impl + < + Point, + Indexable, + tag_t + >::apply(pt, i); } }}}} // namespace boost::geometry::index::detail diff --git a/include/boost/geometry/index/detail/algorithms/path_intersection.hpp b/include/boost/geometry/index/detail/algorithms/path_intersection.hpp index 5cf936694..23aed0adb 100644 --- a/include/boost/geometry/index/detail/algorithms/path_intersection.hpp +++ b/include/boost/geometry/index/detail/algorithms/path_intersection.hpp @@ -113,11 +113,12 @@ struct path_intersection template struct default_path_intersection_distance_type { - typedef typename dispatch::path_intersection< - Indexable, SegmentOrLinestring, - typename tag::type, - typename tag::type - >::comparable_distance_type type; + using type = typename dispatch::path_intersection + < + Indexable, SegmentOrLinestring, + tag_t, + tag_t + >::comparable_distance_type; }; template inline @@ -127,10 +128,11 @@ bool path_intersection(Indexable const& b, { // TODO check Indexable and Linestring concepts - return dispatch::path_intersection< + return dispatch::path_intersection + < Indexable, SegmentOrLinestring, - typename tag::type, - typename tag::type + tag_t, + tag_t >::apply(b, path, comparable_distance); } diff --git a/include/boost/geometry/index/detail/algorithms/segment_intersection.hpp b/include/boost/geometry/index/detail/algorithms/segment_intersection.hpp index 674d9f5f8..bed19ff25 100644 --- a/include/boost/geometry/index/detail/algorithms/segment_intersection.hpp +++ b/include/boost/geometry/index/detail/algorithms/segment_intersection.hpp @@ -32,7 +32,7 @@ namespace boost { namespace geometry { namespace index { namespace detail { // typedef typename select_most_precise< // typename select_most_precise< // typename coordinate_type::type, -// typename coordinate_type::type +// coordinate_type_t // >::type, // float // TODO - use bigger type, calculated from the size of coordinate types // >::type type; @@ -154,9 +154,10 @@ bool segment_intersection(Indexable const& b, { // TODO check Indexable and Point concepts - return dispatch::segment_intersection< + return dispatch::segment_intersection + < Indexable, Point, - typename tag::type + tag_t >::apply(b, p0, p1, relative_distance); } diff --git a/include/boost/geometry/index/detail/bounded_view.hpp b/include/boost/geometry/index/detail/bounded_view.hpp index 1ba9f37f5..1c1b24d91 100644 --- a/include/boost/geometry/index/detail/bounded_view.hpp +++ b/include/boost/geometry/index/detail/bounded_view.hpp @@ -31,7 +31,7 @@ namespace index { namespace detail { template struct bounded_view_base_cs_tag { - typedef typename Strategy::cs_tag type; + using type = typename Strategy::cs_tag; }; template @@ -45,8 +45,8 @@ template typename Geometry, typename BoundingGeometry, typename Strategy, - typename Tag = typename geometry::tag::type, - typename BoundingTag = typename geometry::tag::type, + typename Tag = geometry::tag_t, + typename BoundingTag = geometry::tag_t, typename CSTag = typename bounded_view_base_cs_tag < Geometry, BoundingGeometry, Strategy @@ -66,7 +66,7 @@ template struct bounded_view_base { public: - typedef typename geometry::coordinate_type::type coordinate_type; + using coordinate_type = geometry::coordinate_type_t; bounded_view_base(Segment const& segment, Strategy const& ) : m_segment(segment) @@ -95,7 +95,7 @@ private: template struct bounded_view_base { - typedef typename geometry::coordinate_type::type coordinate_type; + using coordinate_type = geometry::coordinate_type_t; bounded_view_base(Segment const& segment, Strategy const& strategy) { @@ -124,7 +124,7 @@ template struct bounded_view_base { public: - typedef typename geometry::coordinate_type::type coordinate_type; + using coordinate_type = geometry::coordinate_type_t; bounded_view_base(BoxIn const& box, Strategy const& ) : m_box(box) @@ -154,7 +154,7 @@ template struct bounded_view_base { public: - typedef typename geometry::coordinate_type::type coordinate_type; + using coordinate_type = geometry::coordinate_type_t; bounded_view_base(Point const& point, Strategy const& ) : m_point(point) @@ -182,8 +182,8 @@ private: template ::type, - typename BoundingTag = typename geometry::tag::type> + typename Tag = geometry::tag_t, + typename BoundingTag = geometry::tag_t> struct bounded_view : bounded_view_base { @@ -235,7 +235,7 @@ namespace traits template struct tag< index::detail::bounded_view > { - typedef box_tag type; + using type = box_tag; }; template @@ -249,7 +249,7 @@ struct indexed_access { typedef index::detail::bounded_view box_type; - typedef typename geometry::coordinate_type::type coordinate_type; + using coordinate_type = geometry::coordinate_type_t; static inline coordinate_type get(box_type const& b) { @@ -267,7 +267,7 @@ struct indexed_access { typedef index::detail::bounded_view box_type; - typedef typename geometry::coordinate_type::type coordinate_type; + using coordinate_type = geometry::coordinate_type_t; static inline coordinate_type get(box_type const& b) { diff --git a/include/boost/geometry/index/detail/is_bounding_geometry.hpp b/include/boost/geometry/index/detail/is_bounding_geometry.hpp index d14204af7..620ac5555 100644 --- a/include/boost/geometry/index/detail/is_bounding_geometry.hpp +++ b/include/boost/geometry/index/detail/is_bounding_geometry.hpp @@ -17,7 +17,7 @@ namespace boost { namespace geometry { namespace index { namespace detail { template < typename Geometry, - typename Tag = typename geometry::tag::type + typename Tag = geometry::tag_t > struct is_bounding_geometry { diff --git a/include/boost/geometry/index/detail/is_indexable.hpp b/include/boost/geometry/index/detail/is_indexable.hpp index 1e86463a3..347a2bd44 100644 --- a/include/boost/geometry/index/detail/is_indexable.hpp +++ b/include/boost/geometry/index/detail/is_indexable.hpp @@ -17,7 +17,7 @@ namespace boost { namespace geometry { namespace index { namespace detail { template < typename Geometry, - typename Tag = typename geometry::tag::type + typename Tag = geometry::tag_t > struct is_indexable { diff --git a/include/boost/geometry/index/detail/predicates.hpp b/include/boost/geometry/index/detail/predicates.hpp index e6f240198..9b67993f5 100644 --- a/include/boost/geometry/index/detail/predicates.hpp +++ b/include/boost/geometry/index/detail/predicates.hpp @@ -174,9 +174,9 @@ template <> struct spatial_predicate_call { template - static inline bool apply(G1 const& g1, G2 const& g2, S const&) + static inline bool apply(G1 const& g1, G2 const& g2, S const& s) { - return geometry::within(g2, g1); + return geometry::within(g2, g1, s); } }; @@ -184,9 +184,9 @@ template <> struct spatial_predicate_call { template - static inline bool apply(G1 const& g1, G2 const& g2, S const&) + static inline bool apply(G1 const& g1, G2 const& g2, S const& s) { - return geometry::covered_by(g1, g2); + return geometry::covered_by(g1, g2, s); } }; @@ -194,9 +194,9 @@ template <> struct spatial_predicate_call { template - static inline bool apply(G1 const& g1, G2 const& g2, S const&) + static inline bool apply(G1 const& g1, G2 const& g2, S const& s) { - return geometry::covered_by(g2, g1); + return geometry::covered_by(g2, g1, s); } }; @@ -204,41 +204,9 @@ template <> struct spatial_predicate_call { template - static inline bool apply(G1 const& g1, G2 const& g2, S const&) - { - return geometry::disjoint(g1, g2); - } -}; - -// TEMP: used to implement CS-specific intersects predicate for certain -// combinations of geometries until umbrella strategies are implemented -template -< - typename G1, typename G2, - typename Tag1 = typename tag::type, - typename Tag2 = typename tag::type -> -struct spatial_predicate_intersects -{ - template - static inline bool apply(G1 const& g1, G2 const& g2, S const&) - { - return geometry::intersects(g1, g2); - } -}; -// TEMP: used in within and relate -template -struct spatial_predicate_intersects -{ - static inline bool apply(G1 const& g1, G2 const& g2, default_strategy const&) - { - return geometry::intersects(g1, g2); - } - - template static inline bool apply(G1 const& g1, G2 const& g2, S const& s) { - return geometry::intersects(g1, g2, s); + return geometry::disjoint(g1, g2, s); } }; @@ -248,7 +216,7 @@ struct spatial_predicate_call template static inline bool apply(G1 const& g1, G2 const& g2, S const& s) { - return spatial_predicate_intersects::apply(g1, g2, s); + return geometry::intersects(g1, g2, s); } }; @@ -256,9 +224,9 @@ template <> struct spatial_predicate_call { template - static inline bool apply(G1 const& g1, G2 const& g2, S const&) + static inline bool apply(G1 const& g1, G2 const& g2, S const& s) { - return geometry::overlaps(g1, g2); + return geometry::overlaps(g1, g2, s); } }; @@ -266,9 +234,9 @@ template <> struct spatial_predicate_call { template - static inline bool apply(G1 const& g1, G2 const& g2, S const&) + static inline bool apply(G1 const& g1, G2 const& g2, S const& s) { - return geometry::touches(g1, g2); + return geometry::touches(g1, g2, s); } }; @@ -276,9 +244,9 @@ template <> struct spatial_predicate_call { template - static inline bool apply(G1 const& g1, G2 const& g2, S const&) + static inline bool apply(G1 const& g1, G2 const& g2, S const& s) { - return geometry::within(g1, g2); + return geometry::within(g1, g2, s); } }; diff --git a/include/boost/geometry/index/detail/rtree/linear/redistribute_elements.hpp b/include/boost/geometry/index/detail/rtree/linear/redistribute_elements.hpp index b698f18e9..87f933f65 100644 --- a/include/boost/geometry/index/detail/rtree/linear/redistribute_elements.hpp +++ b/include/boost/geometry/index/detail/rtree/linear/redistribute_elements.hpp @@ -243,22 +243,23 @@ struct pick_seeds_impl { BOOST_STATIC_ASSERT(0 < Dimension); - typedef typename Elements::value_type element_type; - typedef typename rtree::element_indexable_type::type indexable_type; + using element_type = typename Elements::value_type; + using indexable_type = typename rtree::element_indexable_type::type; - typedef find_greatest_normalized_separation< + using find_norm_sep = find_greatest_normalized_separation + < Elements, Parameters, Translator, - typename tag::type, Dimension - 1 - > find_norm_sep; + tag_t, Dimension - 1 + >; - typedef typename find_norm_sep::separation_type separation_type; + using separation_type = typename find_norm_sep::separation_type; static inline void apply(Elements const& elements, Parameters const& parameters, Translator const& tr, - separation_type & separation, - size_t & seed1, - size_t & seed2) + separation_type& separation, + size_t& seed1, + size_t& seed2) { pick_seeds_impl::apply(elements, parameters, tr, separation, seed1, seed2); @@ -279,23 +280,24 @@ struct pick_seeds_impl template struct pick_seeds_impl { - typedef typename Elements::value_type element_type; - typedef typename rtree::element_indexable_type::type indexable_type; - typedef typename coordinate_type::type coordinate_type; + using element_type = typename Elements::value_type; + using indexable_type = typename rtree::element_indexable_type::type; + using coordinate_type = coordinate_type_t; - typedef find_greatest_normalized_separation< - Elements, Parameters, Translator, - typename tag::type, 0 - > find_norm_sep; + using find_norm_sep = find_greatest_normalized_separation + < + Elements, Parameters, Translator, + tag_t, 0 + >; - typedef typename find_norm_sep::separation_type separation_type; + using separation_type = typename find_norm_sep::separation_type; static inline void apply(Elements const& elements, Parameters const& parameters, Translator const& tr, - separation_type & separation, - size_t & seed1, - size_t & seed2) + separation_type& separation, + size_t& seed1, + size_t& seed2) { find_norm_sep::apply(elements, parameters, tr, separation, seed1, seed2); } diff --git a/include/boost/geometry/index/detail/rtree/pack_create.hpp b/include/boost/geometry/index/detail/rtree/pack_create.hpp index dab7cfdbd..ee517ca99 100644 --- a/include/boost/geometry/index/detail/rtree/pack_create.hpp +++ b/include/boost/geometry/index/detail/rtree/pack_create.hpp @@ -42,10 +42,10 @@ struct biggest_edge { BOOST_STATIC_ASSERT(0 < Dimension); template - static inline void apply(Box const& box, typename coordinate_type::type & length, std::size_t & dim_index) + static inline void apply(Box const& box, coordinate_type_t & length, std::size_t & dim_index) { biggest_edge::apply(box, length, dim_index); - typename coordinate_type::type curr + coordinate_type_t curr = geometry::get(box) - geometry::get(box); if ( length < curr ) { @@ -59,7 +59,7 @@ template <> struct biggest_edge<1> { template - static inline void apply(Box const& box, typename coordinate_type::type & length, std::size_t & dim_index) + static inline void apply(Box const& box, coordinate_type_t & length, std::size_t & dim_index) { dim_index = 0; length = geometry::get(box) - geometry::get(box); diff --git a/include/boost/geometry/index/detail/rtree/rstar/redistribute_elements.hpp b/include/boost/geometry/index/detail/rtree/rstar/redistribute_elements.hpp index 9dcb3db38..8d1a25548 100644 --- a/include/boost/geometry/index/detail/rtree/rstar/redistribute_elements.hpp +++ b/include/boost/geometry/index/detail/rtree/rstar/redistribute_elements.hpp @@ -121,9 +121,9 @@ struct choose_split_axis_and_index_for_corner Parameters const& parameters, Translator const& translator) { - typedef typename Elements::value_type element_type; - typedef typename rtree::element_indexable_type::type indexable_type; - typedef typename tag::type indexable_tag; + using element_type = typename Elements::value_type; + using indexable_type = typename rtree::element_indexable_type::type; + using indexable_tag = tag_t; BOOST_GEOMETRY_INDEX_ASSERT(elements.size() == parameters.get_max_elements() + 1, "wrong number of elements"); @@ -306,13 +306,15 @@ struct choose_split_axis_and_index content_type overlap_val = (std::numeric_limits::max)(); content_type content_val = (std::numeric_limits::max)(); - choose_split_axis_and_index_for_axis< - Box, - Dimension - 1, - typename tag::type - >::apply(elements, corner, index, sum_of_margins, overlap_val, content_val, parameters, translator); // MAY THROW, STRONG + choose_split_axis_and_index_for_axis + < + Box, + Dimension - 1, + tag_t + >::apply(elements, corner, index, sum_of_margins, overlap_val, content_val, + parameters, translator); // MAY THROW, STRONG - if ( sum_of_margins < smallest_sum_of_margins ) + if (sum_of_margins < smallest_sum_of_margins) { choosen_axis = Dimension - 1; choosen_corner = corner; @@ -341,15 +343,17 @@ struct choose_split_axis_and_index Parameters const& parameters, Translator const& translator) { - typedef typename rtree::element_indexable_type::type element_indexable_type; + using element_indexable_type = typename rtree::element_indexable_type::type; choosen_axis = 0; - choose_split_axis_and_index_for_axis< - Box, - 0, - typename tag::type - >::apply(elements, choosen_corner, choosen_index, smallest_sum_of_margins, smallest_overlap, smallest_content, parameters, translator); // MAY THROW + choose_split_axis_and_index_for_axis + < + Box, + 0, + tag_t + >::apply(elements, choosen_corner, choosen_index, smallest_sum_of_margins, + smallest_overlap, smallest_content, parameters, translator); // MAY THROW } }; @@ -371,9 +375,9 @@ struct nth_element } else { - typedef typename Elements::value_type element_type; - typedef typename rtree::element_indexable_type::type indexable_type; - typedef typename tag::type indexable_tag; + using element_type = typename Elements::value_type; + using indexable_type = typename rtree::element_indexable_type::type; + using indexable_tag = tag_t; typename index::detail::strategy_type::type strategy = index::detail::get_strategy(parameters); diff --git a/include/boost/geometry/index/detail/rtree/utilities/gl_draw.hpp b/include/boost/geometry/index/detail/rtree/utilities/gl_draw.hpp index 051337a27..5dd79c02c 100644 --- a/include/boost/geometry/index/detail/rtree/utilities/gl_draw.hpp +++ b/include/boost/geometry/index/detail/rtree/utilities/gl_draw.hpp @@ -39,10 +39,10 @@ struct gl_draw_point template struct gl_draw_point { - static inline void apply(Point const& p, typename coordinate_type::type z) + static inline void apply(Point const& p, coordinate_type_t z) { - typename coordinate_type::type const& x = geometry::get<0>(p); - typename coordinate_type::type const& y = geometry::get<1>(p); + coordinate_type_t const& x = geometry::get<0>(p); + coordinate_type_t const& y = geometry::get<1>(p); /*glBegin(GL_POINT); glVertex3f(x, y, z); glEnd();*/ @@ -62,7 +62,7 @@ struct gl_draw_box template struct gl_draw_box { - static inline void apply(Box const& b, typename coordinate_type::type z) + static inline void apply(Box const& b, coordinate_type_t z) { glBegin(GL_LINE_LOOP); glVertex3f(geometry::get(b), geometry::get(b), z); @@ -80,7 +80,7 @@ struct gl_draw_segment template struct gl_draw_segment { - static inline void apply(Segment const& s, typename coordinate_type::type z) + static inline void apply(Segment const& s, coordinate_type_t z) { glBegin(GL_LINES); glVertex3f(geometry::get<0, 0>(s), geometry::get<0, 1>(s), z); @@ -115,12 +115,13 @@ struct gl_draw_indexable } // namespace dispatch template inline -void gl_draw_indexable(Indexable const& i, typename coordinate_type::type z) +void gl_draw_indexable(Indexable const& i, coordinate_type_t z) { - dispatch::gl_draw_indexable< - Indexable, - typename tag::type - >::apply(i, z); + dispatch::gl_draw_indexable + < + Indexable, + tag_t + >::apply(i, z); } } // namespace utilities @@ -142,7 +143,7 @@ struct gl_draw inline gl_draw(translator_type const& t, size_t level_first = 0, size_t level_last = (std::numeric_limits::max)(), - typename coordinate_type::type z_coord_level_multiplier = 1 + coordinate_type_t z_coord_level_multiplier = 1 ) : tr(t) , level_f(level_first) @@ -219,7 +220,7 @@ struct gl_draw translator_type const& tr; size_t level_f; size_t level_l; - typename coordinate_type::type z_mul; + coordinate_type_t z_mul; size_t level; }; @@ -230,9 +231,7 @@ template inline void gl_draw(Rtree const& tree, size_t level_first = 0, size_t level_last = (std::numeric_limits::max)(), - typename coordinate_type< - typename Rtree::bounds_type - >::type z_coord_level_multiplier = 1 + coordinate_type_t z_coord_level_multiplier = 1 ) { typedef utilities::view RTV; diff --git a/include/boost/geometry/index/detail/rtree/utilities/print.hpp b/include/boost/geometry/index/detail/rtree/utilities/print.hpp index ddb2d9cb5..5d8f21612 100644 --- a/include/boost/geometry/index/detail/rtree/utilities/print.hpp +++ b/include/boost/geometry/index/detail/rtree/utilities/print.hpp @@ -134,10 +134,11 @@ struct print_indexable template inline void print_indexable(std::ostream & os, Indexable const& i) { - dispatch::print_indexable< - Indexable, - typename tag::type - >::apply(os, i); + dispatch::print_indexable + < + Indexable, + tag_t + >::apply(os, i); } } // namespace utilities diff --git a/include/boost/geometry/index/detail/serialization.hpp b/include/boost/geometry/index/detail/serialization.hpp index acb8cde2a..4ffd6a6c4 100644 --- a/include/boost/geometry/index/detail/serialization.hpp +++ b/include/boost/geometry/index/detail/serialization.hpp @@ -252,7 +252,7 @@ struct serialize_point template static inline void save(Archive & ar, P const& p, unsigned int version) { - typename coordinate_type

::type c = get(p); + coordinate_type_t

c = get(p); ar << boost::serialization::make_nvp("c", c); serialize_point::save(ar, p, version); } @@ -260,7 +260,7 @@ struct serialize_point template static inline void load(Archive & ar, P & p, unsigned int version) { - typename geometry::coordinate_type

::type c; + geometry::coordinate_type_t

c; ar >> boost::serialization::make_nvp("c", c); set(p, c); serialize_point::load(ar, p, version); diff --git a/include/boost/geometry/index/equal_to.hpp b/include/boost/geometry/index/equal_to.hpp index 85fa7e5ad..0466248d7 100644 --- a/include/boost/geometry/index/equal_to.hpp +++ b/include/boost/geometry/index/equal_to.hpp @@ -22,7 +22,7 @@ namespace boost { namespace geometry { namespace index { namespace detail { template ::type> + typename Tag = geometry::tag_t> struct equals { template diff --git a/include/boost/geometry/index/rtree.hpp b/include/boost/geometry/index/rtree.hpp index 584a77624..ec8451f33 100644 --- a/include/boost/geometry/index/rtree.hpp +++ b/include/boost/geometry/index/rtree.hpp @@ -193,9 +193,9 @@ public: /*! \brief The Box type used by the R-tree. */ typedef geometry::model::box< geometry::model::point< - typename coordinate_type::type, + coordinate_type_t, dimension::value, - typename coordinate_system::type + coordinate_system_t > > bounds_type; diff --git a/include/boost/geometry/io/dsv/write.hpp b/include/boost/geometry/io/dsv/write.hpp index e73cdfb81..e509c853f 100644 --- a/include/boost/geometry/io/dsv/write.hpp +++ b/include/boost/geometry/io/dsv/write.hpp @@ -37,6 +37,8 @@ #include +#include + namespace boost { namespace geometry { @@ -53,6 +55,7 @@ struct dsv_settings std::string list_open; std::string list_close; std::string list_separator; + bool close_rings{false}; dsv_settings(std::string const& sep , std::string const& open @@ -61,6 +64,7 @@ struct dsv_settings , std::string const& lopen , std::string const& lclose , std::string const& lsep + , bool cr = false ) : coordinate_separator(sep) , point_open(open) @@ -69,6 +73,7 @@ struct dsv_settings , list_open(lopen) , list_close(lclose) , list_separator(lsep) + , close_rings(cr) {} }; @@ -161,7 +166,7 @@ struct dsv_point \brief Stream ranges as DSV \note policy is used to stream prefix/postfix, enabling derived classes to override this */ -template +template struct dsv_range { template @@ -173,20 +178,31 @@ struct dsv_range os << settings.list_open; - for (auto it = boost::begin(range); it != boost::end(range); ++it) + auto stream_point = [&os, &settings](std::string const& sep, auto const& point) { - os << (first ? "" : settings.point_separator) - << settings.point_open; - + os << sep << settings.point_open; stream_coordinate < point_type, 0, dimension::type::value - >::apply(os, *it, settings); + >::apply(os, point, settings); os << settings.point_close; + }; + for (auto it = boost::begin(range); it != boost::end(range); ++it) + { + stream_point(first ? "" : settings.point_separator, *it); first = false; } + if (BOOST_GEOMETRY_CONDITION(Areal)) + { + if (settings.close_rings && boost::size(range) > 0) + { + // Close it explicitly + stream_point(settings.point_separator, *boost::begin(range)); + } + } + os << settings.list_close; } @@ -207,17 +223,17 @@ struct dsv_poly Polygon const& poly, dsv_settings const& settings) { - typedef typename ring_type::type ring; + using ring_t = ring_type_t; os << settings.list_open; - dsv_range::apply(os, exterior_ring(poly), settings); + dsv_range::apply(os, exterior_ring(poly), settings); auto const& rings = interior_rings(poly); for (auto it = boost::begin(rings); it != boost::end(rings); ++it) { os << settings.list_separator; - dsv_range::apply(os, *it, settings); + dsv_range::apply(os, *it, settings); } os << settings.list_close; } @@ -277,7 +293,7 @@ struct dsv template struct dsv - : detail::dsv::dsv_range + : detail::dsv::dsv_range {}; template @@ -292,7 +308,7 @@ struct dsv template struct dsv - : detail::dsv::dsv_range + : detail::dsv::dsv_range {}; template @@ -348,10 +364,7 @@ struct dsv_multi { typedef dispatch::dsv < - typename single_tag_of - < - typename tag::type - >::type, + typename single_tag_of>::type, typename boost::range_value::type > dispatch_one; @@ -407,6 +420,7 @@ inline detail::dsv::dsv_manipulator dsv(Geometry const& geometry , std::string const& list_open = "(" , std::string const& list_close = ")" , std::string const& list_separator = ", " + , bool close_rings = false ) { concepts::check(); @@ -414,7 +428,7 @@ inline detail::dsv::dsv_manipulator dsv(Geometry const& geometry return detail::dsv::dsv_manipulator(geometry, detail::dsv::dsv_settings(coordinate_separator, point_open, point_close, point_separator, - list_open, list_close, list_separator)); + list_open, list_close, list_separator, close_rings)); } }} // namespace boost::geometry diff --git a/include/boost/geometry/io/io.hpp b/include/boost/geometry/io/io.hpp index caafccf2b..c96082dce 100644 --- a/include/boost/geometry/io/io.hpp +++ b/include/boost/geometry/io/io.hpp @@ -37,7 +37,7 @@ struct read { static inline void apply(Geometry& geometry, std::string const& wkt) { - read_wkt::type, Geometry>::apply(wkt, geometry); + read_wkt, Geometry>::apply(wkt, geometry); } }; diff --git a/include/boost/geometry/io/svg/svg_mapper.hpp b/include/boost/geometry/io/svg/svg_mapper.hpp index a81e874e5..fdfa7732d 100644 --- a/include/boost/geometry/io/svg/svg_mapper.hpp +++ b/include/boost/geometry/io/svg/svg_mapper.hpp @@ -153,7 +153,7 @@ struct svg_map { typedef typename single_tag_of < - typename geometry::tag::type + geometry::tag_t >::type stag; template @@ -270,7 +270,7 @@ class svg_mapper : boost::noncopyable typedef typename geometry::select_most_precise < - typename coordinate_type::type, + coordinate_type_t, double >::type calculation_type; diff --git a/include/boost/geometry/io/svg/write.hpp b/include/boost/geometry/io/svg/write.hpp index a8be963fd..402cc8008 100644 --- a/include/boost/geometry/io/svg/write.hpp +++ b/include/boost/geometry/io/svg/write.hpp @@ -71,7 +71,7 @@ struct svg_box // Prevent invisible boxes, making them >=1, using "max" BOOST_USING_STD_MAX(); - typedef typename coordinate_type::type ct; + using ct = coordinate_type_t; ct x = geometry::get(box); ct y = geometry::get(box); ct width = max BOOST_PREVENT_MACRO_SUBSTITUTION (ct(1), @@ -92,11 +92,11 @@ struct svg_segment static inline void apply(std::basic_ostream& os, Segment const& segment, std::string const& style, double) { - typedef typename coordinate_type::type ct; - ct x1 = geometry::get<0, 0>(segment); - ct y1 = geometry::get<0, 1>(segment); - ct x2 = geometry::get<1, 0>(segment); - ct y2 = geometry::get<1, 1>(segment); + using ct = coordinate_type_t; + ct const x1 = geometry::get<0, 0>(segment); + ct const y1 = geometry::get<0, 1>(segment); + ct const x2 = geometry::get<1, 0>(segment); + ct const y2 = geometry::get<1, 1>(segment); os << "& os, Polygon const& polygon, std::string const& style, double) { - typedef typename geometry::ring_type::type ring_type; - bool first = true; os << " static inline void apply(std::basic_ostream& os, G const& geometry) */ -template ::type> +template > struct svg { BOOST_GEOMETRY_STATIC_ASSERT_FALSE( diff --git a/include/boost/geometry/io/wkt/read.hpp b/include/boost/geometry/io/wkt/read.hpp index 1cc294ac2..9d96dffeb 100644 --- a/include/boost/geometry/io/wkt/read.hpp +++ b/include/boost/geometry/io/wkt/read.hpp @@ -132,7 +132,7 @@ struct parsing_assigner Point& point, std::string const& wkt) { - using coordinate_type = typename coordinate_type::type; + using coordinate_type = coordinate_type_t; // Stop at end of tokens, or at "," ot ")" bool finished = (it == end || *it == "," || *it == ")"); @@ -263,7 +263,7 @@ template ::type const& point, bool) + inline void append(Geometry geom, geometry::point_type_t const& point, bool) { geometry::append(geom, point); } @@ -272,11 +272,8 @@ struct stateful_range_appender template struct stateful_range_appender { - using point_type = typename geometry::point_type::type; - using size_type = typename boost::range_size - < - typename util::remove_cptrref::type - >::type; + using point_type = geometry::point_type_t; + using size_type = typename boost::range_size>::type; BOOST_STATIC_ASSERT((util::is_ring::value)); @@ -329,7 +326,7 @@ private: template struct container_appender { - using point_type = typename geometry::point_type::type; + using point_type = geometry::point_type_t; template static inline void apply(TokenizerIterator& it, @@ -422,8 +419,7 @@ struct ring_parser template struct polygon_parser { - using ring_return_type = typename ring_return_type::type; - using appender = container_appender; + using appender = container_appender>; template static inline void apply(TokenizerIterator& it, @@ -446,7 +442,7 @@ struct polygon_parser } else { - typename ring_type::type ring; + ring_type_t ring; appender::apply(it, end, wkt, ring); range::push_back(geometry::interior_rings(poly), std::move(ring)); } @@ -521,7 +517,7 @@ inline void handle_empty_z_m(TokenizerIterator& it, } -template ::type> +template > struct dimension : geometry::dimension {}; @@ -982,7 +978,7 @@ private: bool = true) { Geom g; - ReadWkt::type>::apply(it, end, wkt, g); + ReadWkt>::apply(it, end, wkt, g); AppendPolicy::apply(geometry, g); return true; } @@ -1022,7 +1018,7 @@ private: namespace dispatch { -template ::type> +template > struct read_wkt {}; diff --git a/include/boost/geometry/io/wkt/write.hpp b/include/boost/geometry/io/wkt/write.hpp index 4b776e02d..e1e9a03ef 100644 --- a/include/boost/geometry/io/wkt/write.hpp +++ b/include/boost/geometry/io/wkt/write.hpp @@ -199,7 +199,7 @@ struct wkt_poly static inline void apply(std::basic_ostream& os, Polygon const& poly, bool force_closure) { - using ring = typename ring_type::type; + using ring_t = ring_type_t; auto const& exterior = exterior_ring(poly); auto const& rings = interior_rings(poly); @@ -215,12 +215,12 @@ struct wkt_poly os << "("; if (point_count > 0) { - wkt_sequence::apply(os, exterior, force_closure); + wkt_sequence::apply(os, exterior, force_closure); for (auto it = boost::begin(rings); it != boost::end(rings); ++it) { os << ","; - wkt_sequence::apply(os, *it, force_closure); + wkt_sequence::apply(os, *it, force_closure); } } os << ")"; @@ -330,7 +330,7 @@ struct wkt_segment namespace dispatch { -template ::type> +template > struct wkt: not_implemented {}; diff --git a/include/boost/geometry/iterators/detail/point_iterator/inner_range_type.hpp b/include/boost/geometry/iterators/detail/point_iterator/inner_range_type.hpp index 8e93cf56e..0e57178da 100644 --- a/include/boost/geometry/iterators/detail/point_iterator/inner_range_type.hpp +++ b/include/boost/geometry/iterators/detail/point_iterator/inner_range_type.hpp @@ -32,7 +32,7 @@ namespace detail { namespace point_iterator template < typename Geometry, - typename Tag = typename tag::type + typename Tag = tag_t > struct inner_range_type { @@ -51,8 +51,8 @@ struct inner_range_type typedef std::conditional_t < ! std::is_const::value, - typename geometry::ring_type::type, - typename geometry::ring_type::type const + geometry::ring_type_t, + geometry::ring_type_t const > type; }; diff --git a/include/boost/geometry/iterators/detail/point_iterator/iterator_type.hpp b/include/boost/geometry/iterators/detail/point_iterator/iterator_type.hpp index 9cace29a0..47adcfe15 100644 --- a/include/boost/geometry/iterators/detail/point_iterator/iterator_type.hpp +++ b/include/boost/geometry/iterators/detail/point_iterator/iterator_type.hpp @@ -37,7 +37,7 @@ namespace detail { namespace point_iterator { -template ::type> +template > struct iterator_type : not_implemented {}; diff --git a/include/boost/geometry/iterators/detail/point_iterator/value_type.hpp b/include/boost/geometry/iterators/detail/point_iterator/value_type.hpp index c5321b118..d98cb0326 100644 --- a/include/boost/geometry/iterators/detail/point_iterator/value_type.hpp +++ b/include/boost/geometry/iterators/detail/point_iterator/value_type.hpp @@ -32,8 +32,8 @@ struct value_type typedef std::conditional_t < ! std::is_const::value, - typename geometry::point_type::type, - typename geometry::point_type::type const + geometry::point_type_t, + geometry::point_type_t const > type; }; diff --git a/include/boost/geometry/iterators/detail/segment_iterator/iterator_type.hpp b/include/boost/geometry/iterators/detail/segment_iterator/iterator_type.hpp index 07d11da07..b8c704a88 100644 --- a/include/boost/geometry/iterators/detail/segment_iterator/iterator_type.hpp +++ b/include/boost/geometry/iterators/detail/segment_iterator/iterator_type.hpp @@ -39,7 +39,7 @@ namespace detail { namespace segment_iterator { -template ::type> +template > struct iterator_type : not_implemented {}; diff --git a/include/boost/geometry/iterators/detail/segment_iterator/value_type.hpp b/include/boost/geometry/iterators/detail/segment_iterator/value_type.hpp index f2a858a81..c4b042ec0 100644 --- a/include/boost/geometry/iterators/detail/segment_iterator/value_type.hpp +++ b/include/boost/geometry/iterators/detail/segment_iterator/value_type.hpp @@ -50,13 +50,7 @@ struct value_type < std::is_reference::value, geometry::model::pointing_segment, - geometry::model::segment - < - typename util::remove_cptrref - < - point_iterator_value_type - >::type - > + geometry::model::segment> > type; }; diff --git a/include/boost/geometry/iterators/dispatch/point_iterator.hpp b/include/boost/geometry/iterators/dispatch/point_iterator.hpp index 938dfd8eb..f558a377d 100644 --- a/include/boost/geometry/iterators/dispatch/point_iterator.hpp +++ b/include/boost/geometry/iterators/dispatch/point_iterator.hpp @@ -23,7 +23,7 @@ namespace dispatch // dispatch for points_begin -template ::type> +template > struct points_begin : not_implemented {}; @@ -31,7 +31,7 @@ struct points_begin // dispatch for points_end -template ::type> +template > struct points_end : not_implemented {}; diff --git a/include/boost/geometry/iterators/dispatch/segment_iterator.hpp b/include/boost/geometry/iterators/dispatch/segment_iterator.hpp index 0c0a1b09a..ab0822ad0 100644 --- a/include/boost/geometry/iterators/dispatch/segment_iterator.hpp +++ b/include/boost/geometry/iterators/dispatch/segment_iterator.hpp @@ -23,7 +23,7 @@ namespace dispatch // dispatch for segments_begin -template ::type> +template > struct segments_begin : not_implemented {}; @@ -31,7 +31,7 @@ struct segments_begin // dispatch for segments_end -template ::type> +template > struct segments_end : not_implemented {}; diff --git a/include/boost/geometry/policies/robustness/segment_ratio.hpp b/include/boost/geometry/policies/robustness/segment_ratio.hpp index 47851a62c..746cf217d 100644 --- a/include/boost/geometry/policies/robustness/segment_ratio.hpp +++ b/include/boost/geometry/policies/robustness/segment_ratio.hpp @@ -351,7 +351,7 @@ private : template struct segment_ratio_type { - using type = segment_ratio::type>; + using type = segment_ratio>; }; }} // namespace boost::geometry diff --git a/include/boost/geometry/srs/projection.hpp b/include/boost/geometry/srs/projection.hpp index 00e4523f7..f4ebd41f8 100644 --- a/include/boost/geometry/srs/projection.hpp +++ b/include/boost/geometry/srs/projection.hpp @@ -53,11 +53,7 @@ namespace detail template struct same_tags - : std::is_same - < - typename geometry::tag::type, - typename geometry::tag::type - > + : std::is_same, geometry::tag_t> {}; template @@ -201,7 +197,7 @@ template < typename Geometry, typename PointPolicy, - typename Tag = typename geometry::tag::type + typename Tag = geometry::tag_t > struct project_geometry {}; diff --git a/include/boost/geometry/srs/projections/dpar.hpp b/include/boost/geometry/srs/projections/dpar.hpp index 696246c18..90b8206f7 100644 --- a/include/boost/geometry/srs/projections/dpar.hpp +++ b/include/boost/geometry/srs/projections/dpar.hpp @@ -545,7 +545,7 @@ struct parameter typename Sphere, std::enable_if_t < - std::is_same::type, srs_sphere_tag>::value, + std::is_same, srs_sphere_tag>::value, int > = 0 > @@ -559,7 +559,7 @@ struct parameter typename Spheroid, std::enable_if_t < - std::is_same::type, srs_spheroid_tag>::value, + std::is_same, srs_spheroid_tag>::value, int > = 0 > diff --git a/include/boost/geometry/srs/projections/impl/pj_ell_set.hpp b/include/boost/geometry/srs/projections/impl/pj_ell_set.hpp index 128c70e68..8e1005719 100644 --- a/include/boost/geometry/srs/projections/impl/pj_ell_set.hpp +++ b/include/boost/geometry/srs/projections/impl/pj_ell_set.hpp @@ -431,7 +431,7 @@ struct static_srs_tag_check_nonexpanded template struct static_srs_tag_check_ellps { - typedef typename geometry::tag + using type = geometry::tag_t < typename srs::spar::detail::ellps_traits < @@ -441,13 +441,13 @@ struct static_srs_tag_check_ellps srs::spar::detail::is_param_tr::pred >::type >::template model_type::type // dummy type - >::type type; + >; }; template struct static_srs_tag_check_datum { - typedef typename geometry::tag + using type = geometry::tag_t < typename srs::spar::detail::ellps_traits < @@ -460,7 +460,7 @@ struct static_srs_tag_check_datum >::type >::ellps_type >::template model_type::type // dummy type - >::type type; + >; }; template diff --git a/include/boost/geometry/srs/projections/impl/pj_transform.hpp b/include/boost/geometry/srs/projections/impl/pj_transform.hpp index 9f16c0e6f..3f4a8b07c 100644 --- a/include/boost/geometry/srs/projections/impl/pj_transform.hpp +++ b/include/boost/geometry/srs/projections/impl/pj_transform.hpp @@ -75,7 +75,7 @@ template > struct z_access { - typedef typename coordinate_type::type type; + using type = coordinate_type_t; static inline type get(Point const& point) { return geometry::get<2>(point); @@ -89,7 +89,7 @@ struct z_access template struct z_access { - typedef typename coordinate_type::type type; + using type = coordinate_type_t; static inline type get(Point const& ) { return type(0); @@ -119,9 +119,9 @@ template > struct range_wrapper { - typedef Range range_type; - typedef typename boost::range_value::type point_type; - typedef typename coordinate_type::type coord_t; + using range_type = Range; + using point_type = typename boost::range_value::type; + using coord_t = coordinate_type_t; range_wrapper(Range & range) : m_range(range) @@ -139,9 +139,9 @@ private: template struct range_wrapper { - typedef Range range_type; - typedef typename boost::range_value::type point_type; - typedef typename coordinate_type::type coord_t; + using range_type = Range; + using point_type = typename boost::range_value::type; + using coord_t = coordinate_type_t; range_wrapper(Range & range) : m_range(range) @@ -237,8 +237,8 @@ inline bool pj_transform(SrcPrj const& srcprj, Par const& srcdefn, Grids const& dstgrids) { - typedef typename boost::range_value::type point_type; - typedef typename coordinate_type::type coord_t; + using point_type = typename boost::range_value::type; + using coord_t = coordinate_type_t; static const std::size_t dimension = geometry::dimension::value; std::size_t point_count = boost::size(range); bool result = true; @@ -616,9 +616,7 @@ inline int pj_geodetic_to_geocentric( T const& a, T const& es, range_wrapper & range_wrapper ) { - //typedef typename boost::range_iterator::type iterator; - typedef typename boost::range_value::type point_type; - //typedef typename coordinate_type::type coord_t; + using point_type = typename boost::range_value::type; Range & rng = range_wrapper.get_range(); std::size_t point_count = boost::size(rng); @@ -671,9 +669,7 @@ inline int pj_geocentric_to_geodetic( T const& a, T const& es, range_wrapper & range_wrapper ) { - //typedef typename boost::range_iterator::type iterator; - typedef typename boost::range_value::type point_type; - //typedef typename coordinate_type::type coord_t; + using point_type = typename boost::range_value::type; Range & rng = range_wrapper.get_range(); std::size_t point_count = boost::size(rng); @@ -762,20 +758,22 @@ inline int pj_geocentric_to_wgs84( Par const& defn, range_wrapper & range_wrapper ) { - typedef typename boost::range_value::type point_type; - typedef typename coordinate_type::type coord_t; + using point_type = typename boost::range_value::type; + using coord_t = coordinate_type_t; - Range & rng = range_wrapper.get_range(); + Range& rng = range_wrapper.get_range(); std::size_t point_count = boost::size(rng); - if( defn.datum_type == datum_3param ) + if (defn.datum_type == datum_3param) { - for(std::size_t i = 0; i < point_count; i++ ) + for (std::size_t i = 0; i < point_count; i++ ) { - point_type & point = range::at(rng, i); + point_type& point = range::at(rng, i); - if( is_invalid_point(point) ) + if (is_invalid_point(point)) + { continue; + } set<0>(point, get<0>(point) + Dx_BF(defn)); set<1>(point, get<1>(point) + Dy_BF(defn)); @@ -819,20 +817,22 @@ inline int pj_geocentric_from_wgs84( Par const& defn, range_wrapper & range_wrapper ) { - typedef typename boost::range_value::type point_type; - typedef typename coordinate_type::type coord_t; + using point_type = typename boost::range_value::type; + using coord_t = coordinate_type_t; - Range & rng = range_wrapper.get_range(); + Range& rng = range_wrapper.get_range(); std::size_t point_count = boost::size(rng); - if( defn.datum_type == datum_3param ) + if (defn.datum_type == datum_3param) { - for(std::size_t i = 0; i < point_count; i++ ) + for (std::size_t i = 0; i < point_count; i++ ) { - point_type & point = range::at(rng, i); + point_type& point = range::at(rng, i); - if( is_invalid_point(point) ) + if (is_invalid_point(point)) + { continue; + } set<0>(point, get<0>(point) - Dx_BF(defn)); set<1>(point, get<1>(point) - Dy_BF(defn)); diff --git a/include/boost/geometry/srs/transformation.hpp b/include/boost/geometry/srs/transformation.hpp index b327e1121..fc2e30c8b 100644 --- a/include/boost/geometry/srs/transformation.hpp +++ b/include/boost/geometry/srs/transformation.hpp @@ -93,18 +93,18 @@ struct transform_geometry_point_coordinates template struct transform_geometry_point { - typedef typename geometry::point_type::type point_type; + using point_type = geometry::point_type_t; - typedef geometry::model::point + using type = geometry::model::point < typename select_most_precise < - typename geometry::coordinate_type::type, + geometry::coordinate_type_t, CT >::type, geometry::dimension::type::value, - typename geometry::coordinate_system::type - > type; + geometry::coordinate_system_t + >; template static inline void apply(PtIn const& in, PtOut & out, bool enable_angles) @@ -153,7 +153,7 @@ template < typename Geometry, typename CT, - typename Tag = typename geometry::tag::type + typename Tag = geometry::tag_t > struct transform_geometry {}; @@ -229,10 +229,10 @@ template < typename select_most_precise < - typename geometry::coordinate_type::type, + geometry::coordinate_type_t, CT >::type, - typename geometry::coordinate_type::type + geometry::coordinate_type_t >::value > struct transform_geometry_wrapper @@ -379,7 +379,7 @@ template < typename Geometry, typename CT, - typename Tag = typename geometry::tag::type + typename Tag = geometry::tag_t > struct transform : not_implemented diff --git a/include/boost/geometry/strategies/area/services.hpp b/include/boost/geometry/strategies/area/services.hpp index 2bc797e90..51673046f 100644 --- a/include/boost/geometry/strategies/area/services.hpp +++ b/include/boost/geometry/strategies/area/services.hpp @@ -27,7 +27,7 @@ namespace services template < typename Geometry, - typename CSTag = typename geometry::cs_tag::type + typename CSTag = geometry::cs_tag_t > struct default_strategy { diff --git a/include/boost/geometry/strategies/azimuth/services.hpp b/include/boost/geometry/strategies/azimuth/services.hpp index 11980e5a4..06b05f0d2 100644 --- a/include/boost/geometry/strategies/azimuth/services.hpp +++ b/include/boost/geometry/strategies/azimuth/services.hpp @@ -27,8 +27,8 @@ namespace services template < typename Point1, typename Point2, - typename CSTag1 = typename geometry::cs_tag::type, - typename CSTag2 = typename geometry::cs_tag::type + typename CSTag1 = geometry::cs_tag_t, + typename CSTag2 = geometry::cs_tag_t > struct default_strategy { diff --git a/include/boost/geometry/strategies/buffer/services.hpp b/include/boost/geometry/strategies/buffer/services.hpp index 445fac08d..b33aa261e 100644 --- a/include/boost/geometry/strategies/buffer/services.hpp +++ b/include/boost/geometry/strategies/buffer/services.hpp @@ -27,7 +27,7 @@ namespace services template < typename Geometry, - typename CSTag = typename geometry::cs_tag::type + typename CSTag = geometry::cs_tag_t > struct default_strategy { diff --git a/include/boost/geometry/strategies/cartesian.hpp b/include/boost/geometry/strategies/cartesian.hpp index 83c89f00c..8ec83563b 100644 --- a/include/boost/geometry/strategies/cartesian.hpp +++ b/include/boost/geometry/strategies/cartesian.hpp @@ -1,5 +1,7 @@ // Boost.Geometry +// Copyright (c) 2025 Adam Wulkiewicz, Lodz, Poland. + // Copyright (c) 2020-2021, Oracle and/or its affiliates. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle @@ -14,6 +16,8 @@ #include #include #include +#include +#include #include #include #include @@ -36,7 +40,8 @@ namespace strategies template class cartesian // derived from the umbrella strategy defining the most strategies - : public strategies::index::cartesian + : public strategies::closest_points::cartesian + , public strategies::centroid::detail::cartesian { public: diff --git a/include/boost/geometry/strategies/cartesian/buffer_end_round.hpp b/include/boost/geometry/strategies/cartesian/buffer_end_round.hpp index fd52eb259..49f876105 100644 --- a/include/boost/geometry/strategies/cartesian/buffer_end_round.hpp +++ b/include/boost/geometry/strategies/cartesian/buffer_end_round.hpp @@ -118,13 +118,12 @@ public : RangeOut& range_out) const { boost::ignore_unused(perp_left_point); - typedef typename coordinate_type::type coordinate_type; - typedef typename geometry::select_most_precise + using promoted_type = typename geometry::select_most_precise < - coordinate_type, + coordinate_type_t, double - >::type promoted_type; + >::type; promoted_type const dist_left = distance.apply(penultimate_point, ultimate_point, buffer_side_left); promoted_type const dist_right = distance.apply(penultimate_point, ultimate_point, buffer_side_right); diff --git a/include/boost/geometry/strategies/cartesian/buffer_join_miter.hpp b/include/boost/geometry/strategies/cartesian/buffer_join_miter.hpp index a47b3fa01..233b4473d 100644 --- a/include/boost/geometry/strategies/cartesian/buffer_join_miter.hpp +++ b/include/boost/geometry/strategies/cartesian/buffer_join_miter.hpp @@ -77,12 +77,11 @@ public: return false; } - typedef typename coordinate_type::type coordinate_type; - typedef typename geometry::select_most_precise + using promoted_type = typename geometry::select_most_precise < - coordinate_type, + coordinate_type_t, double - >::type promoted_type; + >::type; Point p = ip; diff --git a/include/boost/geometry/strategies/cartesian/buffer_join_round.hpp b/include/boost/geometry/strategies/cartesian/buffer_join_round.hpp index 95553685c..e5e9c31e1 100644 --- a/include/boost/geometry/strategies/cartesian/buffer_join_round.hpp +++ b/include/boost/geometry/strategies/cartesian/buffer_join_round.hpp @@ -128,18 +128,12 @@ public : DistanceType const& buffer_distance, RangeOut& range_out) const { - typedef typename coordinate_type::type coordinate_type; - typedef typename boost::range_value::type output_point_type; - - typedef typename geometry::select_most_precise + using promoted_type = typename geometry::select_most_precise < - typename geometry::select_most_precise - < - coordinate_type, - typename geometry::coordinate_type::type - >::type, + coordinate_type_t, + geometry::coordinate_type_t::type>, double - >::type promoted_type; + >::type; geometry::equal_to equals; if (equals(perp1, perp2)) diff --git a/include/boost/geometry/strategies/cartesian/buffer_join_round_by_divide.hpp b/include/boost/geometry/strategies/cartesian/buffer_join_round_by_divide.hpp index 0a2c7ebf6..3230b4113 100644 --- a/include/boost/geometry/strategies/cartesian/buffer_join_round_by_divide.hpp +++ b/include/boost/geometry/strategies/cartesian/buffer_join_round_by_divide.hpp @@ -85,13 +85,11 @@ public : DistanceType const& buffer_distance, RangeOut& range_out) const { - typedef typename coordinate_type::type coordinate_type; - - typedef typename geometry::select_most_precise + using promoted_type = typename geometry::select_most_precise < - coordinate_type, + coordinate_type_t, double - >::type promoted_type; + >::type; geometry::equal_to equals; diff --git a/include/boost/geometry/strategies/cartesian/buffer_point_circle.hpp b/include/boost/geometry/strategies/cartesian/buffer_point_circle.hpp index b6fc0707b..bce0fe8a8 100644 --- a/include/boost/geometry/strategies/cartesian/buffer_point_circle.hpp +++ b/include/boost/geometry/strategies/cartesian/buffer_point_circle.hpp @@ -74,17 +74,14 @@ public : DistanceStrategy const& distance_strategy, OutputRange& output_range) const { - typedef typename boost::range_value::type output_point_type; + using output_point_type = typename boost::range_value::type; - typedef typename geometry::select_most_precise + using promoted_type = typename geometry::select_most_precise < - typename geometry::select_most_precise - < - typename geometry::coordinate_type::type, - typename geometry::coordinate_type::type - >::type, + geometry::coordinate_type_t, + geometry::coordinate_type_t, double - >::type promoted_type; + >::type; promoted_type const buffer_distance = distance_strategy.apply(point, point, strategy::buffer::buffer_side_left); diff --git a/include/boost/geometry/strategies/cartesian/buffer_side_straight.hpp b/include/boost/geometry/strategies/cartesian/buffer_side_straight.hpp index 10dac4298..91c69e0bd 100644 --- a/include/boost/geometry/strategies/cartesian/buffer_side_straight.hpp +++ b/include/boost/geometry/strategies/cartesian/buffer_side_straight.hpp @@ -66,12 +66,12 @@ public : DistanceStrategy const& distance, OutputRange& output_range) { - typedef typename coordinate_type::type coordinate_type; - typedef typename geometry::select_most_precise + using coordinate_type = coordinate_type_t; + using promoted_type = typename geometry::select_most_precise < coordinate_type, double - >::type promoted_type; + >::type; // Generate a block along (left or right of) the segment diff --git a/include/boost/geometry/strategies/cartesian/centroid_average.hpp b/include/boost/geometry/strategies/cartesian/centroid_average.hpp index 5b642a7f4..34654118c 100644 --- a/include/boost/geometry/strategies/cartesian/centroid_average.hpp +++ b/include/boost/geometry/strategies/cartesian/centroid_average.hpp @@ -89,7 +89,7 @@ public : centroid = state.centroid; if ( state.count > 0 ) { - using coord_t = typename coordinate_type::type; + using coord_t = coordinate_type_t; divide_value(centroid, static_cast(state.count)); return true; } diff --git a/include/boost/geometry/strategies/cartesian/centroid_bashein_detmer.hpp b/include/boost/geometry/strategies/cartesian/centroid_bashein_detmer.hpp index 8e4c014a4..7104ed666 100644 --- a/include/boost/geometry/strategies/cartesian/centroid_bashein_detmer.hpp +++ b/include/boost/geometry/strategies/cartesian/centroid_bashein_detmer.hpp @@ -134,8 +134,8 @@ private : std::is_void::value, typename select_most_precise < - typename coordinate_type::type, - typename coordinate_type::type, + coordinate_type_t, + coordinate_type_t, double >::type, CalculationType @@ -211,10 +211,7 @@ public : calc_type const v3 = 3; calc_type const a3 = v3 * state.sum_a2; - typedef typename geometry::coordinate_type - < - ResultPoint - >::type coordinate_type; + using coordinate_type = geometry::coordinate_type_t; // Prevent NaN centroid coordinates if (boost::math::isfinite(a3)) diff --git a/include/boost/geometry/strategies/cartesian/centroid_weighted_length.hpp b/include/boost/geometry/strategies/cartesian/centroid_weighted_length.hpp index 6e8595881..534f1be32 100644 --- a/include/boost/geometry/strategies/cartesian/centroid_weighted_length.hpp +++ b/include/boost/geometry/strategies/cartesian/centroid_weighted_length.hpp @@ -129,7 +129,7 @@ public : // if e.g. distance_type is double and centroid contains floats geometry::detail::for_each_dimension([&](auto dimension) { - typedef typename geometry::coordinate_type::type coordinate_type; + using coordinate_type = geometry::coordinate_type_t; geometry::set( centroid, util::numeric_cast( diff --git a/include/boost/geometry/strategies/cartesian/closest_points_pt_seg.hpp b/include/boost/geometry/strategies/cartesian/closest_points_pt_seg.hpp index 557cd48dd..cb52e2ea0 100644 --- a/include/boost/geometry/strategies/cartesian/closest_points_pt_seg.hpp +++ b/include/boost/geometry/strategies/cartesian/closest_points_pt_seg.hpp @@ -42,7 +42,7 @@ struct compute_closest_point_to_segment < CalculationType, dimension::value, - typename coordinate_system::type + coordinate_system_t >; // For convenience @@ -117,8 +117,8 @@ public: < typename select_most_precise < - typename coordinate_type::type, - typename coordinate_type::type, + coordinate_type_t, + coordinate_type_t, CalculationType >::type > diff --git a/include/boost/geometry/strategies/cartesian/densify.hpp b/include/boost/geometry/strategies/cartesian/densify.hpp index 4d18e1f0c..db0263373 100644 --- a/include/boost/geometry/strategies/cartesian/densify.hpp +++ b/include/boost/geometry/strategies/cartesian/densify.hpp @@ -53,15 +53,15 @@ public: template static inline void apply(Point const& p0, Point const& p1, AssignPolicy & policy, T const& length_threshold) { - typedef typename AssignPolicy::point_type out_point_t; - typedef typename coordinate_type::type out_coord_t; - typedef typename select_most_precise + using out_point_t = typename AssignPolicy::point_type; + using out_coord_t = coordinate_type_t; + using calc_t = typename select_most_precise < - typename coordinate_type::type, out_coord_t, + coordinate_type_t, out_coord_t, CalculationType - >::type calc_t; + >::type; - typedef model::point::value, cs::cartesian> calc_point_t; + using calc_point_t = model::point::value, cs::cartesian>; assert_dimension_equal(); diff --git a/include/boost/geometry/strategies/cartesian/disjoint_segment_box.hpp b/include/boost/geometry/strategies/cartesian/disjoint_segment_box.hpp index 39ebe395c..645edb213 100644 --- a/include/boost/geometry/strategies/cartesian/disjoint_segment_box.hpp +++ b/include/boost/geometry/strategies/cartesian/disjoint_segment_box.hpp @@ -54,11 +54,8 @@ struct compute_tmin_tmax_per_dim RelativeDistance& ti_max, RelativeDistance& diff) { - typedef typename coordinate_type::type box_coordinate_type; - typedef typename coordinate_type - < - SegmentPoint - >::type point_coordinate_type; + using box_coordinate_type = coordinate_type_t; + using point_coordinate_type = coordinate_type_t; RelativeDistance c_p0 = util::numeric_cast < diff --git a/include/boost/geometry/strategies/cartesian/distance_projected_point_ax.hpp b/include/boost/geometry/strategies/cartesian/distance_projected_point_ax.hpp index 0128669f1..3344500bc 100644 --- a/include/boost/geometry/strategies/cartesian/distance_projected_point_ax.hpp +++ b/include/boost/geometry/strategies/cartesian/distance_projected_point_ax.hpp @@ -170,7 +170,7 @@ public : < calculation_type, dimension::value, - typename coordinate_system::type + coordinate_system_t > fp_point_type; // For convenience diff --git a/include/boost/geometry/strategies/cartesian/distance_segment_box.hpp b/include/boost/geometry/strategies/cartesian/distance_segment_box.hpp index ab3aab726..429325630 100644 --- a/include/boost/geometry/strategies/cartesian/distance_segment_box.hpp +++ b/include/boost/geometry/strategies/cartesian/distance_segment_box.hpp @@ -45,7 +45,7 @@ struct cartesian_segment_box > {}; - typedef cartesian_tag cs_tag; + using cs_tag = cartesian_tag; template < diff --git a/include/boost/geometry/strategies/cartesian/intersection.hpp b/include/boost/geometry/strategies/cartesian/intersection.hpp index d6fc5c9bb..057f94310 100644 --- a/include/boost/geometry/strategies/cartesian/intersection.hpp +++ b/include/boost/geometry/strategies/cartesian/intersection.hpp @@ -123,7 +123,7 @@ template > struct cartesian_segments { - typedef cartesian_tag cs_tag; + using cs_tag = cartesian_tag; template struct segment_intersection_info @@ -295,13 +295,13 @@ struct cartesian_segments point2_type const& q1 = range_q.at(0); point2_type const& q2 = range_q.at(1); - typedef typename select_most_precise + using coordinate_type = typename select_most_precise < - typename geometry::coordinate_type::type, - typename geometry::coordinate_type::type - >::type coordinate_type; + geometry::coordinate_type_t, + geometry::coordinate_type_t + >::type; - typedef segment_ratio ratio_type; + using ratio_type = segment_ratio; segment_intersection_info < typename select_calculation_type::type, @@ -361,8 +361,8 @@ struct cartesian_segments UniqueSubRange2 const& range_q, Policy const&) { - typedef typename UniqueSubRange1::point_type point1_type; - typedef typename UniqueSubRange2::point_type point2_type; + using point1_type = typename UniqueSubRange1::point_type; + using point2_type = typename UniqueSubRange2::point_type; point1_type const& p1 = range_p.at(0); point1_type const& p2 = range_p.at(1); @@ -419,11 +419,11 @@ struct cartesian_segments // (only calculated for non-collinear segments) if (! collinear) { - typedef typename select_most_precise + using coordinate_type = typename select_most_precise < - typename geometry::coordinate_type::type, - typename geometry::coordinate_type::type - >::type coordinate_type; + geometry::coordinate_type_t, + geometry::coordinate_type_t + >::type; coordinate_type denominator_a; coordinate_type nominator_a; diff --git a/include/boost/geometry/strategies/cartesian/line_interpolate.hpp b/include/boost/geometry/strategies/cartesian/line_interpolate.hpp index a63cb8548..356c19734 100644 --- a/include/boost/geometry/strategies/cartesian/line_interpolate.hpp +++ b/include/boost/geometry/strategies/cartesian/line_interpolate.hpp @@ -55,11 +55,11 @@ public: Point & p, Distance const&) const { - typedef typename select_calculation_type_alt + using calc_t = typename select_calculation_type_alt < CalculationType, Point - >::type calc_t; - typedef typename coordinate_type::type coord_t; + >::type; + using coord_t = coordinate_type_t; //segment convex combination: p0*fraction + p1*(1-fraction) Fraction const one_minus_fraction = 1-fraction; diff --git a/include/boost/geometry/strategies/cartesian/point_in_point.hpp b/include/boost/geometry/strategies/cartesian/point_in_point.hpp index fe1713638..46b47965b 100644 --- a/include/boost/geometry/strategies/cartesian/point_in_point.hpp +++ b/include/boost/geometry/strategies/cartesian/point_in_point.hpp @@ -76,7 +76,7 @@ namespace strategy { namespace within struct cartesian_point_point { - typedef cartesian_tag cs_tag; + using cs_tag = cartesian_tag; template static inline bool apply(Point1 const& point1, Point2 const& point2) diff --git a/include/boost/geometry/strategies/cartesian/point_in_poly_winding.hpp b/include/boost/geometry/strategies/cartesian/point_in_poly_winding.hpp index 325af9e3e..c35cdb941 100644 --- a/include/boost/geometry/strategies/cartesian/point_in_poly_winding.hpp +++ b/include/boost/geometry/strategies/cartesian/point_in_poly_winding.hpp @@ -83,7 +83,7 @@ class cartesian_winding_base }; public: - typedef cartesian_tag cs_tag; + using cs_tag = cartesian_tag; // Typedefs and static methods to fulfill the concept typedef counter state_type; diff --git a/include/boost/geometry/strategies/centroid/cartesian.hpp b/include/boost/geometry/strategies/centroid/cartesian.hpp index 14b45155a..bb52a2ba1 100644 --- a/include/boost/geometry/strategies/centroid/cartesian.hpp +++ b/include/boost/geometry/strategies/centroid/cartesian.hpp @@ -1,5 +1,7 @@ // Boost.Geometry +// Copyright (c) 2025 Adam Wulkiewicz, Lodz, Poland. + // Copyright (c) 2021, Oracle and/or its affiliates. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle @@ -27,9 +29,12 @@ namespace boost { namespace geometry namespace strategies { namespace centroid { +#ifndef DOXYGEN_NO_DETAIL +namespace detail +{ + template struct cartesian - : public strategies::detail::cartesian_base { template static auto centroid(Geometry const&, @@ -77,6 +82,17 @@ struct cartesian }; +} // namespace detail +#endif // DOXYGEN_NO_DETAIL + + +template +struct cartesian + : public strategies::detail::cartesian_base + , public strategies::centroid::detail::cartesian +{}; + + namespace services { diff --git a/include/boost/geometry/strategies/centroid/geographic.hpp b/include/boost/geometry/strategies/centroid/geographic.hpp index 26619e9e2..fa72ac1ee 100644 --- a/include/boost/geometry/strategies/centroid/geographic.hpp +++ b/include/boost/geometry/strategies/centroid/geographic.hpp @@ -1,5 +1,7 @@ // Boost.Geometry +// Copyright (c) 2025 Adam Wulkiewicz, Lodz, Poland. + // Copyright (c) 2021, Oracle and/or its affiliates. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle @@ -22,24 +24,13 @@ namespace boost { namespace geometry namespace strategies { namespace centroid { -template -< - typename FormulaPolicy = strategy::andoyer, - typename Spheroid = srs::spheroid, - typename CalculationType = void -> -class geographic - : public strategies::detail::geographic_base +#ifndef DOXYGEN_NO_DETAIL +namespace detail { - using base_t = strategies::detail::geographic_base; +class geographic +{ public: - geographic() = default; - - explicit geographic(Spheroid const& spheroid) - : base_t(spheroid) - {} - // TODO: Box and Segment should have proper strategies. template static auto centroid(Geometry const&, Point const&, @@ -53,6 +44,32 @@ public: } }; + +} // namespace detail +#endif // DOXYGEN_NO_DETAIL + + +template +< + typename FormulaPolicy = strategy::andoyer, + typename Spheroid = srs::spheroid, + typename CalculationType = void +> +class geographic + : public strategies::detail::geographic_base + , public strategies::centroid::detail::geographic +{ + using base_t = strategies::detail::geographic_base; + +public: + geographic() = default; + + explicit geographic(Spheroid const& spheroid) + : base_t(spheroid) + {} +}; + + namespace services { diff --git a/include/boost/geometry/strategies/centroid/services.hpp b/include/boost/geometry/strategies/centroid/services.hpp index 382c51da8..2b847493a 100644 --- a/include/boost/geometry/strategies/centroid/services.hpp +++ b/include/boost/geometry/strategies/centroid/services.hpp @@ -27,7 +27,7 @@ namespace services template < typename Geometry, - typename CSTag = typename geometry::cs_tag::type + typename CSTag = geometry::cs_tag_t > struct default_strategy { diff --git a/include/boost/geometry/strategies/centroid/spherical.hpp b/include/boost/geometry/strategies/centroid/spherical.hpp index 4d7634dc1..2fdb03cda 100644 --- a/include/boost/geometry/strategies/centroid/spherical.hpp +++ b/include/boost/geometry/strategies/centroid/spherical.hpp @@ -1,5 +1,7 @@ // Boost.Geometry +// Copyright (c) 2025 Adam Wulkiewicz, Lodz, Poland. + // Copyright (c) 2021, Oracle and/or its affiliates. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle @@ -22,18 +24,13 @@ namespace boost { namespace geometry namespace strategies { namespace centroid { -template -< - typename CalculationType = void -> -class spherical - : public strategies::detail::spherical_base +#ifndef DOXYGEN_NO_DETAIL +namespace detail { - using base_t = strategies::detail::spherical_base; +class spherical +{ public: - spherical() = default; - // TODO: Box and Segment should have proper strategies. template static auto centroid(Geometry const&, Point const&, @@ -48,6 +45,20 @@ public: }; +} // namespace detail +#endif // DOXYGEN_NO_DETAIL + + +template +class spherical + : public strategies::detail::spherical_base + , public strategies::centroid::detail::spherical +{ +public: + spherical() = default; +}; + + namespace services { diff --git a/include/boost/geometry/strategies/closest_points/services.hpp b/include/boost/geometry/strategies/closest_points/services.hpp index d99bbfda8..d5e7067d0 100644 --- a/include/boost/geometry/strategies/closest_points/services.hpp +++ b/include/boost/geometry/strategies/closest_points/services.hpp @@ -29,8 +29,8 @@ template < typename Geometry1, typename Geometry2, - typename CSTag1 = typename geometry::cs_tag::type, - typename CSTag2 = typename geometry::cs_tag::type + typename CSTag1 = geometry::cs_tag_t, + typename CSTag2 = geometry::cs_tag_t > struct default_strategy { diff --git a/include/boost/geometry/strategies/compare.hpp b/include/boost/geometry/strategies/compare.hpp index ecfafc434..739b4a2bd 100644 --- a/include/boost/geometry/strategies/compare.hpp +++ b/include/boost/geometry/strategies/compare.hpp @@ -106,10 +106,8 @@ struct compare_loop template static inline bool apply(Point1 const& left, Point2 const& right) { - typename geometry::coordinate_type::type const& - cleft = geometry::get(left); - typename geometry::coordinate_type::type const& - cright = geometry::get(right); + auto const& cleft = geometry::get(left); + auto const& cright = geometry::get(right); if (EqualsPolicy::apply(cleft, cright)) { diff --git a/include/boost/geometry/strategies/concepts/area_concept.hpp b/include/boost/geometry/strategies/concepts/area_concept.hpp index da983bac5..f31bfa93c 100644 --- a/include/boost/geometry/strategies/concepts/area_concept.hpp +++ b/include/boost/geometry/strategies/concepts/area_concept.hpp @@ -53,7 +53,7 @@ class AreaStrategy state_type *st = 0; // 3) must implement a method apply with the following signature - typename geometry::point_type::type const* sp = 0; + geometry::point_type_t const* sp = 0; str->apply(*sp, *sp, *st); // 4) must implement a static method result with the following signature diff --git a/include/boost/geometry/strategies/concepts/within_concept.hpp b/include/boost/geometry/strategies/concepts/within_concept.hpp index d296fc513..7e37f45af 100644 --- a/include/boost/geometry/strategies/concepts/within_concept.hpp +++ b/include/boost/geometry/strategies/concepts/within_concept.hpp @@ -93,16 +93,16 @@ class WithinStrategyPolygonal { #ifndef DOXYGEN_NO_CONCEPT_MEMBERS - typedef typename geometry::point_type::type point_of_segment; + using point_of_segment = geometry::point_type_t; // 0) - typedef typename concepts::detail::relate_strategy_dispatch + using strategy_type = typename concepts::detail::relate_strategy_dispatch < Point, Polygonal, Strategy - >::type strategy_type; + >::type; // 1) must define state_type - typedef typename strategy_type::state_type state_type; + using state_type = typename strategy_type::state_type; struct checker { diff --git a/include/boost/geometry/strategies/convex_hull/services.hpp b/include/boost/geometry/strategies/convex_hull/services.hpp index 7dfd42147..03402bece 100644 --- a/include/boost/geometry/strategies/convex_hull/services.hpp +++ b/include/boost/geometry/strategies/convex_hull/services.hpp @@ -28,7 +28,7 @@ namespace services template < typename Geometry, - typename CSTag = typename geometry::cs_tag::type + typename CSTag = geometry::cs_tag_t > struct default_strategy { diff --git a/include/boost/geometry/strategies/covered_by.hpp b/include/boost/geometry/strategies/covered_by.hpp index 34efeb411..d285d546e 100644 --- a/include/boost/geometry/strategies/covered_by.hpp +++ b/include/boost/geometry/strategies/covered_by.hpp @@ -52,8 +52,8 @@ template < typename GeometryContained, typename GeometryContaining, - typename TagContained = typename tag::type, - typename TagContaining = typename tag::type, + typename TagContained = tag_t, + typename TagContaining = tag_t, typename CastedTagContained = tag_cast_t < tag_t, diff --git a/include/boost/geometry/strategies/default_length_result.hpp b/include/boost/geometry/strategies/default_length_result.hpp index 7739cb834..2cbe796f7 100644 --- a/include/boost/geometry/strategies/default_length_result.hpp +++ b/include/boost/geometry/strategies/default_length_result.hpp @@ -53,7 +53,7 @@ struct default_length_result_impl> { using type = typename select_most_precise < - typename coordinate_type::type..., + coordinate_type_t..., long double >::type; }; diff --git a/include/boost/geometry/strategies/densify/services.hpp b/include/boost/geometry/strategies/densify/services.hpp index a984c3e45..544cb5925 100644 --- a/include/boost/geometry/strategies/densify/services.hpp +++ b/include/boost/geometry/strategies/densify/services.hpp @@ -27,7 +27,7 @@ namespace services template < typename Geometry, - typename CSTag = typename geometry::cs_tag::type + typename CSTag = geometry::cs_tag_t > struct default_strategy { diff --git a/include/boost/geometry/strategies/detail.hpp b/include/boost/geometry/strategies/detail.hpp index 1b723fc6e..afdbb6b2f 100644 --- a/include/boost/geometry/strategies/detail.hpp +++ b/include/boost/geometry/strategies/detail.hpp @@ -47,7 +47,7 @@ struct is_umbrella_strategy struct cartesian_base : umbrella_strategy { - typedef cartesian_tag cs_tag; + using cs_tag = cartesian_tag; }; template @@ -60,7 +60,7 @@ protected: >::type radius_type; public: - typedef spherical_tag cs_tag; + using cs_tag = spherical_tag; spherical_base() : m_radius(1.0) @@ -95,7 +95,7 @@ protected: typedef double radius_type; public: - typedef spherical_tag cs_tag; + using cs_tag = spherical_tag; srs::sphere model() const { @@ -113,7 +113,7 @@ template class geographic_base : umbrella_strategy { public: - typedef geographic_tag cs_tag; + using cs_tag = geographic_tag; geographic_base() : m_spheroid() diff --git a/include/boost/geometry/strategies/discrete_distance/services.hpp b/include/boost/geometry/strategies/discrete_distance/services.hpp index 5776a8c7e..b1b7848d9 100644 --- a/include/boost/geometry/strategies/discrete_distance/services.hpp +++ b/include/boost/geometry/strategies/discrete_distance/services.hpp @@ -28,8 +28,8 @@ template < typename Geometry1, typename Geometry2, - typename CSTag1 = typename geometry::cs_tag::type, - typename CSTag2 = typename geometry::cs_tag::type + typename CSTag1 = geometry::cs_tag_t, + typename CSTag2 = geometry::cs_tag_t > struct default_strategy { diff --git a/include/boost/geometry/strategies/distance/services.hpp b/include/boost/geometry/strategies/distance/services.hpp index 5ce3cd98b..a4f08aba1 100644 --- a/include/boost/geometry/strategies/distance/services.hpp +++ b/include/boost/geometry/strategies/distance/services.hpp @@ -30,8 +30,8 @@ template < typename Geometry1, typename Geometry2, - typename CSTag1 = typename geometry::cs_tag::type, - typename CSTag2 = typename geometry::cs_tag::type + typename CSTag1 = geometry::cs_tag_t, + typename CSTag2 = geometry::cs_tag_t > struct default_strategy { @@ -54,8 +54,8 @@ template typename Geometry1, typename Geometry2, typename Strategy, - typename CSTag1 = typename geometry::cs_tag::type, - typename CSTag2 = typename geometry::cs_tag::type + typename CSTag1 = geometry::cs_tag_t, + typename CSTag2 = geometry::cs_tag_t > struct custom_strategy_converter { diff --git a/include/boost/geometry/strategies/envelope/services.hpp b/include/boost/geometry/strategies/envelope/services.hpp index f74c19815..1535b0a5f 100644 --- a/include/boost/geometry/strategies/envelope/services.hpp +++ b/include/boost/geometry/strategies/envelope/services.hpp @@ -25,7 +25,7 @@ template < typename Geometry, typename Box, - typename CSTag = typename geometry::cs_tag::type + typename CSTag = geometry::cs_tag_t > struct default_strategy { diff --git a/include/boost/geometry/strategies/expand/services.hpp b/include/boost/geometry/strategies/expand/services.hpp index a636355db..c4c622ece 100644 --- a/include/boost/geometry/strategies/expand/services.hpp +++ b/include/boost/geometry/strategies/expand/services.hpp @@ -25,7 +25,7 @@ template < typename Box, typename Geometry, - typename CSTag = typename geometry::cs_tag::type + typename CSTag = geometry::cs_tag_t > struct default_strategy { diff --git a/include/boost/geometry/strategies/geographic.hpp b/include/boost/geometry/strategies/geographic.hpp index 435ba29b2..f0af5b97f 100644 --- a/include/boost/geometry/strategies/geographic.hpp +++ b/include/boost/geometry/strategies/geographic.hpp @@ -1,5 +1,7 @@ // Boost.Geometry +// Copyright (c) 2025 Adam Wulkiewicz, Lodz, Poland. + // Copyright (c) 2020-2021, Oracle and/or its affiliates. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle @@ -14,6 +16,8 @@ #include #include #include +#include +#include #include #include #include @@ -41,9 +45,10 @@ template > class geographic // derived from the umbrella strategy defining the most strategies - : public index::geographic + : public strategies::closest_points::geographic + , public strategies::centroid::detail::geographic { - using base_t = index::geographic; + using base_t = strategies::closest_points::geographic; public: geographic() = default; diff --git a/include/boost/geometry/strategies/geographic/closest_points_pt_seg.hpp b/include/boost/geometry/strategies/geographic/closest_points_pt_seg.hpp index 94b32a50d..25030b409 100644 --- a/include/boost/geometry/strategies/geographic/closest_points_pt_seg.hpp +++ b/include/boost/geometry/strategies/geographic/closest_points_pt_seg.hpp @@ -84,7 +84,7 @@ public : < typename calculation_type::type, dimension::value, - typename coordinate_system::type + coordinate_system_t > cp; geometry::set_from_radian<0>(cp, result.lon); diff --git a/include/boost/geometry/strategies/geographic/densify.hpp b/include/boost/geometry/strategies/geographic/densify.hpp index 529f90d6b..e6e0abf28 100644 --- a/include/boost/geometry/strategies/geographic/densify.hpp +++ b/include/boost/geometry/strategies/geographic/densify.hpp @@ -63,16 +63,16 @@ public: template inline void apply(Point const& p0, Point const& p1, AssignPolicy & policy, T const& length_threshold) const { - typedef typename AssignPolicy::point_type out_point_t; - typedef typename select_most_precise + using out_point_t = typename AssignPolicy::point_type; + using calc_t = typename select_most_precise < - typename coordinate_type::type, - typename coordinate_type::type, + coordinate_type_t, + coordinate_type_t, CalculationType - >::type calc_t; + >::type; - typedef typename FormulaPolicy::template direct direct_t; - typedef typename FormulaPolicy::template inverse inverse_t; + using direct_t = typename FormulaPolicy::template direct; + using inverse_t = typename FormulaPolicy::template inverse; typename inverse_t::result_type inv_r = inverse_t::apply(get_as_radian<0>(p0), get_as_radian<1>(p0), diff --git a/include/boost/geometry/strategies/geographic/distance_cross_track.hpp b/include/boost/geometry/strategies/geographic/distance_cross_track.hpp index db5e46b9c..1a4548a8d 100644 --- a/include/boost/geometry/strategies/geographic/distance_cross_track.hpp +++ b/include/boost/geometry/strategies/geographic/distance_cross_track.hpp @@ -1,6 +1,6 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) -// Copyright (c) 2023 Adam Wulkiewicz, Lodz, Poland. +// Copyright (c) 2023-2025 Adam Wulkiewicz, Lodz, Poland. // Copyright (c) 2016-2022, Oracle and/or its affiliates. // Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle @@ -273,7 +273,7 @@ private: pl_lat = res14.lat2; } - CT new_distance = inverse_distance_type::apply(lon3, lat3, res14.lon2, res14.lat2, + CT const new_distance = inverse_distance_type::apply(lon3, lat3, res14.lon2, res14.lat2, spheroid).distance; dist_improve = new_distance != result.distance; @@ -346,8 +346,8 @@ private: // g4 is the angle between segment (p1,p2) and segment (p3,p4) // that meet on p4 (GEO) - CT a4 = inverse_dist_azimuth_type::apply(res14.lon2, res14.lat2, - lon2, lat2, spheroid).azimuth; + CT const a4 = inverse_dist_azimuth_type::apply(res14.lon2, res14.lat2, + lon2, lat2, spheroid).azimuth; res34 = inverse_distance_azimuth_quantities_type::apply(res14.lon2, res14.lat2, lon3, lat3, spheroid); g4 = res34.azimuth - a4; @@ -527,8 +527,8 @@ protected: CT lat1 = la1; CT lon2 = lo2; CT lat2 = la2; - CT lon3 = lo3; - CT lat3 = la3; + CT const lon3 = lo3; + CT const lat3 = la3; if (lon1 > lon2) { @@ -549,14 +549,14 @@ protected: //segment on equator //Note: antipodal points on equator does not define segment on equator //but pass by the pole - CT diff = geometry::math::longitude_distance_signed(lon1, lon2); + CT const diff = geometry::math::longitude_distance_signed(lon1, lon2); using meridian_inverse = typename formula::meridian_inverse; - bool meridian_not_crossing_pole = + bool const meridian_not_crossing_pole = meridian_inverse::meridian_not_crossing_pole(lat1, lat2, diff); - bool meridian_crossing_pole = + bool const meridian_crossing_pole = meridian_inverse::meridian_crossing_pole(diff); if (math::equals(lat1, c0) && math::equals(lat2, c0) @@ -596,18 +596,18 @@ protected: #ifdef BOOST_GEOMETRY_DEBUG_GEOGRAPHIC_CROSS_TRACK std::cout << "Meridian segment crossing pole" << std::endl; #endif - CT sign_non_zero = lat3 >= c0 ? 1 : -1; + CT const sign_non_zero = lat3 >= c0 ? 1 : -1; - auto res13 = apply(lon1, lat1, lon1, half_pi * sign_non_zero, lon3, lat3, spheroid); + auto const res13 = apply(lon1, lat1, lon1, half_pi * sign_non_zero, lon3, lat3, spheroid); - auto res23 = apply(lon2, lat2, lon2, half_pi * sign_non_zero, lon3, lat3, spheroid); + auto const res23 = apply(lon2, lat2, lon2, half_pi * sign_non_zero, lon3, lat3, spheroid); return (res13.distance) < (res23.distance) ? res13 : res23; } - auto res12 = inverse_dist_azimuth_reverse_type::apply(lon1, lat1, lon2, lat2, spheroid); + auto const res12 = inverse_dist_azimuth_reverse_type::apply(lon1, lat1, lon2, lat2, spheroid); - auto res13 = inverse_dist_azimuth_type::apply(lon1, lat1, lon3, lat3, spheroid); + auto const res13 = inverse_dist_azimuth_type::apply(lon1, lat1, lon3, lat3, spheroid); if (geometry::math::equals(res12.distance, c0)) { @@ -616,14 +616,14 @@ protected: std::cout << "distance between points=" << res13.distance << std::endl; #endif - auto res = meridian_inverse::apply(lon1, lat1, lon3, lat3, spheroid); + auto const res = meridian_inverse::apply(lon1, lat1, lon3, lat3, spheroid); return non_iterative_case(lon3, lat3, lon1, lat2, res.meridian ? res.distance : res13.distance); } // Compute a12 (GEO) - CT a312 = res13.azimuth - res12.azimuth; + CT const a312 = res13.azimuth - res12.azimuth; // TODO: meridian case optimization if (geometry::math::equals(a312, c0) && meridian_not_crossing_pole) @@ -640,7 +640,7 @@ protected: } } - CT projection1 = cos( a312 ) * res13.distance / res12.distance; + CT const projection1 = cos( a312 ) * res13.distance / res12.distance; #ifdef BOOST_GEOMETRY_DEBUG_GEOGRAPHIC_CROSS_TRACK std::cout << "a1=" << res12.azimuth * math::r2d() << std::endl; @@ -661,10 +661,10 @@ protected: return non_iterative_case(lon3, lat3, lon1, lat1, spheroid); } - auto res23 = inverse_dist_azimuth_type::apply(lon2, lat2, lon3, lat3, spheroid); + auto const res23 = inverse_dist_azimuth_type::apply(lon2, lat2, lon3, lat3, spheroid); - CT a321 = res23.azimuth - res12.reverse_azimuth + pi; - CT projection2 = cos( a321 ) * res23.distance / res12.distance; + CT const a321 = res23.azimuth - res12.reverse_azimuth + pi; + CT const projection2 = cos( a321 ) * res23.distance / res12.distance; #ifdef BOOST_GEOMETRY_DEBUG_GEOGRAPHIC_CROSS_TRACK std::cout << "a21=" << res12.reverse_azimuth * math::r2d() @@ -693,25 +693,28 @@ protected: geometry::cs::spherical_equatorial >; - point p1 = point(lon1, lat1); - point p2 = point(lon2, lat2); - point p3 = point(lon3, lat3); + point const p1(lon1, lat1); + point const p2(lon2, lat2); + point const p3(lon3, lat3); - geometry::strategy::distance::cross_track cross_track(earth_radius); - CT s34_sph = cross_track.apply(p3, p1, p2); + using haversine_t = geometry::strategy::distance::haversine; + using cross_track_t = geometry::strategy::distance::cross_track; - geometry::strategy::distance::haversine str(earth_radius); - CT s13_sph = str.apply(p1, p3); + cross_track_t const cross_track(earth_radius); + CT const s34_sph = cross_track.apply(p3, p1, p2); + + haversine_t const str(earth_radius); + CT const s13_sph = str.apply(p1, p3); //CT s14 = acos( cos(s13/earth_radius) / cos(s34/earth_radius) ) * earth_radius; - CT cos_frac = cos(s13_sph / earth_radius) / cos(s34_sph / earth_radius); - CT s14_sph = cos_frac >= 1 ? CT(0) + CT const cos_frac = cos(s13_sph / earth_radius) / cos(s34_sph / earth_radius); + CT const s14_sph = cos_frac >= 1 ? CT(0) : cos_frac <= -1 ? pi * earth_radius : acos(cos_frac) * earth_radius; CT const a12_sph = geometry::formula::spherical_azimuth<>(lon1, lat1, lon2, lat2); - auto res = geometry::formula::spherical_direct(lon1, lat1, + auto const res = geometry::formula::spherical_direct(lon1, lat1, s14_sph, a12_sph, srs::sphere(earth_radius)); // this is what postgis (version 2.5) returns @@ -734,7 +737,7 @@ protected: } else { - CT s14_start = geometry::strategy::distance::geographic + CT const s14_start = geometry::strategy::distance::geographic < FormulaPolicy, Spheroid, diff --git a/include/boost/geometry/strategies/geographic/distance_cross_track_box_box.hpp b/include/boost/geometry/strategies/geographic/distance_cross_track_box_box.hpp index fed9a670a..4c9b2a2ee 100644 --- a/include/boost/geometry/strategies/geographic/distance_cross_track_box_box.hpp +++ b/include/boost/geometry/strategies/geographic/distance_cross_track_box_box.hpp @@ -1,5 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) +// Copyright (c) 2025 Adam Wulkiewicz, Lodz, Poland. + // Copyright (c) 2017-2021, Oracle and/or its affiliates. // Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle @@ -133,67 +135,52 @@ private : namespace services { -template -struct tag > +template +struct tag > { typedef strategy_tag_distance_box_box type; }; -template -struct return_type, Box1, Box2> +template +struct return_type, Box1, Box2> : geographic_cross_track_box_box < - Strategy, Spheroid, CalculationType + FormulaPolicy, Spheroid, CalculationType >::template return_type {}; -template -struct return_type, Box1, Box2> - : geographic_cross_track_box_box - < - Strategy, Spheroid - >::template return_type -{}; -template -struct return_type, Box1, Box2> - : geographic_cross_track_box_box - < - Strategy - >::template return_type -{}; - -template -struct comparable_type > +template +struct comparable_type > { typedef geographic_cross_track_box_box < - typename comparable_type::type, Spheroid, CalculationType + FormulaPolicy, Spheroid, CalculationType > type; }; -template -struct get_comparable > +template +struct get_comparable > { public: - static inline geographic_cross_track_box_box - apply(geographic_cross_track_box_box const& str) + static inline geographic_cross_track_box_box + apply(geographic_cross_track_box_box const& str) { return str; } }; -template +template struct result_from_distance < - geographic_cross_track_box_box, Box1, Box2 + geographic_cross_track_box_box, Box1, Box2 > { private: - typedef geographic_cross_track_box_box this_strategy; + typedef geographic_cross_track_box_box this_strategy; typedef typename this_strategy::template return_type < @@ -205,12 +192,7 @@ public: static inline return_type apply(this_strategy const& strategy, T const& distance) { - result_from_distance - < - Strategy, - point_type_t, - point_type_t - >::apply(strategy, distance); + return static_cast(distance); } }; diff --git a/include/boost/geometry/strategies/geographic/distance_segment_box.hpp b/include/boost/geometry/strategies/geographic/distance_segment_box.hpp index 552bfcdbe..a24a36a61 100644 --- a/include/boost/geometry/strategies/geographic/distance_segment_box.hpp +++ b/include/boost/geometry/strategies/geographic/distance_segment_box.hpp @@ -58,7 +58,7 @@ struct geographic_segment_box > {}; - typedef geographic_tag cs_tag; + using cs_tag = geographic_tag; //constructor diff --git a/include/boost/geometry/strategies/geographic/intersection.hpp b/include/boost/geometry/strategies/geographic/intersection.hpp index 3f10ce092..c593d1917 100644 --- a/include/boost/geometry/strategies/geographic/intersection.hpp +++ b/include/boost/geometry/strategies/geographic/intersection.hpp @@ -78,7 +78,7 @@ template > struct geographic_segments { - typedef geographic_tag cs_tag; + using cs_tag = geographic_tag; enum intersection_point_flag { ipi_inters = 0, ipi_at_a1, ipi_at_a2, ipi_at_b1, ipi_at_b2 }; @@ -148,10 +148,10 @@ struct geographic_segments BOOST_CONCEPT_ASSERT( (concepts::ConstPoint) ); /* - typename coordinate_type::type + coordinate_type_t const a1_lon = get<0>(a1), const a2_lon = get<0>(a2); - typename coordinate_type::type + coordinate_type_t const b1_lon = get<0>(b1), const b2_lon = get<0>(b2); bool is_a_reversed = a1_lon > a2_lon || a1_lon == a2_lon && get<1>(a1) > get<1>(a2); diff --git a/include/boost/geometry/strategies/geographic/intersection_elliptic.hpp b/include/boost/geometry/strategies/geographic/intersection_elliptic.hpp index c7aaf8aa8..d3babe8a7 100644 --- a/include/boost/geometry/strategies/geographic/intersection_elliptic.hpp +++ b/include/boost/geometry/strategies/geographic/intersection_elliptic.hpp @@ -49,7 +49,7 @@ struct great_elliptic_segments_calc_policy template struct plane { - typedef typename coordinate_type::type coord_t; + using coord_t = coordinate_type_t; // not normalized plane(Point3d const& p1, Point3d const& p2) @@ -98,7 +98,7 @@ struct great_elliptic_segments_calc_policy plane const& plane2, Point3d & ip1, Point3d & ip2) const { - typedef typename coordinate_type::type coord_t; + using coord_t = coordinate_type_t; Point3d id = cross_product(plane1.normal, plane2.normal); // NOTE: the length should be greater than 0 at this point @@ -140,7 +140,7 @@ struct experimental_elliptic_segments_calc_policy template struct plane { - typedef typename coordinate_type::type coord_t; + using coord_t = coordinate_type_t; // not normalized plane(Point3d const& p1, Point3d const& p2, Spheroid const& spheroid) diff --git a/include/boost/geometry/strategies/geographic/side.hpp b/include/boost/geometry/strategies/geographic/side.hpp index a0b4abc81..50c7e98e0 100644 --- a/include/boost/geometry/strategies/geographic/side.hpp +++ b/include/boost/geometry/strategies/geographic/side.hpp @@ -65,7 +65,7 @@ template class geographic { public: - typedef geographic_tag cs_tag; + using cs_tag = geographic_tag; geographic() = default; diff --git a/include/boost/geometry/strategies/index/cartesian.hpp b/include/boost/geometry/strategies/index/cartesian.hpp index 8cbf7ac5a..01e92888e 100644 --- a/include/boost/geometry/strategies/index/cartesian.hpp +++ b/include/boost/geometry/strategies/index/cartesian.hpp @@ -1,5 +1,7 @@ // Boost.Geometry +// Copyright (c) 2025 Adam Wulkiewicz, Lodz, Poland. + // Copyright (c) 2020-2021, Oracle and/or its affiliates. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle @@ -11,17 +13,18 @@ #define BOOST_GEOMETRY_STRATEGIES_INDEX_CARTESIAN_HPP +#include #include #include - namespace boost { namespace geometry { namespace strategies { namespace index { template class cartesian : public distance::cartesian + , public strategies::centroid::detail::cartesian {}; diff --git a/include/boost/geometry/strategies/index/geographic.hpp b/include/boost/geometry/strategies/index/geographic.hpp index 609d2c82f..2a2fc16be 100644 --- a/include/boost/geometry/strategies/index/geographic.hpp +++ b/include/boost/geometry/strategies/index/geographic.hpp @@ -1,5 +1,7 @@ // Boost.Geometry +// Copyright (c) 2025 Adam Wulkiewicz, Lodz, Poland. + // Copyright (c) 2020-2021, Oracle and/or its affiliates. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle @@ -11,6 +13,7 @@ #define BOOST_GEOMETRY_STRATEGIES_INDEX_GEOGRAPHIC_HPP +#include #include #include @@ -26,6 +29,7 @@ template > class geographic : public distance::geographic + , public strategies::centroid::detail::geographic { typedef distance::geographic base_t; diff --git a/include/boost/geometry/strategies/index/services.hpp b/include/boost/geometry/strategies/index/services.hpp index 635a8523d..d6cc2e228 100644 --- a/include/boost/geometry/strategies/index/services.hpp +++ b/include/boost/geometry/strategies/index/services.hpp @@ -24,7 +24,7 @@ namespace strategies { namespace index { namespace services template < typename Geometry, - typename CSTag = typename geometry::cs_tag::type + typename CSTag = geometry::cs_tag_t > struct default_strategy { diff --git a/include/boost/geometry/strategies/index/spherical.hpp b/include/boost/geometry/strategies/index/spherical.hpp index c3502207b..26ae00c7a 100644 --- a/include/boost/geometry/strategies/index/spherical.hpp +++ b/include/boost/geometry/strategies/index/spherical.hpp @@ -1,5 +1,7 @@ // Boost.Geometry +// Copyright (c) 2025 Adam Wulkiewicz, Lodz, Poland. + // Copyright (c) 2020-2021, Oracle and/or its affiliates. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle @@ -11,6 +13,7 @@ #define BOOST_GEOMETRY_STRATEGIES_INDEX_SPHERICAL_HPP +#include #include #include @@ -28,6 +31,7 @@ namespace detail template class spherical : public strategies::distance::detail::spherical + , public strategies::centroid::detail::spherical { using base_t = strategies::distance::detail::spherical; diff --git a/include/boost/geometry/strategies/intersection_result.hpp b/include/boost/geometry/strategies/intersection_result.hpp index 971dc9f2b..7feea9f2d 100644 --- a/include/boost/geometry/strategies/intersection_result.hpp +++ b/include/boost/geometry/strategies/intersection_result.hpp @@ -58,7 +58,7 @@ struct fraction_type template < typename Point, - typename SegmentRatio = segment_ratio::type> + typename SegmentRatio = segment_ratio> > struct segment_intersection_points { diff --git a/include/boost/geometry/strategies/io/services.hpp b/include/boost/geometry/strategies/io/services.hpp index 2577f06aa..8ccf6ca17 100644 --- a/include/boost/geometry/strategies/io/services.hpp +++ b/include/boost/geometry/strategies/io/services.hpp @@ -27,7 +27,7 @@ namespace services template < typename Geometry, - typename CSTag = typename geometry::cs_tag::type + typename CSTag = geometry::cs_tag_t > struct default_strategy { diff --git a/include/boost/geometry/strategies/is_convex/services.hpp b/include/boost/geometry/strategies/is_convex/services.hpp index 7302f6dcb..7309ddf4f 100644 --- a/include/boost/geometry/strategies/is_convex/services.hpp +++ b/include/boost/geometry/strategies/is_convex/services.hpp @@ -28,7 +28,7 @@ namespace services template < typename Geometry, - typename CSTag = typename geometry::cs_tag::type + typename CSTag = geometry::cs_tag_t > struct default_strategy { diff --git a/include/boost/geometry/strategies/length/services.hpp b/include/boost/geometry/strategies/length/services.hpp index 0b17f9e44..27436bc24 100644 --- a/include/boost/geometry/strategies/length/services.hpp +++ b/include/boost/geometry/strategies/length/services.hpp @@ -27,7 +27,7 @@ namespace services template < typename Geometry, - typename CSTag = typename geometry::cs_tag::type + typename CSTag = geometry::cs_tag_t > struct default_strategy { diff --git a/include/boost/geometry/strategies/line_interpolate/services.hpp b/include/boost/geometry/strategies/line_interpolate/services.hpp index 95ba215bc..b46bf71f2 100644 --- a/include/boost/geometry/strategies/line_interpolate/services.hpp +++ b/include/boost/geometry/strategies/line_interpolate/services.hpp @@ -27,7 +27,7 @@ namespace services template < typename Geometry, - typename CSTag = typename geometry::cs_tag::type + typename CSTag = geometry::cs_tag_t > struct default_strategy { diff --git a/include/boost/geometry/strategies/normalize.hpp b/include/boost/geometry/strategies/normalize.hpp index 8cfaf9522..e9887d5ed 100644 --- a/include/boost/geometry/strategies/normalize.hpp +++ b/include/boost/geometry/strategies/normalize.hpp @@ -58,7 +58,7 @@ struct assign_loop { geometry::set(point_out, util::numeric_cast < - typename coordinate_type::type + coordinate_type_t >(geometry::get(point_in))); assign_loop @@ -89,10 +89,7 @@ struct assign_loop<0, DimensionCount> PointIn const& point_in, PointOut& point_out) { - geometry::set<0>(point_out, util::numeric_cast - < - typename coordinate_type::type - >(longitude)); + geometry::set<0>(point_out, util::numeric_cast>(longitude)); assign_loop < @@ -112,7 +109,7 @@ struct assign_loop<1, DimensionCount> { geometry::set<1>(point_out, util::numeric_cast < - typename coordinate_type::type + coordinate_type_t >(latitude)); assign_loop @@ -128,7 +125,7 @@ struct normalize_point { static inline void apply(PointIn const& point_in, PointOut& point_out) { - typedef typename coordinate_type::type in_coordinate_type; + using in_coordinate_type = coordinate_type_t; in_coordinate_type longitude = geometry::get<0>(point_in); in_coordinate_type latitude = geometry::get<1>(point_in); @@ -187,7 +184,7 @@ class normalize_box public: static inline void apply(BoxIn const& box_in, BoxOut& box_out) { - typedef typename coordinate_type::type in_coordinate_type; + using in_coordinate_type = coordinate_type_t; in_coordinate_type lon_min = geometry::get(box_in); in_coordinate_type lat_min = geometry::get(box_in); diff --git a/include/boost/geometry/strategies/relate/cartesian.hpp b/include/boost/geometry/strategies/relate/cartesian.hpp index 2b8a9e13a..dbeccb8c6 100644 --- a/include/boost/geometry/strategies/relate/cartesian.hpp +++ b/include/boost/geometry/strategies/relate/cartesian.hpp @@ -22,6 +22,8 @@ #include #include +#include +#include #include #include #include @@ -155,6 +157,13 @@ public: return strategy::intersection::cartesian_segments(); } + template + static auto comparable_distance(Geometry1 const&, Geometry2 const&, + distance::detail::enable_if_pp_t * = nullptr) + { + return strategy::distance::comparable::pythagoras(); + } + // side static auto side() diff --git a/include/boost/geometry/strategies/relate/geographic.hpp b/include/boost/geometry/strategies/relate/geographic.hpp index b756f1a16..af40c81e3 100644 --- a/include/boost/geometry/strategies/relate/geographic.hpp +++ b/include/boost/geometry/strategies/relate/geographic.hpp @@ -20,6 +20,8 @@ #include #include +#include +#include #include #include #include @@ -78,6 +80,16 @@ public: >(base_t::m_spheroid); } + template + auto comparable_distance(Geometry1 const&, Geometry2 const&, + distance::detail::enable_if_pp_t * = nullptr) const + { + return strategy::distance::geographic + < + FormulaPolicy, Spheroid, CalculationType + >(base_t::m_spheroid); + } + // covered_by template diff --git a/include/boost/geometry/strategies/relate/services.hpp b/include/boost/geometry/strategies/relate/services.hpp index cf9f7c97d..afd1251d6 100644 --- a/include/boost/geometry/strategies/relate/services.hpp +++ b/include/boost/geometry/strategies/relate/services.hpp @@ -28,8 +28,8 @@ template < typename Geometry1, typename Geometry2, - typename CSTag1 = typename geometry::cs_tag::type, - typename CSTag2 = typename geometry::cs_tag::type + typename CSTag1 = geometry::cs_tag_t, + typename CSTag2 = geometry::cs_tag_t > struct default_strategy { diff --git a/include/boost/geometry/strategies/relate/spherical.hpp b/include/boost/geometry/strategies/relate/spherical.hpp index 7914831fe..11b2ae032 100644 --- a/include/boost/geometry/strategies/relate/spherical.hpp +++ b/include/boost/geometry/strategies/relate/spherical.hpp @@ -20,6 +20,8 @@ #include #include +#include +#include #include #include #include @@ -77,6 +79,16 @@ public: >(base_t::radius()); } + template + auto comparable_distance(Geometry1 const&, Geometry2 const&, + distance::detail::enable_if_pp_t * = nullptr) const + { + return strategy::distance::comparable::haversine + < + typename base_t::radius_type, CalculationType + >(base_t::radius()); + } + // covered_by template diff --git a/include/boost/geometry/strategies/simplify/services.hpp b/include/boost/geometry/strategies/simplify/services.hpp index 6f6034317..78eb4ba3d 100644 --- a/include/boost/geometry/strategies/simplify/services.hpp +++ b/include/boost/geometry/strategies/simplify/services.hpp @@ -27,7 +27,7 @@ namespace services template < typename Geometry, - typename CSTag = typename geometry::cs_tag::type + typename CSTag = geometry::cs_tag_t > struct default_strategy { diff --git a/include/boost/geometry/strategies/spherical.hpp b/include/boost/geometry/strategies/spherical.hpp index 0fed07e5b..b8f34c725 100644 --- a/include/boost/geometry/strategies/spherical.hpp +++ b/include/boost/geometry/strategies/spherical.hpp @@ -1,5 +1,7 @@ // Boost.Geometry +// Copyright (c) 2025 Adam Wulkiewicz, Lodz, Poland. + // Copyright (c) 2020-2021, Oracle and/or its affiliates. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle @@ -14,6 +16,8 @@ #include #include #include +#include +#include #include #include #include @@ -40,9 +44,10 @@ template > class spherical // derived from the umbrella strategy defining the most strategies - : public strategies::index::detail::spherical + : public strategies::closest_points::spherical + , public strategies::centroid::detail::spherical { - using base_t = strategies::index::detail::spherical; + using base_t = strategies::closest_points::spherical; public: spherical() = default; diff --git a/include/boost/geometry/strategies/spherical/closest_points_pt_seg.hpp b/include/boost/geometry/strategies/spherical/closest_points_pt_seg.hpp index 5790ead7a..353fcf2ae 100644 --- a/include/boost/geometry/strategies/spherical/closest_points_pt_seg.hpp +++ b/include/boost/geometry/strategies/spherical/closest_points_pt_seg.hpp @@ -93,7 +93,7 @@ public: < CT, dimension::value, - typename coordinate_system::type + coordinate_system_t > result; // http://williams.best.vwh.net/avform.htm#XTE diff --git a/include/boost/geometry/strategies/spherical/compare.hpp b/include/boost/geometry/strategies/spherical/compare.hpp index dc3d14bef..85586fc44 100644 --- a/include/boost/geometry/strategies/spherical/compare.hpp +++ b/include/boost/geometry/strategies/spherical/compare.hpp @@ -45,14 +45,14 @@ namespace detail { template -static inline typename geometry::coordinate_type

::type +static inline geometry::coordinate_type_t

get(P const& p, std::true_type /*same units*/) { return geometry::get(p); } template -static inline typename geometry::coordinate_type

::type +static inline geometry::coordinate_type_t

get(P const& p, std::false_type /*different units*/) { return geometry::get_as_radian(p); @@ -68,11 +68,11 @@ template > struct spherical_latitude { - typedef typename geometry::coordinate_type::type coordinate1_type; - typedef typename geometry::detail::cs_angular_units::type units1_type; - typedef typename geometry::coordinate_type::type coordinate2_type; - typedef typename geometry::detail::cs_angular_units::type units2_type; - typedef std::is_same same_units_type; + using coordinate1_type = geometry::coordinate_type_t; + using units1_type = typename geometry::detail::cs_angular_units::type; + using coordinate2_type = geometry::coordinate_type_t; + using units2_type = typename geometry::detail::cs_angular_units::type; + using same_units_type = std::is_same; template static inline bool apply(Point1 const& left, Point2 const& right, @@ -136,18 +136,15 @@ template > struct spherical_longitude { - typedef typename geometry::coordinate_type::type coordinate1_type; - typedef typename geometry::detail::cs_angular_units::type units1_type; - typedef typename geometry::coordinate_type::type coordinate2_type; - typedef typename geometry::detail::cs_angular_units::type units2_type; - typedef std::is_same same_units_type; - typedef std::conditional_t units_type; + using coordinate1_type = geometry::coordinate_type_t; + using units1_type = typename geometry::detail::cs_angular_units::type; + using coordinate2_type = geometry::coordinate_type_t; + using units2_type = typename geometry::detail::cs_angular_units::type; + using same_units_type = std::is_same; + using units_type = std::conditional_t; - static const bool is_equatorial = ! std::is_same - < - typename geometry::cs_tag::type, - geometry::spherical_polar_tag - >::value; + static const bool is_equatorial = + ! std::is_same, geometry::spherical_polar_tag>::value; static inline bool are_both_at_antimeridian(coordinate1_type const& l0, coordinate2_type const& r0, diff --git a/include/boost/geometry/strategies/spherical/densify.hpp b/include/boost/geometry/strategies/spherical/densify.hpp index 8b14f7ae6..0113b772b 100644 --- a/include/boost/geometry/strategies/spherical/densify.hpp +++ b/include/boost/geometry/strategies/spherical/densify.hpp @@ -79,13 +79,13 @@ public: template inline void apply(Point const& p0, Point const& p1, AssignPolicy & policy, T const& length_threshold) const { - typedef typename AssignPolicy::point_type out_point_t; - typedef typename select_most_precise + using out_point_t = typename AssignPolicy::point_type; + using calc_t = typename select_most_precise < - typename coordinate_type::type, - typename coordinate_type::type, + coordinate_type_t, + coordinate_type_t, CalculationType - >::type calc_t; + >::type; calc_t angle01; diff --git a/include/boost/geometry/strategies/spherical/disjoint_box_box.hpp b/include/boost/geometry/strategies/spherical/disjoint_box_box.hpp index f0504a8b1..5e00e1b99 100644 --- a/include/boost/geometry/strategies/spherical/disjoint_box_box.hpp +++ b/include/boost/geometry/strategies/spherical/disjoint_box_box.hpp @@ -46,8 +46,8 @@ struct box_box_on_spheroid { typedef typename geometry::select_most_precise < - typename coordinate_type::type, - typename coordinate_type::type + coordinate_type_t, + coordinate_type_t >::type calc_t; typedef typename geometry::detail::cs_angular_units::type units_t; typedef math::detail::constants_on_spheroid constants; diff --git a/include/boost/geometry/strategies/spherical/distance_cross_track_box_box.hpp b/include/boost/geometry/strategies/spherical/distance_cross_track_box_box.hpp index f021cf99e..7e62094a4 100644 --- a/include/boost/geometry/strategies/spherical/distance_cross_track_box_box.hpp +++ b/include/boost/geometry/strategies/spherical/distance_cross_track_box_box.hpp @@ -1,5 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) +// Copyright (c) 2025 Adam Wulkiewicz, Lodz, Poland. + // Copyright (c) 2016-2020 Oracle and/or its affiliates. // Contributed and/or modified by Vissarion Fisikopoulos, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle @@ -45,15 +47,15 @@ class cross_track_box_box_generic { public : - template - ReturnType static inline diagonal_case(Point topA, - Point topB, - Point bottomA, - Point bottomB, + template + static inline ReturnType diagonal_case(Point1 const& topA, + Point2 const& topB, + Point1 const& bottomA, + Point2 const& bottomB, bool north_shortest, bool non_overlap, - PPStrategy pp_strategy, - PSStrategy ps_strategy) + PPStrategy const& pp_strategy, + PSStrategy const& ps_strategy) { if (north_shortest && non_overlap) { @@ -78,10 +80,10 @@ public : typename PPStrategy, typename PSStrategy > - ReturnType static inline apply (Box1 const& box1, - Box2 const& box2, - PPStrategy pp_strategy, - PSStrategy ps_strategy) + static inline ReturnType apply(Box1 const& box1, + Box2 const& box2, + PPStrategy const& pp_strategy, + PSStrategy const& ps_strategy) { // this method assumes that the coordinates of the point and diff --git a/include/boost/geometry/strategies/spherical/distance_segment_box.hpp b/include/boost/geometry/strategies/spherical/distance_segment_box.hpp index 32ce3bcaa..6396b6100 100644 --- a/include/boost/geometry/strategies/spherical/distance_segment_box.hpp +++ b/include/boost/geometry/strategies/spherical/distance_segment_box.hpp @@ -65,7 +65,7 @@ struct generic_segment_box < std::is_same < - typename geometry::cs_tag::type, + geometry::cs_tag_t, spherical_polar_tag >::value, spherical_polar_tag, spherical_equatorial_tag @@ -107,15 +107,15 @@ struct generic_segment_box // disjoint but vertex not computed if (disjoint_result == disjoint_info_type::disjoint_no_vertex) { - typedef typename coordinate_type::type CT; + using coor_t = coordinate_type_t; geometry::model::box mbr; geometry::envelope(seg, mbr, strategies); - CT lon1 = geometry::get_as_radian<0>(p0); - CT lat1 = geometry::get_as_radian<1>(p0); - CT lon2 = geometry::get_as_radian<0>(p1); - CT lat2 = geometry::get_as_radian<1>(p1); + coor_t lon1 = geometry::get_as_radian<0>(p0); + coor_t lat1 = geometry::get_as_radian<1>(p0); + coor_t lon2 = geometry::get_as_radian<0>(p1); + coor_t lat2 = geometry::get_as_radian<1>(p1); if (lon1 > lon2) { @@ -123,22 +123,22 @@ struct generic_segment_box std::swap(lat1, lat2); } - CT vertex_lat; - CT lat_sum = lat1 + lat2; - if (lat_sum > CT(0)) + coor_t vertex_lat; + coor_t lat_sum = lat1 + lat2; + if (lat_sum > coor_t(0)) { vertex_lat = geometry::get_as_radian(mbr); } else { vertex_lat = geometry::get_as_radian(mbr); } - CT alp1; + coor_t alp1; strategies.azimuth().apply(lon1, lat1, lon2, lat2, alp1); // TODO: formula should not call strategy! - CT vertex_lon = geometry::formula::vertex_longitude + coor_t vertex_lon = geometry::formula::vertex_longitude < - CT, + coor_t, cs_tag >::apply(lon1, lat1, lon2, lat2, vertex_lat, alp1, strategies.azimuth()); @@ -216,7 +216,7 @@ struct spherical_segment_box > {}; - typedef spherical_tag cs_tag; + using cs_tag = spherical_tag; // constructors diff --git a/include/boost/geometry/strategies/spherical/get_radius.hpp b/include/boost/geometry/strategies/spherical/get_radius.hpp index 411642b13..2a45c7688 100644 --- a/include/boost/geometry/strategies/spherical/get_radius.hpp +++ b/include/boost/geometry/strategies/spherical/get_radius.hpp @@ -32,7 +32,7 @@ namespace strategy_detail template < typename RadiusTypeOrSphere, - typename Tag = typename tag::type + typename Tag = tag_t > struct get_radius { @@ -57,11 +57,11 @@ struct get_radius template struct get_radius { - typedef typename select_most_precise + using type = typename select_most_precise < - typename coordinate_type::type, + coordinate_type_t, double - >::type type; + >::type; template static typename get_radius::type diff --git a/include/boost/geometry/strategies/spherical/intersection.hpp b/include/boost/geometry/strategies/spherical/intersection.hpp index 804efd766..4027addd5 100644 --- a/include/boost/geometry/strategies/spherical/intersection.hpp +++ b/include/boost/geometry/strategies/spherical/intersection.hpp @@ -94,7 +94,7 @@ template > struct ecef_segments { - typedef spherical_tag cs_tag; + using cs_tag = spherical_tag; enum intersection_point_flag { ipi_inters = 0, ipi_at_a1, ipi_at_a2, ipi_at_b1, ipi_at_b2 }; @@ -794,7 +794,7 @@ struct spherical_segments_calc_policy template struct plane { - typedef typename coordinate_type::type coord_t; + using coord_t = coordinate_type_t; // not normalized plane(Point3d const& p1, Point3d const& p2) @@ -832,7 +832,7 @@ struct spherical_segments_calc_policy plane const& plane2, Point3d & ip1, Point3d & ip2) { - typedef typename coordinate_type::type coord_t; + using coord_t = coordinate_type_t; ip1 = cross_product(plane1.normal, plane2.normal); // NOTE: the length should be greater than 0 at this point diff --git a/include/boost/geometry/strategies/spherical/point_in_point.hpp b/include/boost/geometry/strategies/spherical/point_in_point.hpp index 242c22010..7381cb0d5 100644 --- a/include/boost/geometry/strategies/spherical/point_in_point.hpp +++ b/include/boost/geometry/strategies/spherical/point_in_point.hpp @@ -59,7 +59,7 @@ namespace detail { namespace within class point_point_on_spheroid { public: - typedef spherical_tag cs_tag; + using cs_tag = spherical_tag; private: template diff --git a/include/boost/geometry/strategies/spherical/point_in_poly_winding.hpp b/include/boost/geometry/strategies/spherical/point_in_poly_winding.hpp index a11c3c705..bdf5dcddc 100644 --- a/include/boost/geometry/strategies/spherical/point_in_poly_winding.hpp +++ b/include/boost/geometry/strategies/spherical/point_in_poly_winding.hpp @@ -122,7 +122,7 @@ class spherical_winding_base }; public: - typedef typename SideStrategy::cs_tag cs_tag; + using cs_tag = typename SideStrategy::cs_tag; spherical_winding_base() = default; @@ -465,8 +465,8 @@ protected: PointOfSegment const& se, count_info const& ci) const { - typedef typename coordinate_type::type scoord_t; - typedef typename geometry::detail::cs_angular_units::type units_t; + using scoord_t = coordinate_type_t; + using units_t = typename geometry::detail::cs_angular_units::type; if (math::equals(get<1>(point), get<1>(se))) { diff --git a/include/boost/geometry/strategies/spherical/point_order.hpp b/include/boost/geometry/strategies/spherical/point_order.hpp index 3f9eb8ce4..fb064ad97 100644 --- a/include/boost/geometry/strategies/spherical/point_order.hpp +++ b/include/boost/geometry/strategies/spherical/point_order.hpp @@ -95,11 +95,8 @@ namespace strategy { namespace point_order // template // static void convert_latitudes(CalcT & lat1, CalcT & lat2) // { -// static const bool is_polar = std::is_same -// < -// typename geometry::cs_tag::type, -// spherical_polar_tag -// >::value; +// static const bool is_polar = +// std::is_same, spherical_polar_tag>::value; // // if BOOST_GEOMETRY_CONSTEXPR (is_polar) // { diff --git a/include/boost/geometry/strategies/spherical/ssf.hpp b/include/boost/geometry/strategies/spherical/ssf.hpp index 2d29c400c..c6a70f834 100644 --- a/include/boost/geometry/strategies/spherical/ssf.hpp +++ b/include/boost/geometry/strategies/spherical/ssf.hpp @@ -86,7 +86,7 @@ class spherical_side_formula { public : - typedef spherical_tag cs_tag; + using cs_tag = spherical_tag; template static inline int apply(P1 const& p1, P2 const& p2, P const& p) diff --git a/include/boost/geometry/strategies/transform/matrix_transformers.hpp b/include/boost/geometry/strategies/transform/matrix_transformers.hpp index 937cc1489..1d782727f 100644 --- a/include/boost/geometry/strategies/transform/matrix_transformers.hpp +++ b/include/boost/geometry/strategies/transform/matrix_transformers.hpp @@ -61,7 +61,7 @@ struct set_point_from_vec template static inline void apply(Point & p, Vector const& v) { - typedef typename geometry::coordinate_type::type coord_t; + using coord_t = geometry::coordinate_type_t; set(p, util::numeric_cast(qvm::A(v))); set_point_from_vec::apply(p, v); } @@ -197,7 +197,7 @@ public : ct const& c1 = get<0>(p1); ct const& c2 = get<1>(p1); - typedef typename geometry::coordinate_type::type ct2; + using ct2 = geometry::coordinate_type_t; set<0>(p2, util::numeric_cast(c1 * qvm::A<0,0>(this->m_matrix) + c2 * qvm::A<0,1>(this->m_matrix) + qvm::A<0,2>(this->m_matrix))); set<1>(p2, util::numeric_cast(c1 * qvm::A<1,0>(this->m_matrix) + c2 * qvm::A<1,1>(this->m_matrix) + qvm::A<1,2>(this->m_matrix))); @@ -240,7 +240,7 @@ public : ct const& c2 = get<1>(p1); ct const& c3 = get<2>(p1); - typedef typename geometry::coordinate_type::type ct2; + using ct2 = geometry::coordinate_type_t; set<0>(p2, util::numeric_cast( c1 * qvm::A<0,0>(this->m_matrix) + c2 * qvm::A<0,1>(this->m_matrix) + c3 * qvm::A<0,2>(this->m_matrix) + qvm::A<0,3>(this->m_matrix))); @@ -289,7 +289,7 @@ public : ct const& c2 = get<1>(p1); ct const& c3 = get<2>(p1); - typedef typename geometry::coordinate_type::type ct2; + using ct2 = geometry::coordinate_type_t; set<0>(p2, util::numeric_cast( c1 * qvm::A<0,0>(this->m_matrix) + c2 * qvm::A<0,1>(this->m_matrix) + c3 * qvm::A<0,2>(this->m_matrix) + qvm::A<0,3>(this->m_matrix))); diff --git a/include/boost/geometry/strategy/area.hpp b/include/boost/geometry/strategy/area.hpp index 24c7fbc58..2bf1beab0 100644 --- a/include/boost/geometry/strategy/area.hpp +++ b/include/boost/geometry/strategy/area.hpp @@ -58,7 +58,7 @@ template struct result_type : select_most_precise < - typename coordinate_type::type, + coordinate_type_t, double > {}; diff --git a/include/boost/geometry/strategy/cartesian/envelope.hpp b/include/boost/geometry/strategy/cartesian/envelope.hpp index f77907342..24af22769 100644 --- a/include/boost/geometry/strategy/cartesian/envelope.hpp +++ b/include/boost/geometry/strategy/cartesian/envelope.hpp @@ -41,7 +41,7 @@ template class cartesian { public: - typedef cartesian_tag cs_tag; + using cs_tag = cartesian_tag; // Linestring, Ring, Polygon diff --git a/include/boost/geometry/strategy/cartesian/envelope_box.hpp b/include/boost/geometry/strategy/cartesian/envelope_box.hpp index c4e808dd3..160ea591d 100644 --- a/include/boost/geometry/strategy/cartesian/envelope_box.hpp +++ b/include/boost/geometry/strategy/cartesian/envelope_box.hpp @@ -80,7 +80,7 @@ namespace strategy { namespace envelope struct cartesian_box { - typedef cartesian_tag cs_tag; + using cs_tag = cartesian_tag; template static inline void apply(BoxIn const& box_in, BoxOut& mbr) diff --git a/include/boost/geometry/strategy/cartesian/side_by_triangle.hpp b/include/boost/geometry/strategy/cartesian/side_by_triangle.hpp index 9535912e6..3fdbd8019 100644 --- a/include/boost/geometry/strategy/cartesian/side_by_triangle.hpp +++ b/include/boost/geometry/strategy/cartesian/side_by_triangle.hpp @@ -211,9 +211,9 @@ public : using promoted_t = typename select_most_precise::type; bool const are_all_integral_coordinates = - std::is_integral::type>::value - && std::is_integral::type>::value - && std::is_integral::type>::value; + std::is_integral>::value + && std::is_integral>::value + && std::is_integral>::value; eps_policy< math::detail::equals_factor_policy > epsp; promoted_t s = compute_side_value diff --git a/include/boost/geometry/strategy/cartesian/side_robust.hpp b/include/boost/geometry/strategy/cartesian/side_robust.hpp index c8405e932..1483cd7e9 100644 --- a/include/boost/geometry/strategy/cartesian/side_robust.hpp +++ b/include/boost/geometry/strategy/cartesian/side_robust.hpp @@ -96,7 +96,7 @@ struct side_robust public: - typedef cartesian_tag cs_tag; + using cs_tag = cartesian_tag; //! \brief Computes the sign of the CCW triangle p1, p2, p template diff --git a/include/boost/geometry/strategy/geographic/envelope.hpp b/include/boost/geometry/strategy/geographic/envelope.hpp index fb61a4595..1218dd259 100644 --- a/include/boost/geometry/strategy/geographic/envelope.hpp +++ b/include/boost/geometry/strategy/geographic/envelope.hpp @@ -45,7 +45,7 @@ class geographic : public spherical { public: - typedef geographic_tag cs_tag; + using cs_tag = geographic_tag; typedef Spheroid model_type; diff --git a/include/boost/geometry/strategy/relate.hpp b/include/boost/geometry/strategy/relate.hpp index 507d5ad05..35295bea1 100644 --- a/include/boost/geometry/strategy/relate.hpp +++ b/include/boost/geometry/strategy/relate.hpp @@ -40,8 +40,8 @@ template < typename Point, typename Geometry, - typename Tag1 = typename tag::type, - typename Tag2 = typename tag::type + typename Tag1 = tag_t, + typename Tag2 = tag_t > struct default_strategy : strategy::within::services::default_strategy diff --git a/include/boost/geometry/strategy/spherical/envelope.hpp b/include/boost/geometry/strategy/spherical/envelope.hpp index fe225ba72..a6937020b 100644 --- a/include/boost/geometry/strategy/spherical/envelope.hpp +++ b/include/boost/geometry/strategy/spherical/envelope.hpp @@ -41,7 +41,7 @@ template class spherical { public: - typedef spherical_tag cs_tag; + using cs_tag = spherical_tag; // Linestring, Ring, Polygon diff --git a/include/boost/geometry/strategy/spherical/envelope_box.hpp b/include/boost/geometry/strategy/spherical/envelope_box.hpp index 66cddbbc1..99f318146 100644 --- a/include/boost/geometry/strategy/spherical/envelope_box.hpp +++ b/include/boost/geometry/strategy/spherical/envelope_box.hpp @@ -34,7 +34,7 @@ namespace strategy { namespace envelope struct spherical_box : geometry::detail::envelope::envelope_box_on_spheroid { - typedef spherical_tag cs_tag; + using cs_tag = spherical_tag; }; diff --git a/include/boost/geometry/strategy/spherical/envelope_multipoint.hpp b/include/boost/geometry/strategy/spherical/envelope_multipoint.hpp index 049360892..afeda0aa4 100644 --- a/include/boost/geometry/strategy/spherical/envelope_multipoint.hpp +++ b/include/boost/geometry/strategy/spherical/envelope_multipoint.hpp @@ -212,11 +212,11 @@ public: { using point_type = point_type_t; using coordinate_type = coordinate_type_t; - typedef math::detail::constants_on_spheroid + using constants = math::detail::constants_on_spheroid < coordinate_type, typename geometry::detail::cs_angular_units::type - > constants; + >; if (boost::empty(multipoint)) { diff --git a/include/boost/geometry/strategy/spherical/envelope_range.hpp b/include/boost/geometry/strategy/spherical/envelope_range.hpp index e9f5ba218..7124e802a 100644 --- a/include/boost/geometry/strategy/spherical/envelope_range.hpp +++ b/include/boost/geometry/strategy/spherical/envelope_range.hpp @@ -80,7 +80,7 @@ inline void spheroidal_linestring(Range const& range, Box& mbr, template struct side_of_pole { - typedef spherical_tag cs_tag; + using cs_tag = spherical_tag; template static inline int apply(P const& p1, P const& p2, P const& pole) @@ -166,7 +166,7 @@ inline bool pole_within(T const& lat_pole, Ring const& ring, return false; } - using point_t = typename geometry::point_type::type; + using point_t = geometry::point_type_t; point_t point; geometry::assign_zero(point); geometry::set<1>(point, lat_pole); @@ -191,8 +191,8 @@ inline void spheroidal_ring(Range const& range, Box& mbr, spheroidal_linestring(closed_range, mbr, envelope_strategy, expand_strategy); - using coord_t = typename geometry::coordinate_type::type; - using point_t = typename geometry::point_type::type; + using coord_t = geometry::coordinate_type_t; + using point_t = geometry::point_type_t; using units_t = typename geometry::detail::cs_angular_units::type; using constants_t = math::detail::constants_on_spheroid; coord_t const two_pi = constants_t::period(); diff --git a/include/boost/geometry/strategy/spherical/envelope_segment.hpp b/include/boost/geometry/strategy/spherical/envelope_segment.hpp index 75db51a76..f211e0bab 100644 --- a/include/boost/geometry/strategy/spherical/envelope_segment.hpp +++ b/include/boost/geometry/strategy/spherical/envelope_segment.hpp @@ -276,12 +276,12 @@ private: CalculationType lat2, Box& mbr) { - typedef typename coordinate_type::type box_coordinate_type; + using box_coordinate_type = coordinate_type_t; - typedef typename helper_geometry + using helper_box_type = typename helper_geometry < Box, box_coordinate_type, Units - >::type helper_box_type; + >::type; helper_box_type helper_mbr; @@ -343,7 +343,7 @@ public: Box& mbr, Strategy const& strategy) { - typedef envelope_segment_convert_polar> convert_polar; + using convert_polar = envelope_segment_convert_polar>; convert_polar::pre(lat1, lat2); diff --git a/include/boost/geometry/strategy/spherical/expand_point.hpp b/include/boost/geometry/strategy/spherical/expand_point.hpp index e3a879356..48cb9a930 100644 --- a/include/boost/geometry/strategy/spherical/expand_point.hpp +++ b/include/boost/geometry/strategy/spherical/expand_point.hpp @@ -92,11 +92,10 @@ struct point_loop_on_spheroid box_coordinate_type p_lon = geometry::get<0>(box_point); box_coordinate_type p_lat = geometry::get<1>(box_point); - typename coordinate_type::type - b_lon_min = geometry::get(box), - b_lat_min = geometry::get(box), - b_lon_max = geometry::get(box), - b_lat_max = geometry::get(box); + box_coordinate_type b_lon_min = geometry::get(box); + box_coordinate_type b_lat_min = geometry::get(box); + box_coordinate_type b_lon_max = geometry::get(box); + box_coordinate_type b_lat_max = geometry::get(box); if (math::is_latitude_pole(p_lat)) { diff --git a/include/boost/geometry/util/calculation_type.hpp b/include/boost/geometry/util/calculation_type.hpp index b238dde37..bc140b4cd 100644 --- a/include/boost/geometry/util/calculation_type.hpp +++ b/include/boost/geometry/util/calculation_type.hpp @@ -108,7 +108,7 @@ struct unary { typedef typename detail::calculation_type < - typename geometry::coordinate_type::type, + geometry::coordinate_type_t, CalculationType, DefaultFloatingPointCalculationType, DefaultIntegralCalculationType @@ -153,7 +153,7 @@ struct ternary < typename select_most_precise < - typename coordinate_type::type, + coordinate_type_t, typename select_coordinate_type < Geometry2, diff --git a/include/boost/geometry/util/has_infinite_coordinate.hpp b/include/boost/geometry/util/has_infinite_coordinate.hpp index 22113e89d..e4f676775 100644 --- a/include/boost/geometry/util/has_infinite_coordinate.hpp +++ b/include/boost/geometry/util/has_infinite_coordinate.hpp @@ -46,7 +46,7 @@ bool has_infinite_coordinate(Point const& point) detail::isinf, std::is_floating_point < - typename coordinate_type::type + coordinate_type_t >::value >::apply(point); } diff --git a/include/boost/geometry/util/has_nan_coordinate.hpp b/include/boost/geometry/util/has_nan_coordinate.hpp index d3fc9f195..1a487e266 100644 --- a/include/boost/geometry/util/has_nan_coordinate.hpp +++ b/include/boost/geometry/util/has_nan_coordinate.hpp @@ -88,7 +88,7 @@ bool has_nan_coordinate(Point const& point) detail::isnan, std::is_floating_point < - typename coordinate_type::type + coordinate_type_t >::value >::apply(point); } diff --git a/include/boost/geometry/util/has_non_finite_coordinate.hpp b/include/boost/geometry/util/has_non_finite_coordinate.hpp index df6990a15..e141c010a 100644 --- a/include/boost/geometry/util/has_non_finite_coordinate.hpp +++ b/include/boost/geometry/util/has_non_finite_coordinate.hpp @@ -46,7 +46,7 @@ bool has_non_finite_coordinate(Point const& point) detail::is_not_finite, std::is_floating_point < - typename coordinate_type::type + coordinate_type_t >::value >::apply(point); } diff --git a/include/boost/geometry/util/select_coordinate_type.hpp b/include/boost/geometry/util/select_coordinate_type.hpp index 99f59784f..370c936fb 100644 --- a/include/boost/geometry/util/select_coordinate_type.hpp +++ b/include/boost/geometry/util/select_coordinate_type.hpp @@ -35,10 +35,10 @@ namespace boost { namespace geometry template struct select_coordinate_type { - typedef typename select_most_precise + using type = typename select_most_precise < - typename coordinate_type::type... - >::type type; + coordinate_type_t... + >::type; }; diff --git a/include/boost/geometry/views/box_view.hpp b/include/boost/geometry/views/box_view.hpp index 634af89c8..3ba6516ec 100644 --- a/include/boost/geometry/views/box_view.hpp +++ b/include/boost/geometry/views/box_view.hpp @@ -63,7 +63,7 @@ namespace boost { namespace geometry template struct box_view { - using array_t = std::array::type, 5>; + using array_t = std::array, 5>; using iterator = typename array_t::const_iterator; using const_iterator = typename array_t::const_iterator; @@ -92,7 +92,7 @@ namespace traits template struct tag > { - typedef ring_tag type; + using type = ring_tag; }; template diff --git a/include/boost/geometry/views/detail/boundary_view/implementation.hpp b/include/boost/geometry/views/detail/boundary_view/implementation.hpp index df9842d1f..78ea7fa6e 100644 --- a/include/boost/geometry/views/detail/boundary_view/implementation.hpp +++ b/include/boost/geometry/views/detail/boundary_view/implementation.hpp @@ -51,14 +51,11 @@ namespace detail { namespace boundary_views template < typename Polygon, - typename Value = typename ring_type::type, - typename Reference = typename ring_return_type::type, + typename Value = ring_type_t, + typename Reference = ring_return_type_t, typename Difference = typename boost::range_difference < - typename std::remove_reference - < - typename interior_return_type::type - >::type + std::remove_reference_t> >::type > class polygon_rings_iterator @@ -71,13 +68,10 @@ class polygon_rings_iterator Difference > { - typedef typename boost::range_size + using size_type = typename boost::range_size < - typename std::remove_reference - < - typename interior_return_type::type - >::type - >::type size_type; + std::remove_reference_t> + >::type; public: // default constructor @@ -231,7 +225,7 @@ public: }; -template ::type> +template > struct num_rings {}; @@ -255,7 +249,7 @@ struct num_rings }; -template ::type> +template > struct views_container_initializer {}; @@ -328,7 +322,7 @@ public: template class areal_boundary { - typedef boundary_view::type> boundary_view_type; + typedef boundary_view> boundary_view_type; typedef views_container_initializer exception_safe_initializer; template diff --git a/include/boost/geometry/views/detail/boundary_view/interface.hpp b/include/boost/geometry/views/detail/boundary_view/interface.hpp index 4d0b6d030..35b1215a4 100644 --- a/include/boost/geometry/views/detail/boundary_view/interface.hpp +++ b/include/boost/geometry/views/detail/boundary_view/interface.hpp @@ -22,7 +22,7 @@ namespace boost { namespace geometry namespace detail_dispatch { -template ::type> +template > struct boundary_view : not_implemented {}; diff --git a/include/boost/geometry/views/detail/indexed_point_view.hpp b/include/boost/geometry/views/detail/indexed_point_view.hpp index e5a89c9ae..a7825cdc8 100644 --- a/include/boost/geometry/views/detail/indexed_point_view.hpp +++ b/include/boost/geometry/views/detail/indexed_point_view.hpp @@ -37,8 +37,8 @@ class indexed_point_view indexed_point_view & operator=(indexed_point_view const&); public: - typedef typename geometry::point_type::type point_type; - typedef typename geometry::coordinate_type::type coordinate_type; + using point_type = geometry::point_type_t; + using coordinate_type = geometry::coordinate_type_t; indexed_point_view(Geometry & geometry) : m_geometry(geometry) @@ -69,13 +69,13 @@ namespace traits template struct tag< geometry::detail::indexed_point_view > { - typedef point_tag type; + using type = point_tag; }; template struct coordinate_type< geometry::detail::indexed_point_view > { - typedef typename geometry::coordinate_type::type type; + using type = geometry::coordinate_type_t; }; template @@ -84,7 +84,7 @@ struct coordinate_system geometry::detail::indexed_point_view > { - typedef typename geometry::coordinate_system::type type; + using type = geometry::coordinate_system_t; }; template @@ -98,7 +98,7 @@ struct access geometry::detail::indexed_point_view, Dimension > { - typedef typename geometry::coordinate_type::type coordinate_type; + using coordinate_type = geometry::coordinate_type_t; static inline coordinate_type get( geometry::detail::indexed_point_view const& p) diff --git a/include/boost/geometry/views/detail/two_dimensional_view.hpp b/include/boost/geometry/views/detail/two_dimensional_view.hpp index bc8c4467c..3ce20b385 100644 --- a/include/boost/geometry/views/detail/two_dimensional_view.hpp +++ b/include/boost/geometry/views/detail/two_dimensional_view.hpp @@ -37,7 +37,7 @@ template typename Geometry, std::size_t Dimension1 = 0, std::size_t Dimension2 = 1, - typename Tag = typename tag::type + typename Tag = tag_t > struct two_dimensional_view : not_implemented @@ -85,7 +85,7 @@ struct tag > > { - typedef point_tag type; + using type = point_tag; }; template @@ -95,7 +95,7 @@ struct coordinate_system < Point, Dimension1, Dimension2, point_tag > - > : coordinate_system::type> + > : coordinate_system> {}; template @@ -105,7 +105,7 @@ struct coordinate_type < Point, Dimension1, Dimension2, point_tag > - > : coordinate_type::type> + > : coordinate_type> {}; template @@ -127,7 +127,7 @@ struct point_type > > { - typedef typename geometry::point_type::type type; + using type = geometry::point_type_t; }; @@ -141,7 +141,7 @@ struct access 0 > { - typedef typename geometry::coordinate_type::type coordinate_type; + using coordinate_type = geometry::coordinate_type_t; typedef geometry::detail::two_dimensional_view < Point, Dimension1, Dimension2, point_tag @@ -168,11 +168,11 @@ struct access 1 > { - typedef typename geometry::coordinate_type::type coordinate_type; - typedef geometry::detail::two_dimensional_view + using coordinate_type = geometry::coordinate_type_t; + using view_type = geometry::detail::two_dimensional_view < Point, Dimension1, Dimension2, point_tag - > view_type; + >; static inline coordinate_type get(view_type const& view) { diff --git a/include/boost/geometry/views/segment_view.hpp b/include/boost/geometry/views/segment_view.hpp index 07dffe590..24db8d6cb 100644 --- a/include/boost/geometry/views/segment_view.hpp +++ b/include/boost/geometry/views/segment_view.hpp @@ -59,7 +59,7 @@ namespace boost { namespace geometry template struct segment_view { - using array_t = std::array::type, 2>; + using array_t = std::array, 2>; using iterator = typename array_t::const_iterator; using const_iterator = typename array_t::const_iterator; @@ -88,7 +88,7 @@ namespace traits template struct tag > { - typedef linestring_tag type; + using type = linestring_tag; }; } diff --git a/index/test/rtree/CMakeLists.txt b/index/test/rtree/CMakeLists.txt index 5c09204f9..7c2ee72b8 100644 --- a/index/test/rtree/CMakeLists.txt +++ b/index/test/rtree/CMakeLists.txt @@ -1,4 +1,5 @@ # Boost.Geometry +# Copyright (c) 2025 Adam Wulkiewicz, Lodz, Poland. # Copyright (c) 2024, Oracle and/or its affiliates. # Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle # Use, modification and distribution is subject to the Boost Software License, @@ -13,6 +14,7 @@ foreach(item IN ITEMS rtree_move_pack rtree_non_cartesian rtree_values + rtree_with_strategies #compile-fail rtree_values_invalid ) boost_geometry_add_unit_test("index" ${item}) diff --git a/index/test/rtree/Jamfile b/index/test/rtree/Jamfile index c930e8a3f..0ea4a30d1 100644 --- a/index/test/rtree/Jamfile +++ b/index/test/rtree/Jamfile @@ -1,6 +1,6 @@ # Boost.Geometry Index # -# Copyright (c) 2011-2016 Adam Wulkiewicz, Lodz, Poland. +# Copyright (c) 2011-2025 Adam Wulkiewicz, Lodz, Poland. # # Use, modification and distribution is subject to the Boost Software License, # Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -19,5 +19,6 @@ test-suite boost-geometry-index-rtree [ run rtree_move_pack.cpp ] [ run rtree_non_cartesian.cpp ] [ run rtree_values.cpp ] + [ compile rtree_with_strategies.cpp ] [ compile-fail rtree_values_invalid.cpp ] ; diff --git a/index/test/rtree/rtree_with_strategies.cpp b/index/test/rtree/rtree_with_strategies.cpp new file mode 100644 index 000000000..40abeb03e --- /dev/null +++ b/index/test/rtree/rtree_with_strategies.cpp @@ -0,0 +1,160 @@ +// Boost.Geometry Index +// Unit Test + +// Copyright (c) 2025 Adam Wulkiewicz, Lodz, Poland. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#define BOOST_GEOMETRY_INDEX_DETAIL_EXPERIMENTAL_PREDICATES + +#include + +#include +#include +#include + +struct point { double x, y; }; +struct box { point mi, ma; }; +struct segment { point first, second; }; + +BOOST_GEOMETRY_REGISTER_POINT_2D(point, double, cs::undefined, x, y) +BOOST_GEOMETRY_REGISTER_BOX(box, point, mi, ma) +BOOST_GEOMETRY_REGISTER_SEGMENT(segment, point, first, second) + +template +constexpr bool is_bp_or_bb_v = (bg::util::is_box::value + && bg::util::is_point::value) + || (bg::util::is_box::value + && bg::util::is_box::value); + +template +constexpr bool is_pb_or_bb_v = (bg::util::is_point::value + && bg::util::is_box::value) + || (bg::util::is_box::value + && bg::util::is_box::value); + +template +constexpr bool is_pp_or_bb_v = (bg::util::is_point::value + && bg::util::is_point::value) + || (bg::util::is_box::value + && bg::util::is_box::value); + +template +< + typename QueryValue, typename Rtree, + std::enable_if_t, int> = 0 +> +void test_queries_bp_bb(Rtree const& rtree) +{ + // These predicates use algorithms that are not implemented for + // some geometry combinations + std::vector values; + rtree.query(bgi::covered_by(QueryValue{}), std::back_inserter(values)); + rtree.query(bgi::disjoint(QueryValue{}), std::back_inserter(values)); + rtree.query(bgi::within(QueryValue{}), std::back_inserter(values)); +} + +template +< + typename QueryValue, typename Rtree, + std::enable_if_t<(!is_bp_or_bb_v), int> = 0 +> +void test_queries_bp_bb(Rtree const& ) {} + +template +< + typename QueryValue, typename Rtree, + std::enable_if_t, int> = 0 +> +void test_queries_pb_bb(Rtree const& rtree) +{ + // These predicates use algorithms that are not implemented for + // some geometry combinations + std::vector values; + rtree.query(bgi::contains(QueryValue{}), std::back_inserter(values)); + rtree.query(bgi::covers(QueryValue{}), std::back_inserter(values)); +} + +template +< + typename QueryValue, typename Rtree, + std::enable_if_t<(!is_pb_or_bb_v), int> = 0 +> +void test_queries_pb_bb(Rtree const& ) {} + +template +< + typename QueryValue, typename Rtree, + std::enable_if_t, int> = 0 +> +void test_queries_pp_bb(Rtree const& rtree) +{ + // These predicates use algorithms that are not implemented for + // some geometry combinations + std::vector values; + rtree.query(bgi::overlaps(QueryValue{}), std::back_inserter(values)); + rtree.query(bgi::touches(QueryValue{}), std::back_inserter(values)); +} + +template +< + typename QueryValue, typename Rtree, + std::enable_if_t<(!is_pp_or_bb_v), int> = 0 +> +void test_queries_pp_bb(Rtree const& ) {} + +template +void test_queries(Rtree const& rtree) +{ + std::vector values; + rtree.query(bgi::intersects(QueryValue{}), std::back_inserter(values)); + rtree.query(bgi::nearest(QueryValue{}, 1), std::back_inserter(values)); + test_queries_bp_bb(rtree); + test_queries_pb_bb(rtree); + test_queries_pp_bb(rtree); +} + +template +void test_strategies() +{ + std::vector values; + bgi::rtree> rtree{values}; + rtree.insert(Value{}); + rtree.remove(Value{}); + + test_queries(rtree); + test_queries(rtree); + test_queries(rtree); +} + +template +void test_params() +{ + test_strategies>(); + test_strategies>(); + test_strategies>(); + test_strategies>(); + test_strategies>(); + test_strategies>(); +} + +template +void test_value() +{ + test_params>(); + test_params>(); + test_params>(); +} + +int test_main(int, char* []) +{ + test_value(); + test_value(); + test_value(); + + return 0; +} diff --git a/test/algorithms/buffer/CMakeLists.txt b/test/algorithms/buffer/CMakeLists.txt index 1fb93e5ae..bb9108509 100644 --- a/test/algorithms/buffer/CMakeLists.txt +++ b/test/algorithms/buffer/CMakeLists.txt @@ -15,7 +15,6 @@ endforeach() # Tests for all geometry types, cartesian, for one floating point type foreach(item IN ITEMS buffer_point - buffer_linestring buffer_ring buffer_polygon buffer_multi_point @@ -38,6 +37,17 @@ foreach(item IN ITEMS target_compile_definitions(${BOOST_GEOMETRY_UNIT_TEST_NAME} PRIVATE BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE) endforeach() +# Tests which take a long time and are not run by default. +# Besides that, the buffer_countries test requires the WKT files. +foreach(item IN ITEMS + buffer_countries + buffer_linestring + buffer_linestring_geo + ) + boost_geometry_add_unit_test("algorithms" ${item} "not_run") + target_compile_definitions(${BOOST_GEOMETRY_UNIT_TEST_NAME} PRIVATE BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE) +endforeach() + # Other tests foreach(item IN ITEMS buffer_with_strategies diff --git a/test/algorithms/buffer/buffer_cases.hpp b/test/algorithms/buffer/buffer_cases.hpp new file mode 100644 index 000000000..48127fb14 --- /dev/null +++ b/test/algorithms/buffer/buffer_cases.hpp @@ -0,0 +1,144 @@ +// Boost.Geometry + +// Copyright (c) 2025 Barend Gehrels, Amsterdam, the Netherlands. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GEOMETRY_TEST_BUFFER_CASES_HPP +#define BOOST_GEOMETRY_TEST_BUFFER_CASES_HPP + +#include + +// The "w" series of recursive_polygons_buffer, which are or were failing for traversing through the graph +// using the biconnected components. + +// Needs aligning position codes in assign_clustered_counts +static std::string const rt_w1 + = "MULTIPOLYGON(((2 0,2 1,3 1,3 0,2 0)),((4 2,4 3,5 2,4 2)),((1 6,0 6,0 7,1 6)),((1 6,2 5,1 5,1 6)))"; + +// Caused by a wrong block_q in get_turn_info (resulting in ix i/o iu) +static std::string const rt_w2 + = "MULTIPOLYGON(((6 3,6 4,7 4,6 3)),((6 3,5 2,5 3,6 3)))"; + +// Goes wrong either way +static std::string const rt_w3 + = "MULTIPOLYGON(((8 3,8 4,9 4,9 3,8 3)),((7 5,7 6,8 6,7 5)),((5 5,4 4,4 5,5 5)),((5 5,6 5,5 4,5 5)),((0 7,0 8,1 8,0 7)),((2 2,2 3,3 3,2 2)),((2 8,3 8,3 7,3 6,2 6,2 8)))"; + +// Needs fix in arrival handling - it had weird turn info near node 3, ux, while both continue. +static std::string const rt_w4 + = "MULTIPOLYGON(((4 6,4 7,5 6,4 6)),((8 0,8 1,9 1,8 0)),((1 6,1 7,2 7,1 6)),((0 2,0 3,1 2,0 2)),((5 2,6 3,6 2,5 2)),((5 2,5 1,4 1,4 2,5 2)),((2 9,3 8,2 8,1 8,1 9,2 9)))"; + +// Having a big clusters with all position codes, and two interior rings +static std::string const rt_w5 + = "MULTIPOLYGON(((2 1,2 2,3 2,3 1,2 1)),((2 6,2 7,3 7,3 6,2 6)),((3 4,3 5,4 5,4 4,3 4)),((5 3,5 2,4 2,5 3)),((5 3,5 4,6 3,5 3)),((0 2,1 1,0 0,0 2)),((0 8,1 8,1 7,0 7,0 8)),((0 5,1 5,2 5,1 4,0 3,0 5)),((7 1,6 1,6 2,7 1)),((7 1,8 0,7 0,7 1)),((8 6,7 6,7 8,8 8,8 6)),((6 8,6 7,5 7,5 8,6 8)),((6 1,5 0,5 1,6 1)),((7 8,7 9,8 9,7 8)),((6 4,7 3,6 3,6 4)),((6 4,6 5,7 5,7 4,6 4)),((7 6,6 6,6 7,7 6)),((5 8,4 7,4 8,5 8)),((5 8,5 9,6 9,5 8)),((7 4,8 3,7 3,7 4)),((8 3,8 4,9 4,9 3,8 3)))"; + +// Fixed regression +static std::string const rt_w6 + = "MULTIPOLYGON(((7 0,7 1,8 0,7 0)),((8 6,8 7,9 7,9 6,8 6)),((2 8,3 9,3 8,2 8)),((4 3,4 4,5 4,4 3)),((6 5,6 6,7 6,6 5)),((1 7,2 7,1 6,0 6,1 7)),((1 5,0 4,0 5,1 5)),((1 5,2 6,2 5,1 5)),((0 4,1 4,0 3,0 4)),((2 1,1 0,0 0,0 1,2 1)),((7 4,6 3,6 4,7 4)),((7 4,7 5,8 5,7 4)),((6 3,7 3,6 2,6 3)))"; + +// Fixed by first handling non-clustered turns +static std::string const rt_w7 + = "MULTIPOLYGON(((6 0,6 1,7 1,6 0)),((6 6,7 7,7 6,6 6)),((8 0,8 1,9 1,8 0)),((2 7,2 8,3 7,2 7)),((1 2,1 3,2 3,1 2)),((8 2,8 3,9 2,8 2)),((4 5,4 4,3 4,4 5)),((4 5,5 6,5 5,4 5)))"; + +// Fixed select_collinear_target_edge +static std::string const rt_w8 + = "MULTIPOLYGON(((0 4,0 5,1 5,0 4)),((1 3,1 4,2 4,1 3)),((2 8,2 9,3 8,2 8)),((6 3,6 4,7 3,6 3)),((7 1,7 2,8 2,8 1,7 1)),((0 2,0 3,1 2,0 2)),((0 2,1 1,0 1,0 2)),((3 2,3 1,2 1,3 2)),((3 2,2 2,3 3,3 2)),((9 6,9 5,8 5,9 6)),((9 6,8 6,8 7,9 7,9 6)),((5 2,5 1,4 1,4 2,5 2)),((5 2,5 3,6 2,5 2)),((5 6,4 6,4 7,5 6)),((5 6,6 5,5 5,5 6)),((5 6,6 7,6 6,5 6)))"; + +// fixed by setting operations to blocked +static std::string const rt_w9 + = "MULTIPOLYGON(((3 8,4 9,4 8,3 8)),((4 2,4 4,5 3,5 2,4 2)),((4 2,4 1,3 1,3 2,4 2)),((2 4,2 5,3 5,3 4,3 3,2 3,2 2,1 2,1 3,2 4)),((8 8,7 8,7 9,8 8)),((8 8,9 8,8 7,8 8)),((1 2,0 2,0 3,1 2)),((4 6,3 6,3 7,4 6)),((4 6,5 6,5 5,4 5,4 6)),((8 7,8 6,7 6,8 7)),((8 6,9 7,9 6,8 6)))"; + +// fixed by position_code=3 in assign_clustered_counts +static std::string const rt_w10 + = "MULTIPOLYGON(((3 2,3 3,4 3,3 2)),((2 8,2 9,3 9,3 8,2 8)),((7 8,7 9,8 9,7 8)),((4 4,5 5,5 4,4 4)),((5 7,5 8,6 7,5 7)),((6 2,7 3,7 2,6 2)),((0 3,1 4,1 3,0 2,0 3)),((8 5,8 4,7 4,8 5)),((8 5,8 6,9 5,8 5)),((7 4,6 4,6 5,7 5,7 4)),((3 6,4 7,4 6,3 6)),((3 6,3 5,2 5,3 6)),((8 2,8 1,7 1,8 2)),((8 2,8 3,9 2,8 2)),((1 3,2 2,1 2,1 3)))"; + +// same as rt_w1 - also its configuration is similar. +static std::string const rt_w11 + = "MULTIPOLYGON(((2 8,2 9,3 9,3 8,2 8)),((6 7,6 8,7 8,7 7,6 7)),((5 0,5 1,6 1,6 0,5 0)),((4 2,4 3,5 2,4 2)),((4 2,4 1,3 1,3 2,4 2)),((1 6,0 6,0 7,1 6)),((1 6,2 5,1 5,1 6)),((4 1,4 0,3 0,4 1)))"; + +static std::string const rt_w12 + = "MULTIPOLYGON(((0 7,0 8,1 7,0 7)),((4 3,4 4,5 3,4 3)),((5 2,6 3,6 2,5 2)),((5 2,4 1,4 2,5 2)))"; + +// fixed by using continue with count-left 0 +static std::string const rt_w13 + = "MULTIPOLYGON(((6 2,6 3,7 2,6 2)),((4 4,4 3,3 3,3 4,4 4)),((4 4,4 5,5 4,4 4)),((4 3,4 2,3 2,4 3)))"; + +// Caused by a wrong block_q in get_turn_info (resulting in ix i/o iu) +static std::string const rt_w14 + = "MULTIPOLYGON(((6 0,6 1,7 0,6 0)),((1 4,2 5,2 4,1 4)),((1 2,1 3,2 3,1 2)),((3 7,3 8,4 7,3 7)),((2 1,3 2,3 1,2 1)),((3 5,3 6,4 6,4 5,3 5)),((7 4,6 4,6 5,7 4)),((7 4,8 3,7 3,7 4)))"; + +// Would need calling assign_count before enrich. But it is now harmonized +// to be the same as union/intersection +static std::string const rt_w15 + = "MULTIPOLYGON(((3 8,3 9,4 9,4 8,3 8)),((0 8,1 9,1 8,0 8)),((1 6,1 7,2 7,2 6,1 6)),((7 7,8 8,8 7,7 7)),((4 3,3 3,3 4,4 3)),((4 3,5 2,4 2,4 3)),((1 5,2 5,2 4,2 3,1 3,1 4,0 4,1 5)),((6 1,7 0,6 0,6 1)),((6 1,5 1,6 2,6 1)),((7 0,7 1,8 0,7 0)),((2 1,3 1,3 0,1 0,2 1)),((2 1,2 2,3 2,2 1)))"; + +// fixed by ahead_side in cc +static std::string const rt_w16 + = "MULTIPOLYGON(((6 4,6 5,7 5,6 4)),((4 0,4 1,5 0,4 0)),((4 2,4 3,5 3,4 2)),((1 2,1 3,2 3,2 2,1 2)))"; + +// fixed by keeping set_both_verified +static std::string const rt_w17 + = "MULTIPOLYGON(((3 1,4 2,4 1,3 1)),((5 3,6 4,6 3,5 3)),((5 0,5 1,6 1,6 0,5 0)),((8 5,9 6,9 5,8 5)),((8 5,7 4,7 5,8 5)))"; + +static std::string const rt_w18 + = "MULTIPOLYGON(((4 4,4 5,5 4,4 4)),((5 6,6 7,6 6,5 6)),((5 1,4 1,4 2,5 3,5 1)),((7 6,7 7,8 7,7 6)),((0 6,1 6,1 5,1 4,0 4,0 6)),((1 8,2 7,1 7,1 8)),((1 8,2 9,2 8,1 8)),((1 6,1 7,2 6,1 6)),((7 3,7 2,6 2,7 3)),((7 3,7 4,8 4,8 3,7 3)),((3 2,3 1,2 1,3 2)),((3 2,2 2,2 3,3 3,3 2)),((5 8,5 7,4 7,4 8,5 8)),((5 8,6 9,6 8,5 8)))"; + + +// Contains a cc turn (1) located wrongly. +// Reported at 1/1, but should be 0/1 - or it should have a segment id belonging to previous segment. +// Fixed by removing specific arriving handling. +static std::string const rt_w19 + = "MULTIPOLYGON(((3 8,3 9,4 9,3 8)),((3 4,4 5,4 4,3 4)),((7 0,7 1,8 1,7 0)),((8 5,9 6,9 5,8 5)),((2 7,3 7,3 6,2 6,2 7)),((7 4,8 3,7 3,6 3,7 4)))"; + +// REPORTED as #1359 - but somehow now fixed - issue was: start turn discarded while it should not be. +static std::string const rt_w20 + = "MULTIPOLYGON(((2 8,2 9,3 8,2 8)),((7 1,7 2,8 1,7 1)),((5 2,5 3,6 2,5 2)),((2 2,2 3,3 3,2 2)),((1 3,1 4,2 4,1 3)),((6 4,6 5,7 4,6 4)),((9 8,8 8,9 9,9 8)),((9 8,9 7,8 7,9 8)))"; + +// reproduction of wrong order (i/u) +static std::string const rt_w21 + = "MULTIPOLYGON(((2 8,2 9,3 8,2 8)),((4 6,4 7,5 6,4 6)),((4 2,5 2,4 1,4 2)))"; + +// Needs a spike. Also, it misses a small triangle, so area is not completely correct +static std::string const rt_w22 + = "MULTIPOLYGON(((6 3,6 4,7 4,7 3,6 3)),((6 1,6 2,7 2,6 1)),((2 8,2 9,3 9,2 8)),((4 7,5 8,5 7,4 7)),((2 1,2 0,1 0,2 1)),((2 1,2 2,3 2,3 1,2 1)),((3 3,2 2,2 3,3 3)),((3 3,3 4,4 3,3 3)),((0 5,1 4,1 3,0 3,0 5)),((8 6,9 6,9 5,8 5,8 6)),((8 6,7 6,6 6,7 7,8 6)),((1 3,1 2,0 2,1 3)),((4 3,5 3,4 2,4 3)),((4 2,5 1,4 1,4 2)))"; + +// Caused by spike handling. +static std::string const rt_w23 + = "MULTIPOLYGON(((4 0,4 1,5 1,5 0,4 0)),((1 3,1 4,2 4,2 3,1 3)),((6 3,6 4,7 4,7 3,6 3)),((6 8,7 9,7 8,6 8)),((4 8,5 9,5 8,4 8)),((4 4,4 5,5 5,5 4,4 4)),((8 1,8 0,7 0,7 1,8 1)))"; + +// Case with suspicious UX turn, causing a wrong graph, and more. Old algorithm could cope with it. +// This should be fixed in get_turn_info. +static std::string const rt_w24 + = "MULTIPOLYGON(((2 3,2 4,3 3,2 3)),((8 5,8 6,9 6,8 5)),((3 6,4 5,3 5,3 6)),((3 6,4 7,4 6,3 6)),((5 2,5 3,6 3,5 2)),((5 8,6 9,6 8,5 8)),((0 5,1 6,1 5,0 5)),((0 1,0 2,1 1,0 1)))"; + +// Case with wrong order (i/u), corrected to cc, but it also needs adapting the left counts. +static std::string const rt_w25 + = "MULTIPOLYGON(((0 5,0 6,1 5,0 5)),((6 1,7 1,7 0,6 0,6 1)),((1 6,1 7,2 6,1 6)),((8 7,8 8,9 8,9 7,8 7)),((8 1,9 2,9 1,8 1)),((0 1,0 2,1 2,1 1,0 1)),((6 3,6 4,7 3,6 3)),((4.5 8.5,5 8,4 8,4 9,5 9,4.5 8.5)),((2 4,3 5,4 5,4 4,2 4)),((3 7,4 8,4 7,3 7)),((3 7,2 7,2 8,3 7)))"; + +// Needs skip-count to be translated to travels_to_ip_index as -1, for a cc turn. +static std::string const rt_w26 + = "MULTIPOLYGON(((6 6,6 7,7 6,6 6)),((0 0,0 1,1 1,1 0,0 0)),((3 6,2 5,2 7,2.5 6.5,3 7,4 6,5 5,3 5,3 6)),((3 2,2 2,2 3,1 3,3 5,3 2)),((3 1,4 0,3 0,3 1)),((3 1,2 0,2 1,3 1)),((3 7,2 7,2 8,3 7)),((1 8,0 8,0 9,1 9,1 8)),((1 8,2 7,1 7,1 8)),((2 5,1 5,1 6,2 6,1.5 5.5,2 5)),((5 0,5 1,6 1,6 0,5 0)),((1 3,1 2,0 2,1 3)),((4 6,4 7,5 7,5 6,4 6)),((1 6,0 6,0 7,1 6)),((1 5,1 4,0 4,0 5,1 5)),((6 1,6 2,7 2,7 1,6 1)),((6 2,6 3,7 3,6 2)),((7 1,8 1,8 0,7 0,7 1)))"; + +// Fixed by fixing by suspicious UX turn. +static std::string const rt_w27 + = "MULTIPOLYGON(((3 6,4 7,4 6,3 6)),((4 3,4 4,5 4,5 3,4 3)),((5 8,6 9,6 8,5 8)),((2 7,2 8,3 8,3 7,2 7)))"; + +// Fixed by fixing by suspicious UX turn. +static std::string const rt_w28 + = "MULTIPOLYGON(((8 8,8 9,9 9,8 8)),((1 2,1 3,2 3,1 2)),((3 8,3 9,4 9,3 8)),((1 1,2 1,1 0,1 1)),((1 1,0 1,0 2,1 1)),((3 0,2 0,2 1,3 0)),((1 8,2 7,1 7,1 8)),((1 8,0 8,0 9,2 9,1 8)),((2.5 5.5,3 5,2 5,2 6,3 6,2.5 5.5)),((5 5,6 5,6 4,5 4,5 5)),((7 3,8 4,8 3,7 3)),((7 3,6 3,6 4,7 4,7 3)),((7 4,7 5,7 6,8 6,8 4,7 4)),((7 8,7 7,6 7,6 8,7 8)),((4 8,5 9,6 8,4 8)),((4 8,4 7,3 7,4 8)),((2 7,2 6,1 6,2 7)),((1 6,2 5,1 5,1 6)),((5 4,5 3,3 3,3 4,4 4,4 5,5 4)),((2 5,2 4,1 4,2 5)),((8 4,9 5,9 4,8 4)),((6 7,6 6,5 6,5 7,6 7)))"; + +// Needs original arrival behaviour +static std::string const rt_w29 + = "MULTIPOLYGON(((3 7,3 8,4 7,3 7)),((6 5,7 4,5 4,6 5)),((5 4,5 3,4 3,5 4)))"; + +// Needs to skip the "target ahead" check in is_cc_target_for_union +static std::string const rt_w30 + = "MULTIPOLYGON(((6 6,7 7,7 6,6 6)),((8 3,9 3,8.5 2.5,9 2,8 2,8 3)),((4 0,4 1,5 0,4 0)),((0 5,1 6,1 5,0 5)),((3 8,4 9,4 8,3 8)),((7 4,7 5,8 5,7 4)),((7 4,6 3,6 4,7 4)))"; + +// Like rt_w30, needs to skip the "target ahead" check +static std::string const rt_w31 + = "MULTIPOLYGON(((0 1,0 2,1 2,1 1,0 1)),((0 4,0 5,1 5,0 4)),((3 8,4 8,3 7,2 7,3 8)),((3 2,3 3,4 3,3 2)),((0 6,0 7,1 6,0 6)),((0 8,0 9,1 8,0 8)),((4 5,4 4,3 4,3 5,4 5)),((4 5,4 6,5 6,4 5)),((9 3,9 2,8 2,8 3,9 3)),((7 4,7 5,8 5,7 4)),((7 4,6 3,6 4,7 4)),((6 8,7 8,6.5 7.5,7 7,6 7,6 8)),((5 6,5 7,6 6,5 6)))"; + +#endif diff --git a/test/algorithms/buffer/buffer_countries.cpp b/test/algorithms/buffer/buffer_countries.cpp index 4964e0a59..8444e5bd3 100644 --- a/test/algorithms/buffer/buffer_countries.cpp +++ b/test/algorithms/buffer/buffer_countries.cpp @@ -119,6 +119,13 @@ void test_all() const std::string base_folder = "data/"; const std::string gr = read_from_wkt_file(base_folder + "gr.wkt"); + if (gr.empty()) + { + // If this file is not found, the others won't be find either. + std::cerr << "Error: cannot read WKT files from " << base_folder << std::endl; + return; + } + const std::string it = read_from_wkt_file(base_folder + "it.wkt"); const std::string nl = read_from_wkt_file(base_folder + "nl.wkt"); const std::string no = read_from_wkt_file(base_folder + "no.wkt"); @@ -210,10 +217,6 @@ int test_main(int, char* []) test_all >(); #endif -#if defined(BOOST_GEOMETRY_TEST_FAILURES) - BoostGeometryWriteExpectedFailures(BG_NO_FAILURES, 2, BG_NO_FAILURES); -#endif - return 0; } diff --git a/test/algorithms/buffer/buffer_linestring.cpp b/test/algorithms/buffer/buffer_linestring.cpp index 259a2e7e9..dbee66df9 100644 --- a/test/algorithms/buffer/buffer_linestring.cpp +++ b/test/algorithms/buffer/buffer_linestring.cpp @@ -218,10 +218,8 @@ void test_all() // Having flat end test_one("for_collinear", for_collinear, join_round, end_flat, 68.561, 2.0); test_one("for_collinear", for_collinear, join_miter, end_flat, 72, 2.0); -#if defined(BOOST_GEOMETRY_TEST_FAILURES) test_one("for_collinear2", for_collinear2, join_round, end_flat, 74.387, 2.0); test_one("for_collinear2", for_collinear2, join_miter, end_flat, 78.0, 2.0); -#endif test_one("curve", curve, join_round, end_flat, 58.1944, 5.0, settings, 3.0); test_one("curve", curve, join_miter, end_flat, 58.7371, 5.0, settings, 3.0); @@ -470,9 +468,5 @@ int test_main(int, char* []) test_invalid >(); #endif -#if defined(BOOST_GEOMETRY_TEST_FAILURES) - BoostGeometryWriteExpectedFailures(4, 11, 3); -#endif - return 0; } diff --git a/test/algorithms/buffer/buffer_linestring_aimes.cpp b/test/algorithms/buffer/buffer_linestring_aimes.cpp index ec5983527..181db470b 100644 --- a/test/algorithms/buffer/buffer_linestring_aimes.cpp +++ b/test/algorithms/buffer/buffer_linestring_aimes.cpp @@ -257,11 +257,6 @@ void test_aimes() double const aimes_width = width / 1000000.0; for (int i = 0; i < n; i++) { -#if defined(BOOST_GEOMETRY_TEST_FAILURES) - // There are 4 false positives - bool const possible_invalid = width == 18 && (i == 75 || i == 80 || i == 140); - settings.set_test_validity(! possible_invalid); -#endif std::ostringstream name; try { @@ -294,11 +289,5 @@ int test_main(int, char* []) test_aimes >(); -#if defined(BOOST_GEOMETRY_TEST_FAILURES) - // Type float is not supported for these cases. - // Type double has (judging the svg) 4 false negatives for validity - BoostGeometryWriteExpectedFailures(0, 0, 0); -#endif - return 0; } diff --git a/test/algorithms/buffer/buffer_multi_linestring.cpp b/test/algorithms/buffer/buffer_multi_linestring.cpp index abf3f6ea7..364c45f26 100644 --- a/test/algorithms/buffer/buffer_multi_linestring.cpp +++ b/test/algorithms/buffer/buffer_multi_linestring.cpp @@ -195,18 +195,12 @@ void test_all() test_one("mysql_23023665_1_20", mysql_23023665_1, join_round32, end_flat, 1, 1, 350.1135, 2.0); -#if defined(BOOST_GEOMETRY_TEST_FAILURES) - { - // Cases (railway roads) still failing - ut_settings settings(10.0, false); - test_one("ticket_13444_1", - ticket_13444, join_round32, end_round32, 3, 0, 11801.7832, 1.0, settings); - test_one("ticket_13444_3", - ticket_13444, join_round32, end_round32, 3, 1, 34132.0882, 3.0, settings); - test_one("ticket_13444_5", - ticket_13444, join_round32, end_round32, 2, 1, 50525.1110, 5.0, settings); - } -#endif + test_one("ticket_13444_1", + ticket_13444, join_round32, end_round32, 3, 0, 11799.2681, 1.0); + test_one("ticket_13444_3", + ticket_13444, join_round32, end_round32, 3, 1, 34132.0882, 3.0); + test_one("ticket_13444_5", + ticket_13444, join_round32, end_round32, 2, 1, 50525.1110, 5.0); { // This issue was detected for CCW order and only CW is tested by default. @@ -234,8 +228,5 @@ int test_main(int, char* []) test_all >(); #endif -#if defined(BOOST_GEOMETRY_TEST_FAILURES) - BoostGeometryWriteExpectedFailures(6, 9, 3); -#endif return 0; } diff --git a/test/algorithms/buffer/buffer_multi_point.cpp b/test/algorithms/buffer/buffer_multi_point.cpp index 27b795a29..3a033236f 100644 --- a/test/algorithms/buffer/buffer_multi_point.cpp +++ b/test/algorithms/buffer/buffer_multi_point.cpp @@ -51,10 +51,11 @@ void test_all() test_one("simplex3", simplex, join, end_flat, 44.5619, 3.0); test_one("three1", three, join, end_flat, 3.0 * expectation, 1.0); -#if defined(BOOST_GEOMETRY_TEST_FAILURES) - // fails in CCW mode - test_one("three2", three, join, end_flat, 36.7528, 2.0); -#endif + { + // Is reported as invalid for in CCW mode: test validity only for clockwise + ut_settings const settings(ut_settings::default_tolerance, Clockwise); + test_one("three2", three, join, end_flat, 36.7528, 2.0, settings); + } test_one("three19", three, join, end_flat, 33.6857, 1.9); test_one("three21", three, join, end_flat, 39.6337, 2.1); test_one("three3", three, join, end_flat, 65.5243, 3.0); @@ -220,9 +221,5 @@ int test_main(int, char* []) std::cout << "Skipping some tests in debug or unknown mode" << std::endl; #endif -#if defined(BOOST_GEOMETRY_TEST_FAILURES) - BoostGeometryWriteExpectedFailures(BG_NO_FAILURES); -#endif - return 0; } diff --git a/test/algorithms/buffer/buffer_multi_polygon.cpp b/test/algorithms/buffer/buffer_multi_polygon.cpp index a7af1cfce..1c07eeec8 100644 --- a/test/algorithms/buffer/buffer_multi_polygon.cpp +++ b/test/algorithms/buffer/buffer_multi_polygon.cpp @@ -12,6 +12,7 @@ // http://www.boost.org/LICENSE_1_0.txt) #include "test_buffer.hpp" +#include "buffer_cases.hpp" static std::string const simplex = "MULTIPOLYGON(((0 1,2 5,5 3,0 1)),((1 1,5 2,5 0,1 1)))"; @@ -411,6 +412,10 @@ static std::string const mysql_report_2015_07_05_1 static std::string const mysql_report_2015_07_05_2 = "MULTIPOLYGON(((19777 -21893,3.22595e+307 6.86823e+307,-40 -13,19777 -21893)),((-1322 4851,8.49998e+307 3.94481e+307,75 -69,8.64636e+307 3.94909e+307,-1.15292e+18 7.20576e+16,-1322 4851)))"; + +#define TEST_BUFFER(caseid, join, end, area, distance) (test_one) \ + ( #caseid "_buf", caseid, join, end, area, distance) + template void test_all() { @@ -597,6 +602,50 @@ void test_all() test_one("rt_v3", rt_v3, join_round32, end_flat, 22.9158, 1.0); test_one("rt_v4", rt_v4, join_round32, end_flat, 23.4146, 1.0); + TEST_BUFFER(rt_w1, join_miter, end_flat, 30.3995, 1.0); +#if defined(BOOST_GEOMETRY_TEST_FAILURES) + TEST_BUFFER(rt_w2, join_miter, end_flat, 13.65685, 1.0); + TEST_BUFFER(rt_w3, join_miter, end_flat, 19.39949, 1.0); +#endif + TEST_BUFFER(rt_w4, join_miter, end_flat, 57.37, 1.0); + TEST_BUFFER(rt_w5, join_miter, end_flat, 106.7279, 1.0); + TEST_BUFFER(rt_w6, join_miter, end_flat, 79.799, 1.0); +#if defined(BOOST_GEOMETRY_TEST_FAILURES) + TEST_BUFFER(rt_w7, join_miter, end_flat, 58.8701, 1.0); +#endif + TEST_BUFFER(rt_w8, join_miter, end_flat, 83.4852, 1.0); + TEST_BUFFER(rt_w9, join_miter, end_flat, 68.9852, 1.0); + TEST_BUFFER(rt_w10, join_miter, end_flat, 88.1985, 1.0); + TEST_BUFFER(rt_w11, join_miter, end_flat, 53.4853, 1.0); + TEST_BUFFER(rt_w12, join_miter, end_flat, 28.7353, 1.0); + TEST_BUFFER(rt_w13, join_miter, end_flat, 25.5711, 1.0); +#if defined(BOOST_GEOMETRY_TEST_FAILURES) + TEST_BUFFER(rt_w14, join_miter, end_flat, 58.05634, 1.0); +#endif + TEST_BUFFER(rt_w15, join_miter, end_flat, 80.1348, 1.0); + TEST_BUFFER(rt_w16, join_miter, end_flat, 31.6495, 1.0); + TEST_BUFFER(rt_w17, join_miter, end_flat, 33.74264, 1.0); + TEST_BUFFER(rt_w18, join_miter, end_flat, 82.4779, 1.0); + TEST_BUFFER(rt_w19, join_miter, end_flat, 53.7132, 1.0); + TEST_BUFFER(rt_w20, join_miter, end_flat, 63.0269, 1.0); +#if defined(BOOST_GEOMETRY_TEST_FAILURES) + TEST_BUFFER(rt_w21, join_miter, end_flat, 26.3137, 1.0); +#endif + TEST_BUFFER(rt_w22, join_miter, end_flat, 86.0416, 1.0); + TEST_BUFFER(rt_w23, join_miter, end_flat, 59.5711, 1.0); + TEST_BUFFER(rt_w24, join_miter, end_flat, 64.1985, 1.0); + TEST_BUFFER(rt_w25, join_miter, end_flat, 84.3848, 1.0); + TEST_BUFFER(rt_w26, join_miter, end_flat, 91.6569, 1.0); +#if defined(BOOST_GEOMETRY_TEST_FAILURES) + TEST_BUFFER(rt_w27, join_miter, end_flat, 31.6569, 1.0); +#endif + TEST_BUFFER(rt_w28, join_miter, end_flat, 100.0710, 1.0); + TEST_BUFFER(rt_w29, join_miter, end_flat, 25.1421, 1.0); +#if defined(BOOST_GEOMETRY_TEST_FAILURES) + TEST_BUFFER(rt_w30, join_miter, end_flat, 59.4485, 1.0); + TEST_BUFFER(rt_w31, join_miter, end_flat, 85.7916, 1.0); +#endif + test_one("nores_mt_1", nores_mt_1, join_round32, end_flat, 13.4113, 1.0); test_one("nores_mt_2", nores_mt_2, join_round32, end_flat, 17.5265, 1.0); test_one("nores_mt_3", nores_mt_3, join_round32, end_flat, 25.6091, 1.0); @@ -683,9 +732,5 @@ int test_main(int, char* []) test_all >(); #endif -#if defined(BOOST_GEOMETRY_TEST_FAILURES) - BoostGeometryWriteExpectedFailures(1, 3, 3); -#endif - return 0; } diff --git a/test/algorithms/buffer/buffer_point.cpp b/test/algorithms/buffer/buffer_point.cpp index 31ea091e0..1eb48a03d 100644 --- a/test/algorithms/buffer/buffer_point.cpp +++ b/test/algorithms/buffer/buffer_point.cpp @@ -40,9 +40,5 @@ int test_main(int, char* []) test_all >(); #endif -#if defined(BOOST_GEOMETRY_TEST_FAILURES) - BoostGeometryWriteExpectedFailures(BG_NO_FAILURES); -#endif - return 0; } diff --git a/test/algorithms/buffer/buffer_polygon.cpp b/test/algorithms/buffer/buffer_polygon.cpp index 6d2d6e09e..48c644901 100644 --- a/test/algorithms/buffer/buffer_polygon.cpp +++ b/test/algorithms/buffer/buffer_polygon.cpp @@ -955,10 +955,6 @@ int test_main(int, char* []) test_mixed(); #endif -#if defined(BOOST_GEOMETRY_TEST_FAILURES) - BoostGeometryWriteExpectedFailures(1, 9, 1); -#endif - test_different(); return 0; diff --git a/test/algorithms/buffer/read_from_wkt_file.hpp b/test/algorithms/buffer/read_from_wkt_file.hpp index 699023476..55f39a3e4 100644 --- a/test/algorithms/buffer/read_from_wkt_file.hpp +++ b/test/algorithms/buffer/read_from_wkt_file.hpp @@ -38,8 +38,6 @@ inline std::string read_from_wkt_file(std::string const& filename) out << std::fixed << std::setprecision(20) << bg::wkt(mp); } - BOOST_CHECK(! out.str().empty()); - return out.str(); } diff --git a/test/algorithms/buffer/test_buffer.hpp b/test/algorithms/buffer/test_buffer.hpp index a7050adae..3c1ba8358 100644 --- a/test/algorithms/buffer/test_buffer.hpp +++ b/test/algorithms/buffer/test_buffer.hpp @@ -123,7 +123,8 @@ template<> struct EndTestProperties struct ut_settings : public ut_base_settings { - explicit ut_settings(double tol = 0.01, bool val = true, int points = 88) + static constexpr double default_tolerance = 0.01; + explicit ut_settings(double tol = default_tolerance, bool val = true, int points = 88) : ut_base_settings(val) , tolerance(tol) , points_per_circle(points) diff --git a/test/algorithms/check_validity.hpp b/test/algorithms/check_validity.hpp index 31e4f2df9..3aba9b149 100644 --- a/test/algorithms/check_validity.hpp +++ b/test/algorithms/check_validity.hpp @@ -16,7 +16,7 @@ #include template -inline bool input_is_valid(std::string const& case_id, std::string const& subcase, +inline bool is_input_valid(std::string const& case_id, std::string const& subcase, Geometry const& geometry) { std::string message; @@ -42,8 +42,8 @@ inline bool is_output_valid(Geometry const& geometry, bool result = bg::is_valid(geometry, message); if (! result && ignore_validity_on_invalid_input) { - if (! input_is_valid(case_id, "a", g1) - || ! input_is_valid(case_id, "b", g2)) + if (! is_input_valid(case_id, "a", g1) + || ! is_input_valid(case_id, "b", g2)) { // Because input is invalid, output validity is ignored result = true; diff --git a/test/algorithms/distance/distance_brute_force.hpp b/test/algorithms/distance/distance_brute_force.hpp index b049d162f..f4a82025c 100644 --- a/test/algorithms/distance/distance_brute_force.hpp +++ b/test/algorithms/distance/distance_brute_force.hpp @@ -45,9 +45,9 @@ struct distance_from_bg struct use_distance_from_bg : util::bool_constant < - std::is_same::type, point_tag>::value - || std::is_same::type, segment_tag>::value - || std::is_same::type, box_tag>::value + std::is_same, point_tag>::value + || std::is_same, segment_tag>::value + || std::is_same, box_tag>::value > {}; diff --git a/test/algorithms/distance/test_distance.hpp b/test/algorithms/distance/test_distance.hpp index cfda00e29..a34770a4a 100644 --- a/test/algorithms/distance/test_distance.hpp +++ b/test/algorithms/distance/test_distance.hpp @@ -51,7 +51,7 @@ struct tag template struct return_type { - typedef typename coordinate_type::type type; + using type = coordinate_type_t; }; @@ -74,7 +74,7 @@ template struct result_from_distance { template - static inline typename coordinate_type::type apply(taxicab_distance const& , T const& value) + static inline coordinate_type_t apply(taxicab_distance const& , T const& value) { return value; } diff --git a/test/algorithms/distance/test_distance_common.hpp b/test/algorithms/distance/test_distance_common.hpp index 88c2747d5..22ecbed3d 100644 --- a/test/algorithms/distance/test_distance_common.hpp +++ b/test/algorithms/distance/test_distance_common.hpp @@ -355,9 +355,9 @@ struct test_distance_of_geometries > : public test_distance_of_geometries { - typedef test_distance_of_geometries base; + using base = test_distance_of_geometries; - typedef typename bg::ring_type::type ring_type; + using ring_type = bg::ring_type_t; template < @@ -462,7 +462,7 @@ struct test_distance_of_geometries > : public test_distance_of_geometries { - typedef test_distance_of_geometries base; + using base = test_distance_of_geometries; template < diff --git a/test/algorithms/envelope_expand/envelope_on_spheroid.cpp b/test/algorithms/envelope_expand/envelope_on_spheroid.cpp index 9d2bd688d..d677220a0 100644 --- a/test/algorithms/envelope_expand/envelope_on_spheroid.cpp +++ b/test/algorithms/envelope_expand/envelope_on_spheroid.cpp @@ -201,7 +201,7 @@ private: T3 const& lon_max, T4 const& lat_max, double height_max, double tolerance) { - typedef typename bg::coordinate_system::type::units box_units_type; + using box_units_type = bg::detail::coordinate_system_units_t; std::string const units_str = units2string(); diff --git a/test/algorithms/envelope_expand/expand_on_spheroid.cpp b/test/algorithms/envelope_expand/expand_on_spheroid.cpp index e7e45a230..bbfb46cb0 100644 --- a/test/algorithms/envelope_expand/expand_on_spheroid.cpp +++ b/test/algorithms/envelope_expand/expand_on_spheroid.cpp @@ -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; std::string const units_str = units2string(); Box detected; diff --git a/test/algorithms/overlay/dissolver.cpp b/test/algorithms/overlay/dissolver.cpp index 2d8e28a0f..05c2f1964 100644 --- a/test/algorithms/overlay/dissolver.cpp +++ b/test/algorithms/overlay/dissolver.cpp @@ -39,9 +39,8 @@ void test_dissolve_plusmin(std::string const& caseid, Collection const& input, T const& expected_positive_area, T const& expected_negative_area) { - typedef typename boost::range_value::type geometry_type; - typedef typename bg::point_type::type point_type; - + using geometry_type = typename boost::range_value::type; + using point_type = bg::point_type_t; GeometryOut output; bg::dissolver(input, output); @@ -117,8 +116,8 @@ void test_geometry(std::string const& caseid, std::string const& wkt, // Test std::vector { - typedef typename boost::range_value::type polygon_type; - typedef typename bg::ring_type::type ring_type; + using polygon_type = typename boost::range_value::type; + using ring_type = bg::ring_type_t; std::vector rings; for (polygon_type const& polygon : multi_polygon) { @@ -163,8 +162,8 @@ void test_geometry(std::string const& caseid, std::string const& wkt, template void test_all() { - typedef bg::model::polygon polygon; - typedef bg::model::multi_polygon multi_polygon; + using polygon = bg::model::polygon; + using multi_polygon = bg::model::multi_polygon; test_geometry("simplex_one", "MULTIPOLYGON(((0 0,1 4,4 1,0 0)))", diff --git a/test/algorithms/overlay/multi_overlay_cases.hpp b/test/algorithms/overlay/multi_overlay_cases.hpp index fd0d80ad8..6a8295a5d 100644 --- a/test/algorithms/overlay/multi_overlay_cases.hpp +++ b/test/algorithms/overlay/multi_overlay_cases.hpp @@ -62,6 +62,13 @@ static std::string case_multi_2[2] = "MULTIPOLYGON(((14 4,8 8,15 10,14 4)),((15 3,18 9,20 2,15 3)),((5 5,4 7,7 7,5 5)))" }; +// To test travels_to_vertex +static std::string case_multi_3[2] = +{ + "MULTIPOLYGON(((1 2,0 3,0 8,1 9,6 9,7 8,7 3,6 2,1 2)))", + "MULTIPOLYGON(((4 1,4 3,2 4,6 5,2 6,6 7,4 8,4 10,10 10,10 1,4 1)))" +}; + // Case 58, same as case_58 IET (single) but here the second polygon is inverted // To check behaviour of difference, but in an intersection operation static std::string case_58_multi[8] = @@ -653,10 +660,201 @@ static std::string case_140_multi[2] = static std::string case_141_multi[2] = { // Version to test more isolation/validity cases - "MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(2 3,1 2,2 1,3 2,2 3),(2 7,3 8,2 9,1 8,2 7),(10 3,9 4,8 3,9 2,10 3),(7 10,6 9,7 8,8 9,7 10),(10 7,9 8,8 7,9 6,10 7)))", - "MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(0 5,2 3,4 5,2 7),(3 2,4 1,5 2,4 3,3 2),(3 8,4 7,5 8,4 9,3 8),(7 2,8 1,9 2,8 2,8 3,7 2),(8 7,7 8,6 7,7 6,8 7)))" + R""""( + MULTIPOLYGON( + ((0 0,0 10,10 10,10 0,0 0), + (2 3,1 2,2 1,3 2,2 3), + (2 7,3 8,2 9,1 8,2 7), + (10 3,9 4,8 3,9 2,10 3), + (7 10,6 9,7 8,8 9,7 10), + (10 7,9 8,8 7,9 6,10 7))) + )"""", + R""""( + MULTIPOLYGON( + ((0 0,0 10,10 10,10 0,0 0), + (0 5,2 3,4 5,2 7), + (3 2,4 1,5 2,4 3,3 2), + (3 8,4 7,5 8,4 9,3 8), + (7 2,8 1,9 2,8 2,8 3,7 2), + (8 7,7 8,6 7,7 6,8 7))) + )"""" }; +static std::string case_142_multi[2] = +{ + // Simpler version of 141 with one isolated interior (in intersection), + // no clusters, no self-turns. Only cc, ii and ui turns. + R""""( + MULTIPOLYGON( + ((0 0,0 10,0 10,10 10,10 0,0 0), + (2 7,4 5,6 5,8 7,2 7)) + ) + )"""", + R""""( + MULTIPOLYGON( + ((0 0,0 10,4 10,5 11,6 10,10 10,10 0,0 0), + (5 10,2 7,5 4,8 7,5 10)) + ) + )"""" +}; + +static std::string case_143_multi[2] = +{ + // Same but with one extra inteior + R""""( + MULTIPOLYGON( + ((0 0,0 10,10 10,10 8,10 6,10 4,10 2,10 0,0 0), + (2 7,4 5,6 5,8 7,2 7), + (5 4,4 3,5 2,6 3,5 4) + ) + ) + )"""", + R""""( + MULTIPOLYGON( + ((0 0,0 10,4 10,5 11,6 10,10 10,10 9,10 7,10 5,10 3,10 1,10 0,0 0), + (5 10,2 7,5 4,8 7,5 10)) + ) + )"""" +}; + +static std::string case_144_multi[2] = +{ + // Simple case resulting in two separate exterior rings. + R""""( + MULTIPOLYGON( + ((0 0,0 10,10 10,10 0,0 0), + (2 7,4 5,6 5,8 7,2 7), + (5 4,4 3,5 2,6 3,5 4) + ) + ) + )"""", + R""""( + MULTIPOLYGON( + ((0 0,0 10,4 10,5 11,6 10,10 10,10 9,10 1,10 0,6 0,5 -1,4 0,0 0), + (5 10,2 7,5 4,8 7,5 10), + (4 1,5 0,6 1,5 2,4 1) + ) + ) + )"""" +}; + +static std::string case_145_multi[2] = +{ + // Simpler version of 141 with two isolated interiors, and two variations in the lower corners. + // This gives mainly cc, some ii, and some iu cases. + R""""( + MULTIPOLYGON( + ((0 2,0 9,0 10,2 10,6 10,10 10,10 4,10 0,7 0,2 0,0 2), + (10 7,9 8,8 7,9 6,10 7), + (3 8,5 6,7 8,3 8), + (5 0,6 1,5 2,4 1,5 0)) + ) + )"""", + R""""( + MULTIPOLYGON( + ((0 0,0 1,0 10,4 10,5 11,6 10,10 10,10 4,10 2,8 0,3 0,0 0), + (5 10,3 8,5 6,7 8,5 10), + (0 5,2 3,4 5,2 7)) + ) + )"""" +}; + +static std::string case_146_multi[2] = +{ + // As 141, with an interior ring and a separate island, + // but 1: attached is another isolated interior ring + // and 2: these combined shapes are copied to the left, in reversed order. + R""""( + MULTIPOLYGON( + ((0 0,0 10,10 10,10 0,0 0), + (10 3,9 4,8 3,9 2,10 3), + (2 2,1 3,0 2,1 1,2 2), + (5 3,4 4,3 3,4 2,5 3), + (7 2,6 3,5 2,6 1,7 2), + (7 10,6 9,7 8,8 9,7 10), + (10 7,9 8,8 7,9 6,10 7)) + ) + )"""", + R""""( + MULTIPOLYGON( + ((0 0,0 10,10 10,10 0,0 0), + (7 2,8 1,9 2,8 2,8 3,7 2), + (2 2,3 1,4 2,3 2,3 3,2 2), + (8 7,7 8,6 7,7 6,8 7)) + ) + )"""" +}; + +static std::string case_147_multi[2] = +{ + // Version with touching islands in holes in various ways. + R""""( + MULTIPOLYGON( + ((10 0,0 10,10 20,20 10,10 0), + (5 5,7 5,7 7,5 7,5 5), + (15 5,15 9,11 9,11 5,15 5), + (5 15,5 11,7 11,6 12,7 13,7 15,5 15), + (15 15,11 15,11 11,15 11,15 15)), + ((15 9,14 6,11 5,12 8,15 9)), + ((15 15,14 12,11 11,12 14,15 15)) + ) + )"""", + R""""( + MULTIPOLYGON( + ((10 0,0 10,10 20,20 10,10 0), + (7 7,9 7,9 9,7 9,7 7), + (15 5,15 9,11 9,11 5,15 5), + (7 15,8 14,7 13,7 11,9 11,9 15,7 15), + (15 15,11 15,11 11,15 11,15 15)), + ((15 9,14 6,11 5,12 8,15 9)), + ((15 15,14 12,11 11,12 14,15 15)), + ((7 9,8.5 8.5,9 7,7.5 7.5,7 9)) + ) + )"""" +}; + +static std::string case_148_multi[2] = +{ + // For clustered self-turns + R""""( + MULTIPOLYGON( + ((2 3,2 2,1 2,1 3,2 3)), + ((2 0,0 0,0 2,1 2,1.5 1.5,2 2,2 1,1 1,2 0)), + ((2 0,2 1,3 2,4 2,3.5 1.5,4 1,4 0,2 0), (2 1,2.5 0.5,3 1,2 1)) + ) + )"""", + R""""( + MULTIPOLYGON( + ((2 0,2 1.5,3.5 3,4 3,4 0,2 0)), + ((1.0 0.5,1.0 3,1.5 3,1.5 0.5,1.0 0.5)), + ((2 2,2 3,2.5 3,2.5 2,2 2)) + ) + )"""" +}; + +static std::string case_149_multi[2] = +{ + // For all turn situations (cc, ii, uu, iu, ux, ix), + // without self-intersections or clusters. + R""""( + MULTIPOLYGON( + ((1 0,1 9,10 9,10 0,7 0,5 0,3 0,1 0), (9 6,7 8,5 6,7 4,9 6), (6 3,4 5,3 4,5 2,6 3) ), + ((5 10,3 12,5 14,7 12,5 10)) + ) + )"""", + R""""( + MULTIPOLYGON( + ((0 0,0 3,0 6,0 10,9 10,9 0,7 0,5 0,3 0,0 0), + (5 2,3 4,2 3,4 1,5 2), + (1 7,3 5,5 7,3 9,1 7) + ), + ((7 12,5 14,7 16,9 14,7 12)) + + ) + )"""" +}; + + static std::string case_recursive_boxes_1[2] = { "MULTIPOLYGON(((1 0,0 0,0 1,1 1,1 2,0 2,0 4,2 4,2 5,3 5,3 6,1 6,1 5,0 5,0 10,9 10,9 9,7 9,7 8,6 8,6 7,8 7,8 6,9 6,9 4,8 4,8 3,10 3,10 0,6 0,6 1,5 1,5 0,1 0),(8 4,8 5,7 5,7 6,6 6,6 5,5 5,5 4,4 4,4 3,5 3,5 2,7 2,7 3,6 3,6 4,8 4),(8 1,9 1,9 2,8 2,8 1),(4 7,4 9,3 9,3 7,4 7)),((9 9,10 9,10 7,10 6,9 6,9 7,8 7,8 8,9 8,9 9)))", @@ -1314,6 +1512,122 @@ static std::string case_recursive_boxes_88[2] = "MULTIPOLYGON(((4 0,4 1,5 1,5 0,4 0)),((3 4,3 3,1 3,1 5,3 5,2.5 4.5,3 4)),((3 4,3 5,4 5,4 4,3 4)),((1 1,2 0,1 0,1 1)),((1 1,1 2,2 2,2 1,1 1)),((1 2,0 2,0 3,1 3,1 2)),((4 4,5 4,5 2,4 2,4 4)))" }; +static std::string case_recursive_boxes_89[2] = +{ + "MULTIPOLYGON(((1 3,2 3,2 2,1 2,1 3)),((1 1,2 2,2 1,1 1)))", + "MULTIPOLYGON(((1 0,1 3,3 3,3 2,2 2,3 1,2 1,1 0)))" +}; + +static std::string case_recursive_boxes_90[2] = +{ + "MULTIPOLYGON(((5 3,5 4,6 4,5 3)),((7 1,6 1,6 2,7 1)),((5 1,5 2,6 2,5 1)))", + "MULTIPOLYGON(((7 1,4 1,5 2,5 3,6 3,6 2,7 2,7 1)),((4 3,5 2,4 2,4 3)),((7 5,6 4,6 5,7 5)))" +}; + +static std::string case_recursive_boxes_91[8] = +{ + // Issue which needs selection of cc by distance to next turn. + // TODO: calculate it OVER THE RING. + + // Originals (problematic) + "MULTIPOLYGON(((7 10,7 9,8 8,7 8,7 7,6 7,6 6,5 6,5 7,4 7,4 9,5 10,5 9,6 10,7 10)),((3 3,3 4,2 4,2 5,3 5,3 6,2 6,2 7,4 7,4 6,5 6,4.5 5.5,5 5,5 4,4 4,4 3,3 3)),((6 4,6 3,5 3,6 4)),((4 3,5 4,5 3,4 3)),((3 1,4 0,3 0,3 1)),((5 2,5 0,4 0,4 1,5 2)),((2 4,0 4,0 5,1 5,2 4)),((0 1,0 3,1 4,1 3,2 3,3 2,4 2,4 1,0 1),(1 1,1 2,0.5 1.5,1 1)),((2 8,2 9,3 10,4 10,4 9,3 8,2 8)),((0 6,1 7,0 7,1 8,2 8,2 7,1 6,0 6)),((4 8,3 7,3 8,4 8)),((7 7,7 5,6 5,6 6,7 7)),((7 2,7 3,8 4,7 4,7 5,9 5,9 4,10 4,10 3,8 3,8 2,7 2)),((10 0,6 0,6 1,8 1,8 2,9 2,9 1,10 0)),((7 9,8 10,8.5 9.5,9 10,10 10,10 7,9 7,9 8,8 8,9 9,7 9)),((2 4,3 3,2 3,2 4)),((6 1,6 3,7 2,6 1)),((1 10,2 9,1 9,1 10)),((6 3,7 4,7 3,6 3)),((10 2,10 1,9 1,10 2)),((8 8,9 7,8 7,8 8)))", + "MULTIPOLYGON(((10 3,10 1,9 1,9 2,8 2,8 1,7 1,7 0,6 0,6 1,5 1,5 0,3 0,5 2,5 3,6 3,7 2,8 3,10 3)),((7 4,6 4,6 5,5 4,4 4,5 5,5 6,4 6,4 8,5 9,4 9,4 10,6 10,8 8,8 7,7 7,7 8,5 8,5 7,6 7,6 6,7 5,7 4),(6 9,6 10,5.5 9.5,6 9)),((3 4,3 6,3.5 5.5,4 6,4 4,3 4)),((6 8,7 7,6 7,6 8)),((3 1,4 2,4 1,3 1)),((0 3,0 5,1 6,1 5,2 6,2 5,3 5,2 4,1 4,1 3,0 3)),((4 2,3 2,3 0,2 0,2 1,0 1,1 2,2 2,2 3,3 3,4 2)),((1 1,1 0,0 0,0 1,0.5 0.5,1 1)),((0 8,0 9,1 10,3 10,2 9,1 9,1 8,0 8)),((0 6,0 7,1 7,2 8,1 8,2 9,3 8,4 8,3 7,2 7,2 6,0 6)),((10 6,10 4,8 4,8 5,9 5,10 6)),((9 8,9 9,10 10,10 9,9 8)),((9 10,9 9,7 9,7 10,8 10,8.5 9.5,9 10)),((10 0,9 0,9 1,9.5 0.5,10 1,10 0)),((6 4,5 3,5 4,6 4)),((4 4,5 3,4 3,4 4)),((3 6,3 7,4 7,3 6)),((8 6,7 6,7 7,8 6)))", + + // Rewritten by PostGIS intersection (OK) + "MULTIPOLYGON(((7 9,8 8,7 8,7 7,6 7,6 6,5 6,5 7,4 7,4 8,4 9,5 10,5 9,6 10,7 10,7 9)),((3 4,2 4,2 5,3 5,3 6,2 6,2 7,3 7,4 7,4 6,5 6,4.5 5.5,5 5,5 4,4 4,4 3,3 3,3 4)),((6 3,5 3,6 4,6 3)),((5 4,5 3,4 3,5 4)),((4 0,3 0,3 1,4 0)),((5 0,4 0,4 1,5 2,5 0)),((1 4,0 4,0 5,1 5,2 4,1 4)),((0 3,1 4,1 3,2 3,3 2,4 2,4 1,3 1,1 1,0 1,0 3),(1 2,0.5 1.5,1 1,1 2)),((2 9,3 10,4 10,4 9,3 8,2 8,2 9)),((1 7,0 7,1 8,2 8,2 7,1 6,0 6,1 7)),((3 7,3 8,4 8,3 7)),((7 5,6 5,6 6,7 7,7 5)),((7 3,8 4,7 4,7 5,9 5,9 4,10 4,10 3,8 3,8 2,7 2,7 3)),((6 0,6 1,8 1,8 2,9 2,9 1,10 0,6 0)),((8 10,8.5 9.5,9 10,10 10,10 7,9 7,9 8,8 8,9 9,7 9,8 10)),((3 3,2 3,2 4,3 3)),((6 3,7 2,6 1,6 3)),((2 9,1 9,1 10,2 9)),((7 4,7 3,6 3,7 4)),((10 1,9 1,10 2,10 1)),((9 7,8 7,8 8,9 7)))", + "MULTIPOLYGON(((10 1,9 1,9 2,8 2,8 1,7 1,7 0,6 0,6 1,5 1,5 0,3 0,4 1,5 2,5 3,6 3,7 2,8 3,10 3,10 1)),((6 4,6 5,5 4,4 4,5 5,5 6,4 6,4 7,4 8,5 9,4 9,4 10,6 10,7 9,8 8,8 7,7 7,7 8,6 8,5 8,5 7,6 7,6 6,7 5,7 4,6 4),(5.5 9.5,6 9,6 10,5.5 9.5)),((3 5,3 6,3.5 5.5,4 6,4 4,3 4,3 5)),((7 7,6 7,6 8,7 7)),((4 2,4 1,3 1,4 2)),((0 5,1 6,1 5,2 6,2 5,3 5,2 4,1 4,1 3,0 3,0 5)),((3 2,3 1,3 0,2 0,2 1,1 1,0 1,1 2,2 2,2 3,3 3,4 2,3 2)),((1 0,0 0,0 1,0.5 0.5,1 1,1 0)),((0 9,1 10,3 10,2 9,1 9,1 8,0 8,0 9)),((0 7,1 7,2 8,1 8,2 9,3 8,4 8,3 7,2 7,2 6,1 6,0 6,0 7)),((10 4,8 4,8 5,9 5,10 6,10 4)),((9 9,10 10,10 9,9 8,9 9)),((9 9,7 9,7 10,8 10,8.5 9.5,9 10,9 9)),((9 0,9 1,9.5 0.5,10 1,10 0,9 0)),((5 3,5 4,6 4,5 3)),((5 3,4 3,4 4,5 3)),((3 7,4 7,3 6,3 7)),((7 6,7 7,8 6,7 6)))", + + // Intersected with 0,4 (OK) + "MULTIPOLYGON(((3 4,4 4,4 3,3 3,3 4)),((4 0,3 0,3 1,4 0)),((0 3,1 4,1 3,2 3,3 2,4 2,4 1,3 1,1 1,0 1,0 3),(1 2,0.5 1.5,1 1,1 2)),((3 3,2 3,2 4,3 3)))", + "MULTIPOLYGON(((3 0,4 1,4 0,3 0)),((4 2,4 1,3 1,4 2)),((0 4,1 4,1 3,0 3,0 4)),((3 2,3 1,3 0,2 0,2 1,1 1,0 1,1 2,2 2,2 3,3 3,4 2,3 2)),((1 0,0 0,0 1,0.5 0.5,1 1,1 0)))", + + // Manually selected (problematic) + "MULTIPOLYGON(((3 3,3 4,2 4,2 5,3 5,3 6,2 6,2 7,4 7,4 6,5 6,4.5 5.5,5 5,5 4,4 4,4 3,3 3)),((6 4,6 3,5 3,6 4)),((4 3,5 4,5 3,4 3)),((3 1,4 0,3 0,3 1)),((5 2,5 0,4 0,4 1,5 2)),((2 4,0 4,0 5,1 5,2 4)),((0 1,0 3,1 4,1 3,2 3,3 2,4 2,4 1,0 1),(1 1,1 2,0.5 1.5,1 1)),((2 4,3 3,2 3,2 4)))", + "MULTIPOLYGON(((7 4,6 4,6 5,5 4,4 4,5 5,5 6,4 6,4 8,5 9,4 9,4 10,6 10,8 8,8 7,7 7,7 8,5 8,5 7,6 7,6 6,7 5,7 4)),((3 4,3 6,3.5 5.5,4 6,4 4,3 4)),((6 8,7 7,6 7,6 8)),((3 1,4 2,4 1,3 1)),((0 3,0 5,1 6,1 5,2 6,2 5,3 5,2 4,1 4,1 3,0 3)),((4 2,3 2,3 0,2 0,2 1,0 1,1 2,2 2,2 3,3 3,4 2)),((1 1,1 0,0 0,0 1,0.5 0.5,1 1)),((4 4,5 3,4 3,4 4)),((3 6,3 7,4 7,3 6)))" +}; + +static std::string case_recursive_boxes_92[2] = +{ + // Missing triangle in intersection upper-right. Requires different handling of cc + "MULTIPOLYGON(((5 1,5 0,4 0,4 1,5 1)),((2 1,3 2,1 2,2 3,3 3,3 4,4 5,5 5,5 6,7 6,7 7,7.5 6.5,8 7,8 5,6 5,6 4,4 4,5 3,4 3,4 2,3 1,2 1)),((8 7,5 7,5 8,6 8,7 9,7 8,8 7)),((4 6,4 8,5 7,4 6)),((10 7,9 7,9 8,8 8,8 9,6 9,5 8,5 9,4 9,5 10,10 10,10 7)),((7 5,8 4,8 3,7 3,6 2,5 2,5 3,6 3,7 4,7 5)),((0 10,1 10,1 9,2 9,2 8,1 7,3 7,3 6,2 6,2 4,1 3,0 3,1 4,1 5,0 5,0 7,1 8,0 8,0 10)),((3 4,2 3,2 4,3 4)),((4 6,3 5,3 6,4 6)),((0 1,0 2,1 3,1 2,0.5 1.5,1 1,0 1)),((3 9,3 8,2 8,3 9)),((10 6,10 4,9 3,9 4,8 4,8 5,9 5,10 6)),((6 0,6 1,7 2,8 1,7 1,7 0,6 0)),((9 0,10 1,10 0,9 0)),((10 3,10 2,9 2,9 0,8 0,8 2,9 3,10 3)),((3 0,2 0,2 1,3 0)),((1 1,2 0,1 0,1 1)))", + "MULTIPOLYGON(((4 7,5 6,4 6,4 7)),((10 10,9 9,10 8,10 7,6 7,5 6,5 7,4 7,5 8,6 8,6 9,5 9,5 10,7 10,8 9,8 10,10 10),(7 7,8 8,7 8,7 7),(10 8,9 8,9.5 7.5,10 8)),((6 6,5 5,5 6,6 6)),((6 4,5.5 3.5,6 3,5 2,4 2,5 3,5 4,6 4)),((3 0,3 2,4 2,4.5 1.5,5 2,5 1,4 1,5 0,3 0)),((3 7,3 9,3.5 8.5,4 9,5 9,3 7)),((10 3,9 2,9 3,7 3,6 2,6 5,7 6,10 6,10 5,9 5,9 4,10 4,10 3),(7 4,7 5,6.5 4.5,7 4),(8 4,8 5,7.5 4.5,8 4),(8 3,8 4,7 4,8 3)),((2 0,2 1,3 1,2 0)),((0 0,0 6,1 6,1.5 5.5,2 6,2 5,1 5,1 3,2 3,2 4,2.5 3.5,3 4,3 2,2 2,2 1,1 1,1 0,0 0)),((3 6,3 5,2 5,3 6)),((3 8,2.5 7.5,3 7,3 6,1 6,1 7,0 7,0 8,1 8,2 7,2 8,3 8)),((3 9,2 9,2 8,1 8,1 9,0 9,0 10,2 10,3 9)),((7 0,7 1,9 1,9 0,7 0)),((9 2,8 2,8 3,9 2)),((6 0,6 2,7 2,7 1,6 0)),((10 1,9 1,9 2,10 2,10 1)),((4 10,3 9,3 10,4 10)),((4 4,4 5,5 5,4 4)))" +}; + +static std::string case_recursive_boxes_93[2] = +{ + // Similar to 92 + "MULTIPOLYGON(((6 5,3 5,3 7,4 7,4 6,5 7,5 6,6 5)),((3 1,3 5,4 4,5 5,6 4,5 4,4 3,4 2,3 1)),((8 7,8 6,9 6,9 5,10 5,10 3,9 3,8 2,5 2,5 3,5.5 2.5,6 3,6 5,7 4,8 4,8 5,7 5,7 6,8 7),(7 3,6 3,6.5 2.5,7 3)),((4 1,4 2,5 2,5 1,4 1)),((3 0,3 1,4 1,3 0)),((10 1,9 0,5 0,6 1,6 2,6.5 1.5,7 2,7 1,10 1)),((9 10,9 8,8 8,9 7,7 7,7 6,6 6,6 7,5 7,6 8,6 10,7 9,7 10,9 10)),((4 7,5 8,5 7,4 7)),((4 8,4 10,5 10,5 8,4 8)),((3 10,2.5 9.5,3 9,3 7,2 6,2 5,1 5,1 6,2 7,2 8,1 8,1 9,2 9,2 10,3 10)),((2 4,1 4,1 5,2 4)),((0 9,1 9,0.5 8.5,1 8,1 6,0 6,0 9)),((3 3,2 3,2 4,3 3)),((0 1,0 5,1 4,1 3,2 3,2 2,1 1,0 1),(1 2,0 2,0.5 1.5,1 2)),((0 0,0 1,0.5 0.5,1 1,3 1,2 0,0 0)),((4 10,3 9,3 10,4 10)),((9 2,8 1,8 2,9 2)),((10 9,10 6,9 6,9 8,10 9)))", + "MULTIPOLYGON(((2 2,2 3,4 5,4 3,3 3,2.5 2.5,3 2,2 2)),((10 10,10 9,9 8,8 8,8 7,7 7,7 5,4 5,4 8,3 8,3 7,1 7,1 8,2 9,0 9,0 10,3 10,3 9,5 9,5 8,6 9,6 8,7 9,8 9,9 10,9 9,10 10),(5 5,5 6,4.5 5.5,5 5),(6 8,5 7,6 7,6 8)),((7 10,7 9,5 9,5 10,7 10)),((4 9,4 10,5 10,4 9)),((9 5,9 4,8.5 3.5,9 3,10 3,10 1,8 1,8 0,4 0,5 1,5 2,6 3,6 4,7 4,7 3,6.5 2.5,7 2,8 3,8 5,9 5),(6 1,5 1,5.5 0.5,6 1),(7 1,6.5 0.5,7 0,7 1),(8 2,9 1,9 2,8 2)),((3 1,4 2,5 2,4.5 1.5,5 1,3 1)),((0 7,0.5 6.5,1 7,1 5,0 5,0 7)),((2 3,1 3,1 5,2 6,2 3)),((2 4,3 5,3 4,2 4)),((0 1,0 3,1 3,1 2,0 1)),((1 0,0 0,0 1,1 0)),((1 1,2 2,2 1,1 1)),((2 6,3 7,3 6,2 6)),((0 8,1 7,0 7,0 8)),((8 4,7 4,7 5,8 5,7.5 4.5,8 4)),((10 7,10 6,9 5,9 6,10 7)),((10 0,8 0,9 1,10 0)))" +}; + +static std::string case_recursive_boxes_94[2] = +{ + // Similar to 92, requires cc + "MULTIPOLYGON(((6 5,5 5,5 9,7 9,7 10,8 9,7 8,6 8,6 5)),((1 8,1 10,5 10,5 9,4 8,4 7,3 7,3 8,1 8),(4 10,3.5 9.5,4 9,4 10),(3 8,3 9,2.5 8.5,3 8)),((1 5,1.5 4.5,2 5,3 5,4 6,3 6,4 7,5 6,4 5,4 4,5 4,5 3,3 3,3 4,1 4,1 5)),((3 1,3 2,4 2,4 3,5 2,5 3,6 4,6 3,6.5 2.5,7 3,7 2,6 2,5 1,3 1)),((2 0,2 1,3 1,2.5 0.5,3 0,2 0)),((3 0,4 1,4 0,3 0)),((1 3,2 4,2 3,1 3)),((0 0,0 1,2 1,1 0,0 0)),((3 2,2 1,2 2,3 2)),((0 4,1 4,1 3,0 3,0 4)),((3 7,3 6,1 6,2 7,3 7)),((0 6,0 7,1 8,1 6,0 6)),((0 9,1 8,0 8,0 9)),((0 9,0 10,1 10,0 9)),((8 4,7 4,7 5,8 4)),((6 4,6 5,7 6,7 5,6 4)),((9 6,9 5,8 5,8 6,8.5 5.5,9 6)),((9 4,8 3,8 4,9 4)),((9 8,9 6,6 6,8 8,9 8)),((10 7,10 6,9 6,10 7)),((6 0,7 1,7 2,8 2,8 3,10 3,10 2,9 2,8.5 1.5,9 1,9 0,6 0)),((5 0,6 1,6 0,5 0)),((10 2,10 1,9 1,10 2)),((10 4,9 3,9 4,10 4)),((8 10,10 10,10 8,9 8,9 9,8 9,8 10)),((9 7,10 8,10 7,9 7)))", + "MULTIPOLYGON(((1 10,1 7,2 7,4 5,4 4,3 4,3 2,4 2,4 3,5 3,5 2,5.5 1.5,6 2,6 3,7 2,7 0,6 0,6 1,4 1,5 0,2 0,2 2,1 1,1 2,2 3,1 3,1 4,0 4,1 5,0 5,0 9,1 10),(2 6,3 5,3 6,2 6)),((2 7,2 9,3 9,3 8,4 8,4 9,5 8,6 8,5 7,4 7,4 6,3 6,3 7,2 7)),((8 3,6 3,6 5,5 5,5 7,7 7,7 6,8 5,7.5 4.5,8 4,8 3),(6 6,5 6,5.5 5.5,6 6),(7 6,6.5 5.5,7 5,7 6)),((6 4,5 4,5 5,6 4)),((0 2,0 3,1 3,1 2,0 2)),((0 0,1 1,1 0,0 0)),((3 10,2 9,2 10,3 10)),((10 3,9 3,9 6,8 6,8 7,9 8,9 7,10 8,10 3)),((8 4,8 6,9 5,8 4)),((9 3,9 2,7 2,8 3,9 3)),((10 0,8 0,8 1,9 2,9 1,10 1,10 0)),((7 7,7 9,9 9,8.5 8.5,9 8,8 8,8 7,7 7)),((10 10,10 8,9 8,9 9,10 10)),((5 10,5 9,3 9,4 10,5 10)))" +}; + +static std::string case_recursive_boxes_95[2] = +{ + // Similar to 92, requires cc + "MULTIPOLYGON(((1 10,2 9,2 10,3 10,3 9,4 10,4 9,5 9,5 10,5.5 9.5,6 10,7 10,7 9,7.5 8.5,8 9,8 8,7 8,7 7,8 6,7 6,6.5 5.5,7 5,6 4,6 5,5 5,4 4,4 5,3 5,3 4,2 4,2 5,1 5,1 4,0 4,0 8,1 8,1 10),(4 9,3 8,3 7,4.5 5.5,5 6,5 7,4 7,5 8,4 8,4 9),(6 6,6 7,5 7,6 6),(3 6,2 6,2 5,3 6)),((4 7,5 6,4 6,4 7)),((4 4,6 4,5 3,6 3,7 2,6 2,5 1,5 2,4 2,4 4)),((3 3,4 2,3 2,3 3)),((8 2,8 0,4 0,4 1,6 1,6 2,7 1,7 2,8 2)),((8 4,8 3,6 3,6 4,8 4)),((3 1,4 0,3 0,3 1)),((1 3,1 4,2 4,2.5 3.5,3 4,3 3,1 3)),((0 2,0 3,1 3,0 2)),((0 2,1 2,1 0,0 0,0 2)),((9 9,10 9,10 4,9 3,8 3,9 4,8 4,8 6,9 7,9 9),(9 6,8 5,9 5,9 6)),((10 3,10 2,8 2,9 3,10 3)),((9 1,10 2,10 1,9 1)),((9 0,9 1,9.5 0.5,10 1,10 0,9 0)),((8 8,8 7,7 7,8 8)),((9 10,8 9,8 10,9 10)),((2 1,3 2,3 1,2 1)))", + "MULTIPOLYGON(((10 5,9 4,8 4,7.5 3.5,8 3,8 2,7 2,7 3,6 2,3 2,4 3,4 4,3 3,3 4,4 5,3 5,4 6,4.5 5.5,5 6,6 6,6 4,7 5,7 6,8 5,9 6,9 5,10 5)),((8 0,4 0,4 1,5 2,6 1,6 2,7 2,7.5 1.5,8 2,8 0)),((9 10,9 9,8 9,8 8,7.5 7.5,8 7,7 6,7 7,6 6,6 7,5 7,5 8,4 8,4 10,5 10,5 9,5.5 8.5,7 10,9 10)),((0 1,0 4,1 5,1 6,2 5,2 6,3 7,4 7,4 8,5 7,4 6,3 6,2.5 5.5,3 5,3 4,2 4,2 3,1 3,2 2,1 2,0 1),(1 3,1 4,0.5 3.5,1 3)),((2 3,2.5 2.5,3 3,3 0,1 0,2 1,1 1,2 2,2 3)),((3 9,3 10,4 10,3 9)),((0 10,1 10,1 9,2 9,2 7,1 7,1 8,0 8,0 10)),((0 6,0 7,0.5 6.5,1 7,1 6,0 6)),((10 3,9 3,9 4,10 4,10 3)),((8 4,9 3,8 3,8 4)),((10 2,10 1,9.5 0.5,10 0,9 0,9 1,10 2)),((9 9,10 8,10 7,9 7,9 8,8 8,9 9)),((8 6,8 7,9 7,9 6,8 6)),((0 0,0 1,1 1,0 0)))" +}; + +static std::string case_recursive_boxes_96[2] = +{ + // Similar to 92, requires cc + "MULTIPOLYGON(((8 4,8 3,7 3,6.5 2.5,7 2,5 2,7 4,8 4)),((10 0,5 0,5 2,5.5 1.5,6 2,6 1,7 1,7 2,8 3,8 1,9 1,10 0)),((6 6,6 5,5 5,6 6)),((9 10,9 9,8 9,9 8,9 7,10 7,10 6,8 6,8 5,7 4,5 4,4 3,4 4,3 4,3 3,2 3,2 5,1 5,1 4,0 4,0 5,1 6,0 6,0 8,1 8,1 7,3 9,3 10,9 10),(7 6,5 6,5 5,6 4,6 5,7 6),(2 7,3 7,3.5 6.5,4 7,4 6,6 8,6 9,4 9,4 8,2 8,2 7),(3 5,4 6,3 6,3 5),(8 8,8 9,7 9,7 8,8 8),(7 7,6 7,6.5 6.5,7 7),(2 6,1 6,1.5 5.5,2 6)),((5 3,6 4,6 3,5 3)),((4 8,5 8,5 7,4 7,4 8)),((3 8,4 7,3 7,3 8)),((3 1,3 3,3.5 2.5,4 3,4 1,3 1)),((0 2,0 3,1 4,2 3,1 3,1 2,0 2)),((0 1,1 2,2 2,1.5 1.5,2 1,2 0,1 0,1 1,0 1)),((3 2,2 1,2 2,3 2)),((1 9,2 9,2 8,1 8,1 9)),((0 10,1 9,0 9,0 10)),((10 5,9 5,9 6,10 5)),((9 4,9 3,8 3,9 4)),((10 4,10 1,9 1,9 2,8 2,10 4)),((10 9,10 8,9 8,10 9)))", + "MULTIPOLYGON(((3 4,5 6,5.5 5.5,6 6,6 5,5 5,5 4,3 4)),((3 5,3 9,4 10,5 9,4 9,4 8,3.5 7.5,4 7,4 5,3 5)),((8 8,7 8,7 7,4 7,4 8,5 8,5 10,5.5 9.5,6 10,8 10,8 8),(6 8,6 9,5 9,6 8)),((6 7,6 6,5 6,6 7)),((0 3,1 3,1 4,2 4,2 5,3 5,3 4,4 3,5 3,5 2,4 1,3 1,3 2,0 2,0 3),(2 3,1 3,1.5 2.5,2 3),(4 3,3 3,3.5 2.5,4 3)),((7 3,7 2,6 2,6 3,7 3)),((7 1,6 1,6 2,7 1)),((5 1,5 2,6 2,5 1)),((7 0,5 0,5 1,6 1,7 0)),((0 6,0 9,1 8,2 8,2 9,3 8,2 7,1 7,1 6,0 6)),((0 5,1 4,0 4,0 5)),((1 1,2 1,2 0,1 0,1 1)),((3 1,3 0,2 0,3 1)),((3 9,1 9,1 10,2 10,3 9)),((7 7,8 7,8 4,7 3,7 4,6 4,6 5,7 6,7 7)),((7 1,7 2,8 2,9 3,8 3,9 4,8 4,9 5,10 5,10 2,9 2,9 1,7 1)),((9 7,10 6,9 5,9 7)),((7 0,8 1,8 0,7 0)),((5 4,6 4,6 3,5 3,5 4)),((9 0,9 1,10 2,10 0,9 0)),((10 10,10 7,8 7,8 8,9 8,9 10,10 10)))" +}; + +static std::string case_recursive_boxes_97[2] = +{ + "MULTIPOLYGON(((9 10,9 7,8 7,9 6,8 6,7 5,4 5,4 6,4.5 5.5,5 6,5 8,6 9,7 9,7 10,9 10),(8 8,7 8,7 7,8 7,8 8),(6 6,6 7,5 7,6 6)),((6 2,5 2,5 3,3 3,4 4,5 4,6 5,7 4,6 4,6 2)),((5 9,5 10,6 10,6 9,5 9)),((5 7,4 6,4 7,5 7)),((5 1,3 1,4 2,5 1)),((3 10,5 10,4 9,3 9,3 10)),((3 5,2 5,2 6,3 5)),((4 8,4 7,3 6,2 6,2 8,3 7,4 8)),((3 6,4 5,3 4,3 0,1 0,1 1,2 1,2 3,0 3,1 4,2 4,3 5,3 6)),((0 2,1 2,1 1,0.5 0.5,1 0,0 0,0 2)),((0 10,2 10,2 9,3 9,3 8,1 8,1 9,0 9,0 10)),((6 0,6 2,7 3,6 3,7 4,7 5,9 5,10 4,9 4,9 2,8 2,6 0),(8 3,7.5 2.5,8 2,8 3)),((9 7,10 7,10 5,9 5,9 7)),((7 0,7 1,8 1,7 0)),((9 2,9 1,8 1,9 2)),((0 4,1 5,1 4,0 4)),((0 7,1 7,1 5,0 5,0 7)))", + "MULTIPOLYGON(((10 4,10 3,9 3,9 4,10 4)),((1 0,2 1,1 1,1 2,0 2,0 4,2 4,2 5,3 6,4 5,4 6,5 6,5 5,4.5 4.5,5 4,5 3,6 3,6.5 2.5,7 3,7 2,8 2,7 1,6 1,6 0,5 0,5 2,4 2,4 4,3 4,3 1,2 0,1 0),(2 2,3 3,2 3,2 2)),((4 1,5 0,4 0,4 1)),((10 10,10 9,9 8,8 8,8 9,7 9,7 8,6 8,5 7,5 8,4 7,4 9,5 10,5 9,5.5 8.5,6 9,6 10,10 10)),((10 8,10 7,9 6,8 6,9 5,8 4,7 4,7 6,5 6,5 7,6 7,6 8,7 7,8 7,8 8,9 7,10 8)),((2 6,3 7,3 6,2 6)),((0 6,1 7,0 7,0 9,1 10,3 10,3 8,4 7,2 7,2 6,0 6),(1 9,2 8,2 9,1 9),(1 9,0 8,1 8,1 9)),((10 5,9 5,9 6,10 6,10 5)),((9 2,8 1,8 2,9 2)),((9 1,9 2,10 2,10 1,9 1)),((5 7,4 6,4 7,5 7)),((0 1,1 0,0 0,0 1)),((6 5,6 4,5 4,6 5)),((10 0,9 0,9 1,10 0)))" +}; + +static std::string case_recursive_boxes_98[2] = +{ + // Needs skipping targets + "MULTIPOLYGON(((1 8,1 9,2 8,1 8)),((2 6,2 7,2.5 6.5,4 8,5 7,6 6,5 6,5 5,4 4,4 5,3 5,2 5,1 5,2 6),(4 7,4 6,5 7,4 7)),((6 8,6 9,7 8,6 8)),((5 9,6 9,5 8,5 9)),((4 4,3 4,3 5,4 4)),((3 8,3 10,4 10,4 9,4 8,3 8)),((6 7,7 7,6 6,6 7)),((5 10,5 9,4 9,5 10)),((3 4,2 4,2 5,3 4)),((1 6,1 7,2 6,1 6)),((0 7,1 7,0 6,0 7)))", + "MULTIPOLYGON(((4 7,5 7,4 6,4 7)),((6 7,5 7,6 8,6 7)),((6 4,5 4,6 5,6 4)),((5 4,4 4,4 5,5 5,5 4)),((7 8,6 8,2 8,2 9,7 9,7 8)),((1 5,2 5,2.5 4.5,3 5,3 4,2 4,1 4,1 5)),((1 6,1 7,2 6,1 6)),((1 8,1 7,0 7,0 8,1 8)),((3 5,2 5,3 6,3 5)),((7 5,6 5,6 6,7 5)))" +}; + +static std::string case_recursive_boxes_99[4] = +{ + // Has one ii turn with count right = 1 (it should be 2) + // The smaller version ([2][3]) does not have this problem. + "MULTIPOLYGON(((8 3,7 3,7 2,6 1,8 1,8 0,2 0,2 1,3 2,3 1,4 1,4 2,4.5 1.5,5 2,5 4,7 4,8 3),(5 3,6 2,6 3,5 3)),((8 10,8 9,6 9,6 8,3 8,3 10,6 10,6.5 9.5,7 10,8 10),(4 8,5 9,4 9,4 8)),((2 9,2 8,3 8,4 7,5 7,5 5,3 3,4 3,4 2,2 2,2 3,3 4,3 5,2 5,1 4,1 5,0 5,0 6,1 6,1 7,0 7,0 8,1 8,2 9),(5 6,4 6,4 5,5 6),(2 5,2 6,1.5 5.5,2 5),(2 6,3 7,2 7,2 6)),((1 0,0 0,0 2,0.5 1.5,1 2,1 0)),((2 4,2 3,1 2,0 2,0 4,1 4,1.5 3.5,2 4)),((0 8,0 10,2 10,2 9,1 9,0 8)),((9 4,10 5,10 4,9 4)),((7 6,7 5,6 5,6 6,7 6)),((10 7,10 6,9 6,9 5,7 5,8 6,7 6,7 7,8 7,8.5 6.5,9 7,10 7)),((9 1,9 3,10 3,10 2,9 1)),((8 1,8 3,9 2,8 1)),((7 1,7 2,8 2,7 1)),((6 7,6 8,7 9,7.5 8.5,8 9,9 8,7 8,6 7)),((10 9,9 9,9 10,10 10,10 9)),((5 6,6 7,6 6,5 6)),((8 8,9 7,8 7,8 8)),((2 5,3 4,2 4,2 5)))", + "MULTIPOLYGON(((7 6,8 5,7 4,7 3,6 3,6 2,7 1,6 0,6 1,5 0,5 1,3 1,4 2,4 3,5 3,5 4,6 4,6 5,7 5,7 6)),((2 7,5 7,5 4,3 4,3 6,2 6,2 7)),((10 4,9 4,9 5,8 5,9 6,7 6,7 7,6 6,5 6,6 7,5 7,5 8,6 9,7 9,7 10,9 10,10 9,9 9,9 8,10 8,10 4),(7 7,8 8,7 8,7 7),(8 6,9 7,8 7,8 6)),((5 10,4 9,3 9,4 10,5 10)),((3 5,2.5 4.5,3 4,0 4,0 6,2 6,2 5,3 5),(0 5,0.5 4.5,1 5,0 5)),((3 0,2 0,2 1,3 1,2.5 0.5,3 0)),((2 3,1 3,1 4,2 3)),((2 0,0 0,0 1,1 1,2 0)),((0 2,1 3,1.5 2.5,2 3,2 2,0 2)),((3 9,2 8,0 8,1 9,3 9)),((3 10,2 9,2 10,3 10)),((10 2,8 2,9 3,10 3,10 2)),((8 4,9 3,8 3,8 4)),((9 1,10 2,10 1,9 1)),((9 0,7 0,7 2,8 2,8 1,8.5 0.5,9 1,9 0)),((6 9,5 9,5 10,6 10,6 9)),((1 6,1 7,2 7,1 6)),((8 5,9 4,8 4,8 5)),((3 3,4 2,3 2,3 3)),((2 3,3 4,3 3,2 3)),((1 1,2 2,2 1,1 1)))", + "MULTIPOLYGON(((5 4,6 4,6 3,5 3,5 4)),((3 8,4 7,5 7,5 6,5 5,3 3,2 3,3 4,3 5,2 5,2 6,3 7,2 7,2 8,3 8),(4 6,4 5,5 6,4 6)),((6 7,6 6,5 6,6 7)),((3 4,2 4,2 5,3 4)))", + "MULTIPOLYGON(((5 4,6 4,6 3,5 3,5 4)),((5 7,5 6,5 4,3 4,3 5,3 6,2 6,2 7,5 7)),((5 6,6 7,6 6,5 6)),((5 7,5 8,6 8,6 7,5 7)),((2.5 4.5,3 4,2 4,2 5,3 5,2.5 4.5)),((3 4,3 3,2 3,3 4)))" +}; + + +static std::string case_bitset_1[2] = +{ + "MULTIPOLYGON(((2 10,2 8,0 8,0 10,2 10)),((10 8,10 2,8 2,8 0,0 0,0 4,2 4,2 8,4 8,4 10,6 10,6 8,6 6,8 6,8 8,10 8),(8 2,8 4,4 4,4 2,8 2)))", + "MULTIPOLYGON(((2 6,2 4,2 2,2 0,0 0,0 6,2 6)),((2 10,2 8,0 8,0 10,2 10)),((6 8,6 6,2 6,2 8,6 8)),((8 4,8 2,6 2,6 4,8 4)),((10 8,10 6,8 6,8 8,10 8)),((8 10,8 8,6 8,6 10,8 10)))" +}; + +static std::string case_bitset_2[3] = +{ + // (The last one is an invalid version of the first one) + "MULTIPOLYGON(((12 2,12 0,6 0,6 2,8 2,8 4,10 4,10 8,12 8,12 6,14 6,14 2,12 2)),((4 2,4 0,0 0,0 2,2 2,2 4,0 4,0 10,2 10,2 14,6 14,6 12,8 12,8 14,10 14,10 12,12 12,12 10,8 10,8 8,8 6,4 6,4 4,6 4,6 2,4 2),(4 8,2 8,2 6,4 6,4 8),(6 8,6 10,4 10,4 8,6 8)),((14 10,14 8,12 8,12 10,14 10)),((12 12,12 14,14 14,14 12,12 12)))", + "MULTIPOLYGON(((6 2,6 0,0 0,0 2,2 2,2 4,4 4,4 2,6 2)),((10 2,10 0,8 0,8 2,10 2)),((14 4,14 2,12 2,12 4,14 4)))", + "MULTIPOLYGON(((14 10,14 8,12 8,12 6,14 6,14 2,12 2,12 0,6 0,6 2,4 2,4 0,0 0,0 2,2 2,2 4,0 4,0 10,2 10,2 14,6 14,6 12,8 12,8 14,10 14,10 12,12 12,12 10,14 10),(12 10,8 10,8 8,8 6,4 6,4 4,6 4,6 2,8 2,8 4,10 4,10 8,12 8,12 10),(4 6,4 8,2 8,2 6,4 6),(4 8,6 8,6 10,4 10,4 8)),((14 12,12 12,12 14,14 14,14 12)))" +}; + +// Generates an extra interior ring, outside the main polygon. +// Must be caused by assign_parents - the generation itself is correct. +// It happens both in the traversal algorithm, and in the new traverse_through_graph algorithm. +static std::string case_bitset_3[2] = +{ + "MULTIPOLYGON(((4 0,4 2,8 2,10 2,10 0,4 0)),((0 2,0 4,2 4,2 2,0 2)),((10 4,8 4,8 6,6 6,6 8,4 8,4 10,8 10,10 10,10 4)))", + "MULTIPOLYGON(((10 10,10 8,8 8,8 2,6 2,4 2,4 4,2 4,0 4,0 10,10 10),(4 8,2 8,2 6,4 6,4 8)))" +}; + static std::string pie_21_7_21_0_3[2] = { "MULTIPOLYGON(((2500 2500,2500 3875,2855 3828,3187 3690,3472 3472,3690 3187,3828 2855,3875 2500,3828 2144,3690 1812,3472 1527,3187 1309,2855 1171,2499 1125,2144 1171,1812 1309,1527 1527,1309 1812,1171 2144,1125 2499,1171 2855,1309 3187,2500 2500)))", @@ -1528,6 +1842,13 @@ static std::string issue_869_a[2] = "MULTIPOLYGON(((50 50,50 70,70 70,70 50,50 50)),((50 50,50 30,30 30,30 50,50 50)))" }; +// To use intersection for difference research (made valid in tests) +static std::string issue_869_a_inverse[2] = +{ + "MULTIPOLYGON(((70 50,70 10,10 10,10 70,50 70,50 90,70 90,70 70,90 70,90 50,70 50)))", + "MULTIPOLYGON(((0 0,0 100,100 100,100 0,0 0),(50 50,50 70,70 70,70 50,50 50),(50 50,50 30,30 30,30 50,50 50)))" +}; + // For union static std::string issue_869_b[2] = { @@ -1580,12 +1901,24 @@ static std::string issue_1109[2] = "MULTIPOLYGON(((0 -88,0 -115.40000152587890625,-10 -88,0 -88)))" }; +static std::string issue_1221[2] = +{ + "MULTIPOLYGON(((1 2,1 3,0 3,0 4,1 4,1 5,3 5,3 0,0 0,0 2,1 2),(1 2,1 1,2 1,2 2,1 2)))", + "POLYGON((1 3,1 4,2 4,2 3,1 3))" +}; + static std::string issue_1222[2] = { "MULTIPOLYGON(((2 4,2 2,0 2,0 4,2 4)),((6 4,4 4,2 4,2 6,0 6,0 10,6 10,6 4)))", "MULTIPOLYGON(((4 4,4 2,2 2,2 4,4 4)),((4 8,4 6,2 6,2 8,4 8)))" }; +static std::string issue_1241[2] = +{ + "POLYGON((-124.19999999845255 51.901455507812500, -124.19999999460376 51.935823093966235, -123.99999999648789 51.935823093966235, -123.99999999317222 51.902564290309876, -124.19999999845255 51.901455507812500))", + "POLYGON((-123.99999999367975 51.907655109375000, -123.99999999291659 51.900000006653443, -124.19999999861555 51.900000005468293, -124.19999999792353 51.906179355468751, -123.99999999367975 51.907655109375000))" +}; + static std::string issue_1288[3] = { // Issue with differences in behaviour for multi polygon vs polygon @@ -1594,18 +1927,37 @@ static std::string issue_1288[3] = "POLYGON((-0.5 -1.49999999, -2.0 -0.1, -1.99999999 -1.5))" }; -static std::string bug_21155501[2] = - { - "MULTIPOLYGON(((-8.3935546875 27.449790329784214,4.9658203125 18.729501999072138,11.8212890625 23.563987128451217,9.7119140625 25.48295117535531,9.8876953125 31.728167146023935,8.3056640625 32.99023555965106,8.5693359375 37.16031654673677,-1.8896484375 35.60371874069731,-0.5712890625 32.02670629333614,-8.9208984375 29.458731185355344,-8.3935546875 27.449790329784214)))", - "MULTIPOLYGON(((4.9658203125 18.729501999072138,-3.4868710311820115 24.246968623627644,8.3589904332912 33.833614418115445,8.3056640625 32.99023555965106,9.8876953125 31.728167146023935,9.7119140625 25.48295117535531,11.8212890625 23.563987128451217,4.9658203125 18.729501999072138)),((-3.88714525609152 24.508246314579743,-8.3935546875 27.449790329784214,-8.9208984375 29.458731185355344,-0.5712890625 32.02670629333614,-1.8896484375 35.60371874069731,8.5693359375 37.16031654673677,8.362166569827938 33.883846345901595,-3.88714525609152 24.508246314579743)))", - }; - static std::string issue_1299[2] = { "MULTIPOLYGON(((1.2549999979079400 0.85000000411847698, -1.2550000020920500 0.84999999897038103, -1.2549999999999999 -0.85000000102961903, 1.2549999999999999 -0.84999999999999998)))", "MULTIPOLYGON(((-0.87500000000000000 -0.84999999999999998, -0.87500000000000000 -0.070000000000000201, -1.2549999999999999 -0.070000000000000201, -1.2549999999999999 -0.84999999999999998)))" }; +static std::string issue_1349[2] = +{ + "MULTIPOLYGON(((0 0,0 1178,2002 1178,2002 0,0 0),(1000.99879999999996 124.985299999999995,1011.01279999999997 134.999300000000005,1011.01400000000001 325.002599999999973,1001 335.016599999999983,990.98599999999999 325.002599999999973,990.98479999999995 134.999300000000005,1000.99879999999996 124.985299999999995)))", + "MULTIPOLYGON(((1592.0101999999999407 1149.8399999999999181, 1586.9901999999999589 1149.8399999999999181, 1586.9901999999999589 1178.0000000000000000, 1592.0101999999999407 1178.0000000000000000, 1592.0101999999999407 1149.8399999999999181)), ((2001.9988000000000739 230.0014999999999930, 2001.9988000000000739 0.0015000000000000, 1000.9238000000000284 0.0000000000000000, 1000.9238000000000284 230.0765000000000100, 2001.9988000000000739 230.0014999999999930)))" +}; + +// To use intersection for difference research (made valid in tests) +static std::string issue_1349_inverse[2] = +{ + "MULTIPOLYGON(((0 0,0 1178,2002 1178,2002 0,0 0),(1000.99879999999996 124.985299999999995,1011.01279999999997 134.999300000000005,1011.01400000000001 325.002599999999973,1001 335.016599999999983,990.98599999999999 325.002599999999973,990.98479999999995 134.999300000000005,1000.99879999999996 124.985299999999995)))", + "MULTIPOLYGON(((-1000 -1000,-1000 3000,3000 3000,3000 -1000,-1000 -1000),(1592.0101999999999407 1149.8399999999999181, 1586.9901999999999589 1149.8399999999999181, 1586.9901999999999589 1178.0000000000000000, 1592.0101999999999407 1178.0000000000000000, 1592.0101999999999407 1149.8399999999999181),(2001.9988000000000739 230.0014999999999930, 2001.9988000000000739 0.0015000000000000, 1000.9238000000000284 0.0000000000000000, 1000.9238000000000284 230.0765000000000100, 2001.9988000000000739 230.0014999999999930)))" +}; + +static std::string issue_1354[2] = +{ + "MULTIPOLYGON(((295.199999999999989 -295.199999999999989,295.199999999999989 295.199999999999989,-295.199999999999989 295.199999999999989,-295.199999999999989 -295.199999999999989,295.199999999999989 -295.199999999999989),(-179.997681584096682 -159.068022953381728,-179.997941555125578 -158.950077048237887,-180 -158.832148820362704,-180 -14.5241121286848625,-179.998787156680379 -14.4546283814396119,-179.999195199119924 -14.3851352478099308,-179.995132365653177 -14.2452455437218966,-179.992689924229154 -14.1053181682548523,-179.989052871933012 -14.0359190762519734,-179.987035390416196 -13.9664540354863789,-179.978092951651348 -13.8267913392705939,-179.970768603117904 -13.6870344437553584,-179.96471177303323 -13.6178045590987882,-179.960271225550514 -13.5484522436487858,-179.899302518930739 -12.8010583222347041,-179.862001646775752 -12.4192286301278614,-179.812514069087342 -12.0387864551623842,-179.756717919995367 -11.6575893141408002,-179.69354553378804 -11.2702990769800557,-179.617743949785876 -10.8852814175903685,-179.449050736785438 -10.0966985448598905,-179.370713374286112 -9.75497969251792263,-179.282427103876586 -9.41569507620525137,-179.18426728065765 -9.07913428598321026,-178.935424198586816 -8.27008653807789607,-178.812412221610401 -7.89249729706248626,-178.67697357776251 -7.51918515533267851,-178.52206744438692 -7.11329246102736157,-178.372718942212316 -6.74078412878685995,-178.210997411857903 -6.37347828985937515,-177.83796586524096 -5.56325522558086671,-177.683643331306087 -5.24079944287654875,-177.519784336166936 -4.92308352260890025,-177.346534296916872 -4.61038942260158002,-176.888642811189385 -3.8122348268109878,-176.682925174829364 -3.46716074752500347,-176.4657719066781 -3.12916618508967126,-176.203261097574938 -2.73523344331954199,-175.97364845346371 -2.40292746742542196,-175.732982121071331 -2.078537355980135,-175.143129804051284 -1.310831533374758,-174.920901565835123 -1.03035395323309942,-174.690409107515819 -0.756627283942919782,-174.451857396213086 -0.489894938965182547,-173.780108917183412 0.239037812837519681,-173.533488205359163 0.498765442860035435,-173.279226152669509 0.751017352386726955,-173.017549264610096 0.995568826627545533,-172.318055071282714 1.62999550300293983,-172.067822666567167 1.85068903895734671,-171.811551390238662 2.06434045156852441,-171.549439357600335 2.27078457361611186,-171.281689199261223 2.46986180961050472,-171.031950157793972 2.65021087534550936,-170.768065071279523 2.835433324854856,-170.499299340935181 3.01349982052276921,-170.225846968387685 3.18428182963124229,-169.947905338195852 3.34765607758145833,-169.680262243237394 3.50017672557883053,-169.398031980415396 3.65602528487362832,-169.111716805616084 3.80423566024079918,-168.821523388081118 3.94470086983453072,-168.527661196461878 4.07731952245764262,-168.245202320314831 4.20025185193289374,-167.947883471472693 4.32492822022349799,-167.64732257736847 4.44157230975317141,-167.343736590149689 4.55009992398729324,-167.037344645549581 4.6504327250600852,-166.743329216418374 4.74235824805159822,-166.434352475578294 4.83442381331231275,-166.123013965408205 4.91815568760162414,-165.809538417600521 4.99349343122062095,-165.494152106413281 5.06038266355761301,-165.191972700917376 5.12024067253396975,-164.874903279844006 5.17863311131773951,-164.556379617287462 5.2284866074688674,-164.23663163135754 5.26976517552396029,-163.915890123910316 5.3024390196108131,-163.609033520920434 5.32953882673178825,-163.287530010959983 5.35358436207679489,-162.965496567522251 5.36898423202898734,-162.643165642162018 5.375727320588501,-162.320769901163743 5.37380876043037148,-162.012776848660081 5.36783766723553946,-161.690549005093743 5.35725884322304502,-161.368721650836875 5.33802739140809557,-161.047527088684063 5.31015719351933235,-160.727197164665256 5.27366836694196373,-160.421621523858249 5.23469527250653854,-160.102387459886472 5.18961415576110952,-159.784479686856571 5.13597328949175136,-159.468127678314318 5.07381139297753059,-159.153559784816935 5.00317333618393612,-158.853927522957889 4.93164794210813451,-158.541370807245158 4.85258471329888774,-158.231050880339666 4.7651533822312695,-157.923191738695721 4.66941705896188797,-157.618015602513111 4.56544484829227759,-157.327784107566345 4.46219246969767802,-157.025511260386196 4.35005942129268952,-156.726359890085519 4.22984647550804382,-156.430545931383392 4.1016404049654156,-156.138282909974265 3.96553375191790813,-155.860801096610373 3.83174579432549756,-155.572299975036202 3.68783680385857515,-155.287769000407764 3.53622935297387997,-155.007413554087719 3.37703287560877818,-154.731436003441075 3.21036228364411969,-154.46990567067823 3.04758249561918326,-154.198505222998278 2.87355809593285194,-153.931877781715087 2.69230550356012799,-153.670215804986441 2.50395555102093859,-153.413708166777326 2.30864419388203324,-153.171147053156858 2.11875085407343189,-152.87864945418977 1.88227751953715927,-152.593706706865078 1.63675335759936136,-152.316598756515816 1.38241958634308926,-152.047597851087176 1.11952607895504297,-151.758492641328019 0.827987423984159143,-151.497863063903992 0.556792463263721338,-151.245860873059797 0.277562487870442354,-151.002733651293767 -0.00942816944216584574,-150.768720261787024 -0.303897551347931838,-150.580866676220865 -0.54804178071738896,-150.387712159765329 -0.806177457173726353,-150.201562005690334 -1.06940894241931783,-150.022550581694702 -1.33754622957983571,-149.850807102568638 -1.61039577065407258,-149.690225111389282 -1.87328129413026989,-149.633025334764199 -1.97070420726289952,-149.574266655031067 -2.06719491150401513,-149.526997232690093 -2.15129174077182661,-149.478152856477351 -2.23448369888000897,-149.424387935046411 -2.33384350802175922)))", + "MULTIPOLYGON(((-161.64096882920154 -24.7006892825620064,-161.289685158351034 -24.4725629993453921,-160.946576972490334 -24.2323160611842638,-160.612062296092091 -23.9802411719655595,-160.286548683761538 -23.7166454461126293,-159.970432723693705 -23.4418500344136262,-159.664099554492026 -23.1561897327487074,-159.367922395936176 -22.8600125741928615,-159.082262094271272 -22.5536794049911933,-158.807466682572255 -22.2375634449233637,-158.543870956719331 -21.9120498325927926,-158.291796067500627 -21.5775351561945712,-158.051549129339492 -21.2344269703338533,-157.823422846122895 -20.8831432994833506,-157.607695154586736 -20.5241121286848909,-157.404628885692887 -20.1577708821155781,-157.21447144440998 -19.7845658901538215,-157.037454508288789 -19.4049518455944927,-156.873793745198554 -19.0193912496758344,-156.723688550569108 -18.6283538485929157,-156.587321804458156 -18.2323160611842603,-156.464859648740173 -17.8317603984888819,-156.356451284688035 -17.4271748758809046,-156.262228791194332 -17.0190524184980028,-156.182306963853506 -16.6078902606880554,-156.116783175101148 -16.1941893402056749,-156.065737255580729 -15.7784536878967323,-156.029231396882096 -15.361189813614395,-156.007310075770846 -14.9429060891149028,-156 -14.5241121286848909,-156 -0.659861765609321083,-156 -0.659861765609321083,-156.007310075770874 -0.24106780517901305,-156.029231396882125 0.177215919320473647,-156.065737255580757 0.594479793602806117,-156.116783175101205 1.01021544591174406,-156.182306963853563 1.42391636639411612,-156.262228791194389 1.8350785242040577,-156.35645128468812 2.24320098158695203,-156.464859648740259 2.64778650419492223,-156.587321804458242 3.04834216689029436,-156.723688550569193 3.44437995429894173,-156.87379374519864 3.83541735538185424,-157.037454508288874 4.22097795130050457,-157.214471444410094 4.6005919958598227,-157.404628885693 4.97379698782157575,-157.60769515458685 5.34013823439087876,-157.823422846123009 5.69916940518932957,-158.051549129339634 6.0504530760398243,-158.291796067500769 6.39356126190053153,-158.543870956719473 6.72807593829874495,-158.807466682572397 7.05358955062930804,-159.082262094271414 7.36970551069712698,-159.367922395936318 7.67603867989878808,-159.664099554492168 7.97221583845462689,-159.970432723693847 8.25787614011953508,-160.28654868376168 8.53267155181853276,-160.612062296092233 8.79626727767145233,-160.946576972490448 9.04834216689014958,-161.289685158351176 9.28858910505127255,-161.640968829201682 9.51671538826787611,-162.000000000000142 9.73244307980402112,-162.366341246569448 9.93550934869787383,-162.739546238531204 10.1256667899807482,-163.119160283090537 10.3026837261019484,-163.504720879009199 10.4663444891921795,-163.89575828009211 10.6164496838216245,-164.291796067500741 10.7528164299325617,-164.692351730196123 10.8752785856505412,-165.096937252804111 10.9836869497026655,-165.505059710186998 11.0779094431963721,-165.916221867996938 11.1578312705371943,-166.329922788479308 11.2233550592895384,-166.745658440788247 11.2744009788099682,-167.162922315070603 11.3109068375085773,-167.581206039570077 11.3328281586198312,-168.000000000000085 11.3401382343906789,-168.418793960430094 11.3328281586198258,-168.837077684929568 11.3109068375085648,-169.254341559211923 11.2744009788099522,-169.670077211520862 11.2233550592895135,-170.083778132003232 11.1578312705371641,-170.494940289813172 11.077909443196333,-170.90306274719606 10.9836869497026228,-171.307648269804048 10.8752785856504914,-171.708203932499401 10.7528164299325084,-172.10424171990806 10.6164496838215658,-172.495279120990972 10.4663444891921138,-172.880839716909634 10.3026837261018773,-173.260453761468966 10.1256667899806718,-173.633658753430694 9.93550934869779212,-174 9.73244307980393408,-174.35903117079846 9.51671538826778551,-174.710314841648966 9.28858910505117663,-175.053423027509666 9.04834216689004656,-175.387937703907909 8.79626727767134398,-175.713451316238462 8.53267155181842085,-176.029567276306295 8.25787614011941784,-176.335900445507946 7.97221583845450077,-176.632077604063795 7.67603867989865307,-176.917737905728728 7.36970551069698487,-177.192533317427717 7.05358955062915793,-177.456129043280669 6.72807593829858508,-177.708203932499373 6.39356126190036278,-177.948450870660508 6.05045307603964844,-178.176577153877105 5.69916940518914394,-178.392304845413264 5.34013823439068602,-178.595371114307113 4.97379698782137414,-178.785528555589991 4.60059199585961309,-178.962545491711211 4.22097795130028608,-179.126206254801446 3.83541735538162776,-179.276311449430892 3.44437995429870725,-179.412678195541844 3.04834216689005189,-179.535140351259827 2.64778650419467221,-179.643548715311965 2.24320098158669401,-179.737771208805668 1.83507852420379303,-179.817693036146494 1.42391636639384433,-179.883216824898852 1.01021544591146517,-179.934262744419271 0.59447979360252079,-179.970768603117904 0.177215919320182214,-179.992689924229154 -0.241067805179310257,-180 -0.659861765609321083,-180 -14.5241121286848909,-179.992689924229154 -14.942906089114862,-179.970768603117904 -15.3611898136143541,-179.9342627444193 -15.7784536878966932,-179.883216824898852 -16.1941893402056394,-179.817693036146494 -16.6078902606880163,-179.737771208805668 -17.0190524184979672,-179.643548715311965 -17.4271748758808691,-179.535140351259827 -17.8317603984888464,-179.412678195541844 -18.2323160611842248,-179.276311449430921 -18.6283538485928801,-179.126206254801474 -19.0193912496758024,-178.962545491711239 -19.4049518455944607,-178.78552855559002 -19.7845658901537895,-178.595371114307142 -20.1577708821155497,-178.392304845413292 -20.5241121286848625,-178.176577153877133 -20.8831432994833222,-177.948450870660508 -21.2344269703338284,-177.708203932499373 -21.5775351561945428,-177.456129043280669 -21.9120498325927642,-177.192533317427745 -22.2375634449233388,-176.917737905728757 -22.5536794049911684,-176.632077604063824 -22.8600125741928366,-176.335900445507974 -23.1561897327486861,-176.029567276306324 -23.4418500344136049,-175.713451316238491 -23.7166454461126079,-175.387937703907909 -23.9802411719655382,-175.053423027509695 -24.2323160611842425,-174.710314841648994 -24.4725629993453779,-174.359031170798488 -24.7006892825619886,-174.000000000000028 -24.9164169740981407,-173.633658753430723 -25.1194832429920041,-173.260453761468938 -25.3096406842748856,-172.880839716909634 -25.4866576203960911,-172.495279120990972 -25.6503183834863329,-172.104241719908032 -25.8004235781157831,-171.708203932499401 -25.9367903242267275,-171.307648269804019 -26.0592524799447105,-170.903062747196032 -26.1676608439968419,-170.494940289813144 -26.2618833374905556,-170.083778132003175 -26.3418051648313849,-169.670077211520805 -26.4073289535837326,-169.254341559211866 -26.4583748731041695,-168.837077684929511 -26.4948807318027804,-168.418793960430037 -26.5168020529140378,-168.000000000000028 -26.5241121286848909,-167.581206039569992 -26.5168020529140378,-167.162922315070517 -26.4948807318027804,-166.745658440788162 -26.4583748731041695,-166.329922788479223 -26.4073289535837361,-165.916221867996853 -26.341805164831392,-165.505059710186913 -26.2618833374905591,-165.096937252803997 -26.167660843996849,-164.692351730196009 -26.0592524799447212,-164.291796067500627 -25.9367903242267381,-163.895758280091997 -25.8004235781157938,-163.504720879009056 -25.6503183834863435,-163.119160283090395 -25.4866576203961053,-162.739546238531091 -25.3096406842748962,-162.366341246569306 -25.1194832429920183,-162 -24.9164169740981585,-161.64096882920154 -24.7006892825620064)))" +}; + +static std::string bug_21155501[2] = + { + "MULTIPOLYGON(((-8.3935546875 27.449790329784214,4.9658203125 18.729501999072138,11.8212890625 23.563987128451217,9.7119140625 25.48295117535531,9.8876953125 31.728167146023935,8.3056640625 32.99023555965106,8.5693359375 37.16031654673677,-1.8896484375 35.60371874069731,-0.5712890625 32.02670629333614,-8.9208984375 29.458731185355344,-8.3935546875 27.449790329784214)))", + "MULTIPOLYGON(((4.9658203125 18.729501999072138,-3.4868710311820115 24.246968623627644,8.3589904332912 33.833614418115445,8.3056640625 32.99023555965106,9.8876953125 31.728167146023935,9.7119140625 25.48295117535531,11.8212890625 23.563987128451217,4.9658203125 18.729501999072138)),((-3.88714525609152 24.508246314579743,-8.3935546875 27.449790329784214,-8.9208984375 29.458731185355344,-0.5712890625 32.02670629333614,-1.8896484375 35.60371874069731,8.5693359375 37.16031654673677,8.362166569827938 33.883846345901595,-3.88714525609152 24.508246314579743)))", + }; + static std::string mysql_21965285_b[2] = { "MULTIPOLYGON(((3 0, -19 -19, -7 3, -2 10, 15 0, 3 0)))", diff --git a/test/algorithms/overlay/overlay.cpp b/test/algorithms/overlay/overlay.cpp index 9a51a7cf3..dd7b76064 100644 --- a/test/algorithms/overlay/overlay.cpp +++ b/test/algorithms/overlay/overlay.cpp @@ -1,7 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // Unit Test -// Copyright (c) 2015 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2015-2024 Barend Gehrels, Amsterdam, the Netherlands. // This file was modified by Oracle on 2017-2024. // Modifications copyright (c) 2017-2024, Oracle and/or its affiliates. @@ -12,6 +12,9 @@ // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) +#if defined(TEST_WITH_GEOJSON) +#define BOOST_GEOMETRY_DEBUG_SEGMENT_IDENTIFIER +#endif #include #include @@ -25,314 +28,89 @@ #include #include #include +#include #include #include +#include -#if defined(TEST_WITH_SVG) -# include +#if defined(TEST_WITH_GEOJSON) +#include #endif #include "multi_overlay_cases.hpp" -#if defined(TEST_WITH_SVG) -template -struct map_visitor +#if defined(TEST_WITH_GEOJSON) +struct geojson_visitor : public boost::geometry::detail::overlay::overlay_null_visitor { - map_visitor(Mapper& mapper) - : m_mapper(mapper) - , m_traverse_seq(0) - , m_do_output(true) + geojson_visitor(boost::geometry::geojson_writer& writer) + : m_writer(writer) {} - void print(char const* header) - {} - - template - void print(char const* header, Turns const& turns, int turn_index) - { - std::string style = "fill:rgb(0,0,0);font-family:Arial;font-size:6px"; - stream(turns, turns[turn_index], turns[turn_index].operations[0], header, style); - } - - template - void print(char const* header, Turns const& turns, int turn_index, int op_index) - { - std::string style = "fill:rgb(0,0,0);font-family:Arial;font-size:6px"; - stream(turns, turns[turn_index], turns[turn_index].operations[op_index], header, style); - } - template void visit_turns(int phase, Turns const& turns) { - int index = 0; - for (auto const& turn : turns) - { - switch (phase) - { - case 1 : - m_mapper.map(turn.point, "fill:rgb(255,128,0);" - "stroke:rgb(0,0,0);stroke-width:1", 3); - break; - case 11 : - m_mapper.map(turn.point, "fill:rgb(92,255,0);" // Greenish - "stroke:rgb(0,0,0);stroke-width:1", 3); - break; - case 21 : - m_mapper.map(turn.point, "fill:rgb(0,128,255);" // Blueish - "stroke:rgb(0,0,0);stroke-width:1", 3); - break; - case 3 : - label_turn(index, turn); - break; - } - index++; - } - } - - template - std::string stream_turn_index(Turns const& turns, Turn const& turn, Operation const& op) - { - std::ostringstream out; - - if (turn.cluster_id >= 0) - { - out << "cl=" << turn.cluster_id << " "; - } - - // Because turn index is unknown here, and still useful for debugging, - std::size_t index = 0; - for (typename Turns::const_iterator it = turns.begin(); - it != turns.end(); ++it, ++index) - { - Turn const& t = *it; - if (&t == &turn) - { - out << index; - break; - } - } - - if (&op == &turn.operations[0]) { out << "[0]"; } - if (&op == &turn.operations[1]) { out << "[1]"; } - return out.str(); - } - - template - void visit_clusters(Clusters const& clusters, Turns const& turns) - { - int index = 0; - for (auto const& turn : turns) - { - if (turn.cluster_id >= 0) - { - std::cout << " TURN: " << index << " part of cluster " << turn.cluster_id << std::endl; - } - index++; - } - - for (typename Clusters::const_iterator it = clusters.begin(); it != clusters.end(); ++it) - { - std::cout << " CLUSTER " << it->first << ": "; - for (typename std::set::const_iterator sit - = it->second.turn_indices.begin(); - sit != it->second.turn_indices.end(); ++sit) - { - std::cout << " " << *sit; - } - std::cout << std::endl; - } - - std::cout << std::endl; - - } - - template - void visit_traverse(Turns const& turns, Turn const& turn, Operation const& op, const std::string& header) - { - if (! m_do_output) + if (phase != 3) { return; } - std::cout << "Visit turn " << stream_turn_index(turns, turn, op) - << " " << bg::operation_char(turn.operations[0].operation) - << bg::operation_char(turn.operations[1].operation) - << " (" << bg::operation_char(op.operation) << ")" - << " " << header << std::endl; - - // Uncomment for more detailed debug info in SVG on traversal - std::string style - = header == "Visit" ? "fill:rgb(80,80,80)" : "fill:rgb(0,0,0)"; - - style += ";font-family:Arial;font-size:6px"; - - stream(turns, turn, op, header.substr(0, 1), style); - } - - template - void visit_traverse_reject(Turns const& turns, Turn const& turn, Operation const& op, - bg::detail::overlay::traverse_error_type error) - { - if (! m_do_output) + for (auto const& enumerated : boost::geometry::util::enumerate(turns)) { - return; - } - std::cout << "Reject turn " << stream_turn_index(turns, turn, op) - << bg::operation_char(turn.operations[0].operation) - << bg::operation_char(turn.operations[1].operation) - << " (" << bg::operation_char(op.operation) << ")" - << " " << bg::detail::overlay::traverse_error_string(error) << std::endl; - //return; - - std::string style = "fill:rgb(255,0,0);font-family:Arial;font-size:7px"; - stream(turns, turn, op, bg::detail::overlay::traverse_error_string(error), style); - - m_do_output = false; - } - - template - void visit_traverse_select_turn_from_cluster(Turns const& turns, Turn const& turn, Operation const& op) - { - std::cout << "Visit turn from cluster " << stream_turn_index(turns, turn, op) - << " " << bg::operation_char(turn.operations[0].operation) - << bg::operation_char(turn.operations[1].operation) - << " (" << bg::operation_char(op.operation) << ")" - << std::endl; - return; - } - - template - void stream(Turns const& turns, Turn const& turn, Operation const& op, const std::string& header, const std::string& style) - { - std::ostringstream out; - out << m_traverse_seq++ << " " << header - << " " << stream_turn_index(turns, turn, op); - - out << " " << bg::visited_char(op.visited); - - add_text(turn, out.str(), style); - } - - template - bool label_operation(Turn const& turn, int index, std::ostream& os) - { - os << bg::operation_char(turn.operations[index].operation); - bool result = false; - if (! turn.discarded) - { - if (turn.operations[index].enriched.next_ip_index != -1) + auto index = enumerated.index; + auto const& turn = enumerated.value; + auto label_enriched = [&turn](int i) { - os << "->" << turn.operations[index].enriched.next_ip_index; - if (turn.operations[index].enriched.next_ip_index != -1) - { - result = true; - } - } - else + auto const& op = turn.operations[i].enriched; + std::ostringstream out; + out //<< " l:" << op.count_left << " r:" << op.count_right + //<< " rank:" << op.rank + // << " z:" << op.zone + << " region:" << op.region_id + << (op.isolated ? " ISOLATED" : ""); + return out.str(); + }; + auto label_operation_ids = [&turn](int op_index) { - os << "->" << turn.operations[index].enriched.travels_to_ip_index; - if (turn.operations[index].enriched.travels_to_ip_index != -1) - { - result = true; - } - } - - os << " {" << turn.operations[index].enriched.region_id - << (turn.operations[index].enriched.isolated ? " ISO" : "") - << "}"; - - if (! turn.operations[index].enriched.startable) + std::ostringstream out; + out << bg::operation_char(turn.operations[op_index].operation) + << ": " << turn.operations[op_index].seg_id + << " " << turn.operations[op_index].enriched.next_ip_index + << "|" << turn.operations[op_index].enriched.travels_to_ip_index; + return out.str(); + }; + auto label_operations = [&turn]() { - os << "$"; - } + std::ostringstream out; + out << bg::operation_char(turn.operations[0].operation) + << bg::operation_char(turn.operations[1].operation); + return out.str(); + }; + auto label_travel = [&turn]() + { + std::ostringstream out; + out << turn.operations[0].enriched.travels_to_ip_index + << "|" << turn.operations[1].enriched.travels_to_ip_index; + return out.str(); + }; + + m_writer.feature(turn.point); + m_writer.add_property("index", index); + m_writer.add_property("method", bg::method_char(turn.method)); + m_writer.add_property("operations", label_operations()); + m_writer.add_property("travels_to", label_travel()); + m_writer.add_property("cluster_id", turn.cluster_id); + m_writer.add_property("discarded", turn.discarded); + m_writer.add_property("has_colocated_both", turn.has_colocated_both); + m_writer.add_property("self_turn", bg::detail::overlay::is_self_turn(turn)); + m_writer.add_property("operation_0", label_operation_ids(0)); + m_writer.add_property("operation_1", label_operation_ids(1)); + m_writer.add_property("enriched_0", label_enriched(0)); + m_writer.add_property("enriched_1", label_enriched(1)); } - - return result; } - template - void label_turn(int index, Turn const& turn) - { - std::ostringstream out; - out << index << " "; - if (turn.cluster_id != -1) - { - out << " c=" << turn.cluster_id << " "; - } - bool lab1 = label_operation(turn, 0, out); - out << " / "; - bool lab2 = label_operation(turn, 1, out); - if (turn.discarded) - { - out << "!"; - } - if (turn.has_colocated_both) - { - out << "+"; - } - bool const self_turn = bg::detail::overlay::is_self_turn(turn); - if (self_turn) - { - out << "@"; - } - - std::string font8 = "font-family:Arial;font-size:6px"; - std::string font6 = "font-family:Arial;font-size:4px"; - std::string style = "fill:rgb(0,0,255);" + font8; - if (self_turn) - { - if (turn.discarded) - { - style = "fill:rgb(128,28,128);" + font6; - } - else - { - style = "fill:rgb(255,0,255);" + font8; - } - } - else if (turn.discarded) - { - style = "fill:rgb(92,92,92);" + font6; - } - else if (turn.cluster_id != -1) - { - style = "fill:rgb(0,0,255);" + font8; - } - else if (! lab1 || ! lab2) - { - style = "fill:rgb(0,0,255);" + font6; - } - - add_text(turn, out.str(), style); - } - - template - void add_text(Turn const& turn, std::string const& text, std::string const& style) - { - int const margin = 5; - int const lineheight = 6; - double const half = 0.5; - double const ten = 10; - - // Map characteristics - // Create a rounded off point - std::pair p - = std::make_pair( - util::numeric_cast(half - + ten * bg::get<0>(turn.point)), - util::numeric_cast(half - + ten * bg::get<1>(turn.point)) - ); - m_mapper.text(turn.point, text, style, margin, m_offsets[p], lineheight); - m_offsets[p] += lineheight; - } - - - Mapper& m_mapper; - std::map, int> m_offsets; - int m_traverse_seq; - bool m_do_output; + boost::geometry::geojson_writer& m_writer; }; #endif @@ -350,35 +128,22 @@ void test_overlay(std::string const& caseid, Geometry g2; bg::read_wkt(wkt2, g2); - // Reverse if necessary bg::correct(g1); bg::correct(g2); -#if defined(TEST_WITH_SVG) - bool const ccw = bg::point_order::value == bg::counterclockwise; - bool const open = bg::closure::value == bg::open; - +#if defined(TEST_WITH_GEOJSON) std::ostringstream filename; - filename << "overlay" - << "_" << caseid - << "_" << string_from_type::type>::name() - << (ccw ? "_ccw" : "") - << (open ? "_open" : "") - << ".svg"; + // For QGis, it is usually convenient to always write to the same geojson file. + filename << "/tmp/" + // << caseid << "_" + << "overlay.geojson"; + std::ofstream geojson_file(filename.str().c_str()); - std::ofstream svg(filename.str().c_str()); - - using svg_mapper = bg::svg_mapper::type>; - - svg_mapper mapper(svg, 500, 500); - mapper.add(g1); - mapper.add(g2); - - // Input shapes in green (src=0) / blue (src=1) - mapper.map(g1, "fill-opacity:0.5;fill:rgb(153,204,0);" - "stroke:rgb(153,204,0);stroke-width:3"); - mapper.map(g2, "fill-opacity:0.3;fill:rgb(51,51,153);" - "stroke:rgb(51,51,153);stroke-width:3"); + boost::geometry::geojson_writer writer(geojson_file); + writer.feature(g1); + writer.add_property("type", "input1"); + writer.feature(g2); + writer.add_property("type", "input2"); #endif @@ -402,15 +167,14 @@ void test_overlay(std::string const& caseid, strategy_type strategy; -#if defined(TEST_WITH_SVG) - map_visitor visitor(mapper); +#if defined(TEST_WITH_GEOJSON) + geojson_visitor visitor(writer); #else bg::detail::overlay::overlay_null_visitor visitor; #endif Geometry result; - overlay::apply(g1, g2, std::back_inserter(result), - strategy, visitor); + overlay::apply(g1, g2, std::back_inserter(result), strategy, visitor); std::string message; bool const valid = check_validity::apply(result, caseid, g1, g2, message); @@ -428,10 +192,24 @@ void test_overlay(std::string const& caseid, << " clip count: detected: " << result.size() << " expected: " << expected_clip_count); -#if defined(TEST_WITH_SVG) - mapper.map(result, "fill-opacity:0.2;stroke-opacity:0.4;fill:rgb(255,0,0);" - "stroke:rgb(255,0,255);stroke-width:8"); +#if defined(TEST_WITH_GEOJSON) + std::size_t result_index = 0; + for (auto const& p : result) + { + writer.feature(p); + writer.add_property("type", "result"); + writer.add_property("index", result_index++); + } + for (auto const& p : result) + { + for (const auto& ring : bg::interior_rings(p)) + { + writer.feature(ring); + writer.add_property("type", "hole"); + writer.add_property("index", result_index++); + } + } #endif } diff --git a/test/algorithms/overlay/overlay_cases.hpp b/test/algorithms/overlay/overlay_cases.hpp index 7a896eca9..95b989ce3 100644 --- a/test/algorithms/overlay/overlay_cases.hpp +++ b/test/algorithms/overlay/overlay_cases.hpp @@ -1182,13 +1182,20 @@ static std::string issue_1186[2] = "POLYGON((-13848.1446527556 6710443.1496919869,-13848.2559722463 6710440.2884572418,-13847.8106942832 6710440.1096301023,-13847.6993747924 6710443.1496919869,-13847.3654163201 6710442.9708647905,-13846.0295824308 6710442.9708647905,-13846.4748603939 6710435.1024718173,-13847.8106942832 6710435.1024718173,-13848.1446527556 6710435.1024718173,-13849.8144451172 6710443.1496919869,-13848.1446527556 6710443.1496919869),(-13847.4767358109 6710440.1096301023,-13847.8106942832 6710440.1096301023,-13847.9220137740 6710439.9308029665,-13847.5880553017 6710439.7519758362,-13847.4767358109 6710440.1096301023))" }; +static std::string issue_1211[2] = +{ + "POLYGON((0.875 0.4375, 0.875 0.375, 0.9375 0.375))", + "POLYGON((1. 0., 1. 0.581662834, 0.824054539 0.))" +}; + static std::string issue_1226[2] = { "POLYGON((-0.90478776881879274807 0.51756843862589896332,-0.91 0.48,-1.2 0.4,-1.4 1.9,-0.90478776881879274807 0.51756843862589896332))", "POLYGON((-0.91943242964602156508 0.55292377741135378955,-0.90478776881879174887 0.51756843862590162786,-0.91 0.48,-0.91943242964602156508 0.55292377741135378955))" }; -// Triangle, nearly a line +// Triangle, nearly a line. +// Still gives an error in difference static std::string issue_1229[2] = { "POLYGON((38436.758 22765.61,930.538 -10523.68,925.121 -10507.965,38436.758 22765.61))", @@ -1290,6 +1297,12 @@ static std::string issue_1345_b[2] = )"""" }; +static std::string issue_1363[2] = +{ + "MULTIPOLYGON(((2.0611606968426476882 0.61095000000000010409,2.046160696842648008 0.62595000000000000639,2.0311606968426478836 0.6409499999999999087,1.9486606968426476438 0.73094999999999987761,1.9261606968426476794 0.76094999999999990425,1.9336606968426472974 0.78344999999999986873,2.0161606968426477593 0.85844999999999993534,2.0236606968426480435 0.8584499999999997133,2.0461606968426475639 0.90344999999999986429,2.0911606968426479369 0.88844999999999973994,2.098660696842647333 0.8734499999999996156,2.1136606968426479014 0.86594999999999977547,2.1286606968426480258 0.85094999999999976215,2.1436606968426472619 0.83594999999999985985,2.143660696842647706 0.62594999999999989537,2.0836606968426476527 0.62594999999999989537,2.0611606968426476882 0.61095000000000010409)))", + "MULTIPOLYGON(((2.0461606968426484521 0.90344999999999986429,2.001160696842647635 0.91095000000000003748,1.8511606968426477238 0.91094999999999992646,1.813660696842647635 0.91844999999999998863,1.813660696842647635 0.9409499999999999531,1.8211606968426479192 1.1059499999999999886,1.8286606968426479813 1.263449999999999962,1.9636606968426479902 1.263449999999999962,2.0461606968426484521 1.2559499999999998998,2.0536606968426478481 1.2409499999999999975,2.1286606968426480258 1.2409499999999999975,2.1286606968426480258 1.1059499999999999886,2.1211606968426477415 0.92594999999999982876,2.1136606968426479014 0.89594999999999980211,2.091160696842648381 0.88844999999999996199,2.0461606968426484521 0.90344999999999986429)))" +}; + static std::string ggl_list_20120229_volker[3] = { "POLYGON((1716 1554,2076 2250,2436 2352,2796 1248,3156 2484,3516 2688,3516 2688,3156 2484,2796 1248,2436 2352,2076 2250, 1716 1554))", diff --git a/test/algorithms/overlay/self_intersection_points.cpp b/test/algorithms/overlay/self_intersection_points.cpp index cb681ed2c..1ef7ea033 100644 --- a/test/algorithms/overlay/self_intersection_points.cpp +++ b/test/algorithms/overlay/self_intersection_points.cpp @@ -27,7 +27,7 @@ #include #include #include -//#include +#include #include #include diff --git a/test/algorithms/overlay/sort_by_side.cpp b/test/algorithms/overlay/sort_by_side.cpp index 702fbf0c0..9c9e12f91 100644 --- a/test/algorithms/overlay/sort_by_side.cpp +++ b/test/algorithms/overlay/sort_by_side.cpp @@ -159,6 +159,12 @@ std::vector apply_overlay( cluster_type clusters; + // Handle colocations, gathering clusters and (below) their properties. + bg::detail::overlay::handle_colocations + < + Reverse1, Reverse2, OverlayType, Geometry1, Geometry2 + >(turns, clusters); + bg::enrich_intersection_points(turns, clusters, geometry1, geometry2, strategy); diff --git a/test/algorithms/overlay/split_rings.cpp b/test/algorithms/overlay/split_rings.cpp index 90704de0e..7bbfb22cf 100644 --- a/test/algorithms/overlay/split_rings.cpp +++ b/test/algorithms/overlay/split_rings.cpp @@ -47,7 +47,7 @@ struct test_split_rings double precision) { - typedef typename bg::ring_type::type ring_type; + using ring_type = bg::ring_type_t:; std::vector rings; bg::split_rings(geometry, rings); diff --git a/test/algorithms/set_operations/CMakeLists.txt b/test/algorithms/set_operations/CMakeLists.txt index a27a257eb..16a7a6cd5 100644 --- a/test/algorithms/set_operations/CMakeLists.txt +++ b/test/algorithms/set_operations/CMakeLists.txt @@ -8,3 +8,9 @@ add_subdirectory(union) add_subdirectory(intersection) add_subdirectory(difference) add_subdirectory(sym_difference) + +foreach(item IN ITEMS + set_ops_areal_areal + ) + boost_geometry_add_unit_test("algorithms" ${item}) +endforeach() \ No newline at end of file diff --git a/test/algorithms/set_operations/Jamfile b/test/algorithms/set_operations/Jamfile index 27ebad64b..7afe10baa 100644 --- a/test/algorithms/set_operations/Jamfile +++ b/test/algorithms/set_operations/Jamfile @@ -1,6 +1,6 @@ # Boost.Geometry (aka GGL, Generic Geometry Library) # -# Copyright (c) 2007-2014 Barend Gehrels, Amsterdam, the Netherlands. +# Copyright (c) 2007-2024 Barend Gehrels, Amsterdam, the Netherlands. # Copyright (c) 2008-2014 Bruno Lalande, Paris, France. # Copyright (c) 2009-2014 Mateusz Loskot, London, UK. # @@ -14,6 +14,11 @@ # Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) +test-suite boost-geometry-algorithms + : + [ run set_ops_areal_areal.cpp : : : : algorithms_set_ops_areal_areal ] + ; + build-project difference ; build-project intersection ; build-project sym_difference ; diff --git a/test/algorithms/set_operations/check_turn_less.hpp b/test/algorithms/set_operations/check_turn_less.hpp index 5b6e0b67d..7fefa066f 100644 --- a/test/algorithms/set_operations/check_turn_less.hpp +++ b/test/algorithms/set_operations/check_turn_less.hpp @@ -20,7 +20,7 @@ // check less functor for turns template -inline void verify_less_for_turns(Turns turns, Less const& less) +inline void verify_less_for_turns(Turns const& turns, Less const& less) { typedef typename boost::range_iterator::type iterator_type; diff --git a/test/algorithms/set_operations/difference/difference.cpp b/test/algorithms/set_operations/difference/difference.cpp index e89d48b11..0d7f3c764 100644 --- a/test/algorithms/set_operations/difference/difference.cpp +++ b/test/algorithms/set_operations/difference/difference.cpp @@ -34,15 +34,6 @@ namespace { -// Change compiler defines to constexpr bools -// to make conditions more readable -// and to always compile all code. -#if defined(BOOST_GEOMETRY_TEST_FAILURES) -constexpr bool test_failures = true; -#else -constexpr bool test_failures = false; -#endif - #if defined(BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE) constexpr bool test_only_one_type = true; #else @@ -95,16 +86,10 @@ void test_all() 1, 5, 8.0, 1, 5, 8.0); - { - // It reports self-intersections for symmetric difference - ut_settings settings; - settings.sym_difference = false; - test_one("star_comb_15", - star_comb_15[0], star_comb_15[1], - 30, -1, 227.658275102812, - 30, -1, 480.485775259312, - settings); - } + test_one("star_comb_15", + star_comb_15[0], star_comb_15[1], + 30, -1, 227.658275102812, + 30, -1, 480.485775259312); test_one("new_hole", new_hole[0], new_hole[1], @@ -173,31 +158,20 @@ void test_all() 4, 20, 11.533333, 5, 26, 29.783333); - { - ut_settings settings; - settings.validity_of_sym = true; - test_one("intersect_holes_intersect_and_disjoint", - intersect_holes_intersect_and_disjoint[0], intersect_holes_intersect_and_disjoint[1], - 2, 16, 15.75, - 3, 17, 6.75, - settings); + test_one("intersect_holes_intersect_and_disjoint", + intersect_holes_intersect_and_disjoint[0], intersect_holes_intersect_and_disjoint[1], + 2, 16, 15.75, + 3, 17, 6.75); - test_one("intersect_holes_intersect_and_touch", - intersect_holes_intersect_and_touch[0], intersect_holes_intersect_and_touch[1], - 3, 21, 16.25, - 3, 17, 6.25, - settings); - } + test_one("intersect_holes_intersect_and_touch", + intersect_holes_intersect_and_touch[0], intersect_holes_intersect_and_touch[1], + 3, 21, 16.25, + 3, 17, 6.25); - { - ut_settings settings; - settings.percentage = 0.01; - test_one("intersect_holes_new_ring", - intersect_holes_new_ring[0], intersect_holes_new_ring[1], - 3, 15, 9.8961, - 4, 25, 121.8961, - settings); - } + test_one("intersect_holes_new_ring", + intersect_holes_new_ring[0], intersect_holes_new_ring[1], + 3, 15, 9.8961, + 4, 25, 121.8961); test_one("first_within_hole_of_second", first_within_hole_of_second[0], first_within_hole_of_second[1], @@ -209,14 +183,10 @@ void test_all() 2, 14, 16.0, 2, 10, 6.0); - { - ut_settings settings; - test_one("intersect_holes_intersect", - intersect_holes_intersect[0], intersect_holes_intersect[1], - 2, 16, 15.75, - 2, 12, 5.75, - settings); - } + test_one("intersect_holes_intersect", + intersect_holes_intersect[0], intersect_holes_intersect[1], + 2, 16, 15.75, + 2, 12, 5.75); test_one( "case4", case_4[0], case_4[1], @@ -279,11 +249,9 @@ void test_all() TEST_DIFFERENCE(case_precision_9, optional(), optional_sliver(), 1, 59.0, count_set(1, 2)); TEST_DIFFERENCE_WITH(case_precision_10, optional(), optional_sliver(), 1, 59, count_set(1, 2), ut_settings(0.001)); - if BOOST_GEOMETRY_CONSTEXPR(test_failures) - { - // Fails (since rescaling is turned off) - TEST_DIFFERENCE(case_precision_11, optional(), optional_sliver(), 1, 59.0, count_set(1, 2)); - } + // Sym Difference fails (since rescaling is turned off) + TEST_DIFFERENCE_WITH(case_precision_11, optional(), optional_sliver(), 1, 59.0, count_set(1, 2), + ut_settings(ut_settings::default_tolerance, true, BG_IF_TEST_FAILURES)); TEST_DIFFERENCE(case_precision_12, 1, 12.0, 0, 0.0, 1); TEST_DIFFERENCE_WITH(case_precision_13, 1, 12, 0, 0.0, 1, ut_settings(0.001)); @@ -330,23 +298,25 @@ void test_all() count_set(1, 2), settings); } - /*** TODO: self-tangencies for difference - test_one("wrapped_a", - wrapped[0], wrapped[1], - 3, 1, 61, - 1, 0, 13); + { + ut_settings settings(ut_settings::default_tolerance, false); + test_one("wrapped_0_1", + wrapped[0], wrapped[1], + 1, 1, 1.0, + 1, 0, 15.0, + 1, settings); + } - test_one("wrapped_b", + test_one("wrapped_0_2", wrapped[0], wrapped[2], - 3, 1, 61, - 1, 0, 13); - ***/ + 1, 1, 1.0, + 1, 0, 15.0, + 1); { ut_settings settings; settings.percentage = 0.1; - settings.set_test_validity(false); - settings.sym_difference = false; + settings.validity_of_sym = false; // Isovist - the # output polygons differ per compiler/pointtype, (very) small // rings might be discarded. We check area only @@ -374,21 +344,15 @@ void test_all() } { - ut_settings settings; - settings.set_test_validity(true); - - // Output polygons for sym difference might be combined - expectation_limits a{138.5312, 138.6924}; - expectation_limits b{210.5312, 211.8594}; + expectation_limits const a{138.5312, 138.6924}; + expectation_limits const b{210.5312, 211.8594}; test_one("geos_2", geos_2[0], geos_2[1], 1, -1, a, 1, -1, b, - {1, 2}, -1, a + b, - settings); + {1, 2}, -1, a + b); } - // Output polygons for sym difference might be combined test_one("geos_3", geos_3[0], geos_3[1], 1, -1, 16211128.5, @@ -418,15 +382,10 @@ void test_all() 1, 58456.4964294434, 1); - { - ut_settings settings(0.0001, false); - // Symmetric difference should output one polygon - // Using rescaling, it currently outputs two. - TEST_DIFFERENCE_WITH(ggl_list_20110820_christophe, - 1, 2.8570121719168924, - 1, 64.498061986388564, - count_set(1, 2), settings); - } + TEST_DIFFERENCE(ggl_list_20110820_christophe, + 1, 2.8570121719168924, + 1, 64.498061986388564, + count_set(1, 2)); test_one("ggl_list_20120717_volker", ggl_list_20120717_volker[0], ggl_list_20120717_volker[1], @@ -439,28 +398,19 @@ void test_all() // sql server gives: 6.62295817619452E-05 // PostGIS gives: 0.0 (no output) // Boost.Geometry gave results depending on FP-type, and compiler, and operating system. - // With rescaling results are equal w.r.t. compiler/FP type, - // however, some long spikes are still generated in the resulting difference - // Without rescaling there is no output, like PostGIS + // To be verified if some long spikes are still generated in the results test_one("ggl_list_20110627_phillip", ggl_list_20110627_phillip[0], ggl_list_20110627_phillip[1], optional(), -1, optional_sliver(0.00013), 1, -1, expectation_limits(3577.4096, 3577.415), - tolerance(0.01) - ); + tolerance(0.01)); - { - // With rescaling, difference of output a-b and a sym b is invalid - ut_settings settings; - settings.set_test_validity(true); - settings.validity_of_sym = true; - TEST_DIFFERENCE_WITH(ggl_list_20190307_matthieu_1, - count_set(1, 2), 0.18461532, - count_set(1, 2), 0.617978, - count_set(3, 4), settings); - TEST_DIFFERENCE_WITH(ggl_list_20190307_matthieu_2, 2, 12.357152, 0, 0.0, 2, settings); - } + TEST_DIFFERENCE(ggl_list_20190307_matthieu_1, + count_set(1, 2), 0.18461532, + count_set(1, 2), 0.617978, + count_set(3, 4)); + TEST_DIFFERENCE(ggl_list_20190307_matthieu_2, 2, 12.357152, 0, 0.0, 2); // Ticket 8310, one should be completely subtracted from the other. test_one("ticket_8310a", @@ -494,14 +444,11 @@ void test_all() count_set(1, 6), 20.096189, count_set(1, 6)); - if BOOST_GEOMETRY_CONSTEXPR(test_failures) - { - // Without rescaling the second case (labeled "b") produces no output. - test_one("ticket_10108_a", - ticket_10108_a[0], ticket_10108_a[1], - 1, 4, {0.0145036, 0.0145037}, - 1, 4, 0.029019232); - } + test_one("ticket_10108_a", + ticket_10108_a[0], ticket_10108_a[1], + 1, 4, {0.0145036, 0.0145037}, + 1, 4, 0.029019232, + 1); test_one("ticket_10108_b", ticket_10108_b[0], ticket_10108_b[1], @@ -570,7 +517,7 @@ void test_all() { using mp = bg::model::multi_polygon; - static std::string const clip = "POLYGON((2 2,4 4))"; + std::string const clip = "POLYGON((2 2,4 4))"; test_one("simplex_multi_box_mp", clip, case_multi_simplex[0], @@ -590,16 +537,10 @@ void test_all() optional(), optional_sliver(1.0e-5), count_set(1, 2)); - { - ut_settings settings; - settings.set_test_validity(false); - settings.validity_false_negative_a = true; - TEST_DIFFERENCE_WITH(issue_838, - count_set(1, 2), expectation_limits(0.000026, 0.0002823), - count_set(1, 2), expectation_limits(0.67257, 0.67499), - count_set(2, 3, 4), - settings); - } + TEST_DIFFERENCE(issue_838, + count_set(1, 2), expectation_limits(0.000026, 0.0002823), + count_set(1, 2), expectation_limits(0.67257, 0.67499), + count_set(2, 3, 4)); { // The symmetric difference is invalid for ccw @@ -612,7 +553,7 @@ void test_all() TEST_DIFFERENCE(issue_876b, 1, 6114.18234, 1, 4754.29449, count_set(1, 2)); { - // Results are still invalid + // Results are reported as invalid ut_settings settings; settings.set_test_validity(false); settings.validity_of_sym = false; @@ -621,43 +562,6 @@ void test_all() TEST_DIFFERENCE(issue_1138, 1, 203161.751, 2, 1237551.0171, 1); - { - ut_settings settings; - settings.set_test_validity(false); - settings.validity_of_sym = false; - TEST_DIFFERENCE_WITH(issue_1226, 1, 0.238037722, 0, 0.0, 1, settings); - } - - TEST_DIFFERENCE(issue_1231, 2, 36.798659456837477, 3, 195.2986, 5); - - TEST_DIFFERENCE(issue_1244, 3, 8, 3, 2, 6); - - { - // The symmetric difference reports an invalidity since the choice of - // discarding start/touch turns. - // This might be a false negative. - // Clockwise: "method: t; operations: u/x" - // CCW: "method: m; operations: i/x" - ut_settings settings; - settings.validity_of_sym = false; - TEST_DIFFERENCE_WITH(issue_1293, 1, 1.40999, 1, 2.318951, 2, settings); - } - -#if defined(BOOST_GEOMETRY_TEST_FAILURES) - // Difference fails for this case. This was not reported for this case. - // Reported as a failing intersection, which is fixed. - // The failing difference should be investigated more thoroughly. - TEST_DIFFERENCE(issue_1295, 1, 9.999, 1, 9.999, 1); -#endif - - TEST_DIFFERENCE(issue_1326, 3, 6.7128537626409130468, 6, 0.00372806966532758478, 9); - - TEST_DIFFERENCE(issue_1342_a, 2, 5.762381026454777, 0, 0.0, 2); - TEST_DIFFERENCE(issue_1342_b, 2, 5.762381026454777, 1, 2.55e-14, 3); - - TEST_DIFFERENCE(issue_1345_a, 1, 0.059308854, 0, 0.0, 1); - TEST_DIFFERENCE(issue_1345_b, 2, 0.024048025, 0, 0.0, 2); - TEST_DIFFERENCE(mysql_21977775, 2, 160.856568913, 2, 92.3565689126, 4); TEST_DIFFERENCE(mysql_21965285, 1, 92.0, 1, 14.0, 1); TEST_DIFFERENCE(mysql_23023665_1, 1, 92.0, 1, 142.5, 2); @@ -722,12 +626,5 @@ int test_main(int, char* []) test_all, true>(); } -#if defined(BOOST_GEOMETRY_TEST_FAILURES) - // Not yet fully tested for float and long double. - // The difference algorithm can generate (additional) slivers - // Many of the failures are self-intersection points. - BoostGeometryWriteExpectedFailures(5, 17, 10); -#endif - return 0; } diff --git a/test/algorithms/set_operations/difference/difference_multi.cpp b/test/algorithms/set_operations/difference/difference_multi.cpp index 20be703b9..3ce5fe24e 100644 --- a/test/algorithms/set_operations/difference/difference_multi.cpp +++ b/test/algorithms/set_operations/difference/difference_multi.cpp @@ -23,18 +23,12 @@ #include -// Convenience macros (points are not checked) +// Convenience macros (not using number of points, they are not checked anymore) #define TEST_DIFFERENCE(caseid, clips1, area1, clips2, area2, clips3) \ (test_one) \ ( #caseid, caseid[0], caseid[1], clips1, -1, area1, clips2, -1, area2, \ clips3, -1, area1 + area2) -#define TEST_DIFFERENCE_IGNORE(caseid, clips1, area1, clips2, area2, clips3) \ - { ut_settings ignore_validity; ignore_validity.set_test_validity(false); \ - (test_one) \ - ( #caseid, caseid[0], caseid[1], clips1, -1, area1, clips2, -1, area2, \ - clips3, -1, area1 + area2, ignore_validity); } - #define TEST_DIFFERENCE_WITH(index1, index2, caseid, clips1, area1, \ clips2, area2, clips3) \ (test_one) \ @@ -106,18 +100,11 @@ void test_areal() // A should have 3 clips, B should have 5 clips TEST_DIFFERENCE(case_126_multi, 4, 16.0, 5, 27.0, 9); - { - ut_settings settings; - - settings.sym_difference = true; - - test_one("case_108_multi", - case_108_multi[0], case_108_multi[1], - 7, 32, 5.5, - 4, 24, 9.75, - 7, 45, 15.25, - settings); - } + test_one("case_108_multi", + case_108_multi[0], case_108_multi[1], + 7, 32, 5.5, + 4, 24, 9.75, + 7, 45, 15.25); // Ticket on GGL list 2011/10/25 // to mix polygon/multipolygon in call to difference @@ -154,19 +141,7 @@ void test_areal() TEST_DIFFERENCE(bug_21155501, 1, 3.758937, 1, 1.78e-15, 1); -#if defined(BOOST_GEOMETRY_TEST_FAILURES) - { - // With rescaling, it is complete but invalid - // Without rescaling, one ring is missing (for a and s) - ut_settings settings; - settings.set_test_validity(true); - settings.validity_of_sym = true; - TEST_DIFFERENCE_WITH(0, 1, ticket_9081, - 2, 0.0907392476356186, - 4, 0.126018011439877, - count_set(3, 4)); - } -#endif + TEST_DIFFERENCE(ticket_9081, 2, 0.0907392476356186, 4, 0.126018011439877, count_set(3, 4)); TEST_DIFFERENCE(ticket_12503, 46, 920.625, 4, 7.625, 50); @@ -178,9 +153,7 @@ void test_areal() TEST_DIFFERENCE_WITH(0, 1, issue_630_a, 0, expectation_limits(0.0), 1, (expectation_limits(2.023, 2.2004)), 1); TEST_DIFFERENCE_WITH(0, 1, issue_630_b, 1, 0.0056089, 2, 1.498976, 3); TEST_DIFFERENCE_WITH(0, 1, issue_630_c, 0, 0, 1, 1.493367, 1); - // Symmetrical difference fails without get_clusters - settings.sym_difference = BG_IF_TEST_FAILURES; - TEST_DIFFERENCE_WITH(0, 1, issue_643, 1, expectation_limits(76.5385), optional(), optional_sliver(1.0e-6), 1); + TEST_DIFFERENCE_WITH(0, 1, issue_643, 1, expectation_limits(76.5385), optional(), optional_sliver(1.0e-6), 2); } // Cases below go (or went) wrong in either a ( [0] - [1] ) or b ( [1] - [0] ) @@ -238,7 +211,6 @@ void test_areal() TEST_DIFFERENCE(case_138_multi, 5, 16.6, 3, 8.225, 8); TEST_DIFFERENCE(case_139_multi, 4, 16.328125, 3, 8.078125, 7); TEST_DIFFERENCE(case_140_multi, 4, 16.328125, 3, 8.078125, 7); - TEST_DIFFERENCE(case_141_multi, 5, 15.5, 5, 10.0, 10); // Areas correspond with POSTGIS, // #clips in PostGIS is 11,11,5 but should most probably be be 12,12,6 @@ -418,7 +390,7 @@ template void test_specific_areal() { { - // Spikes in a-b and b-a, failure in symmetric difference + // Spikes in a-b and b-a, causing invalidity ut_settings settings; settings.sym_difference = false; settings.set_test_validity(false); @@ -508,11 +480,5 @@ int test_main(int, char* []) test_all >(); #endif -#if defined(BOOST_GEOMETRY_TEST_FAILURES) - // Not yet fully tested for float. - // The difference algorithm can generate (additional) slivers - BoostGeometryWriteExpectedFailures(11, 21, 7); -#endif - return 0; } diff --git a/test/algorithms/set_operations/difference/test_difference.hpp b/test/algorithms/set_operations/difference/test_difference.hpp index f9bbc569e..4b22d6376 100644 --- a/test/algorithms/set_operations/difference/test_difference.hpp +++ b/test/algorithms/set_operations/difference/test_difference.hpp @@ -79,7 +79,9 @@ struct ut_settings : ut_base_settings bool validity_false_negative_b = false; bool validity_false_negative_sym = false; - explicit ut_settings(double p = 0.0001, bool validity = true, bool sd = true) + static constexpr double default_tolerance = 0.0001; + + explicit ut_settings(double p = default_tolerance, bool validity = true, bool sd = true) : ut_base_settings(validity) , percentage(p) , sym_difference(sd) @@ -215,7 +217,6 @@ std::string test_difference(std::string const& caseid, G1 const& g1, G2 const& g #if ! defined(BOOST_GEOMETRY_NO_BOOST_TEST) if (settings.test_validity_of_diff(dtype)) { - // std::cout << bg::dsv(result) << std::endl; typedef bg::model::multi_polygon result_type; std::string message; bool const valid = check_validity::apply(result, caseid, g1, g2, message); diff --git a/test/algorithms/set_operations/intersection/intersection.cpp b/test/algorithms/set_operations/intersection/intersection.cpp index 07573ef4c..cebcd46da 100644 --- a/test/algorithms/set_operations/intersection/intersection.cpp +++ b/test/algorithms/set_operations/intersection/intersection.cpp @@ -26,6 +26,7 @@ #include #include +#include #include #include @@ -51,11 +52,6 @@ BOOST_GEOMETRY_REGISTER_LINESTRING_TEMPLATED(std::vector) (test_one) \ ( #caseid "_rev", caseid[1], caseid[0], clips, points, area) -#define TEST_INTERSECTION_IGNORE(caseid, clips, points, area) \ - { ut_settings ignore_validity; ignore_validity.set_test_validity(false); \ - (test_one) \ - ( #caseid, caseid[0], caseid[1], clips, points, area, ignore_validity); } - #define TEST_INTERSECTION_WITH(caseid, index1, index2, \ clips, points, area, settings) \ (test_one) \ @@ -178,14 +174,9 @@ void test_areal() pie_2_3_23_0[0], pie_2_3_23_0[1], 1, 4, 163292.679042133, ut_settings(0.1)); -#if defined(BOOST_GEOMETRY_TEST_FAILURES) TEST_INTERSECTION(isovist, 1, 19, expectation_limits(88.19202, 88.19206)); -#else - // Reported as invalid - TEST_INTERSECTION_IGNORE(isovist, 1, 19, expectation_limits(88.19202, 88.19206)); -#endif - TEST_INTERSECTION_IGNORE(geos_1, 1, -1, expectation_limits(3454, 3462)); + TEST_INTERSECTION(geos_1, 1, -1, expectation_limits(3454, 3462)); // Can, in some cases, create small slivers // In some cases: 1.430511474609375e-05 (clang/gcc on Xubuntu using b2) @@ -303,23 +294,8 @@ void test_areal() TEST_INTERSECTION(issue_893, 1, -1, 473001.5082956461); - TEST_INTERSECTION(issue_1226, 1, -1, 0.00036722862); TEST_INTERSECTION(issue_1229, 0, -1, 0); - TEST_INTERSECTION(issue_1231, 1, -1, 54.701340543162516); - - TEST_INTERSECTION(issue_1244, 1, -1, 7); - - TEST_INTERSECTION(issue_1293, 1, -1, 1.49123); - TEST_INTERSECTION(issue_1295, 1, -1, 4.90121); - TEST_INTERSECTION(issue_1326, 1, -1, 16.4844); - - TEST_INTERSECTION(issue_1342_a, 1, -1, 43.05575); - TEST_INTERSECTION(issue_1342_b, 1, -1, 43.05575); - - TEST_INTERSECTION(issue_1345_a, 1, -1, 0.00062682687); - TEST_INTERSECTION(issue_1345_b, 1, -1, 0.010896761); - test_one("buffer_mp1", buffer_mp1[0], buffer_mp1[1], 1, 31, 2.271707796); test_one("buffer_mp2", buffer_mp2[0], buffer_mp2[1], @@ -849,11 +825,5 @@ int test_main(int, char* []) test_rational > >(); #endif -#if defined(BOOST_GEOMETRY_TEST_FAILURES) - // llb_touch generates a polygon with 1 point and is therefore invalid everywhere - // TODO: this should be easy to fix - BoostGeometryWriteExpectedFailures(2, 7, 1); -#endif - return 0; } diff --git a/test/algorithms/set_operations/intersection/intersection_multi.cpp b/test/algorithms/set_operations/intersection/intersection_multi.cpp index c74f4e405..0c0237745 100644 --- a/test/algorithms/set_operations/intersection/intersection_multi.cpp +++ b/test/algorithms/set_operations/intersection/intersection_multi.cpp @@ -156,7 +156,6 @@ void test_areal() TEST_INTERSECTION(case_138_multi, 2, 23, 40.4); TEST_INTERSECTION(case_139_multi, 2, 23, 40.546875); TEST_INTERSECTION(case_140_multi, 2, 23, 40.546875); - TEST_INTERSECTION(case_141_multi, 3, -1, 74.5); TEST_INTERSECTION(case_recursive_boxes_1, 10, 89, 47.0); @@ -484,10 +483,6 @@ int test_main(int, char* []) test_all >(); #endif -#if defined(BOOST_GEOMETRY_TEST_FAILURES) - BoostGeometryWriteExpectedFailures(1, 2, 1); -#endif - return 0; } diff --git a/test/algorithms/set_operations/set_ops_areal_areal.cpp b/test/algorithms/set_operations/set_ops_areal_areal.cpp new file mode 100644 index 000000000..53d8f1f4a --- /dev/null +++ b/test/algorithms/set_operations/set_ops_areal_areal.cpp @@ -0,0 +1,312 @@ +// Boost.Geometry +// Unit Test + +// Copyright (c) 2024 Barend Gehrels, Amsterdam, the Netherlands. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include +#include + +#include + +// Use another alias, on purpose it is not "bg::" here +namespace bgeo = boost::geometry; + +// For convenience and to test current failures +#if defined(BOOST_GEOMETRY_TEST_FAILURES) +#define BG_IF_TEST_FAILURES true +#else +#define BG_IF_TEST_FAILURES false +#endif + +struct ut_settings +{ + explicit ut_settings() + {} + + inline ut_settings& ignore_reverse() + { + test_reverse = BG_IF_TEST_FAILURES; + return *this; + } + + inline ut_settings& ignore_diff() + { + test_difference = BG_IF_TEST_FAILURES; + return *this; + } + + inline ut_settings& ignore_validity() + { + test_validity = BG_IF_TEST_FAILURES; + return *this; + } + + inline ut_settings& ignore_validity_union() + { + test_validity_union = BG_IF_TEST_FAILURES; + return *this; + } + + inline ut_settings& ignore_validity_intersection() + { + test_validity_intersection = BG_IF_TEST_FAILURES; + return *this; + } + + inline ut_settings& ignore_validity_diff() + { + test_validity_diff1 = BG_IF_TEST_FAILURES; + test_validity_diff2 = BG_IF_TEST_FAILURES; + test_validity_diff_sym = BG_IF_TEST_FAILURES; + return *this; + } + + inline ut_settings& ignore_validity_diff1() + { + test_validity_diff1 = BG_IF_TEST_FAILURES; + return *this; + } + + inline ut_settings& ignore_validity_diff2() + { + test_validity_diff2 = BG_IF_TEST_FAILURES; + return *this; + } + + inline ut_settings& ignore_validity_diff_sym() + { + test_validity_diff_sym = BG_IF_TEST_FAILURES; + return *this; + } + + inline ut_settings& set_epsilon(long double epsilon) + { + epsilon = epsilon; + return *this; + } + + bool test_reverse{true}; + bool test_difference{true}; + + bool test_validity{true}; + bool test_validity_union{true}; + bool test_validity_intersection{true}; + bool test_validity_diff1{true}; + bool test_validity_diff2{true}; + bool test_validity_diff_sym{true}; + + long double epsilon{1.0e-6}; +}; +template +void test_detail(std::string const& name, std::string const& wkt1, std::string const& wkt2, + ut_settings const& settings) +{ + Geometry1 geometry1; + Geometry2 geometry2; + bgeo::read_wkt(wkt1, geometry1); + bgeo::read_wkt(wkt2, geometry2); + bgeo::correct(geometry1); + bgeo::correct(geometry2); + + Multi result_intersection, result_union; + Multi result_intersection_rev, result_union_rev; + Multi diff1, diff2, sym_diff; + + bgeo::intersection(geometry1, geometry2, result_intersection); + bgeo::intersection(geometry2, geometry1, result_intersection_rev); + bgeo::union_(geometry1, geometry2, result_union); + bgeo::union_(geometry2, geometry1, result_union_rev); + bgeo::difference(geometry1, geometry2, diff1); + bgeo::difference(geometry2, geometry1, diff2); + bgeo::sym_difference(geometry1, geometry2, sym_diff); + + auto const area1 = bgeo::area(geometry1); + auto const area2 = bgeo::area(geometry2); + auto const area_union = bgeo::area(result_union); + auto const area_intersection = bgeo::area(result_intersection); + auto const area_diff1 = bgeo::area(diff1); + auto const area_diff2 = bgeo::area(diff2); + auto const area_sym_diff = bgeo::area(sym_diff); + + auto const balance = (area1 + area2) - area_union - area_intersection; + auto const balance_d1 = (area_union - area2) - area_diff1; + auto const balance_d2 = (area_union - area1) - area_diff2; + auto const balance_sym = (area_diff1 + area_diff2) - area_sym_diff; + + auto const eps = settings.epsilon; + + BOOST_CHECK_MESSAGE(area_union + eps >= area1 && area_union + eps >= area2 , + "Case: " << name << " wrong union " << area_union << " vs " << area1 << " and " << area2); + BOOST_CHECK_MESSAGE(area_intersection - eps <= area1 && area_intersection - eps <= area2, + "Case: " << name << " wrong intersection " << area_intersection << " vs " << area1 << " and " << area2); + + BOOST_CHECK_MESSAGE(bgeo::math::abs(balance) < eps, + "Case: " << name << " wrong union or intersection " << balance); + if (settings.test_difference) + { + BOOST_CHECK_MESSAGE(bgeo::math::abs(balance_d1) < eps, + "Case: " << name << " wrong difference (a-b) " << balance_d1); + BOOST_CHECK_MESSAGE(bgeo::math::abs(balance_d2) < eps, + "Case: " << name << " wrong difference (b-a) " << balance_d2); + BOOST_CHECK_MESSAGE(bgeo::math::abs(balance_sym) < eps, + "Case: " << name << " wrong symmetric difference " << balance_sym); + } + + if (settings.test_reverse) + { + BOOST_CHECK_MESSAGE(bgeo::math::abs(area_union - bgeo::area(result_union_rev)) < eps, + "Case: " << name << " wrong union reversed: " << area_union << " != " << bgeo::area(result_union_rev)); + BOOST_CHECK_MESSAGE(bgeo::math::abs(area_intersection - bgeo::area(result_intersection_rev)) < eps, + "Case: " << name << " wrong intersection reversed: " << area_intersection << " != " << bgeo::area(result_intersection_rev)); + } + + if (settings.test_validity) + { + BOOST_CHECK_MESSAGE(bgeo::is_valid(geometry1), + "Case: " << name << " geometry1 is not valid"); + BOOST_CHECK_MESSAGE(bgeo::is_valid(geometry2), + "Case: " << name << " geometry2 is not valid"); + if (settings.test_validity_union) + { + BOOST_CHECK_MESSAGE(bgeo::is_valid(result_union), + "Case: " << name << " union is not valid"); + } + if (settings.test_validity_intersection) + { + BOOST_CHECK_MESSAGE(bgeo::is_valid(result_intersection), + "Case: " << name << " intersection is not valid"); + } + if (settings.test_validity_diff1) + { + BOOST_CHECK_MESSAGE(bgeo::is_valid(diff1), + "Case: " << name << " difference (a-b) is not valid"); + } + if (settings.test_validity_diff2) + { + BOOST_CHECK_MESSAGE(bgeo::is_valid(diff2), + "Case: " << name << " difference (b-a) is not valid"); + } + if (settings.test_validity_diff_sym) + { + BOOST_CHECK_MESSAGE(bgeo::is_valid(sym_diff), + "Case: " << name << " symmetric difference is not valid"); + } + } +} + +template +void test(std::string const& name, std::string const& wkt1, std::string const& wkt2, + ut_settings const& settings) +{ + using point_t = bgeo::model::point; + using polygon_t = bgeo::model::polygon; + using mp_t = bgeo::model::multi_polygon; + + constexpr auto multipolygon_tag = "MULTIPOLYGON"; + bool const is_polygon1 = ! boost::icontains(wkt1, multipolygon_tag); + bool const is_polygon2 = ! boost::icontains(wkt2, multipolygon_tag); + + if (is_polygon1 && is_polygon2) + { + test_detail(name, wkt1, wkt2, settings); + } + else if (! is_polygon1 && ! is_polygon2) + { + test_detail(name, wkt1, wkt2, settings); + } + else if (is_polygon1) + { + test_detail(name, wkt1, wkt2, settings); + } + else + { + test_detail(name, wkt1, wkt2, settings); + } +} + +void test_all(std::string const& name, std::string const& wkt1, std::string const& wkt2, + ut_settings const& settings = ut_settings()) +{ + test(name, wkt1, wkt2, settings); +} + +#define TEST_CASE(caseid) (test_all(#caseid, caseid[0], caseid[1])) +#define TEST_CASE_WITH(caseid, index1, index2, settings) (test_all(#caseid "_" #index1 "_" #index2, caseid[index1], caseid[index2], settings)) + +int test_main(int, char* []) +{ + TEST_CASE_WITH(case_141_multi, 0, 1, ut_settings().ignore_reverse()); + TEST_CASE(case_142_multi); + TEST_CASE(case_143_multi); + TEST_CASE(case_144_multi); + TEST_CASE(case_145_multi); + TEST_CASE_WITH(case_146_multi, 0, 1, ut_settings().ignore_validity_intersection()); + TEST_CASE(case_147_multi); + TEST_CASE(case_148_multi); + TEST_CASE(case_149_multi); + + TEST_CASE_WITH(issue_1221, 0, 1, ut_settings().ignore_validity_diff()); + + TEST_CASE(issue_1222); + TEST_CASE_WITH(issue_1226, 0, 1, ut_settings().ignore_validity_diff()); + TEST_CASE(issue_1231); + TEST_CASE_WITH(issue_1241, 0, 1, ut_settings().ignore_diff()); + TEST_CASE(issue_1244); + TEST_CASE_WITH(issue_1288, 0, 1, ut_settings().ignore_validity_diff()); + TEST_CASE_WITH(issue_1288, 0, 2, ut_settings()); + TEST_CASE(issue_1293); + TEST_CASE_WITH(issue_1295, 0, 1, ut_settings().ignore_validity_diff()); + TEST_CASE(issue_1299); + + TEST_CASE(issue_1326); + TEST_CASE(issue_1342_a); + TEST_CASE(issue_1342_b); + + TEST_CASE(issue_1345_a); + TEST_CASE(issue_1345_b); + TEST_CASE_WITH(issue_1345_a, 1, 0, ut_settings()); + TEST_CASE_WITH(issue_1345_b, 1, 0, ut_settings()); + + TEST_CASE_WITH(issue_1349, 0, 1, ut_settings().ignore_diff()); + TEST_CASE(issue_1349_inverse); + +#if defined(BOOST_GEOMETRY_TEST_FAILURES) + // Fails in nearly all operations + TEST_CASE(issue_1363); +#endif + + TEST_CASE(case_bitset_1); + TEST_CASE(case_bitset_2); +#if defined(BOOST_GEOMETRY_TEST_FAILURES) + // Needs a fix in assign_parents + TEST_CASE(case_bitset_3); +#endif + + TEST_CASE(case_recursive_boxes_89); + TEST_CASE(case_recursive_boxes_90); +#if defined(BOOST_GEOMETRY_TEST_FAILURES) + TEST_CASE(case_recursive_boxes_91); +#endif + TEST_CASE(case_recursive_boxes_92); + TEST_CASE(case_recursive_boxes_93); + TEST_CASE(case_recursive_boxes_94); + TEST_CASE(case_recursive_boxes_95); + TEST_CASE(case_recursive_boxes_96); + TEST_CASE(case_recursive_boxes_97); + TEST_CASE(case_recursive_boxes_98); + TEST_CASE(case_recursive_boxes_99); + TEST_CASE_WITH(case_recursive_boxes_99, 2, 3, ut_settings()); + +#if defined(BOOST_GEOMETRY_TEST_FAILURES) + // Fails in union or intersection, and in difference. Also the union is invalid. + TEST_CASE_WITH(issue_1354, 0, 1, ut_settings().ignore_validity_union().ignore_diff()); +#endif + + return 0; +} diff --git a/test/algorithms/set_operations/union/union.cpp b/test/algorithms/set_operations/union/union.cpp index 1cf4565c3..59897360c 100644 --- a/test/algorithms/set_operations/union/union.cpp +++ b/test/algorithms/set_operations/union/union.cpp @@ -370,20 +370,11 @@ void test_areal() ggl_list_20110716_enrico[0], ggl_list_20110716_enrico[1], 1, 1, 15, 129904.197692871); - { - ut_settings settings; - settings.set_test_validity(BG_IF_TEST_FAILURES); - TEST_UNION_WITH(ggl_list_20110820_christophe, count_set(1, 2), 0, -1, 67.3550722317627); - } + TEST_UNION(ggl_list_20110820_christophe, count_set(1, 2), 0, -1, 67.3550722317627); - { - // SQL Server gives: 313.360374193241 - // PostGIS gives: 313.360364623393 - // Without rescaling, it is creates an invalidity for double - ut_settings settings; - settings.set_test_validity(false); - TEST_UNION_WITH(isovist, 1, 0, -1, 313.36036462); - } + // SQL Server gives: 313.360374193241 + // PostGIS gives: 313.360364623393 + TEST_UNION(isovist, 1, 0, -1, 313.36036462); TEST_UNION(ggl_list_20190307_matthieu_1, 1, 1, -1, 0.83773); TEST_UNION(ggl_list_20190307_matthieu_2, 1, 0, -1, 16.0); @@ -430,14 +421,7 @@ void test_areal() TEST_UNION_REV(issue_566_a, 1, 0, -1, 214.3728); TEST_UNION_REV(issue_566_b, 1, 0, -1, 214.3728); - { - // With rescaling, the input (was already an output of a previous step) - // is somehow considered as invalid. Output is also invalid. - // Without rescaling, the same input is considered as valid - ut_settings settings; - settings.ignore_validity_on_invalid_input = false; - TEST_UNION_WITH(issue_690, 2, 0, -1, 25492.0505); - } + TEST_UNION(issue_690, 2, 0, -1, 25492.0505); TEST_UNION(issue_838, 1, 0, -1, expectation_limits(1.3333, 1.33785)); TEST_UNION_REV(issue_838, 1, 0, -1, expectation_limits(1.3333, 1.33785)); @@ -475,33 +459,6 @@ void test_areal() TEST_UNION(issue_1229, 1, 0, -1, 384869.166); TEST_UNION_REV(issue_1229, 1, 0, -1, 384869.166); - TEST_UNION(issue_1231, 1, 0, -1, 286.799); - TEST_UNION_REV(issue_1231, 1, 0, -1, 286.799); - - TEST_UNION(issue_1244, 1, 1, -1, 17); - TEST_UNION_REV(issue_1244, 1, 1, -1, 17); - - TEST_UNION(issue_1293, 1, 0, -1, 5.22017); - TEST_UNION_REV(issue_1293, 1, 0, -1, 5.22017); - - TEST_UNION(issue_1295, 1, 0, -1, 17.56273); - TEST_UNION_REV(issue_1295, 1, 0, -1, 17.56273); - - TEST_UNION(issue_1326, 1, 0, -1, 23.201); - TEST_UNION_REV(issue_1326, 1, 0, -1, 23.201); - - TEST_UNION(issue_1342_a, 1, 0, -1, 48.81812749462216); - TEST_UNION_REV(issue_1342_a, 1, 0, -1, 48.81812749462216); - - TEST_UNION(issue_1342_b, 1, 0, -1, 48.81812749462214); - TEST_UNION_REV(issue_1342_b, 1, 0, -1, 48.81812749462214); - - TEST_UNION(issue_1345_a, 1, 0, -1, 0.059935681); - TEST_UNION_REV(issue_1345_a, 1, 0, -1, 0.059935681); - - TEST_UNION(issue_1345_b, 1, 0, -1, 0.034944786); - TEST_UNION_REV(issue_1345_b, 1, 0, -1, 0.034944786); - TEST_UNION(geos_1, 1, 0, -1, expectation_limits(3458.0, 3461.3203125)); TEST_UNION(geos_2, 1, 0, -1, expectation_limits(349.0625, 350.55102539)); TEST_UNION(geos_3, 1, 0, -1, 29391548.4998779); @@ -670,9 +627,5 @@ int test_main(int, char* []) test_all, true>(); #endif -#if defined(BOOST_GEOMETRY_TEST_FAILURES) - BoostGeometryWriteExpectedFailures(1, 2, 0); -#endif - return 0; } diff --git a/test/algorithms/set_operations/union/union_multi.cpp b/test/algorithms/set_operations/union/union_multi.cpp index 020650a74..770a6c1bd 100644 --- a/test/algorithms/set_operations/union/union_multi.cpp +++ b/test/algorithms/set_operations/union/union_multi.cpp @@ -199,7 +199,6 @@ void test_areal() TEST_UNION(case_138_multi, 2, 1, -1, 65.225); TEST_UNION(case_139_multi, 2, 1, -1, 64.953); TEST_UNION(case_140_multi, 2, 1, -1, 64.953); - TEST_UNION(case_141_multi, 1, 0, -1, 100.0); TEST_UNION(case_multi_rectangular, 1, 1, -1, 33125); TEST_UNION(case_multi_diagonal, 1, 2, -1, 5350); @@ -392,16 +391,9 @@ void test_areal() ggl_list_20140212_sybren[0], ggl_list_20140212_sybren[1], 2, bg_if_mp(1, 0), -1, 0.002471626); - { - // Generates either 4 or 3 output polygons - // With rescaling the result is invalid. - ut_settings settings; - settings.set_test_validity(true); - test_one("ticket_9081", - ticket_9081[0], ticket_9081[1], - 3, 0, -1, 0.2187385, - settings); - } + test_one("ticket_9081", + ticket_9081[0], ticket_9081[1], + 3, 0, -1, 0.2187385); test_one("ticket_10803", ticket_10803[0], ticket_10803[1], @@ -492,9 +484,5 @@ int test_main(int, char* []) test_specific, false, false>(); #endif -#if defined(BOOST_GEOMETRY_TEST_FAILURES) - BoostGeometryWriteExpectedFailures(0, 1, 0); -#endif - return 0; } diff --git a/test/algorithms/similarity/discrete_frechet_distance.cpp b/test/algorithms/similarity/discrete_frechet_distance.cpp index 35e552585..7e1ed0bc8 100644 --- a/test/algorithms/similarity/discrete_frechet_distance.cpp +++ b/test/algorithms/similarity/discrete_frechet_distance.cpp @@ -16,13 +16,13 @@ #include "test_frechet_distance.hpp" - template +template void test_all_cartesian() { - typedef bg::model::linestring

linestring_2d; + using linestring_2d = bg::model::linestring

; #ifdef BOOST_GEOMETRY_TEST_DEBUG - typedef typename coordinate_system

::type CordType; - std::cout << typeid(CordType).name() << std::endl; + using coor_t = bg::coordinate_system_t

; + std::cout << typeid(coor_t).name() << std::endl; #endif test_geometry("LINESTRING(3 0,2 1,3 2)","LINESTRING(0 0,3 4,4 3)", 3); @@ -37,14 +37,14 @@ void test_all_cartesian() } - template +template void test_all_geographic() { - typedef bg::model::linestring

linestring_2d; + using linestring_2d = bg::model::linestring

; #ifdef BOOST_GEOMETRY_TEST_DEBUG - typedef typename coordinate_system

::type CordType; - std::cout << typeid(CordType).name() << std::endl; + using coor_t = bg::coordinate_system_t

; + std::cout << typeid(coor_t).name() << std::endl; #endif test_geometry("LINESTRING(3 0,2 1,3 2)","LINESTRING(0 0,3 4,4 3)", 333958); @@ -59,14 +59,14 @@ void test_all_geographic() } - template +template void test_all_spherical_equ() { - typedef bg::model::linestring

linestring_2d; + using linestring_2d = bg::model::linestring

; #ifdef BOOST_GEOMETRY_TEST_DEBUG - typedef typename coordinate_system

::type CordType; - std::cout << typeid(CordType).name() << std::endl; + using coor_t = bg::coordinate_system_t

; + std::cout << typeid(coor_t).name() << std::endl; #endif test_geometry("LINESTRING(3 0,2 1,3 2)","LINESTRING(0 0,3 4,4 3)", 0.05235987); diff --git a/test/algorithms/similarity/discrete_hausdorff_distance.cpp b/test/algorithms/similarity/discrete_hausdorff_distance.cpp index d5d98cdcb..9da820272 100644 --- a/test/algorithms/similarity/discrete_hausdorff_distance.cpp +++ b/test/algorithms/similarity/discrete_hausdorff_distance.cpp @@ -23,16 +23,16 @@ #include "test_hausdorff_distance.hpp" - template +template void test_all_cartesian() { - typedef bg::model::linestring

linestring_2d; - typedef bg::model::multi_linestring mlinestring_t; - typedef bg::model::multi_point

mpoint_t; + using linestring_2d = bg::model::linestring

; + using mlinestring_t = bg::model::multi_linestring; + using mpoint_t = bg::model::multi_point

; #ifdef BOOST_GEOMETRY_TEST_DEBUG - typedef typename coordinate_system

::type CordType; - std::cout << typeid(CordType).name() << std::endl; + using coor_t = bg::coordinate_system_t

; + std::cout << typeid(coor_t).name() << std::endl; #endif test_geometry("POINT(3 1)","MULTIPOINT(0 0,3 4,4 3)", sqrt(5.0)); @@ -48,15 +48,16 @@ void test_all_cartesian() test_geometry("LINESTRING(0 0,3 4,4 3)","LINESTRING(4 3,3 4,0 0)",0); } - template +template void test_all_geographic() { - typedef bg::model::linestring

linestring_2d; - typedef bg::model::multi_linestring mlinestring_t; - typedef bg::model::multi_point

mpoint_t; + using linestring_2d = bg::model::linestring

; + using mlinestring_t = bg::model::multi_linestring; + using mpoint_t = bg::model::multi_point

; + #ifdef BOOST_GEOMETRY_TEST_DEBUG - typedef typename coordinate_system

::type CordType; - std::cout << typeid(CordType).name() << std::endl; + using coor_t = bg::coordinate_system_t

; + std::cout << typeid(coor_t).name() << std::endl; #endif test_geometry("POINT(3 1)","MULTIPOINT(0 0,3 4,4 3)", 247552); @@ -74,16 +75,16 @@ void test_all_geographic() test_geometry("LINESTRING(0 0,3 4,4 3)","LINESTRING(4 3,3 4,0 0)",0); } - template +template void test_all_spherical_equ() { - typedef bg::model::linestring

linestring_2d; - typedef bg::model::multi_linestring mlinestring_t; - typedef bg::model::multi_point

mpoint_t; + using linestring_2d = bg::model::linestring

; + using mlinestring_t = bg::model::multi_linestring; + using mpoint_t = bg::model::multi_point

; #ifdef BOOST_GEOMETRY_TEST_DEBUG - typedef typename coordinate_system

::type CordType; - std::cout << typeid(CordType).name() << std::endl; + using coor_t = bg::coordinate_system_t

; + std::cout << typeid(coor_t).name() << std::endl; #endif test_geometry("POINT(3 1)","MULTIPOINT(0 0,3 4,4 3)", 0.03902); diff --git a/test/concepts/point_concept_checker.cpp b/test/concepts/point_concept_checker.cpp index ea51a2e96..0b6b439a2 100644 --- a/test/concepts/point_concept_checker.cpp +++ b/test/concepts/point_concept_checker.cpp @@ -30,9 +30,9 @@ struct rw_point namespace boost { namespace geometry { namespace traits { -template <> struct tag { typedef point_tag type; }; -template <> struct coordinate_type { typedef float type; }; -template <> struct coordinate_system { typedef cs::cartesian type; }; +template <> struct tag { using type = point_tag; }; +template <> struct coordinate_type { using type = float; }; +template <> struct coordinate_system { using type = cs::cartesian; }; template <> struct dimension { enum { value = 2 }; }; template <> struct access @@ -48,9 +48,9 @@ template <> struct access -template <> struct tag { typedef point_tag type; }; -template <> struct coordinate_type { typedef float type; }; -template <> struct coordinate_system { typedef cs::cartesian type; }; +template <> struct tag { using type = point_tag; }; +template <> struct coordinate_type { using type = float; }; +template <> struct coordinate_system { using type = cs::cartesian; }; template <> struct dimension { enum { value = 2 }; }; template <> struct access diff --git a/test/concepts/point_well_formed_traits.cpp b/test/concepts/point_well_formed_traits.cpp index fc4ab82f2..d0f8352bf 100644 --- a/test/concepts/point_well_formed_traits.cpp +++ b/test/concepts/point_well_formed_traits.cpp @@ -27,19 +27,19 @@ namespace boost { namespace geometry { namespace traits { template <> struct tag { - typedef point_tag type; + using type = point_tag; }; template <> struct coordinate_type { - typedef float type; + using type = float; }; template <> struct coordinate_system { - typedef bg::cs::cartesian type; + using type = bg::cs::cartesian; }; template <> diff --git a/test/concepts/point_with_incorrect_dimension.cpp b/test/concepts/point_with_incorrect_dimension.cpp index 79ffc8bee..592986388 100644 --- a/test/concepts/point_with_incorrect_dimension.cpp +++ b/test/concepts/point_with_incorrect_dimension.cpp @@ -28,9 +28,9 @@ struct point namespace boost { namespace geometry { namespace traits { -template <> struct tag { typedef point_tag type; }; -template <> struct coordinate_type { typedef float type; }; -template <> struct coordinate_system { typedef bg::cs::cartesian type; }; +template <> struct tag { using type = point_tag; }; +template <> struct coordinate_type { using type = float; }; +template <> struct coordinate_system { using type = bg::cs::cartesian; }; template <> struct dimension { enum { value = 3 }; }; template <> struct access diff --git a/test/concepts/point_without_coordinate_type.cpp b/test/concepts/point_without_coordinate_type.cpp index 3896e4690..af852ec65 100644 --- a/test/concepts/point_without_coordinate_type.cpp +++ b/test/concepts/point_without_coordinate_type.cpp @@ -25,9 +25,9 @@ struct point namespace boost { namespace geometry { namespace traits { -template <> struct tag { typedef point_tag type; }; -//template <> struct coordinate_type { typedef float type; }; -template <> struct coordinate_system { typedef bg::cs::cartesian type; }; +template <> struct tag { using type = point_tag; }; +//template <> struct coordinate_type { using type = float; }; +template <> struct coordinate_system { using type = bg::cs::cartesian; }; template <> struct dimension { enum { value = 2 }; }; template <> struct access diff --git a/test/concepts/point_without_dimension.cpp b/test/concepts/point_without_dimension.cpp index 11182ed2b..eb910b1b4 100644 --- a/test/concepts/point_without_dimension.cpp +++ b/test/concepts/point_without_dimension.cpp @@ -26,9 +26,9 @@ struct point namespace boost { namespace geometry { namespace traits { -template <> struct tag { typedef point_tag type; }; -template <> struct coordinate_type { typedef float type; }; -template <> struct coordinate_system { typedef bg::cs::cartesian type; }; +template <> struct tag { using type = point_tag; }; +template <> struct coordinate_type { using type = float; }; +template <> struct coordinate_system { using type = bg::cs::cartesian; }; //template <> struct dimension { enum { value = 2 }; }; template <> struct access diff --git a/test/concepts/point_without_getter.cpp b/test/concepts/point_without_getter.cpp index 5d19924e2..ee74aedce 100644 --- a/test/concepts/point_without_getter.cpp +++ b/test/concepts/point_without_getter.cpp @@ -25,9 +25,9 @@ struct point namespace boost { namespace geometry { namespace traits { -template <> struct tag { typedef point_tag type; }; -template <> struct coordinate_type { typedef float type; }; -template <> struct coordinate_system { typedef bg::cs::cartesian type; }; +template <> struct tag { using type = point_tag; }; +template <> struct coordinate_type { using type = float; }; +template <> struct coordinate_system { using type = bg::cs::cartesian; }; template <> struct dimension { enum { value = 2 }; }; template <> struct access diff --git a/test/concepts/point_without_setter.cpp b/test/concepts/point_without_setter.cpp index 78be83994..3978db266 100644 --- a/test/concepts/point_without_setter.cpp +++ b/test/concepts/point_without_setter.cpp @@ -25,9 +25,9 @@ struct point namespace boost { namespace geometry { namespace traits { -template <> struct tag { typedef point_tag type; }; -template <> struct coordinate_type { typedef float type; }; -template <> struct coordinate_system { typedef bg::cs::cartesian type; }; +template <> struct tag { using type = point_tag; }; +template <> struct coordinate_type { using type = float; }; +template <> struct coordinate_system { using type = bg::cs::cartesian; }; template <> struct dimension { enum { value = 2 }; }; template <> struct access diff --git a/test/core/ring.cpp b/test/core/ring.cpp index cf7ee5d7e..bd7b722d8 100644 --- a/test/core/ring.cpp +++ b/test/core/ring.cpp @@ -52,9 +52,9 @@ void test_ring(std::string const& wkt, std::size_t expected_interior_ring_count, std::size_t expected_first_interior_count) { - typedef bg::model::polygon

the_polygon; - typedef typename bg::ring_type::type the_ring; - typedef typename bg::interior_return_type::type the_interior; + using the_polygon = bg::model::polygon

; + using the_ring = bg::ring_type_t; + using the_interior = bg::interior_return_type_t; the_polygon poly; bg::read_wkt(wkt, poly); diff --git a/test/formulas/intersection.cpp b/test/formulas/intersection.cpp index 4ab53aa24..54069a3d5 100644 --- a/test/formulas/intersection.cpp +++ b/test/formulas/intersection.cpp @@ -1,6 +1,8 @@ // Boost.Geometry // Unit Test +// Copyright (c) 2025 Adam Wulkiewicz, Lodz, Poland. + // Copyright (c) 2016-2019 Oracle and/or its affiliates. // Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle @@ -185,6 +187,19 @@ void test_bugs() } } +void test_special_cases() +{ + { + double lon, lat; + bg::formula::sjoberg_intersection + ::apply(-0.01, 0.0, 0.01, 0.0, + 0.0, -0.01, 0.0, 0.01, + lon, lat, bg::srs::spheroid()); + check_one("geodesic on equator", lon, 0.0); + check_one("geodesic on equator", lat, 0.0); + } +} + int test_main(int, char*[]) { for (size_t i = 0; i < expected_size; ++i) @@ -193,6 +208,7 @@ int test_main(int, char*[]) } test_bugs(); + test_special_cases(); return 0; } diff --git a/test/geometries/concepts/check.cpp b/test/geometries/concepts/check.cpp index 07b344295..d5414ccbd 100644 --- a/test/geometries/concepts/check.cpp +++ b/test/geometries/concepts/check.cpp @@ -30,9 +30,9 @@ struct rw_point namespace boost { namespace geometry { namespace traits { -template <> struct tag { typedef point_tag type; }; -template <> struct coordinate_type { typedef float type; }; -template <> struct coordinate_system { typedef bg::cs::cartesian type; }; +template <> struct tag { using type = point_tag; }; +template <> struct coordinate_type { using type = float; }; +template <> struct coordinate_system { using type = bg::cs::cartesian; }; template <> struct dimension { enum { value = 2 }; }; template <> struct access @@ -48,9 +48,9 @@ template <> struct access -template <> struct tag { typedef point_tag type; }; -template <> struct coordinate_type { typedef float type; }; -template <> struct coordinate_system { typedef bg::cs::cartesian type; }; +template <> struct tag { using type = point_tag; }; +template <> struct coordinate_type { using type = float; }; +template <> struct coordinate_system { using type = bg::cs::cartesian; }; template <> struct dimension { enum { value = 2 }; }; template <> struct access diff --git a/test/geometry_test_common.hpp b/test/geometry_test_common.hpp index a19f994bf..0dc0ab0b6 100644 --- a/test/geometry_test_common.hpp +++ b/test/geometry_test_common.hpp @@ -213,32 +213,4 @@ inline void BoostGeometryWriteTestConfiguration() std::cout << std::endl; } -#ifdef BOOST_GEOMETRY_TEST_FAILURES -#define BG_NO_FAILURES 0 -inline void BoostGeometryWriteExpectedFailures(std::size_t for_double, - std::size_t for_float, - std::size_t for_extended) -{ - std::size_t const expected - = if_typed(for_double, - if_typed(for_float, - for_extended)); - - boost::ignore_unused(expected, for_double, for_float, for_extended); - - -#if defined(BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE) && defined(BOOST_GEOMETRY_TEST_ONLY_ONE_ORDER) - std::cout << "Expected: " << expected << " error(s)" << std::endl; -#else - std::cout << std::endl; -#endif -} - -inline void BoostGeometryWriteExpectedFailures(std::size_t for_double = BG_NO_FAILURES) -{ - BoostGeometryWriteExpectedFailures(for_double, for_double, for_double); -} - -#endif - #endif // GEOMETRY_TEST_GEOMETRY_TEST_COMMON_HPP diff --git a/test/robustness/CMakeLists.txt b/test/robustness/CMakeLists.txt index 9ad40d9f2..60ce71d61 100644 --- a/test/robustness/CMakeLists.txt +++ b/test/robustness/CMakeLists.txt @@ -5,6 +5,37 @@ # Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) + +function(boost_geometry_add_robustness_test item) + set(robustness_test_name "boost_geometry_robustness_${item}") + add_executable(${robustness_test_name} ${item}.cpp) + + # Add a dependency to Boost.Geometry + target_link_libraries(${robustness_test_name} + PRIVATE + Boost::geometry) + + # Include the main Geometry test folder and the current folder, + # and the robustness test folder + target_include_directories(${robustness_test_name} + PRIVATE + "${PROJECT_SOURCE_DIR}/test/robustness" + "${PROJECT_SOURCE_DIR}/test" + "${PROJECT_SOURCE_DIR}/index/test" + .) + + # To compile with C++14 + target_compile_features(${robustness_test_name} PRIVATE cxx_std_14) + + # Add a dependency to the global robustness tests target + add_dependencies(robustness_tests ${robustness_test_name}) + +endfunction() + +if (NOT TARGET robustness_tests) + add_custom_target(robustness_tests) +endif() + add_subdirectory(convex_hull) add_subdirectory(overlay) #add_subdirectory(within) diff --git a/test/robustness/common/make_square_polygon.hpp b/test/robustness/common/make_square_polygon.hpp index 2127a6b17..bb84af463 100644 --- a/test/robustness/common/make_square_polygon.hpp +++ b/test/robustness/common/make_square_polygon.hpp @@ -23,7 +23,7 @@ inline void make_square_polygon(Polygon& polygon, Generator& generator, Settings x = generator(); y = generator(); - typename ring_type::type& ring = exterior_ring(polygon); + auto& ring = exterior_ring(polygon); point_type p; set<0>(p, x); set<1>(p, y); append(ring, p); diff --git a/test/robustness/overlay/areal_areal/CMakeLists.txt b/test/robustness/overlay/areal_areal/CMakeLists.txt index f01e7c688..2b7161cd4 100644 --- a/test/robustness/overlay/areal_areal/CMakeLists.txt +++ b/test/robustness/overlay/areal_areal/CMakeLists.txt @@ -1,24 +1,24 @@ # Boost.Geometry +# +# Copyright (c) 2025 Barend Gehrels, Amsterdam, the Netherlands. # Copyright (c) 2024, Oracle and/or its affiliates. # Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle +# # Use, modification and distribution is subject to the Boost Software License, # Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) foreach(item IN ITEMS - #general_intersection_precision + general_intersection_precision interior_triangles intersection_pies intersection_stars intersects + random_bitset_grids random_ellipses_stars recursive_polygons star_comb #ticket_9081 ) - boost_geometry_add_unit_test("robustness" ${item}) - target_include_directories(${BOOST_GEOMETRY_UNIT_TEST_NAME} - PRIVATE - "${PROJECT_SOURCE_DIR}/test/robustness" - .) + boost_geometry_add_robustness_test(${item}) endforeach() diff --git a/test/robustness/overlay/areal_areal/Jamfile b/test/robustness/overlay/areal_areal/Jamfile index 96e42656d..71ed82798 100644 --- a/test/robustness/overlay/areal_areal/Jamfile +++ b/test/robustness/overlay/areal_areal/Jamfile @@ -25,4 +25,4 @@ exe recursive_polygons : recursive_polygons.cpp ; exe star_comb : star_comb.cpp ; exe ticket_9081 : ticket_9081.cpp ; - +exe random_bitset_grids : random_bitset_grids.cpp ; diff --git a/test/robustness/overlay/areal_areal/general_intersection_precision.cpp b/test/robustness/overlay/areal_areal/general_intersection_precision.cpp index b071e58b6..0eda9f35f 100644 --- a/test/robustness/overlay/areal_areal/general_intersection_precision.cpp +++ b/test/robustness/overlay/areal_areal/general_intersection_precision.cpp @@ -12,17 +12,19 @@ // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) +#define BOOST_GEOMETRY_NO_BOOST_TEST + #include #include #include #include #include -#include - #include #include +#include + // Basic case. Union should deliver 22.0 static std::string case_a[2] = { @@ -207,18 +209,17 @@ std::size_t test_all(std::size_t case_index, std::size_t min_vertex_index, std::cout << case_index << " #cases: " << n << " #errors: " << error_count << std::endl; - BOOST_CHECK_EQUAL(error_count, 0u); return error_count; } -int test_main(int argc, char** argv) +int main(int argc, char** argv) { BoostGeometryWriteTestConfiguration(); using coor_t = default_test_type; test_settings settings; - settings.do_output = argc > 2 && atol(argv[2]) == 1; + settings.do_output = true; // Test three polygons, for the last test two types of intersections test_all(1, 0, 3, 22.0, settings); diff --git a/test/robustness/overlay/areal_areal/random_bitset_grids.cpp b/test/robustness/overlay/areal_areal/random_bitset_grids.cpp new file mode 100644 index 000000000..674a26e23 --- /dev/null +++ b/test/robustness/overlay/areal_areal/random_bitset_grids.cpp @@ -0,0 +1,381 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// Robustness Test + +// Copyright (c) 2025 Tinko Bartels, Shenzhen, China. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#define BOOST_GEOMETRY_NO_BOOST_TEST + +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include + +#define BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE +#ifndef BOOST_GEOMETRY_DEFAULT_TEST_TYPE +#define BOOST_GEOMETRY_DEFAULT_TEST_TYPE int +#endif +#include + +constexpr int chunk_size = 64; +using bits = std::vector>; +using generator_t = std::mt19937_64; +static_assert(sizeof(generator_t::result_type) >= chunk_size / 8, "Generator output too narrow."); + +namespace bg = boost::geometry; + +using point = bg::model::d2::point_xy; +using box = bg::model::box; +using mp_t = bg::model::multi_polygon>; + +struct grid_settings +{ + int width = 5; + int height = 5; + int count = 1; + generator_t::result_type seed = generator_t::default_seed; + bool verbose = false; + std::vector bits1{}; + std::vector bits2{}; +}; + +constexpr int cell_dimension = 2; + +std::vector grid_cells(grid_settings const& settings) +{ + std::vector out; + out.reserve(settings.height * settings.width); + for (int y = 0; y < settings.height; ++y) + { + for (int x = 0; x < settings.width; ++x) + { + out.push_back(box{point(x * cell_dimension, y * cell_dimension), + point((x + 1) * cell_dimension, (y + 1) * cell_dimension)}); + } + } + return out; +} + +std::vector test_points(grid_settings const& settings) +{ + std::vector out; + out.reserve(settings.height * settings.width); + for (int y = 0; y < settings.height; ++y) + { + for (int x = 0; x < settings.width; ++x) + { + out.push_back(point(x * cell_dimension + cell_dimension / 2, + y * cell_dimension + cell_dimension / 2)); + } + } + return out; +} + +std::ostream& operator<<(std::ostream& os, std::pair const& b_gs) +{ + if (b_gs.second.verbose) + { + os << '\n'; + for (int y = b_gs.second.height - 1; y >= 0; --y) + { + for (int x = 0; x < b_gs.second.width; ++x) + { + int index = y * b_gs.second.width + x; + os << b_gs.first[index / chunk_size][index % chunk_size]; + } + os << '\n'; + } + } + else + { + os << '{' << b_gs.first[0].to_ullong(); + for (size_t i = 1; i < b_gs.first.size(); ++i) os << ' ' << b_gs.first[i].to_ullong(); + os << '}'; + } + return os; +} + +bits geometry_to_bits(mp_t const& geometry, std::vector const& test_points) +{ + bits out((test_points.size() + chunk_size - 1) / chunk_size); + for (size_t i = 0; i < test_points.size(); ++i) + { + out[i / chunk_size][i % chunk_size] = bg::within(test_points[i], geometry); + } + return out; +} + +mp_t bits_to_geometry(bits const& b, std::vector const& grid, std::vector const& points, + grid_settings const& settings, std::map& failures) +{ + mp_t out; + for (size_t i = 0; i < grid.size(); ++i) + { + if (b[i / chunk_size][i % chunk_size]) + { + mp_t temp; + bg::union_(out, grid[i], temp); + out = std::move(temp); + } + } + // Convenience lambda to pair bits with settings to use width/height in operator<<(os, ...) + const auto b_gs = [&settings](bits const& b) { return std::make_pair(b, settings); }; + std::string reason{}; + if (! bg::is_valid(out, reason)) + { + if (settings.verbose) + { + std::cout << bg::wkt(out) << "\ngenerated from" << b_gs(b) + << "is invalid: " << reason << ".\n\n"; + } + else std::cout << b_gs(b) << " invalid (" << reason << ")\n"; + ++failures["bits_to_geometry validity"]; + } + if (geometry_to_bits(out, points) != b) + { + if (settings.verbose) + { + std::cout << "Generating grid from pattern" << b_gs(b) + << "results in mismatching geometry: " << bg::wkt(out) << ".\n\n"; + } + else std::cout << b_gs(b) << " mismatch.\n"; + ++failures["bits_to_geometry mismatch"]; + } + return out; +} + +bits gen_bits(generator_t& generator, int bits_size) +{ + bits b((bits_size + chunk_size - 1) / chunk_size); + std::generate(b.begin(), b.end(), std::ref(generator)); + if (bits_size % chunk_size != 0) + { + std::bitset bm; + bm.set(); + bm >>= chunk_size - bits_size % chunk_size; + b.back() &= bm; + } + return b; +} + +bits to_bits(std::vector const& in) +{ + bits out; + out.reserve(in.size()); + for (auto const& ullong : in) out.push_back(std::bitset(ullong)); + return out; +} + +template +bits apply_for_each(bits a, bits const& b, BitOp const& bit_op) +{ + for (size_t i = 0; i < a.size(); ++i) a[i] = bit_op(a[i], b[i]); + return a; +} + +template +void test_op(bits const& bits1, bits const& bits2, mp_t const& geo1, mp_t const& geo2, + std::string const& op_label, BitOp const& bit_op, GeoOp const& geo_op, + std::vector const& test_points, std::vector const& grid, + grid_settings const& settings, std::map& failures) +{ + auto test_geo = geo_op(geo1, geo2); + // Convenience lambda to pair bits with settings to use width/height in operator<<(os, ...) + const auto b_gs = [&settings](bits const& b) { return std::make_pair(b, settings); }; + std::string reason{}; + if (! bg::is_valid(test_geo, reason)) + { + if (settings.verbose) + { + std::cout << op_label << "(\n\t" << bg::wkt(geo1) << ",\n\t " << bg::wkt(geo2) << "\n)," + << "\ngenerated from" << b_gs(bits1) << "and" << b_gs(bits2) << "is invalid: " + << reason << ".\n\n"; + } + else + { + std::cout << op_label << '(' << b_gs(bits1) << ", " << b_gs(bits2) << " invalid (" + << reason << ").\n"; + } + ++failures[op_label + " validity"]; + } + const bits expected = apply_for_each(bits1, bits2, bit_op); + const bits obtained = geometry_to_bits(test_geo, test_points); + if (obtained != expected) + { + if (settings.verbose) + { + std::cout << op_label << "(\n\t" << bg::wkt(geo1) << ",\n\t" << bg::wkt(geo2) << "\n)," + << "\ngenerated from" << b_gs(bits1) << "and" << b_gs(bits2) + << "is incorrect.\nExpected: " + << bg::wkt(bits_to_geometry(expected, grid, test_points, settings, failures)) + << "\ncorresponding to" << b_gs(expected) << "Obtained: " + << bg::wkt(test_geo) << "\ncorresponding to" << b_gs(obtained) << "\n"; + } + else std::cout << op_label << '(' << b_gs(bits1) << ", " << b_gs(bits2) << ") mismatch.\n"; + ++failures[op_label + " mismatch"]; + } +} + +void test_bits(bits const& bits1, bits const& bits2, + std::vector const& grid, std::vector const& test_points, + grid_settings const& settings, std::map& failures) +{ + const auto geo1 = bits_to_geometry(bits1, grid, test_points, settings, failures); + const auto geo2 = bits_to_geometry(bits2, grid, test_points, settings, failures); + test_op(bits1, bits2, geo1, geo2, "union", std::bit_or<>{}, + [](mp_t const& g1, mp_t const& g2) { mp_t g; bg::union_(g1, g2, g); return g; }, + test_points, grid, settings, failures); + test_op(bits1, bits2, geo1, geo2, "intersection", std::bit_and<>{}, + [](mp_t const& g1, mp_t const& g2) { mp_t g; bg::intersection(g1, g2, g); return g; }, + test_points, grid, settings, failures); + test_op(bits1, bits2, geo1, geo2, "sym_difference", std::bit_xor<>{}, + [](mp_t const& g1, mp_t const& g2) { mp_t g; bg::sym_difference(g1, g2, g); return g; }, + test_points, grid, settings, failures); + test_op(bits1, bits2, geo1, geo2, "difference g1 \\ g2", + [](std::bitset b1, std::bitset b2) { return b1 & (~b2); }, + [](mp_t const& g1, mp_t const& g2) { mp_t g; bg::difference(g1, g2, g); return g; }, + test_points, grid, settings, failures); + test_op(bits1, bits2, geo1, geo2, "difference g2 \\ g1", + [](std::bitset b1, std::bitset b2) { return b2 & (~b1); }, + [](mp_t const& g1, mp_t const& g2) { mp_t g; bg::difference(g2, g1, g); return g; }, + test_points, grid, settings, failures); +} + +bool test_all(grid_settings const& settings) +{ + generator_t genenerator(settings.seed); + const auto grid = grid_cells(settings); + const auto points = test_points(settings); + std::map failures; + auto const t0 = std::chrono::high_resolution_clock::now(); + for (int i = 0; i < settings.count || settings.count == -1; i++) + { + const bits bits1 = settings.bits1.size() == 0 ? + gen_bits(genenerator, settings.width * settings.height) + : to_bits(settings.bits1); + const bits bits2 = settings.bits2.size() == 0 ? + gen_bits(genenerator, settings.width * settings.height) + : to_bits(settings.bits2); + test_bits(bits1, bits2, grid, points, settings, failures); + } + auto const t = std::chrono::high_resolution_clock::now(); + auto const elapsed_ms = std::chrono::duration_cast(t - t0).count(); + int failure_count = std::accumulate(failures.begin(), failures.end(), 0, + [](int acc, auto const& kv) { return acc + kv.second; }); + std::cout << "\niterations: " << settings.count + << " errors: " << failure_count + << " time: " << elapsed_ms / 1000.0 << '\n'; + if (failure_count != 0) + { + std::cout << "Failure counts by failure mode:\n"; + for (auto const& fm : failures) std::cout << '\t' << fm.first << ": " << fm.second << '\n'; + } + return failure_count == 0; +} + +bool validate_bits_input(std::vector const& bits_in, size_t bits_size) +{ + if (bits_in.size() == 0) return true; + if (bits_in.size() != (bits_size + chunk_size - 1) / chunk_size) return false; + if (bits_size % chunk_size != 0) + { + std::bitset bm; + bm.set(); + bm >>= chunk_size - bits_size % chunk_size; + if (bits_in.back() & ~bm.to_ullong()) return false; + } + return true; +} + +int main(int argc, char** argv) +{ + BoostGeometryWriteTestConfiguration(); + try + { + namespace po = boost::program_options; + po::options_description description("=== random_integer_grids ===\nAllowed options"); + + grid_settings settings; + + description.add_options() + ("help", "Help message") + ("seed", + po::value(&settings.seed)->default_value(settings.seed), + "Initialization seed for random generator") + ("count", + po::value(&settings.count)->default_value(settings.count), + "Number of tests (-1 for infinite loop)") + ("width", + po::value(&settings.width)->default_value(settings.width), + "Width of grid (>= 1)") + ("height", + po::value(&settings.height)->default_value(settings.height), + "Height of grid (>= 1)") + ("verbose", + po::bool_switch(&settings.verbose), + "Print WKT and bit patterns for each failure.") + ("bits1", + po::value(&settings.bits1)->multitoken(), + "Fixed bit pattern for first operand as list of ullong.") + ("bits2", + po::value(&settings.bits2)->multitoken(), + "Fixed bit pattern for second operand as list of ullong.") + ; + + po::variables_map varmap; + po::store(po::parse_command_line(argc, argv, description), varmap); + po::notify(varmap); + + if (! validate_bits_input(settings.bits1, settings.height * settings.width)) + { + std::cout << "bits1 was provided but does not match dimensions.\n"; + return 1; + } + if (! validate_bits_input(settings.bits2, settings.height * settings.width)) + { + std::cout << "bits2 was provided but does not match dimensions.\n"; + return 1; + } + if (settings.bits1.size() != 0 && settings.bits2.size() != 0 && settings.count != 1) + { + std::cout << "Both bit patterns fixed, count is changed to 1.\n"; + settings.count = 1; + } + if (settings.height < 1 || settings.width < 1) + { + std::cout << "Invalid dimensions, height and width need to be positive.\n"; + return 1; + } + if (varmap.count("help")) + { + std::cout << description << std::endl; + return 1; + } + if (! test_all(settings)) return 1; + } + catch (std::exception const& e) + { + std::cout << "Exception " << e.what() << '\n'; + } + catch (...) + { + std::cout << "Other exception" << '\n'; + } + + return 0; +} diff --git a/test/robustness/overlay/buffer/CMakeLists.txt b/test/robustness/overlay/buffer/CMakeLists.txt index 23b109581..ceda3cc73 100644 --- a/test/robustness/overlay/buffer/CMakeLists.txt +++ b/test/robustness/overlay/buffer/CMakeLists.txt @@ -10,9 +10,5 @@ foreach(item IN ITEMS #multi_point_growth recursive_polygons_buffer ) - boost_geometry_add_unit_test("robustness" ${item}) - target_include_directories(${BOOST_GEOMETRY_UNIT_TEST_NAME} - PRIVATE - "${PROJECT_SOURCE_DIR}/test/robustness" - .) + boost_geometry_add_robustness_test(${item}) endforeach() diff --git a/test/robustness/overlay/buffer/recursive_polygons_buffer.cpp b/test/robustness/overlay/buffer/recursive_polygons_buffer.cpp index 0369d5d61..1c5235461 100644 --- a/test/robustness/overlay/buffer/recursive_polygons_buffer.cpp +++ b/test/robustness/overlay/buffer/recursive_polygons_buffer.cpp @@ -79,45 +79,52 @@ void create_svg(std::string const& filename mapper.map(buffer, "stroke-opacity:0.9;stroke:rgb(0,0,0);fill:none;stroke-width:1"); } -template -bool verify(std::string const& caseid, MultiPolygon const& mp, MultiPolygon const& buffer, Settings const& settings) +template +bool verify_buffer(Geometry const& geometry, Buffer const& buffer, std::string& reason, bool check_validity) { - using polygon_type = typename boost::range_value::type; - - bool result = true; + if (buffer.empty()) + { + reason = "Buffer is empty"; + return false; + } // Area of buffer must be larger than of original polygon - auto const area_mp = bg::area(mp); + auto const area_mp = bg::area(geometry); auto const area_buf = bg::area(buffer); - if (area_buf < area_mp) { - result = false; + reason = "Buffer area is smaller than input area"; + return false; } // Verify if all points are IN the buffer - if (result) + bool all_within = true; + bg::for_each_point(geometry, [&all_within, &buffer](auto const& point) { - for (auto const& polygon : mp) + if (! bg::within(point, buffer)) { - typename bg::point_type::type point; - bg::point_on_border(point, polygon); - if (! bg::within(point, buffer)) - { - result = false; - } + all_within = false; } + }); + + if (! all_within) + { + reason = "Any input points are outside the buffer"; + return false; } - if (result && settings.check_validity) + return check_validity ? bg::is_valid(buffer, reason) : true; +} + +template +bool verify(std::string const& caseid, Geometry const& geometry, MultiPolygon const& buffer, Settings const& settings) +{ + std::string reason; + bool const result = verify_buffer(geometry, buffer, reason, settings.check_validity); + + if (! result) { - bg::validity_failure_type failure; - if (! bg::is_valid(buffer, failure) - && failure != bg::failure_intersecting_interiors) - { - std::cout << "Buffer is not valid: " << bg::validity_failure_type_message(failure) << std::endl; - result = false; - } + std::cout << caseid << " " << reason << std::endl; } bool svg = settings.svg; @@ -134,7 +141,7 @@ bool verify(std::string const& caseid, MultiPolygon const& mp, MultiPolygon cons { // Generate a unique name std::ostringstream out; - out << "rec_pol_buffer_" << geometry_to_crc(mp) + out << "rec_pol_buffer_" << geometry_to_crc(geometry) << "_" << string_from_type::type>::name() << "."; filename = out.str(); @@ -142,14 +149,14 @@ bool verify(std::string const& caseid, MultiPolygon const& mp, MultiPolygon cons if (svg) { - create_svg(filename + "svg", mp, buffer); + create_svg(filename + "svg", geometry, buffer); } if (wkt) { std::ofstream stream(filename + "wkt"); // Stream input WKT - stream << bg::wkt(mp) << std::endl; + stream << bg::wkt(geometry) << std::endl; // If you need the output WKT, then stream bg::wkt(buffer) } diff --git a/test/test_common/test_point.hpp b/test/test_common/test_point.hpp index 42a0f11b4..49fc41fb0 100644 --- a/test/test_common/test_point.hpp +++ b/test/test_common/test_point.hpp @@ -56,13 +56,13 @@ struct test_const_point namespace boost { namespace geometry { namespace traits { template<> -struct tag { typedef point_tag type; }; +struct tag { using type = point_tag; }; template<> -struct coordinate_type { typedef float type; }; +struct coordinate_type { using type = float; }; template<> -struct coordinate_system { typedef cs::cartesian type; }; +struct coordinate_system { using type = cs::cartesian; }; template<> struct dimension : std::integral_constant {}; diff --git a/test/test_common/with_pointer.hpp b/test/test_common/with_pointer.hpp index 1e77e0e64..34641197a 100644 --- a/test/test_common/with_pointer.hpp +++ b/test/test_common/with_pointer.hpp @@ -45,13 +45,13 @@ struct test_point_xy namespace boost { namespace geometry { namespace traits { template<> struct tag -{ typedef point_tag type; }; +{ using type = point_tag; }; template<> struct coordinate_type -{ typedef double type; }; +{ using type = double; }; template<> struct coordinate_system -{ typedef cs::cartesian type; }; +{ using type = cs::cartesian; }; template<> struct dimension : std::integral_constant {}; diff --git a/test/test_geometries/all_custom_linestring.hpp b/test/test_geometries/all_custom_linestring.hpp index a2a3c4a12..034b90e93 100644 --- a/test/test_geometries/all_custom_linestring.hpp +++ b/test/test_geometries/all_custom_linestring.hpp @@ -37,7 +37,7 @@ namespace traits template struct tag > { - typedef linestring_tag type; + using type = linestring_tag; }; diff --git a/test/test_geometries/all_custom_polygon.hpp b/test/test_geometries/all_custom_polygon.hpp index 7e385f971..2b2e0ccc5 100644 --- a/test/test_geometries/all_custom_polygon.hpp +++ b/test/test_geometries/all_custom_polygon.hpp @@ -55,7 +55,7 @@ namespace traits template struct tag > { - typedef polygon_tag type; + using type = polygon_tag; }; template diff --git a/test/test_geometries/all_custom_ring.hpp b/test/test_geometries/all_custom_ring.hpp index e49acea9b..d423863e4 100644 --- a/test/test_geometries/all_custom_ring.hpp +++ b/test/test_geometries/all_custom_ring.hpp @@ -42,7 +42,7 @@ namespace traits template struct tag > { - typedef ring_tag type; + using type = ring_tag; }; diff --git a/test/test_geometries/const_point.hpp b/test/test_geometries/const_point.hpp index 8a1b9c757..d138ce84a 100644 --- a/test/test_geometries/const_point.hpp +++ b/test/test_geometries/const_point.hpp @@ -31,7 +31,7 @@ using ring_of_const_point = std::vector; // Register a vector of const_pos as a non-const-ring with const points namespace boost { namespace geometry { namespace traits { - template<> struct tag { typedef ring_tag type; }; + template<> struct tag { using type = ring_tag; }; }}} @@ -39,7 +39,7 @@ using linestring_of_const_point = std::deque; // Register a vector of const_pos as a non-const-ring with const points namespace boost { namespace geometry { namespace traits { - template<> struct tag { typedef linestring_tag type; }; + template<> struct tag { using type = linestring_tag; }; }}} diff --git a/test/test_geometries/copy_on_dereference_geometries.hpp b/test/test_geometries/copy_on_dereference_geometries.hpp index 2d7d9d6ed..e2be7cec5 100644 --- a/test/test_geometries/copy_on_dereference_geometries.hpp +++ b/test/test_geometries/copy_on_dereference_geometries.hpp @@ -160,13 +160,13 @@ namespace traits template struct tag< multipoint_copy_on_dereference > { - typedef multi_point_tag type; + using type = multi_point_tag; }; template struct tag< linestring_copy_on_dereference > { - typedef linestring_tag type; + using type = linestring_tag; }; } // namespace traits diff --git a/test/test_geometries/custom_lon_lat_point.hpp b/test/test_geometries/custom_lon_lat_point.hpp index 5c0dc0d9d..591f97de2 100644 --- a/test/test_geometries/custom_lon_lat_point.hpp +++ b/test/test_geometries/custom_lon_lat_point.hpp @@ -32,7 +32,7 @@ namespace boost { namespace geometry { namespace traits template struct tag > { - typedef point_tag type; + using type = point_tag; }; template @@ -90,7 +90,7 @@ namespace boost { namespace geometry { namespace traits template struct tag > { - typedef point_tag type; + using type = point_tag; }; template diff --git a/test/test_geometries/wrapped_boost_array.hpp b/test/test_geometries/wrapped_boost_array.hpp index 9dc723589..bb8aab287 100644 --- a/test/test_geometries/wrapped_boost_array.hpp +++ b/test/test_geometries/wrapped_boost_array.hpp @@ -117,7 +117,7 @@ namespace boost { namespace geometry { namespace traits template struct tag< wrapped_boost_array > { - typedef linestring_tag type; + using type = linestring_tag; }; template