/// <summary> /// Removes the Layer from the <see cref="Map"/> it's currently active on. /// </summary> /// <returns>The Layer.</returns> public async Task <Layer> Remove() { GuardAgainstNullBinding("Cannot remove layer from map. No JavaScript binding has been set up."); var module = await JSBinder.GetLeafletMapModule(); await module.InvokeVoidAsync("LeafletMap.Layer.remove", this.JSObjectReference); return(this); }
/// <summary> /// Adds a point to the Polyline /// </summary> /// <param name="latLng">The point to add to the Polyline.</param> /// <returns>The Polyline.</returns> public async Task <Polyline> AddLatLng(LatLng latLng) { GuardAgainstNullBinding("Cannot remove layer from map. No JavaScript binding has been set up."); var module = await JSBinder.GetLeafletMapModule(); await module.InvokeVoidAsync("LeafletMap.Polyline.addLatLng", this.JSObjectReference, latLng); return(this); }
/// <summary> /// Adds the layer to a <see cref="Map"/>. /// </summary> /// <param name="map">The <see cref="Map"/> to add the Layer to.</param> /// <returns>The Layer.</returns> public async Task <Layer> AddTo(Map map) { if (JSBinder is null) { await BindJsObjectReference(map.JSBinder); } GuardAgainstNullBinding("Cannot add layer to map. No JavaScript binding has been set up."); var module = await JSBinder.GetLeafletMapModule(); await module.InvokeVoidAsync("LeafletMap.Layer.addTo", this.JSObjectReference, map.JSObjectReference); return(this); }
/// <summary> /// Sets the view of the map with the given centre and zoom. /// </summary> /// <param name="center">A <see cref="LatLng"/> representing the geogrpahical centre of the map.</param> /// <param name="zoom">The zoom level of the map.</param> /// <returns>The Map.</returns> public async Task <Map> SetView(LatLng center, int zoom) { if (center.JSBinder is null) { await center.BindJsObjectReference(this.JSBinder); } center.GuardAgainstNullBinding("Cannot set map view. No JavaScript binding has been set up for the center argument."); var module = await JSBinder.GetLeafletMapModule(); await module.InvokeVoidAsync("LeafletMap.Map.setView", this.JSObjectReference, center.JSObjectReference, zoom); return(this); }