
    _ h                     (    d Z ddlmZ  G d d      Zy)zCoordinate sequence utilities.    )arrayc                   @    e Zd ZdZd Zd Zd Zd Zd	dZe	d        Z
y)
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                     || _         y)zInitialize the CoordinateSequence.

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

        N)_coords)selfcoordss     j/home/developers/rajanand/mypropertyqr-fmb-refixing-v2/venv/lib/python3.12/site-packages/shapely/coords.py__init__zCoordinateSequence.__init__   s         c                 4    | 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        | j                               D ]*  }t        | j                  |   j	                                , yw)z$Iterate over the CoordinateSequence.N)ranger   tupler   tolist)r   is     r
   __iter__zCoordinateSequence.__iter__+   s<     t||~& 	2AQ..011	2s   AA
c                    | j                         }t        |t              rK||z   dk  s||k\  rt        d      |dk  r||z   }n|}t	        | j
                  |   j                               S t        |t              r`g }|j                  |      \  }}}t        |||      D ]7  }|j                  t	        | j
                  |   j                                      9 |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     LLNc3Qw{cQh !566QwGa//122U#C"%++a.E45$/ <

5a!7!7!9:;<J;<<r   Nc                 t    |du rt        d      |du r| j                  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   s;    , 5=VWWT\<<$$&&<<r   c                     | j                         }t        d      }t        d      }t        |      D ]G  }| j                  |   j	                         }|j                  |d          |j                  |d          I ||fS )zX and Y arrays.dr      )r   r   r   r   r   r   )r   r   xyr   xys         r
   r/   zCoordinateSequence.xym   ss     LLN#J#Jq 	Aa'')BHHRUOHHRUO	 !tr   )NN)__name__
__module____qualname____doc__r   r   r   r$   r)   propertyr/    r   r
   r   r      s5    		%2
=@ : 	 	r   r   N)r3   r   r   r5   r   r
   <module>r6      s    $ q qr   