protected override void OnPropertyChanged([CallerMemberName] string propertyName = null) { base.OnPropertyChanged(propertyName); switch (propertyName) { case nameof(Positions): ((Mapsui.Geometries.Polygon)Feature.Geometry).ExteriorRing = new LinearRing(Positions.Select(p => p.ToMapsui()).ToList()); break; case nameof(Holes): ((Mapsui.Geometries.Polygon)Feature.Geometry).InteriorRings = Holes.Select(h => new LinearRing(h.Select(p => p.ToMapsui()).ToList())).ToList(); break; case nameof(FillColor): ((VectorStyle)Feature.Styles.First()).Fill = new Brush(FillColor.ToMapsui()); break; case nameof(StrokeColor): ((VectorStyle)Feature.Styles.First()).Outline.Color = StrokeColor.ToMapsui(); break; case nameof(StrokeWidth): ((VectorStyle)Feature.Styles.First()).Outline.Width = StrokeWidth; break; } }
private void CreateFeature() { lock (sync) { if (Feature == null) { // Create a new one Feature = new Feature { Geometry = new Mapsui.Geometries.Polygon(), ["Label"] = Label, }; Feature.Styles.Clear(); Feature.Styles.Add(new VectorStyle { Line = new Pen { Width = StrokeWidth, Color = StrokeColor.ToMapsui() }, Fill = new Brush { Color = FillColor.ToMapsui() } }); } } }
protected override void OnPropertyChanged([CallerMemberName] string propertyName = null) { base.OnPropertyChanged(propertyName); switch (propertyName) { case nameof(Center): UpdateFeature(); break; case nameof(Radius): UpdateFeature(); break; case nameof(Quality): UpdateFeature(); break; case nameof(FillColor): ((VectorStyle)Feature.Styles.First()).Fill = new Brush(FillColor.ToMapsui()); break; } }