o
    e5                     @   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   D   t ttf | |ddgd W d    d S 1 sw   Y  d S Nr   r   indicespytestraises	TypeError
ValueError)r   r    r   SD:\Projects\ConvertPro\env\Lib\site-packages\shapely/tests/test_creation_indices.pytest_invalid_coordinates   s   "r   
geometriesr   Zhelloc                 C   r   r   r   )r   r   r   r   r   test_invalid_geometries!   s   "r   r   z helloc                 C   sF   t ttf | ddgg|d W d    d S 1 sw   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}n&| t ju r0d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    d S 1 sRw   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   sP   t tj tjddgddggddgd W d    d S 1 s!w   Y  d S Nr   r   r   r   )r   r   r'   GEOSExceptionr(   r   r   r   r   test_points_invalid[       "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
   r6   c                   C   sd   t t# tjtjddgddggtdtjddgtjdd W d    d S 1 s+w   Y  d S )Nr   r#   r   r   r   )	r   r   r   r'   r(   r0   r1   r2   r3   r   r   r   r   test_points_no_index_raisesi   s   "r7   zindices,expectedc                 C   sL   t jdtd}t|d< tjddgddgg| |d}t|| ||u s$J d S )Nr   r   r   r#   r&   )r0   emptyobjectr   r'   r(   r   r   expectedr$   r5   r   r   r   test_points_outq   s   	
r<   zcoordinates,indices,expected)r   r   r   )r   r   r   )r   r   r   r   c                 C   2   t jtj| tdtj|tjdd}t|| d S Nr   r   )r'   r)   r0   r1   r2   r3   r   )r   r   r;   r5   r   r   r   test_linestrings   s   r?   c                   C   sP   t tj tjddgddggddgd W d    d S 1 s!w   Y  d S r,   )r   r   r'   r-   r)   r   r   r   r   test_linestrings_invalid   r/   r@   )r   r   r   r   r   r   )r   r   r   r#   r#   r#   )r   r   r   r#   r#   r#   c                 C   D   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   rB   rC   rD   r&   )r0   r8   r9   r   r'   r)   r   r:   r   r   r   test_linestrings_out      	
rE   c                 C   s>   t jtj| tjdtjt| tjdd}t|t |  d S r>   )	r'   linearringsr0   r1   Zfloat64zeroslenr3   r   )r   r5   r   r   r   test_linearrings   s
   rJ   c                 C   sN   t tjtf tj| tt| d W d    d S 1 s w   Y  d S Nr   )	r   r   r'   r-   r   rG   r0   rH   rI   )r   r   r   r   test_linearrings_invalid   s   "rL   c                  C   s.   t jg dtdd} t| tg d d S )N)rB   rB   rB   r#   r   )rB   rB   rB   rB   )r'   rG   r0   rH   r   r   r4   r   r   r   *test_linearrings_unclosed_all_coords_equal   s   rM   )r   r   r   r   r   )r   r   r   r   r   )r#   r#   r#   r#   r#   c                 C   rA   )Nr   r   r#   )rB   rC   rD   )r   r   rB   r&   )r0   r8   r9   r   r'   rG   r   r:   r   r   r   test_linearrings_out   rF   rN   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   (   )rP   r   r   2      )r0   randomZrandnZasarrayZreshaperepeatranger'   rG   Zhstackr   )	rO   rP   coordsZcoords1Zindices1Zresult1Zcoords2Zindices2Zresult2r   r   r   test_linearrings_buffer   s   "r[   ))r   r   )r   r%   )r%   r%   ))333333?r\   )r\   皙?)r]   r]   )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   r=   r>   )r'   polygonsr0   r1   r9   r3   r   )Zringsr   r;   r5   r   r   r   test_polygons   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&   )r0   r8   r9   r   r'   r^   r   r   r:   r   r   r   test_polygons_out/  s
   	
r`   c                 C   sB   t ttf | tg|d W d    d S 1 sw   Y  d S rK   )r   r   r   r   r	   r!   r   r   r    test_invalid_indices_collections?  s   "ra   zgeometries,indices,expected)r   r   r   c                 C   s&   t jtj| td|d}t|| d S r>   )r'   geometrycollectionsr0   r1   r9   r   )r   r   r;   r5   r   r   r   test_geometrycollectionsO  s   rc   c                   C   sP   t t tjtjttgt	dddgd W d    d S 1 s!w   Y  d S )Nr   r   r   r   )
r   r   r   r'   rb   r0   r1   r	   r   r9   r   r   r   r   (test_geometrycollections_no_index_raisesa  s
   "rd   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&   )	r0   r8   r9   r   r'   rb   r	   r   r   r:   r   r   r   test_geometrycollections_outh  s
   
re   c                  C   <   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'   multipointsr0   r1   r	   r9   rH   r3   r   r4   r   r   r   test_multipointsw     ri   c                  C   rf   rg   )	r'   multilinestringsr0   r1   r   r9   rH   r3   r   r4   r   r   r   test_multilinestrings~  rj   rl   c                  C   rf   rg   )	r'   rk   r0   r1   r   r9   rH   r3   r   r4   r   r   r   test_multilinearrings  rj   rm   c                  C   rf   rg   )	r'   multipolygonsr0   r1   r
   r9   rH   r3   r   r4   r   r   r   test_multipolygons  rj   ro   zgeometries,funcc                 C   s>   t t || dgd W d    d S 1 sw   Y  d S )Nr   r   )r   r   r   )r   r   r   r   r   test_incompatible_types  s   "rp   )Fnumpyr0   r   r'   r   r   Zshapely.testingr   commonr   r   r   r	   r
   r(   Zpntsr)   Zlstrsrb   Z	geom_collmarkZparametrizerG   r8   fullr9   r   rh   rk   rn   r1   r3   r   r"   Znon_writeableflagsZ	writeabler+   r.   r6   r7   r<   r?   r@   rE   rJ   nanrL   rM   rN   r[   Zhole_1Zhole_2r^   ZpolyZ
poly_emptyZpoly_hole_1Zpoly_hole_2Zpoly_hole_1_2r_   r`   ra   rc   rd   re   ri   rl   rm   ro   rp   r   r   r   r   <module>   s   
	&
**&

2







-
"
 "










