
    (&h                         d dl Z d dlZd dlZd dlmZ d dlmZ d dlmZmZm	Z	m
Z
mZ d dlmZ  G d de j                  ZdS )    N)geos_version)TopologicalError)GeometryCollection
LineString
MultiPointPointPolygon)loadsc                   ,    e Zd Zd Zd Zd Zd Zd ZdS )OperationsTestCasec                 0   t          dd          }|j        dk    sJ |j        dk    sJ |                    t          dd                    t	          j        d          k    sJ t          |j        t                     sJ |                    t          dd                    j	        sJ t          |
                    d          t                    sJ t          |
                    dd          t                    sJ t          d          }t          d	          }|                    dd
          }|                    |d          sJ t          d          }t          d          }|                    dd          }|                    |d          sJ t          |j        t                     sJ t          |                    t          dd                    t                     sJ t          |                    t          dd                    t$                    sJ t          |j        t(                    sJ t          |                    t          dd                    t$                    sJ t          |                                t                     sJ t          |                                t                     sJ |                                |                                k    sJ t          |j        t                     sJ d S )Ng        g      g;f?g      $@    )	quad_segszRPOLYGON ((120 120, 140 199, 160 200, 180 199, 220 120, 122 122, 121 121, 120 120))z@POLYGON ((120 120, 140 199, 160 200, 180 199, 220 120, 120 120))F)preserve_topologygMbP?ziPOLYGON ((80 200, 240 200, 240 60, 80 60, 80 200),(120 120, 220 120, 180 199, 160 200, 140 199, 120 120))T   )r   arealengthdistancepytestapprox
isinstanceenvelopeintersectionis_emptybufferr	   r
   simplifyequals_exactconvex_hull
differencesymmetric_differencer   boundaryr   unionrepresentative_pointpoint_on_surfacecentroid)selfpointpexpectedss        _/var/www/html/reinick/venv/lib/python3.11/site-packages/shapely/tests/legacy/test_operations.pytest_operationsz"OperationsTestCase.test_operations   s   c3 zS    |s""""~~eD$//00FMBT4U4UUUUU
 %.%00000 !!%B--009999 %,,t,,g66666%,,tr,::GDDDDD 
 
 N
 
 JJtuJ55~~h.....F
 
 F
 
 JJttJ44~~h..... %+U33333 %**5Q<<88%@@@@@%44U2q\\BBJOOOOO %.*<===== %++eBll33Z@@@@@%4466>>>>>%0022E:::::))++u/E/E/G/GGGGG%.%0000000    c                    t          dd                              t          dd                    dk    sJ t          d          }|j        rJ t          dk     rUt          j        t          t          j	        f          5  |                    |           d d d            d S # 1 swxY w Y   d S |                    |          dk    sJ d S )Nr   r   	FF0FFF0F2zUPOLYGON ((40 100, 80 100, 80 60, 40 60, 40 100), (60 60, 80 60, 80 40, 60 40, 60 60)))      r   	2FFF1FFF2)
r   relater
   is_validr   r   raisesr   shapelyGEOSException)r'   invalid_polygons     r,   test_relatezOperationsTestCase.test_relateK   s   Q{{!!%B--00K????  3
 
 #++++*$$ 0'2GHII 8 8&&7778 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 #))/::kIIIIIIs    B##B'*B'c                     t          dd          }t          g d          }|                    |          }||                    t          dd                    k    sJ d S )Nr   ))   r   )r<      )r1   r=   r1   r=   )r   r   hausdorff_distancer   )r'   r(   liner   s       r,   test_hausdorff_distancez*OperationsTestCase.test_hausdorff_distance[   sa    a22233++D115>>%1++66666666r.   c                    t          ddg          }t          dd          }|                    dd          }||k    sJ t          d          }|j        sJ |                    dd          }|j        sJ t          d	          }t          j        t          d
          5  |                    dd           d d d            d S # 1 swxY w Y   d S )N)r   r   )r   r<   r   g      ?g      ?T)
normalizedzLINESTRING EMPTYzPOLYGON EMPTYzincorrect geometry type)match)r   r   interpolater
   r   r   r6   	TypeError)r'   	test_lineknown_pointinterpolated_point
empty_linepolygons         r,   test_interpolatez#OperationsTestCase.test_interpolateb   s4   /00	Asmm&22342HH![0000 -..
""""'33CD3II!**** ((]9,EFFF 	6 	6555	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6s   #CCCc                     t          dd          }|                                }||k    sJ t          d          }|                                }t          d          }||k    sJ d S )Nr   z(MULTILINESTRING ((1 1, 0 0), (1 1, 1 2))z(MULTILINESTRING ((1 1, 1 2), (0 0, 1 1)))r   	normalizer
   )r'   r(   resultr?   r*   s        r,   test_normalizez!OperationsTestCase.test_normalizet   sm    a""?@@!!CDD!!!!!!r.   N)__name__
__module____qualname__r-   r:   r@   rK   rO    r.   r,   r   r      sc        <1 <1 <1|J J J 7 7 76 6 6$" " " " "r.   r   )unittestr   r7   r   shapely.errorsr   shapely.geometryr   r   r   r   r	   shapely.wktr
   TestCaser   rS   r.   r,   <module>rY      s                   + + + + + + W W W W W W W W W W W W W W      p" p" p" p" p"* p" p" p" p" p"r.   