.
9 | /// GridLayer will handle creating and animating these DOM elements for you.
10 | ///
11 | public abstract class GridLayer : Layer
12 | {
13 |
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/DPBlazorMapLibrary/Models/Layers/GridLayerOptions.cs:
--------------------------------------------------------------------------------
1 | using System.Drawing;
2 |
3 | namespace DPBlazorMapLibrary
4 | {
5 | public class GridLayerOptions : LayerOptions
6 | {
7 | public GridLayerOptions()
8 | {
9 | Pane = "tilePane";
10 | }
11 |
12 | ///
13 | /// Width and height of tiles in the grid. Use a number if width and height are equal, or L.point(width, height) otherwise.
14 | ///
15 | public int TileSize { get; set; } = 256;
16 |
17 | ///
18 | /// Opacity of the tiles. Can be used in the createTile() function.
19 | ///
20 | public double Opacity { get; set; } = 1.0;
21 |
22 | ///
23 | /// By default, a smooth zoom animation will update grid layers every integer zoom level. Setting this option to false will update the grid layer only when the smooth animation ends.
24 | ///
25 | public bool UpdateWhenZooming { get; set; } = true;
26 |
27 | ///
28 | /// Tiles will not update more than once every updateInterval milliseconds when panning.
29 | ///
30 | public int UpdateInterval { get; set; } = 200;
31 |
32 | public int ZIndex { get; set; } = 1;
33 |
34 | ///
35 | /// If set, tiles will only be loaded inside the set.
36 | ///
37 | public (LatLng TopLeft, LatLng BottomRight)? Bounds { get; set; }
38 |
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/DPBlazorMapLibrary/Models/Layers/InteractiveLayer.cs:
--------------------------------------------------------------------------------
1 | namespace DPBlazorMapLibrary
2 | {
3 | ///
4 | /// Some Layers can be made interactive - when the user interacts with such a layer, mouse events like click and mouseover can be handled.
5 | /// Use the event handling methods to handle these events.
6 | ///
7 | public abstract class InteractiveLayer : Layer
8 | {
9 |
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/DPBlazorMapLibrary/Models/Layers/InteractiveLayerOptions.cs:
--------------------------------------------------------------------------------
1 | namespace DPBlazorMapLibrary
2 | {
3 | public class InteractiveLayerOptions : LayerOptions
4 | {
5 | ///
6 | /// If false, the layer will not emit mouse events and will act as a part of the underlying map.
7 | ///
8 | public bool Interactive { get; set; } = true;
9 |
10 | ///
11 | /// When true, a mouse event on this layer will trigger the same event on the map (unless L.DomEvent.stopPropagation is used).
12 | ///
13 | public bool BubblingMouseEvents { get; set; } = true;
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/DPBlazorMapLibrary/Models/Layers/Layer.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.JSInterop;
2 |
3 | namespace DPBlazorMapLibrary
4 | {
5 | ///
6 | /// A set of methods from the Layer base class that all Leaflet layers use.
7 | /// Inherits all methods, options and events from L.Evented.
8 | ///
9 | public abstract class Layer : Evented
10 | {
11 | private const string _addToJsFunction = "addTo";
12 | private const string _removeJsFunction = "remove";
13 | private const string _removeFromJsFunction = "removeFrom";
14 | private const string _bindPopupJsFunction = "bindPopup";
15 | private const string _unbindPopupJsFunction = "unbindPopup";
16 | private const string _openPopupJsFunction = "openPopup";
17 | private const string _closePopupJsFunction = "closePopup";
18 | private const string _togglePopupJsFunction = "togglePopup";
19 | private const string _isPopupOpenJsFunction = "isPopupOpen";
20 | private const string _setPopupContentJsFunction = "setPopupContent";
21 | private const string _bindTooltipJsFunction = "bindTooltip";
22 | private const string _unbindTooltipJsFunction = "unbindTooltip";
23 | private const string _openTooltipJsFunction = "openTooltip";
24 | private const string _closeTooltipJsFunction = "closeTooltip";
25 | private const string _toggleTooltipJsFunction = "toggleTooltip";
26 | private const string _isTooltipOpenJsFunction = "isTooltipOpen";
27 | private const string _setTooltipContentJsFunction = "setTooltipContent";
28 |
29 | ///
30 | /// Adds the layer to the given map or layer group.
31 | ///
32 | ///
current map
33 | ///
current object
34 | public async Task
AddTo(Map map)
35 | {
36 | await JsReference.InvokeAsync(_addToJsFunction, map.MapReference);
37 | return this;
38 | }
39 |
40 | ///
41 | /// Removes the layer from the map it is currently active on.
42 | ///
43 | ///
44 | public async Task Remove()
45 | {
46 | await JsReference.InvokeAsync(_removeJsFunction);
47 | await JsReference.DisposeAsync();
48 | return this;
49 | }
50 |
51 | ///
52 | /// Removes the layer from the given map
53 | ///
54 | /// current map
55 | /// this
56 | public async Task RemoveFrom(Map map)
57 | {
58 | await JsReference.InvokeAsync(_removeFromJsFunction, map.MapReference);
59 | return this;
60 | }
61 |
62 | //TODO: add RemoveFrom( group)
63 |
64 | //TODO: add Extension methods: onAdd, onRemove, getEvents, getAttribution, getAttribution
65 |
66 |
67 | #region Popup
68 | ///
69 | /// Binds a popup to the layer with the passed content and sets up the necessary event listeners.
70 | /// If a Function is passed it will receive the layer as the first argument and should return a String or HTMLElement.
71 | ///
72 | ///
73 | ///
74 | //TODO: add options?
75 | public async Task BindPopup(string content)
76 | {
77 | await JsReference.InvokeAsync(_bindPopupJsFunction, content);
78 | return this;
79 | }
80 |
81 | ///
82 | /// Removes the popup previously bound with bindPopup.
83 | ///
84 | /// this
85 | public async Task UnbindPopup()
86 | {
87 | await JsReference.InvokeAsync(_unbindPopupJsFunction);
88 | return this;
89 | }
90 |
91 | ///
92 | /// Opens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
93 | ///
94 | ///
95 | /// this
96 | public async Task OpenPopup(LatLng? latLng)
97 | {
98 | await JsReference.InvokeAsync(_openPopupJsFunction, latLng);
99 | return this;
100 | }
101 |
102 | ///
103 | /// Closes the popup bound to this layer if it is open.
104 | ///
105 | ///
106 | public async Task ClosePopup()
107 | {
108 | await JsReference.InvokeAsync(_closePopupJsFunction);
109 | return this;
110 | }
111 |
112 | ///
113 | /// Opens or closes the popup bound to this layer depending on its current state.
114 | ///
115 | ///
116 | public async Task TogglePopup()
117 | {
118 | await JsReference.InvokeAsync(_togglePopupJsFunction);
119 | return this;
120 | }
121 |
122 | ///
123 | /// Returns true if the popup bound to this layer is currently open.
124 | ///
125 | /// true if the popup bound to this layer is currently open
126 | public async Task IsPopupOpen()
127 | {
128 | return await JsReference.InvokeAsync(_isPopupOpenJsFunction);
129 | }
130 |
131 | ///
132 | /// Sets the content of the popup bound to this layer.
133 | ///
134 | ///
135 | /// this
136 | public async Task SetPopupContent(string content)
137 | {
138 | await JsReference.InvokeAsync(_setPopupContentJsFunction, content);
139 | return this;
140 | }
141 |
142 | //TODO: getPopup()
143 |
144 | #endregion
145 |
146 | #region Tooltip
147 | ///
148 | /// Binds a tooltip to the layer with the passed content and sets up the necessary event listeners. If a Function is passed it will receive the layer as the first argument and should return a String or HTMLElement.
149 | ///
150 | /// content
151 | /// this
152 | //TODO: options?
153 | public async Task BindTooltip(string content)
154 | {
155 | await JsReference.InvokeAsync(_bindTooltipJsFunction, content);
156 | return this;
157 | }
158 |
159 | ///
160 | /// Removes the tooltip previously bound with bindTooltip.
161 | ///
162 | /// this
163 | public async Task UnbindTooltip()
164 | {
165 | await JsReference.InvokeAsync(_unbindTooltipJsFunction);
166 | return this;
167 | }
168 |
169 | ///
170 | /// Opens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
171 | ///
172 | ///
173 | /// this
174 | public async Task OpenTooltip(LatLng? latLng)
175 | {
176 | await JsReference.InvokeAsync(_openTooltipJsFunction, latLng);
177 | return this;
178 | }
179 |
180 | ///
181 | /// Closes the tooltip bound to this layer if it is open.
182 | ///
183 | /// this
184 | public async Task CloseTooltip()
185 | {
186 | await JsReference.InvokeAsync(_closeTooltipJsFunction);
187 | return this;
188 | }
189 |
190 | ///
191 | /// Opens or closes the tooltip bound to this layer depending on its current state.
192 | ///
193 | /// this
194 | public async Task ToggleTooltip()
195 | {
196 | await JsReference.InvokeAsync(_toggleTooltipJsFunction);
197 | return this;
198 | }
199 |
200 | ///
201 | /// Returns true if the tooltip bound to this layer is currently open.
202 | ///
203 | /// true if the tooltip bound to this layer is currently open
204 | public async Task IsTooltipOpen()
205 | {
206 | return await JsReference.InvokeAsync(_isTooltipOpenJsFunction);
207 | }
208 |
209 | ///
210 | /// Sets the content of the tooltip bound to this layer.
211 | ///
212 | ///
213 | /// this
214 | public async Task SetTooltipContent(string content)
215 | {
216 | await JsReference.InvokeAsync(_setTooltipContentJsFunction, content);
217 | return this;
218 | }
219 |
220 | //TODO: getTooltip()
221 |
222 | #endregion
223 | }
224 | }
225 |
--------------------------------------------------------------------------------
/DPBlazorMapLibrary/Models/Layers/LayerOptions.cs:
--------------------------------------------------------------------------------
1 | namespace DPBlazorMapLibrary
2 | {
3 | public class LayerOptions
4 | {
5 | public int Id { get; set; }
6 | ///
7 | /// By default the layer will be added to the map's overlay pane.
8 | /// Overriding this option will cause the layer to be placed on another pane by default.
9 | ///
10 | public string Pane { get; set; } = "overlayPane";
11 | ///
12 | /// String to be shown in the attribution control, e.g. "© OpenStreetMap contributors".
13 | /// It describes the layer data and is often a legal obligation towards copyright holders and tile providers.
14 | ///
15 | public string Attribution { get; set; } = null;
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/DPBlazorMapLibrary/Models/Layers/Markers/Marker.cs:
--------------------------------------------------------------------------------
1 | using DPBlazorMapLibrary.JsInterops.Events;
2 | using Microsoft.JSInterop;
3 |
4 | namespace DPBlazorMapLibrary
5 | {
6 | public class Marker : InteractiveLayer
7 | {
8 | private const string _getLatLngJsFunction = "getLatLng";
9 | private const string _setLatLngJsFunction = "setLatLng";
10 | private const string _setZIndexOffsetJsFunction = "setZIndexOffset";
11 | private const string _getIconJsFunction = "getIcon";
12 | private const string _setIconJsFunction = "setIcon";
13 | private const string _setOpacityJsFunction = "setOpacity";
14 |
15 | public Marker(IJSObjectReference jsReference, IEventedJsInterop eventedJsInterop)
16 | {
17 | JsReference = jsReference;
18 | EventedJsInterop = eventedJsInterop;
19 | }
20 |
21 | public async Task GetLatLng()
22 | {
23 | return await JsReference.InvokeAsync(_getLatLngJsFunction);
24 | }
25 |
26 | public async Task SetLatLng(LatLng latLng)
27 | {
28 | return await JsReference.InvokeAsync(_setLatLngJsFunction, latLng);
29 | }
30 |
31 | public async Task SetZIndexOffset(int number)
32 | {
33 | return await JsReference.InvokeAsync(_setZIndexOffsetJsFunction, number);
34 | }
35 |
36 | public async Task GetIcon()
37 | {
38 | return await JsReference.InvokeAsync(_getIconJsFunction);
39 | }
40 |
41 | public async Task SetIcon(Icon icon)
42 | {
43 | return await JsReference.InvokeAsync(_setIconJsFunction, icon);
44 | }
45 |
46 | public async Task SetOpacity(double number)
47 | {
48 | return await JsReference.InvokeAsync(_setOpacityJsFunction, number);
49 | }
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/DPBlazorMapLibrary/Models/Layers/Markers/MarkerOptions.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.JSInterop;
2 | using System.Text.Json.Serialization;
3 |
4 | namespace DPBlazorMapLibrary
5 | {
6 | public class MarkerOptions : InteractiveLayerOptions
7 | {
8 | public MarkerOptions()
9 | {
10 | BubblingMouseEvents = false;
11 | Pane = "markerPane";
12 | }
13 |
14 | private Icon _iconRef;
15 |
16 | [JsonIgnore]
17 | public Icon IconRef
18 | {
19 | get => _iconRef;
20 | init
21 | {
22 | _iconRef = value;
23 | if (value != null)
24 | {
25 | Icon = _iconRef.JsReference;
26 | }
27 | else
28 | {
29 | Icon = null;
30 | }
31 | }
32 | }
33 |
34 | ///
35 | /// Icon instance to use for rendering the marker. See Icon documentation for details on how to customize the marker icon. If not specified, a common instance of L.Icon.Default is used.
36 | ///
37 | public IJSObjectReference Icon { get; init; }
38 |
39 | ///
40 | /// Whether the marker can be tabbed to with a keyboard and clicked by pressing enter.
41 | ///
42 | public bool Keyboard { get; init; } = true;
43 |
44 | ///
45 | /// Text for the browser tooltip that appear on marker hover (no tooltip by default).
46 | ///
47 | public string Title { get; init; }
48 |
49 | ///
50 | /// Text for the alt attribute of the icon image (useful for accessibility).
51 | ///
52 | public string Alt { get; init; }
53 |
54 | ///
55 | /// By default, marker images zIndex is set automatically based on its latitude. Use this option if you want to put the marker on top of all others (or below), specifying a high value like 1000 (or high negative value, respectively).
56 | ///
57 | public int ZIndexOffset { get; init; } = 0;
58 |
59 | ///
60 | /// The opacity of the marker.
61 | ///
62 | public double Opacity { get; init; } = 1d;
63 |
64 | ///
65 | /// If true, the marker will get on top of others when you hover the mouse over it.
66 | ///
67 | public bool RiseOnHover { get; init; } = false;
68 |
69 | ///
70 | /// The z-index offset used for the riseOnHover feature.
71 | ///
72 | public int RiseOffset { get; init; } = 250;
73 |
74 | ///
75 | /// Map pane where the markers shadow will be added.
76 | ///
77 | public string ShadowPane { get; init; } = "shadowPane";
78 |
79 |
80 | #region Draggable marker options
81 |
82 | ///
83 | /// Whether the marker is draggable with mouse/touch or not.
84 | ///
85 | public bool Draggable { get; init; } = false;
86 |
87 | ///
88 | /// Whether to pan the map when dragging this marker near its edge or not.
89 | ///
90 | public bool AutoPan { get; init; } = false;
91 |
92 | ///
93 | /// Distance (in pixels to the left/right and to the top/bottom) of the map edge to start panning the map.
94 | ///
95 | public Point AutoPanPadding { get; init; } = new Point(50, 50);
96 |
97 | ///
98 | /// Number of pixels the map should pan by.
99 | ///
100 | public int AutoPanSpeed { get; init; } = 10;
101 |
102 | #endregion
103 | }
104 | }
105 |
--------------------------------------------------------------------------------
/DPBlazorMapLibrary/Models/Layers/OtherLayers/FeatureGroups/FeatureGroup.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.JSInterop;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace DPBlazorMapLibrary
9 | {
10 | ///
11 | /// Extended LayerGroup that makes it easier to do the same thing to all its member layers:
12 | ///
13 | public class FeatureGroup : LayerGroup
14 | {
15 | //TODO: setStyle
16 | //TODO: bringToFront
17 | //TODO: bringToBack
18 | //TODO: getBounds
19 |
20 | public FeatureGroup(IJSObjectReference jsReference) : base(jsReference)
21 | {
22 | }
23 |
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/DPBlazorMapLibrary/Models/Layers/OtherLayers/GeoJSON/GeoJSONLayer.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.JSInterop;
2 |
3 | namespace DPBlazorMapLibrary
4 | {
5 | ///
6 | /// Represents a GeoJSON object or an array of GeoJSON objects. Allows you to parse GeoJSON data and display it on the map. Extends FeatureGroup.
7 | ///
8 | public class GeoJSONLayer : FeatureGroup
9 | {
10 | public GeoJSONLayer(IJSObjectReference jsReference) : base(jsReference)
11 | {
12 | }
13 |
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/DPBlazorMapLibrary/Models/Layers/OtherLayers/GeoJSON/GeoJSONOptions.cs:
--------------------------------------------------------------------------------
1 | namespace DPBlazorMapLibrary
2 | {
3 | public class GeoJSONOptions : LayerOptions
4 | {
5 | ///
6 | /// Whether default Markers for "Point" type Features inherit from group options.
7 | ///
8 | public bool MarkersInheritOptions { get; set; } = false;
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/DPBlazorMapLibrary/Models/Layers/OtherLayers/LayerGroups/LayerGroup.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.JSInterop;
2 |
3 | namespace DPBlazorMapLibrary
4 | {
5 | public class LayerGroup : Layer
6 | {
7 | private const string _addLayerJsFunction = "addLayer";
8 | private const string _removeLayerJsFunction = "removeLayer";
9 | private const string _hasLayerJsFunction = "hasLayer";
10 |
11 | //TODO: clearLayers
12 | //TODO: invoke
13 | //TODO: eachLayer
14 | //TODO: getLayer
15 | //TODO: getLayers
16 | //TODO: setZIndex
17 | //TODO: getLayerId
18 |
19 | public LayerGroup(IJSObjectReference jsReference)
20 | {
21 | JsReference = jsReference;
22 | }
23 |
24 | ///
25 | /// Adds the given layer to the group.
26 | ///
27 | ///
28 | public async Task AddLayer(Layer layer)
29 | {
30 | return await JsReference.InvokeAsync(_addLayerJsFunction, layer);
31 | }
32 |
33 | ///
34 | /// Removes the given layer from the group.
35 | ///
36 | ///
37 | ///
38 | public async Task RemoveLayer(Layer layer)
39 | {
40 | return await JsReference.InvokeAsync(_removeLayerJsFunction, layer);
41 | }
42 |
43 | ///
44 | /// Removes the layer with the given internal ID from the group.
45 | ///
46 | ///
47 | ///
48 | public async Task RemoveLayer(int id)
49 | {
50 | return await JsReference.InvokeAsync(_removeLayerJsFunction, id);
51 | }
52 |
53 | ///
54 | /// Returns true if the given layer is currently added to the group.
55 | ///
56 | ///
57 | ///
58 | public async Task HasLayer(Layer layer)
59 | {
60 | return await JsReference.InvokeAsync(_hasLayerJsFunction, layer);
61 | }
62 |
63 | ///
64 | /// Returns true if the given internal ID is currently added to the group.
65 | ///
66 | ///
67 | ///
68 | public async Task HasLayer(int id)
69 | {
70 | return await JsReference.InvokeAsync(_hasLayerJsFunction, id);
71 | }
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/DPBlazorMapLibrary/Models/Layers/RasterLayers/ImageOverlays/ImageOverlay.cs:
--------------------------------------------------------------------------------
1 | using DPBlazorMapLibrary.JsInterops.Events;
2 | using Microsoft.JSInterop;
3 |
4 | namespace DPBlazorMapLibrary
5 | {
6 | ///
7 | /// Used to load and display a single image over specific bounds of the map. Extends Layer.
8 | ///
9 | public class ImageOverlay : InteractiveLayer
10 | {
11 | private const string _setOpacityJsFunction = "setOpacity";
12 | private const string _bringToFrontJsFunction = "bringToFront";
13 | private const string _bringToBackJsFunction = "bringToBack";
14 | private const string _setUrlJsFunction = "setUrl";
15 | private const string _setBoundsJsFunction = "setBounds";
16 | private const string _setZIndexJsFunction = "setZIndex";
17 | private const string _getBoundsJsFunction = "getBounds";
18 | private const string _getElementJsFunction = "getElement";
19 |
20 | //TODO: Add events load, error
21 |
22 | public ImageOverlay(IJSObjectReference jsReference, IEventedJsInterop eventedJsInterop)
23 | {
24 | JsReference = jsReference;
25 | EventedJsInterop = eventedJsInterop;
26 | }
27 |
28 | ///
29 | /// Sets the opacity of the overlay.
30 | ///
31 | ///
32 | ///
33 | public async Task SetOpacity(double opacity)
34 | {
35 | return await JsReference.InvokeAsync(_setOpacityJsFunction, opacity);
36 | }
37 |
38 | ///
39 | /// Brings the layer to the top of all overlays.
40 | ///
41 | ///
42 | public async Task BringToFront()
43 | {
44 | return await JsReference.InvokeAsync(_bringToFrontJsFunction);
45 | }
46 |
47 | ///
48 | /// Brings the layer to the bottom of all overlays.
49 | ///
50 | ///
51 | public async Task BringToBack()
52 | {
53 | return await JsReference.InvokeAsync(_bringToBackJsFunction);
54 | }
55 |
56 | ///
57 | /// Changes the URL of the image.
58 | ///
59 | ///
60 | ///
61 | public async Task SetUrl(string url)
62 | {
63 | return await JsReference.InvokeAsync(_setUrlJsFunction, url);
64 | }
65 |
66 | ///
67 | /// Update the bounds that this ImageOverlay covers
68 | ///
69 | ///
70 | ///
71 | public async Task SetBounds(LatLngBounds bounds)
72 | {
73 | return await JsReference.InvokeAsync(_setBoundsJsFunction, bounds);
74 | }
75 |
76 | ///
77 | /// Changes the zIndex of the image overlay.
78 | ///
79 | ///
80 | ///
81 | public async Task SetZIndex(int value)
82 | {
83 | return await JsReference.InvokeAsync(_setZIndexJsFunction, value);
84 | }
85 |
86 | //TODO: getBounds()
87 |
88 | //TODO: getElement()
89 | }
90 | }
91 |
--------------------------------------------------------------------------------
/DPBlazorMapLibrary/Models/Layers/RasterLayers/ImageOverlays/ImageOverlayOptions.cs:
--------------------------------------------------------------------------------
1 | namespace DPBlazorMapLibrary
2 | {
3 | public class ImageOverlayOptions : InteractiveLayerOptions
4 | {
5 | public ImageOverlayOptions()
6 | {
7 | Interactive = true;
8 | }
9 | ///
10 | /// The opacity of the image overlay.
11 | ///
12 | public double Opacity { get; set; } = 1d;
13 |
14 | ///
15 | /// Text for the alt attribute of the image (useful for accessibility).
16 | ///
17 | public string Alt { get; set; } = null;
18 |
19 | ///
20 | /// Whether the crossOrigin attribute will be added to the image. If a String is provided, the image will have its crossOrigin attribute set to the String provided.
21 | /// This is needed if you want to access image pixel data. Refer to CORS Settings for valid String values.
22 | ///
23 | public bool CrossOrigin { get; set; } = false;
24 |
25 | ///
26 | /// URL to the overlay image to show in place of the overlay that failed to load.
27 | ///
28 | public string ErrorOverlayUrl { get; set; } = null;
29 |
30 | ///
31 | /// The explicit zIndex of the overlay layer.
32 | ///
33 | public int ZIndex { get; set; } = 1;
34 |
35 | ///
36 | /// A custom class name to assign to the image. Empty by default.
37 | ///
38 | public string ClassName { get; set; } = null;
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/DPBlazorMapLibrary/Models/Layers/RasterLayers/TileLayers/TileLayer.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.JSInterop;
2 |
3 | namespace DPBlazorMapLibrary
4 | {
5 | ///
6 | /// Used to load and display tile layers on the map. Note that most tile servers require attribution, which you can set under Layer.
7 | ///
8 | public class TileLayer : GridLayer
9 | {
10 | public TileLayer(IJSObjectReference jsReference)
11 | {
12 | JsReference = jsReference;
13 | }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/DPBlazorMapLibrary/Models/Layers/RasterLayers/TileLayers/TileLayerOptions.cs:
--------------------------------------------------------------------------------
1 | namespace DPBlazorMapLibrary
2 | {
3 | public class TileLayerOptions : GridLayerOptions
4 | {
5 |
6 | ///
7 | /// The minimum zoom level down to which this layer will be displayed (inclusive).
8 | ///
9 | public float MinZoom { get; set; }
10 |
11 | ///
12 | /// The maximum zoom level up to which this layer will be displayed (inclusive).
13 | ///
14 | public float MaxZoom { get; set; } = 18;
15 |
16 | ///
17 | /// URL to the tile image to show in place of the tile that failed to load.
18 | ///
19 | public string ErrorTileUrl { get; set; }
20 |
21 | ///
22 | /// If set to true, the zoom number used in tile URLs will be reversed (maxZoom - zoom instead of zoom)
23 | ///
24 | public bool IsZoomReversed { get; set; }
25 |
26 | ///
27 | /// The zoom number used in tile URLs will be offset with this value.
28 | ///
29 | public double ZoomOffset { get; set; }
30 |
31 | ///
32 | /// If true and user is on a retina display, it will request four tiles of half the specified size and a bigger zoom level in place of one to utilize the high resolution.
33 | ///
34 | public bool DetectRetina { get; set; }
35 |
36 | public string AccessToken { get; set; }
37 |
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/DPBlazorMapLibrary/Models/Layers/RasterLayers/VideoOverlays/VideoOverlay.cs:
--------------------------------------------------------------------------------
1 | using DPBlazorMapLibrary.JsInterops.Events;
2 | using Microsoft.JSInterop;
3 |
4 | namespace DPBlazorMapLibrary
5 | {
6 | ///
7 | /// Used to load and display a video player over specific bounds of the map. Extends ImageOverlay.
8 | ///
9 | public class VideoOverlay : ImageOverlay
10 | {
11 | //TODO: add event Load
12 |
13 | public VideoOverlay(IJSObjectReference jsReference, IEventedJsInterop eventedJsInterop) : base(jsReference, eventedJsInterop)
14 | {
15 | }
16 |
17 | //TODO: getElement()
18 |
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/DPBlazorMapLibrary/Models/Layers/RasterLayers/VideoOverlays/VideoOverlayOptions.cs:
--------------------------------------------------------------------------------
1 | namespace DPBlazorMapLibrary
2 | {
3 | public class VideoOverlayOptions : ImageOverlayOptions
4 | {
5 | ///
6 | /// Whether the video starts playing automatically when loaded.
7 | ///
8 | public bool Autoplay { get; set; } = true;
9 |
10 | ///
11 | /// Whether the video will loop back to the beginning when played.
12 | ///
13 | public bool Loop = true;
14 |
15 | ///
16 | /// Whether the video will save aspect ratio after the projection. Relevant for supported browsers. See browser compatibility
17 | ///
18 | public bool KeepAspectRatio = true;
19 |
20 | ///
21 | /// Whether the video starts on mute when loaded.
22 | ///
23 | public bool Muted { get; set; } = false;
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/DPBlazorMapLibrary/Models/Layers/VectorLayers/CircleMarkers/CircleMarker.cs:
--------------------------------------------------------------------------------
1 | using DPBlazorMapLibrary.JsInterops.Events;
2 | using Microsoft.JSInterop;
3 |
4 | namespace DPBlazorMapLibrary
5 | {
6 | ///
7 | /// A circle of a fixed size with radius specified in pixels. Extends Path.
8 | ///
9 | public class CircleMarker : Path
10 | {
11 | private const string _toGeoJSONJsFunction = "toGeoJSON";
12 | private const string _setLatLngJsFunction = "setLatLng";
13 | private const string _getLatLngJsFunction = "getLatLng";
14 | private const string _setRadiusJsFunction = "setRadius";
15 | private const string _getRadiusJsFunction = "getRadius";
16 |
17 | public CircleMarker(IJSObjectReference jsReference, IEventedJsInterop eventedJsInterop)
18 | {
19 | JsReference = jsReference;
20 | EventedJsInterop = eventedJsInterop;
21 | }
22 |
23 | ///
24 | /// precision is the number of decimal places for coordinates. The default value is 6 places. Returns a GeoJSON representation of the circle marker (as a GeoJSON Point Feature).
25 | ///
26 | ///
27 | ///
28 | public async Task