Ë
    ¹ûàg¹  ã                   ór   — d Z ddlmZmZmZmZ ddlmZ ddl	m
Z
 ddlmZ ddlmZ ddlmZ  G d„ d	e
«      Zy
)z®
 This module houses the GEOSCoordSeq object, which is used internally
 by GEOSGeometry to house the actual coordinates of the Point,
 LineString, and LinearRing geometries.
é    )ÚbyrefÚc_byteÚc_doubleÚc_uint)Ú
prototypes)ÚGEOSBase©ÚGEOSException)ÚCS_PTR)Únumpyc                   ó(  — e Zd ZdZeZd%d„Zd„ Zd„ Zd„ Z	d„ Z
d„ Zd„ Zd	„ Zd
„ Zd„ Zd„ Zd„ Zd„ Zd„ Zed„ «       Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z d„ Z!ed„ «       Z"ed„ «       Z#ed„ «       Z$d „ Z%ed!„ «       Z&ed"„ «       Z'ed#„ «       Z(y$)&ÚGEOSCoordSeqzGThe internal representation of a list of coordinates inside a Geometry.c                 óV   — t        |t        «      st        d«      ‚|| _        || _        y)zInitialize from a GEOS pointer.z4Coordinate sequence should initialize with a CS_PTR.N)Ú
isinstancer   Ú	TypeErrorÚ_ptrÚ_z)ÚselfÚptrÚzs      ú^/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/django/contrib/gis/geos/coordseq.pyÚ__init__zGEOSCoordSeq.__init__   s&   € ä˜#œvÔ&ÜÐRÓSÐSØˆŒ	Øˆ�ó    c              #   óN   K  — t        | j                  «      D ]	  }| |   –— Œ y­w)z3Iterate over each point in the coordinate sequence.N)ÚrangeÚsize)r   Úis     r   Ú__iter__zGEOSCoordSeq.__iter__   s'   è ø€ ä�t—y‘yÓ!ò 	ˆAØ�q‘'‹Mñ	ùs   ‚#%c                 ó   — | j                   S )z7Return the number of points in the coordinate sequence.)r   ©r   s    r   Ú__len__zGEOSCoordSeq.__len__!   s   € à�y‰yÐr   c                 ó,   — t        | j                  «      S )z<Return the string representation of the coordinate sequence.)ÚstrÚtupler    s    r   Ú__str__zGEOSCoordSeq.__str__%   s   € ä�4—:‘:‹Ðr   c                 óF   — | j                  |«       | j                  |«      S )z8Return the coordinate sequence value at the given index.)Ú_checkindexÚ_point_getter©r   Úindexs     r   Ú__getitem__zGEOSCoordSeq.__getitem__)   s!   € à×Ñ˜ÔØ×!Ñ! %Ó(Ð(r   c                 ó`  — t        |t        t        f«      rn,t        rt        |t        j                  «      rnt        d«      ‚| j                  dk(  r| j                  rd}| j                  }nd}| j                  }t        |«      |k7  rt        d«      ‚| j                  |«        |||«       y)z5Set the coordinate sequence value at the given index.zBMust set coordinate with a sequence (list, tuple, or numpy array).é   é   z"Dimension of value does not match.N)r   Úlistr$   r   Úndarrayr   Údimsr   Ú_set_point_3dÚ_set_point_2dÚlenr'   )r   r*   ÚvalueÚn_argsÚpoint_setters        r   Ú__setitem__zGEOSCoordSeq.__setitem__.   s›   € ô �eœd¤E˜]Ô+ØÝ”z %¬¯©Ô7ØäØTóð ð �9‰9˜Š>˜dŸgšgØˆFØ×-Ñ-‰LàˆFØ×-Ñ-ˆLÜˆu‹:˜ÒÜÐ@ÓAÐAØ×Ñ˜ÔÙ�U˜EÕ"r   c                 óN   — d|cxk  r| j                   k  sn t        d|z  «      ‚y)zCheck the given index.r   zinvalid GEOS Geometry index: %sN)r   Ú
IndexErrorr)   s     r   r'   zGEOSCoordSeq._checkindexF   s)   € à�UÔ&˜TŸY™YÔ&ÜÐ>ÀÑFÓGÐGð 'r   c                 ó4   — |dk  s|dkD  rt        d|z  «      ‚y)zCheck the given dimension.r   r.   zinvalid ordinate dimension "%d"Nr	   )r   Údims     r   Ú	_checkdimzGEOSCoordSeq._checkdimK   s%   € à�Š7�c˜A’gÜÐ AÀCÑ GÓHÐHð r   c                 óf   — t        j                  | j                  |t        t	        «       «      «      S ©N)ÚcapiÚcs_getxr   r   r   r)   s     r   Ú_get_xzGEOSCoordSeq._get_xP   ó    € Ü�|‰|˜DŸH™H e¬U´8³:Ó->Ó?Ð?r   c                 óf   — t        j                  | j                  |t        t	        «       «      «      S r?   )r@   Úcs_getyr   r   r   r)   s     r   Ú_get_yzGEOSCoordSeq._get_yS   rC   r   c                 óf   — t        j                  | j                  |t        t	        «       «      «      S r?   )r@   Úcs_getzr   r   r   r)   s     r   Ú_get_zzGEOSCoordSeq._get_zV   rC   r   c                 óF   — t        j                  | j                  ||«       y r?   )r@   Úcs_setxr   ©r   r*   r5   s      r   Ú_set_xzGEOSCoordSeq._set_xY   ó   € Ü�‰�T—X‘X˜u eÕ,r   c                 óF   — t        j                  | j                  ||«       y r?   )r@   Úcs_setyr   rL   s      r   Ú_set_yzGEOSCoordSeq._set_y\   rN   r   c                 óF   — t        j                  | j                  ||«       y r?   )r@   Úcs_setzr   rL   s      r   Ú_set_zzGEOSCoordSeq._set_z_   rN   r   c                 óh   — | j                   dk(  r| j                  r| j                  S | j                  S )Nr-   )r1   r   Ú_get_point_3dÚ_get_point_2dr    s    r   r(   zGEOSCoordSeq._point_getterb   s)   € à%)§Y¡Y°!¢^¸¿ºˆt×!Ñ!ÐWÀT×EWÑEWÐWr   c                 óF   — | j                  |«      | j                  |«      fS r?   )rB   rF   r)   s     r   rW   zGEOSCoordSeq._get_point_2df   s   € Ø—‘˜EÓ" D§K¡K°Ó$6Ð7Ð7r   c                 óf   — | j                  |«      | j                  |«      | j                  |«      fS r?   )rB   rF   rI   r)   s     r   rV   zGEOSCoordSeq._get_point_3di   s*   € Ø—‘˜EÓ" D§K¡K°Ó$6¸¿¹ÀEÓ8JÐKÐKr   c                 óV   — |\  }}| j                  ||«       | j                  ||«       y r?   )rM   rQ   )r   r*   r5   ÚxÚys        r   r3   zGEOSCoordSeq._set_point_2dl   s'   € Ø‰ˆˆ1Ø�‰�E˜1ÔØ�‰�E˜1Õr   c                 ó|   — |\  }}}| j                  ||«       | j                  ||«       | j                  ||«       y r?   )rM   rQ   rT   )r   r*   r5   r[   r\   r   s         r   r2   zGEOSCoordSeq._set_point_3dq   s7   € Ø‰ˆˆ1ˆaØ�‰�E˜1ÔØ�‰�E˜1ÔØ�‰�E˜1Õr   c           	      ó¬   — | j                  |«       | j                  |«       t        j                  | j                  ||t        t        «       «      «      S )z3Return the value for the given dimension and index.)r'   r=   r@   Úcs_getordinater   r   r   )r   Ú	dimensionr*   s      r   ÚgetOrdinatezGEOSCoordSeq.getOrdinatex   s>   € à×Ñ˜ÔØ�‰�yÔ!Ü×"Ñ" 4§8¡8¨U°I¼uÄXÃZÓ?PÓQÐQr   c                 óŒ   — | j                  |«       | j                  |«       t        j                  | j                  |||«       y)z0Set the value for the given dimension and index.N)r'   r=   r@   Úcs_setordinater   )r   r`   r*   r5   s       r   ÚsetOrdinatezGEOSCoordSeq.setOrdinate~   s4   € à×Ñ˜ÔØ�‰�yÔ!Ü×Ñ˜DŸH™H e¨Y¸Õ>r   c                 ó&   — | j                  d|«      S )zGet the X value at the index.r   ©ra   r)   s     r   ÚgetXzGEOSCoordSeq.getX„   ó   € à×Ñ  5Ó)Ð)r   c                 ó*   — | j                  d||«       y)z(Set X with the value at the given index.r   N©rd   rL   s      r   ÚsetXzGEOSCoordSeq.setXˆ   ó   € à×Ñ˜˜E 5Õ)r   c                 ó&   — | j                  d|«      S )z#Get the Y value at the given index.é   rf   r)   s     r   ÚgetYzGEOSCoordSeq.getYŒ   rh   r   c                 ó*   — | j                  d||«       y)z(Set Y with the value at the given index.rn   Nrj   rL   s      r   ÚsetYzGEOSCoordSeq.setY�   rl   r   c                 ó&   — | j                  d|«      S )z(Get Z with the value at the given index.r.   rf   r)   s     r   ÚgetZzGEOSCoordSeq.getZ”   rh   r   c                 ó*   — | j                  d||«       y)z(Set Z with the value at the given index.r.   Nrj   rL   s      r   ÚsetZzGEOSCoordSeq.setZ˜   rl   r   c                 ód   — t        j                  | j                  t        t	        «       «      «      S )z,Return the size of this coordinate sequence.)r@   Ú
cs_getsizer   r   r   r    s    r   r   zGEOSCoordSeq.size�   ó   € ô �‰˜tŸx™x¬¬v«x«Ó9Ð9r   c                 ód   — t        j                  | j                  t        t	        «       «      «      S )z2Return the dimensions of this coordinate sequence.)r@   Ú
cs_getdimsr   r   r   r    s    r   r1   zGEOSCoordSeq.dims¢   rx   r   c                 ó   — | j                   S )zƒ
        Return whether this coordinate sequence is 3D. This property value is
        inherited from the parent Geometry.
        )r   r    s    r   ÚhaszzGEOSCoordSeq.hasz§   s   € ð �w‰wˆr   c                 óh   — t        t        j                  | j                  «      | j                  «      S )zClone this coordinate sequence.)r   r@   Úcs_cloner   r|   r    s    r   ÚclonezGEOSCoordSeq.clone°   s    € äœDŸM™M¨$¯(©(Ó3°T·Y±YÓ?Ð?r   c           	      ó¤   ‡ ‡— ‰ j                   rdŠndŠddj                  ˆ ˆfd„t        t        ‰ «      «      D «       «      j	                  «       z  S )z2Return the KML representation for the coordinates.z	%s,%s,%s z%s,%s,0 z<coordinates>%s</coordinates>Ú c              3   ó.   •K  — | ]  }‰‰|   z  –— Œ y ­wr?   © )Ú.0r   r   Úsubstrs     €€r   ú	<genexpr>z#GEOSCoordSeq.kml.<locals>.<genexpr>¿   s   øè ø€ ÒA¨1�f˜t A™wÕ&ÑAùó   ƒ)r|   Újoinr   r4   Ústrip)r   r…   s   `@r   ÚkmlzGEOSCoordSeq.kml´   sH   ù€ ð
 �9Š9Ø ‰FàˆFà+Ø�g‰gÔA´´c¸$³iÓ0@ÔAÓA×GÑGÓIñJð	
r   c                 óˆ   ‡— | j                   }| j                  Š|dk(  r ‰d«      S t        ˆfd„t        |«      D «       «      S )z3Return a tuple version of this coordinate sequence.rn   r   c              3   ó.   •K  — | ]  } ‰|«      –— Œ y ­wr?   rƒ   )r„   r   Ú	get_points     €r   r†   z%GEOSCoordSeq.tuple.<locals>.<genexpr>É   s   øè ø€ Ò4 a‘Y˜q—\Ñ4ùr‡   )r   r(   r$   r   )r   Únr�   s     @r   r$   zGEOSCoordSeq.tupleÂ   s?   ø€ ð �I‰IˆØ×&Ñ&ˆ	Ø�Š6Ù˜Q“<ÐÜÓ4¬5°«8Ô4Ó4Ð4r   c                 óÒ   — t        «       }t        j                  | j                  t	        |«      «      s&t        dt        j                  j                  z  «      ‚|j                  dk(  S )z<Return whether this coordinate sequence is counterclockwise.z*Error encountered in GEOS C function "%s".rn   )r   r@   Ú	cs_is_ccwr   r   r
   Ú	func_namer5   )r   Úrets     r   Úis_counterclockwisez GEOSCoordSeq.is_counterclockwiseË   sP   € ô ‹hˆÜ�~‰~˜dŸh™h¬¨c«
Ô3ÜØ<¼t¿~¹~×?WÑ?WÑWóð ð �y‰y˜A‰~Ðr   N)F))Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   Úptr_typer   r   r!   r%   r+   r8   r'   r=   rB   rF   rI   rM   rQ   rT   Úpropertyr(   rW   rV   r3   r2   ra   rd   rg   rk   ro   rq   rs   ru   r   r1   r|   r   rŠ   r$   r“   rƒ   r   r   r   r      s'  „ ÙMà€Hóòò
òò)ò
#ò0Hò
Iò
@ò@ò@ò-ò-ò-ð ñXó ðXò8òLòò
òRò?ò*ò*ò*ò*ò*ò*ð
 ñ:ó ð:ð ñ:ó ð:ð ñó ðò@ð ñ
ó ð
ð ñ5ó ð5ð ñó ñr   r   N)r—   Úctypesr   r   r   r   Údjango.contrib.gis.geosr   r@   Údjango.contrib.gis.geos.baser   Údjango.contrib.gis.geos.errorr
   Údjango.contrib.gis.geos.libgeosr   Údjango.contrib.gis.shortcutsr   r   rƒ   r   r   ú<module>r       s/   ðñ÷ 3Ó 2å 6Ý 1Ý 7Ý 2Ý .ôC�8õ Cr   