Prusa Slicer 2.6.0
Loading...
Searching...
No Matches
libnest2d::selections::SelectionBoilerplate< RawShape > Class Template Reference

#include <src/libnest2d/include/libnest2d/selections/selection_boilerplate.hpp>

+ Inheritance diagram for libnest2d::selections::SelectionBoilerplate< RawShape >:

Public Types

using ShapeType = RawShape
 
using Item = _Item< RawShape >
 
using ItemGroup = _ItemGroup< RawShape >
 
using PackGroup = _PackGroup< RawShape >
 

Public Member Functions

const PackGroupgetResult () const
 
int lastPackedBinId () const
 
void progressIndicator (ProgressFunction fn)
 
void stopCondition (StopCondition cond)
 
void clear ()
 

Protected Member Functions

template<class Placer , class Container , class Bin , class PCfg >
void remove_unpackable_items (Container &c, const Bin &bin, const PCfg &pcfg)
 

Protected Attributes

PackGroup packed_bins_
 
ProgressFunction progress_ = [](unsigned){}
 
StopCondition stopcond_ = [](){ return false; }
 
int last_packed_bin_id_ = -1
 

Detailed Description

template<class RawShape>
class libnest2d::selections::SelectionBoilerplate< RawShape >

Member Typedef Documentation

◆ Item

template<class RawShape >
using libnest2d::selections::SelectionBoilerplate< RawShape >::Item = _Item<RawShape>

◆ ItemGroup

template<class RawShape >
using libnest2d::selections::SelectionBoilerplate< RawShape >::ItemGroup = _ItemGroup<RawShape>

◆ PackGroup

template<class RawShape >
using libnest2d::selections::SelectionBoilerplate< RawShape >::PackGroup = _PackGroup<RawShape>

◆ ShapeType

template<class RawShape >
using libnest2d::selections::SelectionBoilerplate< RawShape >::ShapeType = RawShape

Member Function Documentation

◆ clear()

template<class RawShape >
void libnest2d::selections::SelectionBoilerplate< RawShape >::clear ( )
inline
27{ packed_bins_.clear(); }
PackGroup packed_bins_
Definition selection_boilerplate.hpp:56

References libnest2d::selections::SelectionBoilerplate< RawShape >::packed_bins_.

◆ getResult()

template<class RawShape >
const PackGroup & libnest2d::selections::SelectionBoilerplate< RawShape >::getResult ( ) const
inline

◆ lastPackedBinId()

template<class RawShape >
int libnest2d::selections::SelectionBoilerplate< RawShape >::lastPackedBinId ( ) const
inline

◆ progressIndicator()

template<class RawShape >
void libnest2d::selections::SelectionBoilerplate< RawShape >::progressIndicator ( ProgressFunction  fn)
inline
23{ progress_ = fn; }
ProgressFunction progress_
Definition selection_boilerplate.hpp:57

References libnest2d::selections::SelectionBoilerplate< RawShape >::progress_.

◆ remove_unpackable_items()

template<class RawShape >
template<class Placer , class Container , class Bin , class PCfg >
void libnest2d::selections::SelectionBoilerplate< RawShape >::remove_unpackable_items ( Container &  c,
const Bin &  bin,
const PCfg &  pcfg 
)
inlineprotected
33 {
34 // Safety test: try to pack each item into an empty bin. If it fails
35 // then it should be removed from the list
36 auto it = c.begin();
37 while (it != c.end() && !stopcond_()) {
38
39 // WARNING: The copy of itm needs to be created before Placer.
40 // Placer is working with references and its destructor still
41 // manipulates the item this is why the order of stack creation
42 // matters here.
43 const Item& itm = *it;
44 Item cpy{itm};
45
46 Placer p{bin};
47 p.configure(pcfg);
48 if (itm.area() <= 0 || !p.pack(cpy)) {
49 static_cast<Item&>(*it).binId(BIN_ID_UNSET);
50 it = c.erase(it);
51 }
52 else it++;
53 }
54 }
_Item< RawShape > Item
Definition selection_boilerplate.hpp:13
StopCondition stopcond_
Definition selection_boilerplate.hpp:58
static const constexpr int BIN_ID_UNSET
Definition nester.hpp:15

References libnest2d::_Item< RawShape >::area(), libnest2d::BIN_ID_UNSET, libnest2d::_Item< RawShape >::binId(), and libnest2d::selections::SelectionBoilerplate< RawShape >::stopcond_.

+ Here is the call graph for this function:

◆ stopCondition()

template<class RawShape >
void libnest2d::selections::SelectionBoilerplate< RawShape >::stopCondition ( StopCondition  cond)
inline

Member Data Documentation

◆ last_packed_bin_id_

◆ packed_bins_

◆ progress_

◆ stopcond_


The documentation for this class was generated from the following file: