OrcaSlicer latest
OrcaSlicer
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 DynamicPrintConfig * config (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< LayerRange > m_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
429{ this->assign(in); }
void assign(const t_layer_config_ranges &in)
Definition PrintApply.cpp:432

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
432 {
433 m_ranges.clear();
434 m_ranges.reserve(in.size());
435 // Input ranges are sorted lexicographically. First range trims the other ranges.
436 coordf_t last_z = 0;
437 for (const std::pair<const t_layer_height_range, ModelConfig> &range : in)
438 if (range.first.second > last_z) {
439 coordf_t min_z = std::max(range.first.first, 0.);
440 if (min_z > last_z + EPSILON) {
441 m_ranges.push_back({ t_layer_height_range(last_z, min_z) });
442 last_z = min_z;
443 }
444 if (range.first.second > last_z + EPSILON) {
445 const DynamicPrintConfig *cfg = &range.second.get();
446 m_ranges.push_back({ t_layer_height_range(last_z, range.first.second), cfg });
447 last_z = range.first.second;
448 }
449 }
450 if (m_ranges.empty())
451 m_ranges.push_back({ t_layer_height_range(0, DBL_MAX) });
452 else if (m_ranges.back().config == nullptr)
453 m_ranges.back().layer_height_range.second = DBL_MAX;
454 else
455 m_ranges.push_back({ t_layer_height_range(m_ranges.back().layer_height_range.second, DBL_MAX) });
456 }
#define EPSILON
Definition ColorUtils.cpp:64
std::vector< LayerRange > m_ranges
Definition PrintApply.cpp:477
double coordf_t
Definition GUI_ObjectList.hpp:46
auto range(Cont &&cont)
Definition libslic3r.h:405
std::pair< coordf_t, coordf_t > t_layer_height_range
Definition Slicing.hpp:159

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
471{ return m_ranges.cbegin(); }

References m_ranges.

◆ config()

const DynamicPrintConfig * Slic3r::LayerRanges::config ( const t_layer_height_range & range) const
inline
458 {
459 auto it = std::lower_bound(m_ranges.begin(), m_ranges.end(), LayerRange{ { range.first - EPSILON, range.second - EPSILON } });
460 // #ys_FIXME_COLOR
461 // assert(it != m_ranges.end());
462 // assert(it == m_ranges.end() || std::abs(it->first.first - range.first ) < EPSILON);
463 // assert(it == m_ranges.end() || std::abs(it->first.second - range.second) < EPSILON);
464 if (it == m_ranges.end() ||
465 std::abs(it->layer_height_range.first - range.first) > EPSILON ||
466 std::abs(it->layer_height_range.second - range.second) > EPSILON )
467 return nullptr; // desired range doesn't found
468 return it == m_ranges.end() ? nullptr : it->config;
469 }
Definition PrintApply.cpp:420

References m_ranges, and Slic3r::range().

Here is the call graph for this function:

◆ end()

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

References m_ranges.

◆ size()

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

References m_ranges.

Member Data Documentation

◆ m_ranges

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

Referenced by assign(), begin(), config(), end(), and size().


The documentation for this class was generated from the following file:
  • /home/runner/work/OrcaSlicer/OrcaSlicer/src/libslic3r/PrintApply.cpp