Prusa Slicer 2.6.0
Loading...
Searching...
No Matches
Slic3r::LinesBucketQueue Class Reference

#include <src/libslic3r/GCode/ConflictChecker.hpp>

+ Collaboration diagram for Slic3r::LinesBucketQueue:

Public Member Functions

void emplace_back_bucket (std::vector< ExtrusionPaths > &&paths, const void *objPtr, Points offset)
 
void build_queue ()
 
bool valid () const
 
const voididToObjsPtr (int id)
 
double removeLowests ()
 
LineWithIDs getCurLines () const
 

Private Attributes

std::vector< LinesBucket_buckets
 
std::priority_queue< LinesBucket *, std::vector< LinesBucket * >, LinesBucketPtrComp_pq
 
std::map< int, const void * > _idToObjsPtr
 
std::map< const void *, int > _objsPtrToId
 

Detailed Description

Member Function Documentation

◆ build_queue()

void Slic3r::LinesBucketQueue::build_queue ( )
102{
103 assert(_pq.empty());
104 for (LinesBucket &bucket : _buckets)
105 _pq.push(&bucket);
106}
std::priority_queue< LinesBucket *, std::vector< LinesBucket * >, LinesBucketPtrComp > _pq
Definition ConflictChecker.hpp:80
std::vector< LinesBucket > _buckets
Definition ConflictChecker.hpp:79

References _buckets, and _pq.

Referenced by Slic3r::ConflictChecker::find_inter_of_lines_in_diff_objs().

+ Here is the caller graph for this function:

◆ emplace_back_bucket()

void Slic3r::LinesBucketQueue::emplace_back_bucket ( std::vector< ExtrusionPaths > &&  paths,
const void objPtr,
Points  offset 
)
93{
94 if (_objsPtrToId.find(objPtr) == _objsPtrToId.end()) {
95 _objsPtrToId.insert({objPtr, _objsPtrToId.size()});
96 _idToObjsPtr.insert({_objsPtrToId.size() - 1, objPtr});
97 }
98 _buckets.emplace_back(std::move(paths), _objsPtrToId[objPtr], offsets);
99}
std::map< int, const void * > _idToObjsPtr
Definition ConflictChecker.hpp:81
std::map< const void *, int > _objsPtrToId
Definition ConflictChecker.hpp:82

References _buckets, _idToObjsPtr, and _objsPtrToId.

Referenced by Slic3r::ConflictChecker::find_inter_of_lines_in_diff_objs().

+ Here is the caller graph for this function:

◆ getCurLines()

LineWithIDs Slic3r::LinesBucketQueue::getCurLines ( ) const
129{
130 LineWithIDs lines;
131 for (const LinesBucket &bucket : _buckets) {
132 if (bucket.valid()) {
133 LineWithIDs tmpLines = bucket.curLines();
134 lines.insert(lines.end(), tmpLines.begin(), tmpLines.end());
135 }
136 }
137 return lines;
138}
std::vector< LineWithID > LineWithIDs
Definition ConflictChecker.hpp:26

References _buckets.

Referenced by Slic3r::ConflictChecker::find_inter_of_lines_in_diff_objs().

+ Here is the caller graph for this function:

◆ idToObjsPtr()

const void * Slic3r::LinesBucketQueue::idToObjsPtr ( int  id)
inline
89 {
90 if (_idToObjsPtr.find(id) != _idToObjsPtr.end())
91 return _idToObjsPtr[id];
92 else
93 return nullptr;
94 }

References _idToObjsPtr.

◆ removeLowests()

double Slic3r::LinesBucketQueue::removeLowests ( )
109{
110 auto lowest = _pq.top();
111 _pq.pop();
112 double curHeight = lowest->curHeight();
113 std::vector<LinesBucket *> lowests;
114 lowests.push_back(lowest);
115
116 while (_pq.empty() == false && std::abs(_pq.top()->curHeight() - lowest->curHeight()) < EPSILON) {
117 lowests.push_back(_pq.top());
118 _pq.pop();
119 }
120
121 for (LinesBucket *bp : lowests) {
122 bp->raise();
123 if (bp->valid()) { _pq.push(bp); }
124 }
125 return curHeight;
126}
static constexpr double EPSILON
Definition libslic3r.h:51

References _pq, and EPSILON.

Referenced by Slic3r::ConflictChecker::find_inter_of_lines_in_diff_objs().

+ Here is the caller graph for this function:

◆ valid()

bool Slic3r::LinesBucketQueue::valid ( ) const
inline
87{ return _pq.empty() == false; }

References _pq.

Referenced by Slic3r::ConflictChecker::find_inter_of_lines_in_diff_objs().

+ Here is the caller graph for this function:

Member Data Documentation

◆ _buckets

std::vector<LinesBucket> Slic3r::LinesBucketQueue::_buckets
private

◆ _idToObjsPtr

std::map<int, const void *> Slic3r::LinesBucketQueue::_idToObjsPtr
private

Referenced by emplace_back_bucket(), and idToObjsPtr().

◆ _objsPtrToId

std::map<const void *, int> Slic3r::LinesBucketQueue::_objsPtrToId
private

Referenced by emplace_back_bucket().

◆ _pq

std::priority_queue<LinesBucket *, std::vector<LinesBucket *>, LinesBucketPtrComp> Slic3r::LinesBucketQueue::_pq
private

Referenced by build_queue(), removeLowests(), and valid().


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