(polygon)
| 20 | |
| 21 | |
| 22 | def _path_from_polygon(polygon): |
| 23 | from matplotlib.path import Path |
| 24 | |
| 25 | from shapely.ops import orient |
| 26 | |
| 27 | if isinstance(polygon, shapely.MultiPolygon): |
| 28 | return Path.make_compound_path( |
| 29 | *[_path_from_polygon(poly) for poly in polygon.geoms] |
| 30 | ) |
| 31 | else: |
| 32 | polygon = orient(polygon) |
| 33 | return Path.make_compound_path( |
| 34 | Path(np.asarray(polygon.exterior.coords)[:, :2]), |
| 35 | *[Path(np.asarray(ring.coords)[:, :2]) for ring in polygon.interiors], |
| 36 | ) |
| 37 | |
| 38 | |
| 39 | def patch_from_polygon(polygon, **kwargs): |
no test coverage detected
searching dependent graphs…