private void Activate(Point2D firstPoint) { if (DrawLayer != null) { DrawLayer.Children.Clear(); } if (Map != null) { Map.Layers.Remove(DrawLayer); } DrawLayer = new ElementsLayer(); Map.Layers.Add(DrawLayer); Map.Layers.Add(tempLayer); polyline = new PolylineElement(); #region 所有风格的控制 polyline.Stroke = Stroke; polyline.StrokeThickness = StrokeThickness; polyline.StrokeMiterLimit = StrokeMiterLimit; polyline.StrokeDashOffset = StrokeDashOffset; polyline.StrokeDashArray = StrokeDashArray; polyline.StrokeDashCap = StrokeDashCap; polyline.StrokeEndLineCap = StrokeEndLineCap; polyline.StrokeLineJoin = StrokeLineJoin; polyline.StrokeStartLineCap = StrokeStartLineCap; polyline.Opacity = Opacity; polyline.Fill = Fill; polyline.FillRule = FillRule; #endregion points = new Point2DCollection(); polyline.Point2Ds = points; points.Add(firstPoint); points.Add(firstPoint); DrawLayer.Children.Add(polyline); isDrawing = true; isActivated = true; }
/// <summary>${ui_action_MapAction_method_deactivate_D}</summary> public override void Deactivate() { isActivated = false; isDrawing = false; polyline = null; points = null; if (DrawLayer != null) { DrawLayer.Children.Clear(); } if (Map != null && Map.Layers != null) { Map.Layers.Remove(DrawLayer); } }
private void endDraw(bool isDblClick = false, bool isCancel = false) { if (points != null) { if (isDblClick) { points.RemoveAt(points.Count - 1); } PolylineElement pLine = new PolylineElement() { Point2Ds = this.points.Clone(), #region 所有风格的控制 Stroke = this.Stroke, StrokeThickness = this.StrokeThickness, StrokeMiterLimit = this.StrokeMiterLimit, StrokeDashOffset = this.StrokeDashOffset, StrokeDashArray = this.StrokeDashArray, StrokeDashCap = this.StrokeDashCap, StrokeEndLineCap = this.StrokeEndLineCap, StrokeLineJoin = this.StrokeLineJoin, StrokeStartLineCap = this.StrokeStartLineCap, Opacity = this.Opacity, Fill = this.Fill, FillRule = this.FillRule #endregion }; GeoLine geoLine = new GeoLine();//构造返回的Geometry geoLine.Parts.Add(points); DrawEventArgs args = new DrawEventArgs { DrawName = Name, Element = pLine, //Element = this.polyline //直接返回是固定像素的 Geometry = geoLine, Canceled = isCancel }; Deactivate(); OnDrawCompleted(args); } }
private void Activate(Point2D firstPoint) { if (Map == null || Map.Layers == null) { return; } polyline = new PolylineElement(); polyline.Stroke = Stroke; polyline.StrokeThickness = StrokeThickness; polyline.Opacity = Opacity; polyline.StrokeMiterLimit = StrokeMiterLimit; polyline.StrokeDashOffset = StrokeDashOffset; polyline.StrokeDashArray = StrokeDashArray; polyline.StrokeDashCap = StrokeDashCap; polyline.StrokeEndLineCap = StrokeEndLineCap; polyline.StrokeLineJoin = StrokeLineJoin; polyline.StrokeStartLineCap = StrokeStartLineCap; polyline.Fill = Fill; polyline.FillRule = FillRule; points = new Point2DCollection(); polyline.Point2Ds = points; points.Add(firstPoint); DrawLayer = new ElementsLayer(); Map.Layers.Add(DrawLayer); DrawLayer.Children.Add(polyline); isActivated = true; isDrawing = true; }