SuperMap.Web.Actions.DrawRectangle.endDraw C# (CSharp) Method

endDraw() private method

private endDraw ( bool isCancel = false ) : void
isCancel bool
return void
        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);
            }
        }