Skip to content

Commit

Permalink
Update IDesigner
Browse files Browse the repository at this point in the history
  • Loading branch information
alexeyvyduykin committed May 30, 2023
1 parent bc70245 commit cdca21b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Mapsui;
using Mapsui.Extensions;
using Mapsui.Interactivity;
using Mapsui.Interactivity.Extensions;
using Mapsui.Interactivity.UI;
Expand Down Expand Up @@ -404,7 +403,8 @@ private void DrawingPointCommand()

designer.EndCreating.Subscribe(s =>
{
_userLayer.Add(s.Feature.Copy());
_userLayer.Add(s);
_userLayer.DataHasChanged();
});

Tip = "Нажмите, чтобы нарисовать точку";
Expand All @@ -427,7 +427,7 @@ private void DrawingRectangleCommand()

designer.EndCreating.Subscribe(s =>
{
_userLayer.Add(s.Feature.Copy());
_userLayer.Add(s);

Tip = string.Empty;

Expand All @@ -454,7 +454,7 @@ private void DrawingCircleCommand()

designer.EndCreating.Subscribe(s =>
{
_userLayer.Add(s.Feature.Copy());
_userLayer.Add(s);

Tip = string.Empty;

Expand Down Expand Up @@ -485,7 +485,7 @@ private void DrawingRouteCommand()

designer.EndCreating.Subscribe(s =>
{
_userLayer.Add(s.Feature.Copy());
_userLayer.Add(s);

Tip = string.Empty;

Expand Down Expand Up @@ -522,7 +522,7 @@ private void DrawingPolygonCommand()

designer.EndCreating.Subscribe(s =>
{
_userLayer.Add(s.Feature.Copy());
_userLayer.Add(s);

Tip = string.Empty;

Expand Down
9 changes: 5 additions & 4 deletions src/Mapsui.Interactivity/Designers/BaseDesigner.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Mapsui.Nts;
using Mapsui.Extensions;
using Mapsui.Nts;
using Mapsui.Nts.Extensions;
using System.Reactive.Linq;
using System.Reactive.Subjects;
Expand All @@ -10,7 +11,7 @@ public abstract class BaseDesigner : BaseInteractive, IDesigner
private readonly Subject<IDesigner> _beginCreatingSubj = new();
private readonly Subject<IDesigner> _creatingSubj = new();
private readonly Subject<IDesigner> _hoverCreatingSubj = new();
private readonly Subject<IDesigner> _endCreatingSubj = new();
private readonly Subject<IFeature> _endCreatingSubj = new();

public GeometryFeature Feature { get; protected set; } = new GeometryFeature();

Expand All @@ -22,7 +23,7 @@ public abstract class BaseDesigner : BaseInteractive, IDesigner

public IObservable<IDesigner> HoverCreating => _hoverCreatingSubj.AsObservable();

public IObservable<IDesigner> EndCreating => _endCreatingSubj.AsObservable();
public IObservable<IFeature> EndCreating => _endCreatingSubj.AsObservable();

public override IEnumerable<IFeature> GetFeatures()
{
Expand Down Expand Up @@ -58,6 +59,6 @@ protected void OnHoverCreating()

protected void OnEndCreating()
{
_endCreatingSubj.OnNext(this);
_endCreatingSubj.OnNext(Feature.Copy());
}
}
2 changes: 1 addition & 1 deletion src/Mapsui.Interactivity/Interfaces/IDesigner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ public interface IDesigner : IInteractive

IObservable<IDesigner> HoverCreating { get; }

IObservable<IDesigner> EndCreating { get; }
IObservable<IFeature> EndCreating { get; }
}

0 comments on commit cdca21b

Please sign in to comment.