typing
This commit is contained in:
parent
76c74f53c4
commit
a174f78d45
1 changed files with 5 additions and 5 deletions
|
|
@ -103,7 +103,7 @@ class SlicePaths(list[np.ndarray]):
|
|||
|
||||
return new_paths
|
||||
|
||||
def offset_curve(self, distance: float, join_style: str = 'round', rotation: Any = None) -> SlicePaths:
|
||||
def offset_curve(self, distance: float, join_style: Literal['round', 'mitre'] = 'round', rotation: Any = None) -> SlicePaths:
|
||||
"""Offsets open/closed curves by a distance using shapely. Handles optional rotation."""
|
||||
p = self
|
||||
if rotation and any(rotation):
|
||||
|
|
@ -770,7 +770,7 @@ def offset_geometry_to_paths(geom: BaseGeometry, z: float) -> list[np.ndarray]:
|
|||
def offset_curve_slice(
|
||||
slice_paths: list[np.ndarray],
|
||||
distance: float,
|
||||
join_style: str = 'round'
|
||||
join_style: Literal['round', 'mitre'] = 'round'
|
||||
) -> tuple[list[np.ndarray], list[int]]:
|
||||
if not slice_paths:
|
||||
return [], []
|
||||
|
|
@ -909,7 +909,7 @@ def paths_to_shapely_polygon(paths: list[np.ndarray]) -> BaseGeometry:
|
|||
from shapely.geometry import Polygon
|
||||
from shapely.ops import unary_union
|
||||
|
||||
pc = pyclipper.Pyclipper()
|
||||
pc = pyclipper.Pyclipper() # pyright: ignore[reportAttributeAccessIssue]
|
||||
for p in paths:
|
||||
if len(p) < 3:
|
||||
continue
|
||||
|
|
@ -917,9 +917,9 @@ def paths_to_shapely_polygon(paths: list[np.ndarray]) -> BaseGeometry:
|
|||
if np.allclose(pts_2d[0], pts_2d[-1]):
|
||||
pts_2d = pts_2d[:-1]
|
||||
scaled = (pts_2d * SCALE).astype(np.int64).tolist()
|
||||
pc.AddPath(scaled, pyclipper.PT_SUBJECT, True)
|
||||
pc.AddPath(scaled, pyclipper.PT_SUBJECT, True) # pyright: ignore[reportAttributeAccessIssue]
|
||||
|
||||
tree = pc.Execute2(pyclipper.CT_UNION, pyclipper.PFT_EVENODD, pyclipper.PFT_EVENODD)
|
||||
tree = pc.Execute2(pyclipper.CT_UNION, pyclipper.PFT_EVENODD, pyclipper.PFT_EVENODD) # pyright: ignore[reportAttributeAccessIssue]
|
||||
|
||||
def polytree_to_shapely(node) -> list[Polygon]:
|
||||
polygons = []
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue