private void Activate(Point2D firstPoint) { _polygon = new PolygonElement(); _textBlockContainer = new List<TextBlock>(); #region 所有风格的控制 _polygon.Stroke = Stroke; _polygon.StrokeThickness = StrokeThickness; _polygon.StrokeMiterLimit = StrokeMiterLimit; _polygon.StrokeDashOffset = StrokeDashOffset; _polygon.StrokeDashArray = StrokeDashArray; _polygon.StrokeDashCap = StrokeDashCap; _polygon.StrokeEndLineCap = StrokeEndLineCap; _polygon.StrokeLineJoin = StrokeLineJoin; _polygon.StrokeStartLineCap = StrokeStartLineCap; _polygon.Opacity = Opacity; _polygon.Fill = Fill; _polygon.FillRule = FillRule; #endregion _points = new Point2DCollection(); _polygon.Point2Ds = _points; _points.Add(firstPoint); _pointsCount++; _points.Add(firstPoint.Clone()); _pointsCount++; DrawLayer.Children.Add(_polygon); TextBlock textBlock = new TextBlock(); textBlock.FontWeight = FontWeights.ExtraBlack; textBlock.Foreground = new SolidColorBrush(Colors.White); textBlock.Text = "起点"; _textBlockContainer.Add(textBlock); DrawLayer.AddChild(textBlock, firstPoint); _isActivated = true; }
private void Activate(Point2D firstPoint) { if (Map == null || Map.Layers == null) { return; } DrawLayer = new ElementsLayer(); Map.Layers.Add(DrawLayer); _startPoint = firstPoint; _polygon = new PolygonElement(); #region 所有风格的控制 _polygon.Stroke = this.Stroke; _polygon.StrokeThickness = this.StrokeThickness; _polygon.StrokeMiterLimit = this.StrokeMiterLimit; _polygon.StrokeDashOffset = this.StrokeDashOffset; _polygon.StrokeDashArray = this.StrokeDashArray; _polygon.StrokeDashCap = this.StrokeDashCap; _polygon.StrokeEndLineCap = this.StrokeEndLineCap; _polygon.StrokeLineJoin = this.StrokeLineJoin; _polygon.StrokeStartLineCap = this.StrokeStartLineCap; _polygon.Opacity = this.Opacity; _polygon.Fill = this.Fill; _polygon.FillRule = this.FillRule; #endregion _points = new Point2DCollection(); _polygon.Point2Ds = _points; _points.Add(firstPoint); _pointsCount++; _points.Add(firstPoint.Clone()); _pointsCount++; DrawLayer.Children.Add(_polygon); _isActivated = true; }