
    _ hG                     f    d dl Z d dlZd dlZd dlmZ d dlmZmZmZ  G d de j                        Z
y)    N)	polylabel)
LineStringPointPolygonc                       e Zd Zd Zd Zd Zd Zej                  j                  e
j                  dk  d      d        Zy	)
PolylabelTestCasec                     t        g d      j                  d      }t        |d      }t        dd      }|j	                  |d      sJ y)zU
        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       /home/developers/rajanand/mypropertyqr-fmb-refixing-v2/venv/lib/python3.12/site-packages/shapely/tests/legacy/test_polylabel.pytest_polylabelz PolylabelTestCase.test_polylabel   sM    
 P

&+ 	 'U3)$$UD111    c                 x    t        g d      j                  d      }t        |      }|j                  |      sJ y)zt
        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_polygonz&PolylabelTestCase.test_concave_polygon   s=     %%MNUU
 /*''...r   c                    t        g d      }t        |      }t        j                  dk\  r|j                  dd dgk(  sJ yt        j                  dk\  r|j                  dd dgk(  sJ y|j                  dd dgk(  sJ y)a  
        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_casez-PolylabelTestCase.test_rectangle_special_case#   s     
 '":-<<?'?&@@@@!!Z/<<?'?&@@@@ <<?'?&@@@@r   c                     t        g dg dg      }t        |d      }|j                  t        j                  d      k(  sJ |j
                  t        j                  d      k(  sJ y)z
        Finds pole of inaccessibility for a polygon with a hole
        https://github.com/shapely/shapely/issues/817
        )r
   )
   r   )r.   r.   )r   r.   r
   )   r0   )   r0   )r1   r1   )r0   r1   r/   )shellholesg?g     @N)r   r   xpytestapproxyr+   s      r   test_polygon_with_holez(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                     t        j                  d      }t        |      }|j                  t	        j
                  d      k(  sJ |j                  t	        j
                  d      k(  sJ y )NzPOLYGON ((536520.0679737709 5438764.374763639, 536520.0679737704 5438764.374763602, 536520.0679737709 5438764.374763642, 536520.0679737709 5438764.374763639))g`"_ Ag   KTA)r(   from_wktr   r4   r5   r6   r7   r+   s      r   test_polygon_infinite_loopz,PolylabelTestCase.test_polygon_infinite_loopJ   s\     "" m
 '"ww&--
3333ww&--4444r   N)__name__
__module____qualname__r   r   r,   r8   r5   markskipifr(   r)   r<    r   r   r   r   
   sP    
2
/A41 [[z)2J  55r   r   )unittestr5   r(   shapely.algorithms.polylabelr   shapely.geometryr   r   r   TestCaser   rB   r   r   <module>rG      s+       2 7 7K5)) K5r   