o
    ó<âg§  ã                   @   sT   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 G dd„ deƒZdS )	é    )Úc_void_p)ÚGDALBase)ÚGDALException)Úds)Úforce_bytesÚ	force_strc                
   @   s\   e Zd ZdZddddddddddœ	Zdd„ Zd	d
„ Zedd„ ƒZedd„ ƒZ	e
dd„ ƒZdS )ÚDriverzº
    Wrap a GDAL/OGR Data Source Driver.
    For more information, see the C API documentation:
    https://gdal.org/api/vector_c_api.html
    https://gdal.org/api/raster_c_api.html
    zESRI ShapefileÚTIGERÚGTiffÚJPEG)	ÚesriÚshpÚshapeÚtigerz
tiger/lineÚtiffÚtifÚjpegÚjpgc                 C   s    t |tƒr$|  ¡  | ¡ | jv r| j| ¡  }n|}tt t|ƒ¡ƒ}nt |t	ƒr3|  ¡  t 
|¡}nt |tƒr;|}ntdt|ƒ ƒ‚|sKtd| ƒ‚|| _dS )zT
        Initialize an GDAL/OGR driver on either a string or integer input.
        z/Unrecognized input type for GDAL/OGR Driver: %sz1Could not initialize GDAL/OGR Driver on input: %sN)Ú
isinstanceÚstrÚensure_registeredÚlowerÚ_aliasr   ÚcapiÚget_driver_by_namer   ÚintÚ
get_driverr   ÚtypeÚptr)ÚselfÚdr_inputÚnameÚdriver© r#   úQ/var/www/html/venv/lib/python3.10/site-packages/django/contrib/gis/gdal/driver.pyÚ__init__#   s&   



ÿÿ
zDriver.__init__c                 C   s   | j S )N)r!   ©r   r#   r#   r$   Ú__str__E   s   zDriver.__str__c                 C   s   t  ¡ s
t  ¡  dS dS )zB
        Attempt to register all the data source drivers.
        N)r   Úget_driver_countÚregister_all©Úclsr#   r#   r$   r   H   s   ÿzDriver.ensure_registeredc                 C   s   t  ¡ S )zO
        Return the number of GDAL/OGR data source drivers registered.
        )r   r(   r*   r#   r#   r$   Údriver_countR   s   zDriver.driver_countc                 C   s   t t | j¡ƒS )zA
        Return description/name string for this driver.
        )r   r   Úget_driver_descriptionr   r&   r#   r#   r$   r!   Y   s   zDriver.nameN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r%   r'   Úclassmethodr   r,   Úpropertyr!   r#   r#   r#   r$   r   	   s(    õ"
	
r   N)Úctypesr   Údjango.contrib.gis.gdal.baser   Údjango.contrib.gis.gdal.errorr   Ú"django.contrib.gis.gdal.prototypesr   r   Údjango.utils.encodingr   r   r   r#   r#   r#   r$   Ú<module>   s    