
    j                     `    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K
Jr   " S S5      rg)	    )GeometryField)Distance)Area)NotSupportedError)cached_propertyc                      ^  \ rS rSrSrSrSrSrSrSr	Sr
\S 5       rSrSr0 r1 SkrSrS	 rS
 rS rS rS r\S 5       rS rU 4S jrS rS rS rS r\" \5      r U 4S jr!S r"S r#S r$Sr%U =r&$ )BaseSpatialOperations	   FNz%sc                     U R                   $ N)selectselfs    f/var/www/html/KUNJ/venv/lib/python3.13/site-packages/django/contrib/gis/db/backends/base/operations.pyselect_extent#BaseSpatialOperations.select_extent   s    {{      >)   r   AsGMLAsKMLAsSVGAsWKBAsWKTScaleUnionLengthRotateAzimuthFromWKBFromWKTGeoHashIsEmptyIsValidMemSizeReverseCentroidr   Envelope	AsGeoJSON	MakeValid	NumPoints	Perimeter	Transform	Translate
Difference
SnapToGridClosestPointGeometryTypeIntersectionNumDimensionsNumGeometriesSymDifferenceBoundingCircleForcePolygonCWPointOnSurfaceLineLocatePointDistanceSpheroidGeometryDistancec                     [        S5      e)Nz:Aggregate extent not implemented for this spatial backend.NotImplementedErrorr   boxsrids      r   convert_extent$BaseSpatialOperations.convert_extentU   s    !H
 	
r   c                     [        S5      e)Nz=Aggregate 3D extent not implemented for this spatial backend.r>   r@   s      r   convert_extent3d&BaseSpatialOperations.convert_extent3dZ   s    !K
 	
r   c                     SU-  $ )Nz'%s'r   )r   names     r   geo_quote_name$BaseSpatialOperations.geo_quote_name`   s    }r   c                     [        S5      e)zP
Return the database column type for the geometry field on
the spatial backend.
zGsubclasses of BaseSpatialOperations must provide a geo_db_type() methodr>   )r   fs     r   geo_db_type!BaseSpatialOperations.geo_db_typed   s    
 "U
 	
r   c                     [        S5      e)z]
Return the distance parameters for the given geometry field,
lookup value, and lookup type.
z:Distance operations not available on this spatial backend.r>   )r   rM   valuelookup_types       r   get_distance"BaseSpatialOperations.get_distancem   s    
 "H
 	
r   c                 J    U S L=(       a    U R                   UR                   :g  $ r   )rB   )rQ   fields     r   _must_transform_value+BaseSpatialOperations._must_transform_valuev   s    D =UZZ5::%==r   c                 4   [        US5      (       aa  UR                  U5      u  pEU R                  UR                  U5      (       a*  U R	                  S5      nU SU S3n/ UQUR
                  P7nXE4$ U R                  X!5      (       a>  U R	                  S5      nU SU R                   S3nX"R
                  UR
                  4nXE4$ U R                  R                  R                  (       a  U R                   S3X!R
                  44$ U R                   S3U44$ )z
Return the placeholder for the given geometry field with the given
value. Depending on the spatial backend, the placeholder may contain a
stored procedure call to the transformation function of the spatial
backend.
as_sqlr-   (z, %s)z(%s, %s), %s)z(%s, %s)z(%s))
hasattrcompilerW   output_fieldspatial_function_namerB   	from_text
connectionfeatureshas_spatialrefsys_table)r   rM   rQ   compilersqlparamstransform_funcs          r   get_geom_placeholder_sql.BaseSpatialOperations.get_geom_placeholder_sqlz   s    5(##"**51KC))%*<*<a@@!%!;!;K!H'(#e4*6*166*;''11!77DN#$Adnn%5]CCZZ0F;__%%==nn%X.?? nn%T*UH44r   c                    > [        XR                  5      (       a  [        SUR                  -  5      e[        TU ]  U5        g )NzA%s spatial aggregation is not supported by this database backend.)
isinstancedisallowed_aggregatesr   rI   supercheck_expression_support)r   
expression	__class__s     r   rn   .BaseSpatialOperations.check_expression_support   s?    j"<"<==#S//"  	(4r   c                     [        S5      e)Nz;Aggregate support not implemented for this spatial backend.r>   )r   agg_names     r   spatial_aggregate_name,BaseSpatialOperations.spatial_aggregate_name   s    !I
 	
r   c                     XR                   ;   a  [        SU-  5      eU R                  R                  XR                  U-   5      $ )Nz-This backend doesn't support the %s function.)unsupported_functionsr   function_namesgetgeom_func_prefix)r   	func_names     r   r_   +BaseSpatialOperations.spatial_function_name   sG    222#?)K  ""&&y2G2G)2STTr   c                     [        S5      e)NzMSubclasses of BaseSpatialOperations must provide a geometry_columns() method.r>   r   s    r   geometry_columns&BaseSpatialOperations.geometry_columns   s    !
 	
r   c                     [        S5      e)NzKsubclasses of BaseSpatialOperations must a provide spatial_ref_sys() methodr>   r   s    r   spatial_ref_sys%BaseSpatialOperations.spatial_ref_sys   s    !
 	
r   c                    > [         TU ]  U5      n[        UR                  [        5      (       a   UR                  U R                  U5      5        U$ r   )rm   get_db_convertersrk   r^   r   appendget_geometry_converter)r   ro   
convertersrp   s      r   r   'BaseSpatialOperations.get_db_converters   sD    W.z:
j--}==d99*EFr   c                     [        S5      e)NzSSubclasses of BaseSpatialOperations must provide a get_geometry_converter() method.r>   )r   ro   s     r   r   ,BaseSpatialOperations.get_geometry_converter   s    !/
 	
r   c                    UR                  U R                  5      (       a1  U R                  R                  R                  (       a  g[	        S5      eUR                  U R                  5      nU(       a  [        R                  " U5      $ g )Nsq_mz2Area on geodetic coordinate systems not supported.)geodeticra   rb   supports_area_geodeticr?   
units_nameAreaMeasureunit_attname)r   rV   r   s      r   get_area_att_for_field,BaseSpatialOperations.get_area_att_for_field   sj    >>$//**''>>%D  ))$//:J"//
;; r   c                    S nUR                  U R                  5      (       a)  U R                  R                  R                  (       a  SnU$ UR	                  U R                  5      nU(       a  [
        R                  " U5      nU$ )Nm)r   ra   rb   supports_distance_geodeticr   DistanceMeasurer   )r   rV   dist_attunitss       r   get_distance_att_for_field0BaseSpatialOperations.get_distance_att_for_field   sg    >>$//**''BB
  $$T__5E*77>r   )'__name__
__module____qualname____firstlineno__postgis
spatialitemariadbmysqloraclespatial_versionr   r   r   rl   rz   rx   rw   r`   rC   rF   rJ   rN   rS   staticmethodrW   rh   rn   rt   r_   r~   r   r   distance_expr_for_lookupr   r   r   r   __static_attributes____classcell__)rp   s   @r   r	   r	   	   s     GJGEFO F   N*Z I




 > >525

U

  ,H5

<	 	r   r	   N)django.contrib.gis.db.modelsr   &django.contrib.gis.db.models.functionsr   django.contrib.gis.measurer   r   r   	django.dbr   django.utils.functionalr   r	   r   r   r   <module>r      s#    6 ; : B ' 3N Nr   