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/geos/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

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

3�a�@sTddlmZmZddlmZddlmZddlm	Z	ddl
mZGdd�de�ZdS)	�)�byref�c_uint)�
prototypes)�GEOSGeometry)�GEOM_PTR)�
LinearRingcs�eZdZdZ�fdd�Zdd�Zdd�Zedd	��Zd
d�Z	dd
�Z
	d!dd�Zdd�Zdd�Z
dd�ZejZejZedd��Zdd�Zdd�Zeee�ZeZedd��ZeZedd ��Z�ZS)"�Polygon�cs�|st�j|�dd�fi|��dS|^}}t|�}|dkrAt|dttf�rA|ds0d}d}nt|ddt�rA|d}t|�}|�|d|g|��}t�j|fi|��dS)a�
        Initialize on an exterior ring and a sequence of holes (both
        instances may be either LinearRing instances, or a tuple/list
        that may be constructed into a LinearRing).

        Examples of initialization, where shell, hole1, and hole2 are
        valid LinearRing geometries:
        >>> from django.contrib.gis.geos import LinearRing, Polygon
        >>> shell = hole1 = hole2 = LinearRing()
        >>> poly = Polygon(shell, hole1, hole2)
        >>> poly = Polygon(shell, (hole1, hole2))

        >>> # Example where a tuple parameters are used:
        >>> poly = Polygon(((0, 0), (0, 10), (10, 10), (0, 10), (0, 0)),
        ...                ((4, 4), (4, 6), (6, 6), (6, 4), (4, 4)))
        rNr	�)�super�__init__�_create_polygon�len�
isinstance�tuple�listr)�self�args�kwargs�ext_ring�
init_holes�n_holes�polygon��	__class__r
�A/usr/lib/python3/dist-packages/django/contrib/gis/geos/polygon.pyrszPolygon.__init__ccs"�tt|��D]}||VqdS)z&Iterate over each ring in the polygon.N)�ranger)r�ir
r
r�__iter__1s��zPolygon.__iter__cCs
|jdS)z+Return the number of rings in this Polygon.r	)�num_interior_rings�rr
r
r�__len__6s
zPolygon.__len__c
Csn|\}}}}|D]}t|ttf�s#td||||||||||f
�Sqt||f||f||f||f||ff�S)z2Construct a Polygon from a bounding box (4-tuple).z,POLYGON((%s %s, %s %s, %s %s, %s %s, %s %s)))r�float�intrr)�cls�bbox�x0�y0�x1�y1�zr
r
r�	from_bbox:s
��&zPolygon.from_bboxc	s�|st��Sg}|D]}t|t�r|�|�q
|���|��q
��|�d��}|d}|r@t|�fdd�|D��}t|�}nd}t�	||t
|��S)Nrr	csg|]}��|��qSr
)�_clone)�.0�rr r
r�
<listcomp>Xsz+Polygon._create_polygon.<locals>.<listcomp>)�capi�create_empty_polygonrr�append�_construct_ringr,�popr�create_polygonr)	r�length�items�ringsr.�shellr�holes�holes_paramr
r rr
Es

zPolygon._create_polygoncCs t|t�r
t�|�St�|j�S�N)rrr0�
geom_clone�ptr)r�gr
r
rr,_s

zPolygon._clone�YParameter must be a sequence of LinearRings or objects that can initialize to LinearRingscCs4t|t�r|Szt|�}|WStyt|��w)z1Try to construct a ring from the given parameter.)rr�	TypeError)r�param�msg�ringr
r
rr3es
�zPolygon._construct_ringcCs2|j}|j}|�||�|_|r||_t�|�dSr<)r>�sridr
r0�destroy_geom)rr6r7�prev_ptrrEr
r
r�	_set_listpszPolygon._set_listcCs&|dkr
t�|j�St�|j|d�S)a7
        Return the ring at the specified index. The first index, 0, will
        always return the exterior ring.  Indices > 0 will return the
        interior ring at the given index (e.g., poly[1] and poly[2] would
        return the first and second interior ring, respectively).

        CAREFUL: Internal/External are not the same as Interior/Exterior!
        Return a pointer from the existing geometries for use internally by the
        object's methods. _get_single_external() returns a clone of the same
        geometry for use by external code.
        rr	)r0�get_extringr>�get_intring�r�indexr
r
r�_get_single_internalzszPolygon._get_single_internalcCstt�|�|��|jd�S)N)rE)rr0r=rMrErKr
r
r�_get_single_external�szPolygon._get_single_externalcCst�|j�S)z$Return the number of interior rings.)r0�
get_nringsr>r r
r
rr�szPolygon.num_interior_ringscCs|dS)z%Get the exterior ring of the Polygon.rr
r r
r
r�
_get_ext_ring�szPolygon._get_ext_ringcCs||d<dS)z%Set the exterior ring of the Polygon.rNr
)rrDr
r
r�
_set_ext_ring�szPolygon._set_ext_ringcst�fdd�tt���D��S)z,Get the tuple for each ring in this Polygon.c3s�|]}�|jVqdSr<)r�r-rr r
r�	<genexpr>�s�z Polygon.tuple.<locals>.<genexpr>)rrrr r
r rr�sz
Polygon.tuplecs0d��fdd�t�j�D��}d�dj|fS)z.Return the KML representation of this Polygon.�c3s"�|]}d�|djVqdS)z%<innerBoundaryIs>%s</innerBoundaryIs>r	N)�kmlrRr r
rrS�s
��
�zPolygon.kml.<locals>.<genexpr>z:<Polygon><outerBoundaryIs>%s</outerBoundaryIs>%s</Polygon>r)�joinrrrU)r�	inner_kmlr
r rrU�s�zPolygon.kml)r@)�__name__�
__module__�__qualname__�
_minlengthrrr!�classmethodr+r
r,r3rHrMrNr�_set_single_rebuild�_set_single�_assign_extended_slice_rebuild�_assign_extended_slice�propertyrrPrQ�
exterior_ringr9r�coordsrU�
__classcell__r
r
rrr	s6%


�



rN)
�ctypesrr�django.contrib.gis.geosrr0� django.contrib.gis.geos.geometryr�django.contrib.gis.geos.libgeosr�"django.contrib.gis.geos.linestringrrr
r
r
r�<module>s

https://t.me/RX1948 - 2025