
    Og                         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y)    N)geos_version)TopologicalError)GeometryCollection
LineString
MultiPointPointPolygon)loadsc                   *    e Zd Zd Zd Zd Zd Zd Zy)OperationsTestCasec                 6   t        dd      }|j                  dk(  sJ |j                  dk(  sJ |j                  t        dd            t	        j
                  d      k(  sJ t        |j                  t               sJ |j                  t        dd            j                  sJ t        |j                  d      t              sJ t        |j                  dd      t              sJ t        d      }t        d      }|j                  dd	
      }|j                  |d      sJ t        d      }t        d      }|j                  dd
      }|j                  |d      sJ t        |j                  t               sJ t        |j!                  t        dd            t               sJ t        |j#                  t        dd            t$              sJ t        |j&                  t(              sJ t        |j+                  t        dd            t$              sJ t        |j-                         t               sJ t        |j/                         t               sJ |j-                         |j/                         k(  sJ t        |j0                  t               sJ y )Ng        g      g;f?g      $@    zRPOLYGON ((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        i/var/www/html/public_html/myphp/venv/lib/python3.12/site-packages/shapely/tests/legacy/test_operations.pytest_operationsz"OperationsTestCase.test_operations   sS   c3 zzS   ||s"""~~eD$/0FMMBT4UUUU
 %..%000 !!%B-09999 %,,t,g666%,,tR0'::: `
 N
 JJtuJ5~~h...F
 F
 JJttJ4~~h... %++U333 %**5Q<8%@@@%44U2q\BJOOO %..*<=== %++eBl3Z@@@%446>>>%002E:::))+u/E/E/GGGG%..%000    c                 h   t        dd      j                  t        dd            dk(  sJ t        d      }|j                  rJ t        dk  rDt        j                  t        t        j                  f      5  |j                  |       d d d        y |j                  |      dk(  sJ y # 1 sw Y   y xY w)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_relateJ   s    Q{!!%B-0K???  c
 #++++*$ 0'2G2GHI 8&&78 8 #))/:kIII8 8s   6B((B1c                     t        dd      }t        g d      }|j                  |      }||j                  t        dd            k(  sJ y )Nr   ))   r   )r;      )r0   r<   r0   r<   )r   r   hausdorff_distancer   )r&   r'   liner   s       r+   test_hausdorff_distancez*OperationsTestCase.test_hausdorff_distanceY   sE    a23++D15>>%1+6666r-   c                 z   t        ddg      }t        dd      }|j                  dd      }||k(  sJ t        d      }|j                  sJ |j                  dd      }|j                  sJ t        d	      }t        j                  t        d
      5  |j                  dd       d d d        y # 1 sw Y   y xY w)N)r   r   )r   r;   r   g      ?g      ?T)
normalizedzLINESTRING EMPTYzPOLYGON EMPTYzincorrect geometry type)match)r   r   interpolater
   r   r   r5   	TypeError)r&   	test_lineknown_pointinterpolated_point
empty_linepolygons         r+   test_interpolatez#OperationsTestCase.test_interpolate`   s    /0	Asm&22342H![000 -.
""""'33CD3I!**** (]]9,EF 	65	6 	6 	6s   B11B:c                     t        dd      }|j                         }||k(  sJ t        d      }|j                         }t        d      }||k(  sJ y )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_normalizer   sU    a"?@!CD!!!r-   N)__name__
__module____qualname__r,   r9   r?   rJ   rN    r-   r+   r   r      s    ;1zJ76$"r-   r   )unittestr   r6   r   shapely.errorsr   shapely.geometryr   r   r   r   r	   shapely.wktr
   TestCaser   rR   r-   r+   <module>rX      s1         + W W n"** n"r-   