§
    Î“Ùht  ã                   ó~   — 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mZ ddlmZ  G d„ d	e
¦  «        Zd
S )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Úgeos_version_tuple)Únumpyc                   óT  — 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(d%S )'ÚGEOSCoordSeqzGThe internal representation of a list of coordinates inside a Geometry.Fc                 ój   — t          |t          ¦  «        st          d¦  «        ‚|| _        || _        dS )zInitialize from a GEOS pointer.z4Coordinate sequence should initialize with a CS_PTR.N)Ú
isinstancer   Ú	TypeErrorÚ_ptrÚ_z)ÚselfÚptrÚzs      ú_/var/www/surfInsights/venv3-11/lib/python3.11/site-packages/django/contrib/gis/geos/coordseq.pyÚ__init__zGEOSCoordSeq.__init__   s6   € å˜#�vÑ&Ô&ð 	TÝÐRÑSÔSÐSØˆŒ	ØˆŒˆˆó    c              #   óL   K  — t          | j        ¦  «        D ]}| |         V — ŒdS )z3Iterate over each point in the coordinate sequence.N)ÚrangeÚsize)r   Úis     r   Ú__iter__zGEOSCoordSeq.__iter__   s8   è è € å�t”yÑ!Ô!ð 	ð 	ˆAØ�q”'ˆMˆMˆMˆMð	ð 	r   c                 ó   — | j         S )z7Return the number of points in the coordinate sequence.)r   ©r   s    r   Ú__len__zGEOSCoordSeq.__len__    s
   € àŒ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                 óV   — |                       |¦  «         |                      |¦  «        S )z8Return the coordinate sequence value at the given index.)Ú_checkindexÚ_point_getter©r   Úindexs     r   Ú__getitem__zGEOSCoordSeq.__getitem__(   s*   € à×Ò˜ÑÔÐØ×!Ò! %Ñ(Ô(Ð(r   c                 ór  — t          |t          t          f¦  «        rn1t          rt          |t          j        ¦  «        rnt          d¦  «        ‚| j        dk    r| j        r
d}| j        }n	d}| j	        }t          |¦  «        |k    rt          d¦  «        ‚|                      |¦  «          |||¦  «         dS )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Ô7ð 	ØåØTñô ð ð Œ9˜Š>ˆ>˜dœgˆ>ØˆFØÔ-ˆLˆLàˆFØÔ-ˆLÝˆu‰:Œ:˜ÒÐÝÐ@ÑAÔAÐAØ×Ò˜ÑÔÐØˆ�U˜EÑ"Ô"Ð"Ð"Ð"r   c                 óR   — d|cxk    r| j         k     sn t          d|z  ¦  «        ‚dS )zCheck the given index.r   zinvalid GEOS Geometry index: %sN)r   Ú
IndexErrorr*   s     r   r(   zGEOSCoordSeq._checkindexE   s?   € à�UÐ&Ð&Ò&Ð&˜TœYÒ&Ð&Ð&Ð&ÝÐ>ÀÑFÑGÔGÐGð 'Ð&r   c                 óB   — |dk     s|dk    rt          d|z  ¦  «        ‚dS )zCheck the given dimension.r   r/   zinvalid ordinate dimension "%d"Nr	   )r   Údims     r   Ú	_checkdimzGEOSCoordSeq._checkdimJ   s.   € à�Š7ˆ7�c˜A’g�gÝÐ AÀCÑ GÑHÔHÐHð �gr   c                 ój   — t          j        | j        |t          t	          ¦   «         ¦  «        ¦  «        S ©N)ÚcapiÚcs_getxr   r   r   r*   s     r   Ú_get_xzGEOSCoordSeq._get_xO   ó$   € ÝŒ|˜DœH e­Uµ8±:´:Ñ->Ô->Ñ?Ô?Ð?r   c                 ój   — t          j        | j        |t          t	          ¦   «         ¦  «        ¦  «        S r@   )rA   Úcs_getyr   r   r   r*   s     r   Ú_get_yzGEOSCoordSeq._get_yR   rD   r   c                 ój   — t          j        | j        |t          t	          ¦   «         ¦  «        ¦  «        S r@   )rA   Úcs_getzr   r   r   r*   s     r   Ú_get_zzGEOSCoordSeq._get_zU   rD   r   c                 ó<   — t          j        | j        ||¦  «         d S r@   )rA   Úcs_setxr   ©r   r+   r6   s      r   Ú_set_xzGEOSCoordSeq._set_xX   ó   € ÝŒ�T”X˜u eÑ,Ô,Ð,Ð,Ð,r   c                 ó<   — t          j        | j        ||¦  «         d S r@   )rA   Úcs_setyr   rM   s      r   Ú_set_yzGEOSCoordSeq._set_y[   rO   r   c                 ó<   — t          j        | j        ||¦  «         d S r@   )rA   Úcs_setzr   rM   s      r   Ú_set_zzGEOSCoordSeq._set_z^   rO   r   c                 óB   — | j         dk    r| j        r| j        n| j        S )Nr.   )r2   r   Ú_get_point_3dÚ_get_point_2dr!   s    r   r)   zGEOSCoordSeq._point_gettera   s#   € à%)¤Y°!¢^ ^¸¼ ^ˆtÔ!Ð!ÀTÔEWÐWr   c                 óV   — |                       |¦  «        |                      |¦  «        fS r@   )rC   rG   r*   s     r   rX   zGEOSCoordSeq._get_point_2de   s%   € Ø—’˜EÑ"Ô" D§K¢K°Ñ$6Ô$6Ð7Ð7r   c                 ó~   — |                       |¦  «        |                      |¦  «        |                      |¦  «        fS r@   )rC   rG   rJ   r*   s     r   rW   zGEOSCoordSeq._get_point_3dh   s3   € Ø—’˜EÑ"Ô" D§K¢K°Ñ$6Ô$6¸¿ºÀEÑ8JÔ8JÐKÐKr   c                 óh   — |\  }}|                       ||¦  «         |                      ||¦  «         d S r@   )rN   rR   )r   r+   r6   ÚxÚys        r   r4   zGEOSCoordSeq._set_point_2dk   s9   € Ø‰ˆˆ1Ø�Š�E˜1ÑÔÐØ�Š�E˜1ÑÔÐÐÐr   c                 ó–   — |\  }}}|                       ||¦  «         |                      ||¦  «         |                      ||¦  «         d S r@   )rN   rR   rU   )r   r+   r6   r\   r]   r   s         r   r3   zGEOSCoordSeq._set_point_3dp   sO   € Ø‰ˆˆ1ˆaØ�Š�E˜1ÑÔÐØ�Š�E˜1ÑÔÐØ�Š�E˜1ÑÔÐÐÐr   c           	      óÀ   — |                       |¦  «         |                      |¦  «         t          j        | j        ||t          t          ¦   «         ¦  «        ¦  «        S )z3Return the value for the given dimension and index.)r(   r>   rA   Úcs_getordinater   r   r   )r   Ú	dimensionr+   s      r   ÚgetOrdinatezGEOSCoordSeq.getOrdinatew   sM   € à×Ò˜ÑÔÐØ�Š�yÑ!Ô!Ð!ÝÔ" 4¤8¨U°I½uÅXÁZÄZÑ?PÔ?PÑQÔQÐQr   c                 ó’   — |                       |¦  «         |                      |¦  «         t          j        | j        |||¦  «         dS )z0Set the value for the given dimension and index.N)r(   r>   rA   Úcs_setordinater   )r   ra   r+   r6   s       r   ÚsetOrdinatezGEOSCoordSeq.setOrdinate}   sG   € à×Ò˜ÑÔÐØ�Š�yÑ!Ô!Ð!ÝÔ˜DœH e¨Y¸Ñ>Ô>Ð>Ð>Ð>r   c                 ó.   — |                       d|¦  «        S )zGet the X value at the index.r   ©rb   r*   s     r   ÚgetXzGEOSCoordSeq.getXƒ   ó   € à×Ò  5Ñ)Ô)Ð)r   c                 ó4   — |                       d||¦  «         dS )z(Set X with the value at the given index.r   N©re   rM   s      r   ÚsetXzGEOSCoordSeq.setX‡   ó    € à×Ò˜˜E 5Ñ)Ô)Ð)Ð)Ð)r   c                 ó.   — |                       d|¦  «        S )z#Get the Y value at the given index.é   rg   r*   s     r   ÚgetYzGEOSCoordSeq.getY‹   ri   r   c                 ó4   — |                       d||¦  «         dS )z(Set Y with the value at the given index.ro   Nrk   rM   s      r   ÚsetYzGEOSCoordSeq.setY�   rm   r   c                 ó.   — |                       d|¦  «        S )z(Get Z with the value at the given index.r/   rg   r*   s     r   ÚgetZzGEOSCoordSeq.getZ“   ri   r   c                 ó4   — |                       d||¦  «         dS )z(Set Z with the value at the given index.r/   Nrk   rM   s      r   ÚsetZzGEOSCoordSeq.setZ—   rm   r   c                 óh   — t          j        | j        t          t	          ¦   «         ¦  «        ¦  «        S )z,Return the size of this coordinate sequence.)rA   Ú
cs_getsizer   r   r   r!   s    r   r   zGEOSCoordSeq.sizeœ   ó"   € õ Œ˜tœx­­v©x¬x©¬Ñ9Ô9Ð9r   c                 óh   — t          j        | j        t          t	          ¦   «         ¦  «        ¦  «        S )z2Return the dimensions of this coordinate sequence.)rA   Ú
cs_getdimsr   r   r   r!   s    r   r2   zGEOSCoordSeq.dims¡   ry   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ˆr   c                 óZ   — t          t          j        | j        ¦  «        | j        ¦  «        S )zClone this coordinate sequence.)r   rA   Úcs_cloner   r}   r!   s    r   ÚclonezGEOSCoordSeq.clone¯   s    € å�DœM¨$¬(Ñ3Ô3°T´YÑ?Ô?Ð?r   c           	      óÀ   ‡ ‡— ‰ j         rdŠndŠdd                     ˆ ˆfd„t          t          ‰ ¦  «        ¦  «        D ¦   «         ¦  «                             ¦   «         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  V — Œd S r@   © )Ú.0r   r   Úsubstrs     €€r   ú	<genexpr>z#GEOSCoordSeq.kml.<locals>.<genexpr>¾   s,   øè è € ÐAÐA¨1�f˜t AœwÑ&ÐAÐAÐAÐAÐAÐAr   )r}   Újoinr   r5   Ústrip)r   r†   s   `@r   ÚkmlzGEOSCoordSeq.kml³   sk   øø€ ð
 Œ9ð 	 Ø ˆFˆFàˆFà+Ø�gŠgÐAÐAÐAÐAÐAµµc¸$±i´iÑ0@Ô0@ÐAÑAÔAÑAÔA×GÒGÑIÔ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.ro   r   c              3   ó.   •K  — | ]} ‰|¦  «        V — Œd S r@   r„   )r…   r   Ú	get_points     €r   r‡   z%GEOSCoordSeq.tuple.<locals>.<genexpr>È   s+   øè è € Ð4Ð4 a�Y�Y˜q‘\”\Ð4Ð4Ð4Ð4Ð4Ð4r   )r   r)   r%   r   )r   Únr�   s     @r   r%   zGEOSCoordSeq.tupleÁ   sT   ø€ ð ŒIˆØÔ&ˆ	Ø�Š6ˆ6Ø�9˜Q‘<”<ÐÝÐ4Ð4Ð4Ð4­5°©8¬8Ð4Ñ4Ô4Ñ4Ô4Ð4r   c                 óÊ  — t          ¦   «         dk     rqd}t          | ¦  «        }t          |¦  «        D ]J}|dz   |z  }|| |         d         | |         d         z  z  }|| |         d         | |         d         z  z  }ŒK|dk    S t          ¦   «         }t	          j        | j        t          |¦  «        ¦  «        s!t          dt          j        j	        z  ¦  «        ‚|j
        dk    S )z<Return whether this coordinate sequence is counterclockwise.)r.   é   g        ro   r   z*Error encountered in GEOS C function "%s".)r   r5   r   r   rA   Ú	cs_is_ccwr   r   r
   Ú	func_namer6   )r   ÚarearŽ   r   ÚjÚrets         r   Úis_counterclockwisez GEOSCoordSeq.is_counterclockwiseÊ   så   € õ ÑÔ &Ò(Ð(ð ˆDÝ�D‘	”	ˆAÝ˜1‘X”Xð 0ð 0�Ø˜‘U˜a‘K�Ø˜˜Qœ œ
 T¨!¤W¨Q¤ZÑ/Ñ/�Ø˜˜Qœ œ
 T¨!¤W¨Q¤ZÑ/Ñ/��Ø˜#’:ÐÝ‰hŒhˆÝŒ~˜dœh­¨c©
¬
Ñ3Ô3ð 	ÝØ<½t¼~Ô?WÑWñô ð ð Œy˜AŠ~Ðr   N)F))Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   Úptr_typer   r   r"   r&   r,   r9   r(   r>   rC   rG   rJ   rN   rR   rU   Úpropertyr)   rX   rW   r4   r3   rb   re   rh   rl   rp   rr   rt   rv   r   r2   r}   r€   rŠ   r%   r–   r„   r   r   r   r      s‘  € € € € € ØMÐMà€Hðð ð ð ðð ð ð
ð ð ðð ð ð)ð )ð )ð
#ð #ð #ð0Hð Hð Hð
Ið Ið Ið
@ð @ð @ð@ð @ð @ð@ð @ð @ð-ð -ð -ð-ð -ð -ð-ð -ð -ð ðXð Xñ „XðXð8ð 8ð 8ðLð Lð Lðð ð ð
ð ð ðRð Rð Rð?ð ?ð ?ð*ð *ð *ð*ð *ð *ð*ð *ð *ð*ð *ð *ð*ð *ð *ð*ð *ð *ð
 ð:ð :ñ „Xð:ð ð:ð :ñ „Xð:ð ðð ñ „Xðð@ð @ð @ð ð
ð 
ñ „Xð
ð ð5ð 5ñ „Xð5ð ðð ñ „Xðð ð r   r   N)rš   Úctypesr   r   r   r   Údjango.contrib.gis.geosr   rA   Údjango.contrib.gis.geos.baser   Údjango.contrib.gis.geos.errorr
   Údjango.contrib.gis.geos.libgeosr   r   Údjango.contrib.gis.shortcutsr   r   r„   r   r   ú<module>r£      sÓ   ððð ð
 3Ð 2Ð 2Ð 2Ð 2Ð 2Ð 2Ð 2Ð 2Ð 2Ð 2Ð 2à 6Ð 6Ð 6Ð 6Ð 6Ð 6Ø 1Ð 1Ð 1Ð 1Ð 1Ð 1Ø 7Ð 7Ð 7Ð 7Ð 7Ð 7Ø FÐ FÐ FÐ FÐ FÐ FÐ FÐ FØ .Ð .Ð .Ð .Ð .Ð .ðMð Mð Mð Mð M�8ñ Mô Mð Mð Mð Mr   