o
    Pfp                     @   sN   d dl mZ d dlmZ d dlmZmZ d dlmZm	Z	 G dd deeZ
dS )    )Template)
JSCSSMixin)LayerMarker)parse_optionsvalidate_locationsc                       sJ   e Zd ZdZedZdgZddgZ									d
 fdd		Z  Z	S )MarkerClustera  
    Provides Beautiful Animated Marker Clustering functionality for maps.

    Parameters
    ----------
    locations: list of list or array of shape (n, 2).
        Data points of the form [[lat, lng]].
    popups: list of length n, default None
        Popup for each marker, either a Popup object or a string or None.
    icons: list of length n, default None
        Icon for each marker, either an Icon object or a string or None.
    name : string, default None
        The name of the Layer, as it will appear in LayerControls
    overlay : bool, default True
        Adds the layer as an optional overlay (True) or the base layer (False).
    control : bool, default True
        Whether the Layer will be included in LayerControls.
    show: bool, default True
        Whether the layer will be shown on opening.
    icon_create_function : string, default None
        Override the default behaviour, making possible to customize
        markers colors and sizes.
    options : dict, default None
        A dictionary with options for Leaflet.markercluster. See
        https://github.com/Leaflet/Leaflet.markercluster for options.

    Example
    -------
    >>> icon_create_function = '''
    ...     function(cluster) {
    ...     return L.divIcon({html: '<b>' + cluster.getChildCount() + '</b>',
    ...                       className: 'marker-cluster marker-cluster-small',
    ...                       iconSize: new L.Point(20, 20)});
    ...     }
    ... '''

    a  
        {% macro script(this, kwargs) %}
            var {{ this.get_name() }} = L.markerClusterGroup(
                {{ this.options|tojson }}
            );
            {%- if this.icon_create_function is not none %}
            {{ this.get_name() }}.options.iconCreateFunction =
                {{ this.icon_create_function.strip() }};
            {%- endif %}
        {% endmacro %}
        )markerclusterjsz[https://cdnjs.cloudflare.com/ajax/libs/leaflet.markercluster/1.1.0/leaflet.markercluster.js)markerclustercsszThttps://cdnjs.cloudflare.com/ajax/libs/leaflet.markercluster/1.1.0/MarkerCluster.css)markerclusterdefaultcssz\https://cdnjs.cloudflare.com/ajax/libs/leaflet.markercluster/1.1.0/MarkerCluster.Default.cssNTc
                    s   |	d ur	|
 |	 t j||||d d| _|d ur9t|}t|D ]\}}| t||o/|| |o4|| d q"tdi |
| _	|d urLt
|tsLJ || _d S )N)nameoverlaycontrolshowr   )popupicon )updatesuper__init___namer   	enumerate	add_childr   r   options
isinstancestricon_create_function)self	locationspopupsiconsr   r   r   r   r   r   kwargsilocation	__class__r   i/home/deployuser/azure_apps/autowriter/venv/lib/python3.10/site-packages/folium/plugins/marker_cluster.pyr   O   s    

zMarkerCluster.__init__)	NNNNTTTNN)
__name__
__module____qualname____doc__r   	_template
default_jsdefault_cssr   __classcell__r   r   r$   r&   r      s(    &r   N)jinja2r   folium.elementsr   
folium.mapr   r   folium.utilitiesr   r   r   r   r   r   r&   <module>   s
    