support multiple polygon path in FillBetweenItem

addresses issue #220 by supportng fills between
finite-connected curves
This commit is contained in:
Richard Bryan 2015-08-25 17:32:15 -04:00
parent 1036edf618
commit 21ed1314aa

View File

@ -70,11 +70,14 @@ class FillBetweenItem(QtGui.QGraphicsPathItem):
path = QtGui.QPainterPath()
transform = QtGui.QTransform()
p1 = paths[0].toSubpathPolygons(transform)
p2 = paths[1].toReversed().toSubpathPolygons(transform)
if len(p1) == 0 or len(p2) == 0:
ps1 = paths[0].toSubpathPolygons(transform)
ps2 = paths[1].toReversed().toSubpathPolygons(transform)
ps2.reverse()
if len(ps1) == 0 or len(ps2) == 0:
self.setPath(QtGui.QPainterPath())
return
path.addPolygon(p1[0] + p2[0])
for p1, p2 in zip(ps1, ps2):
path.addPolygon(p1 + p2)
self.setPath(path)