
    (&h                     d    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
dS )    N)	polylabel)
LineStringPointPolygonc                       e Zd Zd Zd Zd Zd Zej        	                    e
j        dk     d          d             Zd	S )
PolylabelTestCasec                     t          g d                              d          }t          |d          }t          dd          }|                    |d          sJ dS )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       ^/var/www/html/reinick/venv/lib/python3.11/site-packages/shapely/tests/legacy/test_polylabel.pytest_polylabelz PolylabelTestCase.test_polylabel   so    
 PPP
 

&++ 	 'U333))$$UD1111111    c                     t          g d                              d          }t          |          }|                    |          sJ dS )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   sZ     %%M%M%MNNUU
 
 /**''.......r   c                     t          g d          }t          |          }t          j        dk    r|j        dd         dgk    sJ dS |j        dd         dgk    sJ dS )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\@@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       
 
 '"":--<?'?&@@@@@@@ <?'?&@@@@@@@r   c                     t          g dg dg          }t          |d          }|j        t          j        d          k    sJ |j        t          j        d          k    sJ dS )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
   )   r/   )   r/   )r0   r0   )r/   r0   r.   )shellholesg?g     @N)r   r   xpytestapproxyr*   s      r   test_polygon_with_holez(PolylabelTestCase.test_polygon_with_hole:   s~    
 >>>;;;<
 
 
 '4((w&-000000w&-0000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 d S )NzPOLYGON ((536520.0679737709 5438764.374763639, 536520.0679737704 5438764.374763602, 536520.0679737709 5438764.374763642, 536520.0679737709 5438764.374763639))g`"_ Ag   KTA)r'   from_wktr   r3   r4   r5   r6   r*   s      r   test_polygon_infinite_loopz,PolylabelTestCase.test_polygon_infinite_loopG   sk     " m
 
 '""w&-
333333w&-44444444r   N)__name__
__module____qualname__r   r   r+   r7   r4   markskipifr'   r(   r;    r   r   r   r   
   s        
2 
2 
2
/ 
/ 
/A A A.1 1 1 [z)2J   5 5 5 5 5r   r   )unittestr4   r'   shapely.algorithms.polylabelr   shapely.geometryr   r   r   TestCaser   rA   r   r   <module>rF      s       2 2 2 2 2 2 7 7 7 7 7 7 7 7 7 7H5 H5 H5 H5 H5) H5 H5 H5 H5 H5r   