o
    Pf                     @   sR   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	 G dd deeZ
dS )	    )MacroElement)Template)
JSCSSMixin)WmsTileLayer)parse_optionsc                       sD   e Zd ZdZedZg dZddgZ					d fd	d
	Z  Z	S )TimestampedWmsTileLayersa^  
    Creates a TimestampedWmsTileLayer that takes a WmsTileLayer and adds time
    control with the Leaflet.TimeDimension plugin.

    Parameters
    ----------
    data: WmsTileLayer.
        The WmsTileLayer that you want to add time support to.
        Must  be created like a typical WmsTileLayer and added to the map
        before being passed to this class.

    transition_time: int, default 200.
        The duration in ms of a transition from between timestamps.
    loop: bool, default False
        Whether the animation shall loop, default is to reduce load on WMS
        services.
    auto_play: bool, default False
        Whether the animation shall start automatically at startup, default
        is to reduce load on WMS services.
    period: str, default 'P1D'
        Used to construct the array of available times starting
        from the first available time. Format: ISO8601 Duration
        ex: 'P1M' -> 1/month, 'P1D' -> 1/day, 'PT1H' -> 1/hour, and 'PT1M' -> 1/minute
        Note: this seems to be overridden by the WMS Tile Layer GetCapabilities.

    Examples
    --------
    >>> w0 = WmsTileLayer(
    ...     "http://this.wms.server/ncWMS/wms",
    ...     name="Test WMS Data",
    ...     styles="",
    ...     fmt="image/png",
    ...     transparent=True,
    ...     layers="test_data",
    ...     COLORSCALERANGE="0,10",
    ... )
    >>> w0.add_to(m)
    >>> w1 = WmsTileLayer(
    ...     "http://this.wms.server/ncWMS/wms",
    ...     name="Test WMS Data",
    ...     styles="",
    ...     fmt="image/png",
    ...     transparent=True,
    ...     layers="test_data_2",
    ...     COLORSCALERANGE="0,5",
    ... )
    >>> w1.add_to(m)
    >>> # Add WmsTileLayers to time control.
    >>> time = TimestampedWmsTileLayers([w0, w1])
    >>> time.add_to(m)

    See https://github.com/socib/Leaflet.TimeDimension for more information.

    a  
        {% macro script(this, kwargs) %}
            {{ this._parent.get_name() }}.timeDimension = L.timeDimension(
                {{ this.options|tojson }}
            );
            {{ this._parent.get_name() }}.timeDimensionControl =
                L.control.timeDimension(
                    {{ this.options_control|tojson }}
                );
            {{ this._parent.get_name() }}.addControl(
                {{ this._parent.get_name() }}.timeDimensionControl
            );

            {% for layer in this.layers %}
            var {{ layer.get_name() }} = L.timeDimension.layer.wms(
                {{ layer.get_name() }},
                {
                    updateTimeDimension: false,
                    wmsVersion: {{ layer.options['version']|tojson }},
                }
            ).addTo({{ this._parent.get_name() }});
            {% endfor %}
        {% endmacro %}
        ))zjquery3.7.1zAhttps://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js)zjqueryui1.10.2zGhttps://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.10.2/jquery-ui.min.js)iso8601zChttps://cdn.jsdelivr.net/npm/iso8601-js-period@0.2.1/iso8601.min.js)zleaflet.timedimensionzZhttps://cdn.jsdelivr.net/npm/leaflet-timedimension@1.1.1/dist/leaflet.timedimension.min.js)zhighlight.js_csszNhttps://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.4/styles/default.min.css)zleaflet.timedimension_cssz_https://cdn.jsdelivr.net/npm/leaflet-timedimension@1.1.1/dist/leaflet.timedimension.control.css   FP1Dc                    sX   t    d| _t||d| _td|t||dd| _t|tr'|g| _	d S || _	d S )Nr   )periodtime_interval
bottomleft)transitionTimeloop)position	auto_playplayer_options)
super__init___namer   optionsintoptions_control
isinstancer   layers)selfdatatransition_timer   r   r   r   	__class__ s/home/deployuser/azure_apps/autowriter/venv/lib/python3.10/site-packages/folium/plugins/timestamped_wmstilelayer.pyr   y   s    
	

z!TimestampedWmsTileLayers.__init__)r	   FFr
   F)
__name__
__module____qualname____doc__r   	_template
default_jsdefault_cssr   __classcell__r    r    r   r!   r   	   s    7r   N)branca.elementr   jinja2r   folium.elementsr   folium.raster_layersr   folium.utilitiesr   r   r    r    r    r!   <module>   s    