Ë
    íÍ:j¾1  ã                   óÖ   — d dl Zd dlmZmZ d dlmZmZ d„ Z	 G d„ d«      Z
 G d„ de«      Z G d	„ d
«      Z G d„ dej                  «      Z G d„ d«      Z G d„ d«      Z G d„ d«      Zy)é    N)ÚtickerÚ_api)ÚBboxÚ	Transformc                 ór  — g }| dd | dd z
  }t        d«      t        ddd«      fD �]  }| j                  |   \  }}|j                  |   \  }}|j                  |   \  }	}
|j                  |   \  }}|	||	kD  f|||k  ffD ]«  \  }}g }|dd |dd z  j	                  «       \  }||   |||   z
  ||   z  ||   z  z   }|j                  t        |||   «      D ��cg c]E  \  }}|
|cxk  r|k  r5n n2||f|   t        j                  t        j                  |ddd…   Ž «      f‘ŒG c}}«       Œ­ �Œ
 |S c c}}w )aá  
    Find the points where a polyline crosses a bbox, and the crossing angles.

    Parameters
    ----------
    xys : (N, 2) array
        The polyline coordinates.
    bbox : `.Bbox`
        The bounding box.

    Returns
    -------
    list of ((float, float), float)
        Four separate lists of crossings, for the left, right, bottom, and top
        sides of the bbox, respectively.  For each list, the entries are the
        ``((x, y), ccw_angle_in_degrees)`` of the crossing, where an angle of 0
        means that the polyline is moving to the right at the crossing point.

        The entries are computed by linearly interpolating at each crossing
        between the nearest points on either side of the bbox edges.
    é   Néÿÿÿÿ)
ÚsliceÚTÚminÚmaxÚnonzeroÚappendÚzipÚnpÚdegreesÚarctan2)ÚxysÚbboxÚ	crossingsÚdxysÚslÚusÚvsÚdusÚdvsÚuminÚvminÚumaxÚvmaxÚu0ÚinsideÚcrossÚidxsÚvvÚvÚdxys                       úx/home/mcse/projects/srt_converter/srt-converter-venv/lib/python3.12/site-packages/mpl_toolkits/axisartist/grid_finder.pyÚ_find_line_box_crossingsr)      sw  € ð, €IØˆqˆrˆ7�S˜˜"�XÑ€DÜ�T‹{œE $¨¨bÓ1Ð2ó IˆØ—‘�r‘‰ˆˆBØ—6‘6˜"‘:‰ˆˆSØ—X‘X˜b‘\‰
ˆˆdØ—X‘X˜b‘\‰
ˆˆdØ  " t¡)Ð,¨t°R¸$±YÐ.?Ð@ò 	I‰JˆB�ØˆEØ˜C˜R�[ 6¨!¨" :Ñ-×6Ñ6Ó8‰EˆDØ�D‘˜R " T¡(™]¨c°$©iÑ7¸#¸d¹)ÑCÑCˆBØ×Ñä! " d¨4¡jÓ1÷Há�A�s°T¸QÔ5FÀ$Õ5Fð �a�˜‘œbŸj™j¬¯©°S¹¸2¸±YÐ)?Ó@ÒAóHõ Iò		IðIð ÐùóHs   ÃA
D3c                   ó"   — e Zd ZdZd„ Zd„ Zd„ Zy)ÚExtremeFinderSimplezU
    A helper class to figure out the range of grid lines that need to be drawn.
    c                 ó    — || _         || _        y)zy
        Parameters
        ----------
        nx, ny : int
            The number of samples in each direction.
        N)ÚnxÚny)Úselfr-   r.   s      r(   Ú__init__zExtremeFinderSimple.__init__3   s   € ð ˆŒØˆ�ó    c           	      óÂ   — | j                  t        |d«      t        j                  ||||«      «      }|j                  |j
                  |j                  |j                  fS )am  
        Compute an approximation of the bounding box obtained by applying
        *transform_xy* to the box delimited by ``(x1, y1, x2, y2)``.

        The intended use is to have ``(x1, y1, x2, y2)`` in axes coordinates,
        and have *transform_xy* be the transform from axes coordinates to data
        coordinates; this method then returns the range of data coordinates
        that span the actual axes.

        The computation is done by sampling ``nx * ny`` equispaced points in
        the ``(x1, y1, x2, y2)`` box and finding the resulting points with
        extremal coordinates; then adding some padding to take into account the
        finite sampling.

        As each sampling step covers a relative range of ``1/nx`` or ``1/ny``,
        the padding is computed by expanding the span covered by the extremal
        coordinates by these fractions.
        N)Ú_find_transformed_bboxÚ_User2DTransformr   Úfrom_extentsÚx0Úx1Úy0Úy1)r/   Útransform_xyr7   r9   Úx2Úy2Útbboxs          r(   Ú__call__zExtremeFinderSimple.__call__=   sR   € ð& ×+Ñ+Ü˜\¨4Ó0´$×2CÑ2CÀBÈÈBÐPRÓ2SóUˆà�x‰x˜Ÿ™ 5§8¡8¨U¯X©XÐ5Ð5r1   c           
      ó  — t        j                  t        j                  t        j                  |j                  |j
                  | j                  «      t        j                  |j                  |j                  | j                  «      «      d«      j                  }t        j                  «       }|j                  |j                  |«      «       |j                  dd| j                  z  z   dd| j                  z  z   «      S )a  
        Compute an approximation of the bounding box obtained by applying
        *trans* to *bbox*.

        See ``__call__`` for details; this method performs similar
        calculations, but using a different representation of the arguments and
        return value.
        )é   r	   r   r@   )r   ÚreshapeÚmeshgridÚlinspacer6   r7   r-   r8   r9   r.   r   r   ÚnullÚupdate_from_data_xyÚ	transformÚexpanded)r/   Útransr   Úgridr=   s        r(   r3   z*ExtremeFinderSimple._find_transformed_bboxT   s­   € ô �z‰zœ"Ÿ+™+¤b§k¡k°$·'±'¸4¿7¹7ÀDÇGÁGÓ&LÜ&(§k¡k°$·'±'¸4¿7¹7ÀDÇGÁGÓ&LóNà!ó#ç#$¡1ð 	ô —	‘	“ˆØ×!Ñ! %§/¡/°$Ó"7Ô8Ø�~‰~˜a ! d§g¡g¡+™o¨q°1°t·w±w±;©Ó?Ð?r1   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r0   r>   r3   © r1   r(   r+   r+   .   s   „ ñòò6ó.@r1   r+   c                   ó6   ‡ — e Zd ZdZdxZZˆ fd„Zd„ Zd„ Zˆ xZ	S )r4   z.A transform defined by two user-set functions.r@   c                 ó>   •— t         ‰| �  «        || _        || _        y)zÞ
        Parameters
        ----------
        forward, backward : callable
            The forward and backward transforms, taking ``x`` and ``y`` as
            separate arguments and returning ``(tr_x, tr_y)``.
        N)Úsuperr0   Ú_forwardÚ	_backward)r/   ÚforwardÚbackwardÚ	__class__s      €r(   r0   z_User2DTransform.__init__j   s   ø€ ô 	‰ÑÔØˆŒØ!ˆ�r1   c                 ól   — t        j                   | j                  t        j                  |«      Ž «      S ©N)r   Ú	transposerR   )r/   Úvaluess     r(   Útransform_non_affinez%_User2DTransform.transform_non_affinex   s%   € ä�|‰|˜M˜DŸM™M¬2¯<©<¸Ó+?Ð@ÓAÐAr1   c                 óN   —  t        | «      | j                  | j                  «      S rX   )ÚtyperS   rR   ©r/   s    r(   Úinvertedz_User2DTransform.inverted|   s   € àŒt�D‹z˜$Ÿ.™.¨$¯-©-Ó8Ð8r1   )
rJ   rK   rL   rM   Ú
input_dimsÚoutput_dimsr0   r[   r_   Ú__classcell__©rV   s   @r(   r4   r4   e   s    ø„ Ù8à Ð €J�ô"òBö9r1   r4   c                   ó²   — e Zd ZdZ	 	 	 	 	 dd„Zd„ Zd„ Zd„ Zd„ Zd„ Z	eZ
 ej                  d	d
¬«      d„ «       Z ej                  d	d¬«      d„ «       Zd„ Zy)Ú
GridFinderzŸ
    Internal helper for `~.grid_helper_curvelinear.GridHelperCurveLinear`, with
    the same constructor parameters; should not be directly instantiated.
    Nc                 óè   — |€t        dd«      }|€
t        «       }|€
t        «       }|€
t        «       }|€
t        «       }|| _        || _        || _        || _        || _        | j                  |«       y )Né   )	r+   ÚMaxNLocatorÚFormatterPrettyPrintÚextreme_finderÚgrid_locator1Úgrid_locator2Útick_formatter1Útick_formatter2Úset_transform)r/   rF   rj   rk   rl   rm   rn   s          r(   r0   zGridFinder.__init__‡   s‚   € ð Ð!Ü0°°RÓ8ˆNØÐ Ü'›MˆMØÐ Ü'›MˆMØÐ"Ü2Ó4ˆOØÐ"Ü2Ó4ˆOØ,ˆÔØ*ˆÔØ*ˆÔØ.ˆÔØ.ˆÔØ×Ñ˜9Õ%r1   c                 óÈ   — t        j                  | j                  | j                  dœ|¬«      }t	        |t
        j                  «      r|j                  |«      S  ||||«      S )a™  
        Helper to support both standard formatters (inheriting from
        `.mticker.Formatter`) and axisartist-specific ones; should be called instead of
        directly calling ``self.tick_formatter1`` and ``self.tick_formatter2``.  This
        method should be considered as a temporary workaround which will be removed in
        the future at the same time as axisartist-specific formatters.
        )r   r@   )Úidx)r   Úgetitem_checkedrm   rn   Ú
isinstanceÚmtickerÚ	FormatterÚformat_ticks)r/   rq   Ú	directionÚfactorÚlevelsÚfmts         r(   Ú_format_tickszGridFinder._format_ticksŸ   s^   € ô ×"Ñ"Ø×$Ñ$¨×)=Ñ)=Ñ>ÀCôIˆä,6°s¼G×<MÑ<MÔ,N�× Ñ  Ó(ð 	5Ù˜ F¨FÓ3ð	5r1   c           	      ó.  — t        j                  d„ d„ gg|¢­i |¤Ž}d|v r<t        j                  dd¬«       t        j                  |d   |d   |d   |d	   «      }n|d
   }| j
                  j                  | j                  «       j                  «       |«      } | j                  |j                  Ž \  }}} | j                  |j                  Ž \  }	}
}t        j                  |d| «      |z  }t        j                  |	d|
 «      |z  }| j                  |||«      \  }}|j!                  dd«      }d|i}dd||||fdd|	|||ffD ]Æ  \  }}}}}}|g g g g dœdœx||<   }t#        |||«      D ]I  \  }}}t%        ||«      }t#        g d¢|«      D ]&  \  }}|D ]  }|d   |   j'                  ||dœ«       Œ Œ( ŒK |d   D ]M  }|d   |   D � cg c]  } | d   ‘Œ	 }} | j)                  ||||«      }!t#        |d   |   |!«      D ]
  \  } }"|"| d<   Œ ŒO ŒÈ |S c c} w )zp
        Compute positioning information for grid lines and ticks, given the
        axes' data *bbox*.
        c                 ó   — t        «       S rX   ©Úlocals)r7   r9   r;   r<   s       r(   ú<lambda>z*GridFinder.get_grid_info.<locals>.<lambda>²   s   € ¤F£H€ r1   c                 ó   — t        «       S rX   r~   )r   s    r(   r€   z*GridFinder.get_grid_info.<locals>.<lambda>²   s   € ¼6»8€ r1   r7   ú3.11z™Passing extents as separate arguments to get_grid_info is deprecated since %(since)s and support will be removed %(removal)s; pass a single bbox instead.)Úmessager9   r;   r<   r   Ngp¾   ð?Úextremesr   Úlonr@   Úlat)ÚleftÚrightÚbottomÚtop)ÚlinesÚticksrŒ   )ÚlevelÚlocr�   Úlabel)r   Úselect_matching_signatureÚwarn_deprecatedr   r5   rj   r3   Úget_transformr_   rk   Ú	intervalxrl   Ú	intervalyr   ÚasarrayÚ_get_raw_grid_linesrG   r   r)   r   r{   )#r/   ÚargsÚkwargsÚparamsr   r=   Úlon_levsÚlon_nÚ
lon_factorÚlat_levsÚlat_nÚ
lat_factorÚ
lon_valuesÚ
lat_valuesÚ	lon_linesÚ	lat_linesÚbbox_expandedÚ	grid_inforq   Ú
lon_or_latÚlevsrx   rZ   r‹   Úgir   r&   r�   Úall_crossingsÚsider   ÚcrossingÚtickÚlabelsr�   s#                                      r(   Úget_grid_infozGridFinder.get_grid_info¬   s¸  € ô
 ×/Ñ/Ù,Ñ.CÐDðWØGKòWØOUñWˆà�6‰>Ü× Ñ  ð'õ)ô ×$Ñ$Ø�t‘˜f T™l¨F°4©L¸&À¹,óH‰Dð ˜&‘>ˆDà×#Ñ#×:Ñ:Ø×ÑÓ ×)Ñ)Ó+¨Tó3ˆð '9 d×&8Ñ&8¸%¿/¹/Ð&JÑ#ˆ�%˜Ø&8 d×&8Ñ&8¸%¿/¹/Ð&JÑ#ˆ�%˜ä—Z‘Z ¨¨%Ð 0Ó1°JÑ>ˆ
Ü—Z‘Z ¨¨%Ð 0Ó1°JÑ>ˆ
à#×7Ñ7¸
ÀJÐPUÓVÑˆ	�9àŸ™ i°Ó;ˆØ Ð'ˆ	ð �E˜8 Z°¸YÐGØ�E˜8 Z°¸YÐGð=
ò 	*Ñ8ˆC�˜T 6¨6°5ð
 Ø"$¨r¸RÈÑKñ*ð ˆI�jÑ! Bô "% U¨F°DÓ!9ò T‘��Q˜Ü 8¸¸mÓ L�Ü'*Ú:¸Mó(Kò T‘O�D˜)à$-ò T˜Ø˜7™ DÑ)×0Ñ0¸5ÈÑ1RÕSñTñTðTð ˜7™ò *�Ø24°W±+¸dÑ2CÖD¨$˜˜W›ÐD�ÐDØ×+Ñ+¨C°°v¸tÓD�Ü#& r¨'¡{°4Ñ'8¸&Ó#Aò *‘K�D˜%Ø$)�D˜’Mñ*ñ*ð	*ð( Ðùò Es   ÇHc                 ó  — | j                  «       }t        j                  |j                  |j                  d«      }t        j                  |j
                  |j                  d«      }|D �cg c]<  }|j                  t        j                  t        j                  ||«      |g«      «      ‘Œ> }}|D �	cg c]<  }	|j                  t        j                  |t        j                  ||	«      g«      «      ‘Œ> }
}	||
fS c c}w c c}	w )Néd   )
r’   r   rC   r6   r7   r8   r9   rF   Úcolumn_stackÚ	full_like)r/   r    r¡   r   rH   ÚlonsÚlatsr…   r¢   r†   r£   s              r(   r–   zGridFinder._get_raw_grid_linesá   sÙ   € Ø×"Ñ"Ó$ˆÜ�{‰{˜4Ÿ7™7 D§G¡G¨SÓ1ˆÜ�{‰{˜4Ÿ7™7 D§G¡G¨SÓ1ˆà *ö,Øð —_‘_¤R§_¡_´b·l±lÀ4ÈÓ6MÈtÐ5TÓ%UÕVð ,ˆ	ð ,ð !+ö,Øð —_‘_¤R§_¡_°d¼B¿L¹LÈÈsÓ<SÐ5TÓ%UÕVð ,ˆ	ð ,à˜)Ð#Ð#ùò	,ùò,s   Á+AC9Â2AC>c                 ó²   — t        |t        «      r|| _        y t        |«      dk(  r't	        t        t        |«      «      rt        |Ž | _        y t        d«      ‚)Nr@   zF'aux_trans' must be either a Transform instance or a pair of callables)	rs   r   Ú_aux_transformÚlenÚallÚmapÚcallabler4   Ú	TypeError)r/   Ú	aux_transs     r(   ro   zGridFinder.set_transformë   sM   € Ü�i¤Ô+Ø"+ˆDÕÜ�‹^˜qÒ ¤S¬¬X°yÓ)AÔ%BÜ"2°IÐ">ˆDÕäð >ó ?ð ?r1   c                 ó   — | j                   S rX   )r¶   r^   s    r(   r’   zGridFinder.get_transformô   s   € Ø×"Ñ"Ð"r1   r‚   zgrid_finder.get_transform())Úalternativec                 óv   — | j                   j                  t        j                  ||g«      «      j                  S rX   )r¶   rF   r   r±   r   ©r/   ÚxÚys      r(   r:   zGridFinder.transform_xyù   s,   € à×"Ñ"×,Ñ,¬R¯_©_¸aÀ¸VÓ-DÓE×GÑGÐGr1   z&grid_finder.get_transform().inverted()c                 ó’   — | j                   j                  «       j                  t        j                  ||g«      «      j
                  S rX   )r¶   r_   rF   r   r±   r   rÀ   s      r(   Úinv_transform_xyzGridFinder.inv_transform_xyý   s9   € à×"Ñ"×+Ñ+Ó-×7Ñ7Ü�O‰O˜Q ˜FÓ#ó%ß%&¡Qð	'r1   c                 ór   — |j                  «       D ]$  \  }}|dv rt        | ||«       Œt        d|›�«      ‚ y )N)rj   rk   rl   rm   rn   zUnknown update property )ÚitemsÚsetattrÚ
ValueError)r/   r˜   Úkr&   s       r(   ÚupdatezGridFinder.update  sK   € Ø—L‘L“Nò 	C‰DˆAˆqØð (ñ (ô
 ˜˜a Õ#ä Ð#;¸A¸5Ð!AÓBÐBñ	Cr1   )NNNNN)rJ   rK   rL   rM   r0   r{   r®   r–   ro   r’   Úupdate_transformr   Ú
deprecatedr:   rÄ   rÊ   rN   r1   r(   re   re   �   s‹   „ ñð !%Ø#Ø#Ø!%Ø!%ó&ò05ò3òj$ò?ò#ð %Ðà€T‡_�_�VÐ)FÔGñHó HðHð €T‡_�_�VÐ)QÔRñ'ó Sð'ó	Cr1   re   c                   ó4   ‡ — e Zd Z	 	 	 	 	 dˆ fd„	Zˆ fd„Zˆ xZS )rh   c                 óN   •— t         ‰| �  |||||¬«       | j                  «        y )N)ÚstepsÚintegerÚ	symmetricÚprune)rQ   r0   Úcreate_dummy_axis)r/   ÚnbinsrÏ   ÚtrimrÐ   rÑ   rÒ   rV   s          €r(   r0   zMaxNLocator.__init__  s.   ø€ ô 	‰Ñ˜ e°WØ#,°Eð 	ô 	;à×ÑÕ r1   c                 óf   •— t         ‰| �  ||«      }t        j                  |«      t	        |«      dfS ©Nr   )rQ   Útick_valuesr   Úarrayr·   )r/   Úv1Úv2ÚlocsrV   s       €r(   r>   zMaxNLocator.__call__  s-   ø€ Ü‰wÑ" 2 rÓ*ˆÜ�x‰x˜‹~œs 4›y¨!Ð+Ð+r1   )é
   NTFFN©rJ   rK   rL   r0   r>   rb   rc   s   @r(   rh   rh     s!   ø„ Ø'+ØØØ Øõ	!÷,ð ,r1   rh   c                   ó   — e Zd Zd„ Zd„ Zy)ÚFixedLocatorc                 ó   — || _         y rX   )Ú_locs)r/   rÜ   s     r(   r0   zFixedLocator.__init__  s	   € Øˆ�
r1   c                 óÀ   — t        ||g«      \  }}t        j                  | j                  D �cg c]  }||cxk  r|k  sŒn n|‘Œ c}«      }|t	        |«      dfS c c}w r×   )Úsortedr   rÙ   râ   r·   )r/   rÚ   rÛ   ÚlrÜ   s        r(   r>   zFixedLocator.__call__"  sR   € Ü˜˜R˜Ó!‰ˆˆBÜ�x‰x D§J¡JÖ@˜q°"¸´-¸R¶-šÒ@ÓAˆØ”S˜“Y Ð!Ð!ùò As
   ®A¿AN©rJ   rK   rL   r0   r>   rN   r1   r(   rà   rà     s   „ òó"r1   rà   c                   ó   — e Zd Zdd„Zd„ Zy)ri   c                 óp   — t        j                  |d¬«      | _        | j                  j                  «        y )NF)ÚuseMathTextÚ	useOffset)rt   ÚScalarFormatterÚ_fmtrÓ   )r/   ré   s     r(   r0   zFormatterPrettyPrint.__init__+  s)   € Ü×+Ñ+Ø#¨uô6ˆŒ	à�	‰	×#Ñ#Õ%r1   c                 ó8   — | j                   j                  |«      S rX   )rì   rv   )r/   rw   rx   rZ   s       r(   r>   zFormatterPrettyPrint.__call__0  s   € Ø�y‰y×%Ñ% fÓ-Ð-r1   N)Træ   rN   r1   r(   ri   ri   *  s   „ ó&ó
.r1   ri   c                   ó&   ‡ — e Zd Zdˆ fd„	Zd„ Zˆ xZS )ÚDictFormatterc                 ó>   •— t         ‰| �  «        || _        || _        y)zq
        format_dict : dictionary for format strings to be used.
        formatter : fall-back formatter
        N)rQ   r0   Ú_format_dictÚ_fallback_formatter)r/   Úformat_dictÚ	formatterrV   s      €r(   r0   zDictFormatter.__init__5  s    ø€ ô
 	‰ÑÔØ'ˆÔØ#,ˆÕ r1   c                 óÞ   — | j                   r| j                  |||«      }ndgt        |«      z  }t        ||«      D ��cg c]!  \  }}| j                  j	                  ||«      ‘Œ# c}}S c c}}w )zG
        factor is ignored if value is found in the dictionary
        Ú )rò   r·   r   rñ   Úget)r/   rw   rx   rZ   Úfallback_stringsrÉ   r&   s          r(   r>   zDictFormatter.__call__>  sw   € ð ×#Ò#Ø#×7Ñ7Ø˜6 6ó +Ñð !#˜t¤c¨&£kÑ1Ðä Ð(8Ó9÷;Ù�A�qð ×!Ñ!×%Ñ% a¨Õ+ó ;ð 	;ùó ;s   ¿&A)rX   rÞ   rc   s   @r(   rï   rï   4  s   ø„ õ-ö
;r1   rï   )Únumpyr   Ú
matplotlibr   rt   r   Úmatplotlib.transformsr   r   r)   r+   r4   re   rh   rà   ri   rï   rN   r1   r(   ú<module>rü      sl   ðÛ ç .ß 1ò$÷N4@ñ 4@ôn9�yô 9÷8JCñ JCôZ,�'×%Ñ%ô ,÷ "ñ "÷.ñ .÷;ò ;r1   