(conts, withholes = False)
| 16 | import matplotlib.pyplot as plt |
| 17 | |
| 18 | def polygonize(conts, withholes = False): |
| 19 | for i in conts:i[:,[0,1]] = i[:,[1,0]] |
| 20 | polygon = Polygon(conts[0]).buffer(0) |
| 21 | if not withholes:return polygon |
| 22 | holes = [] |
| 23 | for i in conts[1:]: |
| 24 | if len(i)<4:continue |
| 25 | holes.append(Polygon(i).buffer(0)) |
| 26 | hole = cascaded_union(holes) |
| 27 | return polygon.difference(hole) |
| 28 | |
| 29 | |
| 30 | class Plugin(Tool): |
no test coverage detected