diff --git a/OpenLayers.Blazor.sln b/OpenLayers.Blazor.sln index 5b6d6d2..e42060e 100644 --- a/OpenLayers.Blazor.sln +++ b/OpenLayers.Blazor.sln @@ -13,7 +13,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenLayers.Blazor.Demo.Maui EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenLayers.Blazor.Tests", "test\OpenLayers.Blazor.Tests\OpenLayers.Blazor.Tests.csproj", "{D235BF12-E194-49CA-AB16-27E23D87B9C5}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenLayers.Blazor.Demo.Components", "src\OpenLayers.Blazor.Demo.Components\OpenLayers.Blazor.Demo.Components.csproj", "{9BEEE062-7A06-4391-9934-B3963D62B50D}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenLayers.Blazor.Demo.Components", "src\OpenLayers.Blazor.Demo.Components\OpenLayers.Blazor.Demo.Components.csproj", "{9BEEE062-7A06-4391-9934-B3963D62B50D}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/src/OpenLayers.Blazor.Demo.Components/OpenLayers.Blazor.Demo.Components.csproj b/src/OpenLayers.Blazor.Demo.Components/OpenLayers.Blazor.Demo.Components.csproj index 740300e..2563e0c 100644 --- a/src/OpenLayers.Blazor.Demo.Components/OpenLayers.Blazor.Demo.Components.csproj +++ b/src/OpenLayers.Blazor.Demo.Components/OpenLayers.Blazor.Demo.Components.csproj @@ -20,6 +20,7 @@ + diff --git a/src/OpenLayers.Blazor.Demo.Components/Pages/CustomWMTSMap.razor b/src/OpenLayers.Blazor.Demo.Components/Pages/CustomWMTSMap.razor index 27c6080..ddc6ec8 100644 --- a/src/OpenLayers.Blazor.Demo.Components/Pages/CustomWMTSMap.razor +++ b/src/OpenLayers.Blazor.Demo.Components/Pages/CustomWMTSMap.razor @@ -1,7 +1,6 @@ @page "/customdemo"
-

Custom WMTS Map

diff --git a/src/OpenLayers.Blazor.Demo.Components/Pages/DrawDemo.razor b/src/OpenLayers.Blazor.Demo.Components/Pages/DrawDemo.razor index 47d162c..450e2bb 100644 --- a/src/OpenLayers.Blazor.Demo.Components/Pages/DrawDemo.razor +++ b/src/OpenLayers.Blazor.Demo.Components/Pages/DrawDemo.razor @@ -1,13 +1,10 @@ @page "/drawdemo"
-

Drawing Demo

-
- - + - @@ -51,9 +46,6 @@ - - - @if (_map != null) @@ -85,15 +77,24 @@ @code { private SwissMap _map = null!; - private ShapeType _shapeType; + private ShapeType _shapeType = ShapeType.LineString; private double _y = 1197650; private Circle _circle; private Coordinate _center = new Coordinate(1197650, 2604200); private bool _enabledraw, _enableedit, _snap = true; - private Shape _shapeTemplate; - private string _bgcolor = "#563d7c"; - private string _bordercolor = "#dd1111"; - private int _borderSize = 2; + + private StyleOptions _styleOptions = new StyleOptions() + { + Stroke = new StyleOptions.StrokeOptions() + { + Color = "#dd1111", + Width = 2 + }, + Fill = new StyleOptions.FillOptions() + { + Color = "#563d7c" + } + }; protected override Task OnAfterRenderAsync(bool firstRender) { diff --git a/src/OpenLayers.Blazor.Demo.Components/Pages/GeoJsonDemo.razor b/src/OpenLayers.Blazor.Demo.Components/Pages/GeoJsonDemo.razor index 28c1601..d901b00 100644 --- a/src/OpenLayers.Blazor.Demo.Components/Pages/GeoJsonDemo.razor +++ b/src/OpenLayers.Blazor.Demo.Components/Pages/GeoJsonDemo.razor @@ -1,30 +1,71 @@ @page "/geojsondemo" @using System.Text.Json +@using Shape = OpenLayers.Blazor.Shape
-

GeoJson

- + @if (_loading) + { +
+ Loading... +
+ } + else + { + + + }
- + @code { private SwissMap _map = null!; + private bool _loading; [Inject] private HttpClient HttpClient { get; set; } private async Task LoadGeoJson(MouseEventArgs obj) { + _loading = true; // e.g. https://labs.karavia.ch/swiss-boundaries-geojson or https://api3.geo.admin.ch/services/sdiservices.html var json = await HttpClient.GetFromJsonAsync("https://labs.karavia.ch/swiss-boundaries-geojson/geojson/2020/swissBOUNDARIES3D_1_3_TLM_LANDESGEBIET.geojson"); await _map.LoadGeoJson(json); + _loading = false; + } + + private StyleOptions GetShapeStyle(Shape shape) + { + return new StyleOptions() + { + Stroke = new StyleOptions.StrokeOptions() + { + Color = "red", + Width = 3, + LineDash = new double[] { 4 } + }, + Fill = new StyleOptions.FillOptions() + { + Color = shape.Properties["NAME"].ToString() == "Liechtenstein" ? "rgba(0, 255, 50, 0.5)" : "rgba(0, 0, 255, 0.3)" + } + }; + } + + private async Task Reformat() + { + foreach (var shape in _map.ShapesList) + { + shape.BorderSize = 5; + shape.BorderColor = "green"; + shape.BackgroundColor = "rgba(0, 255, 50, 0.5)"; + await _map.UpdateShape(shape); + } } } \ No newline at end of file diff --git a/src/OpenLayers.Blazor.Demo.Components/Pages/GermanGdzDemo.razor b/src/OpenLayers.Blazor.Demo.Components/Pages/GermanGdzDemo.razor new file mode 100644 index 0000000..089e750 --- /dev/null +++ b/src/OpenLayers.Blazor.Demo.Components/Pages/GermanGdzDemo.razor @@ -0,0 +1,17 @@ +@page "/gdzdemo" + +
+
+

German GDZ Demo

+
+
+
+
+ + + + + + + + \ No newline at end of file diff --git a/src/OpenLayers.Blazor.Demo.Components/Pages/Index.razor b/src/OpenLayers.Blazor.Demo.Components/Pages/Index.razor index 8158719..543000d 100644 --- a/src/OpenLayers.Blazor.Demo.Components/Pages/Index.razor +++ b/src/OpenLayers.Blazor.Demo.Components/Pages/Index.razor @@ -22,7 +22,7 @@
- +
diff --git a/src/OpenLayers.Blazor.Demo.Components/Pages/LayersDemo.razor b/src/OpenLayers.Blazor.Demo.Components/Pages/LayersDemo.razor index 60a9856..f2ce2a0 100644 --- a/src/OpenLayers.Blazor.Demo.Components/Pages/LayersDemo.razor +++ b/src/OpenLayers.Blazor.Demo.Components/Pages/LayersDemo.razor @@ -1,11 +1,9 @@ @page "/layersdemo"
-

Layers

-
@@ -13,7 +11,6 @@
-
@@ -35,9 +32,8 @@ protected override Task OnAfterRenderAsync(bool firstRender) { if (firstRender) - { StateHasChanged(); // update _map - } + return base.OnAfterRenderAsync(firstRender); } } \ No newline at end of file diff --git a/src/OpenLayers.Blazor.Demo.Components/Pages/MarkersDemo.razor b/src/OpenLayers.Blazor.Demo.Components/Pages/MarkersDemo.razor index 628fade..498f0f2 100644 --- a/src/OpenLayers.Blazor.Demo.Components/Pages/MarkersDemo.razor +++ b/src/OpenLayers.Blazor.Demo.Components/Pages/MarkersDemo.razor @@ -1,11 +1,9 @@ @page "/markersdemo"
-

Markers

-
-
@@ -32,8 +29,7 @@ - - + @code { diff --git a/src/OpenLayers.Blazor.Demo.Components/Pages/OpenStreetMapDemo.razor b/src/OpenLayers.Blazor.Demo.Components/Pages/OpenStreetMapDemo.razor index b9ad281..b41158c 100644 --- a/src/OpenLayers.Blazor.Demo.Components/Pages/OpenStreetMapDemo.razor +++ b/src/OpenLayers.Blazor.Demo.Components/Pages/OpenStreetMapDemo.razor @@ -1,11 +1,9 @@ @page "/openstreetmapdemo"
-

OpenStreetMap

-
 Center: @_center
@@ -17,7 +15,7 @@ Zoom: @_map?.Zoom
 
 
 
-
+
     
         
-
-
+

ShapesDemo

-
- +

@_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 -

-

SwissMapLayersDemo

-