
    rhf                     *    S r SSKJr   " S S\5      rg)a  
The SpatialProxy object allows for lazy-geometries and lazy-rasters. The proxy
uses Python descriptors for instantiating and setting Geometry or Raster
objects corresponding to geographic model fields.

Thanks to Robert Coup for providing this functionality (see #4322).
    )DeferredAttributec                   B   ^  \ rS rSrSU 4S jjrSU 4S jjrS rSrU =r$ )SpatialProxy   c                 P   > Xl         U=(       d    UU l        [        TU ]  U5        g)za
Initialize on the given Geometry or Raster class (not an instance)
and the corresponding field.
N)_klass
_load_funcsuper__init__)selfklassfield	load_func	__class__s       Z/var/www/html/shao/venv/lib/python3.13/site-packages/django/contrib/gis/db/models/proxy.pyr   SpatialProxy.__init__   s#    
 #,u    c                 P  > Uc  U $  UR                   U R                  R                     n[        X0R                  5      (       a  UnU$ Ub  US:X  a  SnU$ U R                  U5      n[        XR                  R                  U5        U$ ! [         a    [        TU ]  X5      n Nyf = f)z
Retrieve the geometry or raster, initializing it using the
corresponding class specified during initialization and the value of
the field. Currently, GEOS or OGR geometries as well as GDALRasters are
supported.
N )
__dict__r   attnameKeyErrorr
   __get__
isinstancer   r	   setattr)r   instancecls	geo_valuegeo_objr   s        r   r   SpatialProxy.__get__   s     K	7 ))$***<*<=I i--G  Y"_G  ooi0GHjj00':  	76I	7s   #B	 	B%$B%c           
         U R                   R                  nUS:X  a*  Ub&  [        U[        [        U R
                  45      (       a  O[        X R
                  5      (       a)  UR                  c  U R                   R                  Ul        OSUb  [        U[        [        45      (       a  O4[        SUR                  R                  < SU< S[        U5      < 35      eX!R                  U R                   R                  '   U$ )z
Retrieve the proxied geometry or raster with the corresponding class
specified during initialization.

To set geometries, use values of None, HEXEWKB, or WKT.
To set rasters, use JSON or dict values.
RASTERzCannot set z SpatialProxy (z) with value of type: )r   	geom_typer   strdictr   srid
memoryview	TypeErrorr   __name__typer   r   )r   r   valuegtypes       r   __set__SpatialProxy.__set__2   s     

$$HMZT4;;/GHH {{++ zz!!ZZ__
]jj0ABB%%..tE{D  16$**,,-r   )r   r	   )N)	r)   
__module____qualname____firstlineno__r   r   r-   __static_attributes____classcell__)r   s   @r   r   r      s     8" "r   r   N)__doc__django.db.models.query_utilsr   r    r   r   <module>r7      s    ;H$ Hr   