o
    fz                     @  s   d dl mZ d dlmZmZ d dlmZmZ d dlm	Z	m
Z
mZmZ d dlmZmZ d dlmZmZ er:d dlmZ dddZdddZdS )    )annotations)TYPE_CHECKINGcast)FillTypeLineType)concat_codes_or_noneconcat_offsets_or_noneconcat_points_or_noneconcat_points_or_none_with_nan)as_fill_typeas_line_type)check_filledcheck_linesNfilledcpy.FillReturn	fill_typeFillType | strreturnc                 C  s  t |}|tjtjfv r| S t| | t| d dk r| S tr%ttj	| } t
| d }|tjkrPtr8ttj| } |du rDdgdgf}|S |gt| d gf}|S |tjkrutr]ttj| } |du ridgdgf}|S |gt| d gf}|S |tjkrtrttj| } |du rdgdgdgf}|S t| d }|gt| d g|gf}|S |tjkrtrttj| } |du rdgdgdgf}|S t| d }|gt| d g|gf}|S td| )a  Return the specified filled contours with all chunked data moved into the first chunk.

    Filled contours that are not chunked (``FillType.OuterCode`` and ``FillType.OuterOffset``) and
    those that are but only contain a single chunk are returned unmodified. Individual polygons are
    unchanged, they are not geometrically combined.

    Args:
        filled (sequence of arrays): Filled contour data as returned by
            :func:`~contourpy.ContourGenerator.filled`.
        fill_type (FillType or str): Type of ``filled`` as enum or string equivalent.

    Return:
        Filled contours in a single chunk.

    .. versionadded:: 1.2.0
    r      N   zInvalid FillType )r   r   Z	OuterCodeZOuterOffsetr   lenr   r   cpyZFillReturn_Chunkr	   ChunkCombinedCodeZFillReturn_ChunkCombinedCoder   ChunkCombinedOffsetZFillReturn_ChunkCombinedOffsetr   ZChunkCombinedCodeOffsetZ"FillReturn_ChunkCombinedCodeOffsetZChunkCombinedOffsetOffsetZ$FillReturn_ChunkCombinedOffsetOffset
ValueError)r   r   pointsret1ret2ret3Zouter_offsetsZret4 r   1lib/python3.10/site-packages/contourpy/dechunk.pydechunk_filled   sX   




r!   linescpy.LineReturn	line_typeLineType | strc                 C  s6  t |}|tjtjfv r| S t| | t| d dk r| S tr%ttj	| } |tj
krPtr2ttj| } t| d }|du rDdgdgf}|S |gt| d gf}|S |tjkr{tr]ttj| } t| d }|du rodgdgf}|S |gt| d gf}|S |tjkrtrttj| } t| d }|gf}|S td| )a  Return the specified contour lines with all chunked data moved into the first chunk.

    Contour lines that are not chunked (``LineType.Separate`` and ``LineType.SeparateCode``) and
    those that are but only contain a single chunk are returned unmodified. Individual lines are
    unchanged, they are not geometrically combined.

    Args:
        lines (sequence of arrays): Contour line data as returned by
            :func:`~contourpy.ContourGenerator.lines`.
        line_type (LineType or str): Type of ``lines`` as enum or string equivalent.

    Return:
        Contour lines in a single chunk.

    .. versionadded:: 1.2.0
    r   r   Nr   zInvalid LineType )r   r   ZSeparateZSeparateCoder   r   r   r   r   ZLineReturn_Chunkr   ZLineReturn_ChunkCombinedCoder	   r   r   ZLineReturn_ChunkCombinedOffsetr   ZChunkCombinedNanZLineReturn_ChunkCombinedNanr
   r   )r"   r$   r   r   r   r   r   r   r    dechunk_linesY   sB   



r&   )r   r   r   r   r   r   )r"   r#   r$   r%   r   r#   )Z
__future__r   typingr   r   Zcontourpy._contourpyr   r   Zcontourpy.arrayr   r   r	   r
   Zcontourpy.enum_utilr   r   Zcontourpy.typecheckr   r   Z
_contourpyr   r!   r&   r   r   r   r    <module>   s    
F