-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* major refactoring, drawing interactions draft * template shape update on change, buttons * Check effective template change to call SetDrawingSettings/Fix edit * drawing update * fix custom marker image. * add summaries. ---------
- Loading branch information
1 parent
7b29a7c
commit 07d15da
Showing
78 changed files
with
61,007 additions
and
579 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
@page "/drawdemo" | ||
@using Marker = OpenLayers.Blazor.Marker | ||
<h3>DrawDemo</h3> | ||
|
||
<div class="m-2 btn-toolbar mb-3" 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> | ||
</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="_bgcolor"> | ||
<input type="color" class="form-control form-control-color" id="borderColorInput" title="Background" @bind="_bordercolor"> | ||
<input type="range" min="1" max="30" @bind="_borderSize" 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()" /> | ||
<input type="range" min="1080000" max="1280000" value="@_y" @onchange="OnYChange"> <code>@_y</code> | ||
</div> | ||
|
||
|
||
<div class="container"> | ||
<SwissMap @ref="_map" Style="border:1px solid silver;height:800px;" OnShapeAdded="StateHasChanged" OnShapeChanged="StateHasChanged" EnableEditShapes="_enableedit" EnableNewShapes="_enabledraw" EnableShapeSnap="_snap" NewShapeTemplate="_shapeTemplate"> | ||
<Popup> | ||
<div id="popup" class="ol-box"> | ||
@if (@context != null) | ||
{ | ||
<h3>@context.Type</h3> | ||
} | ||
</div> | ||
</Popup> | ||
|
||
<Features> | ||
<Line Points="new []{new Coordinate(1197650, 2604200), new Coordinate(1177650, 2624200)}" BorderColor="red" BorderSize="2"></Line> | ||
<Circle @ref="_circle" Center="_center" Radius="2000" BorderSize="3" BorderColor="blue" BackgroundColor="#55229933"></Circle> | ||
<Point Coordinate="new Coordinate(1247123.8311215444, 2683276.620804008)" BackgroundColor="green" Radius="20"></Point> | ||
</Features> | ||
</SwissMap> | ||
|
||
<!-- Template Shape --> | ||
<Shape @ref="_shapeTemplate" ShapeType="@_shapeType" Color="red" BorderColor="@_bordercolor" BackgroundColor="@_bgcolor" BorderSize="@_borderSize"></Shape> | ||
</div> | ||
|
||
@if (_map != null) | ||
{ | ||
<div> | ||
<h5>Shapes</h5> | ||
@foreach (var shape in _map.ShapesList) | ||
{ | ||
<p> | ||
@shape.Id @shape.Type @shape.GeometryType | ||
<ul> | ||
@if (shape.Coordinates != null) | ||
{ | ||
@foreach (Coordinate c in shape.Coordinates) | ||
{ | ||
<li>@c</li> | ||
} | ||
} | ||
</ul> | ||
</p> | ||
} | ||
<h5>Markers</h5> | ||
@foreach (var marker in _map.MarkersList) | ||
{ | ||
<p>@marker.Id @marker.Type</p> | ||
} | ||
</div> | ||
} | ||
|
||
@code { | ||
private SwissMap _map = null!; | ||
private ShapeType _shapeType; | ||
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; | ||
|
||
protected override Task OnAfterRenderAsync(bool firstRender) | ||
{ | ||
if (firstRender) | ||
StateHasChanged(); | ||
return base.OnAfterRenderAsync(firstRender); | ||
} | ||
|
||
private void OnYChange(ChangeEventArgs obj) | ||
{ | ||
_y = Double.Parse(obj.Value.ToString()); | ||
_center.Y = _y; | ||
_circle.Center = _center; | ||
_ = _circle.UpdateShape(); | ||
} | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,8 +3,7 @@ | |
"defaultProvider": "cdnjs", | ||
"libraries": [ | ||
{ | ||
"provider": "cdnjs", | ||
"library": "[email protected]", | ||
"library": "[email protected]", | ||
"destination": "wwwroot/lib/openlayers/", | ||
"files": [ | ||
"dist/ol.js", | ||
|
@@ -15,16 +14,6 @@ | |
] | ||
}, | ||
{ | ||
"provider": "cdnjs", | ||
"library": "[email protected]", | ||
"destination": "wwwroot/lib/font-awesome/", | ||
"files": [ | ||
"css/all.min.css", | ||
"webfonts/fa-solid-900.woff2" | ||
] | ||
}, | ||
{ | ||
"provider": "cdnjs", | ||
"library": "[email protected]", | ||
"destination": "wwwroot/lib/font-awesome/", | ||
"files": [ | ||
|
@@ -35,6 +24,56 @@ | |
"webfonts/fa-v4compatibility.woff2", | ||
"css/fontawesome.min.css" | ||
] | ||
}, | ||
{ | ||
"library": "[email protected]", | ||
"destination": "wwwroot/lib/bootstrap/", | ||
"files": [ | ||
"js/bootstrap.bundle.js", | ||
"css/bootstrap-grid.css", | ||
"css/bootstrap-grid.css.map", | ||
"css/bootstrap-grid.min.css", | ||
"css/bootstrap-grid.min.css.map", | ||
"css/bootstrap-grid.rtl.css", | ||
"css/bootstrap-grid.rtl.css.map", | ||
"css/bootstrap-grid.rtl.min.css", | ||
"css/bootstrap-grid.rtl.min.css.map", | ||
"css/bootstrap-reboot.css", | ||
"css/bootstrap-reboot.css.map", | ||
"css/bootstrap-reboot.min.css", | ||
"css/bootstrap-reboot.min.css.map", | ||
"css/bootstrap-reboot.rtl.css", | ||
"css/bootstrap-reboot.rtl.css.map", | ||
"css/bootstrap-reboot.rtl.min.css", | ||
"css/bootstrap-reboot.rtl.min.css.map", | ||
"css/bootstrap-utilities.css", | ||
"css/bootstrap-utilities.css.map", | ||
"css/bootstrap-utilities.min.css", | ||
"css/bootstrap-utilities.min.css.map", | ||
"css/bootstrap-utilities.rtl.css", | ||
"css/bootstrap-utilities.rtl.css.map", | ||
"css/bootstrap-utilities.rtl.min.css", | ||
"css/bootstrap-utilities.rtl.min.css.map", | ||
"css/bootstrap.css", | ||
"css/bootstrap.css.map", | ||
"css/bootstrap.min.css", | ||
"css/bootstrap.min.css.map", | ||
"css/bootstrap.rtl.css", | ||
"css/bootstrap.rtl.css.map", | ||
"css/bootstrap.rtl.min.css", | ||
"css/bootstrap.rtl.min.css.map", | ||
"js/bootstrap.bundle.js.map", | ||
"js/bootstrap.bundle.min.js", | ||
"js/bootstrap.bundle.min.js.map", | ||
"js/bootstrap.esm.js", | ||
"js/bootstrap.esm.js.map", | ||
"js/bootstrap.esm.min.js", | ||
"js/bootstrap.esm.min.js.map", | ||
"js/bootstrap.js", | ||
"js/bootstrap.js.map", | ||
"js/bootstrap.min.js", | ||
"js/bootstrap.min.js.map" | ||
] | ||
} | ||
] | ||
} |
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
Oops, something went wrong.