Skip to content

Commit 3437521

Browse files
Change add_layer/remove_layer and add_control/remove_control into add… (#982)
* Change add_layer/remove_layer and add_control/remove_control into add/remove working for both layers and controls, in Map Class. * Update documentation and notebooks replacing add_layer and add_control by add (resp. remove). Add a warning and remove filter. * Update notebooks from ui-tests/notebooks, replacingadd_layer/control by add. * Simplify add_layer, remove_layer, substitute layer in Map by using add, clear and substitute and fix flake8 issue. * Indicate in the docstrings the methods that will be deprecated. * Take review comments into account : in LayerGroup update add_layer/remover layer. * Take review comments into account: Update substitute_layer in Layersgroup. * Fix flake8 issue.
1 parent 5bb4e08 commit 3437521

File tree

93 files changed

+397
-216
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+397
-216
lines changed

docs/source/controls/draw_control.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ Example
4848
}
4949
}
5050

51-
m.add_control(draw_control)
51+
m.add(draw_control)
5252

5353
m
5454

docs/source/controls/fullscreen_control.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Example
99
from ipyleaflet import Map, FullScreenControl
1010

1111
m = Map(zoom=5, center=[51.64, -76.52])
12-
m.add_control(FullScreenControl())
12+
m.add(FullScreenControl())
1313

1414
m
1515

docs/source/controls/layers_control.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ Example
2121
marker1 = Marker(name='marker1', location=(48, -2))
2222
marker2 = Marker(name='marker2', location=(50, 0))
2323
marker3 = Marker(name='marker3', location=(52, 2))
24-
m.add_layer(marker1)
25-
m.add_layer(marker2)
26-
m.add_layer(marker3)
24+
m.add(marker1)
25+
m.add(marker2)
26+
m.add(marker3)
2727

2828
control = LayersControl(position='topright')
29-
m.add_control(control)
29+
m.add(control)
3030

3131
m
3232

docs/source/controls/legend_control.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Example
1111
m = Map(center=(-10,-45), zoom=4)
1212

1313
legend = LegendControl({"low":"#FAA", "medium":"#A55", "High":"#500"}, name="Legend", position="bottomright")
14-
m.add_control(legend)
14+
m.add(legend)
1515

1616
m
1717

docs/source/controls/measure_control.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Example
1515
active_color = 'orange',
1616
primary_length_unit = 'kilometers'
1717
)
18-
m.add_control(measure)
18+
m.add(measure)
1919

2020
measure.completed_color = 'red'
2121

docs/source/controls/scale_control.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Example
99
from ipyleaflet import Map, ScaleControl
1010

1111
m = Map(zoom=5, center=[51.64, -76.52])
12-
m.add_control(ScaleControl(position='bottomleft'))
12+
m.add(ScaleControl(position='bottomleft'))
1313

1414
m
1515

docs/source/controls/search_control.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Example
1212

1313
marker = Marker(icon=AwesomeIcon(name="check", marker_color='green', icon_color='darkgreen'))
1414

15-
m.add_control(SearchControl(
15+
m.add(SearchControl(
1616
position="topleft",
1717
url='https://nominatim.openstreetmap.org/search?format=json&q={s}',
1818
zoom=5,
@@ -32,7 +32,7 @@ You can add a callback that will be run when on search found:
3232
url='https://cartoradon.irsn.fr/commune.py/communes/search/FR/{s}?',
3333
zoom=5
3434
)
35-
m.add_control(search)
35+
m.add(search)
3636

3737
def on_found(**kwargs):
3838
# Print the result of the search (text, location etc)
@@ -68,7 +68,7 @@ You can also search features from GeoJSON layers.
6868
layer_group = LayerGroup(layers=(countries,))
6969
marker = Marker(icon=AwesomeIcon(name="check", marker_color='green', icon_color='darkred'))
7070

71-
m.add_control(SearchControl(
71+
m.add(SearchControl(
7272
position="topleft",
7373
layer=layer_group,
7474
zoom=4,

docs/source/controls/split_map_control.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Example
1414
left_layer = basemap_to_tiles(basemaps.NASAGIBS.ModisAquaBands721CR, "2017-11-11")
1515

1616
control = SplitMapControl(left_layer=left_layer, right_layer=right_layer)
17-
m.add_control(control)
17+
m.add(control)
1818

1919
m
2020

docs/source/controls/widget_control.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ Example
1313
zoom_slider = IntSlider(description='Zoom level:', min=0, max=15, value=7)
1414
jslink((zoom_slider, 'value'), (m, 'zoom'))
1515
widget_control1 = WidgetControl(widget=zoom_slider, position='topright')
16-
m.add_control(widget_control1)
16+
m.add(widget_control1)
1717

1818
color_picker = ColorPicker(description='Pick a color:')
1919
widget_control2 = WidgetControl(widget=color_picker, position='bottomright')
20-
m.add_control(widget_control2)
20+
m.add(widget_control2)
2121
m
2222

2323

docs/source/controls/zoom_control.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Example
99
from ipyleaflet import Map, ZoomControl
1010

1111
m = Map(zoom=5, center=[51.64, -76.52], zoom_control=False) # Do not automatically create a ZoomControl
12-
m.add_control(ZoomControl(position='topright'))
12+
m.add(ZoomControl(position='topright'))
1313

1414
m
1515

0 commit comments

Comments
 (0)