Skip to content

Commit c97c919

Browse files
committed
Implement all useful leaflet methods on geoman
Only the free modules for now
1 parent bf13650 commit c97c919

File tree

1 file changed

+55
-17
lines changed

1 file changed

+55
-17
lines changed

folium/plugins/geoman.py

Lines changed: 55 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class GeoMan(JSCSSMixin, MacroElement):
3434
{{ this._parent.get_name() }}
3535
);
3636
{%- endif %}
37-
/* The global varianble below is needed to prevent streamlit-folium
37+
/* The global variable below is needed to prevent streamlit-folium
3838
from barfing :-(
3939
*/
4040
var drawnItems = drawnItems_{{ this.get_name() }};
@@ -62,12 +62,6 @@ class GeoMan(JSCSSMixin, MacroElement):
6262
{{handler}}
6363
);
6464
{%- endfor %}
65-
drawnItems_{{ this.get_name() }}.addLayer(layer);
66-
});
67-
{{ this._parent.get_name() }}.on("pm:remove", function(e) {
68-
var layer = e.layer,
69-
type = e.layerType;
70-
drawnItems_{{ this.get_name() }}.removeLayer(layer);
7165
});
7266
7367
{% endmacro %}
@@ -87,21 +81,65 @@ class GeoMan(JSCSSMixin, MacroElement):
8781
)
8882
]
8983

90-
def __init__(
91-
self,
92-
position="topleft",
93-
feature_group=None,
94-
on=None,
95-
**kwargs,
96-
):
84+
def __init__(self, position="topleft", feature_group=None, on=None, **kwargs):
9785
super().__init__()
9886
self._name = "GeoMan"
9987
self.feature_group = feature_group
10088
self.on = on or {}
101-
self.options = remove_empty(
102-
position=position, layer_group=feature_group, **kwargs
103-
)
89+
self.options = remove_empty(position=position, **kwargs)
10490

10591
@leaflet_method
10692
def set_global_options(self, **kwargs):
10793
pass
94+
95+
@leaflet_method
96+
def enable_draw(self, shape, /, **kwargs):
97+
pass
98+
99+
@leaflet_method
100+
def disable_draw(self):
101+
pass
102+
103+
@leaflet_method
104+
def set_path_options(self, *, options_modifier, **options):
105+
pass
106+
107+
@leaflet_method
108+
def enable_global_edit_mode(self, **options):
109+
pass
110+
111+
@leaflet_method
112+
def disable_global_edit_mode(self):
113+
pass
114+
115+
@leaflet_method
116+
def enable_global_drag_mode(self):
117+
pass
118+
119+
@leaflet_method
120+
def disable_global_drag_mode(self):
121+
pass
122+
123+
@leaflet_method
124+
def enable_global_removal_mode(self):
125+
pass
126+
127+
@leaflet_method
128+
def disable_global_removal_mode(self):
129+
pass
130+
131+
@leaflet_method
132+
def enable_global_cut_mode(self):
133+
pass
134+
135+
@leaflet_method
136+
def disable_global_cut_mode(self):
137+
pass
138+
139+
@leaflet_method
140+
def enable_global_rotation_mode(self):
141+
pass
142+
143+
@leaflet_method
144+
def disable_global_rotation_mode(self):
145+
pass

0 commit comments

Comments
 (0)