3
©ôÁg-  ã               @   s,   d dl mZ d dlmZ G dd„ deƒZdS )é    )ÚGDALBase)Úrasterc               @   s*   e Zd ZdZedd„ ƒZejdd„ ƒZdS )ÚGDALRasterBasez@
    Attributes that exist on both GDALRaster and GDALBand.
    c             C   sÞ   dg}t j| jƒ}|rJd}|| }x&|rH|j|jƒ ƒ |d7 }|| }q$W t j|ƒ i }x€|D ]x}t j| j|dkrvdn|jƒ ƒ}|s†q^i }d}|| }x2|rÈ|jƒ jdƒ\}	}
|
||	< |d7 }|| }q˜W |||pÔd< q^W |S )zô
        Return the metadata for this raster or band. The return value is a
        nested dictionary, where the first-level key is the metadata domain and
        the second-level is the metadata item names and values for that domain.
        ÚDEFAULTr   é   Nú=)	ÚcapiZget_ds_metadata_domain_listÚ_ptrÚappendÚdecodeZfree_dslZget_ds_metadataÚencodeÚsplit)ÚselfZdomain_listZ	meta_listÚcounterÚdomainÚresultÚdataZdomain_metaÚitemÚkeyÚval© r   úa/var/www/tester-filtro-web/env/lib/python3.6/site-packages/django/contrib/gis/gdal/raster/base.pyÚmetadata	   s6    	

zGDALRasterBase.metadatac             C   sf   x`|j ƒ D ]T\}}|dkrdn|jƒ }x6|j ƒ D ]*\}}tj| j|jƒ |rR|jƒ nd|ƒ q0W q
W dS )zo
        Set the metadata. Update only the domains that are contained in the
        value dictionary.
        r   N)Úitemsr   r   Zset_ds_metadata_itemr	   )r   Úvaluer   r   Z	meta_nameZ
meta_valuer   r   r   r   ;   s    
N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Úpropertyr   Úsetterr   r   r   r   r      s   2r   N)Zdjango.contrib.gis.gdal.baser   Z"django.contrib.gis.gdal.prototypesr   r   r   r   r   r   r   Ú<module>   s   