Inheritance: Geometry
        internal GeoLine ToGeoLine()
        {
            if (this.Parts != null)
            {
                List<Point2DCollection> pss = new List<Point2DCollection>();
                Point2DCollection copy = new Point2DCollection();
                foreach (Point2D item in this.Points)
                {
                    copy.Add(item);
                }
                for (int i = 0; i < this.Parts.Count; i++)
                {
                    Point2DCollection temp = new Point2DCollection();
                    for (int j = 0; j < this.Parts[i]; j++)
                    {
                        temp.Add(copy[j]);
                    }
                    pss.Add(temp);

                    copy.RemoveRange(0, this.Parts[i]);
                }

                GeoLine line = new GeoLine();
                foreach (Point2DCollection item in pss)
                {
                    line.Parts.Add(item);
                }
                return line;
            }
            return null;
        }
Example #2
0
 /// <summary>${WP_core_GeoLine_method_clone_D}</summary>
 public override Geometry Clone()
 {
     GeoLine line = new GeoLine();
     if (this.Parts != null)
     {
         foreach (Point2DCollection points in this.Parts)
         {
             if (points != null)
             {
                 Point2DCollection item = new Point2DCollection();
                 foreach (Point2D point in points)
                 {
                     if (point != null)
                     {
                         item.Add(point.Clone());
                     }
                 }
                 line.Parts.Add(item);
                 continue;
             }
             line.Parts.Add(null);
         }
     }
     return line;
 }
Example #3
0
 /// <summary>${WP_utility_Extensions_method_ToGeoLine_D}</summary>
 public static GeoLine ToGeoLine(this PolylineElement polylineElement)
 {
     if (polylineElement != null && polylineElement.Point2Ds != null && polylineElement.Point2Ds.Count > 0)
     {
         GeoLine line = new GeoLine();
         line.Parts.Add(polylineElement.Point2Ds.Clone());
         return line;
     }
     return null;
 }
Example #4
0
 internal GeoLine Clip(GeoLine line)
 {
     GeoLine newLine = new GeoLine();
     foreach (Point2DCollection points in line.Parts)
     {
         IList<Point2DCollection> list = this.ClipPointCollection(points, this.boundary);
         if ((list != null) && (list.Count > 0))
         {
             foreach (Point2DCollection points2 in list)
             {
                 newLine.Parts.Add(points2);
             }
             continue;
         }
     }
     return newLine;
 }
Example #5
0
        private void Init(Point2D firstPoint)
        {
            if (_isInited)
            {
                return;
            }
            Deactivate();
            _line = new Feature();
            GeoLine line = new GeoLine();
            line.Parts = new System.Collections.ObjectModel.ObservableCollection<Point2DCollection>();
            line.Parts.Add(_points);
            PredefinedLineStyle style = new PredefinedLineStyle();
            style.Stroke = new SolidColorBrush(Colors.Red);
            style.StrokeThickness = 2;
            style.Symbol = PredefinedLineStyle.LineSymbol.Solid;
            _line.Geometry = line;
            _line.Style = style;
            _fLayer.AddFeature(_line);

            TextBlock first = new TextBlock();
            _distanceList.Add(first);
            first.FontWeight = FontWeights.ExtraBlack;
            first.Foreground = new SolidColorBrush(Colors.Black);
            first.Text = "起点";
            _eLayer.AddChild(first, firstPoint);
            _points.Add(firstPoint);
            _distances.Add(0);
            _isInited = true;
        }
Example #6
0
 //预留接口
 private static GeoLine ToGeoLine(XElement xe)
 {
     GeoLine line = new GeoLine();
     return line;
 }
Example #7
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);
            }
        }
Example #8
0
        //添加虚拟线;
        private void addHoverLineSegment(Point2D p0 , Point2D p1 , int index0 , int index1 , Feature feature , Point2DCollection points , int partIndex)
        {
            GeoLine line = new GeoLine();
            line.Parts.Add(new Point2DCollection() { p0 , p1 });
            Feature segment = new Feature() { Geometry = line , Style = hoverLineStyle };
            segment.SetZIndex(1);

            segment.Attributes.Add("Point2DCollection" , points);
            segment.Attributes.Add("Feature" , feature);
            segment.Attributes.Add("Index0" , index0);
            segment.Attributes.Add("Index1" , index1);
            segment.Attributes.Add("PartIndex" , partIndex);

            hoverLayer.Features.Add(segment);
        }