Fix broken partial arrange

This commit is contained in:
tamasmeszaros 2019-07-02 10:32:01 +02:00
parent 253ec07cb2
commit ba82cbe007

View file

@ -340,28 +340,26 @@ class AutoArranger {};
template<class TBin> template<class TBin>
class _ArrBase { class _ArrBase {
public: public:
// Useful type shortcuts... // Useful type shortcuts...
using Placer = typename placers::_NofitPolyPlacer<clppr::Polygon, TBin>; using Placer = typename placers::_NofitPolyPlacer<clppr::Polygon, TBin>;
using Selector = selections::_FirstFitSelection<clppr::Polygon>; using Selector = selections::_FirstFitSelection<clppr::Polygon>;
using Packer = Nester<Placer, Selector>; using Packer = Nester<Placer, Selector>;
using PConfig = typename Packer::PlacementConfig; using PConfig = typename Packer::PlacementConfig;
using Distance = TCoord<PointImpl>; using Distance = TCoord<PointImpl>;
protected: protected:
Packer m_pck;
Packer m_pck; PConfig m_pconf; // Placement configuration
PConfig m_pconf; // Placement configuration double m_bin_area;
double m_bin_area; SpatIndex m_rtree; // spatial index for the normal (bigger) objects
SpatIndex m_rtree; // spatial index for the normal (bigger) objects
SpatIndex m_smallsrtree; // spatial index for only the smaller items SpatIndex m_smallsrtree; // spatial index for only the smaller items
double m_norm; // A coefficient to scale distances double m_norm; // A coefficient to scale distances
MultiPolygon m_merged_pile; // The already merged pile (vector of items) MultiPolygon m_merged_pile; // The already merged pile (vector of items)
Box m_pilebb; // The bounding box of the merged pile. Box m_pilebb; // The bounding box of the merged pile.
ItemGroup m_remaining; // Remaining items (m_items at the beginning) ItemGroup m_remaining; // Remaining items (m_items at the beginning)
ItemGroup m_items; // The items to be packed ItemGroup m_items; // The items to be packed
public: public:
_ArrBase(const TBin& bin, Distance dist, _ArrBase(const TBin& bin, Distance dist,
std::function<void(unsigned)> progressind, std::function<void(unsigned)> progressind,
std::function<bool(void)> stopcond): std::function<bool(void)> stopcond):
@ -715,8 +713,8 @@ bool arrange(ArrangeablePtrs & arrangables,
clpath.Contour.emplace_back(firstp); clpath.Contour.emplace_back(firstp);
outp.emplace_back(applyfn, std::move(clpath)); outp.emplace_back(applyfn, std::move(clpath));
outp.front().rotation(rotation); outp.back().rotation(rotation);
outp.front().translation({offs.x(), offs.y()}); outp.back().translation({offs.x(), offs.y()});
}; };
for (Arrangeable *arrangeable : arrangables) { for (Arrangeable *arrangeable : arrangables) {