Ë
    ómxiO&  ã                   ó°   — d dl Z d dlZddlmZ ddlmZ ddlmZ ddlmZ	 ddl
mZ dd	lmZ dd
lmZ ddlmZmZ d„ Zdej(                  v Z G d„ de«      Zy)é    Né   )Ú	JSONMixin)ÚLayeré   )Údeck_to_html)Úsettings)ÚView)Ú	ViewState)ÚBaseMapProvider)ÚDARKÚget_from_map_identifierc                  óJ   — 	 ddl m}   | «        y# t        t        f$ r Y yw xY w)Nr   ©ÚDeckGLWidgetTF)Úwidgetr   ÚImportErrorÚNotImplementedErrorr   s    úK/home/htdocs/ttos/venv/lib/python3.12/site-packages/pydeck/bindings/deck.pyÚhas_jupyter_extrar      s*   € ðÝ)áŒØøÜÔ,Ð-ò Ùðús   ‚ �"¡"zgoogle.colabc                   ó¾   — e Zd Zd edd¬«      ged eddd¬«      dd	dddej                  j                  dfd
„Z	e
d„ «       Zddefd„Zd„ Zd„ Z	 	 	 	 	 	 	 dd„Zd„ Zy)ÚDeckNÚMapViewT)ÚtypeÚ
controllerr   r   )ÚlatitudeÚ	longitudeÚzoomú100%éô  c                 ó.  — g | _         t        |t        «      r| j                   j                  |«       n|xs g | _         || _        || _        |xs i }|	| _        |
| _        |rt        |«      j                  «       nd| _
        || _        t        «       r”ddlm}  |«       | _        t         j"                  | j                  _        t         j$                  | j                  _        || j                  _        || j                  _        || j                  _        || j                  _
        | j-                  |«       d}t        |t.        «      r3|t0        j2                  j4                  k(  sJ |«       ‚|| _        || _        yt9        ||«      | _        || _        y)a  This is the renderer and configuration for a deck.gl visualization, similar to the
        `Deck <https://deck.gl/docs/api-reference/core/deck>`_ class from deck.gl.
        Pass `Deck` a Mapbox API token to display a basemap; see the notes below.

        Parameters
        ----------

        layers : pydeck.Layer or list of pydeck.Layer, default None
            List of :class:`pydeck.bindings.layer.Layer` layers to render.
        views : list of pydeck.View, default ``[pydeck.View(type="MapView", controller=True)]``
            List of :class:`pydeck.bindings.view.View` objects to render.
        api_keys : dict, default None
            Dictionary of geospatial API service providers, where the keys are ``mapbox``, ``google_maps``, or ``carto``
            and the values are the API key. Defaults to None if not set. Any of the environment variables
            ``MAPBOX_API_KEY``, ``GOOGLE_MAPS_API_KEY``, and ``CARTO_API_KEY`` can be set instead of hardcoding the key here.
        map_provider : str, default 'carto'
            If multiple API keys are set (e.g., both Mapbox and Google Maps), inform pydeck which basemap provider to prefer.
            Values can be ``carto``, ``mapbox`` or ``google_maps``
        map_style : str or dict, default 'dark'
            One of 'light', 'dark', 'road', 'satellite', 'dark_no_labels', and 'light_no_labels', a URI for a basemap
            style, which varies by provider, or a dict that follows the Mapbox style `specification <https://docs.mapbox.com/mapbox-gl-js/style-spec/>`.
            The default is Carto's Dark Matter map. For Mapbox examples, see  Mapbox's `gallery <https://www.mapbox.com/gallery/>`.
            If not using a basemap, set ``map_provider=None``.
        initial_view_state : pydeck.ViewState, default ``pydeck.ViewState(latitude=0, longitude=0, zoom=1)``
            Initial camera angle relative to the map, defaults to a fully zoomed out 0, 0-centered map
            To compute a viewport from data, see :func:`pydeck.data_utils.viewport_helpers.compute_view`
        height : int, default 500
            Height of Jupyter notebook cell, in pixels.
        width : int` or string, default '100%'
            Width of visualization, in pixels (if a number) or as a CSS value string.
        tooltip : bool or dict of {str: str}, default True
            If ``True``/``False``, toggles a default tooltip on visualization hover.
            Layers must have ``pickable=True`` set in order to display a tooltip.
            For more advanced usage, the user can pass a dict to configure more custom tooltip features.
            Further documentation is `here <tooltip.html>`_.

        .. _Deck:
            https://deck.gl/docs/api-reference/core/deck
        .. _gallery:
            https://www.mapbox.com/gallery/
        Nr   r   zQThe map_provider parameter must be 'mapbox' when map_style is provided as a dict.)ÚlayersÚ
isinstancer   ÚappendÚviewsÚinitial_view_stateÚdescriptionÚeffectsÚstrÚlowerÚmap_providerÚ_tooltipr   r   r   Údeck_widgetÚpydeck_settingsÚcustom_librariesÚconfigurationÚheightÚwidthÚtooltipÚ_set_api_keysÚdictr   ÚMAPBOXÚvalueÚ	map_styler   Ú
parameters)Úselfr!   r$   r7   Úapi_keysr%   r1   r0   r2   r&   r'   r*   r8   r   Úcustom_map_style_errors                  r   Ú__init__zDeck.__init__   sS  € ðp ˆŒÜ�fœeÔ$Ø�K‰K×Ñ˜vÕ&à š, BˆDŒKØˆŒ
à"4ˆÔà’>˜rˆà&ˆÔØˆŒÙ9EœC Ó-×3Ñ3Ô5È4ˆÔØˆŒäÔÝ-á+›~ˆDÔÜ0?×0PÑ0PˆD×ÑÔ-Ü-<×-JÑ-JˆD×ÑÔ*à&,ˆD×ÑÔ#Ø%*ˆD×ÑÔ"Ø'.ˆD×ÑÔ$Ø,8ˆD×ÑÔ)à×Ñ˜8Ô$à!tÐä�i¤Ô&Ø¤?×#9Ñ#9×#?Ñ#?Ò?ÐWÐAWÓWÐ?Ø&ˆDŒNð %ˆ�ô 5°YÀÓMˆDŒNà$ˆ�ó    c                 ó\   — | j                   j                  sy | j                   j                  S ©N)r,   Úselected_data©r9   s    r   r@   zDeck.selected_data|   s&   € à×Ñ×-Ò-ØØ×Ñ×-Ñ-Ð-r=   r:   c                 óD  — |D ]  }|xr t        |«       Œ t         D ]�  }|j                  › d�}|j                  › d�}|j                  |j                  «      xs t	        j
                  |«      }t        | ||«       t        «       sŒkt        | j                  ||«       Œƒ y)zQSets API key for base map provider for both HTML embedding and the Jupyter widgetÚ_keyÚ_API_KEYN)	r   r6   ÚnameÚgetÚosÚgetenvÚsetattrr   r,   )r9   r:   ÚkÚproviderÚ	attr_nameÚprovider_env_varÚ
attr_values          r   r3   zDeck._set_api_keys‚   s—   € àò 	%ˆAØÒ$”/ !Ó$ùð	%ä'ò 	AˆHØ#Ÿ>™>Ð*¨$Ð/ˆIØ"*§-¡- °Ð9ÐØ!Ÿ™ h§n¡nÓ5ÒT¼¿¹ÐCSÓ9TˆJÜ�D˜) ZÔ0Ü Õ"Ü˜×(Ñ(¨)°ZÕ@ñ	Ar=   c                 ó&   — | j                  d¬«      S )z2Display current Deck object for a Jupyter notebookT©Únotebook_display)Úto_htmlrA   s    r   Úshowz	Deck.showŽ   s   € ð �|‰|¨Tˆ|Ó2Ð2r=   c                 ó   — t        d«      ‚)a  Update a deck.gl map to reflect the current configuration

        For example, if you've modified data passed to Layer and rendered the map using `.show()`,
        you can call `update` to change the data on the map.

        Intended for use in a Jupyter environment.
        zAJupyter-specific features not currently supported in pydeck v0.9.)r   rA   s    r   ÚupdatezDeck.update˜   s   € ô, "ØOó
ð 	
r=   c                 óÌ   — | j                  «       }	t        |	f| j                  | j                  |||||| j                  t
        j                  t
        j                  ||dœ|¤Ž}
|
S )a„  Write a file and loads it to an iframe, if in a Jupyter environment;
        otherwise, write a file and optionally open it in a web browser

        Parameters
        ----------
        filename : str, default None
            Name of the file.
        open_browser : bool, default False
            Whether a browser window will open or not after write.
        notebook_display : bool, default None
            Display the HTML output in an iframe if True. Set to True automatically if rendering in Jupyter.
        iframe_width : str or int, default '100%'
            Width of Jupyter notebook iframe in pixels, if rendered in a Jupyter environment.
        iframe_height : int, default 500
            Height of Jupyter notebook iframe in pixels, if rendered in Jupyter or Colab.
        as_string : bool, default False
            Returns HTML as a string, if True and ``filename`` is None.
        css_background_color : str, default None
            Background color for visualization, specified as a string in any format accepted for CSS colors.

        Returns
        -------
        str
            Returns absolute path of the file
        )Ú
mapbox_keyÚgoogle_maps_keyÚfilenameÚopen_browserrQ   Úiframe_heightÚiframe_widthr2   r.   r/   Ú	as_stringÚoffline)Úto_jsonr   rW   rX   r+   r-   r.   r/   )r9   rY   rZ   rQ   r\   r[   r]   r^   ÚkwargsÚ	deck_jsonÚfs              r   rR   zDeck.to_html²   sq   € ðH —L‘L“Nˆ	ÜØð
à—‘Ø ×0Ñ0ØØ%Ø-Ø'Ø%Ø—M‘MÜ,×=Ñ=Ü)×7Ñ7ØØñ
ð ñ
ˆð  ˆr=   c                 ó@   — | j                  d¬«      }t        |dd«      S )NTrP   ÚdataÚ )rR   Úgetattr)r9   Úhtmls     r   Ú_repr_html_zDeck._repr_html_é   s#   € ð �|‰|¨Tˆ|Ó2ˆÜ�t˜V RÓ(Ð(r=   r?   )NFNr   r   FF)Ú__name__Ú
__module__Ú__qualname__r	   r   r
   r   ÚCARTOr6   r<   Úpropertyr@   r4   r3   rS   rU   rR   rh   © r=   r   r   r      sœ   „ ð Ù˜¨tÔ4Ð5ØØÙ$¨a¸1À1ÔEØØØØØØ$×*Ñ*×0Ñ0Øó^%ð@ ñ.ó ð.ñ

A dó 
Aò3ò
ð8 ØØØØØØó5ón)r=   r   )rG   ÚsysÚ
json_toolsr   Úlayerr   Úio.htmlr   r   r-   Úviewr	   Ú
view_stater
   Úbase_map_providerr   Ú
map_stylesr   r   r   ÚmodulesÚin_google_colabr   rn   r=   r   ú<module>ry      sF   ðÛ 	Û 
å !Ý Ý "Ý 2Ý Ý !Ý .ß 5òð ! C§K¡KÐ/€ôR)ˆ9õ R)r=   