forked from lolochristen/OpenLayers.Blazor
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
207 changed files
with
124,615 additions
and
56,764 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 8 additions & 5 deletions
13
src/OpenLayers.Blazor.Demo/CodeView.razor → ...ers.Blazor.Demo.Components/CodeView.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
src/OpenLayers.Blazor.Demo.Components/OpenLayers.Blazor.Demo.Components.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<Project Sdk="Microsoft.NET.Sdk.Razor"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<Nullable>enable</Nullable> | ||
<IsPackable>false</IsPackable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.0" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<EmbeddedResource Include="Pages\BingMapDemo.razor" /> | ||
<EmbeddedResource Include="Pages\CustomWMTSMap.razor" /> | ||
<EmbeddedResource Include="Pages\GeoJsonDemo.razor" /> | ||
<EmbeddedResource Include="Pages\Index.razor" /> | ||
<EmbeddedResource Include="Pages\LayersDemo.razor" /> | ||
<EmbeddedResource Include="Pages\MarkersDemo.razor" /> | ||
<EmbeddedResource Include="Pages\OpenStreetMapDemo.razor" /> | ||
<EmbeddedResource Include="Pages\ShapesDemo.razor" /> | ||
<EmbeddedResource Include="Pages\SwissMapLayersDemo.razor" /> | ||
<EmbeddedResource Include="Pages\DrawDemo.razor" /> | ||
<EmbeddedResource Include="Pages\GermanGdzDemo.razor" /> | ||
<EmbeddedResource Include="Pages\FlightTracker.razor" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\OpenLayers.Blazor\OpenLayers.Blazor.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
32 changes: 32 additions & 0 deletions
32
src/OpenLayers.Blazor.Demo.Components/Pages/BingMapDemo.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
@page "/bingmapdemo" | ||
@rendermode Components.RenderMode.DefaultRenderMode | ||
|
||
<div class="card mt-2 mb-2"> | ||
|
||
<div class="card-header"> | ||
<h3 class="card-title">Bing Maps</h3> | ||
</div> | ||
|
||
<div class="card-body"> | ||
<input type="text" @bind-value="_key" width="400px" placeholder="Your Bing Maps Key from https://www.bingmapsportal.com/ "> | ||
<select @bind="_layerselect"> | ||
<option value="Aerial">Aerial</option> | ||
<option value="AerialWithLabelsOnDemand">Aerial with labels</option> | ||
<option value="RoadOnDemand" selected>Road</option> | ||
<option value="CanvasDark">Road dark</option> | ||
<option value="OrdnanceSurvey">Ordnance Survey</option> | ||
</select> | ||
</div> | ||
</div> | ||
|
||
@if (!string.IsNullOrEmpty(_key)) | ||
{ | ||
<BingMap Style="height: 800px;" Class="card" ImagerySet="@(_layerselect != null ? Enum.Parse<BingMapImagerySet>(_layerselect) : BingMapImagerySet.RoadOnDemand)" Key="@_key"></BingMap> | ||
} | ||
|
||
<CodeView Source="BingMapDemo.razor" /> | ||
|
||
@code { | ||
private string? _layerselect; | ||
private string? _key; | ||
} |
16 changes: 16 additions & 0 deletions
16
src/OpenLayers.Blazor.Demo.Components/Pages/CustomWMTSMap.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
@page "/customdemo" | ||
@rendermode Components.RenderMode.DefaultRenderMode | ||
|
||
<div class="card mt-2 mb-2"> | ||
<div class="card-header"> | ||
<h3 class="card-title">Custom WMTS Map</h3> | ||
</div> | ||
</div> | ||
|
||
<Map Style="height:800px" Class="card" Zoom="5" Center="new Coordinate(-73, 40.72)" CoordinatesProjection="EPSG:4326"> | ||
<Layers> | ||
<Layer SourceType="SourceType.XYZ" Url="@("https://basemap.nationalmap.gov/arcgis/rest/services/USGSTopo/MapServer/tile/{z}/{y}/{x}")" CrossOrigin="anonymous" Format="image/png"></Layer> | ||
</Layers> | ||
</Map> | ||
|
||
<CodeView Source="CustomWMTSMap.razor" /> |
103 changes: 103 additions & 0 deletions
103
src/OpenLayers.Blazor.Demo.Components/Pages/DrawDemo.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
@page "/drawdemo/{MapType?}" | ||
@using System.Text.Json | ||
@rendermode Components.RenderMode.DefaultRenderMode | ||
|
||
<div class="card mt-2 mb-2"> | ||
<div class="card-header"> | ||
<h3 class="card-title">Drawing Demo</h3> | ||
</div> | ||
<div class="card-body"> | ||
<div class="btn-toolbar" role="toolbar"> | ||
<div class="btn-group" data-toggle="buttons"> | ||
<input type="checkbox" class="btn-check" id="btndraw" autocomplete="off" @bind="_enabledraw"> | ||
<label class="btn btn-outline-primary" for="btndraw">Draw</label> | ||
<input type="checkbox" class="btn-check" id="btnedit" autocomplete="off" @bind="_enableedit"> | ||
<label class="btn btn-outline-primary" for="btnedit">Edit</label> | ||
<input type="checkbox" class="btn-check" id="btnsnap" autocomplete="off" @bind="_snap"> | ||
<label class="btn btn-outline-primary" for="btnsnap">Snap</label> | ||
<input type="checkbox" class="btn-check" id="btnfreehand" autocomplete="off" @bind="_freehand"> | ||
<label class="btn btn-outline-primary" for="btnfreehand">Freehand</label> | ||
</div> | ||
<select id="type" @bind="_shapeType"> | ||
<option value="@(ShapeType.Point)">Point</option> | ||
<option value="@(ShapeType.LineString)">LineString</option> | ||
<option value="@(ShapeType.Polygon)">Polygon</option> | ||
<option value="@(ShapeType.Circle)">Circle</option> | ||
</select> | ||
<input type="color" class="form-control form-control-color" id="bgColorInput" title="Background" @bind="_styleOptions.Fill.Color"> | ||
<input type="color" class="form-control form-control-color" id="borderColorInput" title="Background" @bind="_styleOptions.Stroke.Color"> | ||
<input type="range" min="1" max="30" @bind="_styleOptions.Stroke.Width" title="Border Size"> | ||
<input type="button" class="btn btn-primary" value="Undo" @onclick="() => _map.Undo()" /> | ||
<input type="button" class="btn btn-secondary" value="Clear" @onclick="() => _map.ShapesList.Clear()" /> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
@if (MapType == "osm") | ||
{ | ||
<OpenStreetMap @ref="_map" Style="height:800px;" Class="card" OnShapeAdded="StateHasChanged" EnableEditShapes="_enableedit" EnableNewShapes="_enabledraw" EnableShapeSnap="_snap" ShapeStyleCallback="(shape) => _styleOptions" NewShapeType="_shapeType" Freehand="_freehand"> | ||
</OpenStreetMap> | ||
} | ||
else | ||
{ | ||
<SwissMap @ref="_map" Style="height: 800px;" Class="card" OnShapeAdded="StateHasChanged" EnableEditShapes="_enableedit" EnableNewShapes="_enabledraw" EnableShapeSnap="_snap" ShapeStyleCallback="(shape) => _styleOptions" NewShapeType="_shapeType" Freehand="_freehand"> | ||
<Features> | ||
<Line Points="new[] { new Coordinate(2604200, 1197650), new Coordinate(2624200, 1177650) }" BorderColor="red" BorderSize="2"></Line> | ||
<Circle Center="_center" Radius="2000" BorderSize="3" BorderColor="blue" BackgroundColor="#55229933"></Circle> | ||
<Point Coordinate="new Coordinate(2683276.620804008, 1247123.8311215444)" BackgroundColor="green" Radius="20"></Point> | ||
</Features> | ||
</SwissMap> | ||
} | ||
|
||
@if (_map != null) | ||
{ | ||
<div class="card mt-2 mb-2"> | ||
<div class="card-header"> | ||
<h5 class="card-title">Shapes</h5> | ||
</div> | ||
<div class="card-body"> | ||
@foreach (var shape in _map.ShapesList) | ||
{ | ||
<p> | ||
<strong>@shape.Id @shape.Type @shape.GeometryType</strong> | ||
<ul> | ||
@if (shape.Coordinates != null) | ||
{ | ||
@JsonSerializer.Serialize(shape.Coordinates) | ||
} | ||
</ul> | ||
</p> | ||
} | ||
</div> | ||
</div> | ||
} | ||
|
||
<CodeView Source="DrawDemo.razor" /> | ||
|
||
@code { | ||
[Parameter] public string? MapType { get; set; } | ||
private Map? _map; | ||
private ShapeType _shapeType = ShapeType.LineString; | ||
private Coordinate _center = new(2604200, 1197650); | ||
private bool _enabledraw, _enableedit, _snap = true, _freehand; | ||
|
||
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) | ||
{ | ||
if (firstRender) | ||
StateHasChanged(); | ||
return base.OnAfterRenderAsync(firstRender); | ||
} | ||
} |
Oops, something went wrong.