tkurbad-overlay/sci-electronics/pcb2gcode/files/pcb2gcode-9999-gcc-11.patch
2021-05-19 10:41:18 +02:00

331 lines
16 KiB
Diff

diff -urN pcb2gcode-9999.orig/path_finding.cpp pcb2gcode-9999/path_finding.cpp
--- pcb2gcode-9999.orig/path_finding.cpp 2021-05-19 10:04:48.238921433 +0200
+++ pcb2gcode-9999/path_finding.cpp 2021-05-19 10:10:38.227035983 +0200
@@ -28,7 +28,7 @@
namespace path_finding {
using boost::optional;
-using boost::make_optional;
+//using boost::make_optional;
Neighbors::iterator Neighbors::iterator::operator++() {
const auto& all_vertices_size = neighbors->vertices.size();
@@ -440,7 +440,7 @@
open_set.pop();
if (current == goal) {
// We're done.
- return make_optional(build_path(current, came_from));
+ return boost::make_optional(build_path(current, came_from));
}
if (closed_set.count(current) > 0) {
// Skip this because we already "removed it", sort of.
diff -urN pcb2gcode-9999.orig/path_finding_tests.cpp pcb2gcode-9999/path_finding_tests.cpp
--- pcb2gcode-9999.orig/path_finding_tests.cpp 2021-05-19 10:04:48.239921443 +0200
+++ pcb2gcode-9999/path_finding_tests.cpp 2021-05-19 10:10:24.618914885 +0200
@@ -7,7 +7,7 @@
#include "bg_helpers.hpp"
#include <boost/optional.hpp>
-using boost::make_optional;
+//using boost::make_optional;
#include <boost/optional/optional_io.hpp>
@@ -126,7 +126,7 @@
multi_polygon_type_fp mp;
box_type_fp box{point_type_fp{0,0}, {10,10}};
bg::convert(box, mp);
- BOOST_CHECK_EQUAL(inside_multipolygon(point_type_fp{1,1}, mp), make_optional(MPRingIndices({{0, {0}}})));
+ BOOST_CHECK_EQUAL(inside_multipolygon(point_type_fp{1,1}, mp), boost::make_optional(MPRingIndices({{0, {0}}})));
BOOST_CHECK_EQUAL(inside_multipolygon(point_type_fp{11,11}, mp), boost::none);
}
@@ -149,10 +149,10 @@
bg::convert(hole, hole_mp);
mp = mp - hole_mp;
- BOOST_CHECK_EQUAL(inside_multipolygon(point_type_fp{1,1}, mp), make_optional(MPRingIndices({{0, {0, 1}}})));
+ BOOST_CHECK_EQUAL(inside_multipolygon(point_type_fp{1,1}, mp), boost::make_optional(MPRingIndices({{0, {0, 1}}})));
BOOST_CHECK_EQUAL(inside_multipolygon(point_type_fp{11,11}, mp), boost::none);
BOOST_CHECK_EQUAL(inside_multipolygon(point_type_fp{5,5}, mp), boost::none);
- BOOST_CHECK_EQUAL(inside_multipolygon(point_type_fp{21,1}, mp), make_optional(MPRingIndices({{1, {0, 1, 2}}})));
+ BOOST_CHECK_EQUAL(inside_multipolygon(point_type_fp{21,1}, mp), boost::make_optional(MPRingIndices({{1, {0, 1, 2}}})));
BOOST_CHECK_EQUAL(inside_multipolygon(point_type_fp{23.5,3.5}, mp), boost::none);
}
@@ -171,9 +171,9 @@
hole = {point_type_fp{30,30}, {70,70}};
bg::convert(hole, hole_mp);
mp = mp - hole_mp;
- BOOST_CHECK_EQUAL(inside_multipolygon(point_type_fp{1,1}, mp), make_optional(MPRingIndices({{0, {0, 1}}})));
+ BOOST_CHECK_EQUAL(inside_multipolygon(point_type_fp{1,1}, mp), boost::make_optional(MPRingIndices({{0, {0, 1}}})));
BOOST_CHECK_EQUAL(inside_multipolygon(point_type_fp{11,11}, mp), boost::none);
- BOOST_CHECK_EQUAL(inside_multipolygon(point_type_fp{21,21}, mp), make_optional(MPRingIndices({{1, {0, 1}}})));
+ BOOST_CHECK_EQUAL(inside_multipolygon(point_type_fp{21,21}, mp), boost::make_optional(MPRingIndices({{1, {0, 1}}})));
BOOST_CHECK_EQUAL(inside_multipolygon(point_type_fp{31,31}, mp), boost::none);
}
@@ -190,7 +190,7 @@
box_type_fp box{point_type_fp{0,0}, {10,10}};
bg::convert(box, mp);
BOOST_CHECK_EQUAL(outside_multipolygon(point_type_fp{1,1}, mp), boost::none);
- BOOST_CHECK_EQUAL(outside_multipolygon(point_type_fp{11,11}, mp), make_optional(MPRingIndices({{0, {0}}})));
+ BOOST_CHECK_EQUAL(outside_multipolygon(point_type_fp{11,11}, mp), boost::make_optional(MPRingIndices({{0, {0}}})));
}
BOOST_AUTO_TEST_CASE(doughnuts) {
@@ -213,10 +213,10 @@
mp = mp - hole_mp;
BOOST_CHECK_EQUAL(outside_multipolygon(point_type_fp{1,1}, mp), boost::none);
- BOOST_CHECK_EQUAL(outside_multipolygon(point_type_fp{11,11}, mp), make_optional(MPRingIndices({{0, {0}}, {1, {0}}})));
- BOOST_CHECK_EQUAL(outside_multipolygon(point_type_fp{5,5}, mp), make_optional(MPRingIndices({{0, {1}}, {1, {0}}})));
+ BOOST_CHECK_EQUAL(outside_multipolygon(point_type_fp{11,11}, mp), boost::make_optional(MPRingIndices({{0, {0}}, {1, {0}}})));
+ BOOST_CHECK_EQUAL(outside_multipolygon(point_type_fp{5,5}, mp), boost::make_optional(MPRingIndices({{0, {1}}, {1, {0}}})));
BOOST_CHECK_EQUAL(outside_multipolygon(point_type_fp{21,1}, mp), boost::none);
- BOOST_CHECK_EQUAL(outside_multipolygon(point_type_fp{23.5,3.5}, mp), make_optional(MPRingIndices({{0, {0}}, {1, {1}}})));
+ BOOST_CHECK_EQUAL(outside_multipolygon(point_type_fp{23.5,3.5}, mp), boost::make_optional(MPRingIndices({{0, {0}}, {1, {1}}})));
}
BOOST_AUTO_TEST_CASE(nested_doughnuts) {
@@ -236,9 +236,9 @@
mp = mp - hole_mp;
BOOST_CHECK_EQUAL(outside_multipolygon(point_type_fp{1,1}, mp), boost::none);
- BOOST_CHECK_EQUAL(outside_multipolygon(point_type_fp{11,11}, mp), make_optional(MPRingIndices({{0, {1}}, {1, {0}}})));
+ BOOST_CHECK_EQUAL(outside_multipolygon(point_type_fp{11,11}, mp), boost::make_optional(MPRingIndices({{0, {1}}, {1, {0}}})));
BOOST_CHECK_EQUAL(outside_multipolygon(point_type_fp{21,21}, mp), boost::none);
- BOOST_CHECK_EQUAL(outside_multipolygon(point_type_fp{31,31}, mp), make_optional(MPRingIndices({{0, {1}}, {1, {1}}})));
+ BOOST_CHECK_EQUAL(outside_multipolygon(point_type_fp{31,31}, mp), boost::make_optional(MPRingIndices({{0, {1}}, {1, {1}}})));
}
BOOST_AUTO_TEST_SUITE_END() // outside_multipolygon_tests
@@ -247,16 +247,16 @@
BOOST_AUTO_TEST_CASE(open_space) {
auto surface = PathFindingSurface(boost::none, multi_polygon_type_fp(), 5);
- BOOST_CHECK_EQUAL(surface.in_surface({1,1}), make_optional(size_t(0)));
+ BOOST_CHECK_EQUAL(surface.in_surface({1,1}), boost::make_optional(size_t(0)));
}
BOOST_AUTO_TEST_CASE(barbell) {
multi_polygon_type_fp barbell{{{{0,0}, {0,100}, {40,100}, {40,2}, {60,2},
{60,100}, {100,100}, {100,0}, {0,0}}}};
auto surface = PathFindingSurface(boost::none, barbell, 5);
- BOOST_CHECK_EQUAL(surface.in_surface({1,1}), make_optional(size_t(0)));
+ BOOST_CHECK_EQUAL(surface.in_surface({1,1}), boost::make_optional(size_t(0)));
BOOST_CHECK_EQUAL(surface.in_surface({6,6}), boost::none);
- BOOST_CHECK_EQUAL(surface.in_surface({-10,-10}), make_optional(size_t(0)));
+ BOOST_CHECK_EQUAL(surface.in_surface({-10,-10}), boost::make_optional(size_t(0)));
BOOST_CHECK_EQUAL(surface.in_surface({10,10}), boost::none);
}
@@ -266,12 +266,12 @@
{51,80}, {51,100}, {100,100},
{100,0}, {0,0}}}};
auto surface = PathFindingSurface(almost_doughnut, multi_polygon_type_fp(), 5);
- BOOST_CHECK_EQUAL(surface.in_surface({1,1}), make_optional(size_t(0)));
- BOOST_CHECK_EQUAL(surface.in_surface({6,6}), make_optional(size_t(0)));
+ BOOST_CHECK_EQUAL(surface.in_surface({1,1}), boost::make_optional(size_t(0)));
+ BOOST_CHECK_EQUAL(surface.in_surface({6,6}), boost::make_optional(size_t(0)));
BOOST_CHECK_EQUAL(surface.in_surface({-10,-10}), boost::none);
- BOOST_CHECK_EQUAL(surface.in_surface({50,1}), make_optional(size_t(0)));
+ BOOST_CHECK_EQUAL(surface.in_surface({50,1}), boost::make_optional(size_t(0)));
BOOST_CHECK_EQUAL(surface.in_surface({50,50}), boost::none);
- BOOST_CHECK_EQUAL(surface.in_surface({50,90}), make_optional(size_t(0)));
+ BOOST_CHECK_EQUAL(surface.in_surface({50,90}), boost::make_optional(size_t(0)));
}
BOOST_AUTO_TEST_SUITE_END() // nested_multipolygon_type_fp
@@ -285,7 +285,7 @@
linestring_type_fp expected;
expected.push_back(point_type_fp(0, 0));
expected.push_back(point_type_fp(1, 1));
- BOOST_CHECK_EQUAL(ret, make_optional(expected));
+ BOOST_CHECK_EQUAL(ret, boost::make_optional(expected));
}
BOOST_AUTO_TEST_CASE(simple) {
@@ -299,7 +299,7 @@
linestring_type_fp expected;
expected.push_back(point_type_fp(0, 0));
expected.push_back(point_type_fp(1, 1));
- BOOST_CHECK_EQUAL(ret, make_optional(expected));
+ BOOST_CHECK_EQUAL(ret, boost::make_optional(expected));
}
BOOST_AUTO_TEST_CASE(simple_limit0) {
@@ -309,7 +309,7 @@
bg::convert(bounding_box, keep_in);
auto surface = PathFindingSurface(keep_in, multi_polygon_type_fp(), 0.1);
auto ret = surface.find_path(point_type_fp(0,0), point_type_fp(1,1),
- infinity, make_optional(size_t(0)));
+ infinity, boost::make_optional(size_t(0)));
BOOST_CHECK_EQUAL(ret, boost::none);
}
@@ -320,11 +320,11 @@
bg::convert(bounding_box, keep_in);
auto surface = PathFindingSurface(keep_in, multi_polygon_type_fp(), 0.1);
auto ret = surface.find_path(point_type_fp(0,0), point_type_fp(1,1),
- infinity, make_optional(size_t(1)));
+ infinity, boost::make_optional(size_t(1)));
linestring_type_fp expected;
expected.push_back(point_type_fp(0, 0));
expected.push_back(point_type_fp(1, 1));
- BOOST_CHECK_EQUAL(ret, make_optional(expected));
+ BOOST_CHECK_EQUAL(ret, boost::make_optional(expected));
}
BOOST_AUTO_TEST_CASE(simple_limit_length200) {
@@ -338,7 +338,7 @@
linestring_type_fp expected;
expected.push_back(point_type_fp(0, 0));
expected.push_back(point_type_fp(100, 100));
- BOOST_CHECK_EQUAL(ret, make_optional(expected));
+ BOOST_CHECK_EQUAL(ret, boost::make_optional(expected));
}
BOOST_AUTO_TEST_CASE(simple_limit_length100) {
@@ -368,7 +368,7 @@
linestring_type_fp expected;
expected.push_back(point_type_fp(0, 0));
expected.push_back(point_type_fp(1, 1));
- BOOST_CHECK_EQUAL(ret, make_optional(expected));
+ BOOST_CHECK_EQUAL(ret, boost::make_optional(expected));
}
BOOST_AUTO_TEST_CASE(hole_unreachable) {
@@ -410,7 +410,7 @@
expected.push_back(point_type_fp(0, 0));
expected.push_back(point_type_fp(3, 7));
expected.push_back(point_type_fp(10, 10));
- BOOST_CHECK_EQUAL(ret, make_optional(expected));
+ BOOST_CHECK_EQUAL(ret, boost::make_optional(expected));
}
BOOST_AUTO_TEST_CASE(box_no_keep_in) {
@@ -434,7 +434,7 @@
expected.push_back(point_type_fp(0, 0));
expected.push_back(point_type_fp(3, 7));
expected.push_back(point_type_fp(10, 10));
- BOOST_CHECK_EQUAL(ret, make_optional(expected));
+ BOOST_CHECK_EQUAL(ret, boost::make_optional(expected));
}
BOOST_AUTO_TEST_CASE(unreachable_box) {
@@ -485,7 +485,7 @@
expected.push_back(point_type_fp(0, 0));
expected.push_back(point_type_fp(3, 7));
expected.push_back(point_type_fp(10, 10));
- BOOST_CHECK_EQUAL(ret, make_optional(expected));
+ BOOST_CHECK_EQUAL(ret, boost::make_optional(expected));
}
BOOST_AUTO_TEST_CASE(u_shape) {
@@ -512,7 +512,7 @@
expected.push_back(point_type_fp(3, 3));
expected.push_back(point_type_fp(7, 3));
expected.push_back(point_type_fp(9, 9));
- BOOST_CHECK_EQUAL(ret, make_optional(expected));
+ BOOST_CHECK_EQUAL(ret, boost::make_optional(expected));
}
BOOST_AUTO_TEST_CASE(doughnut) {
@@ -526,7 +526,7 @@
infinity, boost::none);
linestring_type_fp expected{{10, 10},{30, 70},{51, 80},{90, 90}};
- BOOST_CHECK_EQUAL(ret, make_optional(expected));
+ BOOST_CHECK_EQUAL(ret, boost::make_optional(expected));
}
BOOST_AUTO_TEST_CASE(barbell_search) {
@@ -542,7 +542,7 @@
multi_polygon_type_fp barbell{{{{0,0}, {0,50}, {40,50}, {40,2}, {60,2},
{60,50}, {100,50}, {100,0}, {0,0}}}};
auto surface = PathFindingSurface(boost::none, barbell, 5);
- BOOST_CHECK_EQUAL(surface.find_path({-10,-10},{110,60},infinity, make_optional(size_t(2))),
+ BOOST_CHECK_EQUAL(surface.find_path({-10,-10},{110,60},infinity, boost::make_optional(size_t(2))),
boost::none);
}
@@ -563,7 +563,7 @@
auto ret = surface.find_path({5,5}, point_type_fp(-1,-1),
infinity, boost::none);
linestring_type_fp expected{{5,5},{3,10},{0,10},{-1,-1}};
- BOOST_CHECK_EQUAL(ret, make_optional(expected));
+ BOOST_CHECK_EQUAL(ret, boost::make_optional(expected));
}
BOOST_AUTO_TEST_SUITE_END()
diff -urN pcb2gcode-9999.orig/surface_vectorial.cpp pcb2gcode-9999/surface_vectorial.cpp
--- pcb2gcode-9999.orig/surface_vectorial.cpp 2021-05-19 10:04:48.239921443 +0200
+++ pcb2gcode-9999/surface_vectorial.cpp 2021-05-19 10:11:21.585421829 +0200
@@ -58,7 +58,7 @@
#include <boost/format.hpp>
#include <boost/optional.hpp>
using boost::optional;
-using boost::make_optional;
+//using boost::make_optional;
#include "flatten.hpp"
#include "tsp_solver.hpp"
@@ -723,7 +723,7 @@
const double max_g1_distance = std::isinf(mill->backtrack) ?
g0_time * horizontalG1speed :
mill->backtrack*g0_time / (1 + mill->backtrack/horizontalG1speed);
- return path_finding_surface.find_path(a, b, max_g1_distance, make_optional(mill->path_finding_limit));
+ return path_finding_surface.find_path(a, b, max_g1_distance, boost::make_optional(mill->path_finding_limit));
};
}
@@ -839,7 +839,7 @@
if (!reverse_spikes) {
if (polygon_index > 0) {
spike_offset = diameter - overlap;
- spikes_keep_out = make_optional(multi_polygon_type_fp{polygons[polygon_index - 1]});
+ spikes_keep_out = boost::make_optional(multi_polygon_type_fp{polygons[polygon_index - 1]});
} else {
spike_offset = 0;
}
@@ -850,17 +850,17 @@
if (extra_passes % 2 == 0) {
if (polygon_index + 1 < polygons.size()) {
spike_offset = diameter - overlap;
- spikes_keep_in = make_optional(multi_polygon_type_fp{polygons[polygon_index + 1]});
+ spikes_keep_in = boost::make_optional(multi_polygon_type_fp{polygons[polygon_index + 1]});
} else {
spike_offset = 0;
}
} else {
if (polygon_index + 1 < polygons.size()) {
spike_offset = diameter - overlap;
- spikes_keep_in = make_optional(multi_polygon_type_fp{polygons[polygon_index + 1]});
+ spikes_keep_in = boost::make_optional(multi_polygon_type_fp{polygons[polygon_index + 1]});
} else {
spike_offset = (diameter - overlap)/2;
- spikes_keep_in = make_optional(multi_polygon_type_fp{current_voronoi});
+ spikes_keep_in = boost::make_optional(multi_polygon_type_fp{current_voronoi});
}
}
}
@@ -985,7 +985,7 @@
for (const auto& poly : vectorial_surface->first) {
keep_outs.push_back(bg_helpers::buffer(poly, tool_diameter/2 + isolator->offset));
}
- const auto path_finding_surface = path_finding::PathFindingSurface(mask ? make_optional(mask->vectorial_surface->first) : boost::none, sum(keep_outs), isolator->tolerance);
+ const auto path_finding_surface = path_finding::PathFindingSurface(mask ? boost::make_optional(mask->vectorial_surface->first) : boost::none, sum(keep_outs), isolator->tolerance);
for (size_t trace_index = 0; trace_index < trace_count; trace_index++) {
multi_polygon_type_fp already_milled_shrunk =
bg_helpers::buffer(already_milled[trace_index], -tool_diameter/2 + tolerance);
@@ -1033,7 +1033,7 @@
const string tool_suffix = tool_count > 1 ? "_" + std::to_string(tool_index) : "";
write_svgs(tool_suffix, tool_diameter, new_trace_toolpaths, isolator->tolerance, tool_index == tool_count - 1);
auto new_toolpath = flatten(new_trace_toolpaths);
- multi_linestring_type_fp combined_toolpath = post_process_toolpath(mill, make_optional(&path_finding_surface), new_toolpath);
+ multi_linestring_type_fp combined_toolpath = post_process_toolpath(mill, boost::make_optional(&path_finding_surface), new_toolpath);
write_svgs("_final" + tool_suffix, tool_diameter, combined_toolpath, isolator->tolerance, tool_index == tool_count - 1);
results[tool_index] = make_pair(tool_diameter, mirror_toolpath(combined_toolpath, mirror, ymirror));
}