Skip to content

Commit

Permalink
feat: add remaining examples to cmake
Browse files Browse the repository at this point in the history
  • Loading branch information
barendgehrels committed Sep 28, 2024
1 parent 532743b commit 68bcb25
Show file tree
Hide file tree
Showing 19 changed files with 115 additions and 227 deletions.
22 changes: 0 additions & 22 deletions doc/reference/algorithms/difference_inserter.qbk

This file was deleted.

1 change: 1 addition & 0 deletions doc/src/examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ foreach(item IN ITEMS
endforeach()

add_subdirectory(algorithms)
add_subdirectory(arithmetic)
add_subdirectory(core)
add_subdirectory(geometries)
add_subdirectory(io)
Expand Down
21 changes: 20 additions & 1 deletion doc/src/examples/algorithms/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,28 @@ foreach(item IN ITEMS
union
unique
within

# Entries not present in Jamfile
# Some of them are used in the documentation, but not all of them.
assign_box_corners # uses detail, not used in documentation
assign_point_from_index # uses detail, not used in documentation
assign_point_to_index # uses detail, not used in documentation
azimuth
azimuth_strategy
covered_by
crosses
disjoint
intersection_poly_poly
intersects_segment
is_empty
make_with_range # uses detail, not used in documentation
overlaps
perimeter
simplify_insert # uses detail, not used in documentation
touches_one_geometry
touches_two_geometries
)

boost_geometry_add_example("algorithms" ${item})

endforeach()

2 changes: 1 addition & 1 deletion doc/src/examples/algorithms/assign_box_corners.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ int main()
assign_values(b, 2, 2, 5, 5);

point ll, lr, ul, ur;
assign_box_corners(b, ll, lr, ul, ur);
detail::assign_box_corners(b, ll, lr, ul, ur);

std::cout << "box: " << dsv(b) << std::endl << std::endl;

Expand Down
4 changes: 2 additions & 2 deletions doc/src/examples/algorithms/assign_point_from_index.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ int main()
assign_values(s, 1, 1, 2, 2);

point first, second;
assign_point_from_index<0>(s, first);
assign_point_from_index<1>(s, second);
detail::assign_point_from_index<0>(s, first);
detail::assign_point_from_index<1>(s, second);
std::cout
<< "segment: " << dsv(s) << std::endl
<< "first: " << dsv(first) << std::endl
Expand Down
4 changes: 2 additions & 2 deletions doc/src/examples/algorithms/assign_point_to_index.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ int main()
point lower_left(0, 0), upper_right(2, 2);

box b;
assign_point_to_index<0>(lower_left, b);
assign_point_to_index<1>(upper_right, b);
detail::assign_point_to_index<0>(lower_left, b);
detail::assign_point_to_index<1>(upper_right, b);
std::cout << "box: " << dsv(b) << std::endl;

return 0;
Expand Down
86 changes: 0 additions & 86 deletions doc/src/examples/algorithms/difference_inserter.cpp

This file was deleted.

6 changes: 3 additions & 3 deletions doc/src/examples/algorithms/intersects_segment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ int main()
{
// Calculate the intersects of a cartesian polygon
using P = boost::geometry::model::d2::point_xy<double>;
bg::model::linestring<P> line1, line2;
boost::geometry::model::linestring<P> line1, line2;

boost::geometry::read_wkt("linestring(1 1,2 2)", line1);
boost::geometry::read_wkt("linestring(2 1,1 2)", line2);

bool b = boost::geometry::intersects(line1, line2);
bool intersects = boost::geometry::intersects(line1, line2);

std::cout << "Intersects: " << (b ? "YES" : "NO") << std::endl;
std::cout << "Intersects: " << (intersects ? "YES" : "NO") << std::endl;

return 0;
}
Expand Down
1 change: 0 additions & 1 deletion doc/src/examples/algorithms/is_empty.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/point_xy.hpp>


int main()
{
boost::geometry::model::multi_linestring
Expand Down
14 changes: 4 additions & 10 deletions doc/src/examples/algorithms/simplify_insert.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,12 @@

int main()
{
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));
line.push_back(P(2.5, 2.1));
line.push_back(P(3.1, 3.1));
line.push_back(P(4.9, 1.1));
line.push_back(P(3.1, 1.9));
using L = boost::geometry::model::linestring<boost::geometry::model::d2::point_xy<double>>;

L const line{{1.1, 1.1}, {2.5, 2.1}, {3.1, 3.1}, {4.9, 1.1}, {3.1, 1.9}};
L simplified;
boost::geometry::simplify_inserter(line, std::back_inserter(simplified), 0.5);

boost::geometry::detail::simplify::simplify_insert(line, std::back_inserter(simplified), 0.5);

std::cout
<< " original: " << boost::geometry::dsv(line) << std::endl
Expand Down
71 changes: 0 additions & 71 deletions doc/src/examples/algorithms/simplify_insert_with_strategy.cpp

This file was deleted.

15 changes: 15 additions & 0 deletions doc/src/examples/arithmetic/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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
cross_product
dot_product
)

boost_geometry_add_example("arithmetic" ${item})

endforeach()

2 changes: 2 additions & 0 deletions doc/src/examples/geometries/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@ foreach(item IN ITEMS

endforeach()

add_subdirectory(adapted)
add_subdirectory(register)
20 changes: 20 additions & 0 deletions doc/src/examples/geometries/adapted/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# 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
boost_array
boost_fusion
boost_tuple
c_array
std_array
)

boost_geometry_add_example("geometries_adapted" ${item})

endforeach()

add_subdirectory(boost_range)

18 changes: 18 additions & 0 deletions doc/src/examples/geometries/adapted/boost_range/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# 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
filtered
reversed
sliced
strided
# uniqued Fails to compile, also commented in Jamfile
)

boost_geometry_add_example("geometries_adapted_range" ${item})

endforeach()

9 changes: 1 addition & 8 deletions doc/src/examples/geometries/adapted/boost_range/sliced.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,8 @@

int main()
{
using namespace boost::assign;

using xy = boost::geometry::model::d2::point_xy<int>;
boost::geometry::model::linestring<xy> line;
line += xy(0, 0);
line += xy(1, 1);
line += xy(2, 2);
line += xy(3, 3);
line += xy(4, 4);
boost::geometry::model::linestring<xy> line = {{0, 0}, {1, 1}, {2, 2}, {3, 3}, {4, 4}};

std::cout
<< boost::geometry::dsv(line | boost::adaptors::sliced(1, 3)) << std::endl;
Expand Down
9 changes: 1 addition & 8 deletions doc/src/examples/geometries/adapted/boost_range/strided.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,10 @@

int main()
{
using namespace boost::assign;
using boost::adaptors::strided;

using xy = boost::geometry::model::d2::point_xy<int>;
boost::geometry::model::ring<xy> ring;
ring += xy(0, 0);
ring += xy(0, 1);
ring += xy(0, 2);
ring += xy(1, 2);
ring += xy(2, 2);
ring += xy(2, 0);
boost::geometry::model::ring<xy> ring {{0, 0}, {0, 1}, {0, 2}, {1, 2}, {2, 2}, {2, 0}};

boost::geometry::correct(ring);

Expand Down
Loading

0 comments on commit 68bcb25

Please sign in to comment.