diff --git a/doc/src/examples/CMakeLists.txt b/doc/src/examples/CMakeLists.txt new file mode 100644 index 0000000000..da51662450 --- /dev/null +++ b/doc/src/examples/CMakeLists.txt @@ -0,0 +1,40 @@ +# Boost.Geometry + +# 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) + +function(boost_geometry_add_example prefix item) + set(example_name "boost_geometry_example_${prefix}_${item}") + add_executable(${example_name} ${item}.cpp) + + # Add a dependency to Boost.Geometry + target_link_libraries(${example_name} + PRIVATE + Boost::geometry + ) + + # Include the main Geometry test folder and the current folder + target_include_directories(${example_name} + PRIVATE + .) + + # To compile with C++14 + target_compile_features(${example_name} PRIVATE cxx_std_14) + +endfunction() + +foreach(item IN ITEMS + quick_start +) + boost_geometry_add_example("example" ${item}) +endforeach() + +add_subdirectory(algorithms) +add_subdirectory(core) +add_subdirectory(geometries) +add_subdirectory(io) +add_subdirectory(strategies) +add_subdirectory(views) diff --git a/doc/src/examples/algorithms/CMakeLists.txt b/doc/src/examples/algorithms/CMakeLists.txt new file mode 100644 index 0000000000..c184aac335 --- /dev/null +++ b/doc/src/examples/algorithms/CMakeLists.txt @@ -0,0 +1,73 @@ +# Boost.Geometry +# 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) + +foreach(item IN ITEMS + append + area + area_with_strategy + assign + assign_2d_point + assign_3d_point + assign_inverse + assign_points + buffer_with_strategies + centroid + clear + closest_points + closest_points_strategy + comparable_distance + convert + convex_hull + correct + densify + densify_strategy + discrete_frechet_distance + discrete_frechet_distance_strategy + discrete_hausdorff_distance + discrete_hausdorff_distance_strategy + difference + distance + envelope + equals + expand + for_each_point + for_each_point_const + for_each_segment_const + intersection_ls_ls_point + intersection_segment + intersects_linestring + is_simple + is_valid + is_valid_failure + is_valid_message + length + length_with_strategy + line_interpolate + line_interpolate_strategy + make_2d_point + make_3d_point + make_inverse + num_geometries + num_interior_rings + num_points + num_segments + return_envelope + relate + relation + reverse + simplify + sym_difference + transform + transform_with_strategy + union + unique + within + ) + + boost_geometry_add_example("algorithms" ${item}) + +endforeach() + diff --git a/doc/src/examples/algorithms/append.cpp b/doc/src/examples/algorithms/append.cpp index fd90a6a04d..93b703133f 100644 --- a/doc/src/examples/algorithms/append.cpp +++ b/doc/src/examples/algorithms/append.cpp @@ -1,7 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // QuickBook Example -// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2011-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 @@ -16,32 +16,30 @@ #include #include -#include /*< At the end to avoid conflicts with Boost.QVM >*/ - BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian) int main() { - using boost::assign::tuple_list_of; - using boost::make_tuple; using boost::geometry::append; - typedef boost::geometry::model::polygon > polygon; + using vector = std::vector>; + using polygon = boost::geometry::model::polygon>; polygon poly; // Append a range - append(poly, tuple_list_of(0, 0)(0, 10)(11, 11)(10, 0)); /*< tuple_list_of delivers a range and can therefore be used in boost::geometry::append >*/ + append(poly, vector{{0.0, 0.0}, {0.0, 10.0}, {11.0, 11.0}, {10.0, 0.0}}); /*< vector models a range and can therefore be used in boost::geometry::append >*/ // Append a point (in this case the closing point) - append(poly, make_tuple(0, 0)); + append(poly, boost::make_tuple(0, 0)); // Create an interior ring (append does not do this automatically) boost::geometry::interior_rings(poly).resize(1); // Append a range to the interior ring - append(poly, tuple_list_of(2, 2)(2, 5)(6, 6)(5, 2), 0); /*< The last parameter ring_index 0 denotes the first interior ring >*/ + append(poly, vector{{2, 2}, {2, 5}, {6, 6}, {5, 2}}, 0); /*< The last parameter ring_index 0 denotes the first interior ring >*/ + // Append a point to the first interior ring - append(poly, make_tuple(2, 2), 0); + append(poly, boost::make_tuple(2, 2), 0); std::cout << boost::geometry::dsv(poly) << std::endl; diff --git a/doc/src/examples/algorithms/area.cpp b/doc/src/examples/algorithms/area.cpp index 4297594a28..7c58ee7933 100644 --- a/doc/src/examples/algorithms/area.cpp +++ b/doc/src/examples/algorithms/area.cpp @@ -21,13 +21,13 @@ namespace bg = boost::geometry; /*< Convenient namespace alias >*/ int main() { // Calculate the area of a cartesian polygon - bg::model::polygon > poly; + bg::model::polygon> poly; bg::read_wkt("POLYGON((0 0,0 7,4 2,2 0,0 0))", poly); double area = bg::area(poly); std::cout << "Area: " << area << std::endl; // Calculate the area of a spherical equatorial polygon - bg::model::polygon > > sph_poly; + bg::model::polygon>> sph_poly; bg::read_wkt("POLYGON((0 0,0 45,45 0,0 0))", sph_poly); area = bg::area(sph_poly); std::cout << "Area: " << area << std::endl; diff --git a/doc/src/examples/algorithms/area_with_strategy.cpp b/doc/src/examples/algorithms/area_with_strategy.cpp index 8d7803d8bf..64288433ba 100644 --- a/doc/src/examples/algorithms/area_with_strategy.cpp +++ b/doc/src/examples/algorithms/area_with_strategy.cpp @@ -25,7 +25,7 @@ namespace bg = boost::geometry; /*< Convenient namespace alias >*/ int main() { // Create spherical polygon - bg::model::polygon > > sph_poly; + bg::model::polygon>> sph_poly; bg::read_wkt("POLYGON((0 0,0 1,1 0,0 0))", sph_poly); // Create spherical strategy with mean Earth radius in meters @@ -36,7 +36,7 @@ int main() std::cout << "Area: " << area << std::endl; // Create geographic polygon - bg::model::polygon > > geo_poly; + bg::model::polygon>> geo_poly; bg::read_wkt("POLYGON((0 0,0 1,1 0,0 0))", geo_poly); // Create geographic strategy with WGS84 spheroid diff --git a/doc/src/examples/algorithms/assign.cpp b/doc/src/examples/algorithms/assign.cpp index 32ae0db9d7..8a51d028c0 100644 --- a/doc/src/examples/algorithms/assign.cpp +++ b/doc/src/examples/algorithms/assign.cpp @@ -1,7 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // QuickBook Example -// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2011-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 @@ -22,9 +22,9 @@ BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian) int main() { - typedef boost::geometry::model::d2::point_xy point; - typedef boost::geometry::model::box box; - typedef boost::geometry::model::polygon polygon; + using point = boost::geometry::model::d2::point_xy; + using box = boost::geometry::model::box; + using polygon = boost::geometry::model::polygon; point p1; box b; diff --git a/doc/src/examples/algorithms/assign_box_corners.cpp b/doc/src/examples/algorithms/assign_box_corners.cpp index 9d3e9f3b2d..52087a7411 100644 --- a/doc/src/examples/algorithms/assign_box_corners.cpp +++ b/doc/src/examples/algorithms/assign_box_corners.cpp @@ -1,7 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // QuickBook Example -// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2011-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 @@ -20,8 +20,8 @@ using namespace boost::geometry; int main() { - typedef model::d2::point_xy point; - typedef model::box box; + using point = model::d2::point_xy; + using box = model::box; box b; assign_values(b, 2, 2, 5, 5); diff --git a/doc/src/examples/algorithms/assign_inverse.cpp b/doc/src/examples/algorithms/assign_inverse.cpp index 3390ac1b8c..a5d0702537 100644 --- a/doc/src/examples/algorithms/assign_inverse.cpp +++ b/doc/src/examples/algorithms/assign_inverse.cpp @@ -1,7 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // QuickBook Example -// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2011-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 @@ -20,8 +20,8 @@ using namespace boost::geometry; int main() { - typedef model::point point; - typedef model::box box; + using point = model::point; + using box = model::box; box all; assign_inverse(all); diff --git a/doc/src/examples/algorithms/assign_point_from_index.cpp b/doc/src/examples/algorithms/assign_point_from_index.cpp index 6bcc89d838..836b6b39f5 100644 --- a/doc/src/examples/algorithms/assign_point_from_index.cpp +++ b/doc/src/examples/algorithms/assign_point_from_index.cpp @@ -1,7 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // QuickBook Example -// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2011-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 @@ -20,8 +20,8 @@ using namespace boost::geometry; int main() { - typedef model::d2::point_xy point; - typedef model::segment segment; + using point = model::d2::point_xy; + using segment = model::segment; segment s; assign_values(s, 1, 1, 2, 2); diff --git a/doc/src/examples/algorithms/assign_point_to_index.cpp b/doc/src/examples/algorithms/assign_point_to_index.cpp index 450d3c61fa..1742d42304 100644 --- a/doc/src/examples/algorithms/assign_point_to_index.cpp +++ b/doc/src/examples/algorithms/assign_point_to_index.cpp @@ -1,7 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // QuickBook Example -// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2011-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 @@ -20,8 +20,8 @@ using namespace boost::geometry; int main() { - typedef model::d2::point_xy point; - typedef model::box box; + using point = model::d2::point_xy; + using box = model::box; point lower_left(0, 0), upper_right(2, 2); diff --git a/doc/src/examples/algorithms/assign_points.cpp b/doc/src/examples/algorithms/assign_points.cpp index 9ec1df0199..8901e47e7e 100644 --- a/doc/src/examples/algorithms/assign_points.cpp +++ b/doc/src/examples/algorithms/assign_points.cpp @@ -1,14 +1,14 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // QuickBook Example -// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2011-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) //[assign_points -//` Shows usage of Boost.Geometry's assign, Boost.Assign, and Boost.Range to assign ranges of a linestring +//` Shows usage of Boost.Geometry's assign, and Boost.Range to assign ranges of a linestring #include @@ -16,7 +16,6 @@ #include #include -#include #include BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian) @@ -41,14 +40,12 @@ private : int main() { - using namespace boost::assign; - - typedef boost::geometry::model::linestring > ls; + using ls = boost::geometry::model::linestring>; ls line1, line2, line3; - line1 = tuple_list_of(0, 0)(2, 3)(4, 0)(6, 3)(8, 0)(10, 3)(12, 0); /*< tuple_list_of is part of Boost.Assign and can be used for Boost.Geometry if points are tuples >*/ - boost::geometry::assign_points(line2, tuple_list_of(0, 0)(2, 2)(4, 0)(6, 2)(8, 0)); /*< tuple_list_of delivers a range and can therefore be used in boost::geometry::assign >*/ + line1 = {{0, 0}, {2, 3}, {4, 0}, {6, 3}, {8, 0}, {10, 3}, {12, 0}}; + boost::geometry::assign_points(line2, ls({{0, 0}, {2, 2}, {4, 0}, {6, 2}, {8, 0}})); boost::geometry::assign_points(line3, line1 | boost::adaptors::filtered(x_between(4, 8))); /*< Boost.Range adaptors can also be used in boost::geometry::assign >*/ std::cout << "line 1: " << boost::geometry::dsv(line1) << std::endl; diff --git a/doc/src/examples/algorithms/azimuth.cpp b/doc/src/examples/algorithms/azimuth.cpp index 0f799920ab..08e16f33f1 100644 --- a/doc/src/examples/algorithms/azimuth.cpp +++ b/doc/src/examples/algorithms/azimuth.cpp @@ -18,7 +18,7 @@ int main() { - typedef boost::geometry::model::d2::point_xy point_type; + using point_type = boost::geometry::model::d2::point_xy; point_type p1(0, 0); point_type p2(1, 1); diff --git a/doc/src/examples/algorithms/azimuth_strategy.cpp b/doc/src/examples/algorithms/azimuth_strategy.cpp index 2a8ef5178f..4420042a49 100644 --- a/doc/src/examples/algorithms/azimuth_strategy.cpp +++ b/doc/src/examples/algorithms/azimuth_strategy.cpp @@ -19,7 +19,7 @@ int main() { namespace bg = boost::geometry; - typedef bg::model::point > point_type; + using point_type = bg::model::point>; point_type p1(0, 0); point_type p2(1, 1); diff --git a/doc/src/examples/algorithms/buffer_with_strategies.cpp b/doc/src/examples/algorithms/buffer_with_strategies.cpp index d4fc37885c..d5510274a1 100644 --- a/doc/src/examples/algorithms/buffer_with_strategies.cpp +++ b/doc/src/examples/algorithms/buffer_with_strategies.cpp @@ -1,7 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // QuickBook Example -// Copyright (c) 2013, 2014 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2013, 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 @@ -17,9 +17,9 @@ int main() { - typedef double coordinate_type; - typedef boost::geometry::model::d2::point_xy point; - typedef boost::geometry::model::polygon polygon; + using coordinate_type = double; + using point = boost::geometry::model::d2::point_xy; + using polygon = boost::geometry::model::polygon; // Declare strategies const double buffer_distance = 1.0; diff --git a/doc/src/examples/algorithms/centroid.cpp b/doc/src/examples/algorithms/centroid.cpp index d189f959b5..64ceffbeec 100644 --- a/doc/src/examples/algorithms/centroid.cpp +++ b/doc/src/examples/algorithms/centroid.cpp @@ -1,7 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // QuickBook Example -// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2011-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 @@ -20,8 +20,8 @@ int main() { - typedef boost::geometry::model::d2::point_xy point_type; - typedef boost::geometry::model::polygon polygon_type; + using point_type = boost::geometry::model::d2::point_xy; + using polygon_type = boost::geometry::model::polygon; polygon_type poly; boost::geometry::read_wkt( diff --git a/doc/src/examples/algorithms/clear.cpp b/doc/src/examples/algorithms/clear.cpp index da41711a82..17a8edd5b1 100644 --- a/doc/src/examples/algorithms/clear.cpp +++ b/doc/src/examples/algorithms/clear.cpp @@ -1,7 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // QuickBook Example -// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2011-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 @@ -19,28 +19,21 @@ BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian) -#include - int main() { - using boost::assign::tuple_list_of; - - typedef boost::tuple point; - typedef boost::geometry::model::polygon polygon; - typedef boost::geometry::model::ring ring; - - polygon poly; + using point = boost::tuple; + using polygon = boost::geometry::model::polygon; + using ring = boost::geometry::model::ring; - // Fill the polygon (using its own methods + Boost.Assign) - poly.outer() = tuple_list_of(0, 0)(0, 9)(10, 10)(0, 0); - poly.inners().push_back(tuple_list_of(1, 2)(4, 6)(2, 8)(1, 2)); + // Create a square as exterior ring, with a triangle as interior ring + polygon poly{{{0, 0}, {0, 10}, {10, 10}, {10, 0}, {0, 0}}, {{{1, 2}, {8, 2}, {4, 6}, {1, 2}}}}; std::cout << boost::geometry::dsv(poly) << std::endl; boost::geometry::clear(poly); std::cout << boost::geometry::dsv(poly) << std::endl; - // Create a ring using Boost.Assign - ring r = tuple_list_of(0, 0)(0, 9)(8, 8)(0, 0); + // Create a triangle + ring r{{0, 0}, {0, 9}, {8, 8}, {0, 0}}; std::cout << boost::geometry::dsv(r) << std::endl; boost::geometry::clear(r); @@ -56,7 +49,7 @@ int main() /*` Output: [pre -(((0, 0), (0, 10), (11, 11), (0, 0)), ((0, 0), (0, 10), (11, 11), (0, 0))) +(((0, 0), (0, 10), (10, 10), (10, 0), (0, 0)), ((1, 2), (8, 2), (4, 6), (1, 2))) (()) ((0, 0), (0, 9), (8, 8), (0, 0)) () diff --git a/doc/src/examples/algorithms/closest_points.cpp b/doc/src/examples/algorithms/closest_points.cpp index d826735505..c3f99c8862 100644 --- a/doc/src/examples/algorithms/closest_points.cpp +++ b/doc/src/examples/algorithms/closest_points.cpp @@ -23,10 +23,10 @@ int main() { - typedef boost::geometry::model::d2::point_xy point_type; - typedef boost::geometry::model::polygon polygon_type; - typedef boost::geometry::model::linestring linestring_type; - typedef boost::geometry::model::multi_point multi_point_type; + using point_type = boost::geometry::model::d2::point_xy; + using polygon_type = boost::geometry::model::polygon; + using linestring_type = boost::geometry::model::linestring; + using multi_point_type = boost::geometry::model::multi_point; point_type p(4.3,1.9); point_type p0(0,0); diff --git a/doc/src/examples/algorithms/closest_points_strategy.cpp b/doc/src/examples/algorithms/closest_points_strategy.cpp index 1278cacac7..8fe3f60415 100644 --- a/doc/src/examples/algorithms/closest_points_strategy.cpp +++ b/doc/src/examples/algorithms/closest_points_strategy.cpp @@ -21,14 +21,14 @@ int main() { - typedef boost::geometry::model::d2::point_xy + using point_type = boost::geometry::model::d2::point_xy < double, boost::geometry::cs::geographic - > point_type; - typedef boost::geometry::model::polygon polygon_type; - typedef boost::geometry::model::linestring linestring_type; - typedef boost::geometry::model::multi_point multi_point_type; + >; + using polygon_type = boost::geometry::model::polygon; + using linestring_type = boost::geometry::model::linestring; + using multi_point_type = boost::geometry::model::multi_point; point_type p(4.3,1.9); polygon_type poly; diff --git a/doc/src/examples/algorithms/comparable_distance.cpp b/doc/src/examples/algorithms/comparable_distance.cpp index 8ac50167c9..64461e276d 100644 --- a/doc/src/examples/algorithms/comparable_distance.cpp +++ b/doc/src/examples/algorithms/comparable_distance.cpp @@ -1,7 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // QuickBook Example -// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2011-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 @@ -16,11 +16,10 @@ #include #include -#include int main() { - typedef boost::geometry::model::d2::point_xy point_type; + using point_type = boost::geometry::model::d2::point_xy; point_type p(1.4, 2.6); @@ -35,7 +34,7 @@ int main() point_type min_p; double min_d = boost::numeric::bounds::highest(); - BOOST_FOREACH(point_type const& pv, v) + for (point_type const& pv : v) { double d = boost::geometry::comparable_distance(p, pv); if (d < min_d) diff --git a/doc/src/examples/algorithms/convert.cpp b/doc/src/examples/algorithms/convert.cpp index 1f4570507c..12e484aaca 100644 --- a/doc/src/examples/algorithms/convert.cpp +++ b/doc/src/examples/algorithms/convert.cpp @@ -1,7 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // QuickBook Example -// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2011-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 @@ -22,9 +22,9 @@ BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian) int main() { - typedef boost::geometry::model::d2::point_xy point; - typedef boost::geometry::model::box box; - typedef boost::geometry::model::polygon polygon; + using point = boost::geometry::model::d2::point_xy; + using box = boost::geometry::model::box; + using polygon = boost::geometry::model::polygon; point p1(1, 1); box bx = boost::geometry::make(1, 1, 2, 2); diff --git a/doc/src/examples/algorithms/convex_hull.cpp b/doc/src/examples/algorithms/convex_hull.cpp index cfa658cc0e..4c19ac150c 100644 --- a/doc/src/examples/algorithms/convex_hull.cpp +++ b/doc/src/examples/algorithms/convex_hull.cpp @@ -1,7 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // QuickBook Example -// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2011-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 @@ -21,8 +21,8 @@ BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian) /*<-*/ #include "create_svg_two.hpp" /*->*/ int main() { - typedef boost::tuple point; - typedef boost::geometry::model::polygon polygon; + using point = boost::tuple; + using polygon = boost::geometry::model::polygon; polygon poly; boost::geometry::read_wkt("polygon((2.0 1.3, 2.4 1.7, 2.8 1.8, 3.4 1.2, 3.7 1.6,3.4 2.0, 4.1 3.0" diff --git a/doc/src/examples/algorithms/correct.cpp b/doc/src/examples/algorithms/correct.cpp index c33ace9ae7..9accb03933 100644 --- a/doc/src/examples/algorithms/correct.cpp +++ b/doc/src/examples/algorithms/correct.cpp @@ -1,7 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // QuickBook Example -// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2011-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 @@ -18,38 +18,37 @@ BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian) -#include - int main() { - using boost::assign::tuple_list_of; - - typedef boost::geometry::model::polygon + using clockwise_closed_polygon = boost::geometry::model::polygon < boost::tuple - > clockwise_closed_polygon; + >; clockwise_closed_polygon cwcp; // Fill it counterclockwise (so wrongly), forgetting the closing point - boost::geometry::exterior_ring(cwcp) = tuple_list_of(0, 0)(10, 10)(0, 9); + boost::geometry::exterior_ring(cwcp) = {{0, 0}, {10, 10}, {0, 9}}; // Add a counterclockwise closed inner ring (this is correct) - boost::geometry::interior_rings(cwcp).push_back(tuple_list_of(1, 2)(4, 6)(2, 8)(1, 2)); + boost::geometry::interior_rings(cwcp).push_back({{1, 2}, {4, 6}, {2, 8}, {1, 2}}); // Its area should be negative (because of wrong orientation) // and wrong (because of omitted closing point) - double area_before = boost::geometry::area(cwcp); + const auto area_before = boost::geometry::area(cwcp); + const auto count_before = boost::geometry::num_points(cwcp); // Correct it! boost::geometry::correct(cwcp); // Check its new area - double area_after = boost::geometry::area(cwcp); + const auto area_after = boost::geometry::area(cwcp); + const auto count_after = boost::geometry::num_points(cwcp); // And output it std::cout << boost::geometry::dsv(cwcp) << std::endl; std::cout << area_before << " -> " << area_after << std::endl; + std::cout << count_before << " -> " << count_after << std::endl; return 0; } @@ -63,6 +62,7 @@ int main() [pre (((0, 0), (0, 9), (10, 10), (0, 0)), ((1, 2), (4, 6), (2, 8), (1, 2))) -7 -> 38 +7 -> 8 ] */ //] diff --git a/doc/src/examples/algorithms/covered_by.cpp b/doc/src/examples/algorithms/covered_by.cpp index 72eee97ef3..8fea92a952 100644 --- a/doc/src/examples/algorithms/covered_by.cpp +++ b/doc/src/examples/algorithms/covered_by.cpp @@ -21,22 +21,22 @@ namespace bg = boost::geometry; /*< Convenient namespace alias >*/ int main() { // Checks if the first geometry is inside or on border the second geometry. - bg::model::polygon > poly1; + bg::model::polygon> poly1; bg::read_wkt("POLYGON((0 2,0 3,2 4,1 2,0 2))", poly1); - bg::model::polygon > poly2; + bg::model::polygon> poly2; bg::read_wkt("POLYGON((0 4,3 4,2 2,0 1,0 4))", poly2); bool check_covered = bg::covered_by(poly1, poly2); if (check_covered) { - std::cout << "Covered: Yes" << std::endl; + std::cout << "Covered: Yes" << std::endl; } else { std::cout << "Covered: No" << std::endl; } - bg::model::polygon > poly3; + bg::model::polygon> poly3; bg::read_wkt("POLYGON((-1 -1,-3 -4,-7 -7,-4 -3,-1 -1))", poly3); check_covered = bg::covered_by(poly1, poly3); if (check_covered) { - std::cout << "Covered: Yes" << std::endl; + std::cout << "Covered: Yes" << std::endl; } else { std::cout << "Covered: No" << std::endl; } diff --git a/doc/src/examples/algorithms/create_svg_one.hpp b/doc/src/examples/algorithms/create_svg_one.hpp index 64ccacfb4a..36fd57f4d9 100644 --- a/doc/src/examples/algorithms/create_svg_one.hpp +++ b/doc/src/examples/algorithms/create_svg_one.hpp @@ -1,6 +1,6 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) -// Copyright (c) 2011-2014 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2011-2024 Barend Gehrels, Amsterdam, the Netherlands. // This file was modified by Oracle on 2014. // Modifications copyright (c) 2014, Oracle and/or its affiliates. @@ -29,7 +29,7 @@ void create_svg(std::string const& filename, Geometry const& g) #if defined(HAVE_SVG) std::cout << std::endl << "[$img/algorithms/" << boost::replace_all_copy(filename, ".svg", ".png") << "]" << std::endl << std::endl; - typedef typename boost::geometry::point_type::type point_type; + using point_type = typename boost::geometry::point_type::type; std::ofstream svg(filename.c_str()); boost::geometry::svg_mapper mapper(svg, 400, 400); diff --git a/doc/src/examples/algorithms/create_svg_overlay.hpp b/doc/src/examples/algorithms/create_svg_overlay.hpp index cbef155d21..ef41f1f60c 100644 --- a/doc/src/examples/algorithms/create_svg_overlay.hpp +++ b/doc/src/examples/algorithms/create_svg_overlay.hpp @@ -1,6 +1,6 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) -// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2011-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 @@ -13,7 +13,6 @@ #include -#include #include #include @@ -27,7 +26,7 @@ void create_svg(std::string const& filename, Geometry const& a, Geometry const& #if defined(HAVE_SVG) std::cout << std::endl << "[$img/algorithms/" << boost::replace_all_copy(filename, ".svg", ".png") << "]" << std::endl << std::endl; - typedef typename boost::geometry::point_type::type point_type; + using point_type = typename boost::geometry::point_type::type; std::ofstream svg(filename.c_str()); boost::geometry::svg_mapper mapper(svg, 400, 400); @@ -37,7 +36,7 @@ void create_svg(std::string const& filename, Geometry const& a, Geometry const& mapper.map(a, "fill-opacity:0.5;fill:rgb(153,204,0);stroke:rgb(153,204,0);stroke-width:2"); mapper.map(b, "fill-opacity:0.3;fill:rgb(51,51,153);stroke:rgb(51,51,153);stroke-width:2"); int i = 0; - BOOST_FOREACH(typename boost::range_value::type const& g, range) + for (typename boost::range_value::type const& g : range) { mapper.map(g, "opacity:0.8;fill:none;stroke:rgb(255,128,0);stroke-width:4;stroke-dasharray:1,7;stroke-linecap:round"); std::ostringstream out; diff --git a/doc/src/examples/algorithms/create_svg_two.hpp b/doc/src/examples/algorithms/create_svg_two.hpp index aefaf10e00..215004aabb 100644 --- a/doc/src/examples/algorithms/create_svg_two.hpp +++ b/doc/src/examples/algorithms/create_svg_two.hpp @@ -1,6 +1,6 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) -// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2011-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 @@ -24,7 +24,7 @@ void create_svg(std::string const& filename, Geometry1 const& a, Geometry2 const #if defined(HAVE_SVG) std::cout << std::endl << "[$img/algorithms/" << boost::replace_all_copy(filename, ".svg", ".png") << "]" << std::endl << std::endl; - typedef typename boost::geometry::point_type::type point_type; + using point_type = typename boost::geometry::point_type::type; std::ofstream svg(filename.c_str()); boost::geometry::svg_mapper mapper(svg, 400, 400); diff --git a/doc/src/examples/algorithms/crosses.cpp b/doc/src/examples/algorithms/crosses.cpp index c30380d718..84351e6f8b 100644 --- a/doc/src/examples/algorithms/crosses.cpp +++ b/doc/src/examples/algorithms/crosses.cpp @@ -21,23 +21,23 @@ namespace bg = boost::geometry; /*< Convenient namespace alias >*/ int main() { // Checks if the two geometries (here, a polygon and a linestring) crosses or not. - bg::model::polygon > poly; + bg::model::polygon> poly; bg::read_wkt("POLYGON((0 0,0 3,3 3,3 0,0 0))", poly); - bg::model::linestring > line1; + bg::model::linestring> line1; bg::read_wkt("LINESTRING(1 1,2 2,4 4)", line1); bool check_crosses = bg::crosses(poly, line1); if (check_crosses) { - std::cout << "Crosses: Yes" << std::endl; + std::cout << "Crosses: Yes" << std::endl; } else { std::cout << "Crosses: No" << std::endl; } // Edge case: linestring just touches the polygon but doesn't crosses it. - bg::model::linestring > line2; + bg::model::linestring> line2; bg::read_wkt("LINESTRING(1 1,1 2,1 3)", line2); check_crosses = bg::crosses(poly, line2); if (check_crosses) { - std::cout << "Crosses: Yes" << std::endl; + std::cout << "Crosses: Yes" << std::endl; } else { std::cout << "Crosses: No" << std::endl; } diff --git a/doc/src/examples/algorithms/densify.cpp b/doc/src/examples/algorithms/densify.cpp index 68f7426c6c..a41db907e7 100644 --- a/doc/src/examples/algorithms/densify.cpp +++ b/doc/src/examples/algorithms/densify.cpp @@ -19,8 +19,8 @@ int main() { - typedef boost::geometry::model::d2::point_xy point_type; - typedef boost::geometry::model::polygon polygon_type; + using point_type = boost::geometry::model::d2::point_xy; + using polygon_type = boost::geometry::model::polygon; polygon_type poly; boost::geometry::read_wkt( diff --git a/doc/src/examples/algorithms/densify_strategy.cpp b/doc/src/examples/algorithms/densify_strategy.cpp index eb9934995c..8aad2c7aed 100644 --- a/doc/src/examples/algorithms/densify_strategy.cpp +++ b/doc/src/examples/algorithms/densify_strategy.cpp @@ -20,8 +20,8 @@ int main() { namespace bg = boost::geometry; - typedef bg::model::point > point_type; - typedef bg::model::linestring linestring_type; + using point_type = bg::model::point>; + using linestring_type = bg::model::linestring; linestring_type ls; bg::read_wkt("LINESTRING(0 0,1 1)", ls); diff --git a/doc/src/examples/algorithms/difference.cpp b/doc/src/examples/algorithms/difference.cpp index 98e12d744f..d5a350abcb 100644 --- a/doc/src/examples/algorithms/difference.cpp +++ b/doc/src/examples/algorithms/difference.cpp @@ -1,7 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // QuickBook Example -// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2011-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 @@ -16,13 +16,11 @@ #include #include #include - -#include /*<-*/ #include "create_svg_overlay.hpp" /*->*/ int main() { - typedef boost::geometry::model::polygon > polygon; + using polygon = boost::geometry::model::polygon>; polygon green, blue; @@ -38,7 +36,7 @@ int main() int i = 0; std::cout << "green - blue:" << std::endl; - BOOST_FOREACH(polygon const& p, output) + for (polygon const& p : output) { std::cout << i++ << ": " << boost::geometry::area(p) << std::endl; } @@ -49,7 +47,7 @@ int main() i = 0; std::cout << "blue - green:" << std::endl; - BOOST_FOREACH(polygon const& p, output) + for (polygon const& p : output) { std::cout << i++ << ": " << boost::geometry::area(p) << std::endl; } diff --git a/doc/src/examples/algorithms/difference_inserter.cpp b/doc/src/examples/algorithms/difference_inserter.cpp index 76dac78082..27ee7e3f9a 100644 --- a/doc/src/examples/algorithms/difference_inserter.cpp +++ b/doc/src/examples/algorithms/difference_inserter.cpp @@ -1,7 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // QuickBook Example -// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2011-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 @@ -17,12 +17,11 @@ #include #include -#include /*<-*/ #include "create_svg_overlay.hpp" /*->*/ int main() { - typedef boost::geometry::model::polygon > polygon; + using polygon = boost::geometry::model::polygon>; polygon green, blue; @@ -51,7 +50,7 @@ int main() int i = 0; std::cout << "(blue \ green) u (green \ blue):" << std::endl; - BOOST_FOREACH(polygon const& p, output) + for (polygon const& p : output) { std::cout << i++ << ": " << boost::geometry::area(p) << std::endl; } diff --git a/doc/src/examples/algorithms/discrete_frechet_distance.cpp b/doc/src/examples/algorithms/discrete_frechet_distance.cpp index 52c0fbd9b3..14185addb6 100644 --- a/doc/src/examples/algorithms/discrete_frechet_distance.cpp +++ b/doc/src/examples/algorithms/discrete_frechet_distance.cpp @@ -17,8 +17,8 @@ int main() { - typedef boost::geometry::model::d2::point_xy point_type; - typedef boost::geometry::model::linestring linestring_type; + using point_type = boost::geometry::model::d2::point_xy; + using linestring_type = boost::geometry::model::linestring; linestring_type ls1, ls2; boost::geometry::read_wkt("LINESTRING(0 0,1 1,1 2,2 1,2 2)", ls1); diff --git a/doc/src/examples/algorithms/discrete_frechet_distance_strategy.cpp b/doc/src/examples/algorithms/discrete_frechet_distance_strategy.cpp index adb8bcc042..0e8612bd1a 100644 --- a/doc/src/examples/algorithms/discrete_frechet_distance_strategy.cpp +++ b/doc/src/examples/algorithms/discrete_frechet_distance_strategy.cpp @@ -18,8 +18,8 @@ int main() { namespace bg = boost::geometry; - typedef bg::model::point > point_type; - typedef bg::model::linestring linestring_type; + using point_type = bg::model::point>; + using linestring_type = bg::model::linestring; linestring_type ls1, ls2; bg::read_wkt("LINESTRING(0 0,1 1,1 2,2 1,2 2)", ls1); diff --git a/doc/src/examples/algorithms/discrete_hausdorff_distance.cpp b/doc/src/examples/algorithms/discrete_hausdorff_distance.cpp index b074e91ec0..47a3916954 100644 --- a/doc/src/examples/algorithms/discrete_hausdorff_distance.cpp +++ b/doc/src/examples/algorithms/discrete_hausdorff_distance.cpp @@ -17,8 +17,8 @@ int main() { - typedef boost::geometry::model::d2::point_xy point_type; - typedef boost::geometry::model::linestring linestring_type; + using point_type = boost::geometry::model::d2::point_xy; + using linestring_type = boost::geometry::model::linestring; linestring_type ls1, ls2; boost::geometry::read_wkt("LINESTRING(0 0,1 1,1 2,2 1,2 2)", ls1); diff --git a/doc/src/examples/algorithms/discrete_hausdorff_distance_strategy.cpp b/doc/src/examples/algorithms/discrete_hausdorff_distance_strategy.cpp index 28f0f90437..95cc3a9d17 100644 --- a/doc/src/examples/algorithms/discrete_hausdorff_distance_strategy.cpp +++ b/doc/src/examples/algorithms/discrete_hausdorff_distance_strategy.cpp @@ -18,8 +18,8 @@ int main() { namespace bg = boost::geometry; - typedef bg::model::point > point_type; - typedef bg::model::linestring linestring_type; + using point_type = bg::model::point>; + using linestring_type = bg::model::linestring; linestring_type ls1, ls2; bg::read_wkt("LINESTRING(0 0,1 1,1 2,2 1,2 2)", ls1); diff --git a/doc/src/examples/algorithms/disjoint.cpp b/doc/src/examples/algorithms/disjoint.cpp index 6beffc27aa..37dde1576a 100644 --- a/doc/src/examples/algorithms/disjoint.cpp +++ b/doc/src/examples/algorithms/disjoint.cpp @@ -21,22 +21,22 @@ namespace bg = boost::geometry; /*< Convenient namespace alias >*/ int main() { // Checks if two geometries are disjoint, which means that two geometries have zero intersection. - bg::model::polygon > poly1; + bg::model::polygon> poly1; bg::read_wkt("POLYGON((0 2,-2 0,-4 2,-2 4,0 2))", poly1); - bg::model::polygon > poly2; + bg::model::polygon> poly2; bg::read_wkt("POLYGON((2 2,4 4,6 2,4 0,2 2))", poly2); bool check_disjoint = bg::disjoint(poly1, poly2); if (check_disjoint) { - std::cout << "Disjoint: Yes" << std::endl; + std::cout << "Disjoint: Yes" << std::endl; } else { std::cout << "Disjoint: No" << std::endl; } - bg::model::polygon > poly3; + bg::model::polygon> poly3; bg::read_wkt("POLYGON((0 2,2 4,4 2,2 0,0 2))", poly3); check_disjoint = bg::disjoint(poly1, poly3); if (check_disjoint) { - std::cout << "Disjoint: Yes" << std::endl; + std::cout << "Disjoint: Yes" << std::endl; } else { std::cout << "Disjoint: No" << std::endl; } diff --git a/doc/src/examples/algorithms/distance.cpp b/doc/src/examples/algorithms/distance.cpp index 32de3a6b36..2d13d6bb2f 100644 --- a/doc/src/examples/algorithms/distance.cpp +++ b/doc/src/examples/algorithms/distance.cpp @@ -1,7 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // QuickBook Example -// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2011-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 @@ -20,14 +20,12 @@ #include #include -#include - int main() { - typedef boost::geometry::model::d2::point_xy point_type; - typedef boost::geometry::model::polygon polygon_type; - typedef boost::geometry::model::linestring linestring_type; - typedef boost::geometry::model::multi_point multi_point_type; + using point_type = boost::geometry::model::d2::point_xy; + using polygon_type = boost::geometry::model::polygon; + using linestring_type = boost::geometry::model::linestring; + using multi_point_type = boost::geometry::model::multi_point; point_type p(1,2); polygon_type poly; diff --git a/doc/src/examples/algorithms/envelope.cpp b/doc/src/examples/algorithms/envelope.cpp index e649d17481..49447e1971 100644 --- a/doc/src/examples/algorithms/envelope.cpp +++ b/doc/src/examples/algorithms/envelope.cpp @@ -1,7 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // QuickBook Example -// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2011-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 @@ -20,7 +20,7 @@ int main() { - typedef boost::geometry::model::d2::point_xy point; + using point = boost::geometry::model::d2::point_xy; boost::geometry::model::polygon polygon; diff --git a/doc/src/examples/algorithms/equals.cpp b/doc/src/examples/algorithms/equals.cpp index 461a111e80..533c6fdaa4 100644 --- a/doc/src/examples/algorithms/equals.cpp +++ b/doc/src/examples/algorithms/equals.cpp @@ -1,7 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // QuickBook Example -// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2011-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 @@ -18,17 +18,13 @@ BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian) -#include - int main() { - using boost::assign::tuple_list_of; - - typedef boost::tuple point; + using point = boost::tuple; boost::geometry::model::polygon poly1, poly2; - boost::geometry::exterior_ring(poly1) = tuple_list_of(0, 0)(0, 5)(5, 5)(5, 0)(0, 0); - boost::geometry::exterior_ring(poly2) = tuple_list_of(5, 0)(0, 0)(0, 5)(5, 5)(5, 0); + boost::geometry::exterior_ring(poly1) = {{0, 0}, {0, 5}, {5, 5}, {5, 0}, {0, 0}}; + boost::geometry::exterior_ring(poly2) = {{5, 0}, {0, 0}, {0, 5}, {5, 5}, {5, 0}}; std::cout << "polygons are spatially " @@ -43,7 +39,6 @@ int main() << (boost::geometry::equals(box, poly2) ? "equal" : "not equal") << std::endl; - return 0; } diff --git a/doc/src/examples/algorithms/expand.cpp b/doc/src/examples/algorithms/expand.cpp index cba03b2479..68f55a5dd3 100644 --- a/doc/src/examples/algorithms/expand.cpp +++ b/doc/src/examples/algorithms/expand.cpp @@ -1,7 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // QuickBook Example -// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2011-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 @@ -19,8 +19,8 @@ int main() { - typedef boost::geometry::model::d2::point_xy point_type; - typedef boost::geometry::model::box box_type; + using point_type = boost::geometry::model::d2::point_xy; + using box_type = boost::geometry::model::box; using boost::geometry::expand; diff --git a/doc/src/examples/algorithms/for_each_point.cpp b/doc/src/examples/algorithms/for_each_point.cpp index cfc9e0aaba..9b566d07ad 100644 --- a/doc/src/examples/algorithms/for_each_point.cpp +++ b/doc/src/examples/algorithms/for_each_point.cpp @@ -1,7 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // QuickBook Example -// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2011-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 @@ -16,41 +16,27 @@ #include #include - - -template -class round_coordinates +int main() { -private : - typedef typename boost::geometry::coordinate_type::type coordinate_type; - coordinate_type factor; + using point = boost::geometry::model::d2::point_xy; - inline coordinate_type round(coordinate_type value) + constexpr auto factor = 0.1; + auto round = [&](auto value) { return floor(0.5 + (value / factor)) * factor; - } + }; -public : - round_coordinates(coordinate_type f) - : factor(f) - {} - - inline void operator()(Point& p) - { - using boost::geometry::get; - using boost::geometry::set; - set<0>(p, round(get<0>(p))); - set<1>(p, round(get<1>(p))); - } -}; - - -int main() -{ - typedef boost::geometry::model::d2::point_xy point; boost::geometry::model::polygon poly; boost::geometry::read_wkt("POLYGON((0 0,1.123 9.987,8.876 2.234,0 0),(3.345 4.456,7.654 8.765,9.123 5.432,3.345 4.456))", poly); - boost::geometry::for_each_point(poly, round_coordinates(0.1)); + boost::geometry::for_each_point(poly, + [&round](auto& p) + { + using boost::geometry::get; + using boost::geometry::set; + set<0>(p, round(get<0>(p))); + set<1>(p, round(get<1>(p))); + } + ); std::cout << "Rounded: " << boost::geometry::wkt(poly) << std::endl; return 0; } diff --git a/doc/src/examples/algorithms/for_each_point_const.cpp b/doc/src/examples/algorithms/for_each_point_const.cpp index 43cf2c774f..0c08e1133c 100644 --- a/doc/src/examples/algorithms/for_each_point_const.cpp +++ b/doc/src/examples/algorithms/for_each_point_const.cpp @@ -1,7 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // QuickBook Example -// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2011-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 @@ -26,7 +26,7 @@ void list_coordinates(Point const& p) int main() { - typedef boost::geometry::model::d2::point_xy point; + using point = boost::geometry::model::d2::point_xy; boost::geometry::model::polygon poly; boost::geometry::read_wkt("POLYGON((0 0,0 4,4 0,0 0))", poly); boost::geometry::for_each_point(poly, list_coordinates); diff --git a/doc/src/examples/algorithms/for_each_segment_const.cpp b/doc/src/examples/algorithms/for_each_segment_const.cpp index f7296bc764..e4c8eb4e9f 100644 --- a/doc/src/examples/algorithms/for_each_segment_const.cpp +++ b/doc/src/examples/algorithms/for_each_segment_const.cpp @@ -1,7 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // QuickBook Example -// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2011-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 @@ -11,72 +11,37 @@ //` Sample using for_each_segment, using a functor to get the minimum and maximum length of a segment in a linestring #include +#include #include #include #include -#include - - -template -struct gather_segment_statistics -{ - // Remember that if coordinates are integer, the length might be floating point - // So use "double" for integers. In other cases, use coordinate type - typedef typename boost::geometry::select_most_precise - < - typename boost::geometry::coordinate_type::type, - double - >::type type; - - type min_length, max_length; - - // Initialize min and max - gather_segment_statistics() - : min_length(1e38) - , max_length(-1) - {} - - // This operator is called for each segment - inline void operator()(Segment const& s) - { - type length = boost::geometry::length(s); - if (length < min_length) min_length = length; - if (length > max_length) max_length = length; - } -}; - int main() { - // Bring "+=" for a vector into scope - using namespace boost::assign; - // Define a type - typedef boost::geometry::model::d2::point_xy point; - - // Declare a linestring - boost::geometry::model::linestring polyline; - - // Use Boost.Assign to initialize a linestring - polyline += point(0, 0), point(3, 3), point(5, 1), point(6, 2), - point(8, 0), point(4, -4), point(1, -1), point(3, 2); - - - // Declare the gathering class... - gather_segment_statistics - < - boost::geometry::model::referring_segment - > functor; - - // ... and use it, the essention. - // As also in std::for_each it is a const value, so retrieve it as a return value. - functor = boost::geometry::for_each_segment(polyline, functor); + using point = boost::geometry::model::d2::point_xy; + + // Create a linestring + const boost::geometry::model::linestring polyline = + {{0, 0}, {3, 3}, {5, 1}, {6, 2}, {8, 0}, {4, -4}, {1, -1}, {3, 2}}; + + // Iterate over its segments to find the minimum and maximum length + double min_length = std::numeric_limits::max(); + double max_length = -std::numeric_limits::max(); + + boost::geometry::for_each_segment(polyline, + [&](auto const& s) + { + const auto length = boost::geometry::length(s); + min_length = std::min(min_length, length); + max_length = std::max(max_length, length); + }); // Output the results std::cout - << "Min segment length: " << functor.min_length << std::endl - << "Max segment length: " << functor.max_length << std::endl; + << "Min segment length: " << min_length << std::endl + << "Max segment length: " << max_length << std::endl; return 0; } diff --git a/doc/src/examples/algorithms/intersection_ls_ls_point.cpp b/doc/src/examples/algorithms/intersection_ls_ls_point.cpp index 4586f83d30..f9e549c4bf 100644 --- a/doc/src/examples/algorithms/intersection_ls_ls_point.cpp +++ b/doc/src/examples/algorithms/intersection_ls_ls_point.cpp @@ -1,7 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // QuickBook Example -// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2011-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 @@ -17,14 +17,12 @@ #include #include -#include - BOOST_GEOMETRY_REGISTER_LINESTRING_TEMPLATED(std::vector) int main() { - typedef boost::geometry::model::d2::point_xy P; + using P = boost::geometry::model::d2::point_xy; std::vector

line1, line2; boost::geometry::read_wkt("linestring(1 1,2 2,3 1)", line1); boost::geometry::read_wkt("linestring(1 2,2 1,3 2)", line2); @@ -32,7 +30,7 @@ int main() std::deque

intersection_points; boost::geometry::intersection(line1, line2, intersection_points); - BOOST_FOREACH(P const& p, intersection_points) + for (P const& p : intersection_points) { std::cout << " " << boost::geometry::wkt(p); } diff --git a/doc/src/examples/algorithms/intersection_poly_poly.cpp b/doc/src/examples/algorithms/intersection_poly_poly.cpp index 0add36591b..0da2966a50 100644 --- a/doc/src/examples/algorithms/intersection_poly_poly.cpp +++ b/doc/src/examples/algorithms/intersection_poly_poly.cpp @@ -1,7 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // QuickBook Example -// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2011-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 @@ -17,12 +17,11 @@ #include #include -#include /*<-*/ #include "create_svg_overlay.hpp" /*->*/ int main() { - typedef boost::geometry::model::polygon > polygon; + using polygon = boost::geometry::model::polygon> ; polygon green, blue; @@ -38,7 +37,7 @@ int main() int i = 0; std::cout << "green && blue:" << std::endl; - BOOST_FOREACH(polygon const& p, output) + for (polygon const& p : output) { std::cout << i++ << ": " << boost::geometry::area(p) << std::endl; } diff --git a/doc/src/examples/algorithms/intersection_segment.cpp b/doc/src/examples/algorithms/intersection_segment.cpp index ae5c69ac66..290265433e 100644 --- a/doc/src/examples/algorithms/intersection_segment.cpp +++ b/doc/src/examples/algorithms/intersection_segment.cpp @@ -1,7 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // QuickBook Example -// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2011-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 @@ -15,12 +15,9 @@ #include #include -#include - - int main() { - typedef boost::geometry::model::d2::point_xy P; + using P = boost::geometry::model::d2::point_xy; boost::geometry::model::segment

segment1, segment2; boost::geometry::read_wkt("linestring(1 1,2 2)", segment1); boost::geometry::read_wkt("linestring(2 1,1 2)", segment2); @@ -28,7 +25,7 @@ int main() std::vector

intersections; boost::geometry::intersection(segment1, segment2, intersections); - BOOST_FOREACH(P const& p, intersections) + for (P const& p : intersections) { std::cout << " " << boost::geometry::wkt(p); } diff --git a/doc/src/examples/algorithms/intersects_linestring.cpp b/doc/src/examples/algorithms/intersects_linestring.cpp index e2e1566bab..9149c848df 100644 --- a/doc/src/examples/algorithms/intersects_linestring.cpp +++ b/doc/src/examples/algorithms/intersects_linestring.cpp @@ -1,7 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // QuickBook Example -// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2011-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 @@ -19,7 +19,7 @@ int main() { // Calculate the intersects of a cartesian polygon - typedef boost::geometry::model::d2::point_xy P; + using P = boost::geometry::model::d2::point_xy; boost::geometry::model::linestring

line1, line2; boost::geometry::read_wkt("linestring(1 1,2 2,3 3)", line1); diff --git a/doc/src/examples/algorithms/intersects_segment.cpp b/doc/src/examples/algorithms/intersects_segment.cpp index 7f1b8f540d..5428f3b62f 100644 --- a/doc/src/examples/algorithms/intersects_segment.cpp +++ b/doc/src/examples/algorithms/intersects_segment.cpp @@ -1,7 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // QuickBook Example -// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2011-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 @@ -19,7 +19,7 @@ int main() { // Calculate the intersects of a cartesian polygon - typedef boost::geometry::model::d2::point_xy P; + using P = boost::geometry::model::d2::point_xy; bg::model::linestring

line1, line2; boost::geometry::read_wkt("linestring(1 1,2 2)", line1); diff --git a/doc/src/examples/algorithms/is_simple.cpp b/doc/src/examples/algorithms/is_simple.cpp index 8255b5f1a4..d0ef9ca849 100644 --- a/doc/src/examples/algorithms/is_simple.cpp +++ b/doc/src/examples/algorithms/is_simple.cpp @@ -21,9 +21,9 @@ int main() { - typedef boost::geometry::model::d2::point_xy point_type; - typedef boost::geometry::model::linestring linestring_type; - typedef boost::geometry::model::multi_linestring multi_linestring_type; + using point_type = boost::geometry::model::d2::point_xy; + using linestring_type = boost::geometry::model::linestring; + using multi_linestring_type = boost::geometry::model::multi_linestring; multi_linestring_type multi_linestring; boost::geometry::read_wkt("MULTILINESTRING((0 0,0 10,10 10,10 0,0 0),(10 10,20 20))", multi_linestring); diff --git a/doc/src/examples/algorithms/is_valid.cpp b/doc/src/examples/algorithms/is_valid.cpp index d802b3c450..d9518d9eff 100644 --- a/doc/src/examples/algorithms/is_valid.cpp +++ b/doc/src/examples/algorithms/is_valid.cpp @@ -20,8 +20,8 @@ int main() { - typedef boost::geometry::model::d2::point_xy point_type; - typedef boost::geometry::model::polygon polygon_type; + using point_type = boost::geometry::model::d2::point_xy; + using polygon_type = boost::geometry::model::polygon; polygon_type poly; boost::geometry::read_wkt("POLYGON((0 0,0 10,10 10,10 0,0 0),(0 0,9 1,9 2,0 0),(0 0,2 9,1 9,0 0),(2 9,9 2,9 9,2 9))", poly); diff --git a/doc/src/examples/algorithms/is_valid_failure.cpp b/doc/src/examples/algorithms/is_valid_failure.cpp index 9569ba6ad7..26e6a85f92 100644 --- a/doc/src/examples/algorithms/is_valid_failure.cpp +++ b/doc/src/examples/algorithms/is_valid_failure.cpp @@ -20,8 +20,8 @@ int main() { - typedef boost::geometry::model::d2::point_xy point_type; - typedef boost::geometry::model::polygon polygon_type; + using point_type = boost::geometry::model::d2::point_xy; + using polygon_type = boost::geometry::model::polygon; polygon_type poly; boost::geometry::read_wkt("POLYGON((0 0,0 10,10 10,10 0),(0 0,9 2,9 1,0 0),(0 0,2 9,1 9,0 0))", poly); diff --git a/doc/src/examples/algorithms/is_valid_message.cpp b/doc/src/examples/algorithms/is_valid_message.cpp index 6736573427..e7fbcf77f3 100644 --- a/doc/src/examples/algorithms/is_valid_message.cpp +++ b/doc/src/examples/algorithms/is_valid_message.cpp @@ -21,8 +21,8 @@ int main() { - typedef boost::geometry::model::d2::point_xy point_type; - typedef boost::geometry::model::polygon polygon_type; + using point_type = boost::geometry::model::d2::point_xy; + using polygon_type = boost::geometry::model::polygon; polygon_type poly; boost::geometry::read_wkt("POLYGON((0 0,0 10,10 10,10 0,0 0),(0 0,9 1,9 2,0 0),(0 0,2 9,1 9,0 0),(2 9,9 2,9 9,2 9))", poly); diff --git a/doc/src/examples/algorithms/length.cpp b/doc/src/examples/algorithms/length.cpp index 71693bcf69..74bfc78cb1 100644 --- a/doc/src/examples/algorithms/length.cpp +++ b/doc/src/examples/algorithms/length.cpp @@ -19,7 +19,7 @@ int main() { using namespace boost::geometry; - model::linestring > line; + model::linestring> line; read_wkt("linestring(0 0,1 1,4 8,3 2)", line); std::cout << "linestring length is " << length(line) diff --git a/doc/src/examples/algorithms/length_with_strategy.cpp b/doc/src/examples/algorithms/length_with_strategy.cpp index 4a643c894c..f6aef980d9 100644 --- a/doc/src/examples/algorithms/length_with_strategy.cpp +++ b/doc/src/examples/algorithms/length_with_strategy.cpp @@ -1,7 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // QuickBook Example -// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2011-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 @@ -17,7 +17,7 @@ int main() { using namespace boost::geometry; - typedef model::point > P; + using P = model::point>; model::linestring

line; line.push_back(P(2, 41)); line.push_back(P(2, 48)); diff --git a/doc/src/examples/algorithms/line_interpolate.cpp b/doc/src/examples/algorithms/line_interpolate.cpp index f3804e1aff..2a39374d3b 100644 --- a/doc/src/examples/algorithms/line_interpolate.cpp +++ b/doc/src/examples/algorithms/line_interpolate.cpp @@ -20,7 +20,7 @@ using namespace boost::geometry; int main() { - typedef boost::geometry::model::d2::point_xy point_type; + using point_type = boost::geometry::model::d2::point_xy; using segment_type = model::segment; using linestring_type = model::linestring; using multipoint_type = model::multi_point; diff --git a/doc/src/examples/algorithms/line_interpolate_strategy.cpp b/doc/src/examples/algorithms/line_interpolate_strategy.cpp index ce95c56de7..3b7ed6fc54 100644 --- a/doc/src/examples/algorithms/line_interpolate_strategy.cpp +++ b/doc/src/examples/algorithms/line_interpolate_strategy.cpp @@ -20,7 +20,7 @@ using namespace boost::geometry; int main() { - typedef model::d2::point_xy > point_type; + using point_type = model::d2::point_xy>; using segment_type = model::segment; using linestring_type = model::linestring; using multipoint_type = model::multi_point; diff --git a/doc/src/examples/algorithms/make_2d_point.cpp b/doc/src/examples/algorithms/make_2d_point.cpp index 92f7b0259a..1e3256d362 100644 --- a/doc/src/examples/algorithms/make_2d_point.cpp +++ b/doc/src/examples/algorithms/make_2d_point.cpp @@ -1,7 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // QuickBook Example -// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2011-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 @@ -16,7 +16,6 @@ #include #include #include -#include BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian) @@ -39,10 +38,9 @@ void construct_and_display() int main() { - construct_and_display >(); - construct_and_display >(); - construct_and_display >(); - construct_and_display >(); + construct_and_display>(); + construct_and_display>(); + construct_and_display>(); construct_and_display(); return 0; } diff --git a/doc/src/examples/algorithms/make_3d_point.cpp b/doc/src/examples/algorithms/make_3d_point.cpp index 6b7e8e7dbd..03a83e1d50 100644 --- a/doc/src/examples/algorithms/make_3d_point.cpp +++ b/doc/src/examples/algorithms/make_3d_point.cpp @@ -1,7 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // QuickBook Example -// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2011-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 @@ -17,8 +17,8 @@ int main() { - typedef boost::geometry::model::point point_type; - point_type p = boost::geometry::make(1, 2, 3); + using point_type = boost::geometry::model::point; + const auto p = boost::geometry::make(1, 2, 3); std::cout << boost::geometry::dsv(p) << std::endl; return 0; } diff --git a/doc/src/examples/algorithms/make_inverse.cpp b/doc/src/examples/algorithms/make_inverse.cpp index 339b0f4b1c..4da653cf11 100644 --- a/doc/src/examples/algorithms/make_inverse.cpp +++ b/doc/src/examples/algorithms/make_inverse.cpp @@ -1,7 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // QuickBook Example -// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2011-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 @@ -21,8 +21,8 @@ using namespace boost::geometry; int main() { - typedef model::d2::point_xy point; - typedef model::box box; + using point = model::d2::point_xy; + using box = model::box; box all = make_inverse(); std::cout << dsv(all) << std::endl; diff --git a/doc/src/examples/algorithms/make_with_range.cpp b/doc/src/examples/algorithms/make_with_range.cpp index 56ff34c45b..0dc4bf6a21 100644 --- a/doc/src/examples/algorithms/make_with_range.cpp +++ b/doc/src/examples/algorithms/make_with_range.cpp @@ -1,7 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // QuickBook Example -// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2011-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 @@ -24,8 +24,8 @@ int main() using boost::geometry::make; using boost::geometry::detail::make::make_points; - typedef boost::geometry::model::d2::point_xy point; - typedef boost::geometry::model::linestring linestring; + using point = boost::geometry::model::d2::point_xy; + using linestring = boost::geometry::model::linestring; double coordinates[][2] = {{1,2}, {3,4}, {5, 6}}; /*< Initialize with C array points >*/ linestring ls = make_points(coordinates); diff --git a/doc/src/examples/algorithms/overlaps.cpp b/doc/src/examples/algorithms/overlaps.cpp index 497d5e17e3..ed80290d02 100644 --- a/doc/src/examples/algorithms/overlaps.cpp +++ b/doc/src/examples/algorithms/overlaps.cpp @@ -21,22 +21,22 @@ namespace bg = boost::geometry; /*< Convenient namespace alias >*/ int main() { // Checks if the two geometries overlaps or not. - bg::model::polygon > poly1; + bg::model::polygon> poly1; bg::read_wkt("POLYGON((0 0,0 4,4 4,4 0,0 0))", poly1); - bg::model::polygon > poly2; + bg::model::polygon> poly2; bg::read_wkt("POLYGON((2 2,2 6,6 7,6 1,2 2))", poly2); bool check_overlap = bg::overlaps(poly1, poly2); if (check_overlap) { - std::cout << "Overlaps: Yes" << std::endl; + std::cout << "Overlaps: Yes" << std::endl; } else { std::cout << "Overlaps: No" << std::endl; } - bg::model::polygon > poly3; + bg::model::polygon> poly3; bg::read_wkt("POLYGON((-1 -1,-3 -4,-7 -7,-4 -3,-1 -1))", poly3); check_overlap = bg::overlaps(poly1, poly3); if (check_overlap) { - std::cout << "Overlaps: Yes" << std::endl; + std::cout << "Overlaps: Yes" << std::endl; } else { std::cout << "Overlaps: No" << std::endl; } diff --git a/doc/src/examples/algorithms/perimeter.cpp b/doc/src/examples/algorithms/perimeter.cpp index 130d8fdee5..f80161512b 100644 --- a/doc/src/examples/algorithms/perimeter.cpp +++ b/doc/src/examples/algorithms/perimeter.cpp @@ -21,7 +21,7 @@ namespace bg = boost::geometry; /*< Convenient namespace alias >*/ int main() { // Calculate the perimeter of a cartesian polygon - bg::model::polygon > poly; + bg::model::polygon> poly; bg::read_wkt("POLYGON((0 0,3 4,5 -5,-2 -4, 0 0))", poly); double perimeter = bg::perimeter(poly); std::cout << "Perimeter: " << perimeter << std::endl; diff --git a/doc/src/examples/algorithms/relate.cpp b/doc/src/examples/algorithms/relate.cpp index 2b67dd12d3..631987a480 100644 --- a/doc/src/examples/algorithms/relate.cpp +++ b/doc/src/examples/algorithms/relate.cpp @@ -24,8 +24,8 @@ int main() { - typedef boost::geometry::model::d2::point_xy point_type; - typedef boost::geometry::model::polygon polygon_type; + using point_type = boost::geometry::model::d2::point_xy; + using polygon_type = boost::geometry::model::polygon; polygon_type poly; boost::geometry::read_wkt( diff --git a/doc/src/examples/algorithms/relation.cpp b/doc/src/examples/algorithms/relation.cpp index 87ab9eed0a..468bb4606a 100644 --- a/doc/src/examples/algorithms/relation.cpp +++ b/doc/src/examples/algorithms/relation.cpp @@ -1,7 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // QuickBook Example -// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2011-2024 Barend Gehrels, Amsterdam, the Netherlands. // This file was modified by Oracle on 2015. // Modifications copyright (c) 2015 Oracle and/or its affiliates. @@ -25,8 +25,8 @@ int main() { - typedef boost::geometry::model::d2::point_xy point_type; - typedef boost::geometry::model::polygon polygon_type; + using point_type = boost::geometry::model::d2::point_xy; + using polygon_type = boost::geometry::model::polygon; polygon_type poly; boost::geometry::read_wkt( diff --git a/doc/src/examples/algorithms/return_envelope.cpp b/doc/src/examples/algorithms/return_envelope.cpp index 3c8ef30452..37435826be 100644 --- a/doc/src/examples/algorithms/return_envelope.cpp +++ b/doc/src/examples/algorithms/return_envelope.cpp @@ -1,7 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // QuickBook Example -// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2011-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 @@ -12,31 +12,23 @@ #include - #include #include #include #include -#include - /*<-*/ #include "create_svg_two.hpp" /*->*/ int main() { - using namespace boost::assign; - - typedef boost::geometry::model::d2::point_xy point; + using point = boost::geometry::model::d2::point_xy; + using box = boost::geometry::model::box; - boost::geometry::model::ring ring; - ring += - point(4.0, -0.5), point(3.5, 1.0), - point(2.0, 1.5), point(3.5, 2.0), - point(4.0, 3.5), point(4.5, 2.0), - point(6.0, 1.5), point(4.5, 1.0), - point(4.0, -0.5); - - typedef boost::geometry::model::box box; + const boost::geometry::model::ring ring { + {4.0, -0.5}, {3.5, 1.0}, {2.0, 1.5}, {3.5, 2.0}, + {4.0, 3.5}, {4.5, 2.0}, {6.0, 1.5}, {4.5, 1.0}, + {4.0, -0.5} + }; std::cout << "return_envelope:" @@ -49,7 +41,6 @@ int main() //] - //[return_envelope_output /*` Output: diff --git a/doc/src/examples/algorithms/reverse.cpp b/doc/src/examples/algorithms/reverse.cpp index 89e299e562..9d1237e06d 100644 --- a/doc/src/examples/algorithms/reverse.cpp +++ b/doc/src/examples/algorithms/reverse.cpp @@ -1,7 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // QuickBook Example -// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2011-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 @@ -19,20 +19,15 @@ BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian) -#include - int main() { - using boost::assign::tuple_list_of; - - typedef boost::tuple point; - typedef boost::geometry::model::polygon polygon; - typedef boost::geometry::model::ring ring; - + using point = boost::tuple; + using polygon = boost::geometry::model::polygon; + using ring = boost::geometry::model::ring; polygon poly; - boost::geometry::exterior_ring(poly) = tuple_list_of(0, 0)(0, 9)(10, 10)(0, 0); - boost::geometry::interior_rings(poly).push_back(tuple_list_of(1, 2)(4, 6)(2, 8)(1, 2)); + boost::geometry::exterior_ring(poly) = {{0, 0}, {0, 9}, {10, 10}, {0, 0}}; + boost::geometry::interior_rings(poly).push_back({{1, 2}, {4, 6}, {2, 8}, {1, 2}}); double area_before = boost::geometry::area(poly); boost::geometry::reverse(poly); @@ -40,7 +35,7 @@ int main() std::cout << boost::geometry::dsv(poly) << std::endl; std::cout << area_before << " -> " << area_after << std::endl; - ring r = tuple_list_of(0, 0)(0, 9)(8, 8)(0, 0); + ring r = {{0, 0}, {0, 9}, {8, 8}, {0, 0}}; area_before = boost::geometry::area(r); boost::geometry::reverse(r); diff --git a/doc/src/examples/algorithms/simplify.cpp b/doc/src/examples/algorithms/simplify.cpp index 2d9b77d090..a980578ce6 100644 --- a/doc/src/examples/algorithms/simplify.cpp +++ b/doc/src/examples/algorithms/simplify.cpp @@ -1,7 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // QuickBook Example -// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2011-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 @@ -16,18 +16,12 @@ #include #include -/*< For this example we use Boost.Assign to add points >*/ -#include - -using namespace boost::assign; - - int main() { - typedef boost::geometry::model::d2::point_xy xy; + using xy = boost::geometry::model::d2::point_xy; - boost::geometry::model::linestring line; - line += xy(1.1, 1.1), xy(2.5, 2.1), xy(3.1, 3.1), xy(4.9, 1.1), xy(3.1, 1.9); /*< With Boost.Assign >*/ + const boost::geometry::model::linestring line + {{1.1, 1.1}, {2.5, 2.1}, {3.1, 3.1}, {4.9, 1.1}, {3.1, 1.9}}; // Simplify it, using distance of 0.5 units boost::geometry::model::linestring simplified; @@ -36,7 +30,6 @@ int main() << " original: " << boost::geometry::dsv(line) << std::endl << "simplified: " << boost::geometry::dsv(simplified) << std::endl; - return 0; } diff --git a/doc/src/examples/algorithms/simplify_insert.cpp b/doc/src/examples/algorithms/simplify_insert.cpp index b80686f91d..457fd6b7ef 100644 --- a/doc/src/examples/algorithms/simplify_insert.cpp +++ b/doc/src/examples/algorithms/simplify_insert.cpp @@ -1,7 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // QuickBook Example -// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2011-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 @@ -18,8 +18,8 @@ int main() { - typedef boost::geometry::model::d2::point_xy P; - typedef boost::geometry::model::linestring

L; + using P = boost::geometry::model::d2::point_xy; + using L = boost::geometry::model::linestring

; L line; line.push_back(P(1.1, 1.1)); diff --git a/doc/src/examples/algorithms/simplify_insert_with_strategy.cpp b/doc/src/examples/algorithms/simplify_insert_with_strategy.cpp index 8615d84eca..4580fff970 100644 --- a/doc/src/examples/algorithms/simplify_insert_with_strategy.cpp +++ b/doc/src/examples/algorithms/simplify_insert_with_strategy.cpp @@ -1,7 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // QuickBook Example -// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2011-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 @@ -18,14 +18,14 @@ int main() { - typedef boost::geometry::model::d2::point_xy P; - typedef boost::geometry::model::linestring

L; + using P = boost::geometry::model::d2::point_xy; + using L = boost::geometry::model::linestring

; L line; boost::geometry::read_wkt("linestring(1.1 1.1, 2.5 2.1, 3.1 3.1, 4.9 1.1, 3.1 1.9)", line); - typedef boost::geometry::strategy::distance::projected_point DS; - typedef boost::geometry::strategy::simplify::douglas_peucker simplification; + using DS = boost::geometry::strategy::distance::projected_point; + using simplification = boost::geometry::strategy::simplify::douglas_peucker; L simplified; boost::geometry::simplify_inserter(line, std::back_inserter(simplified), 0.5, simplification()); //std::ostream_iterator

(std::cout, "\n"), 0.5);//); diff --git a/doc/src/examples/algorithms/sym_difference.cpp b/doc/src/examples/algorithms/sym_difference.cpp index 4b1cc5f92c..ed06a6e7d4 100644 --- a/doc/src/examples/algorithms/sym_difference.cpp +++ b/doc/src/examples/algorithms/sym_difference.cpp @@ -1,7 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // QuickBook Example -// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2011-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 @@ -17,12 +17,11 @@ #include #include -#include /*<-*/ #include "create_svg_overlay.hpp" /*->*/ int main() { - typedef boost::geometry::model::polygon > polygon; + using polygon = boost::geometry::model::polygon>; polygon green, blue; @@ -41,7 +40,7 @@ int main() << "green XOR blue:" << std::endl << "total: " << boost::geometry::area(multi) << std::endl; int i = 0; - BOOST_FOREACH(polygon const& p, multi) + for (polygon const& p : multi) { std::cout << i++ << ": " << boost::geometry::area(p) << std::endl; } diff --git a/doc/src/examples/algorithms/touches_two_geometries.cpp b/doc/src/examples/algorithms/touches_two_geometries.cpp index 1edba94ccb..539ae561d9 100644 --- a/doc/src/examples/algorithms/touches_two_geometries.cpp +++ b/doc/src/examples/algorithms/touches_two_geometries.cpp @@ -21,9 +21,9 @@ namespace bg = boost::geometry; /*< Convenient namespace alias >*/ int main() { // Checks if the two geometries touch - bg::model::polygon > poly1; + bg::model::polygon> poly1; bg::read_wkt("POLYGON((0 0,0 4,4 4,4 0,0 0))", poly1); - bg::model::polygon > poly2; + bg::model::polygon> poly2; bg::read_wkt("POLYGON((0 0,0 -4,-4 -4,-4 0,0 0))", poly2); bool check_touches = bg::touches(poly1, poly2); if (check_touches) { @@ -32,7 +32,7 @@ int main() std::cout << "Touches: No" << std::endl; } - bg::model::polygon > poly3; + bg::model::polygon> poly3; bg::read_wkt("POLYGON((1 1,0 -4,-4 -4,-4 0,1 1))", poly3); check_touches = bg::touches(poly1, poly3); if (check_touches) { diff --git a/doc/src/examples/algorithms/transform.cpp b/doc/src/examples/algorithms/transform.cpp index a50845b2cc..c6978e63bd 100644 --- a/doc/src/examples/algorithms/transform.cpp +++ b/doc/src/examples/algorithms/transform.cpp @@ -1,7 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // QuickBook Example -// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2011-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 @@ -19,11 +19,11 @@ int main() namespace bg = boost::geometry; // Select a point near the pole (theta=5.0, phi=15.0) - bg::model::point > p1(15.0, 5.0); + bg::model::point> p1(15.0, 5.0); // Transform from degree to radian. Default strategy is automatically selected, // it will convert from degree to radian - bg::model::point > p2; + bg::model::point> p2; bg::transform(p1, p2); // Transform from degree (lon-lat) to 3D (x,y,z). Default strategy is automatically selected, diff --git a/doc/src/examples/algorithms/transform_with_strategy.cpp b/doc/src/examples/algorithms/transform_with_strategy.cpp index 62a12dc5fd..5ce258a7f5 100644 --- a/doc/src/examples/algorithms/transform_with_strategy.cpp +++ b/doc/src/examples/algorithms/transform_with_strategy.cpp @@ -1,7 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // QuickBook Example -// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2011-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 @@ -13,13 +13,12 @@ #include #include - int main() { namespace trans = boost::geometry::strategy::transform; using boost::geometry::dsv; - typedef boost::geometry::model::point point_type; + using point_type = boost::geometry::model::point; point_type p1(1.0, 1.0); diff --git a/doc/src/examples/algorithms/union.cpp b/doc/src/examples/algorithms/union.cpp index e187ee879e..d723d17222 100644 --- a/doc/src/examples/algorithms/union.cpp +++ b/doc/src/examples/algorithms/union.cpp @@ -1,7 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // QuickBook Example -// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2011-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 @@ -17,12 +17,11 @@ #include #include -#include /*<-*/ #include "create_svg_overlay.hpp" /*->*/ int main() { - typedef boost::geometry::model::polygon > polygon; + using polygon = boost::geometry::model::polygon>; polygon green, blue; @@ -38,7 +37,7 @@ int main() int i = 0; std::cout << "green || blue:" << std::endl; - BOOST_FOREACH(polygon const& p, output) + for(polygon const& p : output) { std::cout << i++ << ": " << boost::geometry::area(p) << std::endl; } diff --git a/doc/src/examples/algorithms/unique.cpp b/doc/src/examples/algorithms/unique.cpp index 0b975698ef..c95a37060e 100644 --- a/doc/src/examples/algorithms/unique.cpp +++ b/doc/src/examples/algorithms/unique.cpp @@ -1,7 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // QuickBook Example -// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2011-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 @@ -20,7 +20,7 @@ BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian) int main() { - boost::geometry::model::polygon > poly; + boost::geometry::model::polygon> poly; boost::geometry::read_wkt("POLYGON((0 0,0 0,0 5,5 5,5 5,5 5,5 0,5 0,0 0,0 0,0 0,0 0))", poly); boost::geometry::unique(poly); std::cout << boost::geometry::wkt(poly) << std::endl; diff --git a/doc/src/examples/algorithms/within.cpp b/doc/src/examples/algorithms/within.cpp index b2e99acb8e..62ae0e9411 100644 --- a/doc/src/examples/algorithms/within.cpp +++ b/doc/src/examples/algorithms/within.cpp @@ -1,7 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // QuickBook Example -// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2011-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 @@ -20,8 +20,8 @@ int main() { - typedef boost::geometry::model::d2::point_xy point_type; - typedef boost::geometry::model::polygon polygon_type; + using point_type = boost::geometry::model::d2::point_xy; + using polygon_type = boost::geometry::model::polygon; polygon_type poly; boost::geometry::read_wkt( diff --git a/doc/src/examples/core/CMakeLists.txt b/doc/src/examples/core/CMakeLists.txt new file mode 100644 index 0000000000..00914edfa9 --- /dev/null +++ b/doc/src/examples/core/CMakeLists.txt @@ -0,0 +1,29 @@ +# Boost.Geometry +# 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) + +foreach(item IN ITEMS + get_point + get_box + set_point + set_box + degree_radian + coordinate_type + coordinate_system + coordinate_dimension + point_order + closure + interior_type + point_type + ring_type + rings + tag + tag_cast + ) + + boost_geometry_add_example("core" ${item}) + +endforeach() + diff --git a/doc/src/examples/core/Jamfile b/doc/src/examples/core/Jamfile index 2331497e43..2486111209 100644 --- a/doc/src/examples/core/Jamfile +++ b/doc/src/examples/core/Jamfile @@ -1,6 +1,6 @@ # Boost.Geometry (aka GGL, Generic Geometry Library) # -# Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. +# Copyright (c) 2007-2024 Barend Gehrels, Amsterdam, the Netherlands. # Copyright (c) 2008-2012 Bruno Lalande, Paris, France. # Copyright (c) 2009-2012 Mateusz Loskot, London, UK. @@ -29,5 +29,5 @@ exe interior_type : interior_type.cpp ; exe point_type : point_type.cpp ; exe ring_type : ring_type.cpp ; exe rings : rings.cpp ; -exe tag : tag.cpp : /boost/assign//boost_assign ; +exe tag : tag.cpp ; exe tag_cast : tag_cast.cpp ; diff --git a/doc/src/examples/core/closure.cpp b/doc/src/examples/core/closure.cpp index 6f76378e7a..b2f1895e4e 100644 --- a/doc/src/examples/core/closure.cpp +++ b/doc/src/examples/core/closure.cpp @@ -1,7 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // QuickBook Example -// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2011-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 @@ -18,8 +18,8 @@ int main() { - typedef boost::geometry::model::d2::point_xy point_type; - typedef boost::geometry::model::polygon polygon_type; + using point_type = boost::geometry::model::d2::point_xy; + using polygon_type = boost::geometry::model::polygon; boost::geometry::closure_selector clos = boost::geometry::closure::value; diff --git a/doc/src/examples/core/coordinate_dimension.cpp b/doc/src/examples/core/coordinate_dimension.cpp index 1664168605..a972a7f54a 100644 --- a/doc/src/examples/core/coordinate_dimension.cpp +++ b/doc/src/examples/core/coordinate_dimension.cpp @@ -1,7 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // QuickBook Example -// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2011-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 diff --git a/doc/src/examples/core/coordinate_system.cpp b/doc/src/examples/core/coordinate_system.cpp index 8f9879c466..a86c7551a5 100644 --- a/doc/src/examples/core/coordinate_system.cpp +++ b/doc/src/examples/core/coordinate_system.cpp @@ -1,7 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // QuickBook Example -// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2011-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 @@ -19,10 +19,10 @@ int main() { - typedef boost::geometry::model::d2::point_xy point_type; - typedef boost::geometry::model::polygon polygon_type; + using point_type = boost::geometry::model::d2::point_xy; + using polygon_type = boost::geometry::model::polygon; - typedef boost::geometry::coordinate_system::type system; + using system = boost::geometry::coordinate_system::type; std::cout << "system: " << typeid(system).name() << std::endl; diff --git a/doc/src/examples/core/coordinate_type.cpp b/doc/src/examples/core/coordinate_type.cpp index 2447e596c9..79fbc0f129 100644 --- a/doc/src/examples/core/coordinate_type.cpp +++ b/doc/src/examples/core/coordinate_type.cpp @@ -1,7 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // QuickBook Example -// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2011-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 @@ -19,10 +19,10 @@ int main() { - typedef boost::geometry::model::d2::point_xy point_type; - typedef boost::geometry::model::polygon polygon_type; + using point_type = boost::geometry::model::d2::point_xy; + using polygon_type = boost::geometry::model::polygon; - typedef boost::geometry::coordinate_type::type ctype; + using ctype = boost::geometry::coordinate_type::type; std::cout << "type: " << typeid(ctype).name() << std::endl; diff --git a/doc/src/examples/core/degree_radian.cpp b/doc/src/examples/core/degree_radian.cpp index 4fa375656a..1b15d82779 100644 --- a/doc/src/examples/core/degree_radian.cpp +++ b/doc/src/examples/core/degree_radian.cpp @@ -1,7 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // QuickBook Example -// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2011-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 @@ -17,8 +17,8 @@ using namespace boost::geometry; int main() { - typedef model::point > degree_point; - typedef model::point > radian_point; + using degree_point = model::point>; + using radian_point = model::point>; degree_point d(4.893, 52.373); radian_point r(0.041, 0.8527); diff --git a/doc/src/examples/core/get_box.cpp b/doc/src/examples/core/get_box.cpp index a159d4c730..7782685706 100644 --- a/doc/src/examples/core/get_box.cpp +++ b/doc/src/examples/core/get_box.cpp @@ -1,7 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // QuickBook Example -// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2011-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 @@ -19,7 +19,7 @@ namespace bg = boost::geometry; int main() { - bg::model::box > box; + bg::model::box> box; bg::assign_values(box, 1, 3, 5, 6); diff --git a/doc/src/examples/core/get_point.cpp b/doc/src/examples/core/get_point.cpp index 458c9877cb..040de3f8b9 100644 --- a/doc/src/examples/core/get_point.cpp +++ b/doc/src/examples/core/get_point.cpp @@ -1,7 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // QuickBook Example -// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2011-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 diff --git a/doc/src/examples/core/interior_type.cpp b/doc/src/examples/core/interior_type.cpp index 8c8ef4e224..39a640c3a0 100644 --- a/doc/src/examples/core/interior_type.cpp +++ b/doc/src/examples/core/interior_type.cpp @@ -1,7 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // QuickBook Example -// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2011-2024 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2023 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, @@ -28,12 +28,12 @@ int main() // Define a polygon storing points in a deque and storing interior rings // in a list (note that std::list is not supported by most algorithms // because not supporting a random access iterator) - typedef boost::geometry::model::polygon + using polygon = boost::geometry::model::polygon < boost::array, true, true, std::deque, std::list - > polygon; + >; std::cout << typeid(boost::geometry::interior_type::type).name() << std::endl; @@ -46,7 +46,7 @@ int main() /*` Output (using MSVC) is a long story (part manually replaced with ellipsis): [pre -class std::list,1,1,class std::deque,class std::allocator>,class std::allocator<...> > > +class std::list,1,1,class std::deque,class std::allocator>,class std::allocator<...>>> ] */ //] diff --git a/doc/src/examples/core/point_order.cpp b/doc/src/examples/core/point_order.cpp index 62b28c3889..6f00c0bd06 100644 --- a/doc/src/examples/core/point_order.cpp +++ b/doc/src/examples/core/point_order.cpp @@ -1,7 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // QuickBook Example -// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2011-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 @@ -18,8 +18,8 @@ int main() { - typedef boost::geometry::model::d2::point_xy point_type; - typedef boost::geometry::model::polygon polygon_type; + using point_type = boost::geometry::model::d2::point_xy; + using polygon_type = boost::geometry::model::polygon; boost::geometry::order_selector order = boost::geometry::point_order::value; diff --git a/doc/src/examples/core/point_type.cpp b/doc/src/examples/core/point_type.cpp index f9fc565c86..d48551bdfd 100644 --- a/doc/src/examples/core/point_type.cpp +++ b/doc/src/examples/core/point_type.cpp @@ -1,7 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // QuickBook Example -// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2011-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 @@ -20,11 +20,10 @@ int main() { - typedef boost::geometry::model::d2::point_xy point_type; - typedef boost::geometry::model::polygon polygon_type; - typedef boost::geometry::model::multi_polygon mp_type; - - typedef boost::geometry::point_type::type ptype; + using point_type = boost::geometry::model::d2::point_xy; + using polygon_type = boost::geometry::model::polygon; + using mp_type = boost::geometry::model::multi_polygon; + using ptype = boost::geometry::point_type::type; std::cout << "point type: " << typeid(ptype).name() << std::endl; diff --git a/doc/src/examples/core/ring_type.cpp b/doc/src/examples/core/ring_type.cpp index 781f4456c9..ba391c35a5 100644 --- a/doc/src/examples/core/ring_type.cpp +++ b/doc/src/examples/core/ring_type.cpp @@ -1,7 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // QuickBook Example -// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2011-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 @@ -19,11 +19,11 @@ int main() { - typedef boost::geometry::model::d2::point_xy point; - typedef boost::geometry::model::polygon polygon; + using point = boost::geometry::model::d2::point_xy; + using polygon = boost::geometry::model::polygon; - typedef boost::geometry::ring_type::type ring_type; - typedef boost::geometry::interior_type::type int_type; + using ring_type = boost::geometry::ring_type::type; + using int_type = boost::geometry::interior_type::type; std::cout << typeid(ring_type).name() << std::endl; std::cout << typeid(int_type).name() << std::endl; @@ -32,7 +32,7 @@ int main() // which is a Boost.Range compatible range // The type of an element of the collection is the very same ring type again. // We show that. - typedef boost::range_value::type int_ring_type; + using int_ring_type = boost::range_value::type; std::cout << std::boolalpha diff --git a/doc/src/examples/core/rings.cpp b/doc/src/examples/core/rings.cpp index 8d483d1840..4ce004ce0b 100644 --- a/doc/src/examples/core/rings.cpp +++ b/doc/src/examples/core/rings.cpp @@ -1,7 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // QuickBook Example -// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2011-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 @@ -23,12 +23,12 @@ Also shows the related ring_type and interior_type. int main() { - typedef boost::geometry::model::d2::point_xy point; - typedef boost::geometry::model::polygon polygon_type; + using point = boost::geometry::model::d2::point_xy; + using polygon_type = boost::geometry::model::polygon; polygon_type poly; - typedef boost::geometry::ring_type::type ring_type; + using ring_type = boost::geometry::ring_type::type; ring_type& ring = boost::geometry::exterior_ring(poly); // For a ring of model::polygon, you can call "push_back". @@ -44,17 +44,18 @@ int main() inner.push_back(point(2, 2)); inner.push_back(point(1, 1)); - typedef boost::geometry::interior_type::type int_type; - int_type& interiors = boost::geometry::interior_rings(poly); + auto& interiors = boost::geometry::interior_rings(poly); interiors.push_back(inner); std::cout << boost::geometry::dsv(poly) << std::endl; - // So int_type defines a collection of rings, + // Let int_type define a collection of rings, // which is a Boost.Range compatible range + using int_type = boost::geometry::interior_type::type; + // The type of an element of the collection is the very same ring type again. // We show that. - typedef boost::range_value::type int_ring_type; + using int_ring_type = boost::range_value::type; std::cout << std::boolalpha diff --git a/doc/src/examples/core/set_box.cpp b/doc/src/examples/core/set_box.cpp index c95e31042c..4eaabb8e78 100644 --- a/doc/src/examples/core/set_box.cpp +++ b/doc/src/examples/core/set_box.cpp @@ -1,7 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // QuickBook Example -// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2011-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 @@ -19,7 +19,7 @@ namespace bg = boost::geometry; int main() { - bg::model::box > box; + bg::model::box> box; bg::set(box, 0); bg::set(box, 2); diff --git a/doc/src/examples/core/set_point.cpp b/doc/src/examples/core/set_point.cpp index adab1fbe6f..3276376b0b 100644 --- a/doc/src/examples/core/set_point.cpp +++ b/doc/src/examples/core/set_point.cpp @@ -1,7 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // QuickBook Example -// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2011-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 diff --git a/doc/src/examples/core/tag.cpp b/doc/src/examples/core/tag.cpp index 5e4c706879..334322e223 100644 --- a/doc/src/examples/core/tag.cpp +++ b/doc/src/examples/core/tag.cpp @@ -1,7 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // QuickBook Example -// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2011-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 @@ -17,8 +17,6 @@ #include #include -#include /*< At the end to avoid conflicts with Boost.QVM >*/ - BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian) template struct dispatch {}; @@ -79,11 +77,11 @@ inline void hello(Geometry const& geometry) int main() { // Define polygon type (here: based on a Boost.Tuple) - typedef boost::geometry::model::polygon > polygon_type; + using polygon_type = boost::geometry::model::polygon>; // Declare and fill a polygon and a multipolygon polygon_type poly; - boost::geometry::exterior_ring(poly) = boost::assign::tuple_list_of(0, 0)(0, 10)(10, 5)(0, 0); + boost::geometry::exterior_ring(poly) = {{0, 0}, {0, 10}, {10, 5}, {0, 0}}; boost::geometry::model::multi_polygon multi; multi.push_back(poly); diff --git a/doc/src/examples/core/tag_cast.cpp b/doc/src/examples/core/tag_cast.cpp index ff4a7c82f7..0bcb69b5b9 100644 --- a/doc/src/examples/core/tag_cast.cpp +++ b/doc/src/examples/core/tag_cast.cpp @@ -1,7 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // QuickBook Example -// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2011-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 @@ -20,11 +20,11 @@ namespace geo = boost::geometry; int main() { - typedef geo::model::d2::point_xy point_type; - typedef geo::model::polygon polygon_type; + using point_type = geo::model::d2::point_xy; + using polygon_type = geo::model::polygon; - typedef geo::tag::type tag; - typedef geo::tag_cast::type base_tag; + using tag = geo::tag::type; + using base_tag = geo::tag_cast::type; std::cout << "tag: " << typeid(tag).name() << std::endl << "base tag: " << typeid(base_tag).name() << std::endl; diff --git a/doc/src/examples/examples_utils/create_svg_buffer.hpp b/doc/src/examples/examples_utils/create_svg_buffer.hpp index 00c6cc864b..15cbd3b153 100644 --- a/doc/src/examples/examples_utils/create_svg_buffer.hpp +++ b/doc/src/examples/examples_utils/create_svg_buffer.hpp @@ -21,7 +21,7 @@ template void create_svg_buffer(std::string const& filename, Geometry1 const& original, Geometry2 const& buffer) { #if defined(HAVE_SVG) - typedef typename boost::geometry::point_type::type point_type; + using point_type = typename boost::geometry::point_type::type; std::ofstream svg(filename.c_str()); boost::geometry::svg_mapper mapper(svg, 400, 400); diff --git a/doc/src/examples/geometries/CMakeLists.txt b/doc/src/examples/geometries/CMakeLists.txt new file mode 100644 index 0000000000..db3a759739 --- /dev/null +++ b/doc/src/examples/geometries/CMakeLists.txt @@ -0,0 +1,24 @@ +# Boost.Geometry +# 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) + +foreach(item IN ITEMS + box + linestring + point + point_xy + point_xyz + polygon + multi_linestring + multi_point + multi_polygon + ring + segment + ) + + boost_geometry_add_example("geometries" ${item}) + +endforeach() + diff --git a/doc/src/examples/geometries/adapted/boost_array.cpp b/doc/src/examples/geometries/adapted/boost_array.cpp index b654ab6472..4b5b6458b0 100644 --- a/doc/src/examples/geometries/adapted/boost_array.cpp +++ b/doc/src/examples/geometries/adapted/boost_array.cpp @@ -31,7 +31,7 @@ int main() boost::geometry::assign_values(b, 2.2, 3.3); std::cout << boost::geometry::distance(a, b) << std::endl; - boost::geometry::model::linestring > line; + boost::geometry::model::linestring> line; line.push_back(b); return 0; diff --git a/doc/src/examples/geometries/adapted/boost_polygon_box.cpp b/doc/src/examples/geometries/adapted/boost_polygon_box.cpp index dd465513c7..74ce084731 100644 --- a/doc/src/examples/geometries/adapted/boost_polygon_box.cpp +++ b/doc/src/examples/geometries/adapted/boost_polygon_box.cpp @@ -1,7 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // QuickBook Example -// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2011-2024 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2014 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, @@ -17,7 +17,7 @@ int main() { - typedef boost::polygon::rectangle_data rect; + using rect = boost::polygon::rectangle_data; rect b = boost::polygon::construct(1, 2, 3, 4); diff --git a/doc/src/examples/geometries/adapted/boost_polygon_polygon.cpp b/doc/src/examples/geometries/adapted/boost_polygon_polygon.cpp index 5444d832fe..2efae66a92 100644 --- a/doc/src/examples/geometries/adapted/boost_polygon_polygon.cpp +++ b/doc/src/examples/geometries/adapted/boost_polygon_polygon.cpp @@ -1,7 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // QuickBook Example -// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2011-2024 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2014 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, @@ -17,9 +17,9 @@ int main() { - typedef boost::polygon::polygon_with_holes_data polygon; - typedef boost::polygon::polygon_traits::point_type point; - typedef boost::polygon::polygon_with_holes_traits::hole_type hole; + using polygon = boost::polygon::polygon_with_holes_data; + using point = boost::polygon::polygon_traits::point_type; + using hole = boost::polygon::polygon_with_holes_traits::hole_type; point pts[5] = { boost::polygon::construct(0, 0), diff --git a/doc/src/examples/geometries/adapted/boost_polygon_ring.cpp b/doc/src/examples/geometries/adapted/boost_polygon_ring.cpp index e0cfd6dcb8..940eb76e3f 100644 --- a/doc/src/examples/geometries/adapted/boost_polygon_ring.cpp +++ b/doc/src/examples/geometries/adapted/boost_polygon_ring.cpp @@ -1,7 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // QuickBook Example -// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2011-2024 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2014 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, @@ -17,8 +17,8 @@ int main() { - typedef boost::polygon::polygon_data polygon; - typedef boost::polygon::polygon_traits::point_type point; + using polygon = boost::polygon::polygon_data; + using point = boost::polygon::polygon_traits::point_type; point pts[5] = { boost::polygon::construct(0, 0), diff --git a/doc/src/examples/geometries/adapted/boost_range/filtered.cpp b/doc/src/examples/geometries/adapted/boost_range/filtered.cpp index 174c0425b0..935447333b 100644 --- a/doc/src/examples/geometries/adapted/boost_range/filtered.cpp +++ b/doc/src/examples/geometries/adapted/boost_range/filtered.cpp @@ -1,7 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // QuickBook Example -// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2011-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 @@ -29,7 +29,7 @@ struct not_two int main() { - typedef boost::geometry::model::d2::point_xy xy; + using xy = boost::geometry::model::d2::point_xy; boost::geometry::model::linestring line; line.push_back(xy(0, 0)); line.push_back(xy(1, 1)); diff --git a/doc/src/examples/geometries/adapted/boost_range/reversed.cpp b/doc/src/examples/geometries/adapted/boost_range/reversed.cpp index 44e8068c77..f2c760bb41 100644 --- a/doc/src/examples/geometries/adapted/boost_range/reversed.cpp +++ b/doc/src/examples/geometries/adapted/boost_range/reversed.cpp @@ -1,7 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // QuickBook Example -// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2011-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 @@ -19,7 +19,7 @@ int main() { - typedef boost::geometry::model::d2::point_xy xy; + using xy = boost::geometry::model::d2::point_xy; boost::geometry::model::linestring line; line.push_back(xy(0, 0)); line.push_back(xy(1, 1)); diff --git a/doc/src/examples/geometries/adapted/boost_range/sliced.cpp b/doc/src/examples/geometries/adapted/boost_range/sliced.cpp index 45cab8195a..8d5ce4f9ed 100644 --- a/doc/src/examples/geometries/adapted/boost_range/sliced.cpp +++ b/doc/src/examples/geometries/adapted/boost_range/sliced.cpp @@ -1,7 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // QuickBook Example -// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2011-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 @@ -17,14 +17,11 @@ #include #include -#include /*< At the end to avoid conflicts with Boost.QVM >*/ - - int main() { using namespace boost::assign; - typedef boost::geometry::model::d2::point_xy xy; + using xy = boost::geometry::model::d2::point_xy; boost::geometry::model::linestring line; line += xy(0, 0); line += xy(1, 1); diff --git a/doc/src/examples/geometries/adapted/boost_range/strided.cpp b/doc/src/examples/geometries/adapted/boost_range/strided.cpp index 1ed9b5ecc5..7642919553 100644 --- a/doc/src/examples/geometries/adapted/boost_range/strided.cpp +++ b/doc/src/examples/geometries/adapted/boost_range/strided.cpp @@ -1,7 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // QuickBook Example -// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2011-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 @@ -17,15 +17,12 @@ #include #include -#include /*< At the end to avoid conflicts with Boost.QVM >*/ - - int main() { using namespace boost::assign; using boost::adaptors::strided; - typedef boost::geometry::model::d2::point_xy xy; + using xy = boost::geometry::model::d2::point_xy; boost::geometry::model::ring ring; ring += xy(0, 0); ring += xy(0, 1); diff --git a/doc/src/examples/geometries/adapted/boost_range/uniqued.cpp b/doc/src/examples/geometries/adapted/boost_range/uniqued.cpp index 6df47dee13..99453cad0f 100644 --- a/doc/src/examples/geometries/adapted/boost_range/uniqued.cpp +++ b/doc/src/examples/geometries/adapted/boost_range/uniqued.cpp @@ -1,7 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // QuickBook Example -// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2011-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 @@ -12,14 +12,12 @@ #include -#include - #include #include #include #include -typedef boost::geometry::model::d2::point_xy xy; +using xy = boost::geometry::model::d2::point_xy; inline bool operator==(xy const& left, xy const& right) { diff --git a/doc/src/examples/geometries/adapted/boost_tuple.cpp b/doc/src/examples/geometries/adapted/boost_tuple.cpp index 6c6599c5e5..9fa06089d6 100644 --- a/doc/src/examples/geometries/adapted/boost_tuple.cpp +++ b/doc/src/examples/geometries/adapted/boost_tuple.cpp @@ -26,7 +26,7 @@ BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian) int main() { - boost::geometry::model::polygon > poly; + boost::geometry::model::polygon> poly; poly.outer().push_back(boost::make_tuple(1.0, 2.0)); poly.outer().push_back(boost::make_tuple(6.0, 4.0)); poly.outer().push_back(boost::make_tuple(5.0, 1.0)); diff --git a/doc/src/examples/geometries/adapted/std_array.cpp b/doc/src/examples/geometries/adapted/std_array.cpp index 28068cb9cf..c2d6904669 100644 --- a/doc/src/examples/geometries/adapted/std_array.cpp +++ b/doc/src/examples/geometries/adapted/std_array.cpp @@ -33,7 +33,7 @@ int main() boost::geometry::assign_values(b, 2.2, 3.3); std::cout << boost::geometry::distance(a, b) << std::endl; - boost::geometry::model::linestring > line; + boost::geometry::model::linestring> line; line.push_back(b); return 0; diff --git a/doc/src/examples/geometries/box.cpp b/doc/src/examples/geometries/box.cpp index 9a39a6d036..ee31f50038 100644 --- a/doc/src/examples/geometries/box.cpp +++ b/doc/src/examples/geometries/box.cpp @@ -1,7 +1,7 @@ // Boost.Geometry // QuickBook Example -// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2011-2024 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2015 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, @@ -18,8 +18,8 @@ namespace bg = boost::geometry; int main() { - typedef bg::model::point point_t; - typedef bg::model::box box_t; + using point_t = bg::model::point; + using box_t = bg::model::box; box_t box1; /*< Default-construct a box. >*/ box_t box2(point_t(0.0, 0.0), point_t(5.0, 5.0)); /*< Construct, assigning min and max corner point. >*/ diff --git a/doc/src/examples/geometries/linestring.cpp b/doc/src/examples/geometries/linestring.cpp index e6c916216f..b6f167f0ee 100644 --- a/doc/src/examples/geometries/linestring.cpp +++ b/doc/src/examples/geometries/linestring.cpp @@ -1,7 +1,7 @@ // Boost.Geometry // QuickBook Example -// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2011-2024 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2015 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, @@ -19,8 +19,8 @@ namespace bg = boost::geometry; int main() { - typedef bg::model::point point_t; - typedef bg::model::linestring linestring_t; + using point_t = bg::model::point; + using linestring_t = bg::model::linestring; linestring_t ls1; /*< Default-construct a linestring. >*/ linestring_t ls2{{0.0, 0.0}, {1.0, 0.0}, {1.0, 2.0}}; /*< Construct a linestring containing three points, using C++11 unified initialization syntax. >*/ diff --git a/doc/src/examples/geometries/multi_linestring.cpp b/doc/src/examples/geometries/multi_linestring.cpp index d5da789f7a..c50ca4995b 100644 --- a/doc/src/examples/geometries/multi_linestring.cpp +++ b/doc/src/examples/geometries/multi_linestring.cpp @@ -1,7 +1,7 @@ // Boost.Geometry // QuickBook Example -// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2011-2024 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2015 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, @@ -19,9 +19,9 @@ namespace bg = boost::geometry; int main() { - typedef bg::model::point point_t; - typedef bg::model::linestring linestring_t; - typedef bg::model::multi_linestring mlinestring_t; + using point_t = bg::model::point; + using linestring_t = bg::model::linestring; + using mlinestring_t = bg::model::multi_linestring; mlinestring_t mls1; /*< Default-construct a multi_linestring. >*/ mlinestring_t mls2{{{0.0, 0.0}, {0.0, 1.0}, {2.0, 1.0}}, diff --git a/doc/src/examples/geometries/multi_point.cpp b/doc/src/examples/geometries/multi_point.cpp index 8250014089..1c9d53b90d 100644 --- a/doc/src/examples/geometries/multi_point.cpp +++ b/doc/src/examples/geometries/multi_point.cpp @@ -1,7 +1,7 @@ // Boost.Geometry // QuickBook Example -// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2011-2024 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2015 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, @@ -19,8 +19,8 @@ namespace bg = boost::geometry; int main() { - typedef bg::model::point point_t; - typedef bg::model::multi_point mpoint_t; + using point_t = bg::model::point; + using mpoint_t = bg::model::multi_point; mpoint_t mpt1; /*< Default-construct a multi_point. >*/ mpoint_t mpt2{{{0.0, 0.0}, {1.0, 1.0}, {2.0, 2.0}}}; /*< Construct a multi_point containing three points, using C++11 unified initialization syntax. >*/ diff --git a/doc/src/examples/geometries/multi_polygon.cpp b/doc/src/examples/geometries/multi_polygon.cpp index 836b52ea46..787f08f7f2 100644 --- a/doc/src/examples/geometries/multi_polygon.cpp +++ b/doc/src/examples/geometries/multi_polygon.cpp @@ -1,7 +1,7 @@ // Boost.Geometry // QuickBook Example -// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2011-2024 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2015 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, @@ -19,9 +19,9 @@ namespace bg = boost::geometry; int main() { - typedef bg::model::point point_t; - typedef bg::model::polygon polygon_t; /*< Default parameters, clockwise, closed polygon. >*/ - typedef bg::model::multi_polygon mpolygon_t; /*< Clockwise, closed multi_polygon. >*/ + using point_t = bg::model::point; + using polygon_t = bg::model::polygon; /*< Default parameters, clockwise, closed polygon. >*/ + using mpolygon_t = bg::model::multi_polygon; /*< Clockwise, closed multi_polygon. >*/ mpolygon_t mpoly1; /*< Default-construct a multi_polygon. >*/ mpolygon_t mpoly2{{{{0.0, 0.0}, {0.0, 5.0}, {5.0, 5.0}, {5.0, 0.0}, {0.0, 0.0}}, diff --git a/doc/src/examples/geometries/polygon.cpp b/doc/src/examples/geometries/polygon.cpp index 0dbba78e32..07b857be8f 100644 --- a/doc/src/examples/geometries/polygon.cpp +++ b/doc/src/examples/geometries/polygon.cpp @@ -1,7 +1,7 @@ // Boost.Geometry // QuickBook Example -// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2011-2024 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2015 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, @@ -19,8 +19,8 @@ namespace bg = boost::geometry; int main() { - typedef bg::model::point point_t; - typedef bg::model::polygon polygon_t; /*< Default parameters, clockwise, closed polygon. >*/ + using point_t = bg::model::point; + using polygon_t = bg::model::polygon; /*< Default parameters, clockwise, closed polygon. >*/ polygon_t poly1; /*< Default-construct a polygon. >*/ diff --git a/doc/src/examples/geometries/register/box_templated.cpp b/doc/src/examples/geometries/register/box_templated.cpp index c54e19e06a..b5f921c0d8 100644 --- a/doc/src/examples/geometries/register/box_templated.cpp +++ b/doc/src/examples/geometries/register/box_templated.cpp @@ -1,7 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // QuickBook Example -// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2011-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 @@ -27,7 +27,7 @@ BOOST_GEOMETRY_REGISTER_BOX_TEMPLATED(my_box, ll, ur) int main() { - typedef my_box > box; + using box = my_box>; box b = boost::geometry::make(0, 0, 2, 2); std::cout << "Area: " << boost::geometry::area(b) << std::endl; return 0; diff --git a/doc/src/examples/geometries/register/linestring.cpp b/doc/src/examples/geometries/register/linestring.cpp index ab5f5998ab..e21105fe7e 100644 --- a/doc/src/examples/geometries/register/linestring.cpp +++ b/doc/src/examples/geometries/register/linestring.cpp @@ -1,7 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // QuickBook Example -// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2011-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 @@ -16,7 +16,7 @@ #include #include -typedef boost::geometry::model::d2::point_xy point_2d; +using point_2d = boost::geometry::model::d2::point_xy; BOOST_GEOMETRY_REGISTER_LINESTRING(std::vector) diff --git a/doc/src/examples/geometries/register/linestring_templated.cpp b/doc/src/examples/geometries/register/linestring_templated.cpp index 5722b581db..d73520e32f 100644 --- a/doc/src/examples/geometries/register/linestring_templated.cpp +++ b/doc/src/examples/geometries/register/linestring_templated.cpp @@ -22,7 +22,7 @@ BOOST_GEOMETRY_REGISTER_LINESTRING_TEMPLATED(std::deque) int main() { - std::deque > line(2); + std::deque> line(2); boost::geometry::assign_values(line[0], 1, 1); boost::geometry::assign_values(line[1], 2, 2); diff --git a/doc/src/examples/geometries/register/multi_linestring.cpp b/doc/src/examples/geometries/register/multi_linestring.cpp index 77a6c614d7..c2a25f1a1a 100644 --- a/doc/src/examples/geometries/register/multi_linestring.cpp +++ b/doc/src/examples/geometries/register/multi_linestring.cpp @@ -1,7 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // QuickBook Example -// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2011-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 @@ -17,10 +17,10 @@ #include #include -typedef boost::geometry::model::linestring +using linestring_type = boost::geometry::model::linestring < boost::tuple - > linestring_type; + >; BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian) BOOST_GEOMETRY_REGISTER_MULTI_LINESTRING(std::deque) diff --git a/doc/src/examples/geometries/register/multi_point.cpp b/doc/src/examples/geometries/register/multi_point.cpp index c4ce3a49bd..3e4ee4852b 100644 --- a/doc/src/examples/geometries/register/multi_point.cpp +++ b/doc/src/examples/geometries/register/multi_point.cpp @@ -1,7 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // QuickBook Example -// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2011-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 @@ -15,7 +15,7 @@ #include #include -typedef boost::tuple point_type; +using point_type = boost::tuple; BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian) BOOST_GEOMETRY_REGISTER_MULTI_POINT(std::deque< ::point_type >) diff --git a/doc/src/examples/geometries/register/multi_point_templated.cpp b/doc/src/examples/geometries/register/multi_point_templated.cpp index 437cbd6d07..032885c2dd 100644 --- a/doc/src/examples/geometries/register/multi_point_templated.cpp +++ b/doc/src/examples/geometries/register/multi_point_templated.cpp @@ -23,7 +23,7 @@ BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian) int main() { // Normal usage of std:: - std::deque > multi_point; + std::deque> multi_point; multi_point.push_back(boost::tuple(1, 1)); multi_point.push_back(boost::tuple(3, 2)); diff --git a/doc/src/examples/geometries/register/multi_polygon.cpp b/doc/src/examples/geometries/register/multi_polygon.cpp index 1cfc9d832c..7413a2c55e 100644 --- a/doc/src/examples/geometries/register/multi_polygon.cpp +++ b/doc/src/examples/geometries/register/multi_polygon.cpp @@ -1,7 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // QuickBook Example -// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2011-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 @@ -17,10 +17,10 @@ #include #include -typedef boost::geometry::model::polygon +using polygon_type = boost::geometry::model::polygon < boost::tuple - > polygon_type; + >; BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian) BOOST_GEOMETRY_REGISTER_MULTI_POLYGON(std::vector) diff --git a/doc/src/examples/geometries/register/ring.cpp b/doc/src/examples/geometries/register/ring.cpp index 58f35a4476..fd0dbf12e4 100644 --- a/doc/src/examples/geometries/register/ring.cpp +++ b/doc/src/examples/geometries/register/ring.cpp @@ -1,7 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // QuickBook Example -// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2011-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 @@ -16,7 +16,7 @@ #include #include -typedef boost::geometry::model::d2::point_xy point_2d; +using point_2d = boost::geometry::model::d2::point_xy; BOOST_GEOMETRY_REGISTER_RING(std::vector) /*< The magic: adapt vector to Boost.Geometry Ring Concept >*/ diff --git a/doc/src/examples/geometries/register/ring_templated.cpp b/doc/src/examples/geometries/register/ring_templated.cpp index a3223421ad..104d715ec5 100644 --- a/doc/src/examples/geometries/register/ring_templated.cpp +++ b/doc/src/examples/geometries/register/ring_templated.cpp @@ -22,7 +22,7 @@ BOOST_GEOMETRY_REGISTER_RING_TEMPLATED(std::deque) int main() { - std::deque > ring(3); + std::deque> ring(3); boost::geometry::assign_values(ring[0], 0, 0); boost::geometry::assign_values(ring[2], 4, 1); boost::geometry::assign_values(ring[1], 1, 4); diff --git a/doc/src/examples/geometries/ring.cpp b/doc/src/examples/geometries/ring.cpp index 68df0c7dc5..807f8a9f7a 100644 --- a/doc/src/examples/geometries/ring.cpp +++ b/doc/src/examples/geometries/ring.cpp @@ -1,7 +1,7 @@ // Boost.Geometry // QuickBook Example -// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2011-2024 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2015 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, @@ -19,8 +19,8 @@ namespace bg = boost::geometry; int main() { - typedef bg::model::point point_t; - typedef bg::model::ring ring_t; /*< Default parameters, clockwise, closed ring. >*/ + using point_t = bg::model::point; + using ring_t = bg::model::ring; /*< Default parameters, clockwise, closed ring. >*/ ring_t ring1; /*< Default-construct a ring. >*/ ring_t ring2{{0.0, 0.0}, {0.0, 5.0}, {5.0, 5.0}, {5.0, 0.0}, {0.0, 0.0}}; /*< Construct a ring containing four points plus one closing point, using C++11 unified initialization syntax. >*/ diff --git a/doc/src/examples/geometries/segment.cpp b/doc/src/examples/geometries/segment.cpp index 855fcce238..35c23a5d99 100644 --- a/doc/src/examples/geometries/segment.cpp +++ b/doc/src/examples/geometries/segment.cpp @@ -1,7 +1,7 @@ // Boost.Geometry // QuickBook Example -// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2011-2024 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2015 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, @@ -19,8 +19,8 @@ namespace bg = boost::geometry; int main() { - typedef bg::model::point point_t; - typedef bg::model::segment segment_t; + using point_t = bg::model::point; + using segment_t = bg::model::segment; segment_t seg1; /*< Default-construct a segment. >*/ segment_t seg2(point_t(0.0, 0.0), point_t(5.0, 5.0)); /*< Construct, assigning the first and the second point. >*/ diff --git a/doc/src/examples/io/CMakeLists.txt b/doc/src/examples/io/CMakeLists.txt new file mode 100644 index 0000000000..a159b6bd7d --- /dev/null +++ b/doc/src/examples/io/CMakeLists.txt @@ -0,0 +1,19 @@ +# Boost.Geometry +# 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) + +foreach(item IN ITEMS + svg + svg_mapper_custom + wkt + read_wkt + to_wkt + from_wkt + ) + + boost_geometry_add_example("io" ${item}) + +endforeach() + diff --git a/doc/src/examples/io/read_wkt.cpp b/doc/src/examples/io/read_wkt.cpp index 55ed25e97b..b77d84636b 100644 --- a/doc/src/examples/io/read_wkt.cpp +++ b/doc/src/examples/io/read_wkt.cpp @@ -1,7 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // QuickBook Example -// Copyright (c) 2014 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2014-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 @@ -17,7 +17,7 @@ int main() { - typedef boost::geometry::model::d2::point_xy point_type; + using point_type = boost::geometry::model::d2::point_xy; point_type a; boost::geometry::model::linestring b; diff --git a/doc/src/examples/io/svg.cpp b/doc/src/examples/io/svg.cpp index 5c7ca91b3b..37fbee680b 100644 --- a/doc/src/examples/io/svg.cpp +++ b/doc/src/examples/io/svg.cpp @@ -1,14 +1,17 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // QuickBook Example -// Copyright (c) 2013 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2013-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) //[svg_mapper -//` Shows the usage of svg_mapper +//` Shows the usage of svg_mapper. +//` Make sure to first call only the method [^add] and then call only the methods [^map] or [^text]. +//` Because [^add] calculates the bounding box internally and that should be finished +//` before calling mapping functions. This might require two loops. #include #include @@ -20,7 +23,7 @@ int main() { // Specify the basic type - typedef boost::geometry::model::d2::point_xy point_type; + using point_type = boost::geometry::model::d2::point_xy; // Declare some geometries and set their values point_type a; diff --git a/doc/src/examples/io/svg_mapper_custom.cpp b/doc/src/examples/io/svg_mapper_custom.cpp index 4ce67ed278..dc0f5530b0 100644 --- a/doc/src/examples/io/svg_mapper_custom.cpp +++ b/doc/src/examples/io/svg_mapper_custom.cpp @@ -1,14 +1,14 @@ // Boost.Geometry // QuickBook Example -// Copyright (c) 2020 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2020-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) //[svg_mapper_custom -//` Shows the usage of svg_mapper with arrows, groups and a larger margin +//` Shows the usage of svg_mapper with arrows, groups and a larger margin. #include #include diff --git a/doc/src/examples/io/to_wkt.cpp b/doc/src/examples/io/to_wkt.cpp index fc04b51b6f..59dea14535 100644 --- a/doc/src/examples/io/to_wkt.cpp +++ b/doc/src/examples/io/to_wkt.cpp @@ -19,7 +19,7 @@ int main() { namespace geom = boost::geometry; - typedef geom::model::d2::point_xy point_type; + using point_type = geom::model::d2::point_xy; point_type point = geom::make(3, 2); geom::model::polygon polygon; diff --git a/doc/src/examples/io/wkt.cpp b/doc/src/examples/io/wkt.cpp index 40d54fa712..2e1d95dfd7 100644 --- a/doc/src/examples/io/wkt.cpp +++ b/doc/src/examples/io/wkt.cpp @@ -1,7 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // QuickBook Example -// Copyright (c) 2014 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2014-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 @@ -19,7 +19,7 @@ int main() { namespace geom = boost::geometry; - typedef geom::model::d2::point_xy point_type; + using point_type = geom::model::d2::point_xy; point_type point = geom::make(3, 6); geom::model::polygon polygon; diff --git a/doc/src/examples/quick_start.cpp b/doc/src/examples/quick_start.cpp index 41d3beb32a..8e15c27e47 100644 --- a/doc/src/examples/quick_start.cpp +++ b/doc/src/examples/quick_start.cpp @@ -1,7 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // Quickbook Examples, for main page -// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2007-2024 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK. @@ -73,8 +73,8 @@ BOOST_GEOMETRY_REGISTER_POINT_2D(QPoint, int, cs::cartesian, x, y) namespace boost { namespace geometry { namespace traits { -template <> struct tag { typedef box_tag type; }; -template <> struct point_type { typedef QPoint type; }; +template <> struct tag { using type = box_tag; }; +template <> struct point_type { using type = QPoint; }; template struct indexed_access @@ -119,7 +119,7 @@ int main(void) //[quickstart_point_in_polygon double points[][2] = {{2.0, 1.3}, {4.1, 3.0}, {5.3, 2.6}, {2.9, 0.7}, {2.0, 1.3}}; - model::polygon > poly; + model::polygon> poly; append(poly, points); boost::tuple p = boost::make_tuple(3.7, 2.0); std::cout << "Point p is in polygon? " << std::boolalpha << within(p, poly) << std::endl; @@ -135,10 +135,10 @@ int main(void) //] //[quick_start_spherical - typedef boost::geometry::model::point + using spherical_point = boost::geometry::model::point < double, 2, boost::geometry::cs::spherical_equatorial - > spherical_point; + >; spherical_point amsterdam(4.90, 52.37); spherical_point paris(2.35, 48.86); diff --git a/doc/src/examples/strategies/CMakeLists.txt b/doc/src/examples/strategies/CMakeLists.txt new file mode 100644 index 0000000000..ca02b93271 --- /dev/null +++ b/doc/src/examples/strategies/CMakeLists.txt @@ -0,0 +1,22 @@ +# Boost.Geometry +# 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) + +foreach(item IN ITEMS + buffer_point_circle + buffer_geographic_point_circle + buffer_point_square + buffer_join_round + buffer_join_miter + buffer_end_round + buffer_end_flat + buffer_distance_symmetric + buffer_distance_asymmetric + ) + + boost_geometry_add_example("strategies" ${item}) + +endforeach() + diff --git a/doc/src/examples/strategies/buffer_distance_asymmetric.cpp b/doc/src/examples/strategies/buffer_distance_asymmetric.cpp index 4b09f08444..dd0a707057 100644 --- a/doc/src/examples/strategies/buffer_distance_asymmetric.cpp +++ b/doc/src/examples/strategies/buffer_distance_asymmetric.cpp @@ -1,7 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // QuickBook Example -// Copyright (c) 2014 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2014-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 @@ -17,9 +17,9 @@ int main() { - typedef boost::geometry::model::d2::point_xy point; - typedef boost::geometry::model::linestring linestring; - typedef boost::geometry::model::polygon polygon; + using point = boost::geometry::model::d2::point_xy; + using linestring = boost::geometry::model::linestring; + using polygon = boost::geometry::model::polygon; // Declare the asymmetric distance strategy boost::geometry::strategy::buffer::distance_asymmetric distance_strategy(1.0, 0.5); diff --git a/doc/src/examples/strategies/buffer_distance_symmetric.cpp b/doc/src/examples/strategies/buffer_distance_symmetric.cpp index b3f481204b..eb0295252d 100644 --- a/doc/src/examples/strategies/buffer_distance_symmetric.cpp +++ b/doc/src/examples/strategies/buffer_distance_symmetric.cpp @@ -1,7 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // QuickBook Example -// Copyright (c) 2014 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2014-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 @@ -17,9 +17,9 @@ int main() { - typedef boost::geometry::model::d2::point_xy point; - typedef boost::geometry::model::linestring linestring; - typedef boost::geometry::model::polygon polygon; + using point = boost::geometry::model::d2::point_xy; + using linestring = boost::geometry::model::linestring; + using polygon = boost::geometry::model::polygon; // Declare the symmetric distance strategy boost::geometry::strategy::buffer::distance_symmetric distance_strategy(0.5); diff --git a/doc/src/examples/strategies/buffer_end_flat.cpp b/doc/src/examples/strategies/buffer_end_flat.cpp index f91f77b71d..664402e49a 100644 --- a/doc/src/examples/strategies/buffer_end_flat.cpp +++ b/doc/src/examples/strategies/buffer_end_flat.cpp @@ -1,7 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // QuickBook Example -// Copyright (c) 2014 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2014-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 @@ -17,9 +17,9 @@ int main() { - typedef boost::geometry::model::d2::point_xy point; - typedef boost::geometry::model::linestring linestring; - typedef boost::geometry::model::polygon polygon; + using point = boost::geometry::model::d2::point_xy; + using linestring = boost::geometry::model::linestring; + using polygon = boost::geometry::model::polygon; // Declare the flat-end strategy boost::geometry::strategy::buffer::end_flat end_strategy; diff --git a/doc/src/examples/strategies/buffer_end_round.cpp b/doc/src/examples/strategies/buffer_end_round.cpp index c36fd4e53c..d8b9ca0dfe 100644 --- a/doc/src/examples/strategies/buffer_end_round.cpp +++ b/doc/src/examples/strategies/buffer_end_round.cpp @@ -1,7 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // QuickBook Example -// Copyright (c) 2014 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2014-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 @@ -17,9 +17,9 @@ int main() { - typedef boost::geometry::model::d2::point_xy point; - typedef boost::geometry::model::linestring linestring; - typedef boost::geometry::model::polygon polygon; + using point = boost::geometry::model::d2::point_xy; + using linestring = boost::geometry::model::linestring; + using polygon = boost::geometry::model::polygon; // Declare the round-end strategy with 36 points for a full circle boost::geometry::strategy::buffer::end_round end_strategy(36); diff --git a/doc/src/examples/strategies/buffer_geographic_point_circle.cpp b/doc/src/examples/strategies/buffer_geographic_point_circle.cpp index 4a160070e6..852c563371 100644 --- a/doc/src/examples/strategies/buffer_geographic_point_circle.cpp +++ b/doc/src/examples/strategies/buffer_geographic_point_circle.cpp @@ -1,7 +1,7 @@ // Boost.Geometry // QuickBook Example -// Copyright (c) 2019 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2019-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 @@ -17,7 +17,7 @@ int main() { namespace bg = boost::geometry; - typedef bg::model::point > point; + using point = bg::model::point>; // Declare the geographic_point_circle strategy (with 36 points) // Default template arguments (taking Andoyer strategy) @@ -36,7 +36,7 @@ int main() bg::read_wkt("POINT(4.9 52.1)", p); // Create the buffer of a point on the Earth - bg::model::multi_polygon > result; + bg::model::multi_polygon> result; bg::buffer(p, result, distance_strategy, side_strategy, join_strategy, end_strategy, point_strategy); diff --git a/doc/src/examples/strategies/buffer_join_miter.cpp b/doc/src/examples/strategies/buffer_join_miter.cpp index be1ce84c12..e11b94cee4 100644 --- a/doc/src/examples/strategies/buffer_join_miter.cpp +++ b/doc/src/examples/strategies/buffer_join_miter.cpp @@ -1,7 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // QuickBook Example -// Copyright (c) 2014 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2014-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 @@ -17,8 +17,8 @@ int main() { - typedef boost::geometry::model::d2::point_xy point; - typedef boost::geometry::model::polygon polygon; + using point = boost::geometry::model::d2::point_xy; + using polygon = boost::geometry::model::polygon; // Declare the join_miter strategy boost::geometry::strategy::buffer::join_miter join_strategy; diff --git a/doc/src/examples/strategies/buffer_join_round.cpp b/doc/src/examples/strategies/buffer_join_round.cpp index 812a1a8e3f..a219f26f64 100644 --- a/doc/src/examples/strategies/buffer_join_round.cpp +++ b/doc/src/examples/strategies/buffer_join_round.cpp @@ -1,7 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // QuickBook Example -// Copyright (c) 2014 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2014-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 @@ -17,8 +17,8 @@ int main() { - typedef boost::geometry::model::d2::point_xy point; - typedef boost::geometry::model::polygon polygon; + using point = boost::geometry::model::d2::point_xy; + using polygon = boost::geometry::model::polygon; // Declare the join_round strategy with 72 points for a full circle boost::geometry::strategy::buffer::join_round join_strategy(72); diff --git a/doc/src/examples/strategies/buffer_point_circle.cpp b/doc/src/examples/strategies/buffer_point_circle.cpp index 82b805ea9e..31db7bdafa 100644 --- a/doc/src/examples/strategies/buffer_point_circle.cpp +++ b/doc/src/examples/strategies/buffer_point_circle.cpp @@ -1,7 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // QuickBook Example -// Copyright (c) 2014 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2014-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 @@ -17,8 +17,8 @@ int main() { - typedef boost::geometry::model::d2::point_xy point; - typedef boost::geometry::model::polygon polygon; + using point = boost::geometry::model::d2::point_xy; + using polygon = boost::geometry::model::polygon; // Declare the point_circle strategy boost::geometry::strategy::buffer::point_circle point_strategy(360); diff --git a/doc/src/examples/strategies/buffer_point_square.cpp b/doc/src/examples/strategies/buffer_point_square.cpp index d50c99d662..5de50de922 100644 --- a/doc/src/examples/strategies/buffer_point_square.cpp +++ b/doc/src/examples/strategies/buffer_point_square.cpp @@ -1,7 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // QuickBook Example -// Copyright (c) 2014 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2014-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 @@ -18,8 +18,8 @@ int main() { - typedef boost::geometry::model::d2::point_xy point; - typedef boost::geometry::model::polygon polygon; + using point = boost::geometry::model::d2::point_xy; + using polygon = boost::geometry::model::polygon; // Declare the point_square strategy boost::geometry::strategy::buffer::point_square point_strategy; diff --git a/doc/src/examples/views/CMakeLists.txt b/doc/src/examples/views/CMakeLists.txt new file mode 100644 index 0000000000..dbcfc8008f --- /dev/null +++ b/doc/src/examples/views/CMakeLists.txt @@ -0,0 +1,15 @@ +# Boost.Geometry +# 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) + +foreach(item IN ITEMS + box_view + segment_view + ) + + boost_geometry_add_example("views" ${item}) + +endforeach() + diff --git a/doc/src/examples/views/box_view.cpp b/doc/src/examples/views/box_view.cpp index e968a867c7..f821c46b99 100644 --- a/doc/src/examples/views/box_view.cpp +++ b/doc/src/examples/views/box_view.cpp @@ -1,7 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // QuickBook Example -// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2011-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 @@ -17,13 +17,13 @@ int main() { - typedef boost::geometry::model::box + using box_type = boost::geometry::model::box < boost::geometry::model::point - > box_type; + >; // Define the Boost.Range compatible type: - typedef boost::geometry::box_view box_view; + using box_view = boost::geometry::box_view; box_type box; boost::geometry::assign_values(box, 0, 0, 4, 4); diff --git a/doc/src/examples/views/segment_view.cpp b/doc/src/examples/views/segment_view.cpp index e02aab3c83..13f38058f2 100644 --- a/doc/src/examples/views/segment_view.cpp +++ b/doc/src/examples/views/segment_view.cpp @@ -1,7 +1,7 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) // QuickBook Example -// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2011-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 @@ -17,12 +17,12 @@ int main() { - typedef boost::geometry::model::segment + using segment_type = boost::geometry::model::segment < boost::geometry::model::point - > segment_type; + >; - typedef boost::geometry::segment_view segment_view; + using segment_view = boost::geometry::segment_view; segment_type segment; boost::geometry::assign_values(segment, 0, 0, 1, 1);