Prusa Slicer 2.6.0
Loading...
Searching...
No Matches
ClipperLib::PolyTree Class Reference

#include <src/clipper/clipper.hpp>

+ Inheritance diagram for ClipperLib::PolyTree:
+ Collaboration diagram for ClipperLib::PolyTree:

Public Member Functions

 PolyTree ()
 
 PolyTree (PolyTree &&src)
 
virtual ~PolyTree ()
 
PolyTreeoperator= (PolyTree &&src)
 
PolyNodeGetFirst () const
 
void Clear ()
 
int Total () const
 
void RemoveOutermostPolygon ()
 
PolyNodeGetNext () const
 
bool IsHole () const
 
bool IsOpen () const
 
int ChildCount () const
 

Public Attributes

Path Contour
 
PolyNodes Childs
 
PolyNodeParent
 

Private Member Functions

 PolyTree (const PolyTree &src)=delete
 
PolyTreeoperator= (const PolyTree &src)=delete
 
PolyNodeGetNextSiblingUp () const
 
void AddChild (PolyNode &child)
 

Private Attributes

std::vector< PolyNode, Allocator< PolyNode > > AllNodes
 
unsigned Index
 
bool m_IsOpen
 
JoinType m_jointype
 
EndType m_endtype
 

Friends

class Clipper
 

Detailed Description

Constructor & Destructor Documentation

◆ PolyTree() [1/3]

ClipperLib::PolyTree::PolyTree ( )
inline
172{}

◆ PolyTree() [2/3]

ClipperLib::PolyTree::PolyTree ( PolyTree &&  src)
inline
173{ *this = std::move(src); }

◆ ~PolyTree()

virtual ClipperLib::PolyTree::~PolyTree ( )
inlinevirtual
174{Clear();};
void Clear()
Definition clipper.hpp:189

◆ PolyTree() [3/3]

ClipperLib::PolyTree::PolyTree ( const PolyTree src)
privatedelete

Member Function Documentation

◆ AddChild()

void ClipperLib::PolyNode::AddChild ( PolyNode child)
privateinherited
113{
114 unsigned cnt = (unsigned)Childs.size();
115 Childs.emplace_back(&child);
116 child.Parent = this;
117 child.Index = cnt;
118}
PolyNodes Childs
Definition clipper.hpp:150

References ClipperLib::PolyNode::Index, and ClipperLib::PolyNode::Parent.

Referenced by ClipperLib::ClipperOffset::AddPath(), and ClipperLib::Clipper::BuildResult2().

+ Here is the caller graph for this function:

◆ ChildCount()

int ClipperLib::PolyNode::ChildCount ( ) const
inlineinherited

◆ Clear()

void ClipperLib::PolyTree::Clear ( )
inline
189{ AllNodes.clear(); Childs.clear(); }
std::vector< PolyNode, Allocator< PolyNode > > AllNodes
Definition clipper.hpp:195

Referenced by ClipperLib::Clipper::BuildResult2(), and ClipperLib::ClipperOffset::Execute().

+ Here is the caller graph for this function:

◆ GetFirst()

PolyNode * ClipperLib::PolyTree::GetFirst ( ) const
inline
188{ return Childs.empty() ? nullptr : Childs.front(); }

◆ GetNext()

PolyNode * ClipperLib::PolyNode::GetNext ( ) const
inlineinherited
153{ return Childs.empty() ? GetNextSiblingUp() : Childs.front(); }
PolyNode * GetNextSiblingUp() const
Definition clipper.hpp:162
TPoint< P > front(const P &p)
Definition geometry_traits.hpp:872

◆ GetNextSiblingUp()

PolyNode * ClipperLib::PolyNode::GetNextSiblingUp ( ) const
inlineprivateinherited
162{ return Parent ? ((Index == Parent->Childs.size() - 1) ? Parent->GetNextSiblingUp() : Parent->Childs[Index + 1]) : nullptr; }
PolyNode * Parent
Definition clipper.hpp:151
unsigned Index
Definition clipper.hpp:158

References ClipperLib::PolyNode::Childs, and ClipperLib::PolyNode::GetNextSiblingUp().

Referenced by ClipperLib::PolyNode::GetNextSiblingUp().

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

◆ IsHole()

bool ClipperLib::PolyNode::IsHole ( ) const
inherited
123{
124 bool result = true;
125 PolyNode* node = Parent;
126 while (node)
127 {
128 result = !result;
129 node = node->Parent;
130 }
131 return result;
132}
PolyNode()
Definition clipper.hpp:147

References ClipperLib::PolyNode::Parent.

Referenced by Slic3r::traverse_pt(), and Slic3r::traverse_pt_noholes().

+ Here is the caller graph for this function:

◆ IsOpen()

bool ClipperLib::PolyNode::IsOpen ( ) const
inlineinherited
155{ return m_IsOpen; }
bool m_IsOpen
Definition clipper.hpp:159

Referenced by ClipperLib::AddPolyNodeToPaths().

+ Here is the caller graph for this function:

◆ operator=() [1/2]

PolyTree & ClipperLib::PolyTree::operator= ( const PolyTree src)
privatedelete

◆ operator=() [2/2]

PolyTree & ClipperLib::PolyTree::operator= ( PolyTree &&  src)
inline
175 {
176 AllNodes = std::move(src.AllNodes);
177 Contour = std::move(src.Contour);
178 Childs = std::move(src.Childs);
179 Parent = nullptr;
180 Index = src.Index;
181 m_IsOpen = src.m_IsOpen;
182 m_jointype = src.m_jointype;
183 m_endtype = src.m_endtype;
184 for (size_t i = 0; i < Childs.size(); ++ i)
185 Childs[i]->Parent = this;
186 return *this;
187 }
Path Contour
Definition clipper.hpp:149
JoinType m_jointype
Definition clipper.hpp:160
EndType m_endtype
Definition clipper.hpp:161

◆ RemoveOutermostPolygon()

void ClipperLib::PolyTree::RemoveOutermostPolygon ( )
135{
136 if (this->ChildCount() == 1 && this->Childs[0]->ChildCount() > 0) {
137 PolyNode *outerNode = this->Childs[0];
138 this->Childs.reserve(outerNode->ChildCount());
139 this->Childs[0] = outerNode->Childs[0];
140 this->Childs[0]->Parent = outerNode->Parent;
141 for (int i = 1; i < outerNode->ChildCount(); ++i)
142 this->AddChild(*outerNode->Childs[i]);
143 } else
144 this->Clear();
145}
int ChildCount() const
Definition clipper.hpp:156
void AddChild(PolyNode &child)
Definition clipper.cpp:112

References ClipperLib::PolyNode::ChildCount(), ClipperLib::PolyNode::Childs, and ClipperLib::PolyNode::Parent.

Referenced by ClipperLib::ClipperOffset::Execute(), and Slic3r::remove_outermost_polygon< ClipperLib::PolyTree >().

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

◆ Total()

int ClipperLib::PolyTree::Total ( ) const
101{
102 int result = (int)AllNodes.size();
103 //with negative offsets, ignore the hidden outer polygon ...
104 if (result > 0 && Childs.front() != &AllNodes.front()) result--;
105 return result;
106}

Referenced by ClipperLib::ClosedPathsFromPolyTree(), Slic3r::sla::anonymous_namespace{Pad.cpp}::divide_blueprint(), ClipperLib::OpenPathsFromPolyTree(), and ClipperLib::PolyTreeToPaths().

+ Here is the caller graph for this function:

Friends And Related Symbol Documentation

◆ Clipper

friend class Clipper
friend

Member Data Documentation

◆ AllNodes

std::vector<PolyNode, Allocator<PolyNode> > ClipperLib::PolyTree::AllNodes
private

◆ Childs

◆ Contour

◆ Index

unsigned ClipperLib::PolyNode::Index
privateinherited

◆ m_endtype

◆ m_IsOpen

bool ClipperLib::PolyNode::m_IsOpen
privateinherited

◆ m_jointype

JoinType ClipperLib::PolyNode::m_jointype
privateinherited

◆ Parent


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