feat: add cmake support to examples

- replace BOOST_FOREACH

- replace Boost.Assign

- replace typedef with using

- other minor changes
This commit is contained in:
Barend Gehrels 2024-09-26 22:13:00 +02:00
parent 966567ff2e
commit 38adce676e
144 changed files with 671 additions and 564 deletions

View File

@ -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)

View File

@ -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()

View File

@ -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 <boost/geometry/geometries/polygon.hpp>
#include <boost/geometry/geometries/adapted/boost_tuple.hpp>
#include <boost/assign.hpp> /*< 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<boost::tuple<int, int> > polygon;
using vector = std::vector<boost::tuple<int, int>>;
using polygon = boost::geometry::model::polygon<boost::tuple<int, int>>;
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;

View File

@ -21,13 +21,13 @@ namespace bg = boost::geometry; /*< Convenient namespace alias >*/
int main()
{
// Calculate the area of a cartesian polygon
bg::model::polygon<bg::model::d2::point_xy<double> > poly;
bg::model::polygon<bg::model::d2::point_xy<double>> 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<bg::model::point<float, 2, bg::cs::spherical_equatorial<bg::degree> > > sph_poly;
bg::model::polygon<bg::model::point<float, 2, bg::cs::spherical_equatorial<bg::degree>>> 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;

View File

@ -25,7 +25,7 @@ namespace bg = boost::geometry; /*< Convenient namespace alias >*/
int main()
{
// Create spherical polygon
bg::model::polygon<bg::model::point<double, 2, bg::cs::spherical_equatorial<bg::degree> > > sph_poly;
bg::model::polygon<bg::model::point<double, 2, bg::cs::spherical_equatorial<bg::degree>>> 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<bg::model::point<double, 2, bg::cs::geographic<bg::degree> > > geo_poly;
bg::model::polygon<bg::model::point<double, 2, bg::cs::geographic<bg::degree>>> geo_poly;
bg::read_wkt("POLYGON((0 0,0 1,1 0,0 0))", geo_poly);
// Create geographic strategy with WGS84 spheroid

View File

@ -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<double> point;
typedef boost::geometry::model::box<point> box;
typedef boost::geometry::model::polygon<point> polygon;
using point = boost::geometry::model::d2::point_xy<double>;
using box = boost::geometry::model::box<point>;
using polygon = boost::geometry::model::polygon<point>;
point p1;
box b;

View File

@ -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<double> point;
typedef model::box<point> box;
using point = model::d2::point_xy<double>;
using box = model::box<point>;
box b;
assign_values(b, 2, 2, 5, 5);

View File

@ -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<float, 3, cs::cartesian> point;
typedef model::box<point> box;
using point = model::point<float, 3, cs::cartesian>;
using box = model::box<point>;
box all;
assign_inverse(all);

View File

@ -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<double> point;
typedef model::segment<point> segment;
using point = model::d2::point_xy<double>;
using segment = model::segment<point>;
segment s;
assign_values(s, 1, 1, 2, 2);

View File

@ -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<int> point;
typedef model::box<point> box;
using point = model::d2::point_xy<int>;
using box = model::box<point>;
point lower_left(0, 0), upper_right(2, 2);

View File

@ -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 <iostream>
@ -16,7 +16,6 @@
#include <boost/geometry/geometries/linestring.hpp>
#include <boost/geometry/geometries/adapted/boost_tuple.hpp>
#include <boost/assign.hpp>
#include <boost/geometry/geometries/adapted/boost_range/filtered.hpp>
BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian)
@ -41,14 +40,12 @@ private :
int main()
{
using namespace boost::assign;
typedef boost::geometry::model::linestring<boost::tuple<int, int> > ls;
using ls = boost::geometry::model::linestring<boost::tuple<int, int>>;
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<int>(4, 8))); /*< Boost.Range adaptors can also be used in boost::geometry::assign >*/
std::cout << "line 1: " << boost::geometry::dsv(line1) << std::endl;

View File

@ -18,7 +18,7 @@
int main()
{
typedef boost::geometry::model::d2::point_xy<double> point_type;
using point_type = boost::geometry::model::d2::point_xy<double>;
point_type p1(0, 0);
point_type p2(1, 1);

View File

@ -19,7 +19,7 @@
int main()
{
namespace bg = boost::geometry;
typedef bg::model::point<double, 2, bg::cs::geographic<bg::degree> > point_type;
using point_type = bg::model::point<double, 2, bg::cs::geographic<bg::degree>>;
point_type p1(0, 0);
point_type p2(1, 1);

View File

@ -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<coordinate_type> point;
typedef boost::geometry::model::polygon<point> polygon;
using coordinate_type = double;
using point = boost::geometry::model::d2::point_xy<coordinate_type>;
using polygon = boost::geometry::model::polygon<point>;
// Declare strategies
const double buffer_distance = 1.0;

View File

@ -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<double> point_type;
typedef boost::geometry::model::polygon<point_type> polygon_type;
using point_type = boost::geometry::model::d2::point_xy<double>;
using polygon_type = boost::geometry::model::polygon<point_type>;
polygon_type poly;
boost::geometry::read_wkt(

View File

@ -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 <boost/assign.hpp>
int main()
{
using boost::assign::tuple_list_of;
using point = boost::tuple<float, float>;
using polygon = boost::geometry::model::polygon<point>;
using ring = boost::geometry::model::ring<point>;
typedef boost::tuple<float, float> point;
typedef boost::geometry::model::polygon<point> polygon;
typedef boost::geometry::model::ring<point> ring;
polygon poly;
// 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))
()

View File

@ -23,10 +23,10 @@
int main()
{
typedef boost::geometry::model::d2::point_xy<double> point_type;
typedef boost::geometry::model::polygon<point_type> polygon_type;
typedef boost::geometry::model::linestring<point_type> linestring_type;
typedef boost::geometry::model::multi_point<point_type> multi_point_type;
using point_type = boost::geometry::model::d2::point_xy<double>;
using polygon_type = boost::geometry::model::polygon<point_type>;
using linestring_type = boost::geometry::model::linestring<point_type>;
using multi_point_type = boost::geometry::model::multi_point<point_type>;
point_type p(4.3,1.9);
point_type p0(0,0);

View File

@ -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<boost::geometry::degree>
> point_type;
typedef boost::geometry::model::polygon<point_type> polygon_type;
typedef boost::geometry::model::linestring<point_type> linestring_type;
typedef boost::geometry::model::multi_point<point_type> multi_point_type;
>;
using polygon_type = boost::geometry::model::polygon<point_type>;
using linestring_type = boost::geometry::model::linestring<point_type>;
using multi_point_type = boost::geometry::model::multi_point<point_type>;
point_type p(4.3,1.9);
polygon_type poly;

View File

@ -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 <boost/geometry/geometries/point_xy.hpp>
#include <boost/numeric/conversion/bounds.hpp>
#include <boost/foreach.hpp>
int main()
{
typedef boost::geometry::model::d2::point_xy<double> point_type;
using point_type = boost::geometry::model::d2::point_xy<double>;
point_type p(1.4, 2.6);
@ -35,7 +34,7 @@ int main()
point_type min_p;
double min_d = boost::numeric::bounds<double>::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)

View File

@ -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<double> point;
typedef boost::geometry::model::box<point> box;
typedef boost::geometry::model::polygon<point> polygon;
using point = boost::geometry::model::d2::point_xy<double>;
using box = boost::geometry::model::box<point>;
using polygon = boost::geometry::model::polygon<point>;
point p1(1, 1);
box bx = boost::geometry::make<box>(1, 1, 2, 2);

View File

@ -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<double, double> point;
typedef boost::geometry::model::polygon<point> polygon;
using point = boost::tuple<double, double>;
using polygon = boost::geometry::model::polygon<point>;
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"

View File

@ -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 <boost/assign.hpp>
int main()
{
using boost::assign::tuple_list_of;
typedef boost::geometry::model::polygon
using clockwise_closed_polygon = boost::geometry::model::polygon
<
boost::tuple<int, int>
> 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 @@ Output:
[pre
(((0, 0), (0, 9), (10, 10), (0, 0)), ((1, 2), (4, 6), (2, 8), (1, 2)))
-7 -> 38
7 -> 8
]
*/
//]

View File

@ -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<bg::model::d2::point_xy<double> > poly1;
bg::model::polygon<bg::model::d2::point_xy<double>> poly1;
bg::read_wkt("POLYGON((0 2,0 3,2 4,1 2,0 2))", poly1);
bg::model::polygon<bg::model::d2::point_xy<double> > poly2;
bg::model::polygon<bg::model::d2::point_xy<double>> 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<bg::model::d2::point_xy<double> > poly3;
bg::model::polygon<bg::model::d2::point_xy<double>> 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;
}

View File

@ -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<Geometry>::type point_type;
using point_type = typename boost::geometry::point_type<Geometry>::type;
std::ofstream svg(filename.c_str());
boost::geometry::svg_mapper<point_type> mapper(svg, 400, 400);

View File

@ -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 <fstream>
#include <boost/foreach.hpp>
#include <boost/core/ignore_unused.hpp>
#include <boost/algorithm/string.hpp>
@ -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<Geometry>::type point_type;
using point_type = typename boost::geometry::point_type<Geometry>::type;
std::ofstream svg(filename.c_str());
boost::geometry::svg_mapper<point_type> 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<Range>::type const& g, range)
for (typename boost::range_value<Range>::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;

View File

@ -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<Geometry1>::type point_type;
using point_type = typename boost::geometry::point_type<Geometry1>::type;
std::ofstream svg(filename.c_str());
boost::geometry::svg_mapper<point_type> mapper(svg, 400, 400);

View File

@ -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<bg::model::d2::point_xy<double> > poly;
bg::model::polygon<bg::model::d2::point_xy<double>> poly;
bg::read_wkt("POLYGON((0 0,0 3,3 3,3 0,0 0))", poly);
bg::model::linestring<bg::model::d2::point_xy<double> > line1;
bg::model::linestring<bg::model::d2::point_xy<double>> 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<bg::model::d2::point_xy<double> > line2;
bg::model::linestring<bg::model::d2::point_xy<double>> 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;
}

View File

@ -19,8 +19,8 @@
int main()
{
typedef boost::geometry::model::d2::point_xy<double> point_type;
typedef boost::geometry::model::polygon<point_type> polygon_type;
using point_type = boost::geometry::model::d2::point_xy<double>;
using polygon_type = boost::geometry::model::polygon<point_type>;
polygon_type poly;
boost::geometry::read_wkt(

View File

@ -20,8 +20,8 @@
int main()
{
namespace bg = boost::geometry;
typedef bg::model::point<double, 2, bg::cs::geographic<bg::degree> > point_type;
typedef bg::model::linestring<point_type> linestring_type;
using point_type = bg::model::point<double, 2, bg::cs::geographic<bg::degree>>;
using linestring_type = bg::model::linestring<point_type>;
linestring_type ls;
bg::read_wkt("LINESTRING(0 0,1 1)", ls);

View File

@ -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 <boost/geometry.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/geometries/polygon.hpp>
#include <boost/foreach.hpp>
/*<-*/ #include "create_svg_overlay.hpp" /*->*/
int main()
{
typedef boost::geometry::model::polygon<boost::geometry::model::d2::point_xy<double> > polygon;
using polygon = boost::geometry::model::polygon<boost::geometry::model::d2::point_xy<double>>;
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;
}

View File

@ -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 <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/geometries/polygon.hpp>
#include <boost/foreach.hpp>
/*<-*/ #include "create_svg_overlay.hpp" /*->*/
int main()
{
typedef boost::geometry::model::polygon<boost::geometry::model::d2::point_xy<double> > polygon;
using polygon = boost::geometry::model::polygon<boost::geometry::model::d2::point_xy<double>>;
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;
}

View File

@ -17,8 +17,8 @@
int main()
{
typedef boost::geometry::model::d2::point_xy<double> point_type;
typedef boost::geometry::model::linestring<point_type> linestring_type;
using point_type = boost::geometry::model::d2::point_xy<double>;
using linestring_type = boost::geometry::model::linestring<point_type>;
linestring_type ls1, ls2;
boost::geometry::read_wkt("LINESTRING(0 0,1 1,1 2,2 1,2 2)", ls1);

View File

@ -18,8 +18,8 @@
int main()
{
namespace bg = boost::geometry;
typedef bg::model::point<double, 2, bg::cs::geographic<bg::degree> > point_type;
typedef bg::model::linestring<point_type> linestring_type;
using point_type = bg::model::point<double, 2, bg::cs::geographic<bg::degree>>;
using linestring_type = bg::model::linestring<point_type>;
linestring_type ls1, ls2;
bg::read_wkt("LINESTRING(0 0,1 1,1 2,2 1,2 2)", ls1);

View File

@ -17,8 +17,8 @@
int main()
{
typedef boost::geometry::model::d2::point_xy<double> point_type;
typedef boost::geometry::model::linestring<point_type> linestring_type;
using point_type = boost::geometry::model::d2::point_xy<double>;
using linestring_type = boost::geometry::model::linestring<point_type>;
linestring_type ls1, ls2;
boost::geometry::read_wkt("LINESTRING(0 0,1 1,1 2,2 1,2 2)", ls1);

View File

@ -18,8 +18,8 @@
int main()
{
namespace bg = boost::geometry;
typedef bg::model::point<double, 2, bg::cs::geographic<bg::degree> > point_type;
typedef bg::model::linestring<point_type> linestring_type;
using point_type = bg::model::point<double, 2, bg::cs::geographic<bg::degree>>;
using linestring_type = bg::model::linestring<point_type>;
linestring_type ls1, ls2;
bg::read_wkt("LINESTRING(0 0,1 1,1 2,2 1,2 2)", ls1);

View File

@ -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<bg::model::d2::point_xy<double> > poly1;
bg::model::polygon<bg::model::d2::point_xy<double>> poly1;
bg::read_wkt("POLYGON((0 2,-2 0,-4 2,-2 4,0 2))", poly1);
bg::model::polygon<bg::model::d2::point_xy<double> > poly2;
bg::model::polygon<bg::model::d2::point_xy<double>> 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<bg::model::d2::point_xy<double> > poly3;
bg::model::polygon<bg::model::d2::point_xy<double>> 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;
}

View File

@ -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 <boost/geometry/geometries/multi_point.hpp>
#include <boost/geometry/geometries/multi_polygon.hpp>
#include <boost/foreach.hpp>
int main()
{
typedef boost::geometry::model::d2::point_xy<double> point_type;
typedef boost::geometry::model::polygon<point_type> polygon_type;
typedef boost::geometry::model::linestring<point_type> linestring_type;
typedef boost::geometry::model::multi_point<point_type> multi_point_type;
using point_type = boost::geometry::model::d2::point_xy<double>;
using polygon_type = boost::geometry::model::polygon<point_type>;
using linestring_type = boost::geometry::model::linestring<point_type>;
using multi_point_type = boost::geometry::model::multi_point<point_type>;
point_type p(1,2);
polygon_type poly;

View File

@ -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<double> point;
using point = boost::geometry::model::d2::point_xy<double>;
boost::geometry::model::polygon<point> polygon;

View File

@ -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 <boost/assign.hpp>
int main()
{
using boost::assign::tuple_list_of;
typedef boost::tuple<int, int> point;
using point = boost::tuple<int, int>;
boost::geometry::model::polygon<point> 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;
}

View File

@ -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<short int> point_type;
typedef boost::geometry::model::box<point_type> box_type;
using point_type = boost::geometry::model::d2::point_xy<short int>;
using box_type = boost::geometry::model::box<point_type>;
using boost::geometry::expand;

View File

@ -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 <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/geometries/polygon.hpp>
template <typename Point>
class round_coordinates
{
private :
typedef typename boost::geometry::coordinate_type<Point>::type coordinate_type;
coordinate_type factor;
inline coordinate_type round(coordinate_type 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<double> point;
using point = boost::geometry::model::d2::point_xy<double>;
constexpr auto factor = 0.1;
auto round = [&](auto value)
{
return floor(0.5 + (value / factor)) * factor;
};
boost::geometry::model::polygon<point> 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<point>(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;
}

View File

@ -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<double> point;
using point = boost::geometry::model::d2::point_xy<double>;
boost::geometry::model::polygon<point> poly;
boost::geometry::read_wkt("POLYGON((0 0,0 4,4 0,0 0))", poly);
boost::geometry::for_each_point(poly, list_coordinates<point>);

View File

@ -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 <iostream>
#include <limits>
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/linestring.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/assign.hpp>
template <typename Segment>
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<Segment>::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<double> point;
using point = boost::geometry::model::d2::point_xy<double>;
// Declare a linestring
boost::geometry::model::linestring<point> polyline;
// Create a linestring
const boost::geometry::model::linestring<point> polyline =
{{0, 0}, {3, 3}, {5, 1}, {6, 2}, {8, 0}, {4, -4}, {1, -1}, {3, 2}};
// 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<point>
> 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);
// Iterate over its segments to find the minimum and maximum length
double min_length = std::numeric_limits<double>::max();
double max_length = -std::numeric_limits<double>::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;
}

View File

@ -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 <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/geometries/register/linestring.hpp>
#include <boost/foreach.hpp>
BOOST_GEOMETRY_REGISTER_LINESTRING_TEMPLATED(std::vector)
int main()
{
typedef boost::geometry::model::d2::point_xy<double> P;
using P = boost::geometry::model::d2::point_xy<double>;
std::vector<P> 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<P> 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);
}

View File

@ -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 <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/geometries/polygon.hpp>
#include <boost/foreach.hpp>
/*<-*/ #include "create_svg_overlay.hpp" /*->*/
int main()
{
typedef boost::geometry::model::polygon<boost::geometry::model::d2::point_xy<double> > polygon;
using polygon = boost::geometry::model::polygon<boost::geometry::model::d2::point_xy<double>> ;
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;
}

View File

@ -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 <boost/geometry.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/foreach.hpp>
int main()
{
typedef boost::geometry::model::d2::point_xy<double> P;
using P = boost::geometry::model::d2::point_xy<double>;
boost::geometry::model::segment<P> 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<P> intersections;
boost::geometry::intersection(segment1, segment2, intersections);
BOOST_FOREACH(P const& p, intersections)
for (P const& p : intersections)
{
std::cout << " " << boost::geometry::wkt(p);
}

View File

@ -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<double> P;
using P = boost::geometry::model::d2::point_xy<double>;
boost::geometry::model::linestring<P> line1, line2;
boost::geometry::read_wkt("linestring(1 1,2 2,3 3)", line1);

View File

@ -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<double> P;
using P = boost::geometry::model::d2::point_xy<double>;
bg::model::linestring<P> line1, line2;
boost::geometry::read_wkt("linestring(1 1,2 2)", line1);

View File

@ -21,9 +21,9 @@
int main()
{
typedef boost::geometry::model::d2::point_xy<double> point_type;
typedef boost::geometry::model::linestring<point_type> linestring_type;
typedef boost::geometry::model::multi_linestring<linestring_type> multi_linestring_type;
using point_type = boost::geometry::model::d2::point_xy<double>;
using linestring_type = boost::geometry::model::linestring<point_type>;
using multi_linestring_type = boost::geometry::model::multi_linestring<linestring_type>;
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);

View File

@ -20,8 +20,8 @@
int main()
{
typedef boost::geometry::model::d2::point_xy<double> point_type;
typedef boost::geometry::model::polygon<point_type> polygon_type;
using point_type = boost::geometry::model::d2::point_xy<double>;
using polygon_type = boost::geometry::model::polygon<point_type>;
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);

View File

@ -20,8 +20,8 @@
int main()
{
typedef boost::geometry::model::d2::point_xy<double> point_type;
typedef boost::geometry::model::polygon<point_type> polygon_type;
using point_type = boost::geometry::model::d2::point_xy<double>;
using polygon_type = boost::geometry::model::polygon<point_type>;
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);

View File

@ -21,8 +21,8 @@
int main()
{
typedef boost::geometry::model::d2::point_xy<double> point_type;
typedef boost::geometry::model::polygon<point_type> polygon_type;
using point_type = boost::geometry::model::d2::point_xy<double>;
using polygon_type = boost::geometry::model::polygon<point_type>;
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);

View File

@ -19,7 +19,7 @@
int main()
{
using namespace boost::geometry;
model::linestring<model::d2::point_xy<double> > line;
model::linestring<model::d2::point_xy<double>> line;
read_wkt("linestring(0 0,1 1,4 8,3 2)", line);
std::cout << "linestring length is "
<< length(line)

View File

@ -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<float, 2, cs::spherical_equatorial<degree> > P;
using P = model::point<float, 2, cs::spherical_equatorial<degree>>;
model::linestring<P> line;
line.push_back(P(2, 41));
line.push_back(P(2, 48));

View File

@ -20,7 +20,7 @@ using namespace boost::geometry;
int main()
{
typedef boost::geometry::model::d2::point_xy<double> point_type;
using point_type = boost::geometry::model::d2::point_xy<double>;
using segment_type = model::segment<point_type>;
using linestring_type = model::linestring<point_type>;
using multipoint_type = model::multi_point<point_type>;

View File

@ -20,7 +20,7 @@ using namespace boost::geometry;
int main()
{
typedef model::d2::point_xy<double,cs::geographic<degree> > point_type;
using point_type = model::d2::point_xy<double,cs::geographic<degree>>;
using segment_type = model::segment<point_type>;
using linestring_type = model::linestring<point_type>;
using multipoint_type = model::multi_point<point_type>;

View File

@ -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 <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/geometries/register/point.hpp>
#include <boost/geometry/geometries/adapted/boost_tuple.hpp>
#include <boost/geometry/geometries/adapted/boost_polygon/point.hpp>
BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian)
@ -39,10 +38,9 @@ void construct_and_display()
int main()
{
construct_and_display<boost::geometry::model::d2::point_xy<double> >();
construct_and_display<boost::geometry::model::d2::point_xy<int> >();
construct_and_display<boost::tuple<double, double> >();
construct_and_display<boost::polygon::point_data<int> >();
construct_and_display<boost::geometry::model::d2::point_xy<double>>();
construct_and_display<boost::geometry::model::d2::point_xy<int>>();
construct_and_display<boost::tuple<double, double>>();
construct_and_display<mypoint>();
return 0;
}

View File

@ -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<double, 3, boost::geometry::cs::cartesian> point_type;
point_type p = boost::geometry::make<point_type>(1, 2, 3);
using point_type = boost::geometry::model::point<double, 3, boost::geometry::cs::cartesian>;
const auto p = boost::geometry::make<point_type>(1, 2, 3);
std::cout << boost::geometry::dsv(p) << std::endl;
return 0;
}

View File

@ -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<double> point;
typedef model::box<point> box;
using point = model::d2::point_xy<double>;
using box = model::box<point>;
box all = make_inverse<box>();
std::cout << dsv(all) << std::endl;

View File

@ -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<double> point;
typedef boost::geometry::model::linestring<point> linestring;
using point = boost::geometry::model::d2::point_xy<double>;
using linestring = boost::geometry::model::linestring<point>;
double coordinates[][2] = {{1,2}, {3,4}, {5, 6}}; /*< Initialize with C array points >*/
linestring ls = make_points<linestring>(coordinates);

View File

@ -21,22 +21,22 @@ namespace bg = boost::geometry; /*< Convenient namespace alias >*/
int main()
{
// Checks if the two geometries overlaps or not.
bg::model::polygon<bg::model::d2::point_xy<double> > poly1;
bg::model::polygon<bg::model::d2::point_xy<double>> poly1;
bg::read_wkt("POLYGON((0 0,0 4,4 4,4 0,0 0))", poly1);
bg::model::polygon<bg::model::d2::point_xy<double> > poly2;
bg::model::polygon<bg::model::d2::point_xy<double>> 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<bg::model::d2::point_xy<double> > poly3;
bg::model::polygon<bg::model::d2::point_xy<double>> 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;
}

View File

@ -21,7 +21,7 @@ namespace bg = boost::geometry; /*< Convenient namespace alias >*/
int main()
{
// Calculate the perimeter of a cartesian polygon
bg::model::polygon<bg::model::d2::point_xy<double> > poly;
bg::model::polygon<bg::model::d2::point_xy<double>> 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;

View File

@ -24,8 +24,8 @@
int main()
{
typedef boost::geometry::model::d2::point_xy<double> point_type;
typedef boost::geometry::model::polygon<point_type> polygon_type;
using point_type = boost::geometry::model::d2::point_xy<double>;
using polygon_type = boost::geometry::model::polygon<point_type>;
polygon_type poly;
boost::geometry::read_wkt(

View File

@ -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<double> point_type;
typedef boost::geometry::model::polygon<point_type> polygon_type;
using point_type = boost::geometry::model::d2::point_xy<double>;
using polygon_type = boost::geometry::model::polygon<point_type>;
polygon_type poly;
boost::geometry::read_wkt(

View File

@ -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 <iostream>
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/box.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/geometries/ring.hpp>
#include <boost/assign.hpp>
/*<-*/ #include "create_svg_two.hpp" /*->*/
int main()
{
using namespace boost::assign;
using point = boost::geometry::model::d2::point_xy<double>;
using box = boost::geometry::model::box<point>;
typedef boost::geometry::model::d2::point_xy<double> point;
boost::geometry::model::ring<point> 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<point> box;
const boost::geometry::model::ring<point> 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:

View File

@ -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 <boost/assign.hpp>
int main()
{
using boost::assign::tuple_list_of;
typedef boost::tuple<int, int> point;
typedef boost::geometry::model::polygon<point> polygon;
typedef boost::geometry::model::ring<point> ring;
using point = boost::tuple<int, int>;
using polygon = boost::geometry::model::polygon<point>;
using ring = boost::geometry::model::ring<point>;
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);

View File

@ -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 <boost/geometry/geometries/linestring.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
/*< For this example we use Boost.Assign to add points >*/
#include <boost/assign.hpp>
using namespace boost::assign;
int main()
{
typedef boost::geometry::model::d2::point_xy<double> xy;
using xy = boost::geometry::model::d2::point_xy<double>;
boost::geometry::model::linestring<xy> 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<xy> 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<xy> simplified;
@ -36,7 +30,6 @@ int main()
<< " original: " << boost::geometry::dsv(line) << std::endl
<< "simplified: " << boost::geometry::dsv(simplified) << std::endl;
return 0;
}

View File

@ -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<double> P;
typedef boost::geometry::model::linestring<P> L;
using P = boost::geometry::model::d2::point_xy<double>;
using L = boost::geometry::model::linestring<P>;
L line;
line.push_back(P(1.1, 1.1));

View File

@ -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<double> P;
typedef boost::geometry::model::linestring<P> L;
using P = boost::geometry::model::d2::point_xy<double>;
using L = boost::geometry::model::linestring<P>;
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<P, P> DS;
typedef boost::geometry::strategy::simplify::douglas_peucker<P, DS> simplification;
using DS = boost::geometry::strategy::distance::projected_point<P, P>;
using simplification = boost::geometry::strategy::simplify::douglas_peucker<P, DS>;
L simplified;
boost::geometry::simplify_inserter(line, std::back_inserter(simplified), 0.5, simplification()); //std::ostream_iterator<P>(std::cout, "\n"), 0.5);//);

View File

@ -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 <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/geometries/multi_polygon.hpp>
#include <boost/foreach.hpp>
/*<-*/ #include "create_svg_overlay.hpp" /*->*/
int main()
{
typedef boost::geometry::model::polygon<boost::geometry::model::d2::point_xy<double> > polygon;
using polygon = boost::geometry::model::polygon<boost::geometry::model::d2::point_xy<double>>;
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;
}

View File

@ -21,9 +21,9 @@ namespace bg = boost::geometry; /*< Convenient namespace alias >*/
int main()
{
// Checks if the two geometries touch
bg::model::polygon<bg::model::d2::point_xy<double> > poly1;
bg::model::polygon<bg::model::d2::point_xy<double>> poly1;
bg::read_wkt("POLYGON((0 0,0 4,4 4,4 0,0 0))", poly1);
bg::model::polygon<bg::model::d2::point_xy<double> > poly2;
bg::model::polygon<bg::model::d2::point_xy<double>> 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<bg::model::d2::point_xy<double> > poly3;
bg::model::polygon<bg::model::d2::point_xy<double>> 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) {

View File

@ -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<long double, 2, bg::cs::spherical<bg::degree> > p1(15.0, 5.0);
bg::model::point<long double, 2, bg::cs::spherical<bg::degree>> 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<long double, 2, bg::cs::spherical<bg::radian> > p2;
bg::model::point<long double, 2, bg::cs::spherical<bg::radian>> p2;
bg::transform(p1, p2);
// Transform from degree (lon-lat) to 3D (x,y,z). Default strategy is automatically selected,

View File

@ -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 <iostream>
#include <boost/geometry.hpp>
int main()
{
namespace trans = boost::geometry::strategy::transform;
using boost::geometry::dsv;
typedef boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian> point_type;
using point_type = boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian>;
point_type p1(1.0, 1.0);

View File

@ -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 <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/geometries/polygon.hpp>
#include <boost/foreach.hpp>
/*<-*/ #include "create_svg_overlay.hpp" /*->*/
int main()
{
typedef boost::geometry::model::polygon<boost::geometry::model::d2::point_xy<double> > polygon;
using polygon = boost::geometry::model::polygon<boost::geometry::model::d2::point_xy<double>>;
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;
}

View File

@ -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<boost::tuple<double, double> > poly;
boost::geometry::model::polygon<boost::tuple<double, double>> 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;

View File

@ -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<double> point_type;
typedef boost::geometry::model::polygon<point_type> polygon_type;
using point_type = boost::geometry::model::d2::point_xy<double>;
using polygon_type = boost::geometry::model::polygon<point_type>;
polygon_type poly;
boost::geometry::read_wkt(

View File

@ -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()

View File

@ -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 : <library>/boost/assign//boost_assign ;
exe tag : tag.cpp ;
exe tag_cast : tag_cast.cpp ;

View File

@ -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<double> point_type;
typedef boost::geometry::model::polygon<point_type> polygon_type;
using point_type = boost::geometry::model::d2::point_xy<double>;
using polygon_type = boost::geometry::model::polygon<point_type>;
boost::geometry::closure_selector clos = boost::geometry::closure<polygon_type>::value;

View File

@ -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

View File

@ -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<double> point_type;
typedef boost::geometry::model::polygon<point_type> polygon_type;
using point_type = boost::geometry::model::d2::point_xy<double>;
using polygon_type = boost::geometry::model::polygon<point_type>;
typedef boost::geometry::coordinate_system<polygon_type>::type system;
using system = boost::geometry::coordinate_system<polygon_type>::type;
std::cout << "system: " << typeid(system).name() << std::endl;

View File

@ -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<double> point_type;
typedef boost::geometry::model::polygon<point_type> polygon_type;
using point_type = boost::geometry::model::d2::point_xy<double>;
using polygon_type = boost::geometry::model::polygon<point_type>;
typedef boost::geometry::coordinate_type<polygon_type>::type ctype;
using ctype = boost::geometry::coordinate_type<polygon_type>::type;
std::cout << "type: " << typeid(ctype).name() << std::endl;

View File

@ -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<double, 2, cs::spherical_equatorial<degree> > degree_point;
typedef model::point<double, 2, cs::spherical_equatorial<radian> > radian_point;
using degree_point = model::point<double, 2, cs::spherical_equatorial<degree>>;
using radian_point = model::point<double, 2, cs::spherical_equatorial<radian>>;
degree_point d(4.893, 52.373);
radian_point r(0.041, 0.8527);

View File

@ -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<bg::model::d2::point_xy<double> > box;
bg::model::box<bg::model::d2::point_xy<double>> box;
bg::assign_values(box, 1, 3, 5, 6);

View File

@ -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

View File

@ -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<short, 3>,
true, true,
std::deque, std::list
> polygon;
>;
std::cout << typeid(boost::geometry::interior_type<polygon>::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<class boost::geometry::model::ring<class boost::array<short,3>,1,1,class std::deque,class std::allocator>,class std::allocator<...> > >
class std::list<class boost::geometry::model::ring<class boost::array<short,3>,1,1,class std::deque,class std::allocator>,class std::allocator<...>>>
]
*/
//]

View File

@ -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<double> point_type;
typedef boost::geometry::model::polygon<point_type, false> polygon_type;
using point_type = boost::geometry::model::d2::point_xy<double>;
using polygon_type = boost::geometry::model::polygon<point_type, false>;
boost::geometry::order_selector order = boost::geometry::point_order<polygon_type>::value;

View File

@ -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<double> point_type;
typedef boost::geometry::model::polygon<point_type> polygon_type;
typedef boost::geometry::model::multi_polygon<polygon_type> mp_type;
typedef boost::geometry::point_type<mp_type>::type ptype;
using point_type = boost::geometry::model::d2::point_xy<double>;
using polygon_type = boost::geometry::model::polygon<point_type>;
using mp_type = boost::geometry::model::multi_polygon<polygon_type>;
using ptype = boost::geometry::point_type<mp_type>::type;
std::cout << "point type: " << typeid(ptype).name() << std::endl;

View File

@ -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<double> point;
typedef boost::geometry::model::polygon<point> polygon;
using point = boost::geometry::model::d2::point_xy<double>;
using polygon = boost::geometry::model::polygon<point>;
typedef boost::geometry::ring_type<polygon>::type ring_type;
typedef boost::geometry::interior_type<polygon>::type int_type;
using ring_type = boost::geometry::ring_type<polygon>::type;
using int_type = boost::geometry::interior_type<polygon>::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<int_type>::type int_ring_type;
using int_ring_type = boost::range_value<int_type>::type;
std::cout
<< std::boolalpha

View File

@ -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<double> point;
typedef boost::geometry::model::polygon<point> polygon_type;
using point = boost::geometry::model::d2::point_xy<double>;
using polygon_type = boost::geometry::model::polygon<point>;
polygon_type poly;
typedef boost::geometry::ring_type<polygon_type>::type ring_type;
using ring_type = boost::geometry::ring_type<polygon_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<polygon_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<polygon_type>::type;
// The type of an element of the collection is the very same ring type again.
// We show that.
typedef boost::range_value<int_type>::type int_ring_type;
using int_ring_type = boost::range_value<int_type>::type;
std::cout
<< std::boolalpha

View File

@ -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<bg::model::d2::point_xy<double> > box;
bg::model::box<bg::model::d2::point_xy<double>> box;
bg::set<bg::min_corner, 0>(box, 0);
bg::set<bg::min_corner, 1>(box, 2);

View File

@ -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

View File

@ -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 <boost/geometry/geometries/multi_polygon.hpp>
#include <boost/geometry/geometries/adapted/boost_tuple.hpp>
#include <boost/assign.hpp> /*< At the end to avoid conflicts with Boost.QVM >*/
BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian)
template <typename Tag> 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<boost::tuple<int, int> > polygon_type;
using polygon_type = boost::geometry::model::polygon<boost::tuple<int, int>>;
// 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<polygon_type> multi;
multi.push_back(poly);

View File

@ -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<double> point_type;
typedef geo::model::polygon<point_type> polygon_type;
using point_type = geo::model::d2::point_xy<double>;
using polygon_type = geo::model::polygon<point_type>;
typedef geo::tag<polygon_type>::type tag;
typedef geo::tag_cast<tag, geo::linear_tag, geo::areal_tag>::type base_tag;
using tag = geo::tag<polygon_type>::type;
using base_tag = geo::tag_cast<tag, geo::linear_tag, geo::areal_tag>::type;
std::cout << "tag: " << typeid(tag).name() << std::endl
<< "base tag: " << typeid(base_tag).name() << std::endl;

View File

@ -21,7 +21,7 @@ template <typename Geometry1, typename Geometry2>
void create_svg_buffer(std::string const& filename, Geometry1 const& original, Geometry2 const& buffer)
{
#if defined(HAVE_SVG)
typedef typename boost::geometry::point_type<Geometry1>::type point_type;
using point_type = typename boost::geometry::point_type<Geometry1>::type;
std::ofstream svg(filename.c_str());
boost::geometry::svg_mapper<point_type> mapper(svg, 400, 400);

View File

@ -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()

View File

@ -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<boost::array<double, 2> > line;
boost::geometry::model::linestring<boost::array<double, 2>> line;
line.push_back(b);
return 0;

View File

@ -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<int> rect;
using rect = boost::polygon::rectangle_data<int>;
rect b = boost::polygon::construct<rect>(1, 2, 3, 4);

View File

@ -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<int> polygon;
typedef boost::polygon::polygon_traits<polygon>::point_type point;
typedef boost::polygon::polygon_with_holes_traits<polygon>::hole_type hole;
using polygon = boost::polygon::polygon_with_holes_data<int>;
using point = boost::polygon::polygon_traits<polygon>::point_type;
using hole = boost::polygon::polygon_with_holes_traits<polygon>::hole_type;
point pts[5] = {
boost::polygon::construct<point>(0, 0),

View File

@ -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<int> polygon;
typedef boost::polygon::polygon_traits<polygon>::point_type point;
using polygon = boost::polygon::polygon_data<int>;
using point = boost::polygon::polygon_traits<polygon>::point_type;
point pts[5] = {
boost::polygon::construct<point>(0, 0),

Some files were not shown because too many files have changed in this diff Show More