
    h                     V    S SK Jr  S SKJr  S SKJr  S SKJr  S SK	J
r
   " S S\
5      rg)	    )c_uint)gdal)
prototypes)GEOSException)GEOSGeometryc                   r  ^  \ rS rSrSrSrSrSU 4S jjrU 4S jrU 4S jr	U 4S jr
\S	 5       r\S
 5       rS rS rS rS rS r\r\S 5       r\R,                  S 5       r\S 5       r\R,                  S 5       r\S 5       r\R,                  S 5       r\S 5       r\R,                  S 5       r\rSrU =r$ )Point	         Tc                 h  > Uc  / nO[        U[        [        45      (       a  UnOe[        U[        [        45      (       a?  [        U[        [        45      (       a$  [        U[        [        45      (       a  XU/nOX/nO[        S5      eU R                  [        U5      U5      n[        TU ]%  XdS9  g)z
The Point object may be initialized with either a tuple, or individual
parameters.

For example:
>>> p = Point((5, 23))  # 2D point, passed in as a tuple
>>> p = Point(5, 23, 8)  # 3D point, passed in with individual parameters
Nz2Invalid parameters given for Point initialization.)srid)

isinstancetuplelistfloatint	TypeError_create_pointlensuper__init__)selfxyzr   coordspoint	__class__s          O/var/www/html/env/lib/python3.13/site-packages/django/contrib/gis/geos/point.pyr   Point.__init__   s     9FE4=))FE3<((ZE3<-H-H!eS\**PQQ""3v;7 	*    c                 F   > U R                   (       a  S $ [        TU ]	  5       $ N)emptyr   _to_pickle_wkbr   r   s    r    r&   Point._to_pickle_wkb+   s    zzt?uw'='??r"   c                 H   > Uc  U R                  5       $ [        TU ]	  U5      $ r$   )_create_emptyr   _from_pickle_wkb)r   wkbr   s     r    r+   Point._from_pickle_wkb.   s&    '*{t!!#U8PQT8UUr"   c                    > U R                   (       a(  [        R                  R                  R	                  5       $ [
        TU ]  5       $ r$   )r%   r   
geometriesr	   r*   r   _ogr_ptrr'   s    r    r0   Point._ogr_ptr1   s4    59ZZDOO!!//1	
EJWEUEW	
r"   c                 &    U R                  S S 5      $ r$   )r   )clss    r    r*   Point._create_empty6   s      t,,r"   c                    U(       d  [         R                  " S5      $ US:  d  US:  a  [        SU-  5      e[         R                  " [	        S5      [	        U5      5      n[        U5      n[         R                  " US[        U5      5        [         R                  " US[        U5      5        US:X  a!  [         R                  " US[        U5      5        [         R                  " U5      $ )z?
Create a coordinate sequence, set X, Y, [Z], and create point
Nr   r   zInvalid point dimension: %s   r   )
capicreate_pointr   	create_csr   itercs_setxnextcs_setycs_setz)r3   ndimr   csis        r    r   Point._create_point:   s    
 $$T**!8tax9D@AA^^F1Ivd|4LRDG$RDG$19LLQQ(  $$r"   c                     U R                  X5      nU(       aL  U R                  n[        R                  " U R                  5        X0l        Ub  X@l        U R                  5         g [        S5      e)Nz3Geometry resulting from slice deletion was invalid.)r   r   r7   destroy_geomptr_ptr
_post_initr   )r   lengthitemsrE   r   s        r    	_set_listPoint._set_listN   sX      /99Ddhh'I 	OO   UVVr"   c                 >    U R                   R                  USU5        g )Nr   _cssetOrdinate)r   indexvalues      r    _set_singlePoint._set_single[   s    UAu-r"   c              #   N   #    [        [        U 5      5       H	  nX   v   M     g7f)z'Iterate over coordinates of this Point.N)ranger   )r   rA   s     r    __iter__Point.__iter__^   s     s4y!A'M "s   #%c                 L    U R                   (       a  gU R                  (       a  gg)zBReturn the number of dimensions for this Point (either 0, 2 or 3).r   r   r   )r%   haszr   s    r    __len__Point.__len__c   s    ::99r"   c                 p    US:X  a  U R                   $ US:X  a  U R                  $ US:X  a  U R                  $ g )Nr   r6   r   )r   r   r   )r   rP   s     r    _get_single_externalPoint._get_single_externall   s7    A:66MaZ66MaZ66M r"   c                 :    U R                   R                  SS5      $ )z$Return the X component of the Point.r   rN   getOrdinaterZ   s    r    r   Point.xv        xx##Aq))r"   c                 >    U R                   R                  SSU5        g)z!Set the X component of the Point.r   NrM   r   rQ   s     r    r   rc   {        	Q5)r"   c                 :    U R                   R                  SS5      $ )z$Return the Y component of the Point.r6   r   ra   rZ   s    r    r   Point.y   rd   r"   c                 >    U R                   R                  SSU5        g)z!Set the Y component of the Point.r6   r   NrM   rf   s     r    r   ri      rg   r"   c                 `    U R                   (       a  U R                  R                  SS5      $ S$ )z$Return the Z component of the Point.r   r   N)rY   rN   rb   rZ   s    r    r   Point.z   s&     .2YYtxx##Aq)@D@r"   c                 v    U R                   (       d  [        S5      eU R                  R                  SSU5        g)z!Set the Z component of the Point.zCannot set Z on 2D Point.r   r   N)rY   r   rN   rO   rf   s     r    r   rl      s-     yy ;<<Q5)r"   c                 .    U R                   R                  $ )zReturn a tuple of the point.)rN   r   rZ   s    r    r   Point.tuple   s     xx~~r"   c                      XR                   S'   g)z6Set the coordinates of the point with the given tuple.r   N)rN   )r   tups     r    r   ro      s     r"   )rF   r   )NNNN)__name__
__module____qualname____firstlineno__
_minlength
_maxlengthhas_csr   r&   r+   r0   classmethodr*   r   rJ   rR   rV   r[   r^   _get_single_internalpropertyr   setterr   r   r   r   __static_attributes____classcell__)r   s   @r    r	   r	   	   s)   JJF+:@V

 - - % %&W.
 0* * XX* * * * XX* * A A XX* *   \\ 
 Fr"   r	   N)ctypesr   django.contrib.gisr   django.contrib.gis.geosr   r7   django.contrib.gis.geos.errorr    django.contrib.gis.geos.geometryr   r	    r"   r    <module>r      s"     # 6 7 9YL Yr"   