o Úøa ã@s ddlmZmZmZmZddlmZmZddlm Z gd¢Z Gdd„deƒZ Gdd„de ƒZ Gd d „d e ƒZ Gd d „d e ƒZGd d„de ƒZGdd„de ƒZdS)é)Ú ExtentFieldÚGeometryCollectionFieldÚ GeometryFieldÚLineStringField)Ú AggregateÚValue)Úcached_property)ÚCollectÚExtentÚExtent3DÚMakeLineÚUnioncsHeZdZdZdZedd„ƒZd ‡fdd„ Zdd„Zd ‡fd d „ Z ‡Z S)Ú GeoAggregateNFcCs| |jdjj¡S)Nr)Úoutput_field_classÚsource_expressionsÚ output_fieldÚsrid)Úself©rúI/usr/lib/python3/dist-packages/django/contrib/gis/db/models/aggregates.pyrszGeoAggregate.output_fieldc s4|j |¡tƒj||fd|p|j |j¡i|¤ŽS)NÚfunction)ÚopsÚcheck_expression_supportÚsuperÚas_sqlÚspatial_aggregate_nameÚname)rÚcompilerÚ connectionrÚ extra_context©Ú __class__rrrs þýüzGeoAggregate.as_sqlcKsp|js.|j d¡pt|ddƒ}| ¡}| g| ¡¢t|ƒ‘¡d}|j||fd|i|¤ŽS|j||fi|¤ŽS)NÚ tolerancegš™™™™™©?z*%(function)s(SDOAGGRTYPE(%(expressions)s))Útemplate) Ú is_extentÚextraÚgetÚgetattrÚcopyÚset_source_expressionsÚget_source_expressionsrr)rrrrr"Úcloner#rrrÚ as_oraclesÿþzGeoAggregate.as_oracleTcs:tƒ |||||¡}| ¡D] }t|jdƒstdƒ‚q|S)NÚ geom_typez6Geospatial aggregates only allowed on geometry fields.)rÚresolve_expressionr*ÚhasattrÚfieldÚ ValueError)rÚqueryÚ allow_joinsÚreuseÚ summarizeÚfor_saveÚcÚexprr rrr.)s   ÿzGeoAggregate.resolve_expression©N)NTNFF) Ú__name__Ú __module__Ú __qualname__rr$rrrr,r.Ú __classcell__rrr rr s   rc@óeZdZdZeZdS)r N)r:r;r<rrrrrrrr 1ór có,eZdZdZdZ‡fdd„Zdd„Z‡ZS)r Ú2Dc ótƒj|fdtƒi|¤ŽdS©Nr©rÚ__init__r©rÚ expressionr%r rrrE:ózExtent.__init__cCó |j |¡Sr9)rÚconvert_extent©rÚvaluerGrrrrÚ convert_value=ó zExtent.convert_value©r:r;r<rr$rErMr=rrr rr 6ó  r cr@)r Ú3Dc rBrCrDrFr rrrEErHzExtent3D.__init__cCrIr9)rÚconvert_extent3drKrrrrMHrNzExtent3D.convert_valuerOrrr rr ArPr c@r>)r N)r:r;r<rrrrrrrr Lr?r c@r>)r N)r:r;r<rrrrrrrr Qr?r N)Ú#django.contrib.gis.db.models.fieldsrrrrÚdjango.db.modelsrrÚdjango.utils.functionalrÚ__all__rr r r r r rrrrÚs '