${mapping_PolylineBase_Title}
${mapping_PolylineBase_Description}
Inheritance: ShapeElement
Ejemplo n.º 1
0
        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;
        }
Ejemplo n.º 2
0
        private void Activate(Point2D firstPoint)
        {
            DrawLayer = new ElementsLayer();
            if (Map.Layers == null)
            {
                return;
            }
            Map.Layers.Add(DrawLayer);

            _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);
            _pointsCount++;
            DrawLayer.Children.Add(_polyline);

            _isActivated = true;
        }
 private void Complete()
 {
     _points = null;
     _isActivated = false;
     _pointsCount = 0;
     _polyline = null;
     _textBlockContainer = null;
     _distances = null;
 }
        private void Activate(Point2D firstPoint)
        {
            _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);
            _pointsCount++;
            DrawLayer.Children.Add(_polyline);

            _textBlockContainer = new List<TextBlock>();
            TextBlock textblock = new TextBlock();
            textblock.FontWeight = FontWeights.ExtraBlack;
            textblock.Foreground = new SolidColorBrush(Colors.White);
            textblock.Text = "起点";
            _textBlockContainer.Add(textblock);
            DrawLayer.AddChild(textblock, firstPoint);

            _distances = new List<double>();
            _distances.Add(0);

            _isActivated = true;
        }
Ejemplo n.º 5
0
 /// <summary>${ui_action_FrawFreeLine_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);
     }
 }
Ejemplo n.º 6
0
        private void endDraw(bool isCancel = false)
        {
            if (points != null)
            {
                PolylineElement pLine = new PolylineElement()
                {
                    Point2Ds = 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,
                    Geometry = geoLine,
                    Canceled = isCancel
                };

                Deactivate();
                OnDrawCompleted(args);
            }
        }