ó
    gziJ+  ã                   ó  • S r SSKrSSKrSSKJr  SSKJr  SSKJr  SSK	J
r
  SSKJr  SSKJr  / S	QrS
 r " S S\5      r\\R$                  R&                  S'    " S S5      r " S S\
5      r\\R$                  R&                  S'   SS jrg)z*Polygons and their linear ring components.é    N)Ú_geometry_helpers)Úsigned_area)ÚTopologicalError)ÚBaseGeometry)Ú
LineString)ÚPoint)Ú
LinearRingÚPolygonÚorientc                 óÄ   • [         R                  " U 5      n[         R                  " U5      n[        R                  " U5      nU(       a  [         R
                  " X25      nU$ ©N)ÚshapelyÚfrom_wkbÚget_sridr   Úlinestring_to_linearringÚset_srid)ÚwkbÚ
linestringÚsridÚ
linearrings       ÚU/home/mande/repo/quber/.venv/lib/python3.13/site-packages/shapely/geometry/polygon.pyÚ_unpickle_linearringr      sK   € Ü×!Ò! #Ó&€JÜ×Ò˜JÓ'€DÜ"×;Ò;¸JÓG€JÞÜ×%Ò% jÓ7ˆ
ØÐó    c                   ó\   • \ rS rSrSr/ rS
S jr\S 5       rS r	\S 5       r
\S 5       rS	rg)r	   é   aF  Geometry type composed of one or more line segments that forms a closed loop.

A LinearRing is a closed, one-dimensional feature.
A LinearRing that crosses itself or touches itself at a single point is
invalid and operations on it may fail.

Parameters
----------
coordinates : sequence
    A sequence of (x, y [,z]) numeric coordinate pairs or triples, or
    an array-like with shape (N, 2) or (N, 3).
    Also can be a sequence of Point objects.

Notes
-----
Rings are automatically closed. There is no need to specify a final
coordinate pair identical to the first.

Examples
--------
Construct a square ring.

>>> from shapely import LinearRing
>>> ring = LinearRing( ((0, 0), (0, 1), (1 ,1 ), (1 , 0)) )
>>> ring.is_closed
True
>>> list(ring.coords)
[(0.0, 0.0), (0.0, 1.0), (1.0, 1.0), (1.0, 0.0), (0.0, 0.0)]
>>> ring.length
4.0

Nc                 ón  • Uc  [         R                  " S5      $ [        U[        5      (       a=  [	        U5      [
        L a  U$ UR                  (       d  [        S5      eUR                  nOé[        US5      (       a  [        R                  " U5      n[        U[        R                  5      (       a5  [        R                  " UR                  [        R                  5      (       a  OnS n[        R                   " U Vs/ s H
  o2" U5      PM     sn5      n[        R                  " UR                  [        R                  5      (       d  [#        S5      e[%        U5      S:X  a  [         R                  " S5      $ [         R&                  " U5      n[        U[
        5      (       d  [#        S5      eU$ s  snf )z!Create a new LinearRing geometry.zLINEARRING EMPTYz"An input LineString must be valid.Ú	__array__c                 óŒ   • [        U [        5      (       a  U R                  S   $ U  Vs/ s H  n[        U5      PM     sn$ s  snf ©Nr   )Ú
isinstancer   ÚcoordsÚfloat)ÚoÚcs     r   Ú_coordsÚ#LinearRing.__new__.<locals>._coordsW   s9   € Ü! !¤U×+Ñ+Ø Ÿx™x¨™{Ð*á23Ó4²!¨Q¤ a¦±!Ñ4Ð4ùÒ4s   ©Az&Inconsistent coordinate dimensionalityr   z/Invalid values passed to LinearRing constructor)r   Úfrom_wktr    r   Útyper	   Úis_validr   r!   ÚhasattrÚnpÚasarrayÚndarrayÚ
issubdtypeÚdtypeÚnumberÚarrayÚ
ValueErrorÚlenÚlinearrings)ÚselfÚcoordinatesr%   r#   Úgeoms        r   Ú__new__ÚLinearRing.__new__=   sV  € àÑô ×#Ò#Ð$6Ó7Ð7Ü˜¤Z×0Ñ0Ü�KÓ ¤JÒ.à"Ð"Ø ×)×)Ü&Ð'KÓLÐLð *×0Ñ0‘ô �{ K×0Ñ0Ü Ÿjšj¨Ó5�Ü˜+¤r§z¡z×2Ñ2´r·}²}Ø×!Ñ!¤2§9¡9÷8ñ 8ð ò5ô !Ÿhšh¹KÓ'HºK°q¨°®
¹KÑ'HÓI�Ü—}’} [×%6Ñ%6¼¿	¹	×BÑBô %Ð%MÓNÐNäˆ{Ó˜qÓ ô ×#Ò#Ð$6Ó7Ð7ä×"Ò" ;Ó/ˆÜ˜$¤
×+Ñ+ÜÐNÓOÐOØˆùò (Is   Ã>F2c                 ó2   • S[        U R                  5      S.$ )z9Return a GeoJSON-like mapping of the LinearRing geometry.r	   ©r(   r6   )Útupler!   ©r5   s    r   Ú__geo_interface__ÚLinearRing.__geo_interface__m   s   € ð %´U¸4¿;¹;Ó5GÑHÐHr   c                 ó:   • [         [        R                  " U SS944$ )z—Pickle support.

WKB doesn't differentiate between LineString and LinearRing so we
need to move the coordinate sequence into the correct geometry type
T)Úinclude_srid)r   r   Úto_wkbr=   s    r   Ú
__reduce__ÚLinearRing.__reduce__r   s   € ô %¤w§~¢~°dÈÑ'NÐ&PÐQÐQr   c                 ó@   • [        [        R                  " U 5      5      $ )z0True if the ring is oriented counter clock-wise.)Úboolr   Úis_ccwr=   s    r   rG   ÚLinearRing.is_ccwz   s   € ô ”G—N’N 4Ó(Ó)Ð)r   c                 ó@   • [        [        R                  " U 5      5      $ )zgTrue if the geometry is simple.

Simple means that any self-intersections are only at boundary points.
)rF   r   Ú	is_simpler=   s    r   rJ   ÚLinearRing.is_simple   s   € ô ”G×%Ò% dÓ+Ó,Ð,r   © r   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Ú	__slots__r8   Úpropertyr>   rC   rG   rJ   Ú__static_attributes__rL   r   r   r	   r	      sY   † ñðB €Iô.ð` ñIó ðIòRð ñ*ó ð*ð ñ-ó ó-r   r	   é   c                   óH   • \ rS rSrSrSrSrSrS rS r	S r
S rS rS	 rS
rg)ÚInteriorRingSequenceé‹   Nr   c                 ó2   • Xl         UR                  U l        g r   )Ú_parentÚ_ndim)r5   Úparents     r   Ú__init__ÚInteriorRingSequence.__init__‘   s   € ØŒØ—\‘\ˆ�
r   c                 ó>   • SU l         U R                  5       U l        U $ r   )Ú_indexÚ__len__Ú_lengthr=   s    r   Ú__iter__ÚInteriorRingSequence.__iter__•   s   € ØˆŒØ—|‘|“~ˆŒØˆr   c                 ó¦   • U R                   U R                  :  a2  U R                  U R                   5      nU =R                   S-  sl         U$ [        e)Né   )r`   rb   Ú	_get_ringÚStopIteration)r5   Úrings     r   Ú__next__ÚInteriorRingSequence.__next__š   s=   € Ø�;‰;˜Ÿ™Ó%Ø—>‘> $§+¡+Ó.ˆDØ�KŠK˜1Ñ�KØˆKäÐr   c                 óB   • [         R                  " U R                  5      $ r   )r   Úget_num_interior_ringsrZ   r=   s    r   ra   ÚInteriorRingSequence.__len__¢   s   € Ü×-Ò-¨d¯l©lÓ;Ð;r   c                 óŽ  • U R                  5       n[        U[        5      (       a6  X-   S:  d  X:¼  a  [        S5      eUS:  a  X!-   nOUnU R	                  U5      $ [        U[
        5      (       aK  / nUR                  U5      u  pVn[        XVU5       H#  nUR                  U R	                  U5      5        M%     U$ [        S5      e)Nr   zindex out of rangezkey must be an index or slice)
ra   r    ÚintÚ
IndexErrorrg   ÚsliceÚindicesÚrangeÚappendÚ	TypeError)r5   ÚkeyÚmÚiÚresÚstartÚstopÚstrides           r   Ú__getitem__Ú InteriorRingSequence.__getitem__¥   s°   € Ø�L‰L‹NˆÜ�cœ3×ÑØ‰w˜‹{˜c›hÜ Ð!5Ó6Ð6Ø�Q‹wØ‘G‘à�Ø—>‘> !Ó$Ð$Ü˜œU×#Ñ#ØˆCØ"%§+¡+¨a£.ÑˆE˜Ü˜5¨Ö/�Ø—
‘
˜4Ÿ>™>¨!Ó,Ö-ñ 0àˆJäÐ;Ó<Ð<r   c                 óD   • [         R                  " U R                  U5      $ r   )r   Úget_interior_ringrZ   )r5   ry   s     r   rg   ÚInteriorRingSequence._get_ring¸   s   € Ü×(Ò(¨¯©°qÓ9Ð9r   )r`   rb   r[   rZ   )rM   rN   rO   rP   rZ   r[   r`   rb   r]   rc   rj   ra   r~   rg   rT   rL   r   r   rW   rW   ‹   s4   † Ø€GØ€EØ€FØ€Gò"òò
 ò<ò=õ&:r   rW   c                   ó€   • \ rS rSrSr/ rSS jr\S 5       r\S 5       r	\S 5       r
\S 5       rSS	 jr\S
 5       rSrg)r
   é¼   aõ  A geometry type representing an area that is enclosed by a linear ring.

A polygon is a two-dimensional feature and has a non-zero area. It may
have one or more negative-space "holes" which are also bounded by linear
rings. If any rings cross each other, the feature is invalid and
operations on it may fail.

Parameters
----------
shell : sequence
    A sequence of (x, y [,z]) numeric coordinate pairs or triples, or
    an array-like with shape (N, 2) or (N, 3).
    Also can be a sequence of Point objects.
holes : sequence
    A sequence of objects which satisfy the same requirements as the
    shell parameters above

Attributes
----------
exterior : LinearRing
    The ring which bounds the positive space of the polygon.
interiors : sequence
    A sequence of rings which bound all existing holes.

Examples
--------
Create a square polygon with no holes

>>> from shapely import Polygon
>>> coords = ((0., 0.), (0., 1.), (1., 1.), (1., 0.), (0., 0.))
>>> polygon = Polygon(coords)
>>> polygon.area
1.0

Nc                 óN  • Uc  [         R                  " S5      $ [        U[        5      (       a  U$ [	        U5      nUb-  [        U5      S:X  a  SnOU Vs/ s H  n[	        U5      PM     nn[         R                  " XS9n[        U[        5      (       d  [        S5      eU$ s  snf )zCreate a new Polygon geometry.NzPOLYGON EMPTYr   )Úholesz,Invalid values passed to Polygon constructor)r   r'   r    r
   r	   r3   Úpolygonsr2   )r5   Úshellr†   ri   r7   s        r   r8   ÚPolygon.__new__ã   s˜   € à‰=ô ×#Ò# OÓ4Ð4Ü˜œw×'Ñ'àˆLä˜uÓ%ˆEàÑÜ�5‹z˜Q‹à‘á6;Ó<²e¨dœ DÖ)±e�Ð<ä×Ò Ñ3ˆÜ˜$¤×(Ñ(ÜÐKÓLÐLØˆùò =s   ÁB"c                 ó.   • [         R                  " U 5      $ )z(Return the exterior ring of the polygon.)r   Úget_exterior_ringr=   s    r   ÚexteriorÚPolygon.exteriorû   s   € ô ×(Ò(¨Ó.Ð.r   c                 ó>   • U R                   (       a  / $ [        U 5      $ )z5Return the sequence of interior rings of the polygon.)Úis_emptyrW   r=   s    r   Ú	interiorsÚPolygon.interiors   s   € ð �=�=ØˆIÜ# DÓ)Ð)r   c                 ó   • [        S5      e)zNot implemented for polygons.zCComponent rings have coordinate sequences, but the polygon does not)ÚNotImplementedErrorr=   s    r   r!   ÚPolygon.coords  s   € ô "ØQó
ð 	
r   c                 ó  • U R                   [        5       :X  a  / nOW[        U R                   R                  5      /nU R                   H'  nUR                  [        UR                  5      5        M)     S[        U5      S.$ )z6Return a GeoJSON-like mapping of the Polygon geometry.r
   r;   )rŒ   r	   r<   r!   r�   ru   )r5   r!   Úholes      r   r>   ÚPolygon.__geo_interface__  s`   € ð �=‰=œJ›LÓ(Ø‰Fä˜DŸM™M×0Ñ0Ó1Ð2ˆFØŸœ�Ø—‘œe D§K¡KÓ0Ö1ñ 'à!´%¸³-Ñ@Ð@r   c                 ó4  • U R                   (       a  gUc  U R                  (       a  SOSnUc  SnU R                  R                   Vs/ s H  nSR                  " U6 PM     sn/nU R
                   VVs/ s H,  ofR                   Vs/ s H  nSR                  " U6 PM     snPM.     nnnSR                  XW-    Vs/ s H*  nSR	                  US	   S
R                  USS 5      5      PM,     sn5      n	SU SSU-   SU SU	 S3	$ s  snf s  snf s  snnf s  snf )a…  Return SVG path element for the Polygon geometry.

Parameters
----------
scale_factor : float
    Multiplication factor for the SVG stroke-width.  Default is 1.
fill_color : str, optional
    Hex string for fill color. Default is to use "#66cc99" if
    geometry is valid, and "#ff3333" if invalid.
opacity : float
    Float number between 0 and 1 for color opacity. Default value is 0.6

z<g />Nz#66cc99z#ff3333g333333ã?z{},{}Ú zM {} L {} zr   z L rf   z <path fill-rule="evenodd" fill="z!" stroke="#555555" stroke-width="g       @z" opacity="z" d="z" />)r�   r)   rŒ   r!   Úformatr�   Újoin)
r5   Úscale_factorÚ
fill_colorÚopacityr$   Úexterior_coordsÚinteriorÚinterior_coordsr!   Úpaths
             r   ÚsvgÚPolygon.svg  s&  € ð �=�=ØØÑØ&*§m§m™¸ˆJØ‰?ØˆGØ8<¿¹×8LÒ8LÓMÒ8L°1˜GŸNšN¨AÓ.Ñ8LÑMÐNˆàJNÏ.Ê.ô
ÚJX¸h¯ªÓ9ª AˆW�^Š^˜QÓ©Ô9É.ð 	ñ 
ð �x‰xð .Ò?óâ?�Fð ×$Ñ$ V¨A¡Y°·
±
¸6À!À"¸:Ó0FÖGÙ?ñó
ˆð /¨z¨lð ;Ø  <Ñ/Ð0°¸G¸9ÀEÈ$ÈÈtðUð	
ùò Nùâ9ùó
ùòs$   ÁDÁ4DÂD
Â DÂ;1DÄ
Dc                 ó"   • U " X4X4X44X24/5      $ )z,Construct a `Polygon()` from spatial bounds.rL   )ÚclsÚxminÚyminÚxmaxÚymaxs        r   Úfrom_boundsÚPolygon.from_bounds<  s    € ñ �T�L 4 ,°°¸t¸lÐKÓLÐLr   rL   )NN)ç      ð?NN)rM   rN   rO   rP   rQ   rR   r8   rS   rŒ   r�   r!   r>   r£   Úclassmethodr«   rT   rL   r   r   r
   r
   ¼   s‚   † ñ"ðH €Iôð0 ñ/ó ð/ð ñ*ó ð*ð ñ
ó ð
ð ñAó ðAô!
ðF ñMó óMr   r
   é   c                 ó0   • [         R                  " XS:  S9$ )aº  Return an oriented polygon.

It is recommended to use :func:`shapely.orient_polygons` instead.

Parameters
----------
polygon : shapely.Polygon
sign : float, default 1.
    The sign of the result's signed area.
    A non-negative sign means that the coordinates of the geometry's exterior
    rings will be oriented counter-clockwise.

Returns
-------
Geometry or array_like

Refer to :func:`shapely.orient_polygons` for full documentation.

g        )Úexterior_cw)r   Úorient_polygons)ÚpolygonÚsigns     r   r   r   E  s   € ô( ×"Ò" 7¸s¹
ÑCÐCr   )r­   )rQ   Únumpyr+   r   r   Úshapely.algorithms.cgar   Úshapely.errorsr   Úshapely.geometry.baser   Úshapely.geometry.linestringr   Úshapely.geometry.pointr   Ú__all__r   r	   ÚlibÚregistryrW   r
   r   rL   r   r   Ú<module>r¾      s‡   ðÙ 0ã ã Ý %Ý .Ý +Ý .Ý 2Ý (â
-€òôl-�ô l-ð^ %€‡�× Ñ �QÑ ÷.:ñ .:ôbCMˆlô CMðL "€‡�× Ñ �QÑ õDr   