Prusa Slicer 2.6.0
Loading...
Searching...
No Matches
Slic3r::LayerRanges Class Reference
+ Collaboration diagram for Slic3r::LayerRanges:

Classes

struct  LayerRange
 

Public Member Functions

 LayerRanges ()=default
 
 LayerRanges (const t_layer_config_ranges &in)
 
void assign (const t_layer_config_ranges &in)
 
const DynamicPrintConfigconfig (const t_layer_height_range &range) const
 
std::vector< LayerRange >::const_iterator begin () const
 
std::vector< LayerRange >::const_iterator end () const
 
size_t size () const
 

Private Attributes

std::vector< LayerRangem_ranges
 

Detailed Description

Constructor & Destructor Documentation

◆ LayerRanges() [1/2]

Slic3r::LayerRanges::LayerRanges ( )
default

◆ LayerRanges() [2/2]

Slic3r::LayerRanges::LayerRanges ( const t_layer_config_ranges in)
inline
266{ this->assign(in); }
void assign(const t_layer_config_ranges &in)
Definition PrintApply.cpp:269

References assign().

+ Here is the call graph for this function:

Member Function Documentation

◆ assign()

void Slic3r::LayerRanges::assign ( const t_layer_config_ranges in)
inline
269 {
270 m_ranges.clear();
271 m_ranges.reserve(in.size());
272 // Input ranges are sorted lexicographically. First range trims the other ranges.
273 coordf_t last_z = 0;
274 for (const std::pair<const t_layer_height_range, ModelConfig> &range : in)
275 if (range.first.second > last_z) {
276 coordf_t min_z = std::max(range.first.first, 0.);
277 if (min_z > last_z + EPSILON) {
278 m_ranges.push_back({ t_layer_height_range(last_z, min_z) });
279 last_z = min_z;
280 }
281 if (range.first.second > last_z + EPSILON) {
282 const DynamicPrintConfig *cfg = &range.second.get();
283 m_ranges.push_back({ t_layer_height_range(last_z, range.first.second), cfg });
284 last_z = range.first.second;
285 }
286 }
287 if (m_ranges.empty())
288 m_ranges.push_back({ t_layer_height_range(0, DBL_MAX) });
289 else if (m_ranges.back().config == nullptr)
290 m_ranges.back().layer_height_range.second = DBL_MAX;
291 else
292 m_ranges.push_back({ t_layer_height_range(m_ranges.back().layer_height_range.second, DBL_MAX) });
293 }
std::pair< coordf_t, coordf_t > t_layer_height_range
Definition UndoRedo.hpp:14
std::vector< LayerRange > m_ranges
Definition PrintApply.cpp:314
if(!(yy_init))
Definition lexer.c:1190
static constexpr double EPSILON
Definition libslic3r.h:51
double coordf_t
Definition libslic3r.h:45
auto range(Cont &&cont)
Definition libslic3r.h:356
std::pair< coordf_t, coordf_t > t_layer_height_range
Definition Slicing.hpp:129

References EPSILON, m_ranges, and Slic3r::range().

Referenced by LayerRanges().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ begin()

std::vector< LayerRange >::const_iterator Slic3r::LayerRanges::begin ( ) const
inline
308{ return m_ranges.cbegin(); }

Referenced by Slic3r::generate_print_object_regions().

+ Here is the caller graph for this function:

◆ config()

const DynamicPrintConfig * Slic3r::LayerRanges::config ( const t_layer_height_range range) const
inline
295 {
296 auto it = std::lower_bound(m_ranges.begin(), m_ranges.end(), LayerRange{ { range.first - EPSILON, range.second - EPSILON } });
297 // #ys_FIXME_COLOR
298 // assert(it != m_ranges.end());
299 // assert(it == m_ranges.end() || std::abs(it->first.first - range.first ) < EPSILON);
300 // assert(it == m_ranges.end() || std::abs(it->first.second - range.second) < EPSILON);
301 if (it == m_ranges.end() ||
302 std::abs(it->layer_height_range.first - range.first) > EPSILON ||
303 std::abs(it->layer_height_range.second - range.second) > EPSILON )
304 return nullptr; // desired range doesn't found
305 return it == m_ranges.end() ? nullptr : it->config;
306 }

◆ end()

std::vector< LayerRange >::const_iterator Slic3r::LayerRanges::end ( ) const
inline
309{ return m_ranges.cend(); }

◆ size()

size_t Slic3r::LayerRanges::size ( ) const
inline
310{ return m_ranges.size(); }

Referenced by Slic3r::generate_print_object_regions().

+ Here is the caller graph for this function:

Member Data Documentation

◆ m_ranges

std::vector<LayerRange> Slic3r::LayerRanges::m_ranges
private

Referenced by assign().


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