Skip to content

Commit 0b52d73

Browse files
committed
Putting features in the top namespace
1 parent b656b5e commit 0b52d73

File tree

2 files changed

+50
-31
lines changed

2 files changed

+50
-31
lines changed

examples/Features.ipynb

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -291,10 +291,10 @@
291291
"pp = features.Popup(\"hello\")\n",
292292
"ic = features.Icon(color='red')\n",
293293
"\n",
294-
"f.add_children(m)\n",
295-
"mk.add_children(ic)\n",
296-
"mk.add_children(pp)\n",
297-
"m.add_children(mk)\n",
294+
"f.add_child(m)\n",
295+
"mk.add_child(ic)\n",
296+
"mk.add_child(pp)\n",
297+
"m.add_child(mk)\n",
298298
"\n",
299299
"f"
300300
]
@@ -438,9 +438,9 @@
438438
"mk = features.RegularPolygonMarker([0,0])\n",
439439
"mk2 = features.RegularPolygonMarker([0,45])\n",
440440
"\n",
441-
"f.add_children(m)\n",
442-
"m.add_children(mk)\n",
443-
"m.add_children(mk2)\n",
441+
"f.add_child(m)\n",
442+
"m.add_child(mk)\n",
443+
"m.add_child(mk2)\n",
444444
"\n",
445445
"f"
446446
]
@@ -738,10 +738,10 @@
738738
"mk = features.Marker([0,0])\n",
739739
"p = features.Popup(\"Hello\")\n",
740740
"v = features.Vega(data, width=\"100%\", height=\"100%\")\n",
741-
"f.add_children(m)\n",
742-
"mk.add_children(p)\n",
743-
"p.add_children(v)\n",
744-
"m.add_children(mk)\n",
741+
"f.add_child(m)\n",
742+
"mk.add_child(p)\n",
743+
"p.add_child(v)\n",
744+
"m.add_child(mk)\n",
745745
"\n",
746746
"f"
747747
]
@@ -993,7 +993,7 @@
993993
"\n",
994994
"f = features.Figure()\n",
995995
"v = features.Vega(data, height=40, width=600)\n",
996-
"f.add_children(v)\n",
996+
"f.add_child(v)\n",
997997
"\n",
998998
"f"
999999
]
@@ -1455,10 +1455,10 @@
14551455
"\n",
14561456
"v2 = features.Vega(data, position='absolute', left=\"0%\", width=\"50%\", height=\"50%\", top='50%')\n",
14571457
"\n",
1458-
"f.add_children(m)\n",
1459-
"f.add_children(m2)\n",
1460-
"f.add_children(v)\n",
1461-
"f.add_children(v2)\n",
1458+
"f.add_child(m)\n",
1459+
"f.add_child(m2)\n",
1460+
"f.add_child(v)\n",
1461+
"f.add_child(v2)\n",
14621462
"\n",
14631463
"f"
14641464
]
@@ -2329,7 +2329,7 @@
23292329
" ],\n",
23302330
" }\n",
23312331
"m = features.Map([48.,5.], zoom_start=6)\n",
2332-
"m.add_children(features.GeoJson(data))\n",
2332+
"m.add_child(features.GeoJson(data))\n",
23332333
"m"
23342334
]
23352335
},
@@ -4076,10 +4076,10 @@
40764076
"for i in range(N):\n",
40774077
" mk = features.Marker([data[i][0],data[i][1]])\n",
40784078
" p = features.Popup(str(data[i][2]))\n",
4079-
" mk.add_children(p)\n",
4080-
" mc.add_children(mk)\n",
4079+
" mk.add_child(p)\n",
4080+
" mc.add_child(mk)\n",
40814081
"\n",
4082-
"m.add_children(mc)\n",
4082+
"m.add_child(mc)\n",
40834083
"m"
40844084
]
40854085
},
@@ -4251,8 +4251,8 @@
42514251
"d1 = f.add_subplot(1,2,1)\n",
42524252
"d2 = f.add_subplot(1,2,2)\n",
42534253
"\n",
4254-
"d1.add_children(features.Map([0,0], tiles='stamenwatercolor', zoom_start=1))\n",
4255-
"d2.add_children(features.Map([46,3], tiles='mapquestopen', zoom_start=5))\n",
4254+
"d1.add_child(features.Map([0,0], tiles='stamenwatercolor', zoom_start=1))\n",
4255+
"d2.add_child(features.Map([46,3], tiles='mapquestopen', zoom_start=5))\n",
42564256
"\n",
42574257
"f"
42584258
]
@@ -6092,9 +6092,9 @@
60926092
"m = features.Map([43,-100], zoom_start=4)\n",
60936093
"g = features.GeoJson(geojson_data)\n",
60946094
"\n",
6095-
"f.add_children(m)\n",
6096-
"m.add_children(g)\n",
6097-
"g.add_children(features.GeoJsonStyle([3.0, 7.0, 8.0, 9.0, 9.0], 'YlGn', sd, key_on='feature.id'))\n",
6095+
"f.add_child(m)\n",
6096+
"m.add_child(g)\n",
6097+
"g.add_child(features.GeoJsonStyle([3.0, 7.0, 8.0, 9.0, 9.0], 'YlGn', sd, key_on='feature.id'))\n",
60986098
"\n",
60996099
"f"
61006100
]

tests/test_plugins.py

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class TestPlugins(object):
1616

1717
def test_scroll_zoom_toggler(self):
1818
mapa = folium.Map([45., 3.], zoom_start=4)
19-
mapa.add_children(plugins.ScrollZoomToggler())
19+
mapa.add_child(plugins.ScrollZoomToggler())
2020
mapa._repr_html_()
2121

2222
def test_marker_cluster(self):
@@ -27,17 +27,18 @@ def test_marker_cluster(self):
2727
range(N), # Popups.
2828
]).T
2929
mapa = folium.Map([45., 3.], zoom_start=4)
30-
mapa.add_children(plugins.MarkerCluster(data))
30+
mapa.add_child(plugins.MarkerCluster(data))
3131
mapa._repr_html_()
3232

3333
def test_terminator(self):
3434
mapa = folium.Map([45., 3.], zoom_start=1)
35-
mapa.add_children(plugins.Terminator())
36-
mapa.add_children(plugins.ScrollZoomToggler())
35+
mapa.add_child(plugins.Terminator())
36+
mapa.add_child(plugins.ScrollZoomToggler())
3737
mapa._repr_html_()
3838

3939
def test_boat_marker(self):
4040
mapa = folium.Map([30., 0.], zoom_start=3)
41+
<<<<<<< b656b5ef3efcb6db92e094ec69159bcc6babeab3
4142
mapa.add_children(plugins.BoatMarker((34, -43),
4243
heading=45,
4344
wind_heading=150,
@@ -48,18 +49,36 @@ def test_boat_marker(self):
4849
wind_heading=46,
4950
wind_speed=25,
5051
color="#88f"))
52+
=======
53+
mapa.add_child(plugins.BoatMarker((34, -43),
54+
heading=45,
55+
wind_heading=150,
56+
wind_speed=45,
57+
color="#8f8"))
58+
mapa.add_child(plugins.BoatMarker((46, -30),
59+
heading=-20,
60+
wind_heading=46,
61+
wind_speed=25,
62+
color="#88f"))
63+
>>>>>>> Putting features in the top namespace
5164
mapa._repr_html_()
5265

5366
def test_layer(self):
5467
mapa = folium.Map([48., 5.], tiles='stamentoner', zoom_start=6)
5568
layer = 'http://otile1.mqcdn.com/tiles/1.0.0/map/{z}/{x}/{y}.png'
69+
<<<<<<< b656b5ef3efcb6db92e094ec69159bcc6babeab3
5670
mapa.add_children(folium.map.TileLayer(layer, name='MapQuest',
5771
attr='attribution'))
5872
mapa.add_children(folium.map.TileLayer(layer,
5973
name='MapQuest2',
6074
attr='attribution2',
6175
overlay=True))
6276
mapa.add_children(folium.map.LayerControl())
77+
=======
78+
mapa.add_child(folium.map.TileLayer(layer, name='MapQuest', attr='attribution'))
79+
mapa.add_child(folium.map.TileLayer(layer, name='MapQuest2', attr='attribution2', overlay=True))
80+
mapa.add_child(folium.map.LayerControl())
81+
>>>>>>> Putting features in the top namespace
6382
mapa._repr_html_()
6483

6584
def test_timestamped_geo_json(self):
@@ -135,12 +154,12 @@ def test_timestamped_geo_json(self):
135154
}
136155

137156
mape = folium.Map([47, 3], zoom_start=1)
138-
mape.add_children(plugins.TimestampedGeoJson(data))
157+
mape.add_child(plugins.TimestampedGeoJson(data))
139158
mape._repr_html_()
140159

141160
def test_heat_map(self):
142161
data = (np.random.normal(size=(100, 2)) * np.array([[1, 1]]) +
143162
np.array([[48, 5]])).tolist()
144163
mapa = folium.Map([48., 5.], tiles='stamentoner', zoom_start=6)
145-
mapa.add_children(plugins.HeatMap(data))
164+
mapa.add_child(plugins.HeatMap(data))
146165
mapa._repr_html_()

0 commit comments

Comments
 (0)