U
    /eE                     @  s  d Z ddlmZ ddlZeeZddlmZ ddl	m
Z
 ddlmZmZmZmZmZmZmZmZmZmZ ddlmZmZ dd	lmZmZmZ dd
lmZ ddlm Z  ddl!m"Z" ddl#m$Z$ dZ%e
G dd de Z&e
G dd de$Z'G dd de&Z(G dd de'Z)dS )z- Models for displaying maps in Bokeh plots.

    )annotationsN   )MapType)abstract)
JSONBase64StringBoolEnumFloatInstanceIntNonNullableOverrideString)errorwarning)INCOMPATIBLE_MAP_RANGE_TYPEMISSING_GOOGLE_API_KEYREQUIRED_RANGE)MISSING_RENDERERS)ModelRange1d   )Plot)GMapOptionsGMapPlot
MapOptionsMapPlotc                   @  s4   e Zd ZdZeeddZeeddZedddZ	dS )r   z3 Abstract base class for map options' models.

    z8
    The latitude where the map should be centered.
    helpz9
    The longitude where the map should be centered.
       z@
    The initial zoom level to use when displaying the map.
    N)
__name__
__module____qualname____doc__r   r
   ZlatZlngr   Zzoom r&   r&   :/tmp/pip-unpacked-wheel-f5fndrjf/bokeh/models/map_plots.pyr   <   s   r   c                      s6   e Zd ZdZdd fddZeedd Z  ZS )r   z/ Abstract base class for map plot models.

    None)returnc                   sL   ddl m} dD ](}||krt|||std| qt j|| d S )Nr   r   )x_rangey_rangezIInvalid value for %r, MapPlot ranges may only be Range1d, not data ranges)models.rangesr   
isinstanceget
ValueErrorsuper__init__)selfargskwr   r	__class__r&   r'   r1   T   s
    zMapPlot.__init__c                 C  sT   ddl m} | jd k	r.t| j|s.dt|  S | jd k	rPt| j|sPdt|  S d S )Nr   r   z
%s.x_rangez
%s.y_range)r,   r   r*   r-   strr+   )r2   r   r&   r&   r'   "_check_incompatible_map_range_type[   s
    z*MapPlot._check_incompatible_map_range_type)	r"   r#   r$   r%   r1   r   r   r9   __classcell__r&   r&   r6   r'   r   N   s   r   c                   @  sB   e Zd ZdZeedddZedddZe	e
ddZed	d
dZdS )r   z( Options for ``GMapPlot`` objects.

    Zroadmapz
    The `map type`_ to use for the ``GMapPlot``.

    .. _map type: https://developers.google.com/maps/documentation/javascript/reference#MapTypeId

    defaultr    FzK
    Whether the Google map should display its distance scale control.
    a	  
    A JSON array of `map styles`_ to use for the ``GMapPlot``. Many example styles can
    `be found here`_.

    .. _map styles: https://developers.google.com/maps/documentation/javascript/reference#MapTypeStyle
    .. _be found here: https://snazzymaps.com

    r   -   a  
    `Tilt`_ angle of the map. The only allowed values are 0 and 45.
    Only has an effect on 'satellite' and 'hybrid' map types.
    A value of 0 causes the map to always use a 0 degree overhead view.
    A value of 45 causes the tilt angle to switch to 45 imagery if available.

    .. _Tilt: https://developers.google.com/maps/documentation/javascript/reference/3/map#MapOptions.tilt

    N)r"   r#   r$   r%   r	   r   Zmap_typer   Zscale_controlr   r   Zstylesr   Ztiltr&   r&   r&   r'   r   c   s
   	r   c                   @  s   e Zd ZdZeedd Zeedd Z	ee
dd Zeedd	Zed
dZeedd	ZedddZedd dZedd dZdS )r   an   A Bokeh Plot with a `Google Map`_ displayed underneath.

    Data placed on this plot should be specified in decimal lat/lon coordinates
    e.g. ``(37.123, -122.404)``. It will be automatically converted into the
    web mercator projection to display properly over google maps tiles.

    The ``api_key`` property must be configured with a Google API Key in order
    for ``GMapPlot`` to function. The key will be stored in the Bokeh Document
    JSON.

    Note that Google Maps exert explicit control over aspect ratios at all
    times, which imposes some limitations on ``GMapPlot``:

    * Only ``Range1d`` ranges are supported. Attempting to use other range
      types will result in an error.

    * Usage of ``BoxZoomTool`` is incompatible with ``GMapPlot``. Adding a
      ``BoxZoomTool`` will have no effect.

    .. _Google Map: https://www.google.com/maps/

    c                 C  s   d S Nr&   r2   r&   r&   r'   _check_required_range   s    zGMapPlot._check_required_rangec                 C  s   d S r>   r&   r?   r&   r&   r'   _check_missing_renderers   s    z!GMapPlot._check_missing_renderersc                 C  s   | j d krt| S d S r>   )api_keyr8   r?   r&   r&   r'   _check_missing_google_api_key   s    
z&GMapPlot._check_missing_google_api_keyz*
    Options for displaying the plot.
    r   z#ffffff)r<   z
    Google Maps API requires an API key. See https://developers.google.com/maps/documentation/javascript/get-api-key
    for more information on how to obtain your own.
    Zweeklyz
    The version of Google Maps API to use. See https://developers.google.com/maps/documentation/javascript/versions
    for more information.

    .. note::
        Changing this value may result in broken map rendering.

    r;   c                   C  s   t  S r>   r   r&   r&   r&   r'   <lambda>       zGMapPlot.<lambda>c                   C  s   t  S r>   r   r&   r&   r&   r'   rD      rE   N)r"   r#   r$   r%   r   r   r@   r   r   rA   r   rC   r   r   Zmap_optionsr   Zborder_fill_colorr   r   rB   r   api_versionr*   r+   r&   r&   r&   r'   r      s   



	r   )*r%   
__future__r   logging	getLoggerr"   logZ
core.enumsr   Zcore.has_propsr   Zcore.propertiesr   r   r   r	   r
   r   r   r   r   r   Zcore.validationr   r   Zcore.validation.errorsr   r   r   Zcore.validation.warningsr   modelr   r,   r   Zplotsr   __all__r   r   r   r   r&   r&   r&   r'   <module>   s&   
0#