# This file is automatically generated by pyo3_stub_gen
# ruff: noqa: E501, F401, F403, F405
r"""
Workpiece state: cleared-area tracker, stock region, and part descriptor.

Maintains a union of swept-disk polygons and provides a spatial-indexed
windowed query for efficient engagement computation.
"""

import builtins
from raygeo import geo
import typing
from . import cleared_area
from . import crescent
from . import image_source
__all__ = [
    "FaceState",
    "Part",
    "StockRegion",
    "cleared_area",
    "crescent",
    "image_source",
]

@typing.final
class FaceState:
    r"""
    Geometry, stock region, and cleared area for one face of a
    multi-face part.
    
    Read-only snapshot. Assemblers mutate face state internally;
    use the getters to inspect the state after assembly.
    """
    @property
    def geometry(self) -> typing.Optional[geo.Geometry]:
        r"""
        Vector geometry for this face, if any.
        """
    @property
    def stock_region(self) -> StockRegion:
        r"""
        Boundary and islands of this face — the geometric input to
        clearing operations.
        """
    @property
    def cleared(self) -> cleared_area.ClearedArea:
        r"""
        Accumulated cleared-area state for this face — what has been
        cut so far.
        """
    def __repr__(self) -> builtins.str: ...

@typing.final
class Part:
    r"""
    Unified workpiece description for motion assembly.
    
    Carries geometry, physical metadata, and a ``ClearedArea``
    tracking what has already been cut.  Assemblers mutate the
    cleared area as they work.
    """
    @property
    def size_mm(self) -> tuple[builtins.float, builtins.float]:
        r"""
        Physical size ``(width, height)`` in millimetres.
        """
    @property
    def pixels_per_mm(self) -> typing.Optional[tuple[builtins.float, builtins.float]]:
        r"""
        Pixel density ``(x, y)`` in px/mm, if set.
        """
    @property
    def geometry(self) -> typing.Optional[geo.Geometry]:
        r"""
        Vector geometry (the outline(s) of the part), if any.
        
        Returns ``None`` if no geometry was provided at construction time.
        """
    @property
    def cleared(self) -> cleared_area.ClearedArea:
        r"""
        Accumulated cleared-area state — what has been cut so far.
        
        Read-only snapshot.  Assemblers mutate this internally;
        use it after an assembler returns to inspect remaining
        material, fragments, etc.
        """
    @property
    def stock_region(self) -> StockRegion:
        r"""
        Boundary and islands of the workpiece — cached extraction
        from geometry. Read-only.
        """
    @property
    def image(self) -> typing.Optional[builtins.list[builtins.int]]:
        r"""
        Optional pixel image buffer for raster/shrinkwrap operations.
        
        Set by the stage before calling an assembler.  The assembler
        reads this internally instead of accepting a separate image
        argument.  Expects a 2-D uint8 numpy array; the value is
        stored on the part as a `WholeImageSource` and is also
        accessible via the `image_source` property.
        
        :returns: flat ``bytes`` of the image (row-major uint8), or
            ``None`` when no image has been attached.
        """
    @image.setter
    def image(self, value: typing.Optional[typing.Any]) -> None: ...
    @property
    def image_source(self) -> typing.Optional[image_source.WholeImageSource]:
        r"""
        The lazy `WholeImageSource` backing this part, or ``None``
        if no raster image has been attached.
        
        Reading this property returns the same `WholeImageSource`
        instance that was passed to the setter (or constructed
        implicitly by the ``image`` setter). Assigning ``None``
        clears it; assigning a `WholeImageSource` instance replaces
        the current source.
        
        Vector-only parts have ``image_source = None``.
        
        :returns: `WholeImageSource` or ``None``.
        """
    @image_source.setter
    def image_source(self, value: typing.Optional[image_source.WholeImageSource]) -> None: ...
    def __new__(cls, geometry: typing.Optional[geo.Geometry] = None, size_mm: tuple[builtins.float, builtins.float] = (0.0, 0.0), pixels_per_mm: typing.Optional[tuple[builtins.float, builtins.float]] = None) -> Part:
        r"""
        Create a new Part.
        
        :param geometry: Optional vector geometry (outlines of the part).
        :param size_mm: Physical size ``(width, height)`` in millimetres.
        :param pixels_per_mm: Optional pixel density ``(x, y)`` in px/mm.
        """
    @staticmethod
    def from_polygons(boundary: typing.Sequence[tuple[builtins.float, builtins.float]], islands: typing.Optional[typing.Sequence[typing.Sequence[tuple[builtins.float, builtins.float]]]] = None, size_mm: tuple[builtins.float, builtins.float] = (0.0, 0.0), initial: typing.Optional[typing.Sequence[typing.Sequence[tuple[builtins.float, builtins.float]]]] = None) -> Part:
        r"""
        Build a Part from a boundary polygon and optional islands.
        
        :param boundary: Outer boundary as ``[(x, y), ...]``.
        :param islands: List of island polygons, each ``[(x, y), ...]``
            (default ``[]``).
        :param size_mm: Physical size ``(width, height)`` in mm
            (default ``(0, 0)``).
        :param initial: Optional pre-seeded cleared polygons (e.g. a
            seed circle for adaptive clearing).  When provided, the
            part's cleared area starts with these fragments instead of
            being empty.
        :returns: A new ``Part`` with the geometry constructed from the
            given polygons.
        """
    def has_geometry(self) -> builtins.bool:
        r"""
        True if this Part has geometry.
        """
    def add_face(self, id: builtins.str, geometry: typing.Optional[geo.Geometry]) -> None:
        r"""
        Add a new face. Panics if a face with the given ``id`` already
        exists.
        
        :param id: Face identifier string. The empty string ``""`` is
            reserved for the default face.
        :param geometry: Optional geometry for this face.
        """
    def face(self, id: builtins.str) -> typing.Optional[FaceState]:
        r"""
        Access a face's state by id.
        
        Returns ``None`` if the given id does not exist. Use the empty
        string ``""`` to get the default face (always exists).
        
        :param id: Face identifier string.
        :returns: A :class:`FaceState` snapshot, or ``None``.
        """
    def __repr__(self) -> builtins.str: ...

@typing.final
class StockRegion:
    r"""
    Boundary and islands of a workpiece — the geometric input to
    clearing operations.
    """
    @property
    def boundary(self) -> builtins.list[tuple[builtins.float, builtins.float]]:
        r"""
        Outer boundary polygon as ``[(x, y), ...]``.
        """
    @property
    def islands(self) -> builtins.list[builtins.list[tuple[builtins.float, builtins.float]]]:
        r"""
        List of island polygons, each ``[(x, y), ...]``.
        """
    def __new__(cls, boundary: typing.Sequence[tuple[builtins.float, builtins.float]], islands: typing.Optional[typing.Sequence[typing.Sequence[tuple[builtins.float, builtins.float]]]] = None) -> StockRegion:
        r"""
        Create a new StockRegion.
        
        :param boundary: Outer boundary polygon as ``[(x, y), ...]``.
        :param islands: List of island polygons, each ``[(x, y), ...]``
            (default ``[]``).
        """
    def __repr__(self) -> builtins.str: ...

