
    (&h                     0    d Z ddlmZ  G d d          ZdS )zCoordinate sequence utilities.    )arrayc                   H    e Zd ZdZd Zd Zd Zd Zd	dZe	d             Z
dS )
CoordinateSequencea.  Access to coordinate tuples from the parent geometry's coordinate sequence.

    Examples
    --------
    >>> from shapely.wkt import loads
    >>> g = loads('POINT (0.0 0.0)')
    >>> list(g.coords)
    [(0.0, 0.0)]
    >>> g = loads('POINT M (1 2 4)')
    >>> g.coords[:]
    [(1.0, 2.0, 4.0)]

    c                     || _         dS )zInitialize the CoordinateSequence.

        Parameters
        ----------
        coords : array
            The coordinate array.

        N)_coords)selfcoordss     I/var/www/html/reinick/venv/lib/python3.11/site-packages/shapely/coords.py__init__zCoordinateSequence.__init__   s         c                 &    | j         j        d         S )zReturn the length of the CoordinateSequence.

        Returns
        -------
        int
            The length of the CoordinateSequence.

        r   )r   shape)r   s    r
   __len__zCoordinateSequence.__len__    s     |!!$$r   c              #      K   t          |                                           D ]0}t          | j        |                                                   V  1dS )z$Iterate over the CoordinateSequence.N)ranger   tupler   tolist)r   is     r
   __iter__zCoordinateSequence.__iter__+   sX      t||~~&& 	2 	2AQ..00111111	2 	2r   c                 ,   |                                  }t          |t                    rX||z   dk     s||k    rt          d          |dk     r||z   }n|}t	          | j        |                                                   S t          |t                    rpg }|                    |          \  }}}t          |||          D ]A}|
                    t	          | j        |                                                              B|S t          d          )a  Get the item at the specified index or slice.

        Parameters
        ----------
        key : int or slice
            The index or slice.

        Returns
        -------
        tuple or list
            The item at the specified index or slice.

        r   zindex out of rangezkey must be an index or slice)r   
isinstanceint
IndexErrorr   r   r   sliceindicesr   append	TypeError)r   keymr   resstartstopstrides           r
   __getitem__zCoordinateSequence.__getitem__0   s    LLNNc3 	=Qw{{cQhh !5666QwwGa//11222U## 	=C"%++a..E45$// < <

5a!7!7!9!9::;;;;J;<<<r   Nc                 p    |du rt          d          |du r| j                                        S | j        S )a  Return a copy of the coordinate array.

        Parameters
        ----------
        dtype : data-type, optional
            The desired data-type for the array.
        copy : bool, optional
            If None (default) or True, a copy of the array is always returned.
            If False, a ValueError is raised as this is not supported.

        Returns
        -------
        array
            The coordinate array.

        Raises
        ------
        ValueError
            If `copy=False` is specified.

        Fz7`copy=False` isn't supported. A copy is always created.T)
ValueErrorr   copy)r   dtyper'   s      r
   	__array__zCoordinateSequence.__array__P   sA    , 5==VWWWT\\<$$&&&<r   c                 <   |                                  }t          d          }t          d          }t          |          D ]W}| j        |                                         }|                    |d                    |                    |d                    X||fS )zX and Y arrays.dr      )r   r   r   r   r   r   )r   r   xyr   xys         r
   r/   zCoordinateSequence.xym   s     LLNN#JJ#JJq 	 	Aa''))BHHRUOOOHHRUOOOO!tr   )NN)__name__
__module____qualname____doc__r   r   r   r$   r)   propertyr/    r   r
   r   r      s         	 	 		% 	% 	%2 2 2
= = =@       : 	 	 X	 	 	r   r   N)r3   r   r   r5   r   r
   <module>r6      sY    $ $      q q q q q q q q q qr   