FIX: fix two tree support bugs

1. hybrid(auto) on_buildplate_only option not working correctly because
parent is not set.
2. tree(auto) on_buildplate_only not working correctly because unsupported
branch isn't deleted completely. I add child to track the dangling nodes
and then delete nodes with no child.

Change-Id: I24c69a7cf400d2961b22a720a6069cf95db6c1a5
(cherry picked from commit bce77c16128d35c668b175e7135b9fe9acd71d13)
This commit is contained in:
Arthur 2022-09-30 16:30:10 +08:00 committed by Lane.Wei
parent c37f489f35
commit c9e8ef3f93
3 changed files with 33 additions and 15 deletions

View file

@ -2,6 +2,8 @@
#define FIRSTFIT_HPP
#include "selection_boilerplate.hpp"
// for writing SVG
//#include "../tools/svgtools.hpp"
namespace libnest2d { namespace selections {
@ -60,14 +62,11 @@ public:
pconfig.m_excluded_items.emplace_back(itm);
});
// If the packed_items array is not empty we have to create as many
// placers as there are elements in packed bins and preload each item
// into the appropriate placer
//for(ItemGroup& ig : fixed_bins) {
// placers.emplace_back(bin);
// placers.back().configure(pconfig);
// placers.back().preload(ig);
//}
#ifdef SVGTOOLS_HPP
svg::SVGWriter<RawShape> svgwriter;
std::for_each(first, last, [this,&svgwriter](Item &itm) { svgwriter.writeShape(itm, "none", "blue"); });
svgwriter.save(boost::filesystem::path("SVG") / "all_items.svg");
#endif
std::function<bool(Item& i1, Item& i2)> sortfunc;
if (pconfig.sortfunc)