Center: @_center
@@ -17,7 +15,7 @@ Zoom: @_map?.Zoom
-
+
-
-
@_featureInfo
diff --git a/src/OpenLayers.Blazor.Demo.Components/Pages/SwissMapLayersDemo.razor b/src/OpenLayers.Blazor.Demo.Components/Pages/SwissMapLayersDemo.razor
index dbeb29c..03f0d3c 100644
--- a/src/OpenLayers.Blazor.Demo.Components/Pages/SwissMapLayersDemo.razor
+++ b/src/OpenLayers.Blazor.Demo.Components/Pages/SwissMapLayersDemo.razor
@@ -3,13 +3,10 @@
@using System.Threading
@using System.Text.Json
-
-
-
+
+
+ Germany GDZ Demo
+
+
+
diff --git a/src/OpenLayers.Blazor/Circle.cs b/src/OpenLayers.Blazor/Circle.cs
index 1b5dbb2..59bca45 100644
--- a/src/OpenLayers.Blazor/Circle.cs
+++ b/src/OpenLayers.Blazor/Circle.cs
@@ -1,11 +1,10 @@
using Microsoft.AspNetCore.Components;
-using OpenLayers.Blazor.Internal;
namespace OpenLayers.Blazor;
public class Circle : Shape
{
- public Circle() : base (ShapeType.Circle)
+ public Circle() : base(ShapeType.Circle)
{
}
diff --git a/src/OpenLayers.Blazor/Coordinate.cs b/src/OpenLayers.Blazor/Coordinate.cs
index 828b2ee..2ee004f 100644
--- a/src/OpenLayers.Blazor/Coordinate.cs
+++ b/src/OpenLayers.Blazor/Coordinate.cs
@@ -32,10 +32,10 @@ public Coordinate(Coordinate coordinate)
X = coordinate.X;
}
-
+
public Coordinate(double[] coordinates)
{
- if (coordinates.Length < 2)
+ if (coordinates.Length < 2)
throw new ArgumentException(nameof(coordinates));
Value = coordinates;
}
diff --git a/src/OpenLayers.Blazor/Defaults.cs b/src/OpenLayers.Blazor/Defaults.cs
index 9082421..8198595 100644
--- a/src/OpenLayers.Blazor/Defaults.cs
+++ b/src/OpenLayers.Blazor/Defaults.cs
@@ -18,4 +18,6 @@ public class Defaults
[JsonConverter(typeof(JsonStringEnumConverter))]
public ScaleLineUnit ScaleLineUnit { get; set; } = ScaleLineUnit.Metric;
+
+ public int SerializationCoordinatesLimit { get; set; } = 255;
}
\ No newline at end of file
diff --git a/src/OpenLayers.Blazor/Feature.cs b/src/OpenLayers.Blazor/Feature.cs
index 000b0db..81b62d2 100644
--- a/src/OpenLayers.Blazor/Feature.cs
+++ b/src/OpenLayers.Blazor/Feature.cs
@@ -1,5 +1,4 @@
-using System.Collections.ObjectModel;
-using Microsoft.AspNetCore.Components;
+using Microsoft.AspNetCore.Components;
using OpenLayers.Blazor.Internal;
namespace OpenLayers.Blazor;
@@ -26,7 +25,7 @@ internal Feature(Internal.Feature feature)
}
///
- /// Identifier
+ /// Identifier
///
[Parameter]
public string Id
@@ -48,5 +47,4 @@ public string Id
public IEnumerable
? Coordinates => CoordinatesHelper.GetCoordinates(InternalFeature.Coordinates);
public IEnumerable> MultiCoordinates => CoordinatesHelper.GetMultiCoordinates(InternalFeature.Coordinates);
-
}
\ No newline at end of file
diff --git a/src/OpenLayers.Blazor/Internal/CoordinatesHelper.cs b/src/OpenLayers.Blazor/Internal/CoordinatesHelper.cs
index 7930e97..4164667 100644
--- a/src/OpenLayers.Blazor/Internal/CoordinatesHelper.cs
+++ b/src/OpenLayers.Blazor/Internal/CoordinatesHelper.cs
@@ -21,7 +21,7 @@ public static double[] SetPoint(Coordinate coordinate)
public static IEnumerable? GetCoordinates(dynamic coordinates)
{
if (coordinates is double[] c1)
- return new [] { new Coordinate(c1) };
+ return new[] { new Coordinate(c1) };
if (coordinates is IEnumerable c2)
return c2.Select(p => new Coordinate(p));
if (coordinates is IEnumerable> c3)
@@ -37,9 +37,9 @@ public static double[][] SetCoordinates(IEnumerable coordinates)
public static IEnumerable>? GetMultiCoordinates(dynamic coordinates)
{
if (coordinates is double[] c1)
- return new[] { new [] { new Coordinate(c1) } };
+ return new[] { new[] { new Coordinate(c1) } };
if (coordinates is IEnumerable c2)
- return new [] { c2.Select(p => new Coordinate(p)) };
+ return new[] { c2.Select(p => new Coordinate(p)) };
if (coordinates is IEnumerable> c3)
return c3.Select(p => p.Select(p2 => new Coordinate(p2)));
return null;
diff --git a/src/OpenLayers.Blazor/Internal/Feature.cs b/src/OpenLayers.Blazor/Internal/Feature.cs
index 58dfb64..aad82eb 100644
--- a/src/OpenLayers.Blazor/Internal/Feature.cs
+++ b/src/OpenLayers.Blazor/Internal/Feature.cs
@@ -1,7 +1,5 @@
-using System.Dynamic;
-using System.Text.Json;
+using System.Text.Json;
using System.Text.Json.Serialization;
-using Microsoft.Extensions.Logging.Abstractions;
namespace OpenLayers.Blazor.Internal;
@@ -31,14 +29,19 @@ public string? Type
public double[]? Point
{
get => CoordinatesHelper.GetPoint(Coordinates)?.Value;
- set
- {
- Coordinates = value;
- }
+ set => Coordinates = value;
}
public Dictionary Properties { get; set; } = new();
+
+ public bool Equals(Feature? other)
+ {
+ if (ReferenceEquals(null, other)) return false;
+ if (ReferenceEquals(this, other)) return true;
+ return Id.Equals(other.Id) && GeometryType == other.GeometryType && Coordinates.Equals(other.Coordinates) && Properties.Equals(other.Properties);
+ }
+
public T? GetProperty(string key)
{
if (Properties.ContainsKey(key))
@@ -56,19 +59,11 @@ public override int GetHashCode()
return HashCode.Combine(Id, GeometryType, Coordinates, Properties);
}
-
- public bool Equals(Feature? other)
- {
- if (ReferenceEquals(null, other)) return false;
- if (ReferenceEquals(this, other)) return true;
- return Id.Equals(other.Id) && GeometryType == other.GeometryType && Coordinates.Equals(other.Coordinates) && Properties.Equals(other.Properties);
- }
-
public override bool Equals(object? obj)
{
if (ReferenceEquals(null, obj)) return false;
if (ReferenceEquals(this, obj)) return true;
- if (obj.GetType() != this.GetType()) return false;
+ if (obj.GetType() != GetType()) return false;
return Equals((Feature)obj);
}
-}
+}
\ No newline at end of file
diff --git a/src/OpenLayers.Blazor/Internal/GeometryTypes.cs b/src/OpenLayers.Blazor/Internal/GeometryTypes.cs
index 295b95e..a6a8d4f 100644
--- a/src/OpenLayers.Blazor/Internal/GeometryTypes.cs
+++ b/src/OpenLayers.Blazor/Internal/GeometryTypes.cs
@@ -10,4 +10,4 @@ public enum GeometryTypes
MultiPoint,
MultiLineString,
MultiPolygon
-}
+}
\ No newline at end of file
diff --git a/src/OpenLayers.Blazor/Internal/Shape.cs b/src/OpenLayers.Blazor/Internal/Shape.cs
index 1a3c1d1..db15e5c 100644
--- a/src/OpenLayers.Blazor/Internal/Shape.cs
+++ b/src/OpenLayers.Blazor/Internal/Shape.cs
@@ -1,5 +1,4 @@
-using System.Text.Json;
-using System.Text.Json.Serialization;
+using System.Text.Json.Serialization;
namespace OpenLayers.Blazor.Internal;
@@ -60,11 +59,6 @@ public string? Content
public double? Scale { get; set; } = 1;
- public override int GetHashCode()
- {
- return HashCode.Combine(base.GetHashCode(), TextScale, Color, BorderColor, BorderSize, BackgroundColor, Radius, Scale);
- }
-
public bool Equals(Shape? other)
{
if (ReferenceEquals(null, other)) return false;
@@ -72,11 +66,16 @@ public bool Equals(Shape? other)
return base.GetHashCode() == other.GetHashCode();
}
+ public override int GetHashCode()
+ {
+ return HashCode.Combine(base.GetHashCode(), TextScale, Color, BorderColor, BorderSize, BackgroundColor, Radius, Scale);
+ }
+
public override bool Equals(object? obj)
{
if (ReferenceEquals(null, obj)) return false;
if (ReferenceEquals(this, obj)) return true;
- if (obj.GetType() != this.GetType()) return false;
+ if (obj.GetType() != GetType()) return false;
return Equals((Shape)obj);
}
}
\ No newline at end of file
diff --git a/src/OpenLayers.Blazor/Layer.cs b/src/OpenLayers.Blazor/Layer.cs
index 15da511..527ddca 100644
--- a/src/OpenLayers.Blazor/Layer.cs
+++ b/src/OpenLayers.Blazor/Layer.cs
@@ -175,11 +175,7 @@ public string? MatrixSet
public string? Format
{
get => _internalLayer.Source.Format;
- set
- {
- _internalLayer.Source.Format = value;
- _internalLayer.Source.Params["format"] = value;
- }
+ set => _internalLayer.Source.Format = value;
}
[Parameter]
@@ -199,15 +195,22 @@ public string? ServerType
[Parameter]
public string? Layers
{
- get => _internalLayer.Source.Params.ContainsKey("layers") ? _internalLayer.Source.Params["layers"].ToString() : null;
- set => _internalLayer.Source.Params["layers"] = value;
+ get => _internalLayer.Source.Params.ContainsKey("LAYERS") ? _internalLayer.Source.Params["LAYERS"].ToString() : null;
+ set => _internalLayer.Source.Params["LAYERS"] = value;
+ }
+
+ [Parameter]
+ public string? Styles
+ {
+ get => _internalLayer.Source.Params.ContainsKey("STYLES") ? _internalLayer.Source.Params["STYLES"].ToString() : null;
+ set => _internalLayer.Source.Params["STYLES"] = value;
}
[Parameter]
public string? Title
{
- get => _internalLayer.Properties.ContainsKey("title") ? _internalLayer.Properties["title"].ToString() : null;
- set => _internalLayer.Properties["title"] = value;
+ get => _internalLayer.Properties.ContainsKey("TITLE") ? _internalLayer.Properties["TITLE"].ToString() : null;
+ set => _internalLayer.Properties["TITLE"] = value;
}
protected override void OnInitialized()
diff --git a/src/OpenLayers.Blazor/Line.cs b/src/OpenLayers.Blazor/Line.cs
index 8771aee..0c6e8f8 100644
--- a/src/OpenLayers.Blazor/Line.cs
+++ b/src/OpenLayers.Blazor/Line.cs
@@ -1,6 +1,5 @@
using Microsoft.AspNetCore.Components;
using OpenLayers.Blazor.Internal;
-using System.Text.Json.Serialization;
namespace OpenLayers.Blazor;
@@ -12,7 +11,7 @@ public Line() : base(ShapeType.LineString)
public Line(Coordinate point1, Coordinate point2) : this()
{
- Points = new List() { point1, point2 };
+ Points = new List { point1, point2 };
}
[Parameter]
@@ -21,4 +20,4 @@ public IEnumerable Points
get => CoordinatesHelper.GetCoordinates(InternalFeature.Coordinates);
set => InternalFeature.Coordinates = CoordinatesHelper.SetCoordinates(value);
}
-}
+}
\ No newline at end of file
diff --git a/src/OpenLayers.Blazor/Map.razor.cs b/src/OpenLayers.Blazor/Map.razor.cs
index 3bd9a58..213033e 100644
--- a/src/OpenLayers.Blazor/Map.razor.cs
+++ b/src/OpenLayers.Blazor/Map.razor.cs
@@ -18,14 +18,13 @@ public partial class Map : IAsyncDisposable
private string _popupId;
///
- /// Default Constructor
+ /// Default Constructor
///
public Map()
{
_mapId = Guid.NewGuid().ToString();
_popupId = Guid.NewGuid().ToString();
- NewShapeTemplate = new Point();
EnableShapeSnap = true;
}
@@ -187,31 +186,37 @@ public ScaleLineUnit ScaleLineUnit
public Extent? VisibleExtent { get; set; }
///
- /// A shape providing default parameters when drawing new shapes
+ /// A shape providing default parameters when drawing new shapes
///
[Parameter]
- public Shape NewShapeTemplate { get; set; }
+ public ShapeType NewShapeType { get; set; }
///
- /// Get or set if new shapes shall be drawn
+ /// Get or set if new shapes shall be drawn
///
[Parameter]
public bool EnableNewShapes { get; set; }
///
- /// Get or sets if the position of points shall be snapped.
+ /// Get or sets if the position of points shall be snapped.
///
[Parameter]
public bool EnableShapeSnap { get; set; }
///
- /// Get or sets if drawing new shapes is enabled.
+ /// Get or sets if drawing new shapes is enabled.
///
[Parameter]
public bool EnableEditShapes { get; set; }
private DotNetObjectReference