
    g                     $    d dl mZ  G d d      Zy)    )gdalc                      e Zd ZdZed        Zed        Zed        Zed        Zed        Z	ed        Z
ed        Zed	        Zed
        Zed        Zed        Zed        Zed        Zed        Zedd       Zd Zy)SpatialRefSysMixinz~
    The SpatialRefSysMixin is a class used by the database-dependent
    SpatialRefSys objects to reduce redundant code.
    c                    t        | d      r| j                  j                         S 	 t        j                  | j
                        | _        | j                  S # t        $ r}|}Y d}~nd}~ww xY w	 t        j                  | j                        | _        | j                  S # t        $ r}|}Y d}~nd}~ww xY wt        d| j
                  d|      )z8
        Return a GDAL SpatialReference object.
        _srsNz-Could not get OSR SpatialReference from WKT: z
Error:
)	hasattrr   cloner   SpatialReferencewktsrs	Exception	proj4text)selfemsgs      /var/www/python.vincentserveurtest.ovh/public_html/venv/lib/python3.12/site-packages/django/contrib/gis/db/backends/base/models.pyr   zSpatialRefSysMixin.srs
   s     4 99??$$
 11$((;	xx  11$..A	xx  88S" s/   /A 	A-!A((A-1/B! !	B6*B11B6c                 .    | j                   j                  S )z
        Return a tuple of the ellipsoid parameters:
        (semimajor axis, semiminor axis, and inverse flattening).
        )r   	ellipsoidr   s    r   r   zSpatialRefSysMixin.ellipsoid(   s     xx!!!    c                 .    | j                   j                  S )zReturn the projection name.)r   namer   s    r   r   zSpatialRefSysMixin.name0   s     xx}}r   c                      | j                   d   S )z4Return the spheroid name for this spatial reference.spheroidr   r   s    r   r   zSpatialRefSysMixin.spheroid5   s     xx
##r   c                      | j                   d   S )z,Return the datum for this spatial reference.datumr   r   s    r   r   zSpatialRefSysMixin.datum:   s     xx  r   c                 .    | j                   j                  S )z$Is this Spatial Reference projected?)r   	projectedr   s    r   r   zSpatialRefSysMixin.projected?   s     xx!!!r   c                 .    | j                   j                  S )z Is this Spatial Reference local?)r   localr   s    r   r!   zSpatialRefSysMixin.localD   s     xx~~r   c                 .    | j                   j                  S )z%Is this Spatial Reference geographic?)r   
geographicr   s    r   r#   zSpatialRefSysMixin.geographicI   s     xx"""r   c                 .    | j                   j                  S )zReturn the linear units name.)r   linear_namer   s    r   r%   zSpatialRefSysMixin.linear_nameN   s     xx###r   c                 .    | j                   j                  S )zReturn the linear units.)r   linear_unitsr   s    r   r'   zSpatialRefSysMixin.linear_unitsS        xx$$$r   c                 .    | j                   j                  S )z%Return the name of the angular units.)r   angular_namer   s    r   r*   zSpatialRefSysMixin.angular_nameX   r(   r   c                 .    | j                   j                  S )zReturn the angular units.)r   angular_unitsr   s    r   r,   z SpatialRefSysMixin.angular_units]   s     xx%%%r   c                     | j                   s| j                  r| j                  | j                  fS | j                  r| j
                  | j                  fS y)z)Return a tuple of the units and the name.)NN)r   r!   r'   r%   r#   r,   r*   r   s    r   unitszSpatialRefSysMixin.unitsb   sI     >>TZZ%%t'7'788__&&(9(9::r   c                 @    t        j                  |      j                  S )z
        Return a tuple of (unit_value, unit_name) for the given WKT without
        using any of the database fields.
        )r   r
   r.   )clsr   s     r   	get_unitszSpatialRefSysMixin.get_unitsl   s     $$S)///r   c                     t        j                  |      }|j                  }|d   }|s||fS t        |      dk(  r|d   |d   }}n|\  }}d|d|d|dS )	z
        Class method used by GeometryField on initialization to
        retrieve the `SPHEROID[..]` parameters from the given WKT.
        r      r      z
SPHEROID["z",,])r   r
   r   len)r0   r   stringr   sphere_paramssphere_nameradius
flattenings           r   get_spheroidzSpatialRefSysMixin.get_spheroidt   sn     ##C(*o-- =!Q&%21%5}Q7G
%2"
-8&*MMr   c                 ,    t        | j                        S )zG
        Return the string representation, a 'pretty' OGC WKT.
        )strr   r   s    r   __str__zSpatialRefSysMixin.__str__   s     488}r   N)T)__name__
__module____qualname____doc__propertyr   r   r   r   r   r   r!   r#   r%   r'   r*   r,   r.   classmethodr1   r=   r@    r   r   r   r      s:   
  : " "   $ $ ! ! " "   # # $ $ % % % % & &     0 0 N N&r   r   N)django.contrib.gisr   r   rG   r   r   <module>rI      s    #H Hr   