| Server IP : 217.160.0.135 / Your IP : 216.73.217.85 Web Server : Apache System : Linux www 6.18.52-i1-ampere #1203 SMP Mon Sep 14 18:29:59 CEST 2026 aarch64 User : sws1074145052 ( 1074145052) PHP Version : 8.3.32 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /lib/python3/dist-packages/django/contrib/gis/gdal/__pycache__/ |
Upload File : |
�
�|�eW � �v � d dl mZ d dlmZ d dlmZ d dlmZmZ d dl m
ZmZ
d dlmZmZ G d� de� � Zd S )
� )�GDALBase)�
GDALException)�Field)�OGRGeometry�OGRGeomType)�ds�geom)�force_bytes� force_strc �� � e Zd ZdZej Zd� Zd� Zd� Z d� Z
d� Zed� � � Z
ed� � � Zed � � � Zed
� � � Zed� � � Zed� � � Zed
� � � Zd� Zd� ZdS )�Featureza
This class that wraps an OGR Feature, needs to be instantiated
from a Layer object.
c �D � |st d� � �|| _ || _ dS )zI
Initialize Feature from a pointer and its Layer object.
z1Cannot create OGR Feature, invalid pointer given.N)r �ptr�_layer)�self�feat�layers �A/usr/lib/python3/dist-packages/django/contrib/gis/gdal/feature.py�__init__zFeature.__init__ s. � � � U�� S�T�T�T��������� c �� � t |t � � r| � |� � }n*d|cxk r| j k rn n|}nt d|z � � �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.
r z9Index out of range when accessing field in a feature: %s.)�
isinstance�str�index�
num_fields�
IndexErrorr )r r �is r �__getitem__zFeature.__getitem__ sx � � �e�S�!�!� b��
�
�5�!�!�A�A�
�%�
)�
)�
)�
)�$�/�
)�
)�
)�
)�
)��A�A��X�[`�`�a�a�a��T�1�~�~�r c � � | j S )z+Return the count of fields in this feature.)r �r s r �__len__zFeature.__len__, s
� ���r c �$ � d| j | j fz S )zThe string name of the feature.zFeature FID %d in Layer<%s>)�fid�
layer_namer s r �__str__zFeature.__str__0 s � �,���$�/�/J�J�Jr c �Z � t t j | j |j � � � � S )z'Do equivalence testing on the features.)�bool�capi�
feature_equalr �_ptr)r �others r �__eq__zFeature.__eq__4 s! � ��D�&�t�x���<�<�=�=�=r c �$ � | j j j S )N)r �_ds�encodingr s r r/ zFeature.encoding9 s � ��{��'�'r c �4 � t j | j � � S )zReturn the feature identifier.)r( �get_fidr r s r r# zFeature.fid= s � � �|�D�H�%�%�%r c �l � t j | j j � � }t || j d�� � S )z-Return the name of the layer for the feature.T��strings_only)r( �
get_feat_namer �_ldefnr r/ )r �names r r$ zFeature.layer_nameB s0 � � �!�$�+�"4�5�5����t�}�4�@�@�@�@r c �4 � t j | j � � S )z+Return the number of fields in the Feature.)r( �get_feat_field_countr r s r r zFeature.num_fieldsH s � � �(���2�2�2r c �D � � � fd�t � j � � D � � S )z'Return a list of fields in the Feature.c
� �� g | ]H}t t j t j �j j |� � � � �j d �� � ��IS )Tr3 )r r( �get_field_name�get_field_defnr r6 r/ )�.0r r s �r �
<listcomp>z"Feature.fields.<locals>.<listcomp>P sb �� �
�
�
�
�
��#�D�$7���8J�A�$N�$N�O�O��
�!�
�
�
�
�
�
r )�ranger r s `r �fieldszFeature.fieldsM s: �� �
�
�
�
�
�T�_�-�-�
�
�
�
r c �v � t j | j � � }t t j |� � � � S )z)Return the OGR Geometry for this Feature.)r( �get_feat_geom_refr r �geom_api�
clone_geom)r �geom_ptrs r r zFeature.geomX s/ � � �)�$�(�3�3���8�.�x�8�8�9�9�9r c �X � t t j | j j � � � � S )z.Return the OGR Geometry Type for this Feature.)r r( �get_fd_geom_typer r6 r s r � geom_typezFeature.geom_type_ s"