${ui_action_DrawEventArgs_Title}。

${ui_action_DrawEventArgs_Description}

Inheritance: System.EventArgs
示例#1
0
 private void OnDrawComplete(DrawEventArgs args)
 {
     if (DrawCompleted != null)
     {
         DrawCompleted(this , args);
     }
 }
示例#2
0
 public override void OnTap(GestureEventArgs e)
 {
     Point2D point = Map.ScreenToMap(e.GetPosition(Map));
     DrawEventArgs args = new DrawEventArgs
     {
         DrawName = Name,
         Element = new Pushpin { Location = point },
         Geometry = new GeoPoint(point.X, point.Y)
     };
     OnDrawComplete(args);
     base.OnTap(e);
 }
        private void endDraw(bool isCancel = false)
        {
            if (points != null)
            {
                PolygonElement pRegion = new PolygonElement()
                {
                    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
                };
                GeoRegion geoRegion = new GeoRegion();//构造返回的Geometry
                points.Add(startPt);//需要添加起始点做为最后一个点
                geoRegion.Parts.Add(points);

                DrawEventArgs args = new DrawEventArgs
                {
                    DrawName = Name,
                    Element = pRegion,
                    Geometry = geoRegion,
                    Canceled = isCancel
                };
                Deactivate();
                OnDrawCompleted(args);
            }
        }
示例#4
0
        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);
            }
        }
示例#5
0
 private void endDraw(double radius, bool isCancel = false)
 {
     if (this.ellipse != null)
     {
         //Point2D item = Map.ScreenToMap(e.GetPosition(Map));
         Rectangle2D b = ElementsLayer.GetBBox(ellipse);
         DrawEventArgs args2 = new DrawEventArgs
         {
             DrawName = Name,
             Element = ellipse, //可以由它的bbox得到半径
             Geometry = new GeoCircle(new Point2D(startPt.X, startPt.Y), radius), //返回圆的中心点
             Canceled = isCancel
         };
         Deactivate();
         OnDrawComplete(args2);
     }
 }
示例#6
0
        private void endDraw(bool isDblClick = false, bool isCancel = false)
        {
            if (points != null)
            {
                points.RemoveAt(points.Count - 2);
                if (isDblClick)
                {
                    points.RemoveAt(points.Count - 2);
                }

                PolygonElement pRegion = new PolygonElement()
                {
                    Point2Ds = points.Clone(),//不克隆,在返回后还与下面的GeoRegion指向一个内存地址
                    #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
                };//构造返回Element对象

                GeoRegion geoRegion = new GeoRegion();//构造返回的Geometry
                points.Add(startPoint);//需要添加起始点做为最后一个点
                geoRegion.Parts.Add(points);

                DrawEventArgs args = new DrawEventArgs
                {
                    DrawName = Name,
                    Element = pRegion,    //Element = this.polyline  //直接返回是固定像素的
                    Geometry = geoRegion,
                    Canceled = isCancel
                };

                Deactivate();
                OnDrawCompleted(args);
            }
        }
        private void endDraw(bool isCancel = false)
        {
            if (rectangle != null)
            {
                Rectangle2D bounds = (Rectangle2D)rectangle.GetValue(ElementsLayer.BBoxProperty);
                if (bounds.IsEmpty || bounds.Width == 0.0 || bounds.Height == 0.0)
                {
                    return;
                }

                //GeoRegion geoRegion = new GeoRegion();//构造返回的Geometry
                //Point2DCollection geoPoints = new Point2DCollection();
                //geoPoints.Add(bounds.BottomLeft);
                //geoPoints.Add(new Point2D(bounds.Right, bounds.Bottom));
                //geoPoints.Add(bounds.TopRight);
                //geoPoints.Add(new Point2D(bounds.Left, bounds.Top));
                //geoPoints.Add(bounds.BottomLeft);//需要添加起始点做为最后一个点
                //geoRegion.Parts.Add(geoPoints);
                GeoRegion geoRegion = bounds.ToGeoRegion();

                DrawEventArgs args2 = new DrawEventArgs
                {
                    DrawName = this.Name,
                    Element = this.rectangle,
                    Geometry = geoRegion,
                    Canceled = isCancel
                };

                Deactivate();
                OnDrawCompleted(args2);
            }
        }