
    \iC,                         S SK r S SKrS SKJr  S SKJrJrJrJrJ	r	J
r
  S SKJrJrJr   " S S\ R                  5      r " S S\5      r " S	 S
\5      r " S S\5      r " S S\5      rg)    N)GeometryTypeError)
LineStringMultiLineString
MultiPointMultiPolygonPointPolygon)	linemergesplitunary_unionc                        \ rS rSrS rS rSrg)TestSplitGeometry   c                 h   [        X5      nUR                  S:X  d   e[        UR                  5      U:X  d   eUS:  a  UR                  S   R                  S:X  a9  U R	                  [        U5      R                  S5      R                  U5      5        g UR                  S   R                  S:X  aO  [        U5      R                  S5      nUR                  U5      (       d   eUR                  UR                  :X  d   eg [        eUS:X  a&  UR                  S   R                  U5      (       d   eg g )NGeometryCollection   r   r   gư>r	   )r   	geom_typelengeoms
assertTruer
   simplifyequalsr   area
ValueError)selfgeomsplitterexpected_chunkssunions         b/var/www/html/kml_chatgpt/mouzaenv/lib/python3.13/site-packages/shapely/tests/legacy/test_split.pyhelperTestSplitGeometry.helper   s   $!{{2222177|...Q wwqz##|3	! 5 5h ? F Ft LM%%2#A//9||D))))zzTYY...  !771:$$T**** "    c                 Z    [        / SQ5      n[        SS5      nU R                  XS5        g )N)r   r   r   r   r   r   r   r   r&   r   r   )r   r   r"   )r   lsr   s      r!   !test_split_closed_line_with_point3TestSplitGeometry.test_split_closed_line_with_point&   s(     @AA;B!$r$    N)__name__
__module____qualname____firstlineno__r"   r+   __static_attributes__r-   r$   r!   r   r      s    +&%r$   r   c                   V    \ rS rSr\" / SQ5      r\" / SQ/ SQ/5      rS rS rS r	Sr
g)	TestSplitPolygon.   r&      r   r8   r8   r   r8   r&         ?r=   )r=         ?r>   r>   )r>   r=   r<   c                    [        SS/5      nU R                  U R                  US5        U R                  U R                  US5        [        / SQ5      nU R                  U R                  US5        U R                  U R                  US5        [        SS/5      nU R                  U R                  US5        U R                  U R                  US5        [        / S	Q5      nU R                  U R                  US5        U R                  U R                  US5        [        / S
Q5      nU R                  U R                  US5        U R                  U R                  US5        g )Nr      r   r8   )rA   rC   333333?rD   rF   rB   rB   r:      r8   r   ))皙?rJ   rF   rF   rB   r8   )r   rB   rB   rB   )rB   r   )r   r"   poly_simple	poly_holer   r   s     r!   test_split_poly_with_line*TestSplitPolygon.test_split_poly_with_line5   s   vw/0D$$h2DNNHa0 DED$$h2DNNHa0 vv./D$$h2DNNHa0 >?D$$h2DNNHa0 67D$$h2DNNHa0r$   c                    [        SS/SS//5      nU R                  U R                  US5        U R                  U R                  US5        [        SS/SS//5      nU R                  U R                  US5        U R                  U R                  US5        [        SS/S	S
//5      nU R                  U R                  US5        U R                  U R                  US5        [        SS// SQ/5      nU R                  U R                  US5        U R                  U R                  US5        [        SS// SQ/5      nU R                  U R                  US5        U R                  U R                  US5        g )N)rJ   rB   )rJ   rD   rE   rG   rB   )rD   r   rB   r      r:   rH   r8   ))333333?rW   rK   rL   rM   )r   r"   rO   rP   rQ   s     r!   test_split_poly_with_multiline/TestSplitPolygon.test_split_poly_with_multilineO   sV   "Xy$9Ix;P#QRD$$h2DNNHa0 #Xy$9GV;L#MND$$h2DNNHa0 #Xy$9FF;K#LMD$$h2DNNHa0 #	"$DE
 	D$$h2DNNHa0 #Xy$9;S#TUD$$h2DNNHa0r$   c                    [         R                  " [        5         [        U R                  [        SS5      5        S S S 5        [         R                  " [        5         [        U R                  [        SS/5      5        S S S 5        [         R                  " [        5         [        U R                  U R                  5        S S S 5        g ! , (       d  f       N= f! , (       d  f       Nc= f! , (       d  f       g = f)Nr   r(   rB   rV   )pytestraisesr   r   rO   r   r   rP   )r   s    r!   test_split_poly_with_other+TestSplitPolygon.test_split_poly_with_otherk   s    ]],-$""E!QK0 .]],-$""J/?$@A .]],-$""DNN3 .-	 .-----s#   !C"C"!C.
C
C+.
C<r-   N)r.   r/   r0   r1   r	   rO   rP   rR   rX   r^   r2   r-   r$   r!   r4   r4   .   s/    BCK0	EFI
14184r$   r4   c                   L    \ rS rSr\" / SQ5      rS rS rS rS r	S r
S rS	rg
)TestSplitLinet   )r&   r?   )g      @g      @c                 L   [        SS5      nU R                  U R                  US5        [        SS5      nU R                  U R                  US5        [        SS5      nU R                  U R                  US5        [        SS5      nU R                  U R                  US5        g )Nr   r8   r>   rB   rV   )r   r"   r*   rQ   s     r!   test_split_line_with_point(TestSplitLine.test_split_line_with_pointw   s    A;DGGXq) c?DGGXq) A;DGGXq) A;DGGXq)r$   c                     [        / SQ5      nU R                  U R                  US5        [        SS/5      nU R                  U R                  US5        [        / SQ5      nU R                  U R                  US5        g )N)r(   r?   r<   rV   r(   r[   r8   )r(   r?   r(   rB   )r   r"   r*   rQ   s     r!   test_split_line_with_multipoint-TestSplitLine.test_split_line_with_multipoint   sg    >?DGGXq) vv./DGGXq) :;DGGXq)r$   c                    [        SS/5      nU R                  U R                  US5        [        / SQ5      nU R                  U R                  US5        [        SS/5      n[        R                  " [
        5         U R                  U R                  US5        S S S 5        [        SS	/5      nU R                  U R                  US5        [        S
S/5      nUR                  U R                  5      (       d   eU R                  U R                  US5        [        SS/5      nUR                  U R                  5      (       d   eU R                  U R                  US5        g ! , (       d  f       N= f)Nr'   r)   r8   )r'   r)   r   r8   rB   r&   )   rk   r   r:   )r   )r   rl   r(   )r   r"   r*   r\   r]   r   touchesrQ   s     r!   test_split_line_with_line'TestSplitLine.test_split_line_with_line   s*   vv./DGGXq) 67DGGXq) vx01]]:&KK1- ' vv./DGGXq) w01((((DGGXq) vv./((((DGGXq) '&s   <E%%
E3c                 8   [        SS/SS//5      nU R                  U R                  US5        [        SS/SS//5      nU R                  U R                  US5        [        SS// S	Q/5      nU R                  U R                  US
5        [        SS/SS//5      n[        R                  " [
        5         U R                  U R                  US5        S S S 5        [        SS/SS//5      nU R                  U R                  US5        g ! , (       d  f       N== f)Nr'   r)   r&   )r8   r8   r:   r7   rB   )r:   r7   )g@g	@rV   r?   r[   r   )r   r"   r*   r\   r]   r   rQ   s     r!   test_split_line_with_multiline,TestSplitLine.test_split_line_with_multiline   s   "VV$4vw6G#HIDGGXq) #VV$4vv6F#GHDGGXq) #VV$46R#STDGGXq) #VZ$8:v:N#OP]]:&KK1- ' #VV$4vv6F#GHDGGXq) '&s   6D
Dc                    [        / SQ5      nU R                  U R                  US5        [        / SQ5      nU R                  U R                  US5        [        / SQ/ SQ/5      nU R                  U R                  US5        g )N)r)   rj   r9   r7   r)   rB   )r&   rj   r9   r)   r&   r8   r6   r;   rV   )r	   r"   r*   rQ   s     r!   test_split_line_with_polygon*TestSplitLine.test_split_line_with_polygon   sm    CDDGGXq) CDDGGXq) 4IJ
 	DGGXq)r$   c                     [        / SQ5      n[        / SQ5      n[        / SQ5      n[        XU/5      nU R                  U R                  US5        g )Nr6   r;   )r&   )r   rq   )rq   rq   )rq   r   r&   rV   )r	   r   r"   r*   )r   poly1poly2poly3r   s        r!   !test_split_line_with_multipolygon/TestSplitLine.test_split_line_with_multipolygon   sN    4
 H
 DEu 56DGGXq)r$   r-   N)r.   r/   r0   r1   r   r*   rd   rg   rn   rr   ru   r{   r2   r-   r$   r!   ra   ra   t   s+    	4	5B*"**8*,*"	*r$   ra   c                   H    \ rS rSr\" SS/SS/SS/SS/SS//5      rS rSrg)TestSplitClosedRing   r   r   c                    [        SS/5      nU R                  U R                  US5        [        SS/5      nU R                  U R                  US5        [        U R                  U5      nUR                  S   R
                  S S  SS/:X  d   eUR                  S   R
                  S S  / SQ:X  d   e[        SS/5      nU R                  U R                  US5        [        U R                  U5      nUR                  S   R
                  S S  / S	Q:X  d   eUR                  S   R
                  S S  S
S/:X  d   e[        SS/5      nU R                  U R                  US5        g )N        r   r=   r8   r   r&   r   r=   )r   r'   r(   r)   r&   )r&   r'   r(   r)   r=   r   r   g       @)r   r"   r*   r   r   coords)r   r   results      r!   !test_split_closed_ring_with_point5TestSplitClosedRing.test_split_closed_ring_with_point   s<   #s$DGGXq)#s$DGGXq)tww)||A%%a(VZ,@@@@||A%%a(,XXXX #s$DGGXq)tww)||A%%a(,VVVV||A%%a(Xv,>>>>#s$DGGXq)r$   r-   N)r.   r/   r0   r1   r   r*   r   r2   r-   r$   r!   r~   r~      s0    	aVaVaVaVaV<	=B*r$   r~   c                   &    \ rS rSrS rS rS rSrg)TestSplitMulti   c                     [        SS/5      n[        SS/5      n[        X/5      n[        S5      nU R                  X4S5        g )Nr'   r8   r   r)   rj   r(   rV   )r   r   r   r"   r   l1l2mlr   s        r!   test_split_multiline_with_point.TestSplitMulti.test_split_multiline_with_point   sE     ()()bX&=B!$r$   c                     [        SS/5      n[        SS/5      n[        X/5      n[        / SQ5      nU R                  X4S5        g )Nr'   rU   r)   rj   )r(   r   )rV   r8   rI   )r   r   r   r"   r   s        r!   $test_split_multiline_with_multipoint3TestSplitMulti.test_split_multiline_with_multipoint  sG     ()()bX&67B!$r$   c                    [        / SQ5      n[        / SQ5      n[        X/5      n[        SS/5      nU R                  X4S5        [        / SQ5      n[        / SQ5      n[        X/5      n[        SS/5      nU R                  X4S5        g )	N)r&   r)   r(   r'   r&   )r(   rj   r9   r   r(   )rl   rl   rN   rV   )
   r   )r      )r   r   )r   r   r   )r   )r   )r   r   )r   r   r   r8   )r	   r   r   r"   )r   rx   ry   mpolyr*   s        r!   !test_split_multipolygon_with_line0TestSplitMulti.test_split_multipolygon_with_line  s    @A@Ae^,6*+Eq! JKTUe^,6*+Eq!r$   r-   N)r.   r/   r0   r1   r   r   r   r2   r-   r$   r!   r   r      s    %%"r$   r   )unittestr\   shapely.errorsr   shapely.geometryr   r   r   r   r   r	   shapely.opsr
   r   r   TestCaser   r4   ra   r~   r   r-   r$   r!   <module>r      sl      ,  6 5%)) %:C4( C4Lm*% m*`*+ *0!"& !"r$   