
    _?i]Q                        d dl mZ d dlmZmZ d dl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mZmZmZmZmZmZmZmZ d d	lmZ d d
lmZ eeefZ  G d d      Z! G d de!e      Z" G d de"      Z# G d d      Z$ G d d      Z% G d de%e"      Z& G d de"      Z' G d de"      Z( G d de"      Z) G d de"      Z* G d d e"      Z+ G d! d"e"      Z, G d# d$e"      Z- G d% d&e%e#      Z. G d' d(e%e#      Z/ G d) d*e#      Z0 G d+ d,e%e#      Z1 G d- d.      Z2 G d/ d0e2e%e"      Z3 G d1 d2e#      Z4 G d3 d4e#      Z5 G d5 d6e"      Z6 G d7 d8e6      Z7 G d9 d:e"      Z8 G d; d<e"      Z9 G d= d>e%e#      Z:ejv                   G d? d@e!e             Z<ejv                   G dA dBe!e             Z=ejv                   G dC dDe%e!e             Z> G dE dFe2e%e"      Z? G dG dHe"      Z@ G dI dJe#      ZA G dK dLe"      ZB G dM dNe"      ZC G dO dPe"      ZD G dQ dRe2e%e"      ZE G dS dTe%e#      ZF G dU dVe"      ZG G dW dXe#      ZH G dY dZe$e#      ZI G d[ d\e$e#      ZJ G d] d^e%e#      ZK G d_ d`e#      Z G da dbeI      ZL G dc dde%e#      ZMye)f    )Decimal)BaseSpatialFieldGeometryField)	AreaFieldDistanceField)GEOSGeometry)Point)
FieldError)NotSupportedError)	BinaryFieldBooleanField	CharField
FloatFieldFuncIntegerField	TextField	TransformValue)Cast)cached_propertyc                   d     e Zd ZdZdZ fdZed        Zed        Z	d	 fd	Z
 fdZd
dZ xZS )GeoFuncMixinNr   c                    t        |   |i | | j                  D ]  }| j                  |   }t	        |t
              s#	 |j                  }|j                  }t	        |t              r|r-t	        |t              st        d| j                  |dz   fz        |j                  s|st        d      |rt        |t        |j                              | j                  |<    y # t        $ r d }Y w xY w)Nz9%s function requires a geometric argument in position %d.   z$SRID is required for all geometries.sridoutput_field)super__init__geom_param_possource_expressions
isinstancer   r   r
   valuer   r   	TypeErrornamer   
ValueError)selfexpressionsextraposexprr   geom	__class__s          x/home/cursorai/projects/django-cronjob-utils/venv/lib/python3.12/site-packages/django/contrib/gis/db/models/functions.pyr!   zGeoFuncMixin.__init__   s    +// &&C**3/DdE*$#00 ::Dt\2"<?Oyy#'*+  99\ !GHH/4}$))'D0'',+ '  $#$s   C%%C32C3c                 .    | j                   j                  S N)r/   __name__r)   s    r0   r'   zGeoFuncMixin.name;   s    ~~&&&    c                 N    | j                   | j                  d      j                  S Nr   )r#   r"   fieldr4   s    r0   	geo_fieldzGeoFuncMixin.geo_field?   s$    &&t':':1'=>DDDr5   c                     | j                   '|%|j                  j                  | j                        }t	        |   ||fd|i|S )Nfunction)r;   opsspatial_function_namer'   r    as_sql)r)   compiler
connectionr;   extra_contextr/   s        r0   r>   zGeoFuncMixin.as_sqlC   sE    == X%5!~~;;DIIFHw~h
WXWWWr5   c           
         t        
|   |i |}| j                  s|S |j                         }| j                  D ]K  }||   }t	        |t
              rt        | j                  d|dz   dt        |      j                  d       |j                  j                  }| j                  dd  D ]V  }|j                  |   }|j                  j                  }	|	|k7  s. t        ||      j                  |i ||j                  |<   X |S )Nz/ function requires a GeometryField in position r   z, got .)r    resolve_expressionr"   get_source_fieldsr$   r   r&   r'   typer3   r9   r   r#   r   r   )r)   argskwargsressource_fieldsr,   r8   	base_sridr-   	expr_sridr/   s             r0   rD   zGeoFuncMixin.resolve_expressionH   s   g($9&9""J --/&&C!#&Ee]3 		aU,,	  ' MM&&	&&qr*C))#.D))..II%/%i)/$$d/6.4/6&&s+ + 
r5   c                 ^    t        |d      s |rt        ||      st        d|d|d      |S )NrD   zThe z) parameter has the wrong type: should be rC   )hasattrr$   r&   )r)   r%   
param_namecheck_typess       r0   _handle_paramzGeoFuncMixin._handle_paramf   s7    u23:e[#A!;0  r5   r2    N)r3   
__module____qualname__r;   r"   r!   propertyr'   r   r9   r>   rD   rQ   __classcell__r/   s   @r0   r   r      sL    HN: ' ' E EX
<r5   r   c                       e Zd Zy)GeoFuncNr3   rT   rU    r5   r0   rZ   rZ   p       r5   rZ   c                       e Zd Zed        Zy)GeomOutputGeoFuncc                 B    t        | j                  j                        S )Nr   )r   r9   r   r4   s    r0   r   zGeomOutputGeoFunc.output_fieldu   s    $.."5"566r5   N)r3   rT   rU   r   r   r\   r5   r0   r_   r_   t   s    7 7r5   r_   c                       e Zd ZdZd Zy)SQLiteDecimalToFloatMixinz
    By default, Decimal values are converted to str by the SQLite backend,
    which is not acceptable by the GIS functions expecting numeric values.
    c           
      6   | j                         }|j                  |j                         D cg c]H  }t        |d      r8t	        |j
                  t              rt        t        |j
                              n|J c}        |j                  ||fi |S c c}w )Nr%   )
copyset_source_expressionsget_source_expressionsrN   r$   r%   r   r   floatr>   )r)   r?   r@   rA   rd   r-   s         r0   	as_sqlitez#SQLiteDecimalToFloatMixin.as_sqlite   s    yy{## !779 :D tW-*TZZ2Q %

+, :		
 t{{8ZA=AAs   ABN)r3   rT   rU   __doc__rh   r\   r5   r0   rb   rb   z   s    
Br5   rb   c                       e Zd ZdZd Zy)OracleToleranceMixing?c                    t        | j                  | j                  j                  d| j                        dt
                    }| j                         }|j                  g | j                         |        |j                  ||fi |S )N	tolerance)
r   rQ   r+   getrm   NUMERIC_TYPESrd   re   rf   r>   )r)   r?   r@   rA   rm   clones         r0   	as_oraclezOracleToleranceMixin.as_oracle   s}    

{DNN;
	 		$$%Pt'B'B'D%Pi%PQu||HjBMBBr5   N)r3   rT   rU   rm   rq   r\   r5   r0   rk   rk      s    I
Cr5   rk   c                   8     e Zd ZdZed        Z fdZd Z xZS )Arear   c                 ,    t        | j                        S r2   )r   r9   r4   s    r0   r   zArea.output_field   s    ((r5   c                     |j                   j                  s&| j                  j                  |      rt	        d      t        |   ||fi |S )Nz2Area on geodetic coordinate systems not supported.)featuressupports_area_geodeticr9   geodeticr   r    r>   r)   r?   r@   rA   r/   s       r0   r>   zArea.as_sql   sP    ""99dnn>U>U?
 $D  w~h
DmDDr5   c                 t    | j                   j                  |      r
d|d<   d|d<    | j                  ||fi |S )Nz+%(function)s(%(expressions)s, %(spheroid)d)templateTspheroid)r9   rx   r>   )r)   r?   r@   rA   s       r0   rh   zArea.as_sqlite   s@    >>"":.(UM*%(,M*%t{{8ZA=AAr5   )	r3   rT   rU   arityr   r   r>   rh   rW   rX   s   @r0   rs   rs      s&    E) )EBr5   rs   c                   "    e Zd Z e       ZdZdZy)Azimuth   r   r   Nr3   rT   rU   r   r   r}   r"   r\   r5   r0   r   r          <LENr5   r   c                   8     e Zd Z e       Zd fd	Z fdZ xZS )	AsGeoJSONc                     |g}|&|j                  | j                  |dt                     d}|r|rd}n	|rd}n|rd}|j                  |       t        |   |i | y )N	precisionr      r   r   appendrQ   intr    r!   )	r)   
expressionbboxcrsr   r+   r*   optionsr/   s	           r0   r!   zAsGeoJSON.__init__   sl    !l t11)[#NO4GGG7#+//r5   c                     | j                         }| j                         }|j                  |d d        t        t        |  ||fi |S Nr   )rf   rd   re   r    r   r>   r)   r?   r@   rA   r#   rp   r/   s         r0   rq   zAsGeoJSON.as_oracle   sL    !88:		$$%7%;<Y-h
TmTTr5   )FF   )r3   rT   rU   r   r   r!   rq   rW   rX   s   @r0   r   r      s    ;L0U Ur5   r   c                   <     e Zd ZdZ e       Zd fd	Z fdZ xZS )AsGML)r   c                 |    ||g}|&|j                  | j                  |dt                     t        |   |i | y Nr   r   )r)   r   versionr   r+   r*   r/   s         r0   r!   zAsGML.__init__   sB    
+ t11)[#NO+//r5   c                     | j                         }|d   }| j                         }|j                  |d   g       |j                  dk(  rdnd|d<   t	        t
        |  ||fi |S )Nr   r   r   zSDO_UTIL.TO_GML311GEOMETRYzSDO_UTIL.TO_GMLGEOMETRYr;   )rf   rd   re   r%   r    r   r>   )r)   r?   r@   rA   r#   r   rp   r/   s          r0   rq   zAsGML.as_oracle   sy    !88:$Q'		$$&8&;%<= }}! )* 	j!
 UE)(JP-PPr5   )r   r   )	r3   rT   rU   r"   r   r   r!   rq   rW   rX   s   @r0   r   r      s     N;L0
Q 
Qr5   r   c                   .     e Zd Z e       Zd fd	Z xZS )AsKMLc                 z    |g}|&|j                  | j                  |dt                     t        |   |i | y r   r   r)   r   r   r+   r*   r/   s        r0   r!   zAsKML.__init__   ?    !l t11)[#NO+//r5   )r   r3   rT   rU   r   r   r!   rW   rX   s   @r0   r   r      s    ;L0 0r5   r   c                   .     e Zd Z e       Zd fd	Z xZS )AsSVGc                     t        |d      r|n
t        |      }||| j                  |dt              g}t        |   |i | y )NrD   r   )rN   r   rQ   r    r!   )r)   r   relativer   r+   r*   r/   s         r0   r!   zAsSVG.__init__   sP    *>?HS] 	 y+s;

 	+//r5   )Fr   r   rX   s   @r0   r   r      s    ;L	0 	0r5   r   c                       e Zd Z e       ZdZy)AsWKBr   N)r3   rT   rU   r   r   r}   r\   r5   r0   r   r     s    =LEr5   r   c                       e Zd Z e       ZdZy)AsWKTr   N)r3   rT   rU   r   r   r}   r\   r5   r0   r   r   	  s    ;LEr5   r   c                   4     e Zd Zd fd	Z fdZ fdZ xZS )BoundingCirclec                 (    t        |   ||fi | y r2   )r    r!   )r)   r   num_segr+   r/   s       r0   r!   zBoundingCircle.__init__  s    W66r5   c                     | j                         }|j                  | j                         d   g       t        t        |  ||fi |S r7   )rd   re   rf   r    r   rq   r)   r?   r@   rA   rp   r/   s        r0   rq   zBoundingCircle.as_oracle  N    		$$d&A&A&CA&F%GH^U5j
$1
 	
r5   c                     | j                         }|j                  | j                         d   g       t        t        |  ||fi |S r7   )rd   re   rf   r    r   rh   r   s        r0   rh   zBoundingCircle.as_sqlite  r   r5   )0   )r3   rT   rU   r!   rq   rh   rW   rX   s   @r0   r   r     s    7

 
r5   r   c                       e Zd ZdZy)Centroidr   Nr3   rT   rU   r}   r\   r5   r0   r   r   !      Er5   r   c                       e Zd ZdZdZy)ClosestPointr   r   Nr3   rT   rU   r}   r"   r\   r5   r0   r   r   %      ENr5   r   c                       e Zd ZdZdZy)
Differencer   r   Nr   r\   r5   r0   r   r   *  r   r5   r   c                   "    e Zd Zed        Zd Zy)DistanceResultMixinc                 ,    t        | j                        S r2   )r   r9   r4   s    r0   r   z DistanceResultMixin.output_field0  s    T^^,,r5   c                 d    | j                   j                  xr | j                   j                  dk(  S )Ni  )r9   	geographyr   r4   s    r0   source_is_geographyz'DistanceResultMixin.source_is_geography4  s&    ~~''GDNN,?,?4,GGr5   N)r3   rT   rU   r   r   r   r\   r5   r0   r   r   /  s    - -Hr5   r   c                   <     e Zd ZdZdZd fd	Z fdZ fdZ xZS )Distancer   Nc                 h    ||g}|| j                  |dt              | _        t        |   |i | y )Nr|   )rQ   boolr|   r    r!   )r)   expr1expr2r|   r+   r*   r/   s         r0   r!   zDistance.__init__<  s:    en ..xTJDM+//r5   c                    | j                         }d }|j                  d   }| j                         }|j                  j                  |k7  rZt        |t              r||j                  _        n8t        |t        |j                  j                  |            |j                  d<   |s| j                  j                  |      r| j                  rY|j                  j                  d      }|j                  j                  t        | j                  j                  |                   n|j                  j                  d      }t!        t"        |J  ||fd|i|S )Nr   )r   r   DistanceSpheroidDistanceSpherer;   )rd   r#   r   r   r   r$   r   r   r   r   r9   rx   r|   r<   r=   r   r    r   r>   )	r)   r?   r@   rA   rp   r;   r   r   r/   s	           r0   as_postgresqlzDistance.as_postgresqlB  s,   		((+,,.	''94%'/8"",.2!u'9'9'>'>)T/((+
 T^^44Z@ }} &>>??@RS((//$..11*=> &>>??@PQXu,j
+3
7D
 	
r5   c                     | j                   j                  |      r&d|d<   t        t        | j                              |d<   t        |   ||fi |S )Nz8COALESCE(%(function)s(%(expressions)s, %(spheroid)s), 0)r{   r|   )r9   rx   r   r   r|   r    r>   ry   s       r0   rh   zDistance.as_sqlitea  sU    >>"":. K *% ),D,?(@M*%w~h
DmDDr5   r2   )	r3   rT   rU   r"   r|   r!   r   rh   rW   rX   s   @r0   r   r   8  s#    NH0
>E Er5   r   c                       e Zd ZdZy)Enveloper   Nr   r\   r5   r0   r   r   k  r   r5   r   c                       e Zd ZdZy)ForcePolygonCWr   Nr   r\   r5   r0   r   r   o  r   r5   r   c                   2     e Zd ZdZdZd fd	Z fdZ xZS )FromWKBr   r\   c                 |    || j                  |dt              g}d|vrt        |      |d<   t        |   |i | y Nr   r   r   rQ   r   r   r    r!   r)   r   r   r+   r*   r/   s        r0   r!   zFromWKB.__init__w  J    tVS1
 &$1t$<E.!+//r5   c                     | j                         }| j                         }|j                  |d d        t        t        |  ||fi |S r   )rf   rd   re   r    r   r>   r   s         r0   rq   zFromWKB.as_oracle  sL    !88:		$$%7%;<We+HjRMRRr5   r   )r3   rT   rU   r}   r"   r!   rq   rW   rX   s   @r0   r   r   s  s    EN0S Sr5   r   c                       e Zd Zy)FromWKTNr[   r\   r5   r0   r   r     r]   r5   r   c                   4     e Zd Z e       Zd fd	Zd Z xZS )GeoHashc                 z    |g}|&|j                  | j                  |dt                     t        |   |i | y r   r   r   s        r0   r!   zGeoHash.__init__  r   r5   c                     | j                         }t        |j                        dk  r$|j                  j                  t	        d              |j
                  ||fi |S )Nr   d   )rd   lenr#   r   r   r>   )r)   r?   r@   rA   rp   s        r0   as_mysqlzGeoHash.as_mysql  sP    		u''(1,$$++E#J7u||HjBMBBr5   r2   )r3   rT   rU   r   r   r!   r   rW   rX   s   @r0   r   r     s    ;L0Cr5   r   c                   *    e Zd Z e       ZdZdZdZdZy)GeometryDistancer   rS   z <-> r   N)	r3   rT   rU   r   r   r}   r;   
arg_joinerr"   r\   r5   r0   r   r     s    <LEHJNr5   r   c                       e Zd ZdZdZy)Intersectionr   r   Nr   r\   r5   r0   r   r     r   r5   r   c                   $    e Zd Z e       ZdZd Zy)GeometryType	geom_typec                 R    |j                  | j                        \  }}d| d}||fS )Nz&(SELECT DECODE(SDO_GEOMETRY.GET_GTYPE(z),1, 'POINT',2, 'LINESTRING',3, 'POLYGON',4, 'COLLECTION',5, 'MULTIPOINT',6, 'MULTILINESTRING',7, 'MULTIPOLYGON',8, 'SOLID','UNKNOWN')))compilelhs)r)   r?   r@   rA   r   paramssqls          r0   rq   zGeometryType.as_oracle  s?    &&txx0V&&)U 	+
 	 F{r5   N)r3   rT   rU   r   r   lookup_namerq   r\   r5   r0   r   r     s    ;LKr5   r   c                       e Zd ZdZ e       Zy)IsEmptyisemptyN)r3   rT   rU   r   r   r   r\   r5   r0   r   r     s    K>Lr5   r   c                   0     e Zd ZdZ e       Z fdZ xZS )IsValidisvalidc                 :    t        |   ||fi |\  }}d|z  |fS )Nz%CASE %s WHEN 'TRUE' THEN 1 ELSE 0 END)r    rq   )r)   r?   r@   rA   r   r   r/   s         r0   rq   zIsValid.as_oracle  s-    g'*NNV6<fDDr5   )r3   rT   rU   r   r   r   rq   rW   rX   s   @r0   r   r     s    K>LE Er5   r   c                   >     e Zd Zd fd	Z fdZ fdZ fdZ xZS )Lengthc                 4    || _         t        |   |fi | y r2   )r|   r    r!   )r)   r   r|   r+   r/   s       r0   r!   zLength.__init__  s     (%(r5   c                     | j                   j                  |      r!|j                  j                  st	        d      t        |   ||fi |S )Nz6This backend doesn't support Length on geodetic fields)r9   rx   rv   supports_length_geodeticr   r    r>   ry   s       r0   r>   zLength.as_sql  sL    NN##J/''@@#H  w~h
DmDDr5   c                 2   | j                         }d }| j                         r/|j                  j                  t	        | j
                               n| j                  j                  |      rY|j                  j                  d      }|j                  j                  t	        | j                  j                  |                   n;t        d | j                         D              }|dkD  r|j                  j                  }t        t        |>  ||fd|i|S )NLengthSpheroidc              3   :   K   | ]  }|s|j                     y wr2   dim.0fs     r0   	<genexpr>z'Length.as_postgresql.<locals>.<genexpr>  s     C%=aee%=s   r   r;   )rd   r   r#   r   r   r|   r9   rx   r<   r=   minrE   length3dr    r   r>   )r)   r?   r@   rA   rp   r;   r   r/   s          r0   r   zLength.as_postgresql  s    		##%$$++E$--,@A^^$$Z0 "~~;;<LMH$$++E$..2I2I*2U,VWCT%;%;%=CCCQw%>>22VU*j
+3
7D
 	
r5   c                     d }| j                   j                  |      r| j                  rdnd}t        |   ||fd|i|S )NGeodesicLengthGreatCircleLengthr;   )r9   rx   r|   r    r>   )r)   r?   r@   rA   r;   r/   s        r0   rh   zLength.as_sqlite  sD    >>"":.+/=='>QHw~h
WXWWWr5   )T)r3   rT   rU   r!   r>   r   rh   rW   rX   s   @r0   r   r     s    )E
$X Xr5   r   c                   "    e Zd Z e       ZdZdZy)LineLocatePointr   r   Nr   r\   r5   r0   r
  r
    r   r5   r
  c                       e Zd Zy)	MakeValidNr[   r\   r5   r0   r  r    r]   r5   r  c                       e Zd Z e       ZdZy)MemSizer   Nr3   rT   rU   r   r   r}   r\   r5   r0   r  r        >LEr5   r  c                       e Zd Z e       ZdZy)NumGeometriesr   Nr  r\   r5   r0   r  r    r  r5   r  c                       e Zd Z e       ZdZy)	NumPointsr   Nr  r\   r5   r0   r  r    r  r5   r  c                   ,     e Zd ZdZ fdZ fdZ xZS )	Perimeterr   c                    d }| j                   j                  |      r| j                         st        d      t	        d | j                         D              }|dkD  r|j                  j                  }t        | $  ||fd|i|S )Nz<ST_Perimeter cannot use a non-projected non-geography field.c              3   4   K   | ]  }|j                     y wr2   r   r   s     r0   r  z*Perimeter.as_postgresql.<locals>.<genexpr>  s     :!9A!%%!9s   r   r;   )
r9   rx   r   r   r  rE   r<   perimeter3dr    r>   )r)   r?   r@   rA   r;   r   r/   s         r0   r   zPerimeter.as_postgresql  s    >>"":.t7O7O7Q#N  :!7!7!9::7!~~11Hw~h
WXWWWr5   c                 r    | j                   j                  |      rt        d      t        |   ||fi |S )Nz+Perimeter cannot use a non-projected field.)r9   rx   r   r    r>   ry   s       r0   rh   zPerimeter.as_sqlite   s7    >>"":.#$QRRw~h
DmDDr5   )r3   rT   rU   r}   r   rh   rW   rX   s   @r0   r  r    s    E	XE Er5   r  c                       e Zd ZdZy)PointOnSurfacer   Nr   r\   r5   r0   r  r  &  r   r5   r  c                       e Zd ZdZy)Reverser   Nr   r\   r5   r0   r  r  *  r   r5   r  c                         e Zd Zd fd	Z xZS )Rotatec                     || j                  |dt              g}|It        |t              st	        d      |j                  t        |j                  t                            t        | (  |i | y )Nanglezorigin argument must be a Pointr   )rQ   ro   r$   r	   r&   r   r   wktr   r    r!   )r)   r   r"  originr+   r*   r/   s         r0   r!   zRotate.__init__/  sj    ug}=
 fe, ABBuVZZmoNO+//r5   r2   r3   rT   rU   r!   rW   rX   s   @r0   r   r   .  s    	0 	0r5   r   c                         e Zd Zd fd	Z xZS )Scalec                     || j                  |dt              | j                  |dt              g}|dk7  r&|j                  | j                  |dt                     t        |   |i | y )Nxy        z)rQ   ro   r   r    r!   )r)   r   r)  r*  r,  r+   r*   r/   s          r0   r!   zScale.__init__<  si    q#}5q#}5

 8t11!S-HI+//r5   )r+  r%  rX   s   @r0   r'  r'  ;  s    0 0r5   r'  c                        e Zd Z fdZ xZS )
SnapToGridc           
      "    t        |      }|g}|dv r5|j                  |D cg c]  } j                  |dt               c}       n2|dk(  r"|g  fd|dd  D         fd|dd D        z  }nt	        d      t           |i | y c c}w )	N)r   r   rS      c              3   L   K   | ]  }j                  |d t                ywrR   rQ   ro   r  argr)   s     r0   r  z&SnapToGrid.__init__.<locals>.<genexpr>R  s!     Q$$$S"m<   !$r   c              3   L   K   | ]  }j                  |d t                ywrR   r2  r3  s     r0   r  z&SnapToGrid.__init__.<locals>.<genexpr>S  s!     R	$$$S"m<	r5  r   z2Must provide 1, 2, or 4 arguments to `SnapToGrid`.)r   extendrQ   ro   r(   r    r!   )r)   r   rG   r+   nargsr*   r4  r/   s   `      r0   r!   zSnapToGrid.__init__H  s    D	!lF?GKLt##C];tL aZ QQRQRQq	R K
 QRR+// Ms   Br%  rX   s   @r0   r.  r.  G  s    0 0r5   r.  c                       e Zd ZdZdZy)SymDifferencer   r   Nr   r\   r5   r0   r:  r:  Z  r   r5   r:  c                        e Zd Z fdZ xZS )r   c                 |    || j                  |dt              g}d|vrt        |      |d<   t        |   |i | y r   r   r   s        r0   r!   zTransform.__init__`  r   r5   r%  rX   s   @r0   r   r   _  s    0 0r5   r   c                        e Zd Z fdZ xZS )	Translatec                     | j                         }t        | j                        dk  r$|j                  j                  t	        d             t        t        |  ||fi |S )Nr0  r   )rd   r   r#   r   r   r    r>  rh   r   s        r0   rh   zTranslate.as_sqlitek  sR    		t&&'!+$$++E!H5Y0:WWWr5   )r3   rT   rU   rh   rW   rX   s   @r0   r>  r>  j  s    X Xr5   r>  c                       e Zd ZdZdZy)Unionr   r   Nr   r\   r5   r0   rA  rA  s  r   r5   rA  N)Ndecimalr   #django.contrib.gis.db.models.fieldsr   r    django.contrib.gis.db.models.sqlr   r   django.contrib.gis.geosr   django.contrib.gis.geos.pointr	   django.core.exceptionsr
   	django.dbr   django.db.modelsr   r   r   r   r   r   r   r   r   django.db.models.functionsr   django.utils.functionalr   r   rg   ro   r   rZ   r_   rb   rk   rs   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   register_lookupr   r   r   r   r
  r  r  r  r  r  r  r  r   r'  r.  r:  r>  rA  r\   r5   r0   <module>rM     s    O E 0 / - '
 
 
 , 3eW%S Sl	lD 	7 7B B*C C B B.g U U0QG Q.0G 00G 0G 
G 

)+< 
&#%6 $ 
%'8 
H H0E"$8' 0Ef  & Sg S*	g 	Cg C"w '): 
 !!<  ", !!"lI " ""
 !!E"L) E "E%X "6 %XPg 	! 	g 
G 
 
E#%97 E()+< g 
0 
0	0%'8 	00*,= 0&(*; 
0! 0X X "3 r5   