diff --git a/GoogleMapsComponents/Helper.cs b/GoogleMapsComponents/Helper.cs index 6cdd3f01..2383b080 100644 --- a/GoogleMapsComponents/Helper.cs +++ b/GoogleMapsComponents/Helper.cs @@ -40,12 +40,11 @@ internal static Task MyInvokeAsync( { var enumType = typeof(T); - if (int.TryParse(str, out var enumintValue)) + if (int.TryParse(str, out var enumIntValue)) { - return (T)Enum.Parse(enumType, enumintValue.ToString()); + return (T)Enum.Parse(enumType, enumIntValue.ToString()); } - if (str == "null") { return null; @@ -179,7 +178,6 @@ private static IEnumerable MakeArgJsFriendly(IJSRuntime jsRuntime, IEnum return enumItem.ToString(); } - var memberInfo = enumItem2.GetType().GetMember(enumItem2.ToString()); if (memberInfo.Length == 0) { @@ -250,7 +248,6 @@ internal static async Task MyAddListenerAsync( string identifier, params object[] args) { - var jsFriendlyArgs = MakeArgJsFriendly(jsRuntime, args); return await jsRuntime.InvokeAsync(identifier, jsFriendlyArgs); @@ -279,7 +276,6 @@ internal static async Task> MyInvokeAsync( if (jsonElement.ValueKind == JsonValueKind.Number) { json = jsonElement.GetRawText(); - } else if (jsonElement.ValueKind == JsonValueKind.String) { @@ -297,14 +293,12 @@ internal static async Task> MyInvokeAsync( result = json ?? ""; return (T)result; } - } else { json = jsonElement.GetString(); } - var propArray = Helper.DeSerializeObject>(json); if (propArray?.TryGetValue("dotnetTypeName", out var typeName) ?? false) { diff --git a/GoogleMapsComponents/Maps/ControlPosition.cs b/GoogleMapsComponents/Maps/ControlPosition.cs index 44425db1..fe626b8f 100644 --- a/GoogleMapsComponents/Maps/ControlPosition.cs +++ b/GoogleMapsComponents/Maps/ControlPosition.cs @@ -4,9 +4,9 @@ namespace GoogleMapsComponents.Maps; /// -/// Identifiers used to specify the placement of controls on the map. -/// Controls are positioned relative to other controls in the same layout position. -/// Controls that are added first are positioned closer to the edge of the map. +/// Identifiers used to specify the placement of controls on the map.
+/// Controls are positioned relative to other controls in the same layout position.
+/// Controls that are added first are positioned closer to the edge of the map. ///
[JsonConverter(typeof(JsonStringEnumConverter))] public enum ControlPosition @@ -18,14 +18,14 @@ public enum ControlPosition BottomCenter, /// - /// Elements are positioned in the bottom left and flow towards the middle. + /// Elements are positioned in the bottom left and flow towards the middle.
/// Elements are positioned to the right of the Google logo. ///
[EnumMember(Value = "BOTTOM_LEFT")] BottomLeft, /// - /// Elements are positioned in the bottom right and flow towards the middle. + /// Elements are positioned in the bottom right and flow towards the middle.
/// Elements are positioned to the left of the copyrights. ///
[EnumMember(Value = "BOTTOM_RIGHT")] diff --git a/GoogleMapsComponents/Maps/Controls/MotionTrackingControlOptions.cs b/GoogleMapsComponents/Maps/Controls/MotionTrackingControlOptions.cs index 19366bc3..ea4c10dc 100644 --- a/GoogleMapsComponents/Maps/Controls/MotionTrackingControlOptions.cs +++ b/GoogleMapsComponents/Maps/Controls/MotionTrackingControlOptions.cs @@ -1,5 +1,13 @@ -namespace GoogleMapsComponents.Maps.Controls; +using System.Text.Json.Serialization; + +namespace GoogleMapsComponents.Maps.Controls; public class MotionTrackingControlOptions { + /// + /// Position id. Used to specify the position of the control on the map.
+ /// The default position is RightBottom. + ///
+ [JsonConverter(typeof(EnumMemberConverter))] + public ControlPosition Position { get; set; } } \ No newline at end of file diff --git a/GoogleMapsComponents/Maps/Extension/CircleList.cs b/GoogleMapsComponents/Maps/Extension/CircleList.cs index b3727962..427682e6 100644 --- a/GoogleMapsComponents/Maps/Extension/CircleList.cs +++ b/GoogleMapsComponents/Maps/Extension/CircleList.cs @@ -7,12 +7,11 @@ namespace GoogleMapsComponents.Maps.Extension; /// -/// A class able to manage a lot of Circle objects and get / set their -/// properties at the same time, eventually with different values -/// Main concept is that each Circle to can be distinguished by other ones need -/// to have a "unique key" with a "external world mean", so not necessary it's GUID -/// -/// All properties should be called With a Dictionary indicating for each Circle(related to that key) the corresponding related property value +/// A class able to manage a lot of Circle objects and get / set their +/// properties at the same time, eventually with different values.
+/// Main concept is that for each Circle to be distinguished from other ones, it needs +/// to have a "unique key" with an "external world meaning", so not necessarily a GUID
+/// All properties should be called With a Dictionary<string, {property type}> indicating for each Circle (related to that key) the corresponding related property value ///
public class CircleList : ListableEntityListBase { @@ -22,8 +21,8 @@ public class CircleList : ListableEntityListBase /// Create circles list /// /// - /// Dictionary of desired Circle keys and CircleOptions values. Key as any type unique key. Not nessary Guid - /// new instance of CircleList class will be returned with its Circles dictionary member populated with the corresponding results + /// Dictionary of desired Circle keys and CircleOptions values. Key as any type unique key. Not necessarily Guid + /// New instance of CircleList class will be returned with its Circles dictionary member populated with the corresponding results public static async Task CreateAsync(IJSRuntime jsRuntime, Dictionary opts) { var jsObjectRef = new JsObjectRef(jsRuntime, Guid.NewGuid()); @@ -40,7 +39,7 @@ public static async Task CreateAsync(IJSRuntime jsRuntime, Dictionar } /// - /// Sync list over lifetime: Create and remove list depending on entity count; + /// Sync list over lifetime: Create and remove list depending on entity count; /// entities will be removed, added or changed to mirror the given set. /// /// @@ -110,7 +109,7 @@ public async Task AddMultipleAsync(Dictionary opts) public Task> GetBounds(List? filterKeys = null) { - var matchingKeys = ComputeMathingKeys(filterKeys); + var matchingKeys = ComputeMatchingKeys(filterKeys); if (matchingKeys.Any()) { @@ -129,7 +128,7 @@ public Task> GetBounds(List? fil public Task> GetCenters(List? filterKeys = null) { - var matchingKeys = ComputeMathingKeys(filterKeys); + var matchingKeys = ComputeMatchingKeys(filterKeys); if (matchingKeys.Any()) { @@ -148,7 +147,7 @@ public Task> GetCenters(List? filterKe public Task> GetEditables(List? filterKeys = null) { - var matchingKeys = ComputeMathingKeys(filterKeys); + var matchingKeys = ComputeMatchingKeys(filterKeys); if (matchingKeys.Any()) { @@ -167,7 +166,7 @@ public Task> GetEditables(List? filterKeys = nu public Task> GetRadiuses(List? filterKeys = null) { - var matchingKeys = ComputeMathingKeys(filterKeys); + var matchingKeys = ComputeMatchingKeys(filterKeys); if (matchingKeys.Any()) { diff --git a/GoogleMapsComponents/Maps/Extension/ListableEntityListBase.cs b/GoogleMapsComponents/Maps/Extension/ListableEntityListBase.cs index aadc9e80..58921c88 100644 --- a/GoogleMapsComponents/Maps/Extension/ListableEntityListBase.cs +++ b/GoogleMapsComponents/Maps/Extension/ListableEntityListBase.cs @@ -21,8 +21,6 @@ protected ListableEntityListBase(JsObjectRef jsObjectRef, Dictionary /// Set the set of entities; entities will be removed, added or changed to mirror the given set. /// @@ -186,7 +184,7 @@ public virtual async Task RemoveMultipleAsync(List guids) //Find the eventual match between required keys (if any) and yet stored markers key (if any) //If filterKeys is null or empty all keys are returned //Otherwise only eventually yet stored marker keys that matches with filterKeys - protected virtual List ComputeMathingKeys(List? filterKeys = null) + protected virtual List ComputeMatchingKeys(List? filterKeys = null) { List matchingKeys; @@ -222,7 +220,7 @@ protected virtual Task> ComputeEmptyResult() public virtual Task> GetMaps(List? filterKeys = null) { - List matchingKeys = ComputeMathingKeys(filterKeys); + List matchingKeys = ComputeMatchingKeys(filterKeys); if (matchingKeys.Any()) { @@ -242,7 +240,7 @@ public virtual Task> GetMaps(List? filterKeys = public virtual Task> GetDraggables(List? filterKeys = null) { - List matchingKeys = ComputeMathingKeys(filterKeys); + List matchingKeys = ComputeMatchingKeys(filterKeys); if (matchingKeys.Any()) { @@ -262,7 +260,7 @@ public virtual Task> GetDraggables(List? filter public virtual Task> GetVisibles(List? filterKeys = null) { - List matchingKeys = ComputeMathingKeys(filterKeys); + List matchingKeys = ComputeMatchingKeys(filterKeys); if (matchingKeys.Any()) { diff --git a/GoogleMapsComponents/Maps/Extension/MarkerList.cs b/GoogleMapsComponents/Maps/Extension/MarkerList.cs index c98df9f4..c67d6d74 100644 --- a/GoogleMapsComponents/Maps/Extension/MarkerList.cs +++ b/GoogleMapsComponents/Maps/Extension/MarkerList.cs @@ -8,12 +8,41 @@ namespace GoogleMapsComponents.Maps.Extension; /// -/// A class able to manage a lot of Marker objects and get / set their -/// properties at the same time, eventually with different values -/// Main concept is that each Marker to can be distinguished by other ones need -/// to have a "unique key" with a "external world mean", so not necessary it's GUID -/// -/// All properties should be called with a Dictionary indicating for each Marker(related to that key) the corresponding related property value +/// +/// A class able to manage a lot of Marker objects and get / set their properties at the same time, eventually with different values +/// +/// +/// Main concept is that for each Marker to be distinguished from other ones, it needs +/// to have a "unique key" with an "external world meaning", so not necessarily a GUID. +/// +/// +/// In real cases Markers are likely to be linked to places, activities, transit stops and so on -> So, what better way to choose as Marker "unique key" the "id" of the object each marker is related to? +/// A string key has been selected as type due to its implicit versatility. +/// +/// +/// To create Markers, simply call MarkerList.CreateAsync with a Dictionary of desired Marker keys and MarkerOptions values. +/// After that, a new instance of MarkerList class will be returned with its Markers dictionary member populated with the corresponding results +/// +/// +/// At run-time is possible to:
+/// +/// add Marker to the same MarkerList class using AddMultipleAsync method (only keys not matching with existent Marker keys will be created)
+/// Markers dictionary will contain "union distinct" of existent Marker's keys and new keys
+///
+/// remove Marker from the MarkerList class (only Marker having keys matching with existent keys will be removed)
+/// Markers dictionary will contain "original - required and found" Marker's keys (eventually any is all Marker are removed)
+///
+///
+///
+/// +/// Each definer getter properties can be used as follows:
+/// a) without parameter -> all eventually defined markers related property will be returned (if any)
+/// b) with a List<string> of keys -> all eventually matching keys with Markers Dictionary keys produces related markers property extraction (if any defined) +///
+/// +/// Each setter properties can be used as follows:
+/// With a Dictionary<string, {property type}> indicating for each Marker (related to that key) the corresponding related property value. +///
///
public class MarkerList : ListableEntityListBase { @@ -23,8 +52,8 @@ public class MarkerList : ListableEntityListBase /// Create markers list /// /// - /// Dictionary of desired Marker keys and MarkerOptions values. Key as any type unique key. Not nessary Guid - /// new instance of MarkerList class will be returned with its Markers dictionary member populated with the corresponding results + /// Dictionary of desired Marker keys and MarkerOptions values. Key as any type unique key. Not necessarily Guid + /// New instance of MarkerList class will be returned with its Markers dictionary member populated with the corresponding results public static async Task CreateAsync(IJSRuntime jsRuntime, Dictionary opts) { var jsObjectRef = new JsObjectRef(jsRuntime, Guid.NewGuid()); @@ -100,9 +129,8 @@ public async Task SetMultipleAsync(Dictionary opts) } /// - /// only keys not matching with existent Marker keys will be created + /// Only keys not matching with existent Marker keys will be created /// - /// /// public async Task AddMultipleAsync(Dictionary opts) { @@ -111,7 +139,7 @@ public async Task AddMultipleAsync(Dictionary opts) public Task> GetAnimations(List? filterKeys = null) { - var matchingKeys = ComputeMathingKeys(filterKeys); + var matchingKeys = ComputeMatchingKeys(filterKeys); if (matchingKeys.Any()) { @@ -130,7 +158,7 @@ public Task> GetAnimations(List? filterKey public Task> GetClickables(List? filterKeys = null) { - var matchingKeys = ComputeMathingKeys(filterKeys); + var matchingKeys = ComputeMatchingKeys(filterKeys); if (matchingKeys.Any()) { @@ -149,7 +177,7 @@ public Task> GetClickables(List? filterKeys = n public Task> GetCursors(List? filterKeys = null) { - var matchingKeys = ComputeMathingKeys(filterKeys); + var matchingKeys = ComputeMatchingKeys(filterKeys); if (matchingKeys.Any()) { @@ -168,7 +196,7 @@ public Task> GetCursors(List? filterKeys = nu public Task>> GetIcons(List? filterKeys = null) { - var matchingKeys = ComputeMathingKeys(filterKeys); + var matchingKeys = ComputeMatchingKeys(filterKeys); if (matchingKeys.Any()) { @@ -187,7 +215,7 @@ public Task>> GetIcons(List> GetLabels(List? filterKeys = null) { - var matchingKeys = ComputeMathingKeys(filterKeys); + var matchingKeys = ComputeMatchingKeys(filterKeys); if (matchingKeys.Any()) { @@ -206,7 +234,7 @@ public Task> GetLabels(List? filterKeys = nul public Task> GetPositions(List? filterKeys = null) { - var matchingKeys = ComputeMathingKeys(filterKeys); + var matchingKeys = ComputeMatchingKeys(filterKeys); if (matchingKeys.Any()) { @@ -225,7 +253,7 @@ public Task> GetPositions(List? filter public Task> GetShapes(List? filterKeys = null) { - var matchingKeys = ComputeMathingKeys(filterKeys); + var matchingKeys = ComputeMatchingKeys(filterKeys); if (matchingKeys.Any()) { @@ -244,7 +272,7 @@ public Task> GetShapes(List? filterKeys public Task> GetTitles(List? filterKeys = null) { - var matchingKeys = ComputeMathingKeys(filterKeys); + var matchingKeys = ComputeMatchingKeys(filterKeys); if (matchingKeys.Any()) { @@ -263,7 +291,7 @@ public Task> GetTitles(List? filterKeys = nul public Task> GetZIndexes(List? filterKeys = null) { - var matchingKeys = ComputeMathingKeys(filterKeys); + var matchingKeys = ComputeMatchingKeys(filterKeys); if (matchingKeys.Any()) { diff --git a/GoogleMapsComponents/Maps/Extension/PolygonList.cs b/GoogleMapsComponents/Maps/Extension/PolygonList.cs index 40d04a4a..e9b95000 100644 --- a/GoogleMapsComponents/Maps/Extension/PolygonList.cs +++ b/GoogleMapsComponents/Maps/Extension/PolygonList.cs @@ -7,12 +7,11 @@ namespace GoogleMapsComponents.Maps.Extension; /// -/// A class able to manage a lot of Polygon objects and get / set their -/// properties at the same time, eventually with different values -/// Main concept is that each Polygon to can be distinguished by other ones need -/// to have a "unique key" with a "external world mean", so not necessary it's GUID -/// -/// All properties should be called With a Dictionary indicating for each Polygon(related to that key) the corresponding related property value +/// A class able to manage a lot of Polygon objects and get / set their +/// properties at the same time, eventually with different values.
+/// Main concept is that for each Polygon to be distinguished from other ones, it needs +/// to have a "unique key" with an "external world meaning", so not necessarily a GUID
+/// All properties should be called With a Dictionary<string, {property type}> indicating for each Polygon (related to that key) the corresponding related property value ///
public class PolygonList : ListableEntityListBase { @@ -22,8 +21,8 @@ public class PolygonList : ListableEntityListBase /// Create polygons list /// /// - /// Dictionary of desired Polygon keys and PolygonOptions values. Key as any type unique key. Not nessary Guid - /// new instance of PolygonList class will be returned with its Polygons dictionary member populated with the corresponding results + /// Dictionary of desired Polygon keys and PolygonOptions values. Key as any type unique key. Not necessarily Guid + /// New instance of PolygonList class will be returned with its Polygons dictionary member populated with the corresponding results public static async Task CreateAsync(IJSRuntime jsRuntime, Dictionary opts) { JsObjectRef jsObjectRef = new JsObjectRef(jsRuntime, Guid.NewGuid()); @@ -106,7 +105,7 @@ public async Task AddMultipleAsync(Dictionary opts) public Task> GetEditables(List filterKeys = null) { - List matchingKeys = ComputeMathingKeys(filterKeys); + List matchingKeys = ComputeMatchingKeys(filterKeys); if (matchingKeys.Any()) { diff --git a/GoogleMapsComponents/Maps/Extension/PolylineList.cs b/GoogleMapsComponents/Maps/Extension/PolylineList.cs index cc4cca32..ed0dfa3b 100644 --- a/GoogleMapsComponents/Maps/Extension/PolylineList.cs +++ b/GoogleMapsComponents/Maps/Extension/PolylineList.cs @@ -7,23 +7,22 @@ namespace GoogleMapsComponents.Maps.Extension; /// -/// A class able to manage a lot of Polyline objects and get / set their -/// properties at the same time, eventually with different values -/// Main concept is that each Polyline to can be distinguished by other ones need -/// to have a "unique key" with a "external world mean", so not necessary it's GUID -/// -/// All properties should be called With a Dictionary indicating for each Polyline(related to that key) the corresponding related property value +/// A class able to manage a lot of Polyline objects and get / set their +/// properties at the same time, eventually with different values.
+/// Main concept is that for each Polyline to be distinguished from other ones, it needs +/// to have a "unique key" with an "external world meaning", so not necessarily a GUID
+/// All properties should be called With a Dictionary<string, {property type}> indicating for each Polyline (related to that key) the corresponding related property value ///
public class PolylineList : ListableEntityListBase { public Dictionary Polylines => base.BaseListableEntities; /// - /// Create circles list + /// Create polylines list /// /// - /// Dictionary of desired Polyline keys and PolylineOptions values. Key as any type unique key. Not nessary Guid - /// new instance of PolylineList class will be returned with its Polylines dictionary member populated with the corresponding results + /// Dictionary of desired Polyline keys and PolylineOptions values. Key as any type unique key. Not necessarily Guid + /// New instance of PolylineList class will be returned with its Polylines dictionary member populated with the corresponding results public static async Task CreateAsync(IJSRuntime jsRuntime, Dictionary opts) { JsObjectRef jsObjectRef = new JsObjectRef(jsRuntime, Guid.NewGuid()); @@ -40,7 +39,7 @@ public static async Task CreateAsync(IJSRuntime jsRuntime, Diction } /// - /// Sync list over lifetime: Create and remove list depending on entity count; + /// Sync list over lifetime: Create and remove list depending on entity count; /// entities will be removed, added or changed to mirror the given set. /// /// @@ -51,19 +50,26 @@ public static async Task CreateAsync(IJSRuntime jsRuntime, Diction /// /// The managed list. Assign to the variable you used as parameter. /// - public static async Task SyncAsync(PolylineList list,IJSRuntime jsRuntime, Dictionary opts,Action clickCallback=null) + public static async Task SyncAsync(PolylineList list, IJSRuntime jsRuntime, Dictionary opts, Action clickCallback = null) { - if (opts.Count==0) { - if (list!=null) { + if (opts.Count == 0) + { + if (list != null) + { await list.SetMultipleAsync(opts); - list=null; + list = null; } - } else { - if (list==null) { - list = await PolylineList.CreateAsync(jsRuntime,new Dictionary()); - if (clickCallback!=null) { - list.EntityClicked+=(sender,e)=>{ - clickCallback(e.MouseEvent,e.Key,e.Entity); + } + else + { + if (list == null) + { + list = await PolylineList.CreateAsync(jsRuntime, new Dictionary()); + if (clickCallback != null) + { + list.EntityClicked += (sender, e) => + { + clickCallback(e.MouseEvent, e.Key, e.Entity); }; } } @@ -99,7 +105,7 @@ public async Task AddMultipleAsync(Dictionary opts) public Task> GetBounds(List filterKeys = null) { - List matchingKeys = ComputeMathingKeys(filterKeys); + List matchingKeys = ComputeMatchingKeys(filterKeys); if (matchingKeys.Any()) { @@ -118,7 +124,7 @@ public Task> GetBounds(List filt public Task> GetCenters(List filterKeys = null) { - List matchingKeys = ComputeMathingKeys(filterKeys); + List matchingKeys = ComputeMatchingKeys(filterKeys); if (matchingKeys.Any()) { @@ -137,7 +143,7 @@ public Task> GetCenters(List filterKey public Task> GetEditables(List filterKeys = null) { - List matchingKeys = ComputeMathingKeys(filterKeys); + List matchingKeys = ComputeMatchingKeys(filterKeys); if (matchingKeys.Any()) { @@ -156,7 +162,7 @@ public Task> GetEditables(List filterKeys = nul public Task> GetRadiuses(List filterKeys = null) { - List matchingKeys = ComputeMathingKeys(filterKeys); + List matchingKeys = ComputeMatchingKeys(filterKeys); if (matchingKeys.Any()) { diff --git a/GoogleMapsComponents/Maps/FullscreenControlOptions.cs b/GoogleMapsComponents/Maps/FullscreenControlOptions.cs index bd3c53cb..7592a73e 100644 --- a/GoogleMapsComponents/Maps/FullscreenControlOptions.cs +++ b/GoogleMapsComponents/Maps/FullscreenControlOptions.cs @@ -1,5 +1,13 @@ -namespace GoogleMapsComponents.Maps; +using System.Text.Json.Serialization; + +namespace GoogleMapsComponents.Maps; public class FullscreenControlOptions { + /// + /// Position id. Used to specify the position of the control on the map.
+ /// The default position is RightTop. + ///
+ [JsonConverter(typeof(EnumMemberConverter))] + public ControlPosition Position { get; set; } } \ No newline at end of file diff --git a/GoogleMapsComponents/Maps/InfoWindow.cs b/GoogleMapsComponents/Maps/InfoWindow.cs index 9ab1c099..a06bea78 100644 --- a/GoogleMapsComponents/Maps/InfoWindow.cs +++ b/GoogleMapsComponents/Maps/InfoWindow.cs @@ -2,32 +2,11 @@ using Microsoft.JSInterop; using System; using System.Threading.Tasks; -// ReSharper disable InvalidXmlDocComment namespace GoogleMapsComponents.Maps; /// -/// A class able to manage a lot of Marker objects and get / set their properties at the same time, eventually with different values -/// -/// Main concept is that each Marker to can be distinguished by other ones need to have a "unique key" with a "external world mean", so not necessary it's GUID -/// In real cases Markers are be linked to places, activities, transit stops and so on -> So, what better way to choose as Marker "unique key" the "id" of the object each marker is related to? -/// A string key has been selected as type due to its implicit versatility. -/// -/// To create Markers, simply call MarkerList.CreateAsync with a Dictionary of desired Marker keys and MarkerOptions values -/// After that, a new instance of MarkerList class will be returned with its Markers dictionary member populated with the corresponding results -/// -/// At run-time is possible to: -/// 1) add Marker to the same MarketList class using AddMultipleAsync method (only keys not matching with existent Marker keys will be created) -/// Markers dictionary will contains "union distinct" of existent Marker's keys and new keys -/// 2) remove Marker from the MarketList class (only Marker having keys matching with existent keys will be removed) -/// Markers dictionary will contains "original - required and found" Marker's keys (eventually any is all Marker are removed) -/// -/// Each definer getter properties can be used as follow: -/// a) without parameter -> all eventually defined markers related property will be returned (if any) -/// b) with a List of keys -> all eventually mathing keys with Markers Dictionary keys produces related merkers property extracion (if any defined) -/// -/// Each setter properties can be used as follow: -/// With a Dictionary indicating for each Marker (related to that key) the corresponding related property value +/// An overlay that looks like a bubble and is often connected to a marker. /// public class InfoWindow : EventEntityBase, IJsObjectRef { @@ -54,10 +33,10 @@ public static async Task CreateAsync(IJSRuntime jsRuntime, InfoWindo } /// - /// Creates an info window with the given options. - /// An InfoWindow can be placed on a map at a particular position or above a marker, depending on what is specified in the options. - /// Unless auto-pan is disabled, an InfoWindow will pan the map to make itself visible when it is opened. - /// After constructing an InfoWindow, you must call open to display it on the map. + /// Creates an info window with the given options.
+ /// An InfoWindow can be placed on a map at a particular position or above a marker, depending on what is specified in the options. + /// Unless auto-pan is disabled, an InfoWindow will pan the map to make itself visible when it is opened. + /// After constructing an InfoWindow, you must call open to display it on the map. /// The user can click the close button on the InfoWindow to remove it from the map, or the developer can call close() for the same effect. ///
/// diff --git a/GoogleMapsComponents/Maps/Map.cs b/GoogleMapsComponents/Maps/Map.cs index 06c12f42..7fadc45e 100644 --- a/GoogleMapsComponents/Maps/Map.cs +++ b/GoogleMapsComponents/Maps/Map.cs @@ -66,8 +66,6 @@ public async Task RemoveAllImageLayers() await _jsObjectRef.JSRuntime.MyInvokeAsync("blazorGoogleMaps.objectManager.removeAllImageLayers", this.Guid.ToString()); } - - /// /// Sets the viewport to contain the given bounds. /// @@ -230,8 +228,6 @@ public Task SetOptions(MapOptions mapOptions) return _jsObjectRef.InvokeAsync("setOptions", mapOptions); } - - public override async ValueTask DisposeAsync() { // Perform async cleanup. @@ -253,7 +249,6 @@ protected override async ValueTask DisposeAsyncCore() protected override void Dispose(bool disposing) { - if (!_isDisposed) { base.Dispose(disposing); diff --git a/GoogleMapsComponents/Maps/MapOptions.cs b/GoogleMapsComponents/Maps/MapOptions.cs index 7309375a..96e0e710 100644 --- a/GoogleMapsComponents/Maps/MapOptions.cs +++ b/GoogleMapsComponents/Maps/MapOptions.cs @@ -8,8 +8,8 @@ namespace GoogleMapsComponents.Maps; public class MapOptions { /// - /// Color used for the background of the Map div. - /// This color will be visible when tiles have not yet loaded as the user pans. + /// Color used for the background of the Map div.
+ /// This color will be visible when tiles have not yet loaded as the user pans.
/// This option can only be set when the map is initialized. ///
public string BackgroundColor { get; set; } @@ -20,8 +20,8 @@ public class MapOptions public LatLngLiteral? Center { get; set; } /// - /// When false, map icons are not clickable. - /// A map icon represents a point of interest, also known as a POI. + /// When false, map icons are not clickable.
+ /// A map icon represents a point of interest, also known as a POI.
/// By default map icons are clickable. ///
public bool? ClickableIcons { get; set; } @@ -42,18 +42,18 @@ public class MapOptions public bool? Draggable { get; set; } /// - /// The name or url of the cursor to display when mousing over a draggable map. - /// This property uses the css cursor attribute to change the icon. - /// As with the css property, you must specify at least one fallback cursor that is not a URL. - /// For example: draggableCursor: 'url(http://www.example.com/icon.png), auto;'. + /// The name or url of the cursor to display when mousing over a draggable map.
+ /// This property uses the css cursor attribute to change the icon.
+ /// As with the css property, you must specify at least one fallback cursor that is not a URL.
+ /// For example: draggableCursor: 'url(http://www.example.com/icon.png), auto;'. ///
public string DraggableCursor { get; set; } /// - /// The name or url of the cursor to display when the map is being dragged. - /// This property uses the css cursor attribute to change the icon. - /// As with the css property, you must specify at least one fallback cursor that is not a URL. - /// For example: draggingCursor: 'url(http://www.example.com/icon.png), auto;'. + /// The name or url of the cursor to display when the map is being dragged.
+ /// This property uses the css cursor attribute to change the icon.
+ /// As with the css property, you must specify at least one fallback cursor that is not a URL.
+ /// For example: draggingCursor: 'url(http://www.example.com/icon.png), auto;'. ///
public string DraggingCursor { get; set; } @@ -69,21 +69,23 @@ public class MapOptions /// /// This setting controls how the API handles gestures on the map. Allowed values: - /// "cooperative": Scroll events and one-finger touch gestures scroll the page, and do not zoom or pan the map. Two-finger touch gestures pan and zoom the map. Scroll events with a ctrl key or ⌘ key pressed zoom the map. In this mode the map cooperates with the page. - /// "greedy": All touch gestures and scroll events pan or zoom the map. - /// "none": The map cannot be panned or zoomed by user gestures. - /// "auto": (default) Gesture handling is either cooperative or greedy, depending on whether the page is scrollable or in an iframe. + /// + /// "cooperative" Scroll events and one-finger touch gestures scroll the page, and do not zoom or pan the map. Two-finger touch gestures pan and zoom the map. Scroll events with a ctrl key or ⌘ key pressed zoom the map. In this mode the map cooperates with the page. + /// "greedy" All touch gestures and scroll events pan or zoom the map. + /// "none" The map cannot be panned or zoomed by user gestures. + /// "auto" (default) Gesture handling is either cooperative or greedy, depending on whether the page is scrollable or in an iframe. + /// /// public string GestureHandling { get; set; } /// - /// The heading for aerial imagery in degrees measured clockwise from cardinal direction North. + /// The heading for aerial imagery in degrees measured clockwise from cardinal direction North.
/// Headings are snapped to the nearest available angle for which imagery is available. ///
public int? Heading { get; set; } /// - /// The heading for aerial imagery in degrees measured clockwise from cardinal direction North. + /// The heading for aerial imagery in degrees measured clockwise from cardinal direction North.
/// Headings are snapped to the nearest available angle for which imagery is available. ///
public bool? KeyboardShortcuts { get; set; } @@ -101,20 +103,19 @@ public class MapOptions /// /// The initial Map mapTypeId. Defaults to ROADMAP. /// - //[JsonConverter(typeof(StringEnumConverter))] [JsonConverter(typeof(EnumMemberConverter))] public MapTypeId MapTypeId { get; set; } /// - /// The maximum zoom level which will be displayed on the map. - /// If omitted, or set to null, the maximum zoom from the current map type is used instead. + /// The maximum zoom level which will be displayed on the map.
+ /// If omitted, or set to null, the maximum zoom from the current map type is used instead.
/// Valid values: Integers between zero, and up to the supported maximum zoom level. ///
public int? MaxZoom { get; set; } /// - /// The minimum zoom level which will be displayed on the map. - /// If omitted, or set to null, the minimum zoom from the current map type is used instead. + /// The minimum zoom level which will be displayed on the map.
+ /// If omitted, or set to null, the minimum zoom from the current map type is used instead.
/// Valid values: Integers between zero, and up to the supported maximum zoom level. ///
public int? MinZoom { get; set; } @@ -135,7 +136,7 @@ public class MapOptions public PanControlOptions? PanControlOptions { get; set; } /// - /// Defines a boundary that restricts the area of the map accessible to users. + /// Defines a boundary that restricts the area of the map accessible to users.
/// When set, a user can only pan and zoom while the camera view stays inside the limits of the boundary. ///
public MapRestriction? Restriction { get; set; } @@ -161,19 +162,19 @@ public class MapOptions public ScaleControlOptions? ScaleControlOptions { get; set; } /// - /// If false, disables zooming on the map using a mouse scroll wheel. + /// If false, disables zooming on the map using a mouse scroll wheel.
/// The scrollwheel is enabled by default. ///
public bool? Scrollwheel { get; set; } - /// - /// A StreetViewPanorama to display when the Street View pegman is dropped on the map. - /// If no panorama is specified, a default StreetViewPanorama will be displayed in the map's div when the pegman is dropped. - /// + ///// + ///// A StreetViewPanorama to display when the Street View pegman is dropped on the map.
+ ///// If no panorama is specified, a default StreetViewPanorama will be displayed in the map's div when the pegman is dropped. + /////
//public StreetViewPanorama streetView { get; set; } /// - /// The initial enabled/disabled state of the Street View Pegman control. + /// The initial enabled/disabled state of the Street View Pegman control.
/// This control is part of the default UI, and should be set to false when displaying a map type on which the Street View road overlay should not appear (e.g. a non-Earth map type). ///
public bool? StreetViewControl { get; set; } @@ -184,22 +185,24 @@ public class MapOptions public StreetViewControlOptions? StreetViewControlOptions { get; set; } /// - /// Styles to apply to each of the default map types. + /// Styles to apply to each of the default map types.
/// Note that for satellite/hybrid and terrain modes, these styles will only apply to labels and geometry. ///
public MapTypeStyle[] Styles { get; set; } /// - /// Controls the automatic switching behavior for the angle of incidence of the map. - /// The only allowed values are 0 and 45. The value 0 causes the map to always use a 0° overhead view regardless of the zoom level and viewport. - /// The value 45 causes the tilt angle to automatically switch to 45 whenever 45° imagery is available for the current zoom level and viewport, and switch back to 0 whenever 45° imagery is not available (this is the default behavior). 45° imagery is only available for satellite and hybrid map types, within some locations, and at some zoom levels. - /// Note: getTilt returns the current tilt angle, not the value specified by this option. + /// Controls the automatic switching behavior for the angle of incidence of the map.
+ /// The only allowed values are 0 and 45. The value 0 causes the map to always use a 0° overhead view regardless of the zoom level and viewport.
+ /// The value 45 causes the tilt angle to automatically switch to 45 whenever 45° imagery is available for the current zoom level and viewport, and + /// switch back to 0 whenever 45° imagery is not available (this is the default behavior). 45° imagery is only available for satellite and hybrid map + /// types, within some locations, and at some zoom levels.
+ /// Note: getTilt returns the current tilt angle, not the value specified by this option. ///
public int? Tilt { get; set; } /// - /// The initial Map zoom level. - /// Required. + /// The initial Map zoom level.
+ /// Required.
/// Valid values: Integers between zero, and up to the supported maximum zoom level. ///
public int? Zoom { get; set; } @@ -215,8 +218,8 @@ public class MapOptions public ZoomControlOptions? ZoomControlOptions { get; set; } /// - /// Type: string optional - /// The unique identifier that represents a single instance of a Google Map. + /// Type: string optional
+ /// The unique identifier that represents a single instance of a Google Map.
/// You can create Map IDs and update a style associated with a /// Map ID at any time in the Google Cloud Console Maps Management /// page without changing embedded JSON styling in your application code. diff --git a/GoogleMapsComponents/Maps/MapTypeControlOptions.cs b/GoogleMapsComponents/Maps/MapTypeControlOptions.cs index dc474b20..3f27b681 100644 --- a/GoogleMapsComponents/Maps/MapTypeControlOptions.cs +++ b/GoogleMapsComponents/Maps/MapTypeControlOptions.cs @@ -1,4 +1,6 @@ -namespace GoogleMapsComponents.Maps; +using System.Text.Json.Serialization; + +namespace GoogleMapsComponents.Maps; /// /// Options for the rendering of the map type control. @@ -8,9 +10,18 @@ public class MapTypeControlOptions /// /// IDs of map types to show in the control. /// - public MapTypeId[] mapTypeIds { get; set; } + public MapTypeId[] MapTypeIds { get; set; } - public ControlPosition position { get; set; } + /// + /// Position id. Used to specify the position of the control on the map.
+ /// The default position is TopLeft. + ///
+ [JsonConverter(typeof(EnumMemberConverter))] + public ControlPosition Position { get; set; } - public MapTypeControlStyle style { get; set; } + /// + /// Style id. Used to select what style of map type control to display. + /// + [JsonConverter(typeof(EnumMemberConverter))] + public MapTypeControlStyle Style { get; set; } } \ No newline at end of file diff --git a/GoogleMapsComponents/Maps/MapTypeControlStyle.cs b/GoogleMapsComponents/Maps/MapTypeControlStyle.cs index d2a485b2..f3162963 100644 --- a/GoogleMapsComponents/Maps/MapTypeControlStyle.cs +++ b/GoogleMapsComponents/Maps/MapTypeControlStyle.cs @@ -1,21 +1,26 @@ -namespace GoogleMapsComponents.Maps; +using System.Runtime.Serialization; -public class MapTypeControlStyle +namespace GoogleMapsComponents.Maps; + +public enum MapTypeControlStyle { /// - /// Uses the default map type control. - /// When the DEFAULT control is shown, it will vary according to window size and other factors. + /// Uses the default map type control. + /// When the DEFAULT control is shown, it will vary according to window size and other factors. /// The DEFAULT control may change in future versions of the API. /// - public const string DEFAULT = "DEFAULT"; + [EnumMember(Value = "0")] //Docs say "DEFAULT + Default, /// /// A dropdown menu for the screen realestate conscious. /// - public const string DROPDOWN_MENU = "DROPDOWN_MENU"; + [EnumMember(Value = "2")] //Docs say "DROPDOWN_MENU" + DropdownMenu, /// /// The standard horizontal radio buttons bar. /// - public const string HORIZONTAL_BAR = "HORIZONTAL_BAR"; + [EnumMember(Value = "1")] //Docs say "HORIZONTAL_BAR" + HorizontalBar } \ No newline at end of file diff --git a/GoogleMapsComponents/Maps/MarkerOptions.cs b/GoogleMapsComponents/Maps/MarkerOptions.cs index e7e13a1f..7e910b1c 100644 --- a/GoogleMapsComponents/Maps/MarkerOptions.cs +++ b/GoogleMapsComponents/Maps/MarkerOptions.cs @@ -16,7 +16,7 @@ public class MarkerOptions : ListableEntityOptionsBase public Animation? Animation { get; set; } /// - /// If false, disables cross that appears beneath the marker when dragging. + /// If false, disables cross that appears beneath the marker when dragging.
/// This option is true by default. ///
public bool? CrossOnDrag { get; set; } @@ -27,7 +27,7 @@ public class MarkerOptions : ListableEntityOptionsBase public string Cursor { get; set; } /// - /// Icon for the foreground. + /// Icon for the foreground.
/// If a string is provided, it is treated as though it were an Icon with the string as url. ///
//[JsonConverter(typeof(OneOfConverter))] @@ -45,8 +45,8 @@ public class MarkerOptions : ListableEntityOptionsBase public float? Opacity { get; set; } /// - /// Optimization renders many markers as a single static element. - /// Optimized rendering is enabled by default. + /// Optimization renders many markers as a single static element.
+ /// Optimized rendering is enabled by default.
/// Disable optimized rendering for animated GIFs or PNGs, or when each marker must be rendered as a separate DOM element (advanced usage only) ///
public bool? Optimized { get; set; } diff --git a/GoogleMapsComponents/Maps/MarkerShape.cs b/GoogleMapsComponents/Maps/MarkerShape.cs index bfd29102..6f4345c0 100644 --- a/GoogleMapsComponents/Maps/MarkerShape.cs +++ b/GoogleMapsComponents/Maps/MarkerShape.cs @@ -3,22 +3,22 @@ namespace GoogleMapsComponents.Maps; /// -/// This object defines the clickable region of a marker image. +/// This object defines the clickable region of a marker image.
/// The shape consists of two properties — type and coord — which define the non-transparent region of an image. ///
public class MarkerShape { /// - /// The format of this attribute depends on the value of the type and follows the w3 AREA coords specification found at http://www.w3.org/TR/REC-html40/struct/objects.html#adef-coords. - /// The coords attribute is an array of integers that specify the pixel position of the shape relative to the top-left corner of the target image.The coordinates depend on the value of type as follows: - /// - circle: coords is [x1, y1, r] where x1, y2 are the coordinates of the center of the circle, and r is the radius of the circle. - /// - poly: coords is [x1, y1, x2, y2...xn, yn] where each x, y pair contains the coordinates of one vertex of the polygon. + /// The format of this attribute depends on the value of the type and follows the w3 AREA coords specification found at http://www.w3.org/TR/REC-html40/struct/objects.html#adef-coords.
+ /// The coords attribute is an array of integers that specify the pixel position of the shape relative to the top-left corner of the target image.The coordinates depend on the value of type as follows:
+ /// - circle: coords is [x1, y1, r] where x1, y2 are the coordinates of the center of the circle, and r is the radius of the circle.
+ /// - poly: coords is [x1, y1, x2, y2...xn, yn] where each x, y pair contains the coordinates of one vertex of the polygon.
/// - rect: coords is [x1, y1, x2, y2] where x1, y1 are the coordinates of the upper-left corner of the rectangle and x2, y2 are the coordinates of the lower-right coordinates of the rectangle. ///
public IEnumerable Coords { get; set; } /// - /// Describes the shape's type and can be circle, poly or rect. + /// Describes the shape's type and can be: circle, poly or rect. /// public string Type { get; set; } } \ No newline at end of file diff --git a/GoogleMapsComponents/Maps/PanControlOptions.cs b/GoogleMapsComponents/Maps/PanControlOptions.cs index fbd8e9d4..2c7d4b40 100644 --- a/GoogleMapsComponents/Maps/PanControlOptions.cs +++ b/GoogleMapsComponents/Maps/PanControlOptions.cs @@ -1,4 +1,6 @@ -namespace GoogleMapsComponents.Maps; +using System.Text.Json.Serialization; + +namespace GoogleMapsComponents.Maps; /// /// Options for the rendering of the pan control. @@ -6,8 +8,9 @@ public class PanControlOptions { /// - /// Position id. Used to specify the position of the control on the map. - /// The default position is TOP_LEFT. + /// Position id. Used to specify the position of the control on the map. + /// The default position is RightBottom. /// - public ControlPosition position { get; set; } + [JsonConverter(typeof(EnumMemberConverter))] + public ControlPosition Position { get; set; } } \ No newline at end of file diff --git a/GoogleMapsComponents/Maps/PolygonOptions.cs b/GoogleMapsComponents/Maps/PolygonOptions.cs index ae90b4cd..c58f81bb 100644 --- a/GoogleMapsComponents/Maps/PolygonOptions.cs +++ b/GoogleMapsComponents/Maps/PolygonOptions.cs @@ -9,7 +9,7 @@ namespace GoogleMapsComponents.Maps; public class PolygonOptions : ListableEntityOptionsBase { /// - /// If set to true, the user can edit this shape by dragging the control points shown at the vertices and on each segment. + /// If set to true, the user can edit this shape by dragging the control points shown at the vertices and on each segment.
/// Defaults to false. ///
public bool? Editable { get; set; } @@ -25,20 +25,20 @@ public class PolygonOptions : ListableEntityOptionsBase public float? FillOpacity { get; set; } /// - /// When true, edges of the polygon are interpreted as geodesic and will follow the curvature of the Earth. - /// When false, edges of the polygon are rendered as straight lines in screen space. - /// Note that the shape of a geodesic polygon may appear to change when dragged, as the dimensions are maintained relative to the surface of the earth. + /// When true, edges of the polygon are interpreted as geodesic and will follow the curvature of the Earth.
+ /// When false, edges of the polygon are rendered as straight lines in screen space.
+ /// Note that the shape of a geodesic polygon may appear to change when dragged, as the dimensions are maintained relative to the surface of the earth.
/// Defaults to false. ///
- public bool? Getodesic { get; set; } + public bool? Geodesic { get; set; } /// - /// The ordered sequence of coordinates that designates a closed loop. - /// Unlike polylines, a polygon may consist of one or more paths. - /// As a result, the paths property may specify one or more arrays of LatLng coordinates. - /// Paths are closed automatically; do not repeat the first vertex of the path as the last vertex. - /// Simple polygons may be defined using a single array of LatLngs. More complex polygons may specify an array of arrays. - /// Any simple arrays are converted into MVCArrays. + /// The ordered sequence of coordinates that designates a closed loop.
+ /// Unlike polylines, a polygon may consist of one or more paths.
+ /// As a result, the paths property may specify one or more arrays of LatLng coordinates.
+ /// Paths are closed automatically; do not repeat the first vertex of the path as the last vertex.
+ /// Simple polygons may be defined using a single array of LatLngs. More complex polygons may specify an array of arrays.
+ /// Any simple arrays are converted into MVCArrays.
/// Inserting or removing LatLngs from the MVCArray will automatically update the polygon on the map. ///
public IEnumerable> Paths { get; set; } diff --git a/GoogleMapsComponents/Maps/PolylineOptions.cs b/GoogleMapsComponents/Maps/PolylineOptions.cs index 94a9afa1..a964ff77 100644 --- a/GoogleMapsComponents/Maps/PolylineOptions.cs +++ b/GoogleMapsComponents/Maps/PolylineOptions.cs @@ -8,14 +8,14 @@ namespace GoogleMapsComponents.Maps; public class PolylineOptions : ListableEntityOptionsBase { /// - /// If set to true, the user can edit this shape by dragging the control points shown at the vertices and on each segment. + /// If set to true, the user can edit this shape by dragging the control points shown at the vertices and on each segment.
/// Defaults to false. ///
public bool? Editable { get; set; } /// - /// When true, edges of the polygon are interpreted as geodesic and will follow the curvature of the Earth. When false, edges of the polygon are rendered as straight lines in screen space. - /// Note that the shape of a geodesic polygon may appear to change when dragged, as the dimensions are maintained relative to the surface of the earth. + /// When true, edges of the polygon are interpreted as geodesic and will follow the curvature of the Earth. When false, edges of the polygon are rendered as straight lines in screen space.
+ /// Note that the shape of a geodesic polygon may appear to change when dragged, as the dimensions are maintained relative to the surface of the earth.
/// Defaults to false. ///
public bool? Geodesic { get; set; } @@ -45,11 +45,10 @@ public class PolylineOptions : ListableEntityOptionsBase ///
public int? StrokeWeight { get; set; } - /// + /// /// Hide the undo button - /// Undocuments property. + /// Undocumented property. /// https://issuetracker.google.com/issues/35821607 /// public bool? SuppressUndo { get; set; } - } \ No newline at end of file diff --git a/GoogleMapsComponents/Maps/RotateControlOptions.cs b/GoogleMapsComponents/Maps/RotateControlOptions.cs index e39761ee..f6ffdef4 100644 --- a/GoogleMapsComponents/Maps/RotateControlOptions.cs +++ b/GoogleMapsComponents/Maps/RotateControlOptions.cs @@ -1,4 +1,6 @@ -namespace GoogleMapsComponents.Maps; +using System.Text.Json.Serialization; + +namespace GoogleMapsComponents.Maps; /// /// Options for the rendering of the rotate control. @@ -6,8 +8,9 @@ public class RotateControlOptions { /// - /// Position id. Used to specify the position of the control on the map. - /// The default position is TOP_LEFT. + /// Position id. Used to specify the position of the control on the map. + /// The default position is LeftBottom. /// - public ControlPosition position { get; set; } + [JsonConverter(typeof(EnumMemberConverter))] + public ControlPosition Position { get; set; } } \ No newline at end of file diff --git a/GoogleMapsComponents/Maps/ScaleControlOptions.cs b/GoogleMapsComponents/Maps/ScaleControlOptions.cs index c3a0165c..55d85cbd 100644 --- a/GoogleMapsComponents/Maps/ScaleControlOptions.cs +++ b/GoogleMapsComponents/Maps/ScaleControlOptions.cs @@ -1,9 +1,15 @@ -namespace GoogleMapsComponents.Maps; +using System.Text.Json.Serialization; + +namespace GoogleMapsComponents.Maps; /// /// Options for the rendering of the scale control. /// public class ScaleControlOptions { - public ScaleControlStyle style { get; set; } + /// + /// Style id. Used to select what style of scale control to display. + /// + [JsonConverter(typeof(EnumMemberConverter))] + public ScaleControlStyle Style { get; set; } } \ No newline at end of file diff --git a/GoogleMapsComponents/Maps/ScaleControlStyle.cs b/GoogleMapsComponents/Maps/ScaleControlStyle.cs index 7c5ce68b..5015fa24 100644 --- a/GoogleMapsComponents/Maps/ScaleControlStyle.cs +++ b/GoogleMapsComponents/Maps/ScaleControlStyle.cs @@ -1,12 +1,15 @@ -namespace GoogleMapsComponents.Maps; +using System.Runtime.Serialization; + +namespace GoogleMapsComponents.Maps; /// /// Identifiers for scale control ids. /// -public class ScaleControlStyle +public enum ScaleControlStyle { /// /// The standard scale control. /// - public const string DEFAULT = "DEFAULT"; + [EnumMember(Value = "DEFAULT")] + Default } \ No newline at end of file diff --git a/GoogleMapsComponents/Maps/StreetViewControlOptions.cs b/GoogleMapsComponents/Maps/StreetViewControlOptions.cs index ec37cef8..5c97e48d 100644 --- a/GoogleMapsComponents/Maps/StreetViewControlOptions.cs +++ b/GoogleMapsComponents/Maps/StreetViewControlOptions.cs @@ -1,4 +1,6 @@ -namespace GoogleMapsComponents.Maps; +using System.Text.Json.Serialization; + +namespace GoogleMapsComponents.Maps; /// /// Options for the rendering of the Street View pegman control on the map. @@ -6,10 +8,11 @@ public class StreetViewControlOptions { /// - /// Position id. Used to specify the position of the control on the map. - /// The default position is embedded within the navigation (zoom and pan) controls. - /// If this position is empty or the same as that specified in the zoomControlOptions or panControlOptions, the Street View control will be displayed as part of the navigation controls. + /// Position id. Used to specify the position of the control on the map.
+ /// The default position is embedded within the navigation (zoom and pan) controls.
+ /// If this position is empty or the same as that specified in the ZoomControlOptions or PanControlOptions, the Street View control will be displayed as part of the navigation controls. /// Otherwise, it will be displayed separately. ///
- public ControlPosition position { get; set; } + [JsonConverter(typeof(EnumMemberConverter))] + public ControlPosition Position { get; set; } } \ No newline at end of file diff --git a/GoogleMapsComponents/Maps/TransitOptions.cs b/GoogleMapsComponents/Maps/TransitOptions.cs index dee92e9b..564e75a6 100644 --- a/GoogleMapsComponents/Maps/TransitOptions.cs +++ b/GoogleMapsComponents/Maps/TransitOptions.cs @@ -15,19 +15,19 @@ public class TransitOptions public DateTime ArrivalTime { get; set; } /// - /// The desired departure time for the route. + /// The desired departure time for the route.
/// If neither departure time nor arrival time is specified, the time is assumed to be "now". ///
public DateTime DepartureTime { get; set; } /// - /// One or more preferred modes of transit, such as bus or train. + /// One or more preferred modes of transit, such as bus or train.
/// If no preference is given, the API returns the default best route. ///
public IEnumerable Modes { get; set; } /// - /// A preference that can bias the choice of transit route, such as less walking. + /// A preference that can bias the choice of transit route, such as less walking.
/// If no preference is given, the API returns the default best route. ///
public TransitRoutePreference RoutingPreference { get; set; } diff --git a/GoogleMapsComponents/Maps/TransitRoutePreference.cs b/GoogleMapsComponents/Maps/TransitRoutePreference.cs index c813c7be..b36e537f 100644 --- a/GoogleMapsComponents/Maps/TransitRoutePreference.cs +++ b/GoogleMapsComponents/Maps/TransitRoutePreference.cs @@ -1,7 +1,7 @@ namespace GoogleMapsComponents.Maps; /// -/// The valid transit route type that can be specified in a TransitOptions. +/// The valid transit route type that can be specified in a TransitOptions. /// public enum TransitRoutePreference { diff --git a/GoogleMapsComponents/Maps/ZoomControlOptions.cs b/GoogleMapsComponents/Maps/ZoomControlOptions.cs index 993b2d59..9f9d3a60 100644 --- a/GoogleMapsComponents/Maps/ZoomControlOptions.cs +++ b/GoogleMapsComponents/Maps/ZoomControlOptions.cs @@ -1,4 +1,6 @@ -namespace GoogleMapsComponents.Maps; +using System.Text.Json.Serialization; + +namespace GoogleMapsComponents.Maps; /// /// Options for the rendering of the zoom control. @@ -6,8 +8,9 @@ public class ZoomControlOptions { /// - /// Position id. Used to specify the position of the control on the map. - /// The default position is TOP_LEFT. + /// Position id. Used to specify the position of the control on the map. + /// The default position is LeftBottom. /// - public ControlPosition position { get; set; } + [JsonConverter(typeof(EnumMemberConverter))] + public ControlPosition Position { get; set; } } \ No newline at end of file diff --git a/ServerSideDemo/Pages/MapLegendPage.razor.cs b/ServerSideDemo/Pages/MapLegendPage.razor.cs index 12a8e939..dfddd932 100644 --- a/ServerSideDemo/Pages/MapLegendPage.razor.cs +++ b/ServerSideDemo/Pages/MapLegendPage.razor.cs @@ -19,15 +19,25 @@ public partial class MapLegendPage protected override void OnInitialized() { - _mapOptions = new MapOptions() + _mapOptions = new MapOptions { Zoom = 13, - Center = new LatLngLiteral() + ZoomControlOptions = new ZoomControlOptions + { + Position = ControlPosition.RightTop + }, + Center = new LatLngLiteral { Lat = 13.505892, Lng = 100.8162 }, - MapTypeId = MapTypeId.Roadmap + MapTypeId = MapTypeId.Roadmap, + MapTypeControlOptions = new MapTypeControlOptions + { + Position = ControlPosition.TopLeft, + Style = MapTypeControlStyle.DropdownMenu, + MapTypeIds = [MapTypeId.Roadmap, MapTypeId.Terrain, MapTypeId.Satellite, MapTypeId.Hybrid] + } }; }