https://t.me/RX1948
Server : Apache
System : Linux iad1-shared-b8-43 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64
User : dh_edsupp ( 6597262)
PHP Version : 8.2.26
Disable Function : NONE
Directory :  /lib/python3/dist-packages/django/contrib/gis/gdal/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/django/contrib/gis/gdal/__pycache__/feature.cpython-310.pyc
o

�aW�@shddlmZddlmZddlmZddlmZmZddl	m
ZmZ
ddlmZmZGdd�de�Zd	S)
�)�GDALBase)�
GDALException)�Field)�OGRGeometry�OGRGeomType)�ds�geom)�force_bytes�	force_strc@s�eZdZdZejZdd�Zdd�Zdd�Z	dd	�Z
d
d�Zedd
��Z
edd��Zedd��Zedd��Zedd��Zedd��Zedd��Zdd�Zdd�ZdS)�Featureza
    This class that wraps an OGR Feature, needs to be instantiated
    from a Layer object.
    cCs|std��||_||_dS)zI
        Initialize Feature from a pointer and its Layer object.
        z1Cannot create OGR Feature, invalid pointer given.N)r�ptr�_layer)�self�feat�layer�r�A/usr/lib/python3/dist-packages/django/contrib/gis/gdal/feature.py�__init__s
zFeature.__init__cCsLt|t�r|�|�}nd|kr|jkrnn|}ntd|��t||�S)a.
        Get the Field object at the specified index, which may be either
        an integer or the Field's string label.  Note that the Field object
        is not the field's _value_ -- use the `get` method instead to
        retrieve the value (e.g. an integer) instead of a Field instance.
        rz9Index out of range when accessing field in a feature: %s.)�
isinstance�str�index�
num_fields�
IndexErrorr)rr�irrr�__getitem__s

zFeature.__getitem__cCs|jS)z+Return the count of fields in this feature.)r�rrrr�__len__,szFeature.__len__cCsd|j|jfS)zThe string name of the feature.zFeature FID %d in Layer<%s>)�fid�
layer_namerrrr�__str__0szFeature.__str__cCstt�|j|j��S)z'Do equivalence testing on the features.)�bool�capi�
feature_equalr�_ptr)r�otherrrr�__eq__4szFeature.__eq__cCs
|jjjS)N)r
�_ds�encodingrrrrr'9s
zFeature.encodingcC�t�|j�S)zReturn the feature identifier.)r!�get_fidrrrrrr=�zFeature.fidcCst�|jj�}t||jdd�S)z-Return the name of the layer for the feature.T��strings_only)r!�
get_feat_namer
�_ldefnr
r')r�namerrrrBszFeature.layer_namecCr()z+Return the number of fields in the Feature.)r!�get_feat_field_countrrrrrrHr*zFeature.num_fieldscs�fdd�t�j�D�S)z'Return a list of fields in the Feature.c	s.g|]}tt�t��jj|���jdd��qS)Tr+)r
r!�get_field_name�get_field_defnr
r.r')�.0rrrr�
<listcomp>Ps���z"Feature.fields.<locals>.<listcomp>)�rangerrrrr�fieldsMs
�zFeature.fieldscCst�|j�}tt�|��S)z)Return the OGR Geometry for this Feature.)r!�get_feat_geom_refrr�geom_api�
clone_geom)r�geom_ptrrrrrXszFeature.geomcCstt�|jj��S)z.Return the OGR Geometry Type for this Feature.)rr!�get_fd_geom_typer
r.rrrr�	geom_type_szFeature.geom_typecCst|d|�}||jS)z�
        Return the value of the field, instead of an instance of the Field
        object.  May take a string of the field name or a Field object as
        parameters.
        r/)�getattr�value)r�field�
field_namerrr�getes
zFeature.getcCs*t�|jt|��}|dkrtd|��|S)z)Return the index of the given field name.rz!Invalid OFT field name given: %s.)r!�get_field_indexrr	r)rr@rrrrrnsz
Feature.indexN)�__name__�
__module__�__qualname__�__doc__r!�destroy_feature�
destructorrrrrr%�propertyr'rrrr6rr<rArrrrrr
s0	







	rN)�django.contrib.gis.gdal.baser�django.contrib.gis.gdal.errorr�django.contrib.gis.gdal.fieldr�"django.contrib.gis.gdal.geometriesrr�"django.contrib.gis.gdal.prototypesrr!rr8�django.utils.encodingr	r
rrrrr�<module>s

https://t.me/RX1948 - 2025