public override void Tap(GestureEventArgs e) { Point2D point = _map.ScreenToMap(e.GetPosition(_map)); DrawEventArgs args = new DrawEventArgs { Geometry =new GeoPoint(point.X,point.Y) }; OnDrawComplete(args); base.Tap(e); }
private void OnDrawComplete(DrawEventArgs args) { if (DrawCompleted != null) { DrawCompleted(this, args); } }
private void endDraw(bool isCancel = false) { Rectangle2D bounds = this.map.Bounds; 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); DrawEventArgs args2 = new DrawEventArgs { Geometry = geoRegion }; Deactivate(); OnDrawCompleted(args2); }