![]() |
![]() |
![]() |
|
PolyTree is intended as a read-only data structure that should only be used to receive solutions from polygon clipping operations. It's an alternative data structure the Paths structure which can also receive clipping solutions. Its major advantages over the Paths structure is that it properly represents the parent-child relationships of the returned polygons, and that it also differentiates between open and closed paths. However, since a PolyTree is more complex than a Paths structure, and because it's more computationally expensive to process (the Execute method being roughly 5-10% slower), it should only be used when parent-child polygon relationships are needed, or when open paths are being 'clipped'.
An empty PolyTree object can be passed as the solution parameter to a Clipper object's Execute method. Once the clipping operation is completed, this method returns with the PolyTree structure filled with data representing the solution.
A PolyTree object is a container for any number of PolyNode children, with each contained PolyNode representing a single polygon contour (either an outer or hole polygon). PolyTree itself is a specialized PolyNode whose immediate children represent the top-level outer polygons of the solution. (Its own Contour property is always empty.) The contained top-level PolyNodes may contain their own PolyNode children representing hole polygons that may also contain children representing nested outer polygons etc. Children of outers will always be holes, and children of holes will always be outers.
PolyTrees can also contain open paths. Open paths will always be represented by top level PolyNodes. Two functions are provided to quickly separate out open and closed paths from a polytree - OpenPathsFromPolyTree and ClosedPathsFromPolyTree.
![]() |
polytree: Contour = () ChildCount = 1 Childs[0]: Contour = ((10,10),(100,10),(100,100),(10,100)) IsHole = False ChildCount = 1 Childs[0]: Contour = ((20,20),(20,90),(90,90),(90,20)) IsHole = True ChildCount = 2 Childs[0]: Contour = ((30,30),(50,30),(50,50),(30,50)) IsHole = False ChildCount = 0 Childs[1]: Contour = ((60,60),(80,60),(80,80),(60,80)) IsHole = False ChildCount = 0 |
Methods | Properties |
---|---|
In PolyTree: | |
Clear | Total |
GetFirst | |
In PolyNode: | |
GetNext | ChildCount |
Childs | |
Contour | |
IsHole | |
IsOpen | |
Parent |
Overview, Clipper, Clipper.Execute, PolyNode, ClosedPathsFromPolyTree, OpenPathsFromPolyTree, Paths
Copyright ©2010-2013 Angus Johnson - Clipper Ver 6.0.0 - Help file built on 30-October-2013