def __init__(self, locations, color=None, weight=None, opacity=None, latlon=True, popup=None): super(PolyLine, self).__init__() self._name = 'PolyLine' self.data = (_locations_mirror(locations) if not latlon else _locations_tolist(locations)) self.color = color self.weight = weight self.opacity = opacity if isinstance(popup, text_type) or isinstance(popup, binary_type): self.add_child(Popup(popup)) elif popup is not None: self.add_child(popup) self._template = Template(u""" {% macro script(this, kwargs) %} var {{this.get_name()}} = L.polyline( {{this.data}}, { {% if this.color != None %}color: '{{ this.color }}',{% endif %} {% if this.weight != None %}weight: {{ this.weight }},{% endif %} {% if this.opacity != None %}opacity: {{ this.opacity }},{% endif %} }); {{this._parent.get_name()}}.addLayer({{this.get_name()}}); {% endmacro %} """) # noqa
def __init__(self, locations, color=None, weight=None, opacity=None, latlon=True, popup=None): super(MultiPolyLine, self).__init__() self._name = 'MultiPolyLine' self.data = (_locations_mirror(locations) if not latlon else _locations_tolist(locations)) self.color = color self.weight = weight self.opacity = opacity if isinstance(popup, text_type) or isinstance(popup, binary_type): self.add_child(Popup(popup)) elif popup is not None: self.add_child(popup) self._template = Template(u""" {% macro script(this, kwargs) %} var {{this.get_name()}} = L.multiPolyline( {{this.data}}, { {% if this.color != None %}color: '{{ this.color }}',{% endif %} {% if this.weight != None %}weight: {{ this.weight }},{% endif %} {% if this.opacity != None %}opacity: {{ this.opacity }},{% endif %} }); {{this._parent.get_name()}}.addLayer({{this.get_name()}}); {% endmacro %} """) # noqa
def __init__(self, locations, color='black', weight=1, fill_color='black', fill_opacity=0.6, popup=None, latlon=True): """ Creates a PolygonMarker object for plotting on a Map. Parameters ---------- locations: tuple or list, default None Latitude and Longitude of Polygon color: string, default ('black') Edge color of a polygon. weight: float, default (1) Edge line width of a polygon. fill_color: string, default ('black') Fill color of a polygon. fill_opacity: float, default (0.6) Fill opacity of a polygon. popup: string or folium.Popup, default None Input text or visualization for object. Returns ------- folium.features.Polygon object Examples -------- >>> locations = [[35.6762, 139.7795], ... [35.6718, 139.7831], ... [35.6767, 139.7868], ... [35.6795, 139.7824], ... [35.6787, 139.7791]] >>> Polygon(locations, color='blue', weight=10, fill_color='red', ... fill_opacity=0.5, popup='Tokyo, Japan')) """ super(PolygonMarker, self).__init__(( _locations_mirror(locations) if not latlon else _locations_tolist(locations)), popup=popup ) self._name = 'PolygonMarker' self.color = color self.weight = weight self.fill_color = fill_color self.fill_opacity = fill_opacity self._template = Template(u""" {% macro script(this, kwargs) %} var {{this.get_name()}} = L.polygon({{this.location}}, { color: '{{ this.color }}', fillColor: '{{ this.fill_color }}', fillOpacity: {{ this.fill_opacity }}, weight: {{ this.weight }} }).addTo({{this._parent.get_name()}}); {% endmacro %} """)
def __init__(self, location, color='black', opacity=1, weight=2, fill_color='blue', fill_opacity=1, number_of_sides=4, rotation=0, radius=15, popup=None, tooltip=None): super(RegularPolygonMarker, self).__init__( _locations_tolist(location), popup=popup, tooltip=tooltip ) self._name = 'RegularPolygonMarker' self.color = color self.opacity = opacity self.weight = weight self.fill_color = fill_color self.fill_opacity = fill_opacity self.number_of_sides = number_of_sides self.rotation = rotation self.radius = radius
def __init__(self, location, color='black', opacity=1, weight=2, fill_color='blue', fill_opacity=1, number_of_sides=4, rotation=0, radius=15, popup=None): super(RegularPolygonMarker, self).__init__(_locations_tolist(location), popup=popup) self._name = 'RegularPolygonMarker' self.color = color self.opacity = opacity self.weight = weight self.fill_color = fill_color self.fill_opacity = fill_opacity self.number_of_sides = number_of_sides self.rotation = rotation self.radius = radius self._template = Template(u""" {% macro script(this, kwargs) %} var {{this.get_name()}} = new L.RegularPolygonMarker( new L.LatLng({{this.location[0]}},{{this.location[1]}}), { icon : new L.Icon.Default(), color: '{{this.color}}', opacity: {{this.opacity}}, weight: {{this.weight}}, fillColor: '{{this.fill_color}}', fillOpacity: {{this.fill_opacity}}, numberOfSides: {{this.number_of_sides}}, rotation: {{this.rotation}}, radius: {{this.radius}} } ) .addTo({{this._parent.get_name()}}); {% endmacro %} """)
def __init__(self, location, color='black', opacity=1, weight=2, fill_color='blue', fill_opacity=1, number_of_sides=4, rotation=0, radius=15, popup=None): super(RegularPolygonMarker, self).__init__( _locations_tolist(location), popup=popup ) self._name = 'RegularPolygonMarker' self.color = color self.opacity = opacity self.weight = weight self.fill_color = fill_color self.fill_opacity = fill_opacity self.number_of_sides = number_of_sides self.rotation = rotation self.radius = radius self._template = Template(u""" {% macro script(this, kwargs) %} var {{this.get_name()}} = new L.RegularPolygonMarker( new L.LatLng({{this.location[0]}},{{this.location[1]}}), { icon : new L.Icon.Default(), color: '{{this.color}}', opacity: {{this.opacity}}, weight: {{this.weight}}, fillColor: '{{this.fill_color}}', fillOpacity: {{this.fill_opacity}}, numberOfSides: {{this.number_of_sides}}, rotation: {{this.rotation}}, radius: {{this.radius}} } ) .addTo({{this._parent.get_name()}}); {% endmacro %} """)