ó
ř˘TQc           @   s˘   d  d l  Td  d l m Z d e f d     YZ d e f d     YZ d e f d     YZ d	 e f d
     YZ d e f d     YZ d e f d     YZ	 d S(   i˙˙˙˙(   t   *(   t   GeometryFieldt   GeoAggregatec           B   s5   e  Z d  Z d Z e Z d e d d  Z d   Z RS(   s   %(function)s(%(field)s)gŠ?c         K   sM   t  t |   j | | | |  | |  _ t |  j t  sI t d   n  d  S(   Ns6   Geospatial aggregates only allowed on geometry fields.(   t   superR   t   __init__t	   tolerancet
   isinstancet   sourceR   t
   ValueError(   t   selft   colR   t
   is_summaryR   t   extra(    (    sD   ../Django//lib/python/django/contrib/gis/db/models/sql/aggregates.pyR      s    	c         C   sÜ   | j  j r |  j |  j d <n  t |  j d  rI |  j j | |  } nO t |  j t t	 f  r d j
 g  |  j D] } | |  ^ qq  } n	 |  j } | j  j |   \ } } i | d 6| d 6} | j |  j  | | S(   s&   Return the aggregate, rendered as SQL.R   t   as_sqlt   .t   functiont   field(   t   opst   oracleR   R   t   hasattrR
   R   R   t   listt   tuplet   joint   spatial_aggregate_sqlt   update(   R	   t   qnt
   connectiont
   field_namet   ct   sql_templatet   sql_functiont   params(    (    sD   ../Django//lib/python/django/contrib/gis/db/models/sql/aggregates.pyR      s    .	
N(	   t   __name__t
   __module__R   t   Nonet   conversion_classt   Falset	   is_extentR   R   (    (    (    sD   ../Django//lib/python/django/contrib/gis/db/models/sql/aggregates.pyR      s
   
t   Collectc           B   s   e  Z RS(    (   R    R!   (    (    (    sD   ../Django//lib/python/django/contrib/gis/db/models/sql/aggregates.pyR&   /   s   t   Extentc           B   s   e  Z d  Z RS(   t   2D(   R    R!   R%   (    (    (    sD   ../Django//lib/python/django/contrib/gis/db/models/sql/aggregates.pyR'   2   s   t   Extent3Dc           B   s   e  Z d  Z RS(   t   3D(   R    R!   R%   (    (    (    sD   ../Django//lib/python/django/contrib/gis/db/models/sql/aggregates.pyR)   5   s   t   MakeLinec           B   s   e  Z RS(    (   R    R!   (    (    (    sD   ../Django//lib/python/django/contrib/gis/db/models/sql/aggregates.pyR+   8   s   t   Unionc           B   s   e  Z RS(    (   R    R!   (    (    (    sD   ../Django//lib/python/django/contrib/gis/db/models/sql/aggregates.pyR,   ;   s   N(
   t   django.db.models.sql.aggregatest#   django.contrib.gis.db.models.fieldsR   t	   AggregateR   R&   R'   R)   R+   R,   (    (    (    sD   ../Django//lib/python/django/contrib/gis/db/models/sql/aggregates.pyt   <module>   s   
+