
    9iG                     f    S SK r S SKrS SKrS SKJr  S SKJrJrJr   " S S\ R                  5      r
g)    N)	polylabel)
LineStringPointPolygonc                       \ rS rSrS rS rS rS r\R                  R                  \R                  S:  SS9S	 5       rS
rg)PolylabelTestCase
   c                     [        / SQ5      R                  S5      n[        USS9n[        SS5      nUR	                  US5      (       d   eg)zE
Finds pole of inaccessibility for a polygon with a tolerance of 10

)r   r   )2      )d   r   )   r   )ii)iji8r   gMbP?)	tolerancegM@gQ[@N)r   bufferr   r   equals_exact)selfpolygonlabelexpecteds       c/var/www/html/land-doc-ocr/venv/lib/python3.13/site-packages/shapely/tests/legacy/test_polylabel.pytest_polylabel PolylabelTestCase.test_polylabel   sP    
 P

&+ 	 'U3)$$UD1111    c                     [        / SQ5      R                  S5      n[        U5      nUR                  U5      (       d   eg)z\
Finds pole of inaccessibility for a concave polygon and ensures that
the point is inside.

))  r   r   )r   r   )r   r   r   N)r   r   r   contains)r   concave_polygonr   s      r   test_concave_polygon&PolylabelTestCase.test_concave_polygon   s@     %%MNUU
 /*''....r   c                    [        / SQ5      n[        U5      n[        R                  S:  a  UR                  SS S/:X  d   eg[        R                  S:  a  UR                  SS S/:X  d   egUR                  SS S/:X  d   eg)z
The centroid algorithm used is vulnerable to floating point errors
and can give unexpected results for rectangular polygons. Test
that this special case is handled correctly.
https://github.com/mapbox/polylabel/issues/3
))'\@@6[L])r"   9#J{M])G\@@r$   )r%   r#   )      r   N)|Pk\@@gek}L]r&      r   )r(   gRL])r(   gמYM])r   r   shapelygeos_versioncoordsr   r   r   s      r   test_rectangle_special_case-PolylabelTestCase.test_rectangle_special_case#   s     
 '":-<<?'?&@@@@!!Z/<<?'?&@@@@ <<?'?&@@@@r   c                     [        / SQ/ SQ/S9n[        US5      nUR                  [        R                  " S5      :X  d   eUR
                  [        R                  " S5      :X  d   eg)zg
Finds pole of inaccessibility for a polygon with a hole
https://github.com/shapely/shapely/issues/817
)r   )r	   r   )r	   r	   )r   r	   r   )   r3   )   r3   )r4   r4   )r3   r4   r2   )shellholesg?g     @N)r   r   xpytestapproxyr.   s      r   test_polygon_with_hole(PolylabelTestCase.test_polygon_with_hole=   s[    
 >;<
 '4(ww&--0000ww&--0000r   r)   zFails with GEOS < 3.12)reasonc                     [         R                  " S5      n[        U5      nUR                  [        R
                  " S5      :X  d   eUR                  [        R
                  " S5      :X  d   eg )NzPOLYGON ((536520.0679737709 5438764.374763639, 536520.0679737704 5438764.374763602, 536520.0679737709 5438764.374763642, 536520.0679737709 5438764.374763639))g`"_ Ag   KTA)r+   from_wktr   r7   r8   r9   r:   r.   s      r   test_polygon_infinite_loop,PolylabelTestCase.test_polygon_infinite_loopJ   s\     "" m
 '"ww&--
3333ww&--4444r    N)__name__
__module____qualname____firstlineno__r   r   r/   r;   r8   markskipifr+   r,   r@   __static_attributes__rB   r   r   r   r   
   sP    
2
/A41 [[z)2J  55r   r   )unittestr8   r+   shapely.algorithms.polylabelr   shapely.geometryr   r   r   TestCaser   rB   r   r   <module>rN      s+       2 7 7K5)) K5r   