SuperMap.Web.Actions.DrawPolygon.Activate C# (CSharp) Method

Activate() private method

private Activate ( Point2D firstPoint ) : void
firstPoint SuperMap.Web.Core.Point2D
return void
        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);
            points.Add(firstPoint);
            points.Add(firstPoint);

            DrawLayer.Children.Add(polygon);

            isDrawing = true;
            isActivated = true;
        }