Class for drawing AntPath polyline overlays on a map. See :func:`folium.vector_layers.path_options` for the `Path` options. Parameters ---------- locations: list of points (latitude, longitude) Latitude and Longitude of line (Northing, Easting) popup: str or folium
| 4 | |
| 5 | |
| 6 | class AntPath(JSCSSMixin, BaseMultiLocation): |
| 7 | """ |
| 8 | Class for drawing AntPath polyline overlays on a map. |
| 9 | |
| 10 | See :func:`folium.vector_layers.path_options` for the `Path` options. |
| 11 | |
| 12 | Parameters |
| 13 | ---------- |
| 14 | locations: list of points (latitude, longitude) |
| 15 | Latitude and Longitude of line (Northing, Easting) |
| 16 | popup: str or folium.Popup, default None |
| 17 | Input text or visualization for object displayed when clicking. |
| 18 | tooltip: str or folium.Tooltip, optional |
| 19 | Display a text when hovering over the object. |
| 20 | **kwargs: |
| 21 | Polyline and AntPath options. See their Github page for the |
| 22 | available parameters. |
| 23 | |
| 24 | https://github.com/rubenspgcavalcante/leaflet-ant-path/ |
| 25 | |
| 26 | """ |
| 27 | |
| 28 | _template = Template( |
| 29 | """ |
| 30 | {% macro script(this, kwargs) %} |
| 31 | {{ this.get_name() }} = L.polyline.antPath( |
| 32 | {{ this.locations|tojson }}, |
| 33 | {{ this.options|tojavascript }} |
| 34 | ).addTo({{this._parent.get_name()}}); |
| 35 | {% endmacro %} |
| 36 | """ |
| 37 | ) |
| 38 | |
| 39 | default_js = [ |
| 40 | ( |
| 41 | "antpath", |
| 42 | "https://cdn.jsdelivr.net/npm/leaflet-ant-path@1.1.2/dist/leaflet-ant-path.min.js", |
| 43 | ) |
| 44 | ] |
| 45 | |
| 46 | def __init__(self, locations, popup=None, tooltip=None, **kwargs): |
| 47 | super().__init__( |
| 48 | locations, |
| 49 | popup=popup, |
| 50 | tooltip=tooltip, |
| 51 | ) |
| 52 | |
| 53 | self._name = "AntPath" |
| 54 | # Polyline + AntPath defaults. |
| 55 | self.options = path_options(line=True, **kwargs) |
| 56 | self.options.update( |
| 57 | { |
| 58 | "paused": kwargs.pop("paused", False), |
| 59 | "reverse": kwargs.pop("reverse", False), |
| 60 | "hardwareAcceleration": kwargs.pop("hardware_acceleration", False), |
| 61 | "delay": kwargs.pop("delay", 400), |
| 62 | "dashArray": kwargs.pop("dash_array", [10, 20]), |
| 63 | "weight": kwargs.pop("weight", 5), |
nothing calls this directly
no test coverage detected
searching dependent graphs…