a
    J5dJ4                     @   s\  d dl Zd dlZd dlZd dlmZmZ d dlmZ ddlm	Z	m
Z
mZmZmZ ejZejZejZejdejejejgejdeded	ed
dejddedgdd Zejdejejejejgejdejddgejddeeggdgdd Z ejdejejejgejdegdd dgdggdd Z!ejdedZ"de"j#_$ejdejejejgejdg dede"ejdedejdedejdedgd d! Z%d"d# Z&d$d% Z'd&d' Z(ejd(d dgeee	dgfd dgede	egfddgddeegfgd)d* Z)ejd+ddgddggd d geddgddgggfg d,g d-gd d geg d,g d-ggfddgddgddgddggg d.eddgddggeddgddgggfgd/d0 Z*d1d2 Z+ejd(g d3e
e
e	dgfg d4e
de	e
gfg d5dde
e
gfgd6d7 Z,ejdddgddgddgddggddgddgddgggd8d9 Z-ejddej.gddgddgddgggd:d; Z/d<d= Z0ejd(g d>edde	gfg d?dede	gfg d@dddegfgdAdB Z1ejdCddgejdDdEdFgdGdH Z2eg dIZ3eg dJZ4e5eZ6e Z7ej5ee3gdKZ8ej5ee4gdKZ9ej5ee3e4gdKZ:ejdLeegd dge6e6gfdegd dge7e6gfdeddgg d.e6e7gfee3egg dMe8e6gfeee3gg dNe6e8gfdeee3gg d.e6e8gfedee3gg d.e6e8gfedee3gg dOe6e8gfeede3gg dOe6e8gfeee3dgg dOe6e8gfee3e4egg dPe:e6gfee3ee4gg d.e8e9gfeee3e4gg dOe6e:gfee3de4egg dQe:e6gfee3dee4gg dRe8e9gfee3ede4gg dSe8e9gfgdTdU Z;ejd(d dge6e6e	dgfd dge6de	e6gfddgdde6e6gfgdVdW Z<ejdej5ejejejejgejdeegdd dgdggdXdY Z=ejdZee
gd d geee
ggfee
gd dgeegee
ggfedgd d geeggfedgd dgeegeg gfdeddgg d.eegeg gfede
gg d[eee
ggfgd\d] Z>d^d_ Z?ejd(d d geee
gdde	gfddgdddeee
ggfgd`da Z@dbdc ZAddde ZBdfdg ZCdhdi ZDejdjegej5fe
gej5fegej5fe
gejfegejfegejfegejfegejfe
gejfg	dkdl ZEdS )m    N)
LinearRingPolygon)assert_geometries_equal   )empty_pointline_stringlinear_ringpointpolygonfunccoordinates)   )r      r   )r   r   )r   r   ZfooZdtypec                 C   sB   t ttf  | |ddgd W d    n1 s40    Y  d S Nr   r   indicespytestraises	TypeError
ValueError)r   r    r   _/var/www/html/django/DPS/env/lib/python3.9/site-packages/shapely/tests/test_creation_indices.pytest_invalid_coordinates   s    r   
geometriesr   Zhelloc                 C   sB   t ttf  | |ddgd W d    n1 s40    Y  d S r   r   )r   r   r   r   r   test_invalid_geometries!   s    r   r   z helloc                 C   sD   t ttf" | ddgg|d W d    n1 s60    Y  d S )N皙?333333?r   r   r   r   r   r   r   test_invalid_indices_simple2   s    r!      Fout)NNN)r"   r   r   c                 C   s   | t ju r$ddgddgg}ddg}nL| t ju r`ddgddgddgddgdd	gd	d	gg}g d
}nttg}ddg}tttf | |||d W d    n1 s0    Y  d S )Nr   r   皙?g      ?r   r   r   r"   r   )r   r   r   r   r   r   r   r#   )	shapelypointslinestringsr	   r   r   r   r   r   )r   r#   xr   r   r   r   test_invalid_out?   s    


(
r*   c                   C   sN   t tj. tjddgddggddgd W d    n1 s@0    Y  d S Nr   r   r   r   )r   r   r&   GEOSExceptionr'   r   r   r   r   test_points_invalid[   s    r-   c                  C   sF   t jtjddgddggtdtjddgtjdd} t| ttg d S )Nr   r"   r   r   r   r   )r&   r'   nparrayfloatintpr   r	   actualr   r   r   test_pointsa   s
    r4   c                   C   sb   t tD tjtjddgddggtdtjddgtjdd W d    n1 sT0    Y  d S )Nr   r"   r   r   r   )	r   r   r   r&   r'   r.   r/   r0   r1   r   r   r   r   test_points_no_index_raisesi   s
    r5   zindices,expectedc                 C   sL   t jdtd}t|d< tjddgddgg| |d}t|| ||u sHJ d S )Nr   r   r   r"   r%   )r.   emptyobjectr   r&   r'   r   r   expectedr#   r3   r   r   r   test_points_outq   s    	
r:   zcoordinates,indices,expected)r   r   r   )r   r   r   )r   r   r   r   c                 C   s2   t jtj| tdtj|tjdd}t|| d S Nr   r   )r&   r(   r.   r/   r0   r1   r   )r   r   r9   r3   r   r   r   test_linestrings   s    r<   c                   C   sN   t tj. tjddgddggddgd W d    n1 s@0    Y  d S r+   )r   r   r&   r,   r(   r   r   r   r   test_linestrings_invalid   s    r=   )r   r   r   r   r   r   )r   r   r   r"   r"   r"   )r   r   r   r"   r"   r"   c                 C   sD   t jdtd}t|d< tjg d| |d}t|| ||u s@J d S )Nr   r   r   )r   r   r   r   r   r   r>   r?   r@   r%   )r.   r6   r7   r   r&   r(   r   r8   r   r   r   test_linestrings_out   s    	
rA   c                 C   s>   t jtj| tjdtjt| tjdd}t|t |  d S r;   )	r&   linearringsr.   r/   Zfloat64zeroslenr1   r   )r   r3   r   r   r   test_linearrings   s
    rE   c                 C   sL   t tjtf( tj| tt| d W d    n1 s>0    Y  d S Nr   )	r   r   r&   r,   r   rB   r.   rC   rD   )r   r   r   r   test_linearrings_invalid   s    rG   c                  C   s.   t jg dtdd} t| tg d d S )N)r>   r>   r>   r"   r   )r>   r>   r>   r>   )r&   rB   r.   rC   r   r   r2   r   r   r   *test_linearrings_unclosed_all_coords_equal   s    rH   )r   r   r   r   r   )r   r   r   r   r   )r"   r"   r"   r"   r"   c                 C   sD   t jdtd}t|d< tjg d| |d}t|| ||u s@J d S )Nr   r   r"   )r>   r?   r@   )r   r   r>   r%   )r.   r6   r7   r   r&   rB   r   r8   r   r   r   test_linearrings_out   s    	
rI   dimorderCFc           	      C   s   t jdd| }t j|d| |d}t tdd}tj||d}t 	||d d dgd d f f}t j|d| |d}t tdd}tj||d}t
|| d S )	N
   r   (   )rK   r   r   2      )r.   randomZrandnZasarrayZreshaperepeatranger&   rB   Zhstackr   )	rJ   rK   ZcoordsZcoords1Zindices1Zresult1Zcoords2Zindices2Zresult2r   r   r   test_linearrings_buffer   s    "rU   ))r   r   )r   r$   )r$   r$   ))333333?rV   )rV   皙?)rW   rW   )Zholeszrings,indices,expected)r   r   r   )r   r   r   )r   r   r   r   )r   r   r   r   )r   r   r   r   r   )r   r   r   r   r   )r   r   r   r   r   c                 C   s2   t jtj| tdtj|tjdd}t|| d S r;   )r&   polygonsr.   r/   r7   r1   r   )Zringsr   r9   r3   r   r   r   test_polygons   s    .rY   c                 C   sD   t jdtd}t|d< tjttg| |d}t|| ||u s@J d S )Nr   r   r   r%   )r.   r6   r7   r   r&   rX   r   r   r8   r   r   r   test_polygons_out/  s
    	
rZ   c                 C   s@   t ttf | tg|d W d    n1 s20    Y  d S rF   )r   r   r   r   r	   r    r   r   r    test_invalid_indices_collections?  s    r[   zgeometries,indices,expected)r   r   r   c                 C   s&   t jtj| td|d}t|| d S r;   )r&   geometrycollectionsr.   r/   r7   r   )r   r   r9   r3   r   r   r   test_geometrycollectionsO  s    r]   c                   C   sN   t t0 tjtjttgt	dddgd W d    n1 s@0    Y  d S )Nr   r   r   r   )
r   r   r   r&   r\   r.   r/   r	   r   r7   r   r   r   r   (test_geometrycollections_no_index_raisesa  s    r^   c                 C   sD   t jdtd}t|d< tjttg| |d}t|| ||u s@J d S )Nr   r   r"   r%   )	r.   r6   r7   r   r&   r\   r	   r   r   r8   r   r   r   test_geometrycollections_outh  s
    
r_   c                  C   s<   t jtjtgtdtjdtjdd} t| t tg d S Nr   r   r   )	r&   multipointsr.   r/   r	   r7   rC   r1   r   r2   r   r   r   test_multipointsw  s    rb   c                  C   s<   t jtjtgtdtjdtjdd} t| t tg d S r`   )	r&   multilinestringsr.   r/   r   r7   rC   r1   r   r2   r   r   r   test_multilinestrings~  s    rd   c                  C   s<   t jtjtgtdtjdtjdd} t| t tg d S r`   )	r&   rc   r.   r/   r   r7   rC   r1   r   r2   r   r   r   test_multilinearrings  s    re   c                  C   s<   t jtjtgtdtjdtjdd} t| t tg d S r`   )	r&   multipolygonsr.   r/   r
   r7   rC   r1   r   r2   r   r   r   test_multipolygons  s    rg   zgeometries,funcc                 C   s<   t t || dgd W d    n1 s.0    Y  d S )Nr   r   )r   r   r   )r   r   r   r   r   test_incompatible_types  s    rh   )Fnumpyr.   r   r&   r   r   Zshapely.testingr   commonr   r   r   r	   r
   r'   Zpntsr(   Zlstrsr\   Z	geom_collmarkZparametrizerB   r6   fullr7   r   ra   rc   rf   r/   r1   r   r!   Znon_writeableflagsZ	writeabler*   r-   r4   r5   r:   r<   r=   rA   rE   nanrG   rH   rI   rU   Zhole_1Zhole_2rX   ZpolyZ
poly_emptyZpoly_hole_1Zpoly_hole_2Zpoly_hole_1_2rY   rZ   r[   r]   r^   r_   rb   rd   re   rg   rh   r   r   r   r   <module>   s  
	&
**&

2






-


" "










